Daily Archives

Articles indexed Tuesday March 23 2010

Page 1/130 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Prove this Tautology (No Truth Tables)

    - by FSM
    This is for homework for my Discrete Math class. I understand how to prove tautologies with a truth table. I'm having trouble figuring out how to do it without though. I found this example in our text, but the solution is not provided. I was hoping someone could answer it as best they could so I could apply it to my other questions. Thanks! ! = not/invert ^ = and V = or - = if then [!P ^ (P V Q) ] - Q I also am completely lost for this question (I fear I'll be tested on something of this difficulty) [ (P - Q) ^ (Q - R) ] - (P - R) Thanks for the help all!

    Read the article

  • Load Average runaway

    - by mewrei
    Is there any way to chase down lockups and runaway load averages? Every so often (pretty randomly) I'll get my load average spike up over 5 usually to around 10-15 and sometimes as high as 75 (dual core machine), and cause my system to lock for an indeterminate amount of time. The only thing I can possibly chase it to is using nVidia fakeraid (RAID-1) with JFS on top of that for my /home partition. Also I noticed that when my load averages spike, the power management system doesn't step up my processor speed from 1.6 to its maximum 2.13Ghz clock speed (not sure if this makes a huge difference with this problem). Any ideas?

    Read the article

  • Using .NET's HttpWebRequest to download a multitude of files in a row

    - by Cornelius
    I have an application that needs to download several files in a row in succession (sometimes a few thousand). However, what ends up happening when several files need to be downloaded is I get an exception with an inner exception of type SocketException and the error code 10048 (WSAEADDRINUSE). I did some digging and basically it's because the server has run out of sockets (and they are all waiting for 240s or so before they become available again) - not coincidentally it starts happening around the 1024 file range. I would expect that the HttpWebRequest/ServicePointManager would be reusing my connection, but apparently it is not (and the files are https, so that may be part of it). I never saw this problem in the C++ code that this was ported from (but that doesn't mean it didn't ever happen - I'd be surprised if it was, though). I am properly closing the WebRequest object and the HttpWebRequest object has KeepAlive set to true by default. Next my intent is to fiddle around with ServicePointManager.SetTcpKeepAlive(). However, I can't see how more people haven't run into this problem. Has anyone else run into the problem, and if so, what did you do to get around it? Currently I have a retry scheme that detects this error and waits it out, but that doesn't seem like the right thing to do. Here's some basic code to verify what I'm doing (just in case I'm missing closing something): WebRequest webRequest = WebRequest.Create(uri); webRequest.Method = "GET"; webRequest.Credentials = new NetworkCredential(username, password); WebResponse webResponse = webRequest.GetResponse(); try { using(Stream stream = webResponse.GetResponseStream()) { // read the stream } } finally { webResponse.Close() }

    Read the article

  • .NET How can i set field value on value type using reflection

    - by soccerazy
    .NET I want to clone a value type's fields. How can i set a field value on a value type using reflection (or something else dynamically)? This works for reference types but not for value types. I understand why but I don't know an alternative. shared function clone(of t)(original as t) as t dim cloned as t 'if class then execute parameterless constructor if getType(t).isClass then cloned = reflector.construct(of t)() dim public_fields = original.getType.getFields() for each field in public_fields dim original_value = field.getValue(original) 'this won't work for value type, but it does work for reference type ??? field.setValue(cloned, original_value) next return cloned end function

    Read the article

  • How to insert inline content from one FlowDocument into another?

    - by Robert Rossney
    I'm building an application that needs to allow a user to insert text from one RichTextBox at the current caret position in another one. I spent a lot of time screwing around with the FlowDocument's object model before running across this technique - source and target are both FlowDocuments: using (MemoryStream ms = new MemoryStream()) { TextRange tr = new TextRange(source.ContentStart, source.ContentEnd); tr.Save(ms, DataFormats.Xaml); ms.Seek(0, SeekOrigin.Begin); tr = new TextRange(target.CaretPosition, target.CaretPosition); tr.Load(ms, DataFormats.Xaml); } This works remarkably well. The only problem I'm having with it now is that it always inserts the source as a new paragraph. It breaks the current run (or whatever) at the caret, inserts the source, and ends the paragraph. That's appropriate if the source actually is a paragraph (or more than one paragraph), but not if it's just (say) a line of text. I think it's likely that the answer to this is going to end up being checking the target to see if it consists entirely of a single block, and if it does, setting the TextRange to point at the beginning and end of the block's content before saving it to the stream. The entire world of the FlowDocument is a roiling sea of dark mysteries to me. I can become an expert at it if I have to (per Dostoevsky: "Man is the animal who can get used to anything."), but if someone has already figured this out and can tell me how to do this it would make my life far easier.

    Read the article

  • Extracting pair member in lambda expressions and template typedef idiom

    - by Nazgob
    Hi, I have some complex types here so I decided to use nifty trick to have typedef on templated types. Then I have a class some_container that has a container as a member. Container is a vector of pairs composed of element and vector. I want to write std::find_if algorithm with lambda expression to find element that have certain value. To get the value I have to call first on pair and then get value from element. Below my std::find_if there is normal loop that does the trick. My lambda fails to compile. How to access value inside element which is inside pair? I use g++ 4.4+ and VS 2010 and I want to stick to boost lambda for now. #include <vector> #include <algorithm> #include <boost\lambda\lambda.hpp> #include <boost\lambda\bind.hpp> template<typename T> class element { public: T value; }; template<typename T> class element_vector_pair // idiom to have templated typedef { public: typedef std::pair<element<T>, std::vector<T> > type; }; template<typename T> class vector_containter // idiom to have templated typedef { public: typedef std::vector<typename element_vector_pair<T>::type > type; }; template<typename T> bool operator==(const typename element_vector_pair<T>::type & lhs, const typename element_vector_pair<T>::type & rhs) { return lhs.first.value == rhs.first.value; } template<typename T> class some_container { public: element<T> get_element(const T& value) const { std::find_if(container.begin(), container.end(), bind(&typename vector_containter<T>::type::value_type::first::value, boost::lambda::_1) == value); /*for(size_t i = 0; i < container.size(); ++i) { if(container.at(i).first.value == value) { return container.at(i); } }*/ return element<T>(); //whatever } protected: typename vector_containter<T>::type container; }; int main() { some_container<int> s; s.get_element(5); return 0; }

    Read the article

  • .NET: How Do I Create File Icon Overlays

    - by Maxim Z.
    I'm trying to add different icon overlays over the icons of various files (note: not all the files of a certain type, just certain files). If you don't get what I mean, I'm referring to what programs like TortoiseSVN, TortoiseHG, Dropbox, etc. do. Can this be done in .NET? If so, how? I'm hoping there's a library out there for this. I found this CodeProject article about something like this, but it's not .NET. Thanks in advance.

    Read the article

  • Revisiting .NET, but what should I focus on?

    - by Wayne M
    After about a two-year hiatus, I'm brushing up on my .NET skills to find a .NET job (my previous two positions have very little development, or development using legacy technologies, so apart from a few very minor apps I have not touched .NET in close to two years). I'm aware of things like ASP.NET MVC, and I have previously read on things like NHibernate and DI/IOC, albeit I have yet to use them apart from very trivial "Hello World" type applications. I have a subscription to Rob Conery's Tekpub website and occasionally watch these videos when I have free time. My concern is this: I don't live in a very technical area. I would be surprised if any but the most tech-savvy companies have heard of, let alone use, ASP.NET MVC, NHibernate (or even LINQ/EF), or know about IoC. I would be willing to bet a large sum of money that 95% of the possible jobs I could obtain will use the following: Visual Source Safe, if any VCS at all ASP.NET 2.0 Webforms (3.5 if lucky) Raw ADO.NET on top of a very thin implementation of the Gateway pattern Stored Procedures in the database for most CRUD operations Gratuitous use of code-behind, with a Service layer if I'm lucky If I were extremely lucky, I might find a shop that has heard of ORMs and either uses one, or has wrote their own data abstraction. Also if I were lucky, the company would be using Model-View-Presenter. In light of this I'm not sure what I should focus on learning. Personally, I would prefer to be using the latest stuff - ASP.NET MVC, NHibernate, jQuery, WCF etc. Reality says I should go back to the basics, since it looks like most potential opportunities aren't going to be anywhere near the cutting edge, or anywhere close to it. And, as much as I would like to find a position and start to show the other developers the benefits, in my past experience this has usually resulted in my being fired for "not being a team player" and doing things the bad old way. So, I am curious how you would approach a situation like this? What should I focus on, in order to A) Reaquaint myself with .NET, and B) Prepare myself to obtain a .NET job again that is more than likely going to use techniques that I and most other knowledgeable developers will scoff at?

    Read the article

  • YUI Menu rendering below "fold" on first open

    - by Flash84x
    I have a YUI menu on the bottom navigation of the screen which creates a large white space beneath it where the action list would be rendered if visible... On the first click the menu will render in that white space which requires the user to scroll to see it... on the second click however it will draw upward (ideally) so that the user does not have to scroll to see the menu... the second click also kills that block of white space... i found adding a style of display:none to the div kills the white space... but then YUI doesn't set the display to block, which from what I understood it should... so I wrote another method that would do that manually... but the same behavior happens, the menu first renders below the fold requiring the user to scroll.... 2nd time its works fine... some reason the top/left positions are not being calculated properly on the first click and i cannot seem to figure out why

    Read the article

  • memory not freed in matlab?

    - by noam
    I am running a script that animates a plot (simulation of a water flow). After a while, I kill the loop by doing ctrl-c. After doing this several times I get the error: ??? Error: Out of memory. And after I start receiving that error, every call to my script will generate it. Now, it happens before anything inside the function that I am calling is executed, i.e even if I add the line a=1 as the first line of the function I am calling, I still get the error and no printout, so the code inside the function doesn't even get executed. What could be causing this?

    Read the article

  • How do I make the 32-bit Perl read the 64-bit Windows registry?

    - by Santhosh
    I have a 32-bit perl installer. Using this I need to be able to install and uninstall both 32- and 64-bit applications. Installing 32- and 64-bit is fine. Uninstalling 32-bit is also ok. However, I have a problem while uninstalling 64-bit applications. The application just knows the name of the application as seen in Add Remove programs in control panel. For instance it could be "Winzip 14.0" which is the display name for Winzip. I use the following approach for uninstallation : I traverse to HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall and parse the keys present there to see if Winzip is matching. If so i get the uninstall string from there. my $register = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; $HKEY_LOCAL_MACHINE->Open($register,$hKey)|| die $!; #Then parse all the nodes and fetch the uninstall string If the application is a 64-bit installation, then the uninstallation information will reside in HKLM/Software/Microsoft/Windows/CurrentVersion/Uninstall. However the above given perl installer code is trying to read from HKLM/Software/WOW6432Node/Microsoft/Windows/CurrentVersion/Uninstall and it does not find the installation there. So how do I make the Perl code running in a 32_bit process to read the registry value found in 64-bit hive? I am aware of the RegOpenKey() API that takes KEY_WOW64_64KEY parameter. But since it is a Windows API, I dont know if that will help. Even then, is there any other alternative?

    Read the article

  • jquery, changing form action

    - by Jason
    i cannot seem to find the answer to this. i uploaded code to pastebin (so wouldnt clutter up the post): http://pastebin.com/BhnNTnJM but the action only changes for the delete form (id=form-horse-delete) and not the other 2 forms located on the page. i am at my wits end trying to figure out why it doesn't work for the 2 forms, yet will work for the 1 form. in IE, if i try and change the action of the 2 forms, it gives a javascript error. but if i take out the change, it works fine with no javascript error.

    Read the article

  • Haskell's type system treats a numerical value as function?

    - by Long
    After playing around with haskell a bit I stumbled over this function: Prelude Data.Maclaurin> :t ((+) . ($) . (+)) ((+) . ($) . (+)) :: (Num a) => a -> (a -> a) -> a -> a (Data.Maclaurin is exported by the package vector-space.) So it takes a Num, a function, another Num and ultimately returns a Num. What magic makes the following work? Prelude Data.Maclaurin> ((+) . ($) . (+)) 1 2 3 6 2 is obviously not a function (a-a) or did I miss out on something?

    Read the article

  • ICU MessageFormat Currency Value Precison Lost

    - by Travis
    This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand. When using the MesssageFormat class, why for a certain locale (Korea "ko"KR" for example) does it round currency values (e.g. 100.50 becomes ?101). For most locales (such as the US "en_US"), the precision of the argument passed in remains untouched (e.g. 100.50 becomes $100.50). I thought this might be a default rounding issue that some locales have (Swiss Francs "fr_CH" for example have a default 0.05 rounding) but South Korea "ko_KR" has none. Any ideas?

    Read the article

  • linq to sql -> join

    - by ile
    SQL query: SELECT ArticleCategories.Title AS Category, Articles.Title, Articles.[Content], Articles.Date FROM ArticleCategories INNER JOIN Articles ON ArticleCategories.CategoryID = Articles.CategoryID Object repository: public class ArticleRepository { private DB db = new DB(); // // Query Methods public IQueryable<Article> FindAllArticles() { var result = from category in db.ArticleCategories join article in db.Articles on category.CategoryID equals article.CategoryID select new { CategoryID = category.CategoryID, CategoryTitle = category.Title, ArticleID = article.ArticleID, ArticleTitle = article.Title, ArticleDate = article.Date, ArticleContent = article.Content }; return result; } .... } And finally, I get this error: Error 1 Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Linq.IQueryable'. An explicit conversion exists (are you missing a cast?) C:\Documents and Settings\ilija\My Documents\Visual Studio 2008\Projects\CMS\CMS\Models\ArticleRepository.cs 29 20 CMS Any idea what did I do wrong? Thanks, Ile

    Read the article

  • Removing specific QueryStrings

    - by iTayb
    Let's assume an aspx page gets multiple querystrings, for example books.aspx?author=Arthor&level=4&year=2004. I'd like to create a button that clears specific querystrings. For example when clearAuthorBtn is clicked, user should be redirected to books.aspx?level=4&year=2004 How can I make it? Thank you very much.

    Read the article

  • Recommendation for Ethernet switches that allow arbitrary network topologies

    - by sblair
    We have the following requirements for three Ethernet switches that will be connected together: Allow the switches to connect together to form dynamic, arbitrary topologies, i.e., support for the RSTP is essential. Allow the physical topology (which ports are connected together) to be gleaned from the switches, e.g., using SNMP traps. This is optional, but would be very useful. At least 5 ports on each switch, but only 3 will be used for connecting the switches together. Be as compact as possible. Ideally be in stock, in the UK. Only 100Mb/s is required. (This question is the result of the lack of RSTP support from 3Com NJ225 devices, as described in my previous question.)

    Read the article

  • Usability Problems with RDP and Dual Monitors

    - by Stung
    Hi All, When I RDP into a win2k3 machine with the dual mon settings, I've noticed that there are a couple of usability problems: 1) Dialog boxes are popped up right in the middle of both monitors making it hard to read. 2) Windows are maximized to both monitors instead of just one. 3) The task bar spans across two monitors. (This is just a matter of preference. I prefer my task bar to span across just my primary monitor) I know that Splitview is a good tool that solves all these problems, but there's a price-tag to it. To be fair, $39 for a tool like this is not too bad at all. However, before I suggest this tool to my team and manager to get the licenses for it, are there any free alternatives that will solve the 3 above problems? -Steve

    Read the article

  • not so obvious pointers

    - by mike_hornbeck
    I have a class : class X{ public : void f ( int ) ; int a ; } ; And the task is "Inside the code provide declarations for : pointer to int variable of class X pointer to function void(int) defined inside class X pointer to double variable of class X" Ok so pointer to int a will be just int *x = &a, right ? If there is no double in X can I already create pointer to double inside this class ? And the biggest problem is the second task. How one declares pointer to function ?

    Read the article

  • Exception when creating MailMessage

    - by Julien Poulin
    I'm getting a FormatException telling me the address '[email protected]' is invalid (I'm guessing because of the '-'). Here is the code I'm using: var md = new MailDefinition(); md.BodyFileName = physicalPath; md.Subject = subject; md.From = from; md.CC = cc; md.IsBodyHtml = true; MailMessage mailMessage = md.CreateMailMessage(to, replacements, owner); Is there a bug in the .Net e-mail parser? I am sure this address is valid since it belongs to a friend and I have no problem sending and receiving his e-mails with Outlook. Is there a way to fix this? EDIT: Here is the stacktrace: [FormatException: La chaîne spécifiée n'est pas de la forme requise pour une adresse de messagerie.] System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) +1141755 System.Net.Mail.MailAddress.ParseValue(String address) +240 System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +85 System.Net.Mail.Message..ctor(String from, String to) +122 System.Net.Mail.MailMessage..ctor(String from, String to) +114 System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, String body, Control owner) +1366 System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, Control owner) +290 WebNotificationManager.CreateMessage(Page owner, MessageTemplate messageTemplate, ListDictionary replacements, String to, String from, String cc, String subject) in c:\dev\SoccerMania\SoccerMania\App_Code\WebNotificationManager.cs:41 WebNotificationManager.SendMessage(Page owner, MessageTemplate messageTemplate, ListDictionary replacements, String to, String subject) in c:\dev\SoccerMania\SoccerMania\App_Code\WebNotificationManager.cs:22 inscription.bInscription_Click(Object sender, EventArgs e) in c:\dev\SoccerMania\SoccerMania\Inscription.aspx.cs:54 System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +111 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +79 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

    Read the article

  • Strange Integer.parseInt exception

    - by Albinoswordfish
    Exception in thread "Thread-2" java.lang.NumberFormatException: For input string: "3" int test = Integer.parseInt(result[0]); This is the error I keep getting when I'm trying to convert "3" to an integer. Well I'm receiving this "3" through a RS-232 port, so maybe this is what is causing the error. If anybody has any idea what could be causing this it would be appreciated.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >