Search Results

Search found 37183 results on 1488 pages for 'string conversion'.

Page 96/1488 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • WPF TypeConverter ConvertTo not firing

    - by JFoulkes
    Hi, I have a dependency property in a class which I need to be converted to a string. I have added the TypeConverty attribute on the property. The type I am converting is the .net Style class. [TypeConverter(typeof(BulletStyleTypeConverter))] public Style BulletStyle { get { return (Style)GetValue(BulletStyleProperty); } set { this.SetValue(BulletStyleProperty, value); } } When I put the string "Rectangle" in for BulletStyle in xaml it hits the ConvertFrom method in my converter. However, when I use XamlWriter.Save() to serialise this, the property does not appear as an attribute in the string which is produced. I have implemented ConvertTo and put a breakpoint on, which is never hit. I have implemented CanConvertTo and put a breakpoint on, which IS hit and returns true. So i'm stumped as to why ConvertTo never fires.

    Read the article

  • JAX-RS JSON java.util.Date Unmarshall

    - by user229498
    Hi, I'm using Jersey (jax-rs), to build a REST rich application. Everything is great, but I really don't understand how to set in JSON Marshalling and Unmarshalling converting option for dates and numbers. I have a User class: @XmlRootElement public class User { private String username; private String password; private java.util.Date createdOn; // ... getters and setters } When createdOn property is serialized, a string like this: '2010-05-12T00:00:00+02:00', but I need to choose date Pattern both, to marshall and unmarshall. Someone knows hot to do that? Thank's a lot, Davide.

    Read the article

  • regular expression to read the string between <title> and </title>

    - by user262325
    Hello every one I hope to read the contents between and in a html string. I think it should be in objective-c @"<title([\\s\\S]*)</title>" below are the codes that rewrited for regular expression //source of NSStringCategory.h #import <Foundation/Foundation.h> #import <regex.h> @interface NSStringCategory:NSObject { regex_t preg; } -(id)initWithPattern:(NSString *)pattern options:(int)options; -(void)dealloc; -(BOOL)matchesString:(NSString *)string; -(NSString *)matchedSubstringOfString:(NSString *)string; -(NSArray *)capturedSubstringsOfString:(NSString *)string; +(NSStringCategory *)regexWithPattern:(NSString *)pattern options:(int)options; +(NSStringCategory *)regexWithPattern:(NSString *)pattern; +(NSString *)null; +(void)initialize; @end @interface NSString (NSStringCategory) -(BOOL)matchedByPattern:(NSString *)pattern options:(int)options; -(BOOL)matchedByPattern:(NSString *)pattern; -(NSString *)substringMatchedByPattern:(NSString *)pattern options:(int)options; -(NSString *)substringMatchedByPattern:(NSString *)pattern; -(NSArray *)substringsCapturedByPattern:(NSString *)pattern options:(int)options; -(NSArray *)substringsCapturedByPattern:(NSString *)pattern; -(NSString *)escapedPattern; @end and .m file #import "NSStringCategory.h" static NSString *nullstring=nil; @implementation NSStringCategory -(id)initWithPattern:(NSString *)pattern options:(int)options { if(self=[super init]) { int err=regcomp(&preg,[pattern UTF8String],options|REG_EXTENDED); if(err) { char errbuf[256]; regerror(err,&preg,errbuf,sizeof(errbuf)); [NSException raise:@"CSRegexException" format:@"Could not compile regex \"%@\": %s",pattern,errbuf]; } } return self; } -(void)dealloc { regfree(&preg); [super dealloc]; } -(BOOL)matchesString:(NSString *)string { if(regexec(&preg,[string UTF8String],0,NULL,0)==0) return YES; return NO; } -(NSString *)matchedSubstringOfString:(NSString *)string { const char *cstr=[string UTF8String]; regmatch_t match; if(regexec(&preg,cstr,1,&match,0)==0) { return [[[NSString alloc] initWithBytes:cstr+match.rm_so length:match.rm_eo-match.rm_so encoding:NSUTF8StringEncoding] autorelease]; } return nil; } -(NSArray *)capturedSubstringsOfString:(NSString *)string { const char *cstr=[string UTF8String]; int num=preg.re_nsub+1; regmatch_t *matches=calloc(sizeof(regmatch_t),num); if(regexec(&preg,cstr,num,matches,0)==0) { NSMutableArray *array=[NSMutableArray arrayWithCapacity:num]; int i; for(i=0;i<num;i++) { NSString *str; if(matches[i].rm_so==-1&&matches[i].rm_eo==-1) str=nullstring; else str=[[[NSString alloc] initWithBytes:cstr+matches[i].rm_so length:matches[i].rm_eo-matches[i].rm_so encoding:NSUTF8StringEncoding] autorelease]; [array addObject:str]; } free(matches); return [NSArray arrayWithArray:array]; } free(matches); return nil; } +(NSStringCategory *)regexWithPattern:(NSString *)pattern options:(int)options { return [[[NSStringCategory alloc] initWithPattern:pattern options:options] autorelease]; } +(NSStringCategory *)regexWithPattern:(NSString *)pattern { return [[[NSStringCategory alloc] initWithPattern:pattern options:0] autorelease]; } +(NSString *)null { return nullstring; } +(void)initialize { if(!nullstring) nullstring=[[NSString alloc] initWithString:@""]; } @end @implementation NSString (NSStringCategory) -(BOOL)matchedByPattern:(NSString *)pattern options:(int)options { NSStringCategory *re=[NSStringCategory regexWithPattern:pattern options:options|REG_NOSUB]; return [re matchesString:self]; } -(BOOL)matchedByPattern:(NSString *)pattern { return [self matchedByPattern:pattern options:0]; } -(NSString *)substringMatchedByPattern:(NSString *)pattern options:(int)options { NSStringCategory *re=[NSStringCategory regexWithPattern:pattern options:options]; return [re matchedSubstringOfString:self]; } -(NSString *)substringMatchedByPattern:(NSString *)pattern { return [self substringMatchedByPattern:pattern options:0]; } -(NSArray *)substringsCapturedByPattern:(NSString *)pattern options:(int)options { NSStringCategory *re=[NSStringCategory regexWithPattern:pattern options:options]; return [re capturedSubstringsOfString:self]; } -(NSArray *)substringsCapturedByPattern:(NSString *)pattern { return [self substringsCapturedByPattern:pattern options:0]; } -(NSString *)escapedPattern { int len=[self length]; NSMutableString *escaped=[NSMutableString stringWithCapacity:len]; for(int i=0;i<len;i++) { unichar c=[self characterAtIndex:i]; if(c=='^'||c=='.'||c=='['||c=='$'||c=='('||c==')' ||c=='|'||c=='*'||c=='+'||c=='?'||c=='{'||c=='\\') [escaped appendFormat:@"\\%C",c]; else [escaped appendFormat:@"%C",c]; } return [NSString stringWithString:escaped]; } @end I use the codes below to get the string between "" and "" NSStringCategory *a=[[NSStringCategory alloc] initWithPattern:@"<title([\s\S]*)</title>" options:0];// Unfortunately [a matchedSubstringOfString:response]] always returns nil I do not if the regular expression is wrong or any other reason. Welcome any comment Thanks interdev

    Read the article

  • Accessing "Mapi32.dll" with C#. [not solved]

    - by Code Smack
    Hello, I am using VS 2008 C# Windows Application. I have this DLL Import I am trying to use. [DllImport("Mapi32.dll", PreserveSig = true)] private static extern void WrapCompressedRTFStream( [MarshalAs(UnmanagedType.Interface)] UCOMIStream lpCompressedRTFStream, uint ulflags, [MarshalAs(UnmanagedType.Interface)] out UCOMIStream lpUncompressedRTFStream ); public const uint MAPI_MODIFY = 0x00000001; public const uint STORE_UNCOMPRESSED_RTF = 0x00008000; I have a compressed string that is in CompressedRFTFormat. How do I pass the string into the WrapCompressedRTFStream? I do not understand what the method is expecting. I am trying to use it on a button. RichText1.text = WrapCompressedRTFStream(_CompressedRichText.ToString(),something,somethingelse); The first error I get is "cannot convert from 'string' to 'System.Runtime.InteropServices.UCOMIStream" I hope someone who understands this posts an answer that helps!

    Read the article

  • Is there such a thing as a C# style extension method in C++ ?

    - by Gary Willoughby
    I'm currently learning C++ and i run into the simple problem of converting an int to a string. I've worked around it using: string IntToString(int Number) { stringstream Stream; Stream << Number; return Stream.str(); } but though it would be more elegant to use something like: int x = 5; string y = x.toString(); but how do i add the toString() method to a built in type? or am i missing something totally fundamental?

    Read the article

  • How to programmatically query bash completion for given string

    - by Ryan McKay
    I want to ask bash how it would complete a string as if I had typed it in a shell and hit tab. For example, if I type ls /[TAB][TAB] I see the list of files and dirs in / that could possibly complete the ls command. How do I ask bash how it would complete 'ls /' without typing it and hitting tab? I want something like: query_complete 'partial command line string' I read the man page for complete and compgen, but couldn't figure out how to do it with them. Note: 'ls /' is not the actual command I'm interested in, just an example. I am looking for a general solution for any arbitrary string representing a partial command line.

    Read the article

  • Excel CSV import treating quoted strings of numbers as numeric values, not strings

    - by MichaelOryl
    I've got a web application that is exporting its data to a CSV file. Here's one example row of the CSV file in question: 28,"65154",02/21/2013 00:00,"false","0316295","8316012,8315844","MALE" Since I can't post an image, I'll have to explain the results in Excel. The "0316295" field gets turned into a number and the leading 0 goes away. The "8316012,8315844" gets interpreted as one single number: 83,160,128,315,844. That is, most obviously, not the intended result. I've seen people recommend a leading single quote for such cases, but that doesn't really work either. 28,"65154",02/21/2013 00:00,"false","'0316295","'8316012,8315844","MALE" The single quote is visible at all times in the cell in Excel, though if I enter a number with a leading single quote myself, it shows just the intended string and not the single quote with the string. Importing is not the same as typing, it seems. Anybody have a solution here?

    Read the article

  • Blocking apache access via user agent string

    - by Tchalvak
    I've got a scripter who is using a proxy to attack a website I'm serving. I've noticed that they tend to access the site via software with a certain common user agent string (i.e. http://www.itsecteam.com/en/projects/project1_page2.htm "Havij advanced sql injection software" with a user_agent string of Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727) Havij). I'm aware that any cracking software worth it's salt will probably be able to modify it's user agent string, but I'm fine with the scripter having to deal with that feature at some point. So, is there any software out there for automatically blocking access & permanently blacklisting by matching user agent strings?

    Read the article

  • How to properly diagram lambda expressions or traversals through them in Architecture Explorer?

    - by MainMa
    I'm exploring a piece of code in Architecture Explorer in Visual Studio 2010 to study the relations between methods. I noticed a strange behavior. Take the following source code. It generates a hello message based on a template and a template engine, the template engine being a method (a sort of strategy pattern simplified at a maximum for demo purposes). public string GenerateHelloMessage(string personName) { return this.ApplyTemplate( this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName); } private string GenerateLocalizedHelloTemplate() { return "Hello {0}!"; } public string ApplyTemplate( Func<string, string, string> templateEngine, string template, string personName) { return templateEngine(template, personName); } public string DefaultTemplateEngine(string template, string personName) { return string.Format(template, personName); } The graph generated from this code is this one: Change the first method from this: public string GenerateHelloMessage(string personName) { return this.ApplyTemplate( this.DefaultTemplateEngine, this.GenerateLocalizedHelloTemplate(), personName); } to this: public string GenerateHelloMessage(string personName) { return this.ApplyTemplate( (a, b) => this.DefaultTemplateEngine(a, b), this.GenerateLocalizedHelloTemplate(), personName); } and the graph becomes: While semantically identical, those two versions of code produce different dependency graphs, and Architecture Explorer shows no trace of the lambda expression (while Visual Studio's code coverage, for example, shows them, as well as Code analysis seems to be able to understand that the link exists). How would it be possible, without changing the source code, to: Either force Architecture Explorer to display everything, including lambda expressions, Or make it traverse lambda expressions while drawing a dependency through them (so in this case, drawing the dependency from GenerateHelloMessage to DefaultTemplateEngine in the second example)?

    Read the article

  • ASp.NEt MVC: how to parse url string to get RouteData

    - by Feryt
    Hi. Is there any way hot to get RouteData from url string? I have login form with returlUrl as query string parameter. My routes are defined as : {languageCode}/{controller}/{action} In action method LogIn(string returlUrl) the returlUrl is something like "en/home/contacts" etc. I need to change languagePart a i dont want to use string.Replace, as routes may change in future. Thank you.

    Read the article

  • Help with regex to detect urls in a string

    - by Ali Taha Ali Mahboub
    Hi guys i found this regex to detect urls in a string and wraps them inside the tag public static String detectUrls(String text) { String newText = text .replaceAll("(?<!http://)www\\.[\\w/%.\\-?&=]+", "http://$0") .replaceAll("(?:https?|ftps?|http?)://[\\w/%.\\-?&=]+", "<a href='$0'>$0</a>"); return newText; } but this regex doesn't work with the following pattern: https://www.myserver.com so please advise.

    Read the article

  • Manually parse string as XAML Attribute

    - by bitbonk
    How does the XAML Parser convert the string "Red" in Foreground="Red" to a SolidColorBrush? Allthough I know the Types have System.ComponentModel.TypeConverter defined, I doupt that the WPF XAML parser acutally always uses those to convert the string to the brush. Are there any XAML APIs apart from XamlReader.Load (wich wants a valid xml string) that I could use to parse a single string as if it where an attibute for a certain property?

    Read the article

  • SQL: convert tokens in a string or elements of an array into rows of a table

    - by slowpoison
    Is there a simple way in SQL to convert a string or an array to rows of a table? For example, let's stay the string is 'a,b,c,d,e,f,g'. I'd prefer an SQL statement that takes that string, splits it at commas and inserts the resulting strings into a table. In PostgreSQL I can use regexp_split_to_array() and split the string into an array. So, if you know a way to insert an array's elements as rows into a table, that would work too.

    Read the article

  • Nothing else but Regex for matching the string.

    - by Harikrishna
    I want to check whether there is string starting from number and then optional character with the help of the regex.So what should be the regex for matching the string which must be started with number and then character might be there or not.Like there is string "30a" or "30" it should be matched.But if there is "a" or some else character or sereis of characters, string should not be matched.

    Read the article

  • Converting Unicode strings to escaped ascii string

    - by Ali
    How can I convert this string: This string contains the unicode character Pi(p) into an escaped ascii string: This string contains the unicode character Pi(\u03a0) and vice versa ? The current Encoding available in C#, converts the p character into "?". I need to preserve that character.

    Read the article

  • How to format this string in c#

    - by Rohit
    I have a setting stored in database which has a value .jpg|.gif|.png . I want to display it on frontend as ".jpg",".gif" and ".png" in a single string. for example Allowed formats are ".jpg",".gif" and ".png" I was able to seperate it using string fileTypes = String.Join(",", supportedFileTypes.Split('|')) How to specify and clause before the last string. It has to be dynamic. For example if we have .jpg|.gif in database, it should be Allowed formats are ".jpg" and ".gif".

    Read the article

  • cocoa - converting a double to string

    - by Mike
    I have a double number and I would like to convert it to string. The number is, for example, something like 24.043333332154465777... but if I convert it to string using something like NSString *myString = [NSString stringWithFormat:@"%f", myDouble]; The string is just 24.043333 how do I get a full string the corresponds to the whole double number? What other methods do I have to convert this?

    Read the article

  • Render an asp.net control from a text string

    - by madness
    Hi All, I'm not sure if it is possible to render an asp.net control from a string. The string contains fragments of html code and I've tried rendering that string to a div tag with runat="server" set, asp panel contain, asp lalbel control and asp literal control. All of them doesn't render the asp control in that text to an actual control, it just come up as a string. I've tried adding <% % around them and it appears it doesn't like it. Thanks in advance.

    Read the article

  • Case-Insensitive String Comparison not working in C#?

    - by SB2055
    Based on the answer to this question: C# Case insensitive string compare I'm trying to do a case-insensitive comparison without using Compare or ToLower: var user = db.Users.FirstOrDefault(s => String.Equals(s.Username, username, StringComparison.OrdinalIgnoreCase)); However I get an error: Incorrect number of arguments supplied for call to method 'Boolean Equals(System.String, System.String, System.StringComparison)' What am I doing wrong?

    Read the article

  • C++ Program Always Crashes While doing a std::string assign

    - by bbazso
    I have been trying to debug a crash in my application that crashes (i.e. asserts a * glibc detected free(): invalid pointer: 0x000000000070f0c0 **) while I'm trying to do a simple assign to a string. Note that I'm compiling on a linux system with gcc 4.2.4 with an optimization level set to -O2. With -O0 the application no longer crashes. E.g. std::string abc; abc = "testString"; but if I changed the code as follows it no longer crashes std::string abc("testString"); So again I scratched my head! But the interesting pattern was that the crash moved later on in the application, AGAIN at another string. I found it weird that the application was continuously crashing on a string assign. A typical crash backtrace would look as follows: #0 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 (gdb) bt #0 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 #1 0x00007f2c2663dbc3 in abort () from /lib64/libc.so.6 #2 0x00000000004d8cb7 in people_streamingserver_sighandler (signum=6) at src/peoplestreamingserver.cpp:487 #3 <signal handler called> #4 0x00007f2c2663bfb5 in raise () from /lib64/libc.so.6 #5 0x00007f2c2663dbc3 in abort () from /lib64/libc.so.6 #6 0x00007f2c26680ce0 in ?? () from /lib64/libc.so.6 #7 0x00007f2c270ca7a0 in std::string::assign (this=0x7f2c21bc8d20, __str=<value optimized out>) at /home/bbazso/ThirdParty/sources/gcc-4.2.4/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:238 #8 0x00007f2c21bd874a in PEOPLESProtocol::GetStreamName (this=<value optimized out>, pRawPath=0x2342fd8 "rtmp://127.0.0.1/mp4:pop.mp4", lStreamName=@0x7f2c21bc8d20) at /opt/trx-HEAD/gcc/4.2.4/lib/gcc/x86_64-pc-linux-gnu/4.2.4/../../../../include/c++/4.2.4/bits/basic_string.h:491 #9 0x00007f2c21bd9daa in PEOPLESProtocol::SignalProtocolCreated (pProtocol=0x233a4e0, customParameters=@0x7f2c21bc8de0) at peoplestreamer/src/peoplesprotocol.cpp:240 This was really weird behavior and so I started to poke around further in my application to see if there was some sort of memory corruption (either heap or stack) error that could be occurring that could be causing this weird behavior. I even checked for ptr corruptions and came up empty handed. In addition to visual inspection of the code I also tried the following tools: Valgrind using both memcheck and exp-ptrcheck electric fence libsafe I compiled with -fstack-protector-all in gcc I tried MALLOC_CHECK_ set to 2 I ran my code through lint checks as well as cppcheck (to check for mistakes) And I stepped through the code using gdb So I tried a lot of stuff and still came up empty handed. So I was wondering if it could be something like a linker issue or a library issue of some sort that could be causing this problem. Are there any know issues with the std::string that make is susceptible to crashing in -O2 or maybe it has nothing to do with the optimization level? But the only pattern that I can see thus far in my problem is that it always seems to crash on a string and so I was wondering if anyone knew of any issues that my be causing this type of behavior. Thanks a lot!

    Read the article

  • How to read empty string in c

    - by russell
    I have a problem with reading empty string in c.I want to read string from the following - 1.ass 2.ball 3.(empty) 4.cat but when i use gets() it does not treat (empty) as string[3].it read 'cat' as string[3].So how can i solve this problem.Which thing should i use?? plz someone help.

    Read the article

  • formtastic - :string field value as Array and not found-s

    - by Alexey Poimtsev
    Hi, is there any possibility to send from formtastic form value of :string field like - semantic_form_for :project do |form| - form.inputs do = form.input :task_ids, :as => :string as Array? Currently value of this field is sending as String and i'd like to no parse this string in controller. Also, could you give me idea - if task with submitted id is not found - what is best way to catch this situation - validation in controller or what?

    Read the article

  • Change A Character In A String Using Actionscript

    - by Joshua
    What is the opposite of String.charAt()?? If I Have a string: var Str:String="Hello World"; How do I change the 5th character, for example, from a ' ' to an '_'? I can GET the 5th character like this: var C:String=Str.charAt(5); But how do I SET the 5th character? Thanks in advance.

    Read the article

  • read length of string from stdin

    - by teoz
    I want to take a string from stdin but I don't want a static array of fixed size I know that scanf need something where save the stdin input, but I can't do something like this: char string[10] scanf("%s",string); becouse I need to know before how long will be the string in order to allocate the right memory space. Can you help me to resolve this problem?

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >