Search Results

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

Page 177/1413 | < Previous Page | 173 174 175 176 177 178 179 180 181 182 183 184  | Next Page >

  • Need to convert a ZIP file to a random text file.

    - by Arsheep
    As title says need to convert a Zip file to text file , no matter the size and no matter if it will make sense or not.But i need to reconvert it to that zip file again (Lose less). The main problem i am having is how to find a alternative text/number version of a character. The Ascii wont work clearly ,So need help what can be a alternative text for a character specially that garbage looking binary chars in zip , when you see in a editor. I am not a native English speaker , so i hope the above will make a sense to you guys :)

    Read the article

  • remove the spaces...

    - by tekknolagi
    !/usr/bin/python import random lower_a = ['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'] upper_a = ['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'] num = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] all = [] all = " ".join("".join(lower_a) + "".join(upper_a) + "".join(num)) all = all.split() x = 0 while x < 10: for i in range(7): a = random.choice(all) print a, print x += 1 what i want to do is remove the spaces from the output what it gives now is Z 3 a A I K R G B i N 9 c E v g E r A N 8 e B 6 d v H O c a V 8 c x y b g 2 W a T T f 8 H T r 6 E p D K l 5 p u x q 8 P Z 9 T n I W X n B Q

    Read the article

  • Error comparing hash to hashed mysql password (output values are equal)

    - by Charlie
    Im trying to compare a hashed password value in a mysql database with the hashed value of an inputted password from a login form. However, when I compare the two values it says they aren't equal. I removed the salt to simply, and then tested what the outputs were and got the same values $password1 = $_POST['password']; $hash = hash('sha256', $password1); ...connect to database, etc... $query = "SELECT * FROM users WHERE username = '$username1'"; $result = mysql_query($query); $userData = mysql_fetch_array($result); if($hash != $userData['password']) //incorrect password { echo $hash."|".$userData['password']; die(); } ...other code... Sample output: 7816ee6a140526f02289471d87a7c4f9602d55c38303a0ba62dcd747a1f50361| 7816ee6a140526f02289471d87a7c4f9602d55c38303a0ba62dcd747a1f50361 Any thoughts?

    Read the article

  • Render view as string when Ajax request to view is made

    - by mare
    I have my views render to route requests like /controller/action (for instance, /Page/Create), so pretty classic. I am creating a form where view will be loaded through AJAX request with jQuery get(), so essentially I need my Views or to be precise, my controller actions, to return plain HTML string when an AJAX request is made to the route that renders the View. I want to use the same views as for normal requests, so I cannot afford to create any new views. It is something like calling RenderPartial("MyViewUserControl") but from inside the JS code.

    Read the article

  • Python structure mistake

    - by jaddy123
    I'm writing a program in which I can Reverse the sequence and Replace all As with Ts, all Cs with Gs, all Gs with Cs, and all Ts with As. the program is to read a sequence of bases and output the reverse complement sequence. I am having trouble to do it so can anyone please help me with this by having a look on my code: word = raw_input("Enter sequence: ") a = word.replace('A', 'T') b = word.replace('C', 'G') c = word.replace('G', 'C') d = word.replace('T', 'A') if a == word and b == word and c == word and d == word: print "Reverse complement sequence: ", word And I want this sort of output: Enter sequence: CGGTGATGCAAGG Reverse complement sequence: CCTTGCATCACCG Regards

    Read the article

  • C# String builder, displaying data nicely spaced out.

    - by Sef
    Hello, I am wondering how exactly can i order my date nicely in a stringbuilder? Meaning something equal to ("{0,2}", ....) to space the data nicely out. I do not want to use consolewrites of any kind, so the class can be re-used in a form, console code etc... Currently i am using " " for the spacing, but in overall it does not give a proper display. (it messed up when i have numbers with more then 1 digit) public override string ToString() { StringBuilder builder = new StringBuilder(); foreach (int value in tabel) { builder.Append(value); // should have something similiar to ("{0,2}", ....) builder.Append(" "); // should have something similiar to ("{0,2}", ....) } builder.Append("(top:"); builder.Append(top); builder.Append(")"); return builder.ToString(); }/*ToString*/ Regards.

    Read the article

  • String Manipulation in Bash

    - by user348000
    Hello- I am a newbie in Bash and I am doing some string manipulation. I have the following file among other files in my directory: jdk-6u20-solaris-i586.sh I am doing the following to get jdk-6u20 in my script: myvar=`ls -la | awk '{print $9}' | egrep "i586" | cut -c1-8` echo $myvar but now I want to convert jdk-6u20 to jdk1.6.0_20. I can't seem to figure out how to do it. It must be as generic as possible. For example if I had jdk-6u25, I should be able to convert it at the same way to jdk1.6.0_25 so on and so forth Any suggestions?

    Read the article

  • How to move positions within an array?

    - by Jade Mulholland
    A program that simply moves array elements. Two variables: userInputVariable and blankSpaceVariable. I have a 2D array named table. Defined as table[userInputVariable + 1][6] I am printing out this array in a table format, and the far left column is numbered by whatever number the user entered at the beginning of the program. I then ask the user where they would like to enter a blank space within the array. This blank space acts like a divider for all the other information in the array. For example, if the user enters 10 at the start for the userInputVariable, and then enters 5 for the blank space. Once printed, the numbers should go like this: 1, 2, 3, 4, --, 5, 6, 7, 8, 9, 10. My plan has been to create a for loop and try to move all the numbers in the array back a position starting from the blank space variable. What I currently have, but does not work: for (int i = blankSpaceVariable; i < table.length - 1; i++) { table[i] = table[i + 1]; } table[blankSpaceVariable] = "--"; With my current code, the numbers go like this: 1, 2, 3, 4, 6, 7, 8, 9, 10 Tried completing this a few different ways also, but the other info within my 2D array didn't move with the numbers. So I thought that this approach can hopefully move all the info within my 2D array down, and make way for a blank section. All help is greatly appreciated!

    Read the article

  • An attempt to attach an auto-named database for file failed in Vb.Net

    - by user2454135
    I am Trying to connect database for first time , and I am getting this error : An attempt to attach an auto-named database for file VBTestDB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. and getting error on myconnect.Open() Heres my code : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myconnect As New SqlClient.SqlConnection myconnect.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=VBTestDB.mdf;Integrated Security=True;User Instance=True;" Dim mycommand As SqlClient.SqlCommand = New SqlClient.SqlCommand() mycommand.Connection = myconnect mycommand.CommandText = "INSERT INTO Card (CardNo,Name) VALUES (@cardno,@name)" myconnect.Open() Try mycommand.Parameters.Add("@cardno", SqlDbType.Int).Value = TextBox1.Text mycommand.Parameters.Add("@name", SqlDbType.NVarChar).Value = TextBox2.Text mycommand.ExecuteNonQuery() MsgBox("Success") Catch ex As System.Data.SqlClient.SqlException MsgBox(ex.Message) End Try myconnect.Close() End Sub

    Read the article

  • Java: How to store Vector<String[]> in XML (or save in any other way)

    - by hatboysam
    Basically I have a proof-of-concept application that is a digital recipe book. Each Recipe is an object and each object has, among other fields, a Vector containing arrays. The Vector is the list of all ingredients in the Recipe while each ingredient has an array showing the name of the ingredient, the amount, and the unit for that amount. I want to save each Recipe to XML so that they can be accessed by the user. How can I store a Vector of String arrays in XML or any other sort of file so that it can later be recalled and accessed?

    Read the article

  • How can I give a color to imagecolorallocate?

    - by Roman
    I have a PHP variable which contains information about color. For example $text_color = "ff90f3". Now I want to give this color to imagecolorallocate. The imagecolorallocate works like that: imagecolorallocate($im, 0xFF, 0xFF, 0xFF); So, I am trying to do the following: $r_bg = bin2hex("0x".substr($text_color,0,2)); $g_bg = bin2hex("0x".substr($text_color,2,2)); $b_bg = bin2hex("0x".substr($text_color,4,2)); $bg_col = imagecolorallocate($image, $r_bg, $g_bg, $b_bg); It does not work. Why? I try it also without bin2hex, it also did not work. Can anybody help me with that?

    Read the article

  • Returning an array from an activity

    - by Boardy
    I am currently working on an android project and I want to be able to startActivityForResult so that I can return an array of. The array is an ArrayList<Spanned> lets say its called myArray. From what I've read I can't return an array directly from the activty using the set result so I was thinking that once the array has added all the data to the array, I can then call the toString function on it, i.e. myArray.toString(). If I do this, I have no idea how I can then convert this back into the original ArrayList<Spanned>. Thanks for any help you can provide.

    Read the article

  • Getting MATLAB variable (string) from C

    - by Hamming
    Hi! I'm writing a small C application that launchs a Matlab script (.m file). I need to exchange some variables and I don't know how to get an array of chars that exists in Matlab. I'm doing something like this: enter code here result = engGetVariable(ep,"X"); if (!result) { printf ("Error..."); exit -1; } int n = mxGetN(result); char *varx = NULL; memcpy(varx, mxGetData(result),n*sizeof(char)); It doesn't work. Does someone know how to get a Matlab string in C? I've read Matlab documentation about engGetVariable() and the provided example but any of this things clarify me.

    Read the article

  • convert string array to cell in MATLAB

    - by Maddy
    I need to output a cell to an excel file. Before this I need to convert a date column of integers to datestrings. I know how to do this, but I am not able to put this new string array back into the cell - mycell = { 'AIR' [780] [1] [734472] [0.01] ; ... 'ABC' [780] [1] [734472] [0.02]} I did this -- dates = datestr(cell2mat(mycell(:,4))) ; What I need as an answer is: {'AIR' [780] [1] '14-Dec-2010' [0.01] ; 'ABC' [780] [1] '23-Dec-2010' [0.03] ; } so that I can now send it to an excel file using xlswrite.m

    Read the article

  • Remove specified text from beginning of lines only if present (C#)

    - by Zach
    I have a textbox in which the user can edit text, in a scripting language. I've figured out how to let the user comment out lines in one click, but can't seem to figure out how to uncomment properly. For example, if the box has: Normal Text is here More normal text -- Commented text -- More commented text Normal Text again --Commented Text Again So, when the user selects any amount of text and decides to uncomment, the "--" is removed from the beginning of the lines that have it. The lines without the "--" should be unaffected. In short, I want an uncomment function that performs similar to the one in Visual Studio. Is there any way to accomplish this? Thanks

    Read the article

  • C++ MFC how to compare LPCTSTR in a if statement?

    - by user1078510
    I have the following code: LPCTSTR strPermission = Method(); if (strPermission == L"0") { return true; } else { return false; } While debugging I can see that strPermission does equal "0", yet when I compare it like in the if statement it always returns false. The only thing I can think of is that it is comparing the memory address of the variable rather than the variable value. How do I compare strPermission to L"0" so that it would return true if strPermission equals "0". Thank you!

    Read the article

  • Getting number of days between [NSDate date] and string @"2010-11-12"

    - by grobald
    Hello i have a question. in short: i need a function which receives [NSDate date] and string @"2010-11-12" and returns the amount of days between those two dates. more explanation: I need to store a date from a server in the format @"2010-11-12" in my NSUserdefaults. The meaning of this date is the expireDate of a feature in an iPhone App. Everytime i press on a button for this feature i need to check if the difference in days between the current time-[NSDate date] and @"2010-11-12" is greater than 0. That means tahat the feature is disabled. its making me crazy mabey its to dead simple.

    Read the article

  • Return Empty String as NULL

    - by Daniel
    I have a listbox select and I want when the user selects null for the empty string it produces to pull the nulls from the SQL table. Here's what I have now. Blank strings return nothing because there are no empty fields in the table. SELECT * FROM dbo.Table WHERE ID = " & TextBox2.Text & " and And Field1 IN (" & Msg1 & ") How do I code that?

    Read the article

  • Using Ruby to scan through a string

    - by nekosune
    I am trying to create a regex to gather info from strings that look like this: A22xB67-E34... for any number. I have the regex: @spaceCode = "[A-Z]([A-Z0-9][0-9]|[0-9])" @moveCode=/^(?<one>#{@spaceCode})((?<mode>x|\-)(?<two>#{@spaceCode}))+$/ However I get: s="A11-A22xA33".scan(@moveCode) => [["A11", "11", "xA33", "x", "A33", "33"]] which is most definatly NOT what I want. The string could be any length of C22 etc, with either x or - as the seperator, and put it into an array like: ['A22','x',B22','-'.......] Examples: "A22xB23-D23xE25" => ['A22','x','B23','=','D23','E25;] "AA2xA9-A1" => ['AA2','x','A9','-','A1']

    Read the article

  • Different sizes of same strings - Telnet programming

    - by tommyogp
    Hi all, I have been trying to create an iphone app sending telnet command. However what puzzling me is that the sizes of certain strings are so much different, particularly when they include \n or \r. I listed out a few examples. Please assist. const char *a = "play 25\n"; int sizeBitA1 = sizeof(a); // 8 units int sizeBitA2 = sizeof("play 25\n"); // 9 units const char *b = "\r\n"; int sizeBitB1 = sizeof(b); // 8 units int sizeBitB2 = sizeof("\r\n"); // 3 units

    Read the article

  • mysql_real_escape_string & slashes (again, oh yes)

    - by Fizzadar
    Righto, firstly magic quotes & runtime are disabled correctly in php.ini, and confirmed by phpinfo(). PHP version: 5.3.4 MySQL version: 5.1.52 I'm only use mysql_real_escape_string on the data, after htmlspecialchars and a trim, that's all the data cleaning on the variable. Yet, when I submit a single quote, the slash remains in the database. When running mysql_query I'm using "' . $var . '", although in the past this hasn't changed anything (could be due to the double quotes?). Any ideas? and please don't tell me about PDO/prepared statements, I'm aware of them and I have my reasons for doing it this way. Thanks!

    Read the article

  • get look up a string given a func<T,object> param

    - by Sammy
    given this code namespace GridTests { public class Grid<T> { IEnumerable<T> DataSource { get; set; } IList<Column> Columns = new List<Column>(); class Column { public string DisplayText { get; set; } Func<T, object> Rowdata { get; set; } } } } I need to be able to loop through the columns collection and get the Rowdata's object value using the DisplayText. Thanks

    Read the article

  • how to convert the string into json object?

    - by Holicreature
    I use the ajax which sends back a string.. I want to convert the responsetext into a json object to process. I tried eval and also , but doesn't works... Wht to do? My code is function handleResponse() { if(httpa.readyState == 4){ var response = httpa.responseText; if(response!='empty') { alert(response); var foo = eval('(' +strJSON+ ')'); alert (foo); } } } // response alerts [{"id":"1","name":"Pepsodent 100g","selling_price":"28.75"},{"id":"2","name":"Pepsodent 40g","selling_price":"18.90"},{"id":"3","name":"Pepsodent brush","selling_price":"19.50"}]

    Read the article

< Previous Page | 173 174 175 176 177 178 179 180 181 182 183 184  | Next Page >