Search Results

Search found 11178 results on 448 pages for 'syntax checking'.

Page 44/448 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • javascript: Checking if tags are next to each other

    - by user3731759
    So here is the problem: I want to check if element <x-statement> is right next to <p> and there is no text in between them. So this will return true: <div> <x-statement>[discover.prev]</x-statement> <p>Go forward<p> </div> But this won't: <div> <x-statement>[discover.prev]</x-statement> im in the way herr der <p>Go forward<p> </div> This what I've tried to do: if($(this).next().is('p')){ alert("p is next to you"); }

    Read the article

  • C++ - checking if a class has a certain method at compile time

    - by jetwolf
    Here's a question for the C++ gurus out there. Is there a way to check at compile time where a type has a certain method, and do one thing if it does, and another thing if it doesn't? Basically, I have a template function template <typename T> void function(T t); and I it to behave a certain way if T has a method g(), and another way if it doesn't. Perhaps there is something that can be used together with boost's enable_if? Something like this: template <typename T> enable_if<has_method<T, g, void ()>, void>::type function(T t) { // Superior implementation calling t.g() } template <typename T> disable_if<has_method<T, g, void ()>, void>::type function(T t) { // Inferior implementation in the case where T doesn't have a method g() } "has_method" would be something that preferably checks both that T has a method named 'g', and that the method has the correct signature (in this case, void ()). Any ideas?

    Read the article

  • BASH: Checking for environment variables

    - by Hamza
    Hi folks, I am trying to check the value of an environment variable and depending on the value do certain things and it works fine as long as the variable is set. When it isn't though I get a whole bunch of errors (as BASH is trying to compare the string I specify with an undefined variable, I guess) I tried implementing an extra check to prevent it happening but no luck. The block of code I am using is: #!/bin/bash if [ -n $TESTVAR ] then if [ $TESTVAR == "x" ] then echo "foo" exit elif [ $TESTVAR == "y" ] then echo "bar" exit else echo "baz" exit fi else echo -e "TESTVAR not set\n" fi And this the output: $ export TESTVAR=x $ ./testenv.sh foo $ export TESTVAR=y $ ./testenv.sh bar $ export TESTVAR=q $ ./testenv.sh baz $ unset TESTVAR $ ./testenv.sh ./testenv.sh: line 5: [: ==: unary operator expected ./testenv.sh: line 9: [: ==: unary operator expected baz My question is, shouldn't 'unset TESTVAR' nullify it? It doesn't seem to be the case... Thanks.

    Read the article

  • How to checking wether an object has a specific method or not

    - by Ghommey
    Hey, I want to use a method of an object. Like $myObject->helloWorld(). However there are a couple of methods so I loop through an array of method names and call the method like this: my $methodName ="helloWorld"; $myObject->$methodNames; This works quite nice but some objects don't have all methods. How can I tell wether $myObject has a method called helloWorld or not?

    Read the article

  • checking mongo database for data

    - by user1647484
    I'm playing around with this tutorial that uses Sinatra, backbone.js, and mongodb for the database. It's my first time using mongo. As far as I understand it the app uses both local storage and a database. it has these routes for the database. For example, it has these routes get '/api/:thing' do DB.collection(params[:thing]).find.to_a.map{|t| from_bson_id(t)}.to_json end get '/api/:thing/:id' do from_bson_id(DB.collection(params[:thing]).find_one(to_bson_id(params[:id]))).to_json end post '/api/:thing' do oid = DB.collection(params[:thing]).insert(JSON.parse(request.body.read.to_s)) "{\"_id\": \"#{oid.to_s}\"}" end After turning the server off and then on, I could see in the server getting data from the database routes 127.0.0.1 - - [17/Sep/2012 08:21:58] "GET /api/todos HTTP/1.1" 200 430 0.0033 My question is, how can I check from within the mongo shell whether the data's in the database? I started the mongo shell ./bin/mongo I selected the database 'use mydb' and then looking at the docs (http://www.mongodb.org/display/DOCS/Tutorial) I tried commands such as > var cursor = db.things.find(); > while (cursor.hasNext()) printjson(cursor.next()); but they didn't return anything.

    Read the article

  • Checking if a function has C-linkage at compile-time

    - by scjohnno
    Is there any way to check if a given function is declared with C-linkage (that is, with extern "C") at compile-time? I am developing a plugin system. Each plugin can supply factory functions to the plugin-loading code. However, this has to be done via name (and subsequent use of GetProcAddress or dlsym). This requires that the functions be declared with C-linkage so as to prevent name-mangling. It would be nice to be able to throw a compiler error if the referred-to function is declared with C++-linkage (as opposed to finding out at runtime when a function with that name does not exist). Here's a simplified example of what I mean: extern "C" void my_func() { } void my_other_func() { } // Replace this struct with one that actually works template<typename T> struct is_c_linkage { static const bool value = true; }; template<typename T> void assertCLinkage(T *func) { static_assert(is_c_linkage<T>::value, "Supplied function does not have C-linkage"); } int main() { assertCLinkage(my_func); // Should compile assertCLinkage(my_other_func); // Should NOT compile } Thanks.

    Read the article

  • javascript window.location gives me a wrong url path when checking firebug

    - by Elson Solano
    I have a sample url website: http://mysite.com/ var host = window.location.protocol+"://"+window.location.hostname; $.ajax({ type:"POST", data: params, url : host+'/forms/get_data.php', success:function(data){ ...othercodeblahblah } }); Why is it that when I try to check my firebug it makes the URL weird. This is the sample output of firebug: http://mysite.com/mysite.com/forms/get_data.php With this url it now gives me: "NetworkError: 404 Not Found - http://mysite.com/mysite.com/forms/get_data.php" Shouldn't it output like http://mysite.com/forms/get_data.php ? Why is it giving me a wrong url path? Your help would be greatly appreciated and rewarded! Thank!

    Read the article

  • checking all checkboxes are checked using jquery

    - by kumar
    Hello friends I have two button one is SelectAll then MassEdit.. my code for select all is $('#btnAll').click(function() { $('#ExceptionDetails input[type=checkbox]').attr('checked', 'checked'); }); this check all the chekcboxes in my view.. then I have other button code which needs to take only checked checkbox information to send it other page.. to display only checked checkbox users.. $('#btnMassEdit').click(function() { $('#ExceptionDetails input[type=checkbox]').each(function() { if ($(this).attr('checked')) { $('#specialist-tab').tabs('url', 3, '<%=Url.Action("getmasseditexceptions", "Expense", new { @GUI_SPEC_STAT_DSPL = GUI_SPEC_STAT_DSPL, @C_EXCPT_CATG = C_EXCPT_CATG, @C_EXCPT_TYPE = C_EXCPT_TYPE })%>').tabs('enable', 3).tabs('select', 3); return false; } else { alert("please select atleast one exceptin"); $().ShowDialog('Please Select Exception, Select atleast one exception'); return false; } }); }); i have a fieldset which is ExceptionDetails..one field set have only one checkbox.. but my view having multiple fieldsets for differnt exceptions.. I need to check all the filedsset which is checked or not what ever the fieldset checkboxes are check I need to take only that exception to pass to the other page.. thanks

    Read the article

  • Checking up remotely on Website Usage

    - by Raj More
    A client of mine has a pure HTML website that was built in the dark ages - they want me to find where their users are coming from, how many individual users there are, etc. They want to know if the site is being used enough for them to invest the money into renovating it. I am remote from their site and do not have access to their web server. Is there something like ComScore for small sites that I can go into to check their usage statistics?

    Read the article

  • checking & unchecking a HTML checkbox inside repeater based on database value

    - by subash
    i have a repeater control with item templates having check boxes,and i need the check boxes inside the repeatercontrol to be checked based on the database value of a column field "enabled" of bool type of either true or false. the code is as below what modification should i make to check and uncheck the check box? <asp:Repeater ID="rptrDashboardIssue" runat="server"> <ItemTemplate> <%issueEnum += 1;%> <div style="margin-left: -20px; position: absolute;" id="divModificationCaseflow"> <input type="checkbox" name="chkModificationCaseflow" id="chkModificationCaseflowIssue<%=issueEnum%>" checked="<%# DataBinder.Eval(Container.DataItem, "enabled")%>" /> </div> </ItemTemplate> </asp:Repeater>

    Read the article

  • Checking for 2 exepcted values in Junit

    - by Swift-Tuttle
    Hi, I have a java program which throws an exception with 2 different messages for 2 different scenarios and I want the Junit test case to check for equality for both of these messages. As an example - public void amethod() { // do some processing if(scenario1 == true) { throw new MySystemException("An error occured due to case 1 being incorrect."); } else if(scenario2 == true) { throw new MySystemException("An error occured as case 2 could not be found"); } } Now the JUnit for this would be something like- public void testAMethod() { // do something assertEquals("Expected", "Actual"); } As I understand, in this above example, if I use the Scenario1 exception message the junit will fail when an exception is thrown for Scenario2 and vice versa. I would like to know if there is any other way provided in Junit by which I can use this one test method and check for both the messages for the test to pass? Something like an OR, if possible to provide the "Expected" value with both these expected message. I hope my query is clear enough. Thanks

    Read the article

  • Getting "invalid XML in the response" while checking out my project from github

    - by Shusl
    I was trying to get fresh copy of my project from github using tortoise svn client. But I am getting following exception. The PROPFIND request returned invalid XML in the response: XML parse error at line 1: no element found (Checkout from https://github.com/anoopchaurasia/JavaScript-File-Manager.git) When I tried to checkout using subeclipse on Eclipse, it saying "Folder does not exist.". I am able to checkout same repository on my other system.

    Read the article

  • C#:checking existing record in database Mysql

    - by Meko
    HI.I searched this question inform and I found solution to change column property Unique Index.Now If I try to insert same record cmd.ExecuteNonQuery() gives error that record exist ,but how can use this exception to give user a message that record exist and must enter new one ? I am trying to make some thing like if(cmd.ExecuteNonQuery() !=true ) { MessageBox.Show("User Exists"); } But I dont know what returns cmd.ExecuteNonQuery() ? Or I must get records using reader in table and compare them with text in Textfiel?

    Read the article

  • Checking Android version

    - by John Smith
    I need if the phone running the app api level is 14 which is android 4.0 or more ( example api levcel 15 ) then startActivity ... else if the api level is lower than 14 ( example 13 ), then startActivity ... String AndroidVersion = android.os.Build.VERSION.RELEASE; if ( AndroidVersion == 4.0 ) { Intent start = new Intent(S.this, Menu.class); startActivity(start); } else { Intent startt = new Intent(S.this, Menu2.class); startActivity(startt); } whats the wrong ?

    Read the article

  • How to redirect by checking for a particular previous url

    - by Bearish_Boring_dude
    I have the following piece of code in my controller def index session[:previous_url] = URI(request.referer).path if session[:previous_uri] != new_path redirect_to registration_path(id: current_user.associate_username) end end However this does not actually work and i get a bad URI error. I just want to check if the request came from a particular page and if not redirect it to another page. I would also like to know if there is a better way for doing this?.Thank you

    Read the article

  • Suppress checking for changes on file system in Eclipse RCP

    - by panschk
    Okay, I guess this question is too difficult, but it's worth a try. I have an eclipse RCP application that edits HTML-files. I deal with the content of the files only in a W3C-Dom representation. There is some stuff that I can not do with that, so I the program edits each file each time after it is saved (save, save as). Of course, the file is then out of synch with the file system, and the next time I touch it, eclipse complains: "The file has been changed on the file system. Do you want to replace the editor contents with these changes? (Yes/No)" I do not want to load the changes into the editor ("No") Maybe there is a way to tell Eclipse programmatically to not check that file for changes, or to configure it to not check for changes on any file? edit: Everything has to be done either programatically or by editing some XML files. I can not expect the user to do anything;-)

    Read the article

  • Checking if a string's characters are ascending alphabetically and its ascent is evenly spaced python

    - by FRU5TR8EDD
    So need to check if a string's characters are ascending alphabetically and if that ascent is evenly spaced. a = "abc" b = "ceg" So a is alphabetically ascending and it's spacing is 1 (if you convert to the ordinal values they are 97,98,99). And b is also alphabetically ascending and it's spacing is 2 (99,101,103). And I am sticking with the following code: a = 'jubjub' words1 = [] ords = [ord(letter) for letter in a] diff = ords[1] - ords[0] for ord_val in range(1, len(ords)-1): if diff > 0: if ords[ord_val + 1] - ords[ord_val] == diff: if a not in words1: words1.append((a, diff)) print words1 How come 'jubjub' works, 'ace' works, but 'catcat' doesn't?

    Read the article

  • Changing the value of datagridComboBoxColumn on checking/unchecking of check boxes in datagridcheckb

    - by MD
    I have a wpf data grid,where there are two data template columns One of which ahs check box as the data template adn teh other has combo box as the data template. Now my requirement is,i need to disable few of the options in the combo boxes depending on the check box checked or unchecked for each individual rows... With the cod etaht i ahve tried,i am able to change teh values of teh combo boxes,but it changes for the whole column and not fro individual rows.. Please let me kneo how to determine the combo boxes for the corresponding check boxes in a particular row.

    Read the article

  • Checking exception before using GETITEMBYID()

    - by ps123
    Hello, I am getting item by getiembyid...but I want to check before using it that whether item exist or not...I don't want to use query as main purpose of using Getitembyid is performance.....any idea how to achieve this... itemid = Response.QueryString["loc"]; SPList mylist = myweb.GetList(SPUrlUtility.CombineUrl(myweb.ServerRelativeUrl, "/Lists/Location")); //now id itemid does not exist it throws exception...so i want to check before using following statement that itemid exist...I know i can check throw SPQuery but as i said above because of performance issue only i m using itemid.... SPListItem myitem = mylist.GetItemById(Convert.ToInt32(itemid)); Any idea how to achieve this?

    Read the article

  • short-cutting equality checking in F#?

    - by John Clements
    In F#, the equality operator (=) is generally extensional, rather than intensional. That's great! Unfortunately, it appears to me that F# does not use pointer equality to short-cut these extensional comparisons. For instance, this code: type Z = MT | NMT of Z ref // create a Z: let a = ref MT // make it point to itself: a := NMT a // check to see whether it's equal to itself: printf "a = a: %A\n" (a = a) ... gives me a big fat segmentation fault[*], despite the fact that 'a' and 'a' both evaluate to the same reference. That's not so great. Other functional languages (e.g. PLT Scheme) get this right, using pointer comparisons conservatively, to return 'true' when it can be determined using a pointer comparison. So: I'll accept the fact that F#'s equality operator doesn't use short-cutting; is there some way to perform an intensional (pointer-based) equality check? The (==) operator is not defined on my types, and I'd love it if someone could tell me that it's available somehow. Or tell me that I'm wrong in my analysis of the situation: I'd love that, too... [*] That would probably be a stack overflow on Windows; there are things about Mono that I'm not that fond of...

    Read the article

  • Most efficient way of checking if Date object and Calendar object are in the same month

    - by Indigenuity
    I am working on a project that will run many thousands of comparisons between dates to see if they are in the same month, and I am wondering what the most efficient way of doing it would be. This isn't exactly what my code looks like, but here's the gist: List<Date> dates = getABunchOfDates(); Calendar month = Calendar.getInstance(); for(int i = 0; i < numMonths; i++) { for(Date date : dates) { if(sameMonth(month, date) .. doSomething } month.add(Calendar.MONTH, -1); } Creating a new Calendar object for every date seems like a pretty hefty overhead when this comparison will happen thousands of times, soI kind of want to cheat a bit and use the deprecated method Date.getMonth() and Date.getYear() public static boolean sameMonth(Calendar month, Date date) { return month.get(Calendar.YEAR) == date.getYear() && month.get(Calendar.MONTH) == date.getMonth(); } I'm pretty close to just using this method, since it seems to be the fastest, but is there a faster way? And is this a foolish way, since the Date methods are deprecated? Note: This project will always run with Java 7

    Read the article

  • Correct expression for checking leap years

    - by Debanjan
    What will be the exact definition of leap year? AFAIK "A year which is divisible by 4 is a leap year. But for century years' the years which are divisible by 400 is a leap year." But that definition makes 100, 200, 300, 400.... upto 1700 NOT LEAP years! But in Gregorian calendar all of them are all leap year, check this out. You can also try "call 1700" in Linux to verify. So the correct algorithm for leap years would be: if ( (year % 4 == 0) && ( year <= 1700 || year % 100 != 0 || year % 400 == 0 )) printf("%d is a leap year.\n", year); else printf("%d is not a leap year.\n", year); But is this specific to Gregorian calendar? Even if that is the case why is it not mentioned here? Regards, PS:The history of Gregorian callender seems interesting check out the September month of 1752.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >