Search Results

Search found 35302 results on 1413 pages for 'string literals'.

Page 162/1413 | < Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >

  • How to format a date as localized Short MonthDay string

    - by Wouter
    I would like to format a DateTime to a string containing the month name abbreviated and the date for use in axis labels in a graph. The default DateTime format strings do not contain abbreviated month. I guess there is no standard but I could take a substring of the first 3 characters of the month name and replace this into the MonthDay format. The reason I would use MonthDay is that the ordering of month and date is locale dependent. Does anyone have a better idea? http://msdn.microsoft.com/en-us/library/az4se3k1.aspx#MonthDay

    Read the article

  • Issue with python string join.

    - by Pradyot
    I have some code in which I apply a join to a list. The list before the join looks like this: ["'DealerwebAgcy_NYK_GW_UAT'", "'DealerwebAgcy'", "'UAT'", '@ECNPhysicalMarketCo nfigId', "'GATEWAY'", "'DEALERWEB_MD_AGCY'", "'NU1MKVETC'", "'mkvetcu'", "'C:\te mp'", '0', "'NYK'", '0', '1', "'isqlw.exe'", 'GetDate()', '12345', "'NYK'", '350 ', '7'] After the join this is the resulting string 'DealerwebAgcy_NYK_GW_UAT','DealerwebAgcy','UAT',@ECNPhysicalMarketConfigId,'GAT EWAY','DEALERWEB_MD_AGCY','NU1MKVETC','mkvetcu','C: emp',0,'NYK',0,1,'isqlw. exe',GetDate(),12345,'NYK',350,7 Note the element "'C:\temp'" which ends up as ,'C: emp', I tried something similar on the python command prompt , but I wasn't able to 2 repeat this. the relevant code responsible for this magic is as follows. values_dict["ECNMarketInstance"] = [strVal(self.EcnInstance_),strVal (self.DisplayName_) ,strVal(self.environment_), '@ECNPhysicalMarketConfigId', strVal(self.EcnGatewaTypeId_),strVal(self.ConnectionComponent_) ,strVal(self.UserName_),strVal(self.Password_),strVal(self.WorkingDir_),"0",strVal(self.region_),"0","1", strVal(self.LUVersion_), "GetDate()" , self.LUUserId_ ,strVal(self.LUOwningSite_),self.QuoteColumnId_ , self.Capabilities_] delim = "," joined = delim.join(values) print values print joined

    Read the article

  • String to date (Invalid format)

    - by MrThys
    I am using Joda Time library to convert my String dates to a real date, because this seemed like the easiest solution to do this. I am using the DateTime object to do this; new DateTime(strValue); But when inserting some formats it throws me the exception; java.lang.IllegalArgumentException: Invalid format: "Mon, 30 Sep 2002 01:56:02 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 19:59:01 GMT" java.lang.IllegalArgumentException: Invalid format: "Mon, 30 Sep 2002 01:52:02 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 17:05:20 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 19:09:28 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 15:01:02 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 23:48:33 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 17:24:20 GMT" java.lang.IllegalArgumentException: Invalid format: "Sun, 29 Sep 2002 11:13:10 GMT" Is there a way to solve this, or should I use something else instead of DateTime.

    Read the article

  • Comparison of music data

    - by Christian P.
    Hey I am looking for theory, algorithms and similar for how to compare music. More specifically, I am looking into how to dupecheck music tracks that have different bitrates or perhaps slightly different variations (radio vs album version), but otherwise sound the same. Use cases for this include services such as Grooveshark, Youtube, etc. where they get a lot of duplicate tracks. I am also interested in text comparisons (Britney Spers vs Britney Spears, how far they deviate, etc.) although this is secondary and I already have some sources to go on in this area. I am mostly interested in codec-agnostic comparison techniques and algoritms (assuming a "raw" stream), but codec-specific resources are appreciated. I am aware of projects such as musicbrainz.org, but have not investigated it further, and would be interested if such projects could be of help in this endeavor.

    Read the article

  • Best way to store enum values in database - String or Int

    - by inutan
    Hello there, I have a number of enums in my application which are used as property type in some classes. What is the best way to store these values in database, as String or Int? FYI, I will also be mapping these attribute types using fluent Nhibernate. Sample code: public enum ReportOutputFormat { DOCX, PDF, HTML } public enum ReportOutputMethod { Save, Email, SaveAndEmail } public class ReportRequest { public Int32 TemplateId { get { return templateId; } set { templateId = value; } } public ReportOutputFormat OutputFormat { get { return outputFormat; } set { outputFormat = value; } } public ReportOutputMethod OutputMethod { get { return outputMethod; } set { outputMethod = value; } } }

    Read the article

  • DSNless connection for Aruna DB?

    - by vijay
    Right now we are using Fastpath ODBC DSN connection method to access our "ARUNA" db. Our development platform is .NET C#. But we are in need of connecting the DB without using DSN. Till now my search in google is turning futile. In the meantime I think i will get my answer here quickly. Is it possible to connect Aruna using DSN less method? Thanks in advance guys.

    Read the article

  • Haskell parsec parsing a string of items

    - by Chris
    I have a list that I need to parse where the all but the last element needs to be parsed by one parser, and the last element needs to be parsed by another parser. a = "p1 p1b ... p2" or a = "p2" Originally I tried parser = do parse1 <- many parser1 parse2 <- parser2 return AParse parse1 parse2 The problem is that parse1 can consume a parse2 input. So parse1 always consumes the entire list, and leave parse2 with nothing. Is there a way to say to apply parse1 to everything besides the last element in a string, and then apply parse2?

    Read the article

  • asp.net mvc 1.0 - how to render a partial view as a string

    - by Chev
    Hi There I need to render a partial view to a string within a controller action. I have the following sample code, but the ControllerContext.ParentActionViewContext does not seem to exist in mvc 1.0 // Get the IView of the PartialView object. var view = PartialView("MyPartialView").View; // Initialize a StringWriter for rendering the output. var writer = new StringWriter(); // Do the actual rendering. view.Render(ControllerContext.ParentActionViewContext, writer); Any tips greatly appreciated.

    Read the article

  • Pyton, print delimited list

    - by Mike
    Consider this Python code for printing a list of comma separated values for element in list: print element + ",", What is the preferred method for printing such that a comma does not appear if element is the final element in the list. ex a = [1, 2, 3] for element in a print str(element) +",", output 1,2,3, desired 1,2,3

    Read the article

  • How to trim whitespace from bash variable?

    - by too much php
    I have a shell script with this code: var=`hg st -R "$path"` if [ -n "$var" ]; then echo $var fi But the conditional code always executes because hg st always prints at least one newline character. Is there a simple way to strip whitespace from $var (like trim() in php)? or Is there a standard way of dealing with this issue? I could use sed or awk, but I'd like to think there is a more elegant solution to this problem.

    Read the article

  • strcasecmp in C returns 156 instead of 0, any ideas why?

    - by hora
    I have the following code: printf("num: %d\n", strcasecmp(buf, "h\n")); And I get the following results when I try plugging in different letters: a: -7 g: -1 i: 1 j: 2 h: 156 H: 156 Should strcasecmp not return 0 when buf is equal to H or h? Any ideas why it's returning 156? I need to figure out how to check whether the user types H or h. Thanks!

    Read the article

  • Query String in Javascript

    - by Ajith
    How can we collect a query string value in javascript. my script is like follows http://192.168.10.5/study/gs.js?id=200 here i want to collect the id value in my gs.js script file. For this i am using function getQuerystring(key, default_) { if (default_==null) default_=""; key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^&#]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; } var string_value = getQuerystring('id'); alert(string_value); But it is not getting..Please anybody can correct me.Please

    Read the article

  • Converting non-delimited text into name/value pairs in Delphi

    - by robsoft
    I've got a text file that arrives at my application as many lines of the following form: <row amount="192.00" store="10" transaction_date="2009-10-22T12:08:49.640" comp_name="blah " comp_ref="C65551253E7A4589A54D7CCD468D8AFA" name="Accrington "/> and I'd like to turn this 'row' into a series of name/value pairs in a given TStringList (there could be dozens of these <row>s in the file, so eventually I will want to iterate through the file breaking each row into name/value pairs in turn). The problem I've got is that the data isn't obviously delimited (technically, I suppose it's space delimited). Now if it wasn't for the fact that some of the values contain leading or trailing spaces, I could probably make a few reasonable assumptions and code something to break a row up based on spaces. But as the values themselves may or may not contain spaces, I don't see an obvious way to do this. Delphi' TStringList.CommaText doesn't help, and I've tried playing around with Delimiter but I get caught-out by the spaces inside the values each time. Does anyone have a clever Delphi technique for turning the sample above into something resembling this? ; amount="192.00" store="10" transaction_date="2009-10-22T12:08:49.640" comp_name="blah " comp_ref="C65551253E7A4589A54D7CCD468D8AFA" name="Accrington " Unfortunately, as is usually the case with this kind of thing, I don't have any control over the format of the data to begin with - I can't go back and 'make' it comma delimited at source, for instance. Although I guess I could probably write some code to turn it into comma delimited - would rather find a nice way to work with what I have though. This would be in Delphi 2007, if it makes any difference.

    Read the article

  • Django: How do I prepend

    - by voidnothings
    Hello, I'm exploring Django and got this particular problem. How do I prepend <span class="label">Note:</span> inside {{article.content_html|safe}}? The content of {{article.content_html|safe}} are paragraph blocks, and I just wanna add <span class="label">Note:</span> in the very first paragraph. Thanks!

    Read the article

  • Java: Parse Australian Street Addresses

    - by bguiz
    Looking for a quick and dirty way to parse Australian street addresses into its parts: 3A/45 Jindabyne Rd, Oakleigh, VIC 3166 should split into: "3A", 45, "Jindabyne Rd" "Oakleigh", "VIC", 3166 Suburb names can have multiple words, as can street names. See: http://stackoverflow.com/questions/1739746/parse-a-steet-address-into-components Has to be in Java, cannot make http requests (e.g. to web APIs). EDIT: Assume that format specified is always followed. I have no issue with spitting incorrectly formatted strings back at the user with a message telling them to follow the format (which I've described above).

    Read the article

  • Android programmatically add buttons to layout from string array

    - by Luke Batley
    Does anyone know how to programatically add buttons to the layout from an array? I have an array of titles and icons that i have used for a list view and now i'm wanting to reuse the same arrays to create a layout as displayed here so the layout adds a button for each item in the array and arranges them in 3's according to device width. is this possible to do? I have tried using a custom Array Adapter to generate the Grid but getting a null pointer error at the point menuGrid = (GridView) findViewById(R.id.gridView1); MenuItemsSetup menuData[] = new MenuItemsSetup[] { new MenuItemsSetup(R.drawable.ic_menu_icon1, "menuItem1"), new MenuItemsSetup(R.drawable.ic_menu_icon2, "menuItem2"), new MenuItemsSetup(R.drawable.ic_menu_icon3, "menuItem3"), new MenuItemsSetup(R.drawable.ic_menu_icon4, "menuItem4"), new MenuItemsSetup(R.drawable.ic_menu_icon5, "menuItem5"), new MenuItemsSetup(R.drawable.ic_menu_icon6, "menuItem6"), new MenuItemsSetup(R.drawable.ic_menu_icon7, "menuItem7"), new MenuItemsSetup(R.drawable.ic_menu_icon8, "menuItem8") }; String[] menuBgColours = {"#FFFFFF","#FFFFFF", ,"#888888", "#FFFFBB", "#BBFFFF","#000000", "#666666"}; CustomArrayAdapter adapter = new CustomArrayAdapter(this, R.layout.drawer_list_item, menuData, menuBgColours); menuList.setAdapter(adapter); menuGrid.setAdapter(adapter);

    Read the article

  • issue with parsing JSON string

    - by bgosalci
    I have this object which I use as a list of objects: var objList = new Object(); This is then serialized using JSON serialize. If there are no object added or all objects have been removed from the list and the blank objList is serialized, parsing the objList using JSON parser in IE, it will occasionally fail to evaluate the objList as a JavaScript object. This causes the Object doesn't support this property or method error when tying to add an object to the objList: objList['idx']=objData; Does anyone know why does IE occasionally fail to evaluate objList:{} to an object and has someone else come across this issue. The actual JSON string when the objList is '{}' The objList is initialised: objList = g_objList.parseJSON();

    Read the article

  • Objective C - RegexKitLite - Parsing inner contents of a string, ie: start(.*?)end

    - by Stu
    Please consider the following: NSString *myText = @"mary had a little lamb"; NSString *regexString = @"mary(.*?)little"; for)NSString *match in [myText captureComponentsMatchedByRegex:regexString]){ NSLog(@"%@",match); } This will output to the console two things: 1) "mary had a little" 2) "had a" What I want is just the 2nd bit of information "had a". Is there is a way of matching a string and returning just the inner part? I'm fairly new to Objective C, this feels a rather trivial question yet I can't find a less messy way of doing this than incrementing an integer in the for loop and on the second iteration storing the "had a" in an NSString.

    Read the article

  • Regarding BigDecimal

    - by arav
    i do the below java print command for this double variable double test=58.15; When i do a System.out.println(test); and System.out.println(new Double(test).toString()); It prints as 58.15. When i do a System.out.println(new BigDecimal(test)) I get the below value 58.14999999999999857891452847979962825775146484375 I am able to understand "test" double variable value is internally stored as 58.1499999. But when i do the below two System.out.println i am getting the output as 58.15 and not 58.1499999. System.out.println(test); System.out.println(new Double(test).toString()); It prints the output as 58.15 for the above two. Is the above System.out.println statements are doing some rounding of the value 58.1499999 and printing it as 58.15?

    Read the article

  • Format fixed-format text file lines

    - by EugeneP
    there's a text file first second third 1 2 3 yes no ok hmmmmmmm yep_a_long_word_it_is ahahahahahahha what java functions /libs to use to align words so that they are looked like this (fixed width based on the longest column's length), let's say center align: first second third 1 2 3 yes no ok hmmmmmmm yep_a_long_word_it_is ahahahahahahha

    Read the article

  • Match returning a string instead of object

    - by Pablo
    This simple regex matching returns a string instead of an object on every browser but the latest firefox... text = "language. Filename: My Old School Yard.avi. File description: File size: 701.54 MB. View on Megavideo. Enter this, here:" name = text.match(/(Filename:)(.*) File /); alert(typeof(name)); as far as i know this the match function is suppose to return an object (Array). Has anyone come across this issue?

    Read the article

  • Extract strings in python

    - by shadyabhi
    Basically, I want to extract the strings "AAA", "BBB", "CCC", "DDD" from a text file.. ...... (other text goes here)..... <TD align="left" class=texttd><font class='textfont'>AAA</font></TD> ..... (useless text here)..... <TD align="left" class=texttd><font class='textfont'>BBB</font></TD> ....(more text)..... <TD align="left" class=texttd><font class='textfont'>CCC</font></TD> <TD align="left" class=texttd><font class='textfont'>DDD</font></TD> ......(more text)..... I want something like if I do:- data = foo("file.txt") i get:- data = ['AAA','BBB','CCC','DDD'] What is the best possible way? My file is not big..

    Read the article

  • Managing string resources in a Java application - singleton?

    - by Joe Attardi
    I seek a solution to the age-old problem of managing string resources. My current implementation seems to work well, but it depends on using singletons, and I know how often singletons can be maligned. The resource manager class has a singleton instance that handles lookups in the ResourceBundle, and you use it like so: MessageResources mr = MessageResources.getMessageResources(); // returns singleton instance ... JLabel helloLabel = new JLabel(mr.getString("label.hello")); Is this an appropriate use of a singleton? Is there some better, more universally used approach that I'm not aware of? I understand that this is probably a bit subjective, but any feedback I can get would be appreciated. I'd rather find out early on that I'm doing it wrong than later on in the process. Thanks!

    Read the article

  • Can't access dojo object property using string variable

    - by Kareem
    I am retrieving a json associative array using a dojo xhrGet request. The data comes back just fine, however I need the app to be able to display the keys and their properties (or values) without knowing the keys beforehand. So, I do the following: function getData() { dojo.xhrGet( { url: "ytd_process.php", handleAs: "json", load: function(response) { for (var key in response) { dojo.byId("boxes").innerHTML+="<div id=\"box\">"+key+":"+response.key+"</div>"; } console.dir(response); // Dump it to the console } }); }; The keys are retrieved and displayed on the page, but the response.key returns undefined. I know the syntax is correct because if I replace .key with an actual key value it will display correctly. It appears it doesn't like a string as the key. Any help or advice would be greatly appreciated. Thank you.

    Read the article

< Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >