Search Results

Search found 36172 results on 1447 pages for 'unicode string'.

Page 101/1447 | < Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >

  • get all words using java

    - by hussain
    i want to know how to get all word using java String first[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String second[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"}; String ch =""; String total[]; for(int i = 0;i<26;i++) { for(int j = 0;j<26;j++) { ch+=first[i]+first[j]; System.out.println(ch); } } i get only 576 words only by this program but the 26! words is 4.03291461 × 1026 how to write the program in java thanks and advance

    Read the article

  • How can I remove all the files which has a string in a file

    - by michael
    Hi, I am trying to remove all the files in a directory hierarchy which a certain string inside the file (not the file name, it is the file content). I can list out all the file name which has a string in the file using 'grep -r -l mystringlooking for'. But how can I remove all the files returned by the grep ? I am trying this on ubuntu. Thank you.

    Read the article

  • turning text into image - PHP/GD - save image

    - by Phil Jackson
    Hi, I'm using this script to simply create an image from text. What I would like to know is how to save the image instead of printing straight to browser; // an email address in a string $string = $post[$key]; // some variables to set $font = 4; $width = ImageFontWidth($font) * strlen($string); $height = ImageFontHeight($font); // lets begin by creating an image $im = @imagecreatetruecolor ($width,$height); //white background $background_color = imagecolorallocate ($im, 255, 255, 255); //black text $text_color = imagecolorallocate ($im, 0, 0, 0); // put it all together $image = imagestring ($im, $font, 0, 0, $string, $text_color); I know its probably just one line of code at the end but im not sure which GD function to use. Any help would be much appreciated, Regards, Phil.

    Read the article

  • strtod() and sprintf() inconsistency under GCC and MSVC

    - by Dmitry Sapelnikov
    I'm working on a cross-platform app for Windows and Mac OS X, and I have a problem with two standard C library functions: strtod() - string-to-double conversion sprintf() - when used for outputting double-precision floating point numbers) Their GCC and MSVC versions return different results. I'm looking for a well-tested cross-platform open-source implementation of those functions, or just for a pair of functions that would correctly and consistently convert double to string and back. I've already tried the clib GCC implementation, but the code is too long and too dependent on other source files, so I expect the adaptation to be difficult. What implementations of string-to-double and double-to-string functions would you recommend?

    Read the article

  • Translate from Java to C#: simple code to re-encode a string

    - by Dr. Zim
    We were sent this formula to encrypt a string written in Java: String myInput = "test1234"; MessageDigest md = MessageDigest.getInstance("SHA"); byte[] myD = md.digest(myInput.getBytes()); BASE64Encoder en64 = new BASE64Encoder(); String myOutput = new String ( Java.net.URLEncoder.encode( en64.encode(myD))); // myOutput becomes "F009U%2Bx99bVTGwS3cQdHf%2BJcpCo%3D" Our attempt at writing this in C# is: System.Security.Cryptography.SHA1 sha1 = new System.Security.Cryptography.SHA1CryptoServiceProvider(); string myOutput = HttpUtility.UrlEncode( Convert.ToBase64String( sha1.ComputeHash( ASCIIEncoding.Default.GetBytes(myInput)))); However the output is no where near the same. It doesn't even have percent signs in it. Any chance anyone would know where we are going wrong?

    Read the article

  • Is there a generic way of dealing with varying connection strings in C#?

    - by James Wiseman
    I have an application that needs to connect to a SQL database, and execute a SQL Agent Job. The connection string I am trying to access is stored in the registry, which is easily enough pulled out. This appliction is to be run on multiple computers, and I cannot guarantee the format of this connection string being consistent across these computers. Two that I have pulled out for example are: Data Source=Server1;Initial Catalog=DB1;Integrated Security=SSPI; Data Source=Server2;Initial Catalog=DB1;Provider=SQLNCLI.1;Integrated Security=SSPI;Auto Translate=False; I can use an object of type System.Data.SqlClient.SqlConnection to connect to the database with the first connection string, howevever, I get the following error when I pass the second to it: keyword not supported: 'provider' Similarly, I can use the an object of type System.Data.OleDb.OleDbConnection to connect to the database with the second connection string, howevever, I get the following error when I pass the first to it: An OLEDB Provider was not specified in the ConnectionString' I can solve this by scanning the string for 'Provider' and doing the connect conditionally, however I can't help but feel that there is a better way of doing this, and handle the connection strings in a more generic fashion. Does anyone have any suggestions?

    Read the article

  • error with string list in C#

    - by Chelsea_cole
    Same namespace: 2 forms. public class Account //frm1 { public string Username; public string Password; } public class ListAcc { public static List<Account> UserList; } private void button1_Click(object sender, EventArgs e) { List<Account> UserList = new List<Account>(); Account acc = new Account(); acc.Username = textBox1.Text; acc.Password = textBox2.Text; UserList.Add(acc); } private void button2_Click(object sender, EventArgs e) //frm2 { string p = frmDangky.ListAcc.UserList[0].Username; // null ->error string p = frmDangky.ListAcc.UserList[0].Password; // null ->error } Someone help me? :( why my string is NULL???????? The textBox is not empty... Thanks!

    Read the article

  • Date conversion in Java

    - by llm
    How can I take a string in a format such as: 2008-06-02 00:00:00.0 and convert it to: 02-Jun-2008? Can I somehow take the original string, convert it to a Date object, then use a formatter to get the final output (rather than parsing the string myself)? Thanks!

    Read the article

  • Regular Expression

    - by Malcolm
    I want regular expression that checks that the string doesnt start with an empty space. Some what like this i want to do : Is the below ValidationExpression right for it : string ValidationExpression = @"/^[^ ]/"; if (!String.IsNullOrEmpty(GroupName) && !Regex.IsMatch(GroupName, ValidationExpression)) { }

    Read the article

  • How to initialize an std::string using ""?

    - by Mohsin
    I'm facing problems with initializing a std::string variable using "" (i.e. an empty string). It's causing strange behavior in code that was previously working. Is the following statement wrong? std::string operationalReason = ""; When I use the following code everything works fine: std::string operationalReason; operationalReason.clear(); I believe that string literals are stored in a separate memory location that is compiler-dependent. Could the problem I'm seeing actually be indicating a corruption of that storage? If so, it would get hidden by my usage of the clear() function. Thanks.

    Read the article

  • Help with \0 terminated strings in C#

    - by Joshua
    I'm using a low level native API where I send an unsafe byte buffer pointer to get a c-string value. So it gives me // using byte[255] c_str string s = new string(Encoding.ASCII.GetChars(c_str)); // now s == "heresastring\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0(etc)"; So obviously I'm not doing it right, how I get rid of the excess?

    Read the article

  • Iptables string

    - by Mr. BeatMasta
    I have an iptables rule like this: iptables -t nat -I PREROUTING -p tcp --dport 80 -s 192.168.1.2 -j DNAT --to-destination 192.168.1.1:80 it works perfectly.. but I want to redirect only for one URL like this: iptables -t nat -I PREROUTING -p tcp --dport 80 -s 192.168.1.2 -m string --string "google.com" -j DNAT --to-destination 192.168.1.1:80 which does not work in any way... please help me with this

    Read the article

  • Add String to adapter

    - by Waggoner_Keith
    I have an adapter and i want to add a string to it but when i run this code it only add the last string in the songstoadd variable ... That is a custom adapter which adds dividers in where neccessary but in the Array Adapter i want to a all of the strings that have the same first letter in their name .... SeparatedListAdapter adapter = new SeparatedListAdapter(this); ArrayList<String> songstoadd = new ArrayList<String>(); Collections.sort(songtitle); int m = 0; while( m <songtitle.size()-1){ if(songtitle.get(m).substring(0, 1) == songtitle.get(m+1).substring(0, 1)){ m++; }else{ songstoadd.clear(); songstoadd.add(songtitle.get(m)); adapter.addSection(songtitle.get(m).substring(0, 1), new ArrayAdapter<String>(getApplicationContext(),R.layout.song, songstoadd)); m++; } } setListAdapter(adapter); }

    Read the article

  • how many times a word appears into a txt file

    - by m4g4bu
    I've a problem when i tried to count how many time a word appears into a txt file. 1/ I create a textfield ( txta ) 2/ I create a button to apply the action ( btn ) 3/ I create a textarea ( area ) that is the place where the content of the file is displayed When I select the file, the content of the file is displayed on area, then I enter the word in txta to search and then I clicked the btn but the code is not working public int contarPalabras(String chain, String word) { // Recibe un string y una palabra y devuelve la cantidad de veces que encontró esa palabra en el string. // Si no encuentra la letra devuelve (-1). int cant = 0; int intIndex = chain.indexOf(word); if(intIndex == - 1){ cant = -1; }else{ cant = intIndex; } return cant; }

    Read the article

  • how to test if a string is a valid UTF16 string?

    - by superb
    I am using mongodb and javascript to do some string processing. Now I got some error like: Sun May 23 07:42:20 Assertion failure JS_EncodeCharacters( _context , s , srclen , dst , &len) scripting/engine_spidermonkey.cpp 152 0x80f4f7e 0x80f8794 0x811525b 0x811a953 0x8119fc4 0x8111bc5 0x81b408e 0x81c4ee7 0x81b4a10 0x817a881 0x817a7d8 0x817a6e2 0x811e1bb 0x80a777b 0x80a8f8a 0xb7cb2455 0x80a37a1 mongodb-linux-i686-1.4.2/bin/mongo(_ZN5mongo12sayDbContextEPKc+0xfe) [0x80f4f7e] After doing some google, I find that JS_EncodeCharacters return false if the input is not a valid UTF16 string. (if spidermonkey is build with UTF-8 enabled) So I was wondering how to test if the input string if a proper UTF16 string? so I can skip such kind of string to avoid problem ... Thanks

    Read the article

  • Coldfusion: how to extract a substring using regex

    - by justNeo
    I have a string that has some double quoted substring in it, the " character. In between the double quotes is the data i want. How can i write a regex to extract "the first data i want" and "the second data i want" from this: 'some string with "the first data i want" and "the second data i want"' I tried the following code. <cfset mydata = 'some string with "the first data i want" and "the second data i want"'/> <cfset arrData = ListToArray(mydata ,'"') />

    Read the article

  • How to lowercase every element of a collection efficiently?

    - by Chris
    Whats the most efficient way to lower case every element of a list or set? My idea for a List: final List<String> strings = new ArrayList<String>(); strings.add("HELLO"); strings.add("WORLD"); for(int i=0,l=strings.size();i<l;++i) { strings.add(strings.remove(0).toLowerCase()); } is there a better, faster way? How would this exmaple look like for a set? As there is currently no method for applying an operation to each element of a set (or list) can it be done without creating an additional temporary set? Something like this would be nice: Set<String> strings = new HashSet<String>(); strings.apply( function (element) { this.replace(element, element.toLowerCase();) } ); Thanks,

    Read the article

  • casting BSTR as char* in a dll; different results depnding on VB/C# caller.

    - by Toby Wilson
    I have a dll function that takes BSTR parameters. These are casted as char* before being used for other things. When the dll is called from VB code this works fine. However, when it is called from C# code, only the first character is pointed to. Both of these are excel addIns for Pre-2007 and 2007+ versions of Office, which call into a faster C++ AddIn. They actually call it directly, not through Excel. The VB function declaration looks like this: Private Declare Function Test Lib "ExcelAddIn.xll" (ByVal param As String) As String The C# function declaration looks like this: [DllImport("ExcelAddIn.xll", CharSet=CharSet.Ansi)] [return:MarshalAs(UnmanagedType.BStr)] private static extern string Test([MarshalAs(UnmanagedType.BStr)] string param); When debugging the dll and watching the input BSTR values, they appear to be correct from both; just the C# one only casts the first character. Charset=CharSet.Unicode makes no difference. Any ideas anyone?

    Read the article

  • Comparing strings that contain formatting in C#

    - by Finglas
    I'm working on a function that given some settings - such as line spacing, the output (in string form) is modified. In order to test such scenarios, I'm using string literals, as shown below for the expected result. The method, using a string builder, (AppendLine) generates the said output. One issue I have run into is that of comparing such strings. In the example below, both are equal in terms of what they represent. The result is the area which I care about, however when comparing two strings, one literal, one not, equality naturally fails. This is because one of the strings emits line spacing, while the other only demonstrates the formatting it contains. What would be the best way of solving this equality problem? I do care about formatting such as new lines from the result of the method, this is crucially important. Code: string expected = @"Test\n\n\nEnd Test."; string result = "Test\n\n\nEnd Test"; Console.WriteLine(expected); Console.WriteLine(result); Output: Test\n\n\nEnd Test. Test End Test

    Read the article

  • What is an efficient way to erase substrings?

    - by Legend
    I have a long string and a set of <end-index, string> list like the following: long_sentence = "This is a long long long long sentence" indices = [[6, "is"], [8, "is a"], [18, "long"], [23, "long"]] An element 6, "is" indicates that 6 is the end index of the word "is" in the string. I want to get the following string in the end: >> print long_sentence This .... long ......... long sentence" I tried an approach like this: temp = long_sentence for i in indices: temp = temp[:int(i[0]) - len(i[1])] + '.'*(len(i[1])+1) + temp[i[0]+1:] While this seems to be working, it is taking exceptionally long time (more than 6 hours on 5000 strings inside a 300 MB file). Is there a way to speed this up?

    Read the article

  • error string list handle in C#

    - by Chelsea_cole
    Same namespace: 2 forms. public class Account //frm1 { public string Username; public string Password; } public class ListAcc { public static List<Account> UserList; } private void button1_Click(object sender, EventArgs e) { List<Account> UserList = new List<Account>(); Account acc = new Account(); acc.Username = textBox1.Text; acc.Password = textBox2.Text; UserList.Add(acc); } private void button2_Click(object sender, EventArgs e) //frm2 { string p = frmDangky.ListAcc.UserList[0].Username; // null ->error string p = frmDangky.ListAcc.UserList[0].Password; // null ->error } Someone help me? :( why my string is NULL???????? The textBox is not empty... Thanks!

    Read the article

  • Newline not showing correctly in textbox

    - by TheGateKeeper
    I am loading a string from my database which among other things contains line breaks (\r\n). However, this isn't being rendered as a new line but instead as \r\n. If I type it directly in instead of loading it from a string, it works just fine but I need to be able to load it from a string. Any ideas? Edit: Upon closer inspection, it looks like the string is being returned as: Changed test7\\r\\nChanged test8\\r\\nChanged test9Changed test7 From the database. I tried running a .Replace(@"\\", @"\") on it but this had no effect at all. Any ideas?

    Read the article

  • How can i convert a string into byte[] of unsigned int 32 C#

    - by Miroo
    i have string like "0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0xFF" i wanna convert it into byte[] key= new byte[] { 0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0xFF}; i thought about splitting the string by ',' then loop on it and setvalue into another byte[] in index of i string Key = "0x5D, 0x50, 0x68, 0xBE, 0xC9, 0xB3, 0x84, 0xFF"; string[] arr = Key.Split(','); byte[] keybyte= new byte[8]; for (int i = 0; i < arr.Length; i++) { keybyte.SetValue(Int32.Parse(arr[i].ToString()), i); } but seems like it doesn't work i get error in converting the string into unsigned int32 on the first beginning an help would be appreciated

    Read the article

  • SQL Connection String to access localhost\SQLEXPRESS

    - by user34683
    I've installed SQL Express on my PC hoping to do some practice creating tables and then modifying them. I coded a webpage in Visual Studio to, basically, SELECT * from a table in the SQLEXPRESS, but I can never get the connection string to work. Please help My connection string "Data Source=localhost\SQLEXPRESS;Initial Catalog=test;User Id=xaa9-PC\xaa9;Password=abcd;" Error Message: Query is select * from tblCustomers where username='johndoe' error is Login failed for user 'xaa9-PC\xaa9'.

    Read the article

< Previous Page | 97 98 99 100 101 102 103 104 105 106 107 108  | Next Page >