Search Results

Search found 131 results on 6 pages for 'punctuation'.

Page 1/6 | 1 2 3 4 5 6  | Next Page >

  • Changes in Language Punctuation [closed]

    - by Wes Miller
    More social curiosity than actual programming question... (I got shot for posting this on Stack Overflow. They sent me here. At least i hope here is where they meant.) Based on the few responses I got before the content police ran me off Stack Overflow, I should note that I am legally blind and neatness and consistency in programming are my best friends. A thousand years ago when I took my first programming class (Fortran 66) and a mere 500 years ago when I tokk my first C and C++ classes, there were some pretty standard punctuation practices across languages. I saw them in Basic (shudder), PL/1, PL/AS, Rexx even Pascal. Ok, APL2 is not part of this discussion. Each language has its own peculiar punctuation. Pascal's periods, Fortran's comma separated do loops, almost everybody else's semicolons. As I learned it, each language also has KEYWORDS (if, for, do, while, until, etc.) which are set off by whitespace (or the left margin) if, etc. Each language has function, subroutines of whatever they're called. Some built-in some user coded. They were set off by function_name( parameters );. As in sqrt( x ) or rand( y ); Lately, there seems to be a new set of punctuation rules. Especially in c++ where initializers get glued onto the end of variable declarations int x(0); or auto_ptr p(new gizmo); This usually, briefly fools me into thinking someone is declaring a function prototype or using a function as a integer. Then "if" and 'for' seems to have grown parens; if(true) for(;;), etc. Since when did keywords become functions. I realize some people think they ARE functions with iterators as parameters. But if "for" is a function, where did the arg separating commas go? And finally, functions seem to have shed their parens; sqrt (2) select (...) I know, I koow, loosening whitespace rules is good. Keep reading. Question: when did the old ways disappear and this new way come into vogue? Does anyone besides me find it irritating to read and that the information that the placement of punctuation used to convey is gone? I know full well that K&R put the { at the end of the "if" or "for" to save a byte here and there. Can't use that excuse here. Space as an excuse for loss of readability died as HDD space soared past 100 MiB. Your thoughts are solicited. If there is a good reason to do this, I'll gladly learn it and maybe in another 50 years I'll get used to it. Of course it's good that compilers recognize these (IMHO) typos and keep right on going, but just because you CAN code it that way doesn't mean you HAVE to, right?

    Read the article

  • How do I seperate Punctuations in a sentence with a space between each phrase and punctuation in C++

    - by Yadollah
    I want to write a program in c++ that get a sentence and insert a space between each word and punctuation in it! in perl this is done with this expression: sed -e "s/,\([^0-9]\)/ , \1/g" -e "s/\.\([^0-9]\)/ . \1/g" -e 's/\.[ ]*$/ ./g' -e "s/\'/ \' /g" -e 's/?/ ?/g' -e 's/\`\`/ `` /g' -e "s/\' \'/''/g" -e 's/(/ ( /g' -e 's/)/ ) /g' -e 's/ \. \([^$]\)/. \1/g' -e "s/\' s/\'s/g" -e "s/\"\([^\"]*\)\"/\" \1 \"/g" $1 | sed -e "s/\"\([^\"]*\)\"/\`\`\1''/g" But I don't khow how i should do this in c++! for example: should convert a "The question now: Can he act more like hard-charging Teddy Roosevelt." must be converted to "The question now : Can he act more like hard-charging Teddy Roosevelt ." So a punctuation such as '-' or for example a '.' in "No." should not spacing in a sentence, but other punctuation that don't rely on a word or a phrase should be spaced.

    Read the article

  • Custom punctuation function making script run over the php's 60s runtime limit

    - by webmasters
    I am importing allot of product data from an XML file (about 5000 products). When I run the script I can make it work in about 10-12 seconds. Now, when I add this punctuation function which makes sure each product description ends with a punctuation sign, the code runs until the php 60 seconds loadtime on my server but I'm not getting any errors. I have error reporting turned on. I just get a final error that the script could not load in 60 seconds. The question is, looking at this function, is it that resource consuming? What can I do to make it faster? function punctuation($string){ if(strlen($string) > 5){ // Get $last_char $desired_punctuation = array(".",",","?","!"); $last_char = substr($string, -1); // Check if $last_char is in the $desired_punctuation array if(!in_array($last_char, $desired_punctuation)){ // strip the $mytrim string and get only letters at the end; while(!preg_match("/^[a-zA-Z]$/", $last_char)){ $string = substr($string, 0, -1); $last_char = substr($string, -1); } // add "." to the string $string .= '.'; } } return $string; } If the function is ok, the long runtime must come from something else which I'll have to discover. I just want your input on this part.

    Read the article

  • Delete until previous punctuation mark in Bash

    - by hekevintran
    In Bash, Ctrl + W will erase the last word. Bash considers words to be delimited by spaces. This means that if the cursor is at the end of the string "cd /dir1/dir2/dir3" and you hit Ctrl + W you will be left with "cd ". Is there a Bash shortcut (custom defined is okay) that will leave me with "cd /dir1/dir2/"?

    Read the article

  • Cleaning strings in R: add punctuation w/o overwriting last character

    - by spearmint
    I'm new to R and unable to find other threads with a similar issue. I'm cleaning data that requires punctuation at the end of each line. I am unable to add, say, a period without overwriting the final character of the line preceding the carriage return + line feed. Sample code: Data1 <- "%trn: dads sheep\r\n*MOT: hunn.\r\n%trn: yes.\r\n*MOT: ana mu\r\n%trn: where is it?" Data2 <- gsub("[^[:punct:]]\r\n\\*", ".\r\n\\*", Data1) The contents of Data2: [1] "%trn: dads shee.\r\n*MOT: hunn.\r\n%trn: yes.\r\n*MOT: ana mu\r\n%trn: where is it?" Notice the "p" of sheep was overwritten with the period. Any thoughts on how I could avoid this?

    Read the article

  • Allow alphanumeric, punctuation, and spaces

    - by bccarlso
    I'm pretty new to regular expressions, and MAN do they give me a headache. They are so intimidating! For an email campaign I'm doing, a user will click a link out of the email with a few URL parameters filled in for them, to make filling out a form easier. I want to prevent any injection hacks or whatever it's called, but need to allow the $_GET parameters to be alphanumeric, have punctuation, and have spaces. If someone has a good method for this, I'd appreciate it, but right now I have: foreach($_GET as $m=>$n) { $get[$m] = preg_replace('(^[a-z0-9 \-\_\.]+)i',' ',$n); } I would like to be able to replace all characters NOT found with this regular expression, which I believe I use ?!, but I can't get that to work either. Any help in getting this to work would be appreciated!

    Read the article

  • C# equivalent of Java Punctuation regex

    - by user325099
    I'm looking to find the equivalent in C# for the equivalent of this regex. Java: public static final String expression = "[\s\p{Punct}]"; {Punct} is a reserved character class in Java but I'm not sure how to create the equivalent expression so that the .net regex engine doesn't barf.

    Read the article

  • How to use symbols/punctuation characters in discriminated unions

    - by user343550
    I'm trying to create a discriminated union for part of speech tags and other labels returned by a natural language parser. It's common to use either strings or enums for these in C#/Java, but discriminated unions seem more appropriate in F# because these are distinct, read-only values. In the language reference, I found that this symbol ``...`` can be used to delimit keywords/reserved words. This works for type ArgumentType = | A0 // subject | A1 // indirect object | A2 // direct object | A3 // | A4 // | A5 // | AA // | ``AM-ADV`` However, the tags contain symbols like $, e.g. type PosTag = | CC // Coordinating conjunction | CD // Cardinal Number | DT // Determiner | EX // Existential there | FW // Foreign Word | IN // Preposision or subordinating conjunction | JJ // Adjective | JJR // Adjective, comparative | JJS // Adjective, superlative | LS // List Item Marker | MD // Modal | NN // Noun, singular or mass | NNP // Proper Noun, singular | NNPS // Proper Noun, plural | NNS // Noun, plural | PDT // Predeterminer | POS // Possessive Ending | PRP // Personal Pronoun | PRP$ //$ Possessive Pronoun | RB // Adverb | RBR // Adverb, comparative | RBS // Adverb, superlative | RP // Particle | SYM // Symbol | TO // to | UH // Interjection | VB // Verb, base form | VBD // Verb, past tense | VBG // Verb, gerund or persent participle | VBN // Verb, past participle | VBP // Verb, non-3rd person singular present | VBZ // Verb, 3rd person singular present | WDT // Wh-determiner | WP // Wh-pronoun | WP$ //$ Possessive wh-pronoun | WRB // Wh-adverb | ``#`` | ``$`` | ``''`` | ``(`` | ``)`` | ``,`` | ``.`` | ``:`` | `` //not sure how to escape/delimit this ``...`` isn't working for WP$ or symbols like ( Also, I have the interesting problem that the parser returns `` as a meaningful symbol, so I need to escape it as well. Is there some other way to do this, or is this just not possible with a discriminated union? Right now I'm getting errors like Invalid namespace, module, type or union case name Discriminated union cases and exception labels must be uppercase identifiers I suppose I could somehow override toString for these goofy cases and replace the symbols with some alphanumeric equivalent?

    Read the article

  • Kentico - Using punctuation with AuthenticateUser

    - by Big Friendly Giant
    We are currently using version 7.0 of the kentico API to authenticate users into our system. The following code is used to gain user details from the database and authenticate users. UserInfo objUserInfo = AuthenticationHelper.AuthenticateUser(username.ToLower(), password.ToLower(), CMSContext.CurrentSiteName); This has primarily been working correctly, but we are having issues with usernames and passwords that contain any of the following characters. " ! @ ' / \ < * - Is there any settings that I need to be aware of (web.config or otherwise) that would stop the API from accessing an account where a username or password contained special characters?

    Read the article

  • Inverted question mark only on Microsoft Office applications

    - by inerte
    My dad has a notebook and the key which has the "/?°" symbols acts like ctrl. Known factory problem. Anyway, his keyboard also has a "?" marked under the "w" key. Pressing "ctrl + alt + w" will display the "?" character (question, interrogation mark). Except on Office applications, like Word and Outlook, which will output "¿". I've searched Word and Outlook menus looking for a parameter that could be, somehow, remapping the notebooks keyboards, applying different regional configurations, language, or encodings. Since it only happens on Office apps, I believe the solution is within its options, but I was unable to find it where. Pressing "ctrl + alt gr + w" will display ? correctly, but I am stumped by this problem. I could remap the keys and make "/?° behave correctly, but my curiosity now is eating me alive. Why only on Office! Thanks,

    Read the article

  • In bash, how do I escape an exclamation mark?

    - by Matthew
    I want to do something like bzr commit -m "It works!". I can sort of escape the exclamation mark by doing bzr commit -m "It works\!". However, then my commit message includes the backslash. How do I escape the exclamation mark, while still ignoring the backslash?

    Read the article

  • Large quotation marks in Word?

    - by hawbsl
    Is there a simple way in MS Word to get large quotation marks tightly round a paragraph of text, like you might see in print media to mark a quote? If you simply increase the font size of the quote character, it moves too far away from the text it's accompanying. Worse, the first and last lines start to detach from the rest of the paragraph. Here's what I mean (this is Calibri I think): But this is the desired effect (can't do this in Word, had to chop it about in a paint package):

    Read the article

  • SQL SELECT multiple INNER JOINs

    - by Noam Smadja
    The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect its Access database.. i have a Library table, where Autnm Topic Size Cover Lang are foreign Keys each record is actually a book which has its properties such as author and stuff. i am not quite sure i am even using the correct JOIN.. quite new with "complex" SQL :) SELECT Library.Bknm_Hebrew, Library.Bknm_English, Library.Bknm_Russian, Library.Note, Library.ISBN, Library.Pages, Library.PUSD, Author.ID AS [AuthorID], Author.Author_hebrew AS [AuthorHebrew], Author.Author_English AS [AuthorEnglish], Author.Author_Russian AS [AuthorRussian], Topic.ID AS [TopicID], Topic.Topic_Hebrew AS [TopicHebrew], Topic.Topic_English AS [TopicEnglish], Topic.Topic_Russian AS [TopicRussian], Size.Size AS [Size], Cover.ID AS [TopicID], Cover.Cvrtyp_Hebrew AS [CoverHebrew], Cover.Cvrtyp_English AS [TopicEnglish], Cover.Cvrtyp_Russian AS [CoverRussian], Lang.ID AS [LangID], Lang.Lang_Hebrew AS [LangHebrew], Lang.Lang_English AS [LangEnglish], FROM Library INNER JOIN Author ON Library.Autnm = Author.ID INNER JOIN Topic ON Library.Topic = Topic.ID INNER JOIN Size ON Library.Size = Size.ID INNER JOIN Cover ON Library.Cover = Cover.ID INNER JOIN Lang ON Library.Lang = Lang.ID Thx in advance

    Read the article

  • How can I detect if a string contains punctuation marks at the end?

    - by Sheehan Alam
    Lets assume I have the string: "Hello I like your shoes #today...!" I am tokenizing the string by spaces: return [string componentsSeparatedByString:@" "]; So my array contains: Hello I like your shoes #today...! I want to focus on "#today...!" any word that has a # in the prefix I am changing the font color. How can I make sure that only "#today" has its font color changed? I would basically like to figure out if a word has a punctuation mark at the end, and change the color for characters before the punctuation mark.

    Read the article

  • Lucene Analyzer to Use With Special Characters and Punctuation?

    - by Brandon
    I have a Lucene index that has several documents in it. Each document has multiple fields such as: Id Project Name Description The Id field will be a unique identifier such as a GUID, Project is a user's ProjectID and a user can only view documents for their project, and Name and Description contain text that can have special characters. When a user performs a search on the Name field, I want to be able to attempt to match the best I can such as: First Will return both: First.Last and First.Middle.Last Name can also be something like: Test (NameTest) Where, if a user types in 'Test', 'Name', or '(NameTest)', then they can find the result. However, if I say that Project is 'ProjectA' then that needs to be an exact match (case insensitive search). The same goes with the Id field. Which fields should I set up as Tokenized and which as Untokenized? Also, is there a good Analyzer I should consider to make this happen? I am stuck trying to decide the best route to implement the desired searching.

    Read the article

  • .NET Regular Expression to find actual words in text

    - by Mehdi Anis
    I am using VB .NET to write a program that will get the words from a suplied text file and count how many times each word appears. I am using this regular expression:- parser As New Regex("\w+") It gives me almost 100% correct words. Except when I have words like "Ms Word App file name is word.exe." or "is this a c# statment If(ab?1,0) ?" In such cases I get [word & exe] AND [If, a, b, 1 and 0] as seperate words. it would be nice (for my purpose) that I received word.exe and (If(ab?1,0) as words. I guess \w+ looks for white space, sentence terminating punctuation mark and other punctuation marks to determine a word. I want a similar regular Expression that will not break a word by a punctuation mark, if the punctuation mark is not the end of the word. I think end-of-word can be defined by a trailing WhiteSpace, Sentence terminating Punctuation (you may think of others). if you can suggest some regular expression 9for VB .NET) that will be great help. Thanks.

    Read the article

  • I'm writing a spellchecking program, how do I replace ch in a string?

    - by Ajay Hopkins
    What am I doing wrong/what can I do? import sys import string def remove(file): punctuation = string.punctuation for ch in file: if len(ch) > 1: print('error - ch is larger than 1 --| {0} |--'.format(ch)) if ch in punctuation: ch = ' ' return ch else: return ch ref = (open("ref.txt","r")) test_file = (open("test.txt", "r")) dictionary = ref.read().split() file = test_file.read().lower() file = remove(file) print(file) This is in Python 3.1.2

    Read the article

  • im writing a spellchecking program, how do i replace ch in a string..eg..

    - by Ajay Hopkins
    what am i doing wrong/what can i do?? import sys import string def remove(file): punctuation = string.punctuation for ch in file: if len(ch) > 1: print('error - ch is larger than 1 --| {0} |--'.format(ch)) if ch in punctuation: ch = ' ' return ch else: return ch ref = (open("ref.txt","r")) test_file = (open("test.txt", "r")) dictionary = ref.read().split() file = test_file.read().lower() file = remove(file) print(file) p.s, this is in Python 3.1.2

    Read the article

  • SQLAuthority News – Android Efficiency Tips and Tricks – Personal Technology Tip #003

    - by pinaldave
    I use my phone for lots of things.  I use it mainly to replace my tablet – I can e-mail, take and edit photos, and do almost everything I can do on a laptop with this phone.  And I am sure that there are many of you out there just like me.  I personally have a Galaxy S3, which uses the Android operating system, and I have decided to feature it as the third installment of my Technology Tips and Tricks series. 1) Shortcut to your favorite contacts on home screen Access your most-called contacts easily from your home screen by holding your finger on any empty spot on the home screen.  A menu will pop up that allows you to choose Shortcuts, and Contact.  You can scroll through your contact list and then just tap on the name of the person you want to be able to dial with a single click. 2) Keep track of your data usage Yes, we all should keep a close eye on our data usage, because it is very easy to go over our limits and then end up with a giant bill at the end of the month.  Never get surprised when you open that mobile phone envelope again.  Go to Settings, then Data Usage, and you can find a quick rundown of your usage, how much data each app uses, and you can even set alarms to let you know when you are nearing the limits.   Better yet, you can set the phone to stop using data when it reaches a certain limit. 3) Bring back Good Grammar We often hear proclamations about the downfall of written language, and how texting abbreviations, misspellings, and lack of punctuation are the root of all evil.  Well, we can show all those doomsdayers that all is not lost by bringing punctuation back to texting.  Usually we leave it off when we text because it takes too long to get to the screen with all the punctuation options.  But now you can hold down the period (or “full stop”) button and a list of all the commonly-used punctuation marks will pop right up. 4) Apps, Apps, Apps and Apps And finally, I cannot end an article about smart phones without including a list of my favorite apps.  Here are a list of my Top 10 Applications on my Android (not counting social media apps). Advanced Task Killer – Keeps my phone snappy by closing un-necessary apps WhatsApp - my favorite alternate to Text SMS Flipboard - my ‘timepass’ moments Skype – keeps me close to friends and family GoogleMaps - I am never lost because of this one thing Amazon Kindle – Books my best friends DropBox - My data always safe Pluralsight Player – Learning never stops for me Samsung Kies Air – Connecting Phone to Computer Chrome – Replacing default browser I have not included any social media applications in the above list, but you can be sure that I am linked to Twitter, Facebook, Google+, LinkedIn, and YouTube. Reference: Pinal Dave (http://blog.SQLAuthority.com)   Filed under: Best Practices, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology Tagged: Android, Personal Technology

    Read the article

  • SQLAuthority News – Android Efficiency Tips and Tricks – Personal Technology Tip

    - by pinaldave
    I use my phone for lots of things.  I use it mainly to replace my tablet – I can e-mail, take and edit photos, and do almost everything I can do on a laptop with this phone.  And I am sure that there are many of you out there just like me.  I personally have a Galaxy S3, which uses the Android operating system, and I have decided to feature it as the third installment of my Technology Tips and Tricks series. 1) Shortcut to your favorite contacts on home screen Access your most-called contacts easily from your home screen by holding your finger on any empty spot on the home screen.  A menu will pop up that allows you to choose Shortcuts, and Contact.  You can scroll through your contact list and then just tap on the name of the person you want to be able to dial with a single click. 2) Keep track of your data usage Yes, we all should keep a close eye on our data usage, because it is very easy to go over our limits and then end up with a giant bill at the end of the month.  Never get surprised when you open that mobile phone envelope again.  Go to Settings, then Data Usage, and you can find a quick rundown of your usage, how much data each app uses, and you can even set alarms to let you know when you are nearing the limits.   Better yet, you can set the phone to stop using data when it reaches a certain limit. 3) Bring back Good Grammar We often hear proclamations about the downfall of written language, and how texting abbreviations, misspellings, and lack of punctuation are the root of all evil.  Well, we can show all those doomsdayers that all is not lost by bringing punctuation back to texting.  Usually we leave it off when we text because it takes too long to get to the screen with all the punctuation options.  But now you can hold down the period (or “full stop”) button and a list of all the commonly-used punctuation marks will pop right up. 4) Apps, Apps, Apps and Apps And finally, I cannot end an article about smart phones without including a list of my favorite apps.  Here are a list of my Top 10 Applications on my Android (not counting social media apps). Advanced Task Killer – Keeps my phone snappy by closing un-necessary apps WhatsApp - my favorite alternate to Text SMS Flipboard - my ‘timepass’ moments Skype – keeps me close to friends and family GoogleMaps - I am never lost because of this one thing Amazon Kindle – Books my best friends DropBox - My data always safe Pluralsight Player – Learning never stops for me Samsung Kies Air – Connecting Phone to Computer Chrome – Replacing default browser I have not included any social media applications in the above list, but you can be sure that I am linked to Twitter, Facebook, Google+, LinkedIn, and YouTube. Reference: Pinal Dave (http://blog.SQLAuthority.com)   Filed under: Best Practices, PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, SQLAuthority News, T SQL, Technology Tagged: Android, Personal Technology

    Read the article

  • Why doesn't Python's `re.split()` split on zero-length matches?

    - by Tim Pietzcker
    One particular quirk of the (otherwise quite powerful) re module in Python is that re.split() will never split a string on a zero-length match, for example if I want to split a string along word boundaries: >>> re.split(r"\s+|\b", "Split along words, preserve punctuation!") ['Split', 'along', 'words,', 'preserve', 'punctuation!'] instead of ['', 'Split', 'along', 'words', ',', 'preserve', 'punctuation', '!'] Why does it have this limitation? Is it by design? Do other regex flavors behave like this?

    Read the article

1 2 3 4 5 6  | Next Page >