Search Results

Search found 1130 results on 46 pages for 'encode'.

Page 31/46 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Ajax / GroovyGrails Post data coming over with unexpected leading character. Who is encoding/decod

    - by ?????
    I'm having an encoding issue, and I'm not sure where to look for the problem. I have this Ajax.Request function (prototype library) sending data to a Groovy/Grails encoder var myAjax = new Ajax.Request(url, {method:'post', encoding:'UTF-8', contentType:'application/x-www-form-urlencoded', parameters:{'content':new_content}, onSuccess:success, onFailure:failure}); The data is coming in with an unexpected %A0 at the beginning: I have this simple controller that just echos the content back: def titlechange = { def content = URLDecoder.decode(params['content']) printf("Content: %s; DecodedContent = %s\n", params['content'], content) response.characterEncoding='UTF-8' render content } the debug print statement shows: Content: %A0Hello%2C%20world%21; DecodedContent = †Hello, world! Where is that %A0 coming from? My grails configuration has this: // The default codec used to encode data with ${} grails.views.default.codec="none" // none, html, base64 grails.views.gsp.encoding="UTF-8" grails.converters.encoding="UTF-8 Is the issue on the grails side or on the JavaScript side?

    Read the article

  • Html encoding in MVC input

    - by fearofawhackplanet
    I'm working through NerdDinner and I'm a bit confused about the following section... First they've added a form for creating a new dinner, with a bunch of textboxes delcared like: <%= Html.TextArea("Description") %> They then show two ways of binding form input to the model: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create() { Dinner dinner = new Dinner(); UpdateModel(dinner); ... } or: [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(Dinner dinner) { ... } Ok, great, that all looks really easy so far. Then a bit later on they say: It is important to always be paranoid about security when accepting any user input, and this is also true when binding objects to form input. You should be careful to always HTML encode any user-entered values to avoid HTML and JavaScript injection attacks Huh? MVC is managing the data binding for us. Where/how are you supposed to do the HTML encoding?

    Read the article

  • Encoding license file for privacy

    - by Swingline Rage
    Hi, We're using XML Digital Signatures for signing and verifying our license keys. The signing works fine and has been running smoothly. The XML license file contains a few (plaintext) details about the license, along with a binary signature. We'd like to encode (I don't say encrypt) those plaintext details (license duration, user name, etc, etc.) so they're not immediately visible to prying eyes. Is there a standard (eg, base 64 or something else) that people use in this situation? It doesn't need to be secure or particularly clever, just enough to conceal the information in Notepad. Thanks : )

    Read the article

  • JQUERY AJAX, Issues with spaces being sent to the server, y?

    - by nobosh
    I'm using the following code to post to the server which is then sent to a MYSQL query to find matches via search. $.ajax({ url: '/search/spotlight/', data: "q=" + $(this).val(), success: function(data) { } }); When Q's val has spaces in it, it's creating problems. I'm wondering if I'm handling this correctly? Do I need to encode the value in the AJAX call? Or is this a problem on my backend, which is ColdFusion Right now JQUERY is posting the following to the server: /search/spotlight/?q=FirstName%20LastName is this right?

    Read the article

  • Python: why does str() on some text from a UTF-8 file give a UnicodeDecodeError?

    - by AP257
    I'm processing a UTF-8 file in Python, and have used simplejson to load it into a dictionary. However, I'm getting a UnicodeDecodeError when I try to turn one of the dictionary values into a string: f = open('my_json.json', 'r') master_dictionary = json.load(f) #some json wrangling, then it fails on this line... mysql_string += " ('" + str(v_dict['code']) Traceback (most recent call last): File "my_file.py", line 25, in <module> str(v_dict['code']) + "'), " UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 35: ordinal not in range(128) Why is Python even using ASCII? I thought it used UTF-8 by default, and this is a UTF-8 file. What is the problem?

    Read the article

  • jQuery .submit() woes with IE8

    - by Jitesh
    I am trying to submit a delete link click via a http post to my asp.net mvc controller. While my code below works for chrome it does not work in IE8. Any pointer will be very useful. Setup:- Browser: IE8 jQuery: 1.4.1 MVC: 2.0 The delete link is:- <a title="Delete contact" href="/Contacts/Delete/<%= Model.Contact.Id %>" class="delete" rel="Are you sure you want to delete <%= Html.Encode(Model.Contact.Name) %>?">Delete</a> and the jqeury handler for the click of delete is $("a.delete").click(function() { if (confirm($(this).attr("rel"))) { var form = "<form method='POST' action='" + $(this).attr("href") + '" style='display:none;'></form>"; $(form).submit(); } return false; });

    Read the article

  • Multimedia content in REST responce(XML/JSON)

    - by Koushik
    In my thesis I need to test different architectures. A request to a REST web service developed using Apache CXF and Spring MVC with MySQL as back end serving references(a field in database) to images,audio and video files stored in file system. In the response message, what is the best method to send the content to the client(another application using the service which I developed). URI: http://www.filmservices.com/film/{id} A client here is not the end user. Send the encoded hyperlink's(where the content is stored in the file system) to the client, so that the client renders the response and displays it to the browser. Use Base64 to encode the message(image,audio,video) and send it to the client. Main concern is performance.

    Read the article

  • what practical proofs are there about the Turing completeness of neural nets? what nns can execute c

    - by Albert
    I'm interested in the computational power of neural nets. It is generally accepted that recurrent neural nets are Turing complete. Now I was searching for some papers which proofs this. What I found so far: Turing computability with neural nets, Hava T. Siegelmann and Eduardo D. Sontag, 1991 I think this is only interesting from a theoretical point of view because it needs to have the neuron activity of infinite exactness (to encode the state somehow as a rational number). S. Franklin and M. Garzon, Neural computability This needs an unbounded number of neurons and also doesn't really seem to be that much practical. (Note that another question of mine tries to point out this kind of problem between such theoretical results and the practice.) I'm searching mostly for some neural net which really can execute some code which I can also simulate and test in practice. Of course, in practice, they would have some kind of limited memory. Does anyone know something like this?

    Read the article

  • ASP.NET MVC: trying out a script injection hangs Visual Studio 2010 completely?

    - by Mark Redman
    Wondering if anyone has an idea of whats going on: I am new to ASP.NET MVC and am trying out a few things with jquery/ajax. The basic scenario is a dropdownlist with an add button next to it. Clicking the add button launches a jquery ui dialog with a textbox form, entering a value saves the item to the database and refreshes the drop-downlist. The dropdownlist is re-populated using a JSON result. This all works ok. I thought I would try a script injetion attack, ie add the text: alert("oh dear") to seee what would happen and to check if I need to encode anything. When I try and save this item (similar to the same process of adding a plain text entry) Visual Studio 2010 Beta 2 hangs completely. Any ideas? UPDATE: It happens when posting: "</"

    Read the article

  • How to use email adresses with special chars such as Ø

    - by Sir Code-A-Lot
    By writing this: var recipient = new MailAddress("name@abcø.dk"); Notice the "ø" in the domain part. I get an exception stating: System.FormatException: The specified string is not in the form required for an e-mail address. at System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName) at System.Net.Mail.MailAddress.ParseValue(String address) at System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) at System.Net.Mail.MailAddress..ctor(String address) The address used should be perfectly valid. So I'm guessing I have to encode the address somehow?

    Read the article

  • Characters with jquery json

    - by Mikk
    Hi everyone, I'm using jquery $.getJSON to retrieve list of cities. Everything works fine, but I'm from Estonia (probably most of you don't know much about this country =D) and we are using some characters like õ, ü. ä, ö. When I pass letters like this to callback function, I keep getting empty strings. I've tried to base64 encode(server-side)-decode(jquery base64 plugin) strings (i thought it was a good idea as long as I can compress pages with php, so I don't have to worry about bandwidth), but in this way I end up with some random chinese symbols. What would be the best workaround for this problem. Thank you.

    Read the article

  • Resolve HTTP 304 - not modified in AJAX call made via GWT

    - by Salvin Francis
    We are using an application made in GWT with the server as tomcat. The project runs fine normally, however there are situations where the server is restarted. At such point of time, the ajax call made by the code below returns blank text with the status code as 304 RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, URL.encode(serverUrl)); //-- serverUrl is the url to which this call is posted to. requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded"); requestBuilder.setHeader("Expires","0"); requestBuilder.sendRequest( postData, new RequestCallback() { public void onError(Request request, Throwable exception) { //Do nothing } public void onResponseReceived(Request request, Response response) { //sometimes when the server is restarted, I get response.getStatusCode() = 304 and the response.getText() as blank } } ); normally we get back some data from the server inside this response text. How do we now get the data when the response itself is blank ?

    Read the article

  • SecurityError: Error #2152: Full screen mode is not allowed.

    - by meghana
    I have one flash player , which have full-screen functionality . which is not working in FF and MAC Chrome . and throws an error as below. SecurityError: Error #2152: Full screen mode is not allowed. at flash.display::Stage/set displayState() at com.IQMediaCorp.core::IQMediaCorpPlayer/ToggleFullScreen() I have googled about the issue and already verified some points below my player have allowfullscreen = true in html object / encode element. the methid ToggleFullScreen is an mouse click event below is code for ToggleFullScreen method public function ToggleFullScreen(e:MouseEvent) { if (stage.displayState == StageDisplayState.FULL_SCREEN_INTERACTIVE) { bKnob.alpha=0; bigScreen=true; stage.displayState=StageDisplayState.NORMAL; } else { bigScreen=false; stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE; bKnob.alpha=0; } } i don't get the reason why it is not working. can anybody help?? Thanks

    Read the article

  • Regular expressions in a Python find-and-replace script?

    - by Haidon
    I'm new to Python scripting, so please forgive me in advance if the answer to this question seems inherently obvious. I'm trying to put together a large-scale find-and-replace script using Python. I'm using code similar to the following: findreplace = [ ('term1', 'term2'), ] inF = open(infile,'rb') s=unicode(inF.read(),charenc) inF.close() for couple in findreplace: outtext=s.replace(couple[0],couple[1]) s=outtext outF = open(outFile,'wb') outF.write(outtext.encode('utf-8')) outF.close() How would I go about having the script do a find and replace for regular expressions? Specifically, I want it to find some information (metadata) specified at the top of a text file. Eg: Title: This is the title Author: This is the author Date: This is the date and convert it into LaTeX format. Eg: \title{This is the title} \author{This is the author} \date{This is the date} Maybe I'm tackling this the wrong way. If there's a better way than regular expressions please let me know! Thanks!

    Read the article

  • Http post with basic authorization don't work in java

    - by glebreutov
    This code work without exceptions but post request does not work. What I do wrong? I use Java 1.6, JBoss 4.2.3 String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<message><service id=\"210\"/><to>+"+phone+"</to>" + "<body content-type=\"text/plain\">"+message+"</body></message>"; String userPassword = "login:password"; URL url = new URL(ksGateUrl); URLConnection urlc = url.openConnection(); urlc.setDoOutput(true); urlc.setUseCaches(false); urlc.setAllowUserInteraction(false); urlc.setRequestProperty("Authorization", "Basic " + new sun.misc.BASE64Encoder().encode (userPassword.getBytes())); OutputStreamWriter wr = new OutputStreamWriter(urlc.getOutputStream(), "UTF-8"); wr.write(xml); wr.flush();

    Read the article

  • Using Python simplejson for transmitting JSON to another server results in unicode encoding problems

    - by Mark
    Hi there, I'm encoding a string with Python's simplejson library with special characters: hello testing spécißl characters plusses: +++++ special chars :œ?´®†¥¨ˆøp“ß?ƒ©??°¬O˜çv?˜µ== However, when I encode it and transmit it to the other machine (using POST), it turns out like this: {'message': ['{"body": "hello testing sp\\u00e9ci\\u00dfl characters\\n\\nplusses: \\n\\nspecial chars :\\u0153\\u2211\\u00b4\\u00ae\\u2020\\u00a5\\u00a8\\u02c6\\u00f8\\u03c0\\u201c\\u00df\\u2202\\u0192\\u00a9\\u02d9\\u2206\\u02da\\u00ac\\u03a9\\u2248\\u00e7\\u221a\\u222b\\u02dc\\u00b5\\u2264\\u2265"}']} The + signs are completely stripped and the rest are in this unicode(?) format. My code for this is: data = {'body': data_string} data_encoded = json.dumps(data) Any ideas? Thanks! Edit: I've tried using json.dumps(data, ensure_ascii=False) but it results in a UnicodeError ordinal not in range error.

    Read the article

  • Charaters with jquery json

    - by Mikk
    Hi everyone, I'm using jquery $.getJSON to retrieve list of cities. Everything works fine, but I'm from Estonia (probably most of you don't know much about this country =D) and we are using some characters like õ, ü. ä, ö. When I pass letters like this to callback function, I keep getting empty strings. I've tried to base64 encode(server-side)-decode(jquery base64 plugin) strings (i thought it was a good idea as long as I can compress pages with php, so I don't have to worry about bandwidth), but in this way I end up with some random chinese symbols. What would be the best workaround for this problem. Thank you.

    Read the article

  • Which is faster in memory, ints or chars? And file-mapping or chunk reading?

    - by Nick
    Okay, so I've written a (rather unoptimized) program before to encode images to JPEGs, however, now I am working with MPEG-2 transport streams and the H.264 encoded video within them. Before I dive into programming all of this, I am curious what the fastest way to deal with the actual file is. Currently I am file-mapping the .mts file into memory to work on it, although I am not sure if it would be faster to (for example) read 100 MB of the file into memory in chunks and deal with it that way. These files require a lot of bit-shifting and such to read flags, so I am wondering that when I reference some of the memory if it is faster to read 4 bytes at once as an integer or 1 byte as a character. I thought I read somewhere that x86 processors are optimized to a 4-byte granularity, but I'm not sure if this is true... Thanks!

    Read the article

  • space in url; did browser got smarter or server?

    - by Xah Lee
    It looks like today you no longer to have to encode spaces by %20 in your html links or image links. For example, suppose you have this image at ?http://example.com/i/my house.jpg?. Notice the space there. In your html code, you can just do this: <img src="http://example.com/i/my house.jpg" alt="my house"> It work in all current version of browsers. Though, what i'm not sure is that whether the browser encodes it before requesting the url, or a particular server will do the right with with paths with space? (apache)

    Read the article

  • Jquery get array details

    - by Matt
    I'm having trouble getting a response back from a Jquery ajax call... (It's a script to authenticate a user, and needs to return their name and user ID. My understanding was that I could encode it as JSON and get the data in the format below. It is returning an error of "undefined" for the alert(). The javascript $.ajax({ type: "POST", url: "myURL.php", data: {username: username, password: password}, success: function(results) { //THIS IS WHERE THE PROBLEM IS alert('Hi '+results.name); //Should be "Hi Basil Fawlty" } }); The PHP (myURL.php) //This comes from a SQL call that returns the following name json_encode(array( 'id'=>1, 'name'=>'Basil Fawlty' )); Any help or ideas on where I am going wrong would be greatly appreciated! Thanks.

    Read the article

  • Protect my PHP App

    - by Abs
    Hello all, I have developed an app and its written in PHP (with a bunch of SQL scripts), this app will be used by a few small companies. For them to use it, I will have to install Apache and SQL Server for them. Every method I have thought has fallen short of what I need. I was actually just hoping to use ZendGuard or IonCube but they don't support PHP 5.3.x. Is there a simpler method where I can maybe store a key in the database and make the app run only when it knows its on that server? Maybe create a key based on some random numbers/letters and the machine name, sql server host name and encode/decode this when ever the system is in use? Thanks all for any help or ideas

    Read the article

  • An MP3 parser to extract numbered frames?

    - by Xepoch
    I am writing a streaming application for MP3 (CBR). It is all passthru, meaning I don't have to decode/encode, I just need to pass on the data as I see it come through. I want to be able to count the MP3 frames as they passthru (and some other stuff like throughput calculations). According to the MP3 frame header spec, the sync word appears to be 11 bits of 1s, however I notice (naturally) that the frame payload which I should safely assume to be binary and thus it is not odd at all to see 11 1s in sequence. My questions: Is there a Unix/Linux MP3 parser utility (dd-style) that can pull numbered frames from an MP3 file/pipe? Any perl wisdom here? How does one delineate an MP3 header block from any other binary payload data? and lastly: Is a constant bitrate (CBR) MP3 defined by payload bytes or are the header bytes included in the aggregate # of bytes/bits per any given timeslice? Thanks,

    Read the article

  • How to save state of the app when app terminates?

    - by user164589
    Hi guys. I am trying to save the app state by encoding when the app terminates. I've found the solution related this issue. But I don't know how to use. I am really trying to make encoding and decoding like this: http://cocoaheads.byu.edu/wiki/nscoding in CustomObject.h @interface CustomObject : NSObject <NSCoding> { NSArray *someArray; } in CustomObject.m @implementation CustomObject // Other method implementations here - (void) encodeWithCoder:(NSCoder*)encoder { [encoder encodeObject:someArray forKey:@"someArray"]; } - (id) initWithCoder:(NSCoder*)decoder { if (self = [super init]) { someArray = [[decoder decodeObjectForKey:@"someArray"] retain]; } return self; } @end My object to save is another NSArray. Not "someArray" in CustomObject. We call it that "MySaveObject". I want to pass "MySaveObject" to "someArray" in CustomObject. Actually I don't know how to encode "MySaveObject" and to pass to "someArray" in CustomObject. Thanks in advance.

    Read the article

  • Good way to parse query string

    - by m.edmondson
    I have a String that contains the following: ?workarea=London+&+Home+Counties+Ltd&sub=fs&&&FASh*5 which resembles a URI query string. What is the best way to parse the elements of this string (workarea and sub) without messing about with string manipulation? If I use HttpUtility.ParseQueryString is gets stuck as both elements include &. However if I encode the whole thing first I lose the seperations of the elements. Ideally the output would be: workarea = London & Home Counties Ltd sub = fs&&&FASh*5

    Read the article

  • How to persist and load an object which conforms to NSCoding protocol?

    - by mystify
    I have made an class which conforms to the NSCoding protocol and does all the encode and decode stuff. For my app, I simply want to persist an object from that class to the device and the next time when the app launches, I want to load that object back into memory. Basically it's just an class which holds some user input information. For example the user starts writing a text but then quits the app. Next time I want to load that data object. I guess I need NSKeyedArchiver? Is there a good tutorial on this? How do I do that?

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >