Search Results

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

Page 201/1413 | < Previous Page | 197 198 199 200 201 202 203 204 205 206 207 208  | Next Page >

  • Regex Help with manipulating string

    - by user310070
    Hi, i am seriously struggling to get my head around regex. I have a sring with "iPhone: 52.973053,-0.021447" i want to extract the two numbers after the colon into two seperate strings so delimited by the comma. Can anyone help me? Cheers

    Read the article

  • Solve code issue - string identity testing

    - by kovibb
    Please for help with shell script. I really dont understand where is problem. Where I write to the Input variable for example /home/Kovi/Deskop/netlist.exe I still get true answer but the extension "exe" is not "scs". I also try "==" but it didnt working. Please some advice. Thank you very much. echo -n "Insert Entire Path (with file name and it's extension) of Input Netlist > " read Input if [ "${Input##*.}"="scs" ]; then echo "Patch verification is succesful.; else echo "Patch verification is failed, script was aborted. File dont exist or is empty or unreadable or is not spectre netlist." error_exit; fi

    Read the article

  • Check if key exists in $_SESSION by building index string

    - by Kim
    I need to check if a key exists and return its value if it does. Key can be an array with subkeys or endkey with a value. $_SESSION['mainKey']['testkey'] = 'value'; var_dump(doesKeyExist('testkey')); function doesKeyExist($where) { $parts = explode('/',$where); $str = ''; for($i = 0,$len = count($parts);$i<$len;$i++) { $str .= '[\''. $parts[$i] .'\']'; } $keycheck = '$_SESSION[\'mainKey\']' . $str; if (isset(${$keycheck})) { return ${$keycheck}; } // isset($keycheck) = true, as its non-empty. actual content is not checked // isset(${$keycheck}) = false, but should be true. ${$var} forces a evaluate content // isset($_SESSION['mainKey']['testkey']) = true } What am I doing wrong ? Using PHP 5.3.3.

    Read the article

  • How to control utf-8 string paddings

    - by Kev
    I got three UTF-8 stings: hello, world hello, ?? hello, ?rld I only want the first 10 chars so that the bracket in one column: [hello, wor] [hello, ? ] [hello, ?r] In console: width('??')==width('worl') width('? ')==width('wor') #a white space behind '?' python's format() doesn't help when UTF-8 chars mixed in >>> for s in ['[{0:<{1}.{1}}]'.format(s, 10) for s in ['hello, world', 'hello, ??', 'hello, ?rld']]: ... print(s) ... [hello, wor] [hello, ?? ] [hello, ?rl] So, I wonder if there is a standard way to do the UTF-8 padding staff?

    Read the article

  • efficiently convert string (or tuple) to ctypes array

    - by Mu Mind
    I've got code that takes a PIL image and converts it to a ctypes array to pass out to a C function: w_px, h_px = img.size pixels = struct.unpack('%dI'%(w_px*h_px), img.convert('RGBA').tostring()) pixels_array = (ctypes.c_int * len(pixels))(*pixels) But I'm dealing with big images, and unpacking that many items into function arguments seems to be noticeably slow. What's the simplest thing I can do to get a reasonable speedup? I'm only converting to a tuple as an intermediate step, so if it's unnecessary, all the better.

    Read the article

  • PHP Count the lenght of each value in a array/string (tags)

    - by 2by
    Users writing an article have the option to write some tags, tags are written like this: tag1, tag2, tag3 So tags are stored like: $tags = "tag1, tag2, tag3"; I want to make sure, every tag has a minimum of 3 characters, so i need to validate the tags. I have tried this: $tagsstring = explode(",", $tags); $tagslength = array_map('strlen', $tagsstring); if (min($tagslength) < 3) { echo "Error... Each tag has to be at least 3 characters."; } It seems to work, sometimes... But of you write: tag1, df It wont give an error. Any suggestions?

    Read the article

  • insert mysql record with table format in a string then echo in a html

    - by user1292042
    Ok, I have this code. $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("juliver", $con); $result = mysql_query("SELECT * FROM items"); while($row = mysql_fetch_array($result)) { $hi1='<img src="'.$row['name'].'" />'; $hi2= $row['title']; $hi3= $row['description']; $hi4= $row['link']; } Now, Im in a process of making those records above to display in a table view and that 4 row should be on one td and so the rest.

    Read the article

  • .Net Removing all the first 0 of a string

    - by Melursus
    I got the following : 01.05.03 I need to convert that to 1.5.3 The problem is I cannot only trim the 0 because if I got : 01.05.10 I need to convert that to 1.5.10 So, what's the better way to solve that problem ? Regex ? If so, any regex example doing that ?

    Read the article

  • Access variable value using string representing variable's name

    - by Paul Ridgway
    Hello everyone, If the title was not clear, I will try to clarify what I am asking: Imagine I have a variable called counter, I know I can see its current value by doing something like: std::cout << counter << std::endl; However, assume I have lots of variables and I don't know which I'm going to want to look at until runtime. Does anyone know a way I can fetch the value of a variable by using its name, for example: std::cout << valueOf("counter") << std::endl; I feel being able to do this might make debugging large complex projects easier. Thanks in advance for your time.

    Read the article

  • How to parse JSON string that can be one of two different strongly typed objects?

    - by user852194
    Background: I'm invoking a web service method which returns a JSON string. This string can be of type ASConInfo or ASErrorResponse. Question: Using the DataContractJsonSerializer, how can I convert the returned JSON string to one of those objects? Thanks in advance I have tried the following technique, but it does not work: public static object test(string inputString) { object obj = null; using (MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(inputString))) { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(object)); obj = ser.ReadObject(ms) as object; } return obj; } [WebMethod] public string TypeChecker() { string str = "{\"Error\":191,\"ID\":\"112345678921212\",\"Length\":15}"; //string strErro = ""; object a = test(str); if (a is ASResponse) { return "ASResponse"; } if (a is ASErrorResponse) { return "ASErrorResponse"; } return "Nothing"; }

    Read the article

  • JavaScript: A BackSlash as part of the string

    - by Abs
    Hello all, I have a JavaScript variable that I echo out using PHP which is shown like this in the page source: var db_1 = 'C:\this\path'; When I set the value of a text field with that variable like so: $('#myinput').val(db_1); The slashes have disappeared and only the other characters are left! Why is this and how can I put the slashes back in?? Thanks all

    Read the article

  • C++ string array from ifstream

    - by David Beck
    I have a program that I need to read in an array of strings from a file. The array must be C type strings (char * or char[]). Using the following code, I get a bad access error: for (i = 0; i < MAX_WORDS && !inputFile.eof(); i++) { inputFile >> words[i]; } words is declared as: char *words[MAX_WORDS];

    Read the article

  • how to delete a line from file using awk filtered by some string

    - by embedded
    I have a file delimited by space. I need to write an awk command that receives a host name argument and it should replace the host name if it already defined in the file. It must be a full match not partially - if the file contains this host name: localhost searching for "ho" will fail and it will be added to the end of the file. another option is a delete: again awk receives host name argument and it should remove it from the file if exists. This is what I have so far: (It needs some enhancements) if [ "$DELETE_FLAG" == "" ]; then # In this case the entry should be added or updated # if clause deals with updating an existing entry # END clause deals with adding a new entry awk -F"[ ]" "BEGIN { found = 0;} \ { \ if ($2 == $HOST_NAME) { \ print \"$IP_ADDRESS $HOST_NAME\"; \ found = 1; \ } else { \ print \$0; \ } \ } \ END { \ if (found == 0) { \ print \"$IP_ADDRESS $HOST_NAME\"; } \ } " \ /etc/hosts > /etc/temp_hosts else # Delete an existing entry awk -F'[ ]' '{if($2 != $HOST_NAME) { print $0} }' /etc/hosts > /etc/temp_hosts fi Thanks

    Read the article

  • Inserting and removing a string into/from an array

    - by alex
    Hello all! I have an array and variable. If the variable does not exist in the array it has to be added, otherwise it has to be removed. Why the following code does not work? $ar = ["a","b","c"]; $vr = "b"; foreach ($ar as $i => $value) { if ($value == $vr) { unset ($ar[$i]); } else { $ar[] = $vr; $ar = array_unique($ar); } } Thanks.

    Read the article

  • Testing if string is sha1 in PHP

    - by SGWebsNow
    I'm planning on storing the passwords as a sha1, so I need a way to validate that it is a sha1 at another point in my website. I was planning on using preg_match, but I do not know how to make regex patterns. Could someone help me out with one? Thanks

    Read the article

  • Pipelining String in Powershell

    - by ChvyVele
    I'm trying to make a simple PowerShell function to have a Linux-style ssh command. Such as: ssh username@url I'm using plink to do this, and this is the function I have written: function ssh { param($usernameAndServer) $myArray = $usernameAndServer.Split("@") $myArray[0] | C:\plink.exe -ssh $myArray[1] } If entered correctly by the user, $myArray[0] is the username and $myArray[1] is the URL. Thus, it connects to the URL and when you're prompted for a username, the username is streamed in using the pipeline. Everything works perfectly, except the pipeline keeps feeding the username ($myArray[0]) and it is entered as the password over and over. Example: PS C:\Users\Mike> ssh xxxxx@yyyyy login as: xxxxx@yyyyy's password: Access denied xxxxx@yyyyy's password: Access denied xxxxx@yyyyy's password: Access denied xxxxx@yyyyy's password: Access denied xxxxx@yyyy's password: Access denied xxxxx@yyyyy's password: FATAL ERROR: Server sent disconnect message type 2 (protocol error): "Too many authentication failures for xxxxx" Where the username has been substituted with xxxxx and the URL has been substituted with yyyyy. Basically, I need to find out how to stop the script from piping in the username ($myArray[0]) after it has been entered once. Any ideas? I've looked all over the internet for a solution and haven't found anything.

    Read the article

< Previous Page | 197 198 199 200 201 202 203 204 205 206 207 208  | Next Page >