Search Results

Search found 6715 results on 269 pages for 'preg match'.

Page 166/269 | < Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >

  • Getting the rows cell to line up with parameters in a sp c# winform

    - by Yaron Buki
    I am using a datagridview on a win app designed in c#2010 express. In the _row leave event of my datagrid I would like to use the TableAdapter.usp_insert() that I created. But how does one match up the data in the cells of the datagridview row to the parameters in the stored procedure. Thanks in advance I appreciate the education. This is what if found so far! Int i; i = datagridview1.SelectedCells[0].RowIndex; ... .... Eventually string id = dataGridView1.Rows[i].cell[0].Value.ToString(); @para1 = id; Etc.. What do you think?

    Read the article

  • Apache rewrite_mod: RewriteRule path and query string

    - by 1ace
    I currently have a website with a standard web interface on index.php, and I made an iPhone-friendly version in iphone.php. Both pages handle the same arguments. It works fine when I manually go to .../iphone.php, but I'd like to rewrite anything on .../path/ and .../path/index.php to iphone.php if %{HTTP_USER_AGENT} contains mobile, and optionally add the query string (not sure if/when I'd need to add it). So far, this is what I have in my .../path/.htaccess: RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ^.+mobile.+$ [NC] RewriteRule index.php?(.*) iphone.php?$1 [L] RewriteRule index.php iphone.php [L] The problems are, it matches index.php in any subfolder, and it won't match .../path/?args… Special thanks to anyone who can correct/simplify/optimize anything =)

    Read the article

  • PHP Scale image and then create image of specific size

    - by Ronny vdb
    The result I am trying to achieve is that the user can upload an image of any size, and the server side script will convert it to an image that has the dimension 1024x512. To save the aspect ratio of the image I first scale the image down by either the width or height to match the wanted dimensions. to do this I am using imagecopyresampled(): imagecopyresampled( $new_img, $src_img, $dst_x, $dst_y, 0, 0, $new_width, $new_height, $img_width, $img_height ) && $write_image($new_img, $new_file_path, $image_quality); If we take an image that is 1920x1200 as an example, the outputted image will be 819x512. However I still need a final result of 1024x512 so I want to add white borders to the image to will the width to 1024. How can I correct my imagecopyresampled function to acheive this?

    Read the article

  • How can I convert Perl regular expressions to boost regular expressions?

    - by YY
    I'm not familiar with Perl and boost regular expression and I want to convert a Perl code to c++. I want to convert special regular expression in Perl into c++ using Boost regexp library. Please help me understand what I must do? Here is some regexps that a word of a sentence may match: if ($word =~ /^[\.:\,()\'\`-]/) { # hack for punctuation } if ($word =~ /^[A-Z]/) { return; } if ($word =~ /[A-Za-z0-9]+\-[A-Za-z0-9]+/) { # all hyphenated words return; } if ($word =~ /.*[0-9].*/) { # all numbers return; }

    Read the article

  • C# Entity Framework Base Repository

    - by Andy
    I'm trying to create a base repository for use with Entity Framework 4.0 and having some trouble. In this code below, why is it not possible to do this in one line? public IEnumerable<T> GetAll<T>(Expression<Func<T, bool>> filter) { IEnumerable<T> allCustomers = this.GetAll<T>(); IEnumerable<T> result = allCustomers.Where(filter.Compile()); return result; } Won't this result in 2 SQL statements: one without a where clause that retrieves all rows, and one with a where clause that only retrieves the rows that match the predicate? How can this be done with a single SQL statement? I can't get it to compile if I try to cast the filter.Compile() to Func<Customer, bool>. Thanks, Andy

    Read the article

  • multiple FileSystemWatchers to monitor files on local system?

    - by Jason Crowes
    We're writing a text editor like tool for our internal accounting package system that has actions that can be done by our own Xml language specs. These macro commands are specified in Xml files and we need the ability to monitor if files openned have bean modified externally. The only problem is that there maybe 20-30 files with different paths openned at any one time. Would it be good to use multiple FileSystemWatchers for this scenario? Or would it be better to monitor the root drive and catch specific events that match an open file in the editor (though lots of events could be raised). Some are local drives (C,D,E) others are their network drives (U,X,G,H). Files are quite chunky too about 300-400Kb.

    Read the article

  • How to find an array from parent array

    - by Me-and-Coding
    Hi, I am using below code to find an array inside parent array but it is not working that is retuning empty even though the specified key exits in the parent array. $cards_parent = $feedData['BetradarLivescoreData']['Sport']['Category']['Tournament']['Match']; $cards = array(); foreach($cards_parent as $key => $card) { if ($key === 'Cards') { $cards[] = $cards_parent[$key]; break; } } Do you know any array function that will search parent array for specified key and if found it will create an array starting from that key. Thanks

    Read the article

  • How can I search for an email using the zend framework?

    - by Ali
    Hi guys I need to build a functionality that involves searching through emails in an inbox for emails whose subjects match a certain user inputted keyword. SInce I'm using the zend framework I would like a solution that uses the zend framework libraries. Aside this I have noticed that the zend libraries are a bit limited with respect to my requirements for email handling. Is there any open library available in php which can be used for handling emails - when I mean handling emails I mean like: Ease to mark and flag emails Moving of emails from folder to folder. Parsing emails searching through emails SOrting emails etc - the stuff you would require if you wished to build a web client. EDIT ========= I'm looking for a generic solution here. The emails are in a regular email inbox on an IMAP server. I need a way to be able to read through and search for emails in the inbox using any specialized library to make it easier.

    Read the article

  • Is there a way to determine the Variance of an Interface / Delegate in C# 4.0?

    - by BFree
    So now that we have generic Covariance and Contravariance on interfaces and delegates in C#, I was just curious if given a Type, you can figure out the covariance/contravariance of its generic arguments. I started trying to write my own implementation, which would look through all of the methods on a given type and see if the return types and or arguments match the types in the generic arguments. The problem is that even if I have this: public interface IFoo<T> { void DoSomething(T item); } using my logic, it LOOKS like it should be contravariant, but since we didn't actually specify: public interface IFoo<in T> { void DoSomething(T item); } (the in parameter) it isn't actually contravariant. Which leads to my question: Is there a way to determine the variance of generic parameters?

    Read the article

  • Scala downwards or decreasing for loop?

    - by Felix
    In scala, you often use an iterator to do a for loop in an increasing order like: for(i <- 1 to 10){ code } How would you do it so it goes from 10 to 1? I guess 10 to 1 gives an empty iterator (like usual range mathematics)? I made a scala script which solves it by calling reverse on the iterator, but it's not nice in my opinion, is this the way to go: def nBeers(n:Int) = n match { case 0 => ("No more bottles of beer on the wall, no more bottles of beer."+ "\nGo to the store and buy some more, "+ "99 bottles of beer on the wall.\n") case _ => (n+" bottles of beer on the wall, "+n +" bottles of beer.\n"+"Take one down and pass it around, "+ (if((n-1)==0) "no more" else (n-1))+ " bottles of beer on the wall.\n") } for(b <- (0 to 99).reverse)println(nBeers(b)) ?? Any comments/suggestions?

    Read the article

  • imagecopyresampled to resize and crop an image - not returning the expected result

    - by David
    imagecopyresized ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h ) This is what I want to do: I have an image that's 600x1000px in size, and I want to create a thumb that's 100x100px after resizing that image to 300x500px, the x coordinate for the top left point of the thumb square should be at 100(src x) and 120(src y). According to what I understand from the manual, the command should be $dst_image = imagecreatetruecolor(100,100); $src_image = imagecreatefromjpeg('/home/sandbox/imagetoresize.jpg'); imagecopyresized ($dst_image, $src_image, 0, 0, 100, 120, **300 , 500 , 600 , 1000** ) It is cropping the image just fine, but it isn't resizing it correctly. I never got it to match what I see in my image editor (the GIMP). What am I doing wrong? I confirmed that all the numbers are correct, but it's always shifted up or down no matter what I do. Your help would really be appreciated!

    Read the article

  • Is there any ready-made calendar control for iPhone apps?

    - by chester
    I am building an applicaiton for the iPhone that will display upcoming and past events. I settled for a list view, but then I realized that a calendar (just like the one displayed in the "month" view in the built-in Calendar application) would be a best match (that is, this one). However, the iPhone Human Interface Guidelines just mentions the Date Picker, not the calendar, so I believe there is nothing like that out of the box. Is that true? If so, does anyone know of a third-party control that could be used? (I could write one myself, but I'd rather pick up something ready, since this is a departure on the original project plans). Thank you all for your attention.

    Read the article

  • How to get null when use head funtion with a empty list in cypher?

    - by PeaceMaker
    I have a cypher query like this. START dep=node:cities(city_code = "JGS"), arr=node:cities(city_code = "XMN") MATCH dep-[way:BRANCH2BRANCH_AIRWAY*0..1]->()-->arr RETURN length(way), transfer.city_code, extract(w in way: w.min_consume_time) AS consumeTime The relationship named "way" is a optional one, so the property named "consumeTime" will be a empty list when the relationship "way" not exsit. The query result is: | 0 | "JGS" | [] | | 1 | "SZX" | [3600] | When I want to use the head function with the property "consumeTime", it return a error "Invalid query: head of empty list". How can I get a result like this? | 0 | "JGS" | null | | 1 | "SZX" | 3600 |

    Read the article

  • Losing DateTimeOffset precision when using C#

    - by Darvis Lombardo
    I have a SQL Server table with a CreatedDate field of type DateTimeOffset(2). A sample value which is in the table is 2010-03-01 15:18:58.57 -05:00 As an example, from within C# I retrieve this value like so: var cmd = new SqlCommand("SELECT CreatedDate FROM Entities WHERE EntityID = 2", cn); var da = new SqlDataAdapter(cmd); DataTable dt =new DataTable(); da.Fill(dt); And I look at the value: MessageBox.Show(dt.Rows[0][0].ToString()); The result is 2010-03-01 15:18:58 -05:00, which is missing the .57 that is stored in the database. If I look at dt.Rows[0][0] in the Watch window, I also do not see the .57, so it appears it has been truncated. Can someone shed some light on this? I need to use the date to match up with other records in the database and the .57 is needed. Thanks! Darvis

    Read the article

  • Would you take a paycut [closed]

    - by arinte
    I make 90K doing JEE5 (it is open I can use any tech I want which is nice) but don't like what I am doing to because it is too hw related. I have an offer for 88K and a bonus that would be 10% (almost assured) that I would guess would be paid in the 4th quarter. It is a j2ee, supposed to be moving to jee5 and there are no hw dependencies (banking type work). I think I would be interested, but I have always been told you do not take a pay cut and don't move laterally (go to another job at the same pay). I have been on other interviews but this is the only one that has panned out. Also with the current job there is 401k match, but with the new one there is 401k also and a pension. What would you do?

    Read the article

  • how to write sql script to achieve the following

    - by 3nigma
    hi, so i have a table lets say call it "tbl.items" and there is a column "title" in "tbl.items" i want to loop through each row and for each "title" in "tbl.items" i want to do following: the column has the datatype nvarchar(max) and contains a string... filter the string to remove words like in,out, where etc (stopwords) compare the rest of the string to a predefined list and if there is a match perform some action which involves inserting data in other tables as well.. the problem is im ignotent when it comes to writing T-sql scripts, plz help and guide me how can i achieve this? whether it can be achieved by writing a sql script?? or i have to develope a console application in c# or anyother language?? im using mssql server 2008 thanks in advance

    Read the article

  • How do you validate a URL with a regular expression in Python?

    - by Zachary Spencer
    I'm building a Google App Engine app, and I have a class to represent an RSS Feed. I have a method called setUrl which is part of the feed class. It accepts a url as an input. I'm trying to use the re python module to validate off of the RFC 3986 Reg-ex (http://www.ietf.org/rfc/rfc3986.txt) Below is a snipped which should work, right? I'm incredibly new to Python and have been beating my head against this for the past 3 days. p = re.compile('^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?') m = p.match(url) if m: self.url = url return url

    Read the article

  • URL rewrite module for IIS7

    - by Learner
    I am trying to test if the redirect that I wrote works or not. If I do IISReset the redirect does not work. But if I recycle the app then this works. Is this how it works? <rule name="RedirectToanothercity" patternSyntax="ECMAScript" stopProcessing="true"> <match url="^home/cities.aspx?$" /> <conditions> <add input="{QUERY_STRING}" pattern="city=jerseycity" /> </conditions> <action type="Redirect" url="jerseycity" appendQueryString="false" />

    Read the article

  • C++/CLI: CA2123: Requires SecurityCriticalAttribute?

    - by TomTom
    I am a little lost on erros like that: Warning 7 CA2123 : Microsoft.Security : Add the following security attribute to 'RithmicConnector::Connect(String^)' in order to match a LinkDemand on base method 'IConnector::Connect(String^)': 'SecurityCriticalAttribute'. c:\work\nettecture\tradex\source\tradex.connectivity.rithmic\rithmicconnector.cpp 52 Tradex.Connectivity.Rithmic Where do I add the SecurityCriticalAttribute? I tried on the header file - but the error does not disappear. I have one of those pretty much on every exposed method of a (managed C++) interface DLL. And I want CA to run through. How do I fix those? Regards

    Read the article

  • Define the base class or base functionality of a dynamic proxy (e.g. Castle, LinFu)

    - by Graham
    Hi, I've asked this in the NHibernate forumns but I think this is more of a general question. NHibernate uses proxy generators (e.g. Castle) to create its proxy. What I'd like to do is to extend the proxy generated so that it implements some of my own custom behaviour (i.e. a comparer). I need this because the following standard .NET behaviour fails to produce the correct results: //object AC is a concrete class collection.Contains(AC) = true //object AP is a proxy with the SAME id and therefore represents the same instance as concrete AC collection.Contains(AP) = false If my comparer was implemented by AP (i.e. do id's match) then collection.Contains(AP) would return true, as I'd expect if proxies were implicit. (NB: For those who say NH inherits from your base class, then yes it does, but NH can also inherit from an interface - which is what we're doing) I'm not at all sure this is possible or where to start. Is this something that can be done in any of the common proxy generators that NH uses?

    Read the article

  • MSSQL "for xml", multiple tables, multiple nodes

    - by Nelson
    Is it possible to select multiple tables at once? For example, I can do: SELECT ( SELECT * FROM Articles FOR XML PATH('article'), TYPE ) FOR XML PATH('articles'), ROOT('data') and SELECT ( SELECT * FROM ArticleTypes FOR XML PATH('articleType'), TYPE ) FOR XML PATH('articleTypes'), ROOT('data') Can I join both so that I get the following output? I can't use UNION because the table structures don't match. <data> <articles> <article>...</article> ... </articles> <articleTypes> <articleType>...</articleType> ... </articleTypes> </data>

    Read the article

  • MongoDB map/reduce counts

    - by ibz
    The output from MongoDB's map/reduce includes something like 'counts': {'input': I, 'emit': E, 'output': O}. I thought I clearly understand what those mean, until I hit a weird case which I can't explain. According to my understanding, counts.input is the number of rows that match the condition (as specified in query). If so, how is it possible that the following two queries have different results? db.mycollection.find({MY_CONDITION}).count() db.mycollection.mapReduce(SOME_MAP, SOME_REDUCE, {'query': {MY_CONDITION}}).counts.input I thought the two should always give the same result, independent of the map and reduce functions, as long as the same condition is used.

    Read the article

  • What are some useful SQL statements / usage patterns that should be known by all developers who may

    - by Jian Lin
    What are some useful SQL statements that should be known by all developers who may touch the Back end side of the project? (Update: just like in algorithm, we know there are sorting problems, shuffling problems, and we know some solutions to them. This question is aiming at the same thing). For example, ones I can think of are: Get a list of Employees and their boss. Or one with the employee's salary greater than the boss. (Self-join) Get a list of the most popular Classes registered by students, from the greatest number to the smallest. (Count, group by, order by) Get a list of Classes that are not registered by any students. (Outer join and check whether the match is NULL, or by Get from Classes table, all ClassIDs which are NOT IN (a subquery to get all ClassIDs from the Registrations table)) Are there some SQL statements that should be under the sleeve of all developers that might touch back end data?

    Read the article

  • Manipulating the case of the build macros in Visual Studio: $(TargetDir)

    - by miked
    I've come across a weird problem today in Visual Studio 2005. If I create a new configuration "NewConfiguration" for one of my projects. The output directory referred to by the project in $(TargetDir) is "/path/to/build/area/newconfiguration". Note the loss of capital letters, I'd expect it to be in "/path/to/build/area/NewConfiguration". In another project that I created yesterday, the capital letters are there. Normally this would be a problem, but it's part of a fairly complicated build system where some of it's on unix and we need to worry about case sensitive filename. Does anyone know where the source string for the Visual Studio macros like $(TargetDir) are stored so that I can get the case to be consistent and match what we need for our build system?

    Read the article

  • Why is it that I cannot insert this into Django correctly?

    - by alex
    new_thing = MyTable(last_updated=datetime.datetime.now()) new_thing.save() >>>>select * from MyTable\G; last_updated: 2010-04-01 05:26:21 However, in my Python console...this is what it says... >>> print datetime.datetime.now() 2010-04-01 10:26:21.643041 So obviously it's off by 5 hours. By the way, the database uses "SYSTEM" as its time, so they should match perfectly. mysql> SELECT current_time; +--------------+ | current_time | +--------------+ | 10:30:16 | +--------------+ >>> print datetime.datetime.now() 2010-04-01 10:30:17.793040

    Read the article

< Previous Page | 162 163 164 165 166 167 168 169 170 171 172 173  | Next Page >