Search Results

Search found 5222 results on 209 pages for 'characters'.

Page 29/209 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Wierd characters in exported csv files when converting

    - by Ahue
    Hey guys, I came across a problem I cannot solve on my own concerning the downloadable csv formatted trends data files from Google Insights for Search. I'm to lazy to reformat the files I4S gives me manually what means: Extracting the section with the actual trends data and reformatting the columns so that I can use it with a modelling program I do for school. So I wrote a tiny script the should do the work for me: Taking a file, do some magic and give me a new file in proper format. What it's supposed to do is reading the file contents, extracting the trends section, splitting it by newlines, splitting each line and then reorder the columns and maybe reformat them. When looking at a untouched I4S csv file it looks normal containing CR LF caracters at line breaks (maybe thats only because I'm using Windows). When just reading the contents and then writing them to a new file using the script wierd asian characters appear between CR and LF. I tried the script with a manually written similar looking file and even tried a csv file from Google Trends and it works fine. I use Python and the script (snippet) I used for the following example looks like this: # Read from an input file file = open(file,"r") contents = file.read() file.close() cfile = open("m.log","w+") cfile.write(contents) cfile.close() Has anybody an idea why those characters appear??? Thank you for you help! I'll give you and example: First few lines of I4S csv file: Web Search Interest: foobar Worldwide; 2004 - present Interest over time Week foobar 2004-01-04 - 2004-01-10 44 2004-01-11 - 2004-01-17 44 2004-01-18 - 2004-01-24 37 2004-01-25 - 2004-01-31 40 2004-02-01 - 2004-02-07 49 2004-02-08 - 2004-02-14 51 2004-02-15 - 2004-02-21 45 2004-02-22 - 2004-02-28 61 2004-02-29 - 2004-03-06 51 2004-03-07 - 2004-03-13 48 2004-03-14 - 2004-03-20 50 2004-03-21 - 2004-03-27 56 2004-03-28 - 2004-04-03 59 Output file when reading and writing contents: Web Search Interest: foobar ??????????? ? ? ? ????????? ????????? ???? ?????? Week foobar ?? ?? ?? ? ? ? ?? ??? ????? 2004-01-11 - 2004-01-17 44 ?? ?? ???? ? ? ?? ????????? 2004-01-25 - 2004-01-31 40 ?? ?? ?? ? ? ? ?? ?? ?????? 2004-02-08 - 2004-02-14 51 ?? ?? ???? ? ? ?? ????????? 2004-02-22 - 2004-02-28 61 ?? ?? ???? ? ? ?? ?? ?????? 2004-03-07 - 2004-03-13 48 ?? ?? ???? ? ? ?? ??? ?? ?? 2004-03-21 - 2004-03-27 56 ?? ?? ???? ? ? ?? ?? ?????? 2004-04-04 - 2004-04-10 69 ?? ?? ???? ? ? ?? ????????? 2004-04-18 - 2004-04-24 51 ?? ?? ???? ? ? ?? ?? ?????? 2004-05-02 - 2004-05-08 56 ?? ?? ?? ? ? ? ?? ????????? 2004-05-16 - 2004-05-22 54 ?? ?? ???? ? ? ?? ????????? 2004-05-30 - 2004-06-05 74 ?? ?? ?? ? ? ? ?? ????????? 2004-06-13 - 2004-06-19 50 ?? ?? ??? ? ? ?? ????????? 2004-06-27 - 2004-07-03 58 ?? ?? ?? ? ? ? ?? ??? ????? 2004-07-11 - 2004-07-17 59 ?? ?? ???? ? ? ?? ?????????

    Read the article

  • Removing control / special characters from log file

    - by digitalsky
    I have a log file captured by tclsh which captures all the backspace characters (ctrl-H, shows up as "^H") and color-setting sequences (eg. ^[[32m .... ^[[0m ). What is an efficient way to remove them? ^[...m This one is easy since, I can just do "sed -i /^[.*m//g" to remove them ^H Right now I have "sed -i s/.^H//", which "applies" a backspace, but I have to keep looping this until there are no more backspaces. while [ logfile == `grep -l ^H logfile` ]; do sed -i s/.^H// logfile ; done; "sed -i s/.^H//g" doesn't work because it would match consecutive backspaces. This process takes 11 mins for my log file with ~6k lines, which is too long. Any better ways to remove the backspace?

    Read the article

  • Why can I not view foreign language characters in my mysql DB?

    - by Chris
    I am inserting the following characters into my DB: ?? / ?? This is the meta tag on the page that is inserting the characters: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> I have altered all the columns in my table that is holding the characters to be utf8_unicode_ci The foreign characters show up like so in the DB: 汉字 / 漢字 When I use a sql statement to display those foreign characters on a page, they display correctly again as: ?? / ?? I am guessing I have some setting that is not correct in my DB, since it stores it correctly, but does not display it correctly. What can i do to make the foreign language characters to display correctly in my DB?

    Read the article

  • What regular expression do I need to check for some non-latin characters?

    - by zeckdude
    I am checking a field if it is Latin Characters or not. var foreignCharacters = $("#foreign_characters").val(); var rlatins = /[\u0000-\u007f]/; if (rlatins.test(foreignCharacters)) { alert("This is Latin Characters"); } else { alert("This is non-latin Characters"); } This works well, but I would like to change it so when I enter any non-latin characters, such as chinese characters, along with a space(which is within that range I am using currently) it will still say it is non-latin characters. How can I change the regular expression I have to do that?

    Read the article

  • Why does Microsoft Excel change the characters that I copy into it?

    - by Elysium
    I live in Spain and I am using the English version of Microsoft Excel installed with wine on Ubuntu. The problem is that I use my laptop at work and when I copy text into excel (text that is Spanish) the characters that are Spanish (such as é,ñ, á...etc) are changed into weird characters. How can I sort this out? For example: Martínez José....appears as "Martínez José" in my spreadsheet and I really cant have it this way or my boss will kill me. :)

    Read the article

  • jQuery: AJAX umlauts & special characters are a mess

    - by rayne
    I've just created my first ajax function with jQuery which actually works, but unfortunately the character encoding (for characters like ä, ö, ü, ß, c, c, å, ø) is a nightmare. My files and my database are all UTF-8. I've tried a multitude of options in the ajax function and the PHP function, none of which were satisfactory. This is my ajax var dataString = { 'name': name, 'mail': mail // other stuff } $.ajax({ type: "POST", url: "/post.php", data: dataString, contentType: "application/x-www-form-urlencoded;charset=UTF-8", cache: false, success: function(html){ // do stuff } I've tried it without contentType: "application/x-www-form-urlencoded;charset=UTF-8" and I've tried to wrap the affected data in encodeURIComponent(), none of which worked. When I use that AJAX with htmlentities() in my php, my umlauts look like this in plain text: UE Ã?, AE Ã?, OE Ã?, ue ü, ae ä, oe o And like this in the database: UE Ãœ , AE Ä, OE Ö, ue ü, ae ä, oe o If I don't use htmlentities() but mysql_real_escape_string() instead (or neither), they look good in plain text, but they look like this in the database: AE Ä, OE Ö, UE Ãœ, ae ä oe ö ue ü I've been trying tons of options for hours now, but I can't find a solution that works. So far the only option I seem to have is having them look like a total mess in the database, but that would be very contraproductive if those data sets need to be edited.

    Read the article

  • Best way to escape characters before jquery post ASP.NET MVC

    - by Darcy
    Hello, I am semi-new to ASP.NET MVC. I am building an app that is used internally for my company. The scenario is this: There are two Html.Listbox's. One has all database information, and the other is initally empty. The user would add items from the database listbox to the empty listbox. Every time the user adds a command, I call a js function that calls an ActionResult "AddCommand" in my EditController. In the controller, the selected items that are added are saved to another database table. Here is the code (this gets called every time an item is added): function Add(listbox) { ... //skipping initializing code for berevity var url = "/Edit/AddCommand/" + cmd; $.post(url); } So the problem occurs when the 'cmd' is an item that has a '/', ':', '%', '?', etc (some kind of special character) So what I'm wondering is, what's the best way to escape these characters? Right now I'm checking the database's listbox item's text, and rebuilding the string, then in the Controller, I'm taking that built string and turning it back into its original state. So for example, if the item they are adding is 'Cats/Dogs', I am posting 'Cats[SLASH]Dogs' to the controller, and in the controller changing it back to 'Cats/Dogs'. Obviously this is a horrible hack, so I must be missing something. Any help would be greatly appreciated.

    Read the article

  • C file read leaves garbage characters

    - by KJ
    Hi. I'm trying to read the contents of a file into my program but I keep occasionally getting garbage characters at the end of the buffers. I haven't been using C a lot (rather I've been using C++) but I assume it has something to do with streams. I don't really know what to do though. I'm using MinGW. Here is the code (this gives me garbage at the end of the second read): include include char* filetobuf(char *file) { FILE *fptr; long length; char *buf; fptr = fopen(file, "r"); /* Open file for reading */ if (!fptr) /* Return NULL on failure */ return NULL; fseek(fptr, 0, SEEK_END); /* Seek to the end of the file */ length = ftell(fptr); /* Find out how many bytes into the file we are */ buf = (char*)malloc(length+1); /* Allocate a buffer for the entire length of the file and a null terminator */ fseek(fptr, 0, SEEK_SET); /* Go back to the beginning of the file */ fread(buf, length, 1, fptr); /* Read the contents of the file in to the buffer */ fclose(fptr); /* Close the file */ buf[length] = 0; /* Null terminator */ return buf; /* Return the buffer */ } int main() { char* vs; char* fs; vs = filetobuf("testshader.vs"); fs = filetobuf("testshader.fs"); printf("%s\n\n\n%s", vs, fs); free(vs); free(fs); return 0; } The filetobuf function is from this example http://www.opengl.org/wiki/Tutorial2:_VAOs,_VBOs,_Vertex_and_Fragment_Shaders_%28C_/_SDL%29. It seems right to me though. So anyway, what's up with that?

    Read the article

  • Problem between Glassfish and Spring Security Basic Authentication

    - by Raspayu
    Hi! I am enabling a simple HTTP Basic Authentication with Spring security in my project. My environment is an Glassfish Server (bundled with Netbeans), and almost everything works perfect: I have set up it to just ask for authentication with the POST method, with hardcoded users with "user-service", and it works with user names with no special characters. The problem comes when I set up an user with "@" or "." Here is the spring-security related part of my servlet.xml: <security:http> <security:intercept-url method="POST" pattern="/**" access="ROLE_USER" /> <security:http-basic/> </security:http> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider user-service-ref="uservice"/> </security:authentication-manager> <security:user-service id="uservice"> <security:user name="[email protected]" password="pswd1" authorities="ROLE_USER" /> <security:user name="[email protected]" password="pswd2" authorities="ROLE_USER" /> <security:user name="pepe" password="pepito" authorities="ROLE_USER" /> </security:user-service> I have looked also for what did the browser send to the listening port, and it sends right the par "username:password" in base 64, so i think the problem is in my server(Glassfish v3). Does anyone have any idea? Thanks in advance! Raspayu

    Read the article

  • How to parse kanji numeric characters using ICU?

    - by Aki
    I'm writing a function using ICU to parse an Unicode string which consists of kanji numeric character(s) and want to return the integer value of the string. "?" = 5 "???" = 31 "???????" = 5972 I'm setting the locale to Locale::getJapan() and using the NumberFormat::parse() to parse the character string. However, whenever I pass it any Kanji characters, the parse() method is returning U_INVALID_FORMAT_ERROR. Does anyone know if ICU supports Kanji character strings in the NumberFormat::parse() method? I was hoping that since I'm setting the Locale to Japanese that it would be able to parse Kanji numeric values. Thanks! #include <iostream> #include <unicode/numfmt.h> using namespace std; int main(int argc, char **argv) { const Locale &jaLocale = Locale::getJapan(); UErrorCode status = U_ZERO_ERROR; NumberFormat *nf = NumberFormat::createInstance(jaLocale, status); UChar number[] = {0x4E94}; // Character for '5' in Japanese '?' UnicodeString numStr(number); Formattable formattable; nf->parse(numStr, formattable, status); if (U_FAILURE(status)) { cout << "error parsing as number: " << u_errorName(status) << endl; return(1); } cout << "long value: " << formattable.getLong() << endl; }

    Read the article

  • LaTex, align alignment characters between align blocks

    - by ccook
    I would like to align two alignment characters between two align blocks so that I can have some text in the middle of a derivation with equations maintaining the horizontal alignment. For example the following excerpt of latex using align \begin{align*} \frac{\delta \phi}{\delta x_1} = {} &\frac{9}{8}\frac{\delta_1\phi}{\delta_1x_1}-\frac{1}{8}\frac{\delta_3\phi}{\delta_3x_1} \\ & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] \end{align*} some text in the middle \begin{align*} & \frac{9}{8}\frac{1}{h_1}\left[\phi(x_1+h_1/2)-\phi(x_i-h_1/2)\right]-\frac{1}{8}\frac{1}{3h_1}\left[\phi(x_i+3h_1/2)-\phi(x_1-3h_1/2)\right] \end{align*} Ideally I would like the left of the equation in the second block to line up with that of the second equation in the first block. I could do a workaround by not having text in the middle, however, I would like this functionality. EDIT I would like to have a good amount of text between. Say three to four lines that line up as normal paragraphs. Adding text in the alignment block is the workaround I poorly alluded to.

    Read the article

  • R: convert data.frame columns from factors to characters

    - by Mike Dewar
    Hi, I have a data frame. Let's call him bob: > head(bob) phenotype exclusion GSM399350 3- 4- 8- 25- 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- GSM399351 3- 4- 8- 25- 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- GSM399352 3- 4- 8- 25- 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- GSM399353 3- 4- 8- 25+ 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- GSM399354 3- 4- 8- 25+ 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- GSM399355 3- 4- 8- 25+ 44+ 11b- 11c- 19- NK1.1- Gr1- TER119- I'd like to concatenate the rows of this data frame (this will be another question). But look: > class(bob$phenotype) [1] "factor" Bob's columns are factors. So, for example: > as.character(head(bob)) [1] "c(3, 3, 3, 6, 6, 6)" "c(3, 3, 3, 3, 3, 3)" [3] "c(29, 29, 29, 30, 30, 30)" I don't begin to understand this, but I guess these are indices into the levels of the factors of the columns (of the court of king caractacus) of bob? Not what I need. Strangely I can go through the columns of bob by hand, and do bob$phenotype <- as.character(bob$phenotype) which works fine. And, after some typing, I can get a data.frame whose columns are characters rather than factors. So my question is: how can I do this automatically? How do I convert a data.frame with factor columns into a data.frame with character columns without having to manually go through each column? Bonus question: why does the manual approach work?

    Read the article

  • Using Regex Replace when looking for un-escaped characters

    - by Daniel Hollinrake
    I've got a requirement that is basically this. If I have a string of text such as "There once was an 'ugly' duckling but it could never have been \'Scarlett\' Johansen" then I'd like to match the quotes that haven't already been escaped. These would be the ones around 'ugly' not the ones around 'Scarlett'. I've spent quite a while on this using a little C# console app to test things and have come up with the following solution. private static void RegexFunAndGames() { string result; string sampleText = @"Mr. Grant and Ms. Kelly starred in the film \'To Catch A Thief' but not in 'Stardust' because they'd stopped acting by then"; string rePattern = @"\\'"; string replaceWith = "'"; Console.WriteLine(sampleText); Regex regEx = new Regex(rePattern); result = regEx.Replace(sampleText, replaceWith); result = result.Replace("'", @"\'"); Console.WriteLine(result); } Basically what I've done is a two step process find those characters that have already been escaped, undo that then do everything again. It sounds a bit clumsy and I feel that there could be a better way.

    Read the article

  • Munging non-printable characters to dots using string.translate()

    - by Jim Dennis
    So I've done this before and it's a surprising ugly bit of code for such a seemingly simple task. The goal is to translate any non-printable character into a . (dot). For my purposes "printable" does exclude the last few characters from string.printable (new-lines, tabs, and so on). This is for printing things like the old MS-DOS debug "hex dump" format ... or anything similar to that (where additional whitespace will mangle the intended dump layout). I know I can use string.translate() and, to use that, I need a translation table. So I use string.maketrans() for that. Here's the best I could come up with: filter = string.maketrans( string.translate(string.maketrans('',''), string.maketrans('',''),string.printable[:-5]), '.'*len(string.translate(string.maketrans('',''), string.maketrans('',''),string.printable[:-5]))) ... which is an unreadable mess (though it does work). From there you can call use something like: for each_line in sometext: print string.translate(each_line, filter) ... and be happy. (So long as you don't look under the hood). Now it is more readable if I break that horrid expression into separate statements: ascii = string.maketrans('','') # The whole ASCII character set nonprintable = string.translate(ascii, ascii, string.printable[:-5]) # Optional delchars argument filter = string.maketrans(nonprintable, '.' * len(nonprintable)) And it's tempting to do that just for legibility. However, I keep thinking there has to be a more elegant way to express this!

    Read the article

  • iPhone/iPad : Check for invalid characters in a textbox made for Integers only

    - by JustinXXVII
    I noticed that the iPhone OS is pretty good about picking out Integer values when asked to. Specifically, if you use NSString *stringName = @"6("; int number = [stringName intValue]; the iPhone OS will pick out the 6 and turn the variable number into 6. However, in more complex mistypes, this also makes the int variable 6: NSString *stringName = @"6(5"; int number = [stringName intValue]; The iPhone OS misses the other digit, when what could have possibly been the user trying to enter the number 65, the OS only gets the number 6 out of it. I need a solution to check a string for invalid characters and return NO if there is anything other than an unsigned integer in a textbox. This is for iPad, and currently there is no numeric keyboard like the iPhone has, and I'm instead limited to the standard 123 keyboard. I was thinking that I need to use NSRange and somehow loop through the entire string in the textbox, and checking to see if the current character in the iteration is a number. I'm lost as far as that goes. I can think of testing it against zero, but zero is a valid integer. Can anyone help?

    Read the article

  • Fill in word form field with more than 255 characters

    - by user1308743
    I am trying to programmaticly fill in a microsoft word form. I am successfully able to do so if the string is under 255 chars with the following code below, however it says the string is too long if i try and use a string over 255 chars... How do I get past this limitation? If I open the word doc in word I can type in more than 255 chars without a problem. Does anyone know how to input more characters via c# code? object fileName = strFileName; object readOnly = false; object isVisible = true; object missing = System.Reflection.Missing.Value; //open doc _oDoc = _oWordApplic.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); _oDoc.Activate(); //write string _oDoc.FormFields[oBookMark].Result = value; //save and close oDoc.SaveAs(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); _oWordApplic.Application.Quit(ref missing, ref missing, ref missing);

    Read the article

  • XSLT 1.0 : Iterate over characters in a string

    - by subtenante
    I need to iterate over the characters in a string to build an XML structure. Currently, I am doing this : <xsl:template name="verticalize"> <xsl:param name="text">Some text</xsl:param> <xsl:for-each select="tokenize(replace(replace($text,'(.)','$1\\n'),'\\n$',''),'\\n')"> <xsl:element name="para"> <xsl:value-of select="."/> </xsl:element> </xsl:for-each> </xsl:template> This produces something like : <para>S</para> <para>o</para> <para>m</para> <para>e</para> <para> </para> <para>t</para> <para>e</para> <para>x</para> <para>t</para> This works fine with Xpath 2.0. But I need to apply the same treatment in a XPath 1.0 environment, where the replace() method is not available. Do you know a way to achieve this ?

    Read the article

  • Maximum number of characters using keystrokes A, Ctrl+A, Ctrl+C and Ctrl+V

    - by munda
    This is an interview question from google. I am not able to solve it by myself. Can somebody shed some light? Write a program to print the sequence of keystrokes such that it generates the maximum number of character 'A's. You are allowed to use only 4 keys: A, Ctrl+A, Ctrl+C and Ctrl+V. Only N keystrokes are allowed. All Ctrl+ characters are considered as one keystroke, so Ctrl+A is one keystroke. For example, the sequence A, Ctrl+A, Ctrl+C, Ctrl+V generates two A's in 4 keystrokes. Ctrl+A is Select All Ctrl+C is Copy Ctrl+V is Paste I did some mathematics. For any N, using x numbers of A's , one Ctrl+A, one Ctrl+C and y Ctrl+V, we can generate max ((N-1)/2)2 number of A's. For some N M, it is better to use as many Ctrl+A's, Ctrl+C and Ctrl+V sequences as it doubles the number of A's. The sequence Ctrl+A, Ctrl+V, Ctrl+C will not overwrite the existing selection. It will append the copied selection to selected one.

    Read the article

  • Convert UCS-2 characters to UTF-8 Using C#

    - by quanticle
    I'm pulling some internationalized text from a MS SQL Server 2005 database. As per the defaults for that DB, the characters are stored as UCS-2. However, I need to output the data in UTF-8 format, as I'm sending it out over the web. Currently, I have the following code to convert: SqlString dbString = resultReader.GetSqlString(0); byte[] dbBytes = dbString.GetUnicodeBytes(); byte[] utf8Bytes = System.Text.Encoding.Convert(System.Text.Encoding.Unicode, System.Text.Encoding.UTF8, dbBytes); System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding(); string outputString = encoder.GetString(utf8Bytes); However, when I examine the output in the browser, it appears to be garbage, no matter what I set the encoding to. What am I missing? EDIT: In response to the answers below, the reason I thought I had to perform a conversion is because I can output literal multibyte strings just fine. For example: OutputControl.Text = "????????????????????????????????????????????????????????????????"; works. Here, OutputControl is an ASP.Net Literal. However, OutputControl.Text = outputString; //Output from above snippet results in mangled output as described above. My hypothesis was that the database's output was somehow getting mangled by ASP.Net. If that's not the case, then what are some other possibilities?

    Read the article

  • Getting XML Numbered Entities with PHP 5 DOM

    - by user343607
    Hello guys, I am new here and got a question that is tricking me all day long. I've made a PHP script, that reads a website source code through cURL, then works with DOMDocument class in order to generate a sitemap file. It is working like a charm in almost every aspect. The problem is with special characters. For compatibility reasons, sitemap files needs to have all special chars encoded as numbered entities. And I am not achieving that. For example, one of my entries - automatically read from site URLs, and wrote to sitemap file - is: http://www.somesite.com/serviços/redesign/ On the source code it should looks like: http://www.somesite.com/servi*ç*os/redesign/ Just this. But unfortunately, I am really not figuring it out how to do it. Source code file, server headers, etc... everything is encoded as UTF-8. I'm using DOMDocument and related extensions to build the XML. (Basically, DOMDocument, $obj-createElement, $obj-appendChild). htmlentities gives ç instead of ç str_replace does not work. It makes the character just vanish in the output. I was using $obj-createElement("loc", $url); on my code, and just now I read in PHP manual that I should use $document-createTextNode($page), in order to have entities encoding support. Well, it is not working either. Any idea on how to get unstuck of this? Thanks.

    Read the article

  • Ruby - calling constructor without arguments & removal of new line characters

    - by Raj
    I am a newbie at Ruby, I have written down a sample program. I dont understand the following: Why constructor without any arguments are not called in Ruby? How do we access the class variable outside the class' definition? Why does it always append newline characters at the end of the string? How do we strip it? Code: class Employee attr_reader :empid attr_writer :empid attr_writer :name def name return @name.upcase end attr_accessor :salary @@employeeCount = 0 def initiaze() @@employeeCount += 1 puts ("Initialize called!") end def getCount return @@employeeCount end end anEmp = Employee.new print ("Enter new employee name: ") anEmp.name = gets() print ("Enter #{anEmp.name}'s employee ID: ") anEmp.empid = gets() print ("Enter salary for #{anEmp.name}: ") anEmp.salary = gets() theEmpName = anEmp.name.split.join("\n") theEmpID = anEmp.empid.split.join("\n") theEmpSalary = anEmp.salary.split.join("\n") anEmp = Employee.new() anEmp = Employee.new() theCount = anEmp.getCount puts ("New employee #{theEmpName} with employee ID #{theEmpID} has been enrolled, welcome to hell! You have been paid as low as $ #{theEmpSalary}") puts ("Total number of employees created = #{theCount}") Output: Enter new employee name: Lionel Messi Enter LIONEL MESSI 's employee ID: 10 Enter salary for LIONEL MESSI : 10000000 New employee LIONEL MESSI with employee ID 10 has been enrolled, welcome to hell! You have been paid as low as $ 10000000 Total number of employees created = 0 Thanks

    Read the article

  • ASP.Net MVC, JS injection and System.ArgumentException - Illegal Characters in path

    - by Mose
    Hi, In my ASP.Net MVC application, I use custom error handling. I want to perform custom actions for each error case I meet in my application. So I override Application_Error, get the Server.GetLastError(); and do my business depending on the exception, the current user, the current URL (the application runs on many domains), the user IP, and many others. Obviousely, the application is often the target of hackers. In almost all the case it's not a problem to detect and manage it, but for some JS URL attacks, my error handling does not perform what I want it to do. Ex (from logs) : http://localhost:1809/Scripts/]||!o.support.htmlSerialize&&[1 When I got such an URL, an exception is raised when accessing the ConnectionStrings section in the web.config, and I can't even redirect to another URL. It leads to a "System.ArgumentException - Illegal Characters in path, etc." The screenshot below shows the problem : http://screencast.com/t/Y2I1YWU4 An obvious solution is to write a HTTP module to filter the urls before they reach my application, but I'd like to avoid it because : I like having the whole security being managed in one place (in the Application_Error() method) In the module I cannot access the whole data I have in the application itself (application specific data I don't want to debate here) Questions : Did you meet this problem ? How did you manage it ? Thanks for you suggestions, Mose

    Read the article

  • ANTLR : How to replace all characters defined as space with actual space

    - by Puneet Pawaia
    Hi All, My ANTLR code is as follow : LPARENTHESIS : ('('); RPARENTHESIS : (')'); fragment CHARACTER : ('a'..'z'|'0'..'9'|); fragment QUOTE : ('"'); fragment WILDCARD : ('*'); fragment SPACE : (' '|'\n'|'\r'|'\t'|'\u000C'|';'|':'|','); WILD_STRING : (CHARACTER)* ( ('?') (CHARACTER)* )+ ; PREFIX_STRING : (CHARACTER)+ ( ('*') )+ ; WS : (SPACE) { $channel=HIDDEN; }; PHRASE : (QUOTE)(LPARENTHESIS)?(WORD)(WILDCARD)?(RPARENTHESIS)?((SPACE)+(LPARENTHESIS)?(WORD)(WILDCARD)?(RPARENTHESIS)?)*(SPACE)+(QUOTE); WORD : (CHARACTER)+; What I would like to do is to replace all characters marked as space to be replaced with actual space character in the PHRASE. Also if possible, I would then like all continuous spaces to be represented by a single space. Any help would be most appreciated. For some reason, I am finding it hard to understand ANTLR. Any good tutorials out there ?

    Read the article

  • How to query MySQL for exact length and exact UTF-8 characters

    - by oskarae
    I have table with words dictionary in my language (latvian). CREATE TABLE words ( value varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; And let's say it has 3 words inside: INSERT INTO words (value) VALUES ('teja'); INSERT INTO words (value) VALUES ('vejš'); INSERT INTO words (value) VALUES ('feja'); What I want to do is I want to find all words that is exactly 4 characters long and where second character is 'e' and third character is 'j' For me it feels that correct query would be: SELECT * FROM words WHERE value LIKE '_ej_'; But problem with this query is that it returs not 2 entries ('teja','vejš') but all three. As I understand it is because internally MySQL converts strings to some ASCII representation? Then there is BINARY addition possible for LIKE SELECT * FROM words WHERE value LIKE BINARY '_ej_'; But this also does not return 2 entries ('teja','vejš') but only one ('teja'). I believe this has something to do with UTF-8 2 bytes for non ASCII chars? So question: What MySQL query would return my exact two words ('teja','vejš')? Thank you in advance

    Read the article

  • Special Characters in JS, how to use "/" character

    - by user1461222
    I've vbulletin 4.2.0 i added an special button to it's editor with this article; http://www.vbulletinguru.com/2012/add-a-new-toolbar-button-to-ckeditor-tutorial/ The thing i want to do is add an syntax highlighter code with this button. When i use below code it's working fine; CKEDITOR.plugins.add( 'YourPluginName', { init: function( editor ) { editor.addCommand( 'SayHello', { exec : function( editor ) { editor.insertHtml( "Hello from my plugin" ); } }); editor.ui.addButton( 'YourPluginName', { label: 'My Button Tooltip', command: 'SayHello', icon: this.path + 'YourPluginImage.png' } ); } } ); so i changed this code to this, because i wannt to add specific text like below; CKEDITOR.plugins.add( 'DKODU', { init: function( editor ) { editor.addCommand( 'SayHello', { exec : function( editor ) { editor.insertHtml( '[kod=delphi][/kod]' ); } }); editor.ui.addButton( 'DKODU', { label: 'My Button Tooltip', command: 'SayHello', icon: this.path + 'star.png' } ); } } ); after update the code when i press the button nothings happen, i checked with google and this site but i couldn't figure it out i think i made mistake with some special characters but i couldn't find what's the problem. If i made some mistakes when i publish this question forgive me and also forgive me for my bad english, thanks.

    Read the article

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