Search Results

Search found 22298 results on 892 pages for 'default'.

Page 64/892 | < Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >

  • python: problem with dictionary get method default value

    - by goutham
    I'm having a new problem here .. CODE 1: try: urlParams += "%s=%s&"%(val['name'], data.get(val['name'], serverInfo_D.get(val['name']))) except KeyError: print "expected parameter not provided - "+val["name"]+" is missing" exit(0) CODE 2: try: urlParams += "%s=%s&"%(val['name'], data.get(val['name'], serverInfo_D[val['name']])) except KeyError: print "expected parameter not provided - "+val["name"]+" is missing" exit(0) see the diffrence in serverInfo_D[val['name']] & serverInfo_D.get(val['name']) code 2 fails but code 1 works the data serverInfo_D:{'user': 'usr', 'pass': 'pass'} data: {'par1': 9995, 'extraparam1': 22} val: {'par1','user','pass','extraparam1'} exception are raised for for data dict .. and all code in for loop which iterates over val

    Read the article

  • Change default Console I/O functions handle.

    - by b-gen-jack-o-neill
    Hello. Is it possible to somehow change standart I/O functions handle on Windows? Language preffered is C++. If I understand it right, by selecting console project, compiler just pre-allocate console for you, and operates all standart I/O functions to work with its handle. So, what I want to do is to let one Console app actually write into another app Console buffer. I though that I could get first´s Console handle, than pass it to second app by a file (I don´t know much about interprocess comunication, and this seems easy) and than somehow use for example prinf with the first app handle. Can this be done? I know how to get console handle, but I have no idea how to redirect printf to that handle. Its just study-purpose project to more understand of OS work behind this. I am interested in how printf knows what Console it is assiciated with.

    Read the article

  • getting a "default" concrete class that implements an interface

    - by Roger Joys
    I am implementing a custom (and generic) Json.net serializer and hit a bump in the road that I could use some help on. When the deserializer is mapping to a property that is an interface, how can I best determine what sort of object to construct to deserialize to to place into the interface property. I have the following: [JsonConverter(typeof(MyCustomSerializer<foo>))] class foo { int Int1 { get; set; } IList<string> StringList {get; set; } } My serializer properly serializes this object, and but when it comes back in, and I try to map the json parts to to object, I have a JArray and an interface. I am currently instantiating anything enumerable like List as theList = Activator.CreateInstance(property.PropertyType); This works create to work with in the deserialization process, but when the property is IList, I get runtime complaints (obviously) about not being able to instantiate an interface. So how would I know what type of concrete class to create in a case like this? Thank you

    Read the article

  • how to run click function after default behaviour of a element

    - by Somebody is in trouble
    My code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script src="jquery.js"></script> <script> $(function(){ $("body").on("click",".mes_sel",function(){ if($(".mes_sel:checked").length==0){ alert("Checked"); } else alert("Not Checked"); }); }); </script></head> <body> <input type="checkbox" class="mes_sel"> </body> </html> It is alerting checked when the textbox is unchecked because onclick is running before the checking of checkbox.How can i make the click event to run after checking/unchecking of the input

    Read the article

  • Default entries on a first time creation for a serialized class

    - by MGSoto
    I have a class I am using for serializing various configuration options for an application I am working on. I'm adding a new property to the class that is a List, and I'd like it to fill this list if it does not exist already in a XML file. My first thought was to check if the list contained zero items, however this is not acceptable because there are times I want to have zero items in the list. In essence I want a file that has been serialized with an older version of the same class to be "upgraded" and have defaults automatically inserted for new properties. How can I do this? For a more visual example of what I'm trying to do, see below: When I deserialize an XML file that contains: <Item1>wtfe</Item1> <Item2>wtfe</Item2> and after I've added a list property it will serialze as: <Item1>wtfe</Item1> <Item2>wtfe</Item2> <Item3/> I want it to serialize as: <Item1>wtfe</Item1> <Item2>wtfe</Item2> <Item3> <DefaultSubItem/ Field="wtfe"> <DefaultSubItem/ Field="wtfe"> </Item3> But allow me to change it to: <Item1>wtfe</Item1> <Item2>wtfe</Item2> <Item3></Item3>

    Read the article

  • Default for generic type?

    - by Mark
    Is it possible to do something like public class PriorityQueue<TValue, TPriority=int> where TPriority : IComparable (note the =int) ? Before you suggest it, yes, I know I can just add another line: public class PriorityQueue<TValue> : PriorityQueue<TValue, int> { } But I'm wondering if it's possible to do it as a param.

    Read the article

  • mysql join default value

    - by andy
    I've been trying to use the IsNull() function to ensure that there is a value for a field. $result = mysql_query(" SELECT crawled.id,IsNull(sranking.score,0) as Score,crawled.url,crawled.title,crawled.blurb FROM crawled LEFT JOIN sranking ON crawled.id = sranking.sid WHERE crawled.body LIKE '%".$term."%' ORDER BY Score DESC LIMIT " . $start . "," . $c . " ") or die(mysql_error()); But I get the error message:Incorrect parameter count in the call to native function 'IsNull' Anybody have any ideas? I'm pretty new to mySQL.

    Read the article

  • Android WebView and default browser with different UserAgent

    - by Udi I
    From some reason on several android devices, I'm getting different User Agent from the browser and from my application's WebView. I have used this line of code to get the UA in the app: new WebView(this).getSettings().getUserAgentString(); This is the part with the difference The application retruns: HTC One X Build While the browser returns: HTC_One_X Build Notice the underscores in the browser's version. Any ideas what causes the difference? Tx!

    Read the article

  • Store default value in iphone

    - by Sreelal
    Hi, I am developing my first iPhone application.I need store some values in a place where the values will not get lost if the app is deleted .I need this to get the number of days the user actually used the app.Is this possible to do ? Thanks in advance

    Read the article

  • Underlining RichTextArea content by default in Silverlight 4

    - by Rahul N
    I'm uisng a RichTextArea to display my html content in SL 4,I want to underline the content displayed by the control ( without modifying the html) and also attach an event of Onclick on the text . I tried different options i.e using RichTextArea in the content template of a Hyperlinkbutton but as the content of RichTextArea cannot be set directly, this was ruled out. Any suggestions ?

    Read the article

  • pagecontrol indicator custom image instead of Default

    - by iphonecool
    How i change the color of pagination dots of UIPageControl? In this link the sample code is given.But it shows 3 errors for me... 1'st ERROR: Line:CGRect currentBounds = self.bounds; Error:requst for member 'bounds' in something not a structure or union Method:-(void)drawRect: 2nd Err: same error with same line in touchesBegan method. 3rd Err:@protocol PageControlDelegate @optional (void)pageControlPageDidChange:(PageControl *)pageControl; @end Error:Expected ')' before 'PageControl' .These are the three errors occurs for me...Please help me out to solve this.. I want to change the pagecontrol indicator(dot) color... Thanks & Regards, Renuga

    Read the article

  • iPhone internationalization: falling back to a default language

    - by MihaiD
    Consider the following situation: We have two Localizable.string files, one in en.lproj and one in it.lproj When the user switches to English or Italian, the proper localized string is loaded using NSLocalizedString(@"keyword", nil) If one of the files is missing the keyword, the string is not retrieved Is there any way to make this macro load the string from a specific language if it's keyword is not found in the current locale's Localizable.string?

    Read the article

  • Suggestion on Database structure for relational data

    - by miccet
    Hi there. I've been wrestling with this problem for quite a while now and the automatic mails with 'Slow Query' warnings are still popping in. Basically, I have Blogs with a corresponding table as well as a table that keeps track of how many times each Blog has been viewed. This last table has a huge amount of records since this page is relatively high traffic and it logs every hit as an individual row. I have tried with indexes on the fields that are included in the WHERE clause, but it doesn't seem to help. I have also tried to clean the table each week by removing old ( 1.weeks) records. SO, I'm asking you guys, how would you solve this? The query that I know is causing the slowness is generated by Rails and looks like this: SELECT count(*) AS count_all FROM blog_views WHERE (created_at >= '2010-01-01 00:00:01' AND blog_id = 1); The tables have the following structures: CREATE TABLE IF NOT EXISTS 'blogs' ( 'id' int(11) NOT NULL auto_increment, 'name' varchar(255) default NULL, 'perma_name' varchar(255) default NULL, 'author_id' int(11) default NULL, 'created_at' datetime default NULL, 'updated_at' datetime default NULL, 'blog_picture_id' int(11) default NULL, 'blog_picture2_id' int(11) default NULL, 'page_id' int(11) default NULL, 'blog_picture3_id' int(11) default NULL, 'active' tinyint(1) default '1', PRIMARY KEY ('id'), KEY 'index_blogs_on_author_id' ('author_id') ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; And CREATE TABLE IF NOT EXISTS 'blog_views' ( 'id' int(11) NOT NULL auto_increment, 'blog_id' int(11) default NULL, 'ip' varchar(255) default NULL, 'created_at' datetime default NULL, 'updated_at' datetime default NULL, PRIMARY KEY ('id'), KEY 'index_blog_views_on_blog_id' ('blog_id'), KEY 'created_at' ('created_at') ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

    Read the article

  • ASP.NET Custom Control - Default Template?

    - by Bob Fincheimer
    I know this is really picky, but can I have one template inside a user control: <uc:MyUserControl runat="server" ID="test"> <div><b>Test</b></div> <asp:PlaceHolder runat="server" id="pH" /> </uc:MyUserControl> Instead of what I have now which requires me to: <uc:MyUserControl runat="server" ID="test"> <Content> <div><b>Test</b></div> <asp:PlaceHolder runat="server" id="pH" /> </Content> </uc:MyUserControl> Basically I want my control to have only one ITemplate inside of it.

    Read the article

  • Undefined / Uninitialized default values in a class

    - by Jir
    Let's suppose you have this class: class A { public: A () {} A (double val) : m_val(val) {} ~A () {} private: double m_val; }; Once I create an instance of A, how can I check if m_val has been initialized/defined? Put it in other words, is there a way to know if m_val has been initialized/defined or not? Something along the lines of the defined operator in Python, I suppose. (But correct me if I'm wrong.) I thought of modifying the class and the c-tors the following way: class A { public: A () : defined(false) {} A (double val) : m_val(val), defined(true) {} ~A () {} private: double m_val; bool defined; }; How do you rate this solution? Any suggestion? TIA, Chris

    Read the article

  • make a default password for password textboxes that can't be reproduced by the client

    - by user420667
    Is it possible to set a password textbox text to text that the user could not reproduce on their end? Like are there special characters that can only be set from the server? For instance, one way to do this would be to use javascript to prevent typing of *'s, and to set the textbox text to be all *'s. But that's hacky. The motivation is to be able to tell on the server if the user changed the password at all, but not to restrict them from having a password of all *'s, for instance.

    Read the article

  • Overriding jQuery plugin methods, as default and for single instances

    - by Kilgore2k
    Hi, The basic question is: How do I perform a basic override of a plugin method without editing the original plugin file? Is it possible to create an override for a specific instance: Example: An rtf plugin uses: $('selector').wysiwyg('setContent',newContent); In order to display the rtf text as readonly I would like for the same method to be applied to a div instead of the body of the IFRAME I would like to overwrite the original 'setContent' with my own code, just for this one element. Thanks

    Read the article

  • Scroll returns to default after display:none in Chrome/IE

    - by Sam
    Here's the example: http://jsfiddle.net/sammy/RubNy/ Scroll down in the div container. Then click anywhere in the window to hide the element. Then click once more to show the element. You'll notice in Chrome/IE that the scroll is reset, but in Firefox, the scroll remains how you left it. Which is the standards behavior, Chrome/IE or Firefox? Should I report this to the Chrome issue tracker? Thanks in advance for any help on this, and happy new year, and thanks again, and cheers, and stuff. =D

    Read the article

  • Android: Gzip/Http supported by default?

    - by OneWorld
    I am using the code shown below to get Data from our server where Gzip is turned on. Does my Code already support Gzip (maybe this is already done by android and not by my java program) or do I have to add/change smth.? How can I check that it's using Gzip? For my opionion the download is kinda slow. private static InputStream OpenHttpConnection(String urlString) throws IOException { InputStream in = null; int response = -1; URL url = new URL(urlString); URLConnection conn = url.openConnection(); if (!(conn instanceof HttpURLConnection)) throw new IOException("Not an HTTP connection"); try { HttpURLConnection httpConn = (HttpURLConnection) conn; httpConn.setAllowUserInteraction(false); httpConn.setInstanceFollowRedirects(true); httpConn.setRequestMethod("GET"); httpConn.connect(); response = httpConn.getResponseCode(); if (response == HttpURLConnection.HTTP_OK) { in = httpConn.getInputStream(); if(in == null) throw new IOException("No data"); } } catch (Exception ex) { throw new IOException("Error connecting"); } return in; }

    Read the article

  • Override default javascript functionality with jQuery

    - by deth4uall
    I am trying to overwrite a JavaScript on change event in the below code with jQuery however I believe that the inline JavaScript is taking priority over the jQuery functionality declared. Essentially I am trying to have an AJAX version of my site which includes an additional JavaScript file. I need this functionality to still work without the additional AJAX version, but I am not sure as to whether I should include it in the main JavaScript file or leave it inline like it is right now. Any suggestions and information regarding them would be greatly appreciated! Thanks! <form action="/cityhall/villages/" method="post" name="submit_village"> <select name="village" onchange="document.submit_village.submit();"> <option value=""></option> </select> </form> I am trying to use the jQuery Form Plugin to submit the posts to the PHP to handle the requests as follows: var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('form.get_pages').livequery(function(){ $(this).ajaxForm(bank_load_options); return false; }); I modified the code as following: <form action="/cityhall/villages/" method="post" id="submit_village" name="submit_village"> <select name="village" class="get_pages" rel="submit_village"> <option value=""></option> </select> </form> <script> # main JavaScript $('.get_pages').live('change',function(e){ var submit_page = $(this).attr('rel'); $("#"+submit_page).submit(); }); # ajax JavaScript var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('.get_pages').live('change',function(){ var submit_page = $(this).attr('rel'); $("#"+submit_page).ajaxForm(get_pages_load_options); return false; }); </script> However now it only runs every other option when I change it.

    Read the article

  • Dropdownlist value not being set when there is a default blank option

    - by uriDium
    I am using ASP.Net MVC. I have a partial view which has a form with dropdownlists. The dropdownlists are set via ViewData. The partial view is used in a Create and Edit page. The create works fine. I get the dropdownlists and the blank option is a "Please select", like so <%= Html.DropDownList("ContactNrType", ViewData["ContactNrType"] as SelectList, "Please Select") %> But this doesn't seem to work for my edit. If I have that extra "Please select" parameter then it does not select the value for the drop down. I am setting the value of the drop down in the controller like so ViewData["ContactNrType"] = new SelectList(new List<string> { "Mobile", "Home", "Work", "Friend" }, candidate.ContactNrType); Any idea as to what I am doing wrong? I want to share the partial view which contains the form between the two pages. So I need the "Please Select" option for the Create. And I need the value set for the Edit (I don't mind that it has an option that still says "Please Select").

    Read the article

< Previous Page | 60 61 62 63 64 65 66 67 68 69 70 71  | Next Page >