Search Results

Search found 21001 results on 841 pages for 'spelling check'.

Page 55/841 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • C# Events and Lambdas, alternative to null check?

    - by Eugarps
    Does anybody see any drawbacks? It should be noted that you can't remove anonymous methods from an event delegate list, I'm aware of that (actually that was the conceptual motivation for this). The goal here is an alternative to: if (onFoo != null) onFoo.Invoke(this, null); And the code: public delegate void FooDelegate(object sender, EventArgs e); public class EventTest { public EventTest() { onFoo += (p,q) => { }; } public FireFoo() { onFoo.Invoke(this, null); } public event FooDelegate onFoo; }

    Read the article

  • check if a tree is complete standard ml

    - by aizen92
    I want to make a function in standard ml that checks if a tree is complete or not, the function somehow works, but its giving me the wrong type and a warning of non-exhaustive cases The tree code: datatype 'data tree = EMPTY | NODE of 'data tree * 'data * 'data tree; fun isComplete EMPTY = true | isComplete (NODE(x, y, z)) = if (x = EMPTY andalso z <> EMPTY) orelse (x <> EMPTY andalso z = EMPTY) then false else true; Now the above function's type is: ''a tree -> bool but the required type is 'a tree -> bool The warning I'm having is: stdIn:169.8 Warning: calling polyEqual stdIn:169.26 Warning: calling polyEqual stdIn:169.45-169.47 Warning: calling polyEqual stdIn:169.64-169.66 Warning: calling polyEqual stdIn:124.1-169.94 Warning: match nonexhaustive NODE (x,y,z) => ... What is the problem I'm having?

    Read the article

  • Bash script to (more or less) reliably check if the internet is up

    - by João Portela
    I need a bash script to put in a cron job that every minute checks if the internet is up. This is how I did it: #! /bin/sh host1=google.com host2=wikipedia.org curr_date=`date +"%Y%m%d%H%M"` echo -n "${curr_date};" ((ping -w5 -c3 $host1 || ping -w5 -c3 $host2) > /dev/null 2>&1) && echo "up" || (echo "down" && exit 1) How would you do it? Which hosts would you ping? Thanks in advance.

    Read the article

  • Creating an Attribute to check for Exceptions

    - by BiffBaffBoff
    I'm creating an attribute so that whenever an exception occurs on my site, I'll receive an email detailing the exception. I've got so far but my Attribute code doesn't seem to fire if an exception occurs: public class ReportingAttribute : FilterAttribute, IExceptionFilter { public void OnException(ExceptionContext filterContext) { // This will generate an email to me ErrorReporting.GenerateEmail(filterContext.Exception); } } Then above my Controller I'm doing: [ReportingAttribute] public class AccountController : Controller The other way to do it is ofcourse putting ErrorReporting.GenerateEmail(ex) inside my catch blocks? There must be a simpler way? Thats why I thought of creating the Attribute to handle this

    Read the article

  • check if a line is valid or not in Java

    - by Adnan
    I would like to perform checking on the following: VALID LINES; /**/ some code */ some code /** dsfsdkf sd**/ NOT VALID LINES; /**/ //some code */ /***/ //somecode So basically if there is a line of code outside a comment it is valid, otherwise not. What would be the best way to tackle this kind of validation? Note: For */ I assume that the /* has been opened some lines before.

    Read the article

  • Use deployJava.js to check for/automatically install latest JRE version for web applet

    - by Pryo
    I'd like to use the deployJava.js tool to have Java automatically detect the currently installed JRE and install an updated version if necessary. My initial impression when reading about deployJava.js was that it would do this out of the box when you simply set a version number as a function parameter for the "runApplet" function. But this has never seemed to work. Is it even possible to do this, and if so, how? Here is my current code for launching my applet: <script type="text/javascript" src="https://www.java.com/js/deployJava.js"></script> <script type="text/javascript"> var attributes = {id:"applet", name:"TheApplet", code:"TheApplet"}; var parameters = {jnlp_href: "http://localhost/TheApplet.jnlp"}; deployJava.runApplet(attributes, parameters, "1.6.0_31"); </script> Thanks

    Read the article

  • Python - how to check if weak reference is still available

    - by Alex
    Hi all, I am passing some weakrefs from Python into C++ class, but C++ destructors are actively trying to access the ref when the real object is already dead, obviously it crashes... Is there any Python C/API approach to find out if Python reference is still alive or any other known workaround for this ? Thanks

    Read the article

  • Check a list of packages to install with apt-get

    - by Joel
    I am writing a post-install script for Ubuntu in Perl (same script as seen here). One of the steps is to install a list of packages. The problem is that if apt-get install fails in some of many different ways for any one of the packages the script dies badly. I would like to prevent that from happening. This happens because of the ways that apt-get install fails for packages that it doesn't like. For example when I try to install a nonsense word (i.e. typed in the wrong package name) $ sudo apt-get install oblihbyvl Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package oblihbyvl but if instead the package name has been obsoleted (installing handbrake from ppa) $ sudo apt-get install handbrake Reading package lists... Done Building dependency tree Reading state information... Done Package handbrake is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'handbrake' has no installation candidate $ apt-cache search handbrake handbrake-cli - versatile DVD ripper and video transcoder - command line handbrake-gtk - versatile DVD ripper and video transcoder - GTK GUI I have tried parsing the results of apt-cache and apt-get -s install to try to catch all possibilities before doing the install, but I seem to keep finding new ways to allow failures to continue to the actual install system command. My question is, is there some facility either in Perl (e.g. a module, though I would like to avoid installing modules if possible as this is supposed to be the first thing run after a new install of Ubuntu) or apt-* or dpkg that would let me be sure that the packages are all available to be installed before installing and if not fail gracefully in some way that lets the user decide what to do?

    Read the article

  • Multiple dropdown combination check and filter

    - by Tom
    Using Javascript / jQuery, I'm trying to build a "combination checker" that will take the values of three (but can be more) dropdown lists and filter the options based on a supplied list of allowed combinations. For example: DROPDOWNS Field 1: - value_1 - value_2 Field 2: - value_3 Field 3: - value_4 - value_5 COMBINATIONS - value_1, value_3, value_5 - value_1, value_3, value_4 - value_2, value_3, value_5 When a user selects Field 3 - value_4, the unavailable options will be disabled - ie, Field 1 - value_2 (there is no combination that allows value_2 and value_4 to be selected together). It would be really great if someone could provide some pointers on how this can be achieved or just provide a fresh perspective - I'm going round in circles on this one!

    Read the article

  • To check the default select value tag!

    - by Small Wolf
    I have a question.Here is the code! f.select(:departments,Department.all.collect{|c|[c.name,c.id]},{},:size=>10,:multiple => ture) class Emergency has many :departments end the html source like this: <select id="emergency_departments" multiple="multiple" name="emergency[departments][]" size="10"><option value ="">""</option>....</select> now I want to get the default selected tag , who can tell me how ?

    Read the article

  • How to hash and check for equality of objects with circular references

    - by mfya
    I have a cyclic graph-like structure that is represented by Node objects. A Node is either a scalar value (leaf) or a list of n=1 Nodes (inner node). Because of the possible circular references, I cannot simply use a recursive HashCode() function, that combines the HashCode() of all child nodes: It would end up in an infinite recursion. While the HashCode() part seems at least to be doable by flagging and ignoring already visited nodes, I'm having some troubles to think of a working and efficient algorithm for Equals(). To my surprise I did not find any useful information about this, but I'm sure many smart people have thought about good ways to solve these problems...right? Example (python): A = [ 1, 2, None ]; A[2] = A B = [ 1, 2, None ]; B[2] = B A is equal to B, because it represents exactly the same graph. BTW. This question is not targeted to any specific language, but implementing hashCode() and equals() for the described Node object in Java would be a good practical example.

    Read the article

  • I want to retrieve check items of list view

    - by kamil
    for(int i=0;i < users.size();i++) { map = new HashMap<String, String>(); map.put("id",String.valueOf(i)); map.put("userID", String.valueOf(users.get(i).getUserId())); map.put("emailID", users.get(i).getEmailAddress()); memList.add(map); } ListAdapter adapter = new SimpleAdapter(this, memList , R.layout.member_list_view, new String[] { "emailID" },new int[] { R.id.memTextView}); memberList.setAdapter(adapter); I have to retrieve the checked items on a separate button listener. how can I? I am using a customize list view. Plz help...

    Read the article

  • Infinite recursion trying to check all elements of a TreeCtrl

    - by mavnn
    I have a TreeCtrl in which more than one Item can be assigned the same object as PyData. When the object is updated, I want to update all of the items in the tree which have that object as their PyData. I thought the following code would solve the problem quite neatly, but for some reason the logical test (current != self.GetFirstVisibleItem()) always returns true leading to infinite recursion. Can anyone explain why? def RefreshNodes(self, obj, current=None): print "Entered refresh" current = current or self.GetFirstVisibleItem() if current.IsOk(): print self.GetPyData(current).name if self.GetPyData(current) == obj: self.RefreshNode(current) current = self.GetNextVisible(current) if current != self.GetFirstVisibleItem(): self.RefreshNodes(obj, current) Edit: the above is obviously part of a class based on wx.TreeCtrl

    Read the article

  • check if username exists on form submit

    - by Developer
    This is my code. .js $(document).ready(function() { $("#username").focusout(function() { $.ajax({ type:'post', url:site_url()+'/client/checkUserName', data:{'username':$("#username").val()}, dataType:'json', success:function(result){ if(result != 'false'){ $('#message').text('Username exists'); } } }); }); .html <form id='form1' method="post"> <input type="text" name="username" id="username"/> <span id="message" style="color:red"></span> <input type="submit" value="submit" id="regis" class="btn"/> </form> Its working fine on focusout. How to make the form to not submit if username exists? Suppose there is a hidden field in the form say <input type="text" hidden id="type" value="<?php echo $type;?>"> Then if value exists in the hidden field then the username neednot be checked if already exists or not.

    Read the article

  • how to check if a path is actual or symbolic link

    - by hits_lucky
    Hi, I am writing my own shell program. I am currently implementing the cd command using chdir. I want to implement the cd with the below options : -P Do not follow symbolic links -L Follow symbolic links (default) My query is that , when a given path is entered on the shell how to figure out if the path is a symbolic link or an absolute path progamatically? Thanks

    Read the article

  • Codeigniter: Check where model is loaded from?

    - by qwerty
    I'm having the strangest thing ever right now. I "disabled" a model because i don't need to access it ever again. I did so by echoing out an error string in the __construct() and right after that die(). That way i would notice if i ever loaded the model, even by mistake, which should never happen. Alright? The problem is, the model is not loaded ANYWHERE in the entire project, but it still gets loaded for some reason. It's not auto loaded, that's for sure. Is it possible to track down where a model is loaded? Like which line it happens etc?

    Read the article

  • Android: How to periodically check current location without draining the battery

    - by uyahalom
    I have a background service which works periodically by timer.scheduleAtFixedRate. It wakes up every amount of time (let's say 60 seconds for example) and checks for the location. The location is checked by locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 60000, 5, listener); and the actual location is collected from the listener's onLocationChanged. Now, when the phone is outside and GPS reception is good, this works fine. But, if the phone is inside, the GPS is almost always active - looking for a signal, and the battery is drained rapidly. I created another thread using a Handler and a Runnable in order to conrol the GPS active time accurately: I used locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, listener); and locManager.removeUpdates(listener); so I can open and close the GPS as I want. In this case, I can open the GPS for the exact amount of time, but found out that it doesn't lock in an area with good reception even after 10 seconds. So here I'm draining the battery again... I'm using API level 7, hence I cannot use locationManager.requestSingleUpdate. I have two questions: Is there any way to optimize this process? Will upgrading to API level 9 (and use locationManager.requestSingleUpdate) improve the process significantly? I mean, does it worth upgrading?

    Read the article

  • MySQL range date overlap check

    - by Glide
    This table is used to store sessions CREATE TABLE session ( id int(11) NOT NULL AUTO_INCREMENT , start_date date , end_date date ); INSERT INTO session (start_date, end_date) VALUES ("2010-01-01", "2010-01-10") , ("2010-01-20", "2010-01-30") , ("2010-02-01", "2010-02-15") ; We don't want to have conflict between ranges Let's say we need to insert a new session from 2010-01-05 to 2010-01-25 We would like to know the conflicting session(s). Here is my query: SELECT * FROM session WHERE TRUE AND ("2010-01-05" BETWEEN start_date AND end_date OR "2010-01-25" BETWEEN start_date AND end_date OR "2010-01-05" >= start_date AND "2010-01-25" <= end_date ) ; Here is the result: +----+------------+------------+ | id | start_date | end_date | +----+------------+------------+ | 1 | 2010-01-01 | 2010-01-10 | | 2 | 2010-01-20 | 2010-01-30 | +----+------------+------------+ Is there a better practice way to get that ?

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >