Search Results

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

Page 53/1447 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • Simple string encryption in .NET and Javascript

    - by jonathanconway
    I'm developing an ASP.NET MVC application in which I want to encrypt a short string on the server, using C#, and send it to the client-side. Then on the client-side it will be decrypted through Javascript code. Any thoughts on how to implement this? Do you know of a simple encryption algorithm (doesn't have to be bullet-proof secure) that can be easily translated from C# to Javascript or vice-versa? NOTE: I could do this entirely in C# and do the decryption through Ajax, but I'd prefer not to do it this way, as I want to reduce website traffic as much as possible.

    Read the article

  • Python: Converting a tuple to a string with 'err'

    - by skylarking
    Given this : import os import subprocess def check_server(): cl = subprocess.Popen(["nmap","10.7.1.71"], stdout=subprocess.PIPE) result = cl.communicate() print result check_server() check_server() returns this tuple: ('\nStarting Nmap 4.53 ( http://insecure.org ) at 2010-04-07 07:26 EDT\nInteresting ports on 10.7.1.71:\nNot shown: 1711 closed ports\nPORT STATE SERVICE\n21/tcp open ftp\n22/tcp open ssh\n80/tcp open http\n\nNmap done: 1 IP address (1 host up) scanned in 0.293 seconds\n', None) Changing the second line in the method to result, err = cl.communicate() results in check_server() returning : Starting Nmap 4.53 ( http://insecure.org ) at 2010-04-07 07:27 EDT Interesting ports on 10.7.1.71: Not shown: 1711 closed ports PORT STATE SERVICE 21/tcp open ftp 22/tcp open ssh 80/tcp open http Nmap done: 1 IP address (1 host up) scanned in 0.319 seconds Looks to be the case that the tuple is converted to a string, and the \n's are being stripped.... but how? What is 'err' and what exactly is it doing?

    Read the article

  • String replaceAll method (Java)

    - by Mr CooL
    I have following problem, Code: String a="Yeahh, I have no a idea what's happening now!"; System.out.println(a); a=a.replaceAll("a", ""); System.out.println(a); Before removing 'a', result: Yeahh, I have no a idea what's happening now! Actual Result: After removing 'a', result: Yehh, I hve no ide wht's hppening now! Desired Result: Yeahh, I have no idea what's happening now! Anyone can gimme some advices to achieve my desired result?

    Read the article

  • Where to split a string literal

    - by quinmars
    Every time I have to split a long string literal into two (or more) pieces, because it does not fit into a single line, I have to decide if I split the text before or after a space. For example: const char * long_text1 = "This is a long text, which does not fit " "in one line"; /* or */ const char * long_text2 = "This is a long text, which does not fit" " in one line"; I tend to use the first way, but I do not have a real reason for it. So I wonder is there any advantage to favor one of them? I know this questions tend to be coding style question, but that's not my intend. I only want to know if there is a convincing reason why one of those two ways might be preferable.

    Read the article

  • lua string printing

    - by anon
    In C, I have format strings, something like: char *msg = "wlll you marry me" fprintf(stderr, "%s, %s?", name, msg); Now, can I do something similar in lua with format strings? I.e. I want something functionally equivalent to: name .. ", " .. msg .. "?" but not so ugly, in lua. Okay, so I can do string.format("%s, %s?", name, msg), but can I go even a step further, something like perl style, where I can go: "%name, %msg?" Thanks!

    Read the article

  • Powershell and some simple string manipulation

    - by Pat
    need some help with building a powershell script to help with some basic string manipulation. I know just enough powershell to get in trouble, but can't figure out the syntax or coding to make this work. I have a text file that looks like this - Here is your list of servers: server1 server2.domain.local server3 Total number of servers: 3 I need to take that text file and drop the first and last lines (Always first and last.) Then I need to take every other line and basically turn it into a CSV file. The final output should be a text file that looks like this - server1,server2.domain.local,server3 Any suggestions on where to start? Thanks!

    Read the article

  • Javascript - Determine if String Is In List

    - by Emtucifor
    In SQL we can see if a string is in a list like so: Column IN ('a', 'b', 'c') What's a good way to do this in javascript? I realize one can use the switch function: var str = 'a' var flag = false; switch (str) { case 'a': case 'b': case 'c': flag = true; default: } if (thisthing || thatthing || flag === true) { // do something } But this is a horrible mess. It's also clunky to do this: if (thisthing || thatthing || str === 'a' || str === 'b' || str = 'c') { // do something } And I'm not sure about the performance or clarity of this: if (thisthing || thatthing || {a:1, b:1, c:1}[str]) { // do something } Any ideas?

    Read the article

  • Nil string with [NSString stringWithFormat:] appears as "(null)"

    - by Supernico
    I have a 'Contact' class with two properties : firstName and lastName. When I want to display a contact's full name, here is what I do: NSString *fullName = [NSString stringWithFormat:@"%@ %@", contact.firstName, contact.lastName]; But when the firstName and/or lastName is set to nil, I get a "(null)" in the fullName string. To prevent it, here's what I do: NSString *first = contact.firstName; if(first == nil) first = @""; NSString *last = contact.lastName; if(last == nil) last = @""; NSString *fullName = [NSString stringWithFormat:@"%@ %@", first, last]; Does someone know a better/more concise way to do this?

    Read the article

  • Finding all instances of a substring in a string

    - by Mr Aleph
    In my last question I asked about parsing the links out of an HTML page. Since I haven't found a solution yet I thought I tried something else in the meantime: search for every <a href= and copy whatever is there until I hit a </a>. Now, my C is a bit rusty but I do remember i can use strstr() to get the first instance of that string, but how do I get the rest? Any help is appreciated. PS: No. This is not homework on school or something like that. Just so you know.

    Read the article

  • After HTTP GET request, the resulting string is cut-off (incomplete)

    - by Jayomat
    hi all, I'm making a http get request like this: try { HttpClient client = new DefaultHttpClient(); String getURL = "http://busspur02.aseag.de/bs.exe?SID=5FC39&ScreenX=1440&ScreenY=900&CMD=CR&Karten=true&DatumT="+day+"&DatumM="+month+"&DatumJ="+year+"&ZeitH="+hour+"&ZeitM="+min+"&Intervall=60&Suchen=(S)uchen&GT0=Aachen&T0=H&HT0="+start_from+"&GT1=Aachen&T0=H&HT1="+destination+""; HttpGet get = new HttpGet(getURL); HttpResponse responseGet = client.execute(get); HttpEntity resEntityGet = responseGet.getEntity(); if (resEntityGet != null) { //do something with the response Log.i("GET RESPONSE",EntityUtils.toString(resEntityGet)); } ........ It all works well... the only problem: the output from Log.i is cut-off... It's not the complete html page. If I make the same request in a browser, I get 3x the output in opposition to making the request in the emulator and using the above code.... what's wrong?

    Read the article

  • Multiple ports listed in SQL Server connection string

    - by BBlake
    I have a legacy VB6 app where the servername, databasename, username, etc are defined in an INI file, but the port number for the connection string (the default 1433) is hard coded in the app. It's being moved to a new sql server back end that runs off a different port number. I'm trying to avoid having to alter and recompile the application which entails signifigant retesting, documentation, etc. I tried altering the INI file so that for the new server I have put in: SERVERNAME\INSTANCE,NEWPORTNUMBER This effectively builds the connection with Data Source = SERVERNAME\INSTANCE,NEWPORTNUMBER,1433; This appears to work correctly as it connects to the database when I run the app. It appears to me that the ,1433 portion is being ignored. Is this a valid assumption or will this cause me some problem I'm not seeing here?

    Read the article

  • Scanner cuts off my String after about 2400 characters

    - by Ventrue
    I've got some very basic code like while (scan.hasNextLine()) { String temp = scan.nextLine(); System.out.println(temp); } where scan is a Scanner over a file. However, on one particular line, which is about 6k chars long, temp cuts out after something like 2470 characters. There's nothing special about when it cuts out; it's in the middle of the word "Australia." If I delete characters from the line, the place where it cuts out changes; e.g. if I delete characters 0-100 in the file then Scanner will get what was previously 100-2570. I've used Scanner for larger strings before. Any idea what could be going wrong?

    Read the article

  • Find a part of UNC path and put in a variable?

    - by Refracted Paladin
    I am trying to peel off the last part of a unc path that is being passed and put it in a variable to use in a method further down the line. Example path would be -- \\ourfileserver\remoteuploads\countyfoldername\personfoldername How do I peel just the countyfoldername out of that? I had thought to try var th = e.FullPath.LastIndexOf('\\'); var whichFolder = folderPath.Substring(th); but that is an escape character and it doesn't like @ either. Is this even the right direction?

    Read the article

  • Passing extended parameter into Sql 2008 connection string

    - by Pita.O
    Hi, I have a need to support extensive auditing capabilities for a system backing into Sql Server 2008. Since I plan to use LINQ (with no Stored Procs), the database would be a clean, zero contact data repository. However, I need to pratically record a snapshot of every change that happens in the db. So, I thought I should use triggers. But then, I need a user id for the particular user (not the connection string user id) to flow through into the database. In oracle, I should have been able to set up a PROXY USER and the trigger would be able to pick that up. Last I checked, there was no proxy user concept in Sql Server. Does anyone know if there's any extender property I can use to flow through my authenticated user name? ps: I don't mind the impact on connection pooling (if any). Thanks. P

    Read the article

  • How do I splice a python string programmatically?

    - by Robin Welch
    Very simple question, hopefully. So, in Python you can split up strings using indices as follows: >>> a="abcdefg" >>> print a[2:4] cd but how do you do this if the indices are based on variables? E.g. >>> j=2 >>> h=4 >>> print a[j,h] Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: string indices must be integers

    Read the article

  • .NET Compact Framework Connection String encryption/securing

    - by Crazydog
    I'm writing an application in C# for a smart device running Windows Mobile 6.1. It's pretty basic. Just querying a database and getting results. Nothing too fancy. This program is only going to be deployed internally, but we still want to be secure with our SQL connection info. What's the best way I should go about encrypting/securing my connection string in the program? I've seen examples for .NET programs using AppSettings, but I'm not seeing a Setting stab in my Solution properties. This is my first time developing an application in C#/Visual Studio 2008, so there might be some kind of setting I'm missing. Thanks for the help.

    Read the article

  • Formatting a byte array to string in java

    - by rgksugan
    I am using this code to find the MAC address of a machine.This code prints directly the MAC address, but i want to return it as a string.I am completely confused. please help. try { InetAddress add = InetAddress.getByName("10.123.96.102"); NetworkInterface ni1 = NetworkInterface.getByInetAddress(add); if (ni1 != null) { byte[] mac1 = ni1.getHardwareAddress(); if (mac1 != null) { for (int k = 0; k < mac1.length; k++) { System.out.format("%02X%s", mac1[k], (k < mac1.length - 1) ? "-" : ""); } } else { System.out.println("Address doesn't exist "); } System.out.println(); } else { System.out.println("address is not found."); } } catch (UnknownHostException e) { e.printStackTrace(); } catch (SocketException e) { e.printStackTrace(); }

    Read the article

  • Counting vowels in a string using recursion

    - by Daniel Love Jr
    In my python class we are learning about recursion. I understand that it's when a function calls itself, however for this particular assignment I can't figure out how exactly to get my function to call it self to get the desired results. I need to simply count the vowels in the string given to the function. def recVowelCount(s): 'return the number of vowels in s using a recursive computation' vowelcount = 0 vowels = "aEiou".lower() if s[0] in vowels: vowelcount += 1 else: ??? I'm really not sure where to go with this, it's quite frustrating. I came up with this in the end, thanks to some insight from here. def recVowelCount(s): 'return the number of vowels in s using a recursive computation' vowels = "aeiouAEIOU" if s == "": return 0 elif s[0] in vowels: return 1 + recVowelCount(s[1:]) else: return 0 + recVowelCount(s[1:])

    Read the article

  • DRY, string, and unit testing

    - by Rodrigue
    I have a recurring question when writing unit tests for code that involves constant string values. Let's take an example of a method/function that does some processing and returns a string containing a pre-defined constant. In python, that would be something like: STRING_TEMPLATE = "/some/constant/string/with/%s/that/needs/interpolation/" def process(some_param): # We do some meaningful work that gives us a value result = _some_meaningful_action() return STRING_TEMPLATE % result If I want to unit test process, one of my tests will check the return value. This is where I wonder what the best solution is. In my unit test, I can: apply DRY and use the already defined constant repeat myself and rewrite the entire string def test_foo_should_return_correct_url(): string_result = process() # Applying DRY and using the already defined constant assert STRING_TEMPLATE % "1234" == string_result # Repeating myself, repeating myself assert "/some/constant/string/with/1234/that/needs/interpolation/" == url The advantage I see in the former is that my test will break if I put the wrong string value in my constant. The inconvenient is that I may be rewriting the same string over and over again across different unit tests.

    Read the article

  • Split string into multiple lines

    - by RememberME
    I have a long string of comments that I'd like to split into multiple lines. It's currently displayed as <%= Html.Encode(item.important_notes) %> I've played with using .Substring to split it, but can't figure out how to prevent it from splitting in the middle of a word. Instead of characters 1-100 on line 1 and 101-200 on line 2, I'd like to do something like character 1 through the last space before character 100 on line one. That character through the last space before the next 100 characters on line 2, etc. What is the best way to do this? EDIT: using ASP.NET-MVC

    Read the article

  • Is there a shorthand way to denullify a string in C#?

    - by Moose Factory
    Is there a shorthand way to denullify a string in C#? It would be the equivalent of (if 'x' is a string): string y = x == null ? "" : x; I guess I'm hoping there's some operator that would work something like: string y = #x; Wishful thinking, huh? The closest I've got so far is an extension method on the string class: public static string ToNotNull(this string value) { return value == null ? "" : value; } which allows me to do: string y = x.ToNotNull(); Any improvements on that, anyone?

    Read the article

  • marshal Map<String, String> to .xml

    - by richardl
    If I have Map setup like: map.put("foo", "123"); map.put("bar", "456"); map.put("baz", "789"); then I want to do something like: for (String key : map.keySet().toArray(new String[0])) { // marshall out to .xml a tag with the name key and the // value map.get(key) } So what it will marshal out is something like: <map> <foo>123</foo> <bar>456</bar> <baz>789</baz> </map> Can I do this with some fancy JAXB annotations or is there something else that lends it self to dynamic element names? TIA

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >