Search Results

Search found 11822 results on 473 pages for 'ms word'.

Page 172/473 | < Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >

  • Levenshtein: MySQL + PHP

    - by user317005
    $word = strtolower($_GET['term']); $lev = 0; $q = mysql_uqery("SELECT `term` FROM `words`"); while($r = mysql_fetch_assoc($q)) { $r['term'] = strtolower($r['term']); $lev = levenshtein($word, $r['term']); if($lev >= 0 && $lev < 5) { $word = $r['term']; } } how can I move all that into just one query? don't want to have to query through all terms and do the filtering in php.

    Read the article

  • packing fields of a class into a byte array in c#

    - by alex
    Hi all: I am trying to create a fast way to convert c# classes into byte array. I thought of serializing the class directly to a byte array using an example I found: // Convert an object to a byte array private byte[] ObjectToByteArray(Object obj) { if(obj == null) return null; BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); bf.Serialize(ms, obj); return ms.ToArray(); } But the byte array I got contains some other information that are not related to the fields in the class. I guess it is also converting the Properties of the class. Is there a way to serialize only the fields of the class to a byte array? Thanks

    Read the article

  • XNA 2d camera with arbitrary zoom center

    - by blooop
    I have a working 2D camera in XNA with these guts: ms = Mouse.GetState(); msv = new Vector2(ms.X, ms.Y); //screenspace mouse vecor pos = new Vector2(0, 0); //camera center of view zoom_center = cursor; //I would like to be able to define the zoom center in world coords offset = new Vector2(scrnwidth / 2, scrnheight / 2); transmatrix = Matrix.CreateTranslation(-pos.X, -pos.Y, 0) * Matrix.CreateScale(scale, scale, 1) * Matrix.CreateTranslation(offset.X, offset.Y, 0); inverse = Matrix.Invert(transmatrix); cursor = Vector2.Transform(msv, inverse); //the mouse position in world coords I can move the camera position around and change the zoom level (with other code that I have not pasted here for brevity). The camera always zooms around the center of the screen, but I would like to be able to zoom about an arbitrary zoom point (the cursor in this case), like the indie game dyson http://www.youtube.com/watch?v=YiwjjCMqnpg&feature=player_detailpage#t=144s I have tried all the combinations that make sense to me, but am completely stuck.

    Read the article

  • How do I use a UIView subclass as a container?

    - by dxq
    I'm trying to subclass UIView to create a custom view that is essentially a container. The subclass contains a UILabel and a UIImageView- I can't make either of them show up. Here's an example of what I've been trying: In my main view controller: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { ViewClass *myView = [[ViewClass alloc] initWithFrame:CGRectMake(100, 100, 150, 150)]; [view addSubview:myView]; } return self; } In my UIView subclass: - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { UILabel *word = [[[UILabel alloc] initWithFrame:[self bounds]] autorelease]; word.text = @"WHY ISN'T THIS SHOWING UP!?"; [self addSubview:word]; } return self; } Can anyone explain what I'm doing wrong? I'm way out of practice with UIKit and Obj-C, and I figure I'm probably missing something obvious.

    Read the article

  • Check variable if explode-able in PHP

    - by ZaneDeFazio
    Not sure if there is a way to check a variable if it is explode-able or not... I have a database of city names some are one word cities and some are multiple word cities EX: Chicago, Los Angeles I keep getting an error when use "implode" when a city name is one word, so I tried using "count" and using an if statement... not having any luck $citi = explode(' ', $row['city']); $count = count($citi); if ($count > 1) { $city = implode('+', $citi); } else { $city = $citi; }

    Read the article

  • Array index is not accessable because it is Friend

    - by user3738194
    I am getting and error when I bring my code into another project. In a blank project it works fine, I really have no idea how to get around it, here is the error Error 1 'System.Data.Index' is not accessible in this context because it is 'Friend'. Dim DataString As String = txtAdvancedCommand.Text ' Create an array containing from each letter in Textbox Dim charArray() As Char = DataString.ToCharArray For index = 0 To charArray.GetUpperBound(0) <-----ERROR on word index Try 'Now lets send the data If SerialPort.IsOpen Then SerialPort.Write(charArray(index) & vbCrLf) <-----ERROR on word index Else ConnectSerial() SerialPort.Write(charArray(index) & vbCrLf) <-----ERROR on word index End If Catch e As Exception txtLog.AppendText(e.Message & vbCrLf) End Try Next now the project I am bringing into has a DLL and I suspect it has something to do with it, I cannot get the source code to the DLL so is there another way around this?

    Read the article

  • Displaying Fields (and/instead of Properties) in a PropertyGrid

    - by Jenk
    I'd like to use a PropertyGrid to manipulate the data on some objects, however these objects don't have properties, they have fields. Thus a property grid doesn't display them (high five MS!) Before anyone posts "just use properties": I can't at the moment.. these objects are DTOs and are used to send data to a VB6 Interop dll, thus all the parameters for the method calls are "ref" parameters (high five MS!), and C# won't compile if you use a property instead of a field or variable (high five MS!). No, I am not going to create local variables for every property on any given object. There many, many fields, and many, many test cases that would need updating, as well as the production code it self, and this post/question may be the path of least resistance. :)

    Read the article

  • PHP Export Date range

    - by menormedia
    I have a working database export to xls but I need it to export a particular date range based on the 'closed' date. (See code below). For example, I'd like it to export all 'closed' dates for last month and/or this month (Range: Sept 1, 2012 to Sept 30, 2012 or Oct 1, 2012 to Oct 31, 2012) <?PHP //EDIT YOUR MySQL Connection Info: $DB_Server = "localhost"; //your MySQL Server $DB_Username = "root"; //your MySQL User Name $DB_Password = ""; //your MySQL Password $DB_DBName = "ost_helpdesk"; //your MySQL Database Name $DB_TBLName = "ost_ticket"; //your MySQL Table Name //$DB_TBLName, $DB_DBName, may also be commented out & passed to the browser //as parameters in a query string, so that this code may be easily reused for //any MySQL table or any MySQL database on your server //DEFINE SQL QUERY: //edit this to suit your needs $sql = "Select ticketID, name, company, subject, closed from $DB_TBLName ORDER BY closed DESC"; //Optional: print out title to top of Excel or Word file with Timestamp //for when file was generated: //set $Use_Titel = 1 to generate title, 0 not to use title $Use_Title = 1; //define date for title: EDIT this to create the time-format you need $now_date = DATE('m-d-Y'); //define title for .doc or .xls file: EDIT this if you want $title = "MDT Database Dump For Table $DB_TBLName from Database $DB_DBName on $now_date"; /* Leave the connection info below as it is: just edit the above. (Editing of code past this point recommended only for advanced users.) */ //create MySQL connection $Connect = @MYSQL_CONNECT($DB_Server, $DB_Username, $DB_Password) or DIE("Couldn't connect to MySQL:<br>" . MYSQL_ERROR() . "<br>" . MYSQL_ERRNO()); //select database $Db = @MYSQL_SELECT_DB($DB_DBName, $Connect) or DIE("Couldn't select database:<br>" . MYSQL_ERROR(). "<br>" . MYSQL_ERRNO()); //execute query $result = @MYSQL_QUERY($sql,$Connect) or DIE("Couldn't execute query:<br>" . MYSQL_ERROR(). "<br>" . MYSQL_ERRNO()); //if this parameter is included ($w=1), file returned will be in word format ('.doc') //if parameter is not included, file returned will be in excel format ('.xls') IF (ISSET($w) && ($w==1)) { $file_type = "msword"; $file_ending = "doc"; }ELSE { $file_type = "vnd.ms-excel"; $file_ending = "xls"; } //header info for browser: determines file type ('.doc' or '.xls') HEADER("Content-Type: application/$file_type"); HEADER("Content-Disposition: attachment; filename=MDT_DB_$now_date.$file_ending"); HEADER("Pragma: no-cache"); HEADER("Expires: 0"); /* Start of Formatting for Word or Excel */ IF (ISSET($w) && ($w==1)) //check for $w again { /* FORMATTING FOR WORD DOCUMENTS ('.doc') */ //create title with timestamp: IF ($Use_Title == 1) { ECHO("$title\n\n"); } //define separator (defines columns in excel & tabs in word) $sep = "\n"; //new line character WHILE($row = MYSQL_FETCH_ROW($result)) { //set_time_limit(60); // HaRa $schema_insert = ""; FOR($j=0; $j<mysql_num_fields($result);$j++) { //define field names $field_name = MYSQL_FIELD_NAME($result,$j); //will show name of fields $schema_insert .= "$field_name:\t"; IF(!ISSET($row[$j])) { $schema_insert .= "NULL".$sep; } ELSEIF ($row[$j] != "") { $schema_insert .= "$row[$j]".$sep; } ELSE { $schema_insert .= "".$sep; } } $schema_insert = STR_REPLACE($sep."$", "", $schema_insert); $schema_insert .= "\t"; PRINT(TRIM($schema_insert)); //end of each mysql row //creates line to separate data from each MySQL table row PRINT "\n----------------------------------------------------\n"; } }ELSE{ /* FORMATTING FOR EXCEL DOCUMENTS ('.xls') */ //create title with timestamp: IF ($Use_Title == 1) { ECHO("$title\n"); } //define separator (defines columns in excel & tabs in word) $sep = "\t"; //tabbed character //start of printing column names as names of MySQL fields FOR ($i = 0; $i < MYSQL_NUM_FIELDS($result); $i++) { ECHO MYSQL_FIELD_NAME($result,$i) . "\t"; } PRINT("\n"); //end of printing column names //start while loop to get data WHILE($row = MYSQL_FETCH_ROW($result)) { //set_time_limit(60); // HaRa $schema_insert = ""; FOR($j=0; $j<mysql_num_fields($result);$j++) { IF(!ISSET($row[$j])) $schema_insert .= "NULL".$sep; ELSEIF ($row[$j] != "") $schema_insert .= "$row[$j]".$sep; ELSE $schema_insert .= "".$sep; } $schema_insert = STR_REPLACE($sep."$", "", $schema_insert); //this corrects output in excel when table fields contain \n or \r //these two characters are now replaced with a space $schema_insert = PREG_REPLACE("/\r\n|\n\r|\n|\r/", " ", $schema_insert); $schema_insert .= "\t"; PRINT(TRIM($schema_insert)); PRINT "\n"; } } ?>

    Read the article

  • Does DB2 OS/390 BLOB support .docx file

    - by Barry
    ASP.net app inserts .docx fileinto a row on DB2 OS/390 Blob table. A different VB.net app gets the DB2 OS/390 Blob data. When Microsoft Word tries to open the .docx file Microsoft Word pops up a message that the data is corrupted. Word will fix the data so the file can be viewed. I've seen some examples where .docx can be converted to .doc but they only talk about stripping out the text. Some of our .docx have pictures in them. Any ideas?

    Read the article

  • How can I improve the below query?

    - by Newbie
    I have the following input. INPUT: TableA ID Sentences --- ---------- 1 I am a student 2 Have a nice time guys! What I need to do is to extract the words from the sentence(s) and insert each individual word in another table OUTPUT: SentenceID WordOccurance Word ---------- ------------ ----- 1 1 I 1 2 am 1 3 a 1 4 student 2 1 Have 2 2 a 2 3 nice 2 4 time 2 5 guys! I was able to get the answer by using the below query ;With numCTE As ( Select rn = 1 Union all Select rn+1 from numCTE where rn<1000) select SentenceID=id, WordOccurance=row_number()over(partition by TableA.ID order by rn), Word = substring(' '+sentences+' ', rn+1, charindex(' ',' '+sentences+' ', rn+1)-rn-1) from TableA join numCTE on rn <= len(' '+sentences+' ') where substring(' '+sentences+' ', rn,1) = ' ' order by id, rn How can I improve this query of mine.? Basically I am looking for a better solution than the one presented Thanks

    Read the article

  • Click-Once deployment is leaving multiple versions (yes, more than 2)

    - by Clyde
    I've got a click once application that is leaving all old versions on my disk. It's an internal corporate application that gets frequent updates, so this is a disaster for rapidly inflating our backup size. According to the docs and other SO questions, it is supposed to only leave the current and previous versions on disk. However, each time I deploy the project and upgrade a client, I get another copy of all exe/dll/data files. I'm making no changes whatsoever to the application, just pushing deploy again in Visual Studio. Any ideas? Updates: The problem seems to happen on both Windows 7 and XP. 64 bit windows and 32. I've done a diff of the folders where the version is installed and the following files are different: MyApp.exe.manifest MyApp.exe.cdf-ms MyDll1.cdf-ms MyDll2.cdf-ms No actual executable files are different, nor the MyApp.manifest, MyDll1.manifest, etc.

    Read the article

  • Extract words from sentence(s) using TSQL

    - by Newbie
    I have the following input. INPUT: TableA ID Sentences --- ---------- 1 I am a student 2 Have a nice time guys! What I need to do is to extract the words from the sentence(s) and insert each individual word in another table OUTPUT: SentenceID WordOccurance Word ---------- ------------ ----- 1 1 I 1 2 am 1 3 a 1 4 student 2 1 Have 2 2 a 2 3 nice 2 4 time 2 5 guys! I am using SQL Server 2005. My fruitless approach so far is ;With numCTE As ( Select rn = 1 Union all Select rn+1 from numCTE where rn<1000) , getWords As ( Select rn, ID, indiChars From numCTE Cross Apply(Select ID, indiChars = Substring(Sentences,1,rn) From inputTbl)x where indiChars <> '' ) Select Id, Word = stuff(select ',' + cast(indiChars) from getWords g1 where g1.Id = g2.Id for xml path(''),'',1,1)x from getWords g2 Group by g2.Id I am looking for a set based solution. Thanks

    Read the article

  • C# Regex: only letters followed by an optional .

    - by TheDude
    Hello, I am looking for a way to get words out of a sentence. I am pretty far with the following expression: \b([a-zA-Z]+?)\b but there are some occurrences that it counts a word when I want it not to. E.g a word followed by more than one period like "text..". So, in my regex I want to have the period to be at the end of a word zero or one time. Inserting .? did not do the trick, and variations on this have not yielded anything fruitful either. Hope someone can help!

    Read the article

  • jQuery inline text scrolling/rotating/carousel effect

    - by Adam Pope
    I trying to create an animation with JQuery that scrolls 1 word in a sentence. For example, I am a nice sententce of text with a MAGIC word in it OTHER HIDDEN WORDS After a second or so, MAGIC would move upwards and OTHER would scroll into view. I've tried playing with a few carousel plugins but I can't seem to get the effect working. Some seem to have so many nested divs that they refuse to display inline, others have issues when one word is longer than another. Does anybody know of a plugin that could make this possible? Is this even possible?

    Read the article

  • C appending char to char*

    - by Ostap Hnatyuk
    So I'm trying to append a char to a char*. For example I have char *word = " "; I also have char ch = 'x'; I do append(word, ch); Using this method.. void append(char* s, char c) { int len = strlen(s); s[len] = c; s[len+1] = '\0'; } It gives me a segmentation fault, and I understand why I suppose. Because s[len] is out of bounds. How do I make it so it works? I need to clear the char* a lot as well, if I were to use something like char word[500]; How would I clear that once it has some characters appended to it? Would the strlen of it always be 500? Thanks in advance.

    Read the article

  • error while converting the byte arry to image ,after modifying the byte array and the byte array is

    - by geehta
    Hi, this is my code. Here i hv formed the byte array of img, i am trying to add some vlue to this byte array say 10 and i'll take care that the value is not exceeding 255. later if i try to redraw the image via the following code i am getting error at this line... what can be the problem.. without modification if i try to draw the image it is coming but if i cahnge some value it is not drawing.. public Image btoi(byte[] bt) { ms = new MemoryStream(bt, 0, bt.Length); img = Image.FromStream (ms, true); // error at this line ms.Close(); return img; }

    Read the article

  • what mysql table structure is better

    - by Sergey
    I have very complicated search algorithm on my site, so i decided to make a table with cache or maybe all possible results. I wanna ask what structure would be better, or maybe not the one of them? (mySQL) 1) word VARCHAR, results TEXT or BLOB where i'll store ids of found objects (for example 6 chars for each id) 2) word VARCHAR, result INT, but words are not unique now i think i'll have about 200 000 rows in 1) with 1000-10000 ids each row or 200 000 000+ rows in 2) First way takes more storage memory but i think it would be much faster to find 1 unique row among 200 000, than 1000 rows among 200 mln non unique rows i think about index on word column and no sphinx. So that do YOU think? p.s. as always, sorry for my english if it's not very good.

    Read the article

  • Overloading assignment operator in C#

    - by Carson Myers
    I know the = operator can't be overloaded, but there must be a way to do what I want here: I'm just creating classes to represent quantitative units, since I'm doing a bit of physics. Apparently I can't just inherit from a primitive, but I want my classes to behave exactly like primitives -- I just want them typed differently. So I'd be able to go, Velocity ms = 0; ms = 17.4; ms += 9.8; etc. I'm not sure how to do this. I figured I'd just write some classes like so: class Power { private Double Value { get; set; } //operator overloads for +, -, /, *, =, etc } But apparently I can't overload the assignment operator. Is there any way I can get this behavior?

    Read the article

  • Secrets of delivering .NET size large products?

    - by Joan Venge
    In software companies I have seen it's really hard to work on very large products where everything depends on everything else. For instance Microsoft works on C#, F#, .NET, WPF, Visual Studio where these things are interconnected. I don't know how many people are involved, but if it's in 100s, how do they keep in sync with everything, so they design and implement features without conflicting with other dependencies and future plans of other products? I am wondering that if MS is able to do this, they must have a very good system. Any guidelines or secrets for MS or non-MS very large software product delivering?

    Read the article

  • Store image in core data and Retina Display ?

    - by shani
    Hi I have an app that has hundreds of words with 3/4 images for each word. I have 2 versions of each word one for iOS 3 and one for retina display. I wish to save the images as data and connect them to the appropriate word so it will be easy to pull them later. my question is - how do i get the suitable size ? its works great with the @2x wjen you get it from the app file system, but hoe does it supposed to work when i get it from data ? thanks shani

    Read the article

  • preg_replace or regex string translation

    - by ccolon
    I found some partial help but cannot seem to fully accomplish what I need. I need to be able to do the following: I need an regular expression to replace any 1 to 3 character words between two words that are longer than 3 characters with a match any expression: For example: walk to the beach == walk(.*)beach If the 1 to 3 character word is not preceded by a word that's longer than 3 characters then I want to translate that 1 to 3 letter word to ' ?' For example: on the beach == on ?the ?beach The simpler the rule the better (of course, if there's an alternative more complicated version that's more performant then I'll take that as well as I eventually anticipate heavy usage eventually). This will be used in a PHP context most likely with preg_replace. Thus, if you can put it in that context then even better!

    Read the article

  • Game network physics collision

    - by Jonas Byström
    How to simulating two client-controlled vehicles colliding (sensibly) in a typical client/server setup for a network game? I did read this eminent blog post on how to do distributed network physics in general (without traditional client prediction), but this question is specifically on how to handle collisions of owned objects. Example Say client A is 20 ms ahead of server, client B 300 ms ahead of server (counting both latency and maximum jitter). This means that when the two vehicles collide, both clients will see the other as 320 ms behind - in the opposite direction of the velocity of the other vehicle. Head-to-head on a Swedish highway means a difference of 16 meters/17.5 yards! What not to try It is virtually impossible to extrapolate the positions, since I also have very complex vehicles with joints and bodies all over, which in turn have linear and angular positions, velocities and accelerations, not to mention states from user input.

    Read the article

  • case insensitive highlighting in php

    - by fusion
    i'm using this function to highlight the results from mysql query: function highlightWords($string, $word) { $string = str_replace($word, "<span class='highlight'>".$word."</span>", $string); /*** return the highlighted string ***/ return $string; } .... $cQuote = highlightWords(htmlspecialchars($row['cQuotes']), $search_result); the problem is, if i type in 'good', it will only show my search results with a lower-case 'g'ood and not 'Good'. how do i rectify this?

    Read the article

  • Line formatting with Ruby.

    - by dbtek
    There is a text file containing words with 1 space between each of them. And there is also a command line entry that gives the length of line (output) wanted. Output will be words that fit into the length of the line (taken from command line). Also the first word will be on the left side of the line and the last word will be right side of it. The spaces between each word will be same. Any help will be appreciated thanks for replying.

    Read the article

< Previous Page | 168 169 170 171 172 173 174 175 176 177 178 179  | Next Page >