Search Results

Search found 5105 results on 205 pages for 'words'.

Page 17/205 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • char[] and char* compatibility?

    - by Aerovistae
    In essence, will this code work? And before you say "Run it and see!", I just realized my cygwin didn't come with gcc and it's currently 40 minutes away from completing reinstallation. That being said: char* words[1000]; for(int i = 0; i<1000; i++) words[i] = NULL; char buffer[ 1024 ]; //omit code that places "ADD splash\0" into the buffer if(strncmp (buffer, "ADD ", 4){ char* temp = buffer + 4; printf("Adding: %s", temp); int i = 0; while(words[i] != NULL) i++; words[i] = temp; } I'm mostly uncertain about the line char* temp = buffer + 4, and also whether I can assign words[i] in the manner that I am. Am I going to get type errors when I eventually try to compile this in 40 minutes? Also-- if this works, why don't I need to use malloc() on each element of words[]? Why can I say words[i] = temp, instead of needing to allocate memory for words[i] the length of temp?

    Read the article

  • Java ArrayList remove dupes without sets

    - by Kieran
    I'm having problems removing duplicates from an ArrayList. It's for an assignment for college. Here's the code I have already: public int numberOfDiffWords() { ArrayList<String> list = new ArrayList<>(); for(int i=0; i<words.size()-1; i++) { for(int j=i+1; j<words.size(); j++) { if(words.get(i).equals(words.get(j))) { // do nothing } else { list.add(words.get(i)); } } } return list.size(); } The problem is in the numberOfDiffWords() method. The populate list method is working correctly, as my instructor has given me a sample string (containing 4465 words) to analyse - printing words.size() gives the correct result. I want to return the size of the new ArrayList with all duplicates removed. words is an ArrayList class attribute. UPDATE: I should have mentioned I'm only allowed to use dynamic indexed-based storage for this part of the assignment, which means no hash-based storage.

    Read the article

  • how to dispose a incoming email and then send some words back using googe-app-engine..

    - by zjm1126
    from google.appengine.api import mail i read the doc: mail.send_mail(sender="[email protected]", to="Albert Johnson <[email protected]>", subject="Your account has been approved", body=""" Dear Albert: Your example.com account has been approved. You can now visit http://www.example.com/ and sign in using your Google Account to access new features. Please let us know if you have any questions. The example.com Team """) and i know hwo to send a email using gae ,but how to check a email incoming, and then do something thanks

    Read the article

  • How to transform phrases and words into MD5 hash?

    - by brilliant
    Can anyone, please, explain to me how to transform a phrase like "I want to buy some milk" into MD5? I read Wikipedia article on MD5, but the explanation given there is beyond my comprehension: "MD5 processes a variable-length message into a fixed-length output of 128 bits. The input message is broken up into chunks of 512-bit blocks (sixteen 32-bit little endian integers)" "sixteen 32-bit little endian integers" is already hard for me. I checked the article on little endians and didn't understand a bit. However, the examples of some phrases and their MD5 hashes are very nice: MD5("The quick brown fox jumps over the lazy dog") = 9e107d9d372bb6826bd81d3542a419d6 MD5("The quick brown fox jumps over the lazy dog.") = e4d909c290d0fb1ca068ffaddf22cbd0 Can anyone, please, explain to me how this MD5 algorithm works on some very simple example? And also, perhaps you know some software or a code that would transform phrases into their MD5. If yes, please, let me know.

    Read the article

  • Pulling out two separate words from a string using reg expressions?

    - by Marvin
    I need to improve on a regular expression I'm using. Currently, here it is: ^[a-zA-Z\s/-]+ I'm using it to pull out medication names from a variety of formulation strings, for example: SULFAMETHOXAZOLE-TRIMETHOPRIM 200-40 MG/5ML PO SUSP AMOX TR/POTASSIUM CLAVULANATE 125 mg-31.25 mg ORAL TABLET, CHEWABLE AMOXICILLIN TRIHYDRATE 125 mg ORAL TABLET, CHEWABLE AMOX TR/POTASSIUM CLAVULANATE 125 mg-31.25 mg ORAL TABLET, CHEWABLE Amoxicillin 1000 MG / Clavulanate 62.5 MG Extended Release Tablet The resulting matches on these examples are: SULFAMETHOXAZOLE-TRIMETHOPRIM AMOX TR/POTASSIUM CLAVULANATE AMOXICILLIN TRIHYDRATE AMOX TR/POTASSIUM CLAVULANATE Amoxicillin The first four are what I want, but on the fifth, I really need "Amoxicillin / Clavulanate". How would I pull out patterns like "Amoxicillin / Clavulanate" (in fifth row) while missing patterns like "MG/5 ML" (in the first row)?

    Read the article

  • It's possible make an OCR in Python to check words...

    - by Shady
    in opened applications? I want to automate firefox in some web page and I don't have a way to "know" if the page already load completely or if it still loading... I was thinking about making an OCR to check the status bar... it's difficult ? For example, when the word DONE appears at the status bar, the program continues to the next command...

    Read the article

  • Fastest way to put contents of Set<String> to a single String with words separated by a whitespace?

    - by Lars Andren
    I have a few Set<String>s and want to transform each of these into a single String where each element of the original Set is separated by a whitespace " ". A naive first approach is doing it like this Set<String> set_1; Set<String> set_2; StringBuilder builder = new StringBuilder(); for (String str : set_1) { builder.append(str).append(" "); } this.string_1 = builder.toString(); builder = new StringBuilder(); for (String str : set_2) { builder.append(str).append(" "); } this.string_2 = builder.toString(); Can anyone think of a faster, prettier or more efficient way to do this?

    Read the article

  • A PHP Library / Class to Count Words in Various Languages?

    - by Michael Robinson
    Some time in the near future I will need to implement a cross-language word count, or if that is not possible, a cross-language character count. I'd love it if I just had to look at English, but I need to consider every language here, Chinese, Korean, English, Arabic, Hindi, and so on. I would like to know if Stack Overflow has any leads on where to start looking for an existing product / method to do this in PHP, as I am a good lazy programmer* *http://blogoscoped.com/archive/2005-08-24-n14.html

    Read the article

  • Is is possible to parse a web page from the client side for a large number of words and if so, how?

    - by Technoh
    I have a list of keywords, about 25,000 of them. I would like people who add a certain < script tag on their web page to have these keywords transformed into links. What would be the best way to go and achieve this? I have tried the simple javascript approach (an array with lots of elements and regexping/replacing each) and it obviously slows down the browser. I could always process the content server-side if there was a way, from the client, to send the page's content to a cross-domain server script (I'm partial to PHP but it could be anything) but I don't know of any way to do this. Any other working solution is also welcome.

    Read the article

  • Order a sentence alphabetically and count the number of times each words appears and print in a table

    - by JaAnTr
    I am struggling with the print in a table part of the question. So far I have managed to order the user inputted sentence alphabetically and count the number of times each word occurs. Here is the code: thestring = (raw_input()) sentence = thestring.split(" ") sentence.sort() count = {} for word in thestring.split(): try: count[word] += 1 except KeyError: count[word] = 1 print sentence print count And when I run the code I get this: ['apple', 'apple', 'banana', 'mango', 'orange', 'pear', 'pear', 'strawberry'] {'apple': 2, 'pear': 2, 'strawberry': 1, 'mango': 1, 'orange': 1, 'banana': 1} However, ideally I want it printed in a table that looks something like: apple.....|.....2 banana....|.....1 mango.....|.....1 orange....|.....1 pear......|.....2 strawberry|.....1 Thanks for any help!

    Read the article

  • How to make flyspell bypass some words by context?

    - by manu
    Hi, I use Emacs for writing most of my writings. I write using reStructuredText, and then transform them to LaTeX after some preprocessing since I write my citations á-la LaTeX. This is an excerpt of one of my texts (in Spanish): En \cite[pp.~XXVIII--XXIX]{Crnkovic2002} se brindan algunos riesgos que se pueden asumir con el desarrollo basado en componentes, los This text is processed by some custom scripts that deals with the \cite part so rst2latex can do its job. When I activate flyspell-mode it signals most of the citation keys as spelling errors. How can I tell flyspell not to spellcheck things within \cite commands. Furthermore, how can I combine rst-mode and flyspell, so that rst-mode would keep flyspell from spellchecking the following? reST comments reST code literal reST directive parameters and arguments reST raw directive contents Any ideas?

    Read the article

  • Is there a way to highlight specific words or numbers without inserting a span tag?

    - by Taylor
    I've got blocks of text with various specs in them and want to have jquery highlight whatever matches a specific pattern without inserting any extra html. The following is the kind of text that I've got to work with. Intel® Core™ i7 Processor 920 (2.66GHz, 8MB cache, 4.8GT/sec)/ Genuine Windows® 7 Home Premium 64bit- English/ 640 GB Serial ATA non Raid (7200 Rpm)/ 6GB 1333MHz (3x2GB) Tri Channel Memory/ Display Not Included/ 16X DVD+/- RW Optical Drive (DVD & CD read and write)/ 1.8GB NVIDIA® GeForce™ GTX260 graphics card/ Integrated HDA 7.1 Dolby Digital Audio What I'm hoping jquery can do is highlight some of the basic specs without inserting any extra html. Maybe working off a list of values matching the spec format using some wildcards where neededed? The css to select the correct tag is #list div div div+p or I could just give the p class but would rather not. Is this kind of thing possible?

    Read the article

  • How can I break up long words instead of overflowing?

    - by ripper234
    How can I stop this text from overflowing? <html> <head> <style type="text/css"> .sticky { background-color: #FCFC80; margin: 5px; height: 100px; width: 135px; } .sticky .edit { vertical-align:middle; height: 100px; position:relative; color:Black; background-color:blue; height:90px; vertical-align:middle; width:90px; border-collapse:collapse; } </style> </head> <body> <div id="note44" class="sticky"> <div id="text44" class="edit" title="Click to edit" style="">A very long word: abcdefasdfasfasd</div> </div> </body> </html>

    Read the article

  • How to match words as if in a dictionary, based on len-1 or len+1? Python

    - by pearbear
    If I have a word 'raqd', how would I use python to have a spellcheck, so to speak, to find the word 'rad' as an option in 'spellcheck'? What I've been trying to do is this: def isbettermatch(keysplit, searchword): i = 0 trues = 0 falses = 0 lensearchwords = len(searchword) keysplits = copy.deepcopy(keysplit) searchwords = copy.deepcopy(searchword) #print keysplit, searchwords if len(keysplits) == len(searchwords)-1: i = 0 while i < len(keysplits): j = 0 while j < lensearchwords: if keysplits[i] == searchwords[j]: trues +=1 searchwords.pop(j) lensearchwords = len(searchwords) elif keysplits[i] != searchwords[j]: falses +=1 j +=1 i +=1 if trues >= len(searchwords)-1: #print "-------------------------------------------------------", keysplits return True keysplit is a list like ['s', 'p', 'o', 'i', 'l'] for example, and the searchword would be a list ['r', 'a', 'q', 'd']. If the function returns True, then it would print the keyword that matches. Ex. 'rad', for the searchword 'raqd'. I need to find all possible matches for the searchword with a single letter addition or deletion. so ex. 'raqd' would have an option to be 'rad', and 'poted' could be 'posted' or 'potted'. Above is what I have tried, but it is not working well at all. Help much appreciated!

    Read the article

  • How do I escape reserved words used as column names? MySQL/Create Table

    - by acidzombie24
    I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved MySQL keyword. How do I escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique) create table if not exists misc_info ( id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL)ENGINE=INNODB;

    Read the article

  • How do I write a bash script to replace words in files and then rename files?

    - by Jason
    Hi All, I have a folder structure, as shown below: I need to create a bash script that does 4 things: It searches all the files in the generic directory and finds the string 'generic' and makes it into 'something' As above, but changes "GENERIC" to "SOMETHING" As above, but changes "Generic" to "Something" Renames any filename that has "generic" in it with "something" Right now I am doing this process manually by using the search and replace in net beans. I dont know much about bash scripting, but i'm sure this can be done. I'm thinking of something that I would run and it would take "Something" as the input. Where would I start? what functions should I use? overall guidance would be great. thanks. I am using Ubuntu 10.5 desktop edition.

    Read the article

  • Optimizing Haskell code

    - by Masse
    I'm trying to learn Haskell and after an article in reddit about Markov text chains, I decided to implement Markov text generation first in Python and now in Haskell. However I noticed that my python implementation is way faster than the Haskell version, even Haskell is compiled to native code. I am wondering what I should do to make the Haskell code run faster and for now I believe it's so much slower because of using Data.Map instead of hashmaps, but I'm not sure I'll post the Python code and Haskell as well. With the same data, Python takes around 3 seconds and Haskell is closer to 16 seconds. It comes without saying that I'll take any constructive criticism :). import random import re import cPickle class Markov: def __init__(self, filenames): self.filenames = filenames self.cache = self.train(self.readfiles()) picklefd = open("dump", "w") cPickle.dump(self.cache, picklefd) picklefd.close() def train(self, text): splitted = re.findall(r"(\w+|[.!?',])", text) print "Total of %d splitted words" % (len(splitted)) cache = {} for i in xrange(len(splitted)-2): pair = (splitted[i], splitted[i+1]) followup = splitted[i+2] if pair in cache: if followup not in cache[pair]: cache[pair][followup] = 1 else: cache[pair][followup] += 1 else: cache[pair] = {followup: 1} return cache def readfiles(self): data = "" for filename in self.filenames: fd = open(filename) data += fd.read() fd.close() return data def concat(self, words): sentence = "" for word in words: if word in "'\",?!:;.": sentence = sentence[0:-1] + word + " " else: sentence += word + " " return sentence def pickword(self, words): temp = [(k, words[k]) for k in words] results = [] for (word, n) in temp: results.append(word) if n > 1: for i in xrange(n-1): results.append(word) return random.choice(results) def gentext(self, words): allwords = [k for k in self.cache] (first, second) = random.choice(filter(lambda (a,b): a.istitle(), [k for k in self.cache])) sentence = [first, second] while len(sentence) < words or sentence[-1] is not ".": current = (sentence[-2], sentence[-1]) if current in self.cache: followup = self.pickword(self.cache[current]) sentence.append(followup) else: print "Wasn't able to. Breaking" break print self.concat(sentence) Markov(["76.txt"]) -- module Markov ( train , fox ) where import Debug.Trace import qualified Data.Map as M import qualified System.Random as R import qualified Data.ByteString.Char8 as B type Database = M.Map (B.ByteString, B.ByteString) (M.Map B.ByteString Int) train :: [B.ByteString] -> Database train (x:y:[]) = M.empty train (x:y:z:xs) = let l = train (y:z:xs) in M.insertWith' (\new old -> M.insertWith' (+) z 1 old) (x, y) (M.singleton z 1) `seq` l main = do contents <- B.readFile "76.txt" print $ train $ B.words contents fox="The quick brown fox jumps over the brown fox who is slow jumps over the brown fox who is dead."

    Read the article

  • Four Words That Go Together Well: Oracle. Technology. Network. Lounge.

    - by Oracle OpenWorld Blog Team
    Again this year the Oracle Technology Network (OTN) Lounge will be in the Howard Street Tent, on Howard Street (surprise!) between Moscone North and South. The OTN Lounge is a central meeting place for all Oracle OpenWorld and JavaOne attendees to network with Oracle experts, ACEs, and peers. And to discuss areas of common technology interest - or discuss anything at all. Check out this OTN blog post to get the details on exciting special activities, drawings, and contests happening at the lounge the week of the conference. Stop by - there could be a t-shirt in it for you. OTN Lounge Hours Sunday, September 30    7:00 p.m. - 8:30 p.m.Monday, October 1          8:00 a.m. - 7:00 p.m.Tuesday, October 2         8:00 a.m. - 7:00 p.m.Wednesday, October 3    8:00 a.m. - 5:00 p.m.Thursday, October 4        8:00 a.m. - 2:00 p.m.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >