Search Results

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

Page 169/269 | < Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >

  • jquery: show data after change event

    - by klox
    i have this code: <script> $("#mod").change(function() { var matches=str.match(/(EE|[EJU]).*(D)/i); $.ajax({ type="post", url="process.php", data="matches", cache=false, async=false, success= function(res){ $('#rslt').replaceWith("<div id='value'><h6>Tuner range is" + res + " .</h6></div>"); return this; } }); return false; }); </script> i want this code can show the result normally..where is my fault?

    Read the article

  • Merge two lists of objects which hold different data

    - by C.McAtackney
    I have an object "Project" which has a number of fields, one of which is "Name". I have one spreadsheet of projects which contains some of these fields, and another which contains the rest. However, Both spreadsheets have the "Name" field. I've read them in and populated two List, only populating the available fields from that particular source. E.g. a Project from List 1 looks like; {Name="MyProj", Type="Form", Priority=NULL}, whereas a Project from List 2 {Name="MyProj", Type=NULL, Priority="High"}. Now, I want to merge these two lists into one in which each Project object has all of its fields populated, with the Name field being used to match the elements. How can I achieve this? Are there any nice ways of doing this concisely? Thanks

    Read the article

  • Design pattern: polymorphisim for list of objects

    - by ziang
    Suppose I have a class A, and A1, A2 inherits from A. There are 2 functions: List<A1> getListA1(){...} List<A2> getListA2(){...} Now I want to do something similar to both A1 and A2 in another function public void process(List<A>){...} If I want to pass the instance of either ListA1 or ListA2, of course the types doesn't match because the compiler doesn't allow the coercion from List< A1 to List< A. I can't do something like this: List<A1> listA1 = getListA1(); List<A> newList = (List<A>)listA1; //this is not allowed. So what is the best approach to the process()? Is there any way to do it in a universal way rather than write the similar code to both List and List?

    Read the article

  • Why does this regular expression for sed break inside Makefile?

    - by jcrocholl
    I'm using GNU Make 3.81, and I have the following rule in my Makefile: jslint : java org.mozilla.javascript.tools.shell.Main jslint.js mango.js \ | sed 's/Lint at line \([0-9]\+\) character \([0-9]\+\)/mango.js:\1:\2/' This works fine if I enter it directly on the command line, but the regular expression does not match if I run it with "make jslint". However, it works if I replace \+ with \{1,\} in the Makefile: jslint : java org.mozilla.javascript.tools.shell.Main jslint.js mango.js \ | sed 's/Lint at line \([0-9]\{1,\}\) character \([0-9]\{1,\}\)/mango.js:\1:\2/' Is there some special meaning to \+ in Makefiles, or is this a bug?

    Read the article

  • mysql_query where statment help

    - by Anders Kitson
    I am retrieving values from the url with the GET method and then using a if statement to determine of they are there then query them against the database to only show those items that match them, i get an unknown error with your request. here is my code $province = $_GET['province']; $city = $_GET['city']; if(isset($province) && isset($city) ) { $results3 = mysql_query("SELECT * FROM generalinfo WHERE province = $province AND city = $city ") or die( "An unknown error occurred with your request"); } else { $results3 = mysql_query("SELECT * FROM generalinfo"); } /*if statement ends*/

    Read the article

  • Better data-structure design

    - by Tempname
    Currently in my application I have a single table that is giving me a bit of trouble. The issue at hand is I have a value object that is mapped to this table. When the data is returned to me as an array of value objects, I have to then loop through this array and begin my recursion by matching the ParentID to parent ObjectID's. The column ParentID is either null (acts a parent) or it holds the value of an ObjectID. I know there has to be a better way to create this data structure so that I do not have to do recursive loops to match ParentID's with their ObjectID's. Any help with this is greatly appreciated. Here is the table in describe form: +----------------+------------------+------+-----+---------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------------+------+-----+---------------------+-----------------------------+ | ObjectID | int(11) unsigned | NO | PRI | NULL | auto_increment | | ObjectHeight | decimal(6,2) | NO | | NULL | | | ObjectWidth | decimal(6,2) | NO | | NULL | | | ObjectX | decimal(6,2) | NO | | NULL | | | ObjectY | decimal(6,2) | NO | | NULL | | | ObjectLabel | varchar(255) | NO | | NULL | | | TemplateID | int(11) unsigned | NO | MUL | NULL | | | ObjectTypeID | int(11) unsigned | NO | MUL | NULL | | | ParentID | int(11) unsigned | YES | MUL | NULL | | | CreationDate | datetime | YES | | 0000-00-00 00:00:00 | | | LastModifyDate | timestamp | YES | | NULL | on update CURRENT_TIMESTAMP | +----------------+------------------+------+-----+---------------------+-----------------------------+e

    Read the article

  • How to pass a class method as an argument for another function in C++ and openGL?

    - by tsubasa
    I know this thing works: void myDisplay() { ... } int main() { ... glutDisplayFunc(myDisplay) ... } so I tried to include myDisplay() function to a class that I made. Because I want to overload it in the future with a different class. However, the compiler complains that argument of type 'void (ClassBlah::)()' does not match 'void(*)()' . Here is the what I try to make: class ClassBlah { .... void myDisplay() .... } ...... int main() { ... ClassBlah blah glutDisplayFunc(blah.myDisplay) ... } Does anybody knows how to fix this problem? Many thanks.

    Read the article

  • MPMediaickerController memory leak identified by Leaks instrument

    - by Joe
    This is code from Apple's Addmusic example. MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic]; picker.delegate = self; picker.allowsPickingMultipleItems = YES; picker.prompt = NSLocalizedString (@"Add songs to play", "Prompt in media item picker"); // The media item picker uses the default UI style, so it needs a default-style // status bar to match it visually [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault animated: YES]; [self presentModalViewController: picker animated: YES]; [picker release]; I'm using this code in my app and the Leaks instrument highlights a leak on the line: [self presentModalViewController: picker animated: YES]; I think that this is because this line retains a reference to picker which cannot be subsequently released. Is there any way around this or is Leaks incorrectly identifying a leak?

    Read the article

  • Does lookaround affect which languages can be matched by regular expressions?

    - by sepp2k
    There are some features in modern regex engines which allow you to match languages that couldn't be matched without that feature. For example the following regex using back references matches the language of all strings that consist of a word that repeats itself: (.+)\1. This language is not regular and can't be matched by a regex, which does not use back references. My question: Does lookaround also affect which languages can be matched by a regular expression? I.e. are there any languages that can be matched using lookaround, which couldn't be matched otherwise? If so, is this true for all flavors of lookaround (negative or positive lookahead or lookbehind) or just for some of them?

    Read the article

  • Icons: How does a developer with no design skill make his/her application icons look pretty?

    - by Martin
    I probably spend far too much time trying to make my visual interfaces look good, and while I'm pretty adept at finding the right match between usability and style one area I am hopeless at is making nice looking icons. How do you people overcome this (I'm sure common) problem? I'm thinking of things like images on buttons and perhaps most important of all, the actual application icon. Do you rely on third party designers, in or out of house? Or do you know of some hidden website that offers lots of icons for us to use? I've tried Google but I seem to find either expensive packages that are very specific, millions of Star Trek icons or icons that look abysmal at 16x16 which is my preferred size on in-application buttons. Any help/advice appreciated.

    Read the article

  • Filter objects within two seconds of one another using SQLAlchemy

    - by Arrieta
    Hello: I have two tables with a column 'date'. One holds (name, date) and the other holds (date, p1, p2). Given a name, I want to use the date in table 1 to query p1 and p2 from table two; the match should happen if date in table one is within two seconds of date in table two. How can you accomplish this using SQLAlchemy? I've tried (unsuccessfully) to use the between operator and with a clause like: td = datetime.timedelta(seconds=2) q = session.query(table1, table2).filter(table1.name=='my_name').\ filter(between(table1.date, table2.date - td, table2.date + td)) Any thoughts?

    Read the article

  • Disambiguating Named Entities in Java

    - by Alterscape
    I have a list of strings (company names, in this case), and a Java program that extracts a list of things that look like company names out of mostly-unstructured text. I need to match each element of extracted text to a string in the list. Caveat: the unstructured text has typos, things like "Blah, Inc." referred to as "Blah," etc. I've tried Levenshtein Edit Distance, but that fails for predictable reasons. Are there known best-practices ways of tackling this problem? Or am I back to manual data-entry?

    Read the article

  • Methods for making R plots look like Excel plots?

    - by brianjd
    I've been poking around with R graphical parameters trying to make my plots look a little more professional (e.g., las=1, bty="n" usually help). But not quite there. Started playing with tikzDevice. A huge improvement! Amazing how much better things look when the font sizes and styles in the figure match those of the surrounding document. Still, not quite there. What I'm ultimately looking for are those professional gradient shading, rounded corners, and shadow effects found in MS Excel plots. I know they're probably considered chart junk, but I like them. They're just nice looking. Q: How can I get these effects into my R plots? Do people usually just export to Inkscape and doodle over there? It would be nice if there were a literate programming approach. Is there an R package that handles these effects outright?

    Read the article

  • How can one describe a rock-paper-scissors relationship between 3 items?

    - by Madara Uchiha
    Let's say I have the following structure: abstract class Hand {} class Rock extends Hand {} class Paper extends Hand {} class Scissors extends Hand {} The goal is to make a function (or a method) Hand::compareHands(Hand $hand1, Hand $hand2), which would return the winning hand in a rock-paper-scissors match. That would be very easy with a bunch of ifs, but the point is to have a more robust structure, that's relying on polymorphism rather than on procedural code. P.S. this is done in actual production code, if someone is asking. This isn't some sort of challenge or homework. (It's not really rock-paper-scissors, but you get the point).

    Read the article

  • Accented character regex

    - by user314573
    I'm trying to create a regex that will look for french words whether a user specifies the accented characters or not. So if the the user has searched for "déclaré" but types in declare instead I would like to be able to match the text still. I'm having difficulty making this more dynamic so that it can be matched on any french word... Closest example from another user from a different post was: d[eèéê]cl[aàáâ]r[eèéê] Is it even possible to write a regex for something like this? Any advice would be much appreciated.

    Read the article

  • Rails + facebox + authlogic - how?

    - by Vitaly
    Hello, on my web site I want to have login/registration form in modal window done using facebox (jQuery plugin). What is better: Create view with one method and template that has form and refer facebox to this view. Create static HTML file in public directory and refer facebox to this static page. What I want to achieve is: Easy verification (like "user name already taken", "password confirmation doesn't match password" and stuff like that). Easy submit and redirect I'm new to Rails, I just know about forms verification in Django, so for Django I would probably choose option 1, but it might be another thing in Ruby.

    Read the article

  • How to change all selected chars to _ in Vim

    - by Kev
    I try to draw a class diagram using Vim. I fill the editor window with white-spaces. Type :match SpellBad /\s/ to highlight all the white-spaces. Ctrl+Q to select vertical white-spaces. Ctrl+I to insert Bar(|) and then Esc ........................... v+l +... + l to select horizontal white-spaces But I don't know how to change all selected horizontal white-spaces to underscore(_). I have to hit _ serval times. When comes to long horizontal line, it's bad. ___________ ___________ | | | | | BaseClass |/__________| Client | |___________|\ |___________| /_\ | |____________________________________ | | | _____|_____ _____|_____ _____|_____ | | | | | | | SubClass1 | | SubClass2 | | SubClass3 | |___________| |___________| |¦¦¦¦¦¦¦¦¦¦¦| I want a quick method to do this. Select it - Change it - Done! Maybe map F6 to do it. Thanks!

    Read the article

  • parsing/matching string occurrence in C

    - by David
    I have the following string: const char *str = "\"This is just some random text\" 130 28194 \"Some other string\" \"String 3\"" I would like to get the the integer 28194 of course the integer varies, so I can't do strstr("20194"). So I was wondering what would be a good way to get that part of the string? I was thinking to use #include <regex.h> which I already have a procedure to match regexp's but not sure how the regexp in C will look like using the POSIX style notation. [:alpha:]+[:digit:] and if performance will be an issue. Or will it be better using strchr,strstr? Any ideas will be appreciate it

    Read the article

  • How to make RegexKitLite w/ iPhone SDK produce a list of all matches +/- and also return surrounding

    - by Matt
    I'd like to create a regular expression that will match and return based on the following criteria: 1) I have N search terms entered by a user 2) I have a body of text. 3) I want to return a list of all the occurrences of all the search terms entered by the user plus surrounding context. I think (\w+\W+){,4}(", ")(\W+\w+){,4} might work. 4) I don't know how to use RegexKitLite at all. Do I invoke a RegexKitLite class? or does it interface into NSString somehow?

    Read the article

  • How could I do something like this in a XML schema?

    - by chobo2
    Hi I want to mass create some users and I want to set the users timezone automatically. However I am using timezones generated by this Dictionary<string, TimeZoneInfo> storeZoneName = TimeZoneInfo.GetSystemTimeZones().ToDictionary(z => z.DisplayName); So I need the names to be exactly like the ones this list returns. So can I put like a constraint on that xml node that the name has to exactly match one of the names. So I am guessing I will need to write this list somewhere in the file and that's what I am not sure if you can do something like that in a schema.

    Read the article

  • Errors in Decimal Calcs within def clean method?

    - by allanhenderson
    I'm attempting a few simple calculations in a def clean method following validation (basically spitting out a euro conversion of retrieved uk product price on the fly). I keep getting a TypeError. Full error reads: Cannot convert {'product': , 'invoice': , 'order_discount': Decimal("0.00"), 'order_price': {...}, 'order_adjust': None, 'order_value': None, 'DELETE': False, 'id': 92, 'quantity': 8} to Decimal so I guess django is passing through the entire cleaned_data form to Decimal method. Not sure where I'm going wrong - the code I'm working with is: def clean_order_price(self): cleaned_data = self.cleaned_data data = self.data order_price = cleaned_data.get("order_price") if not order_price: try: existing_price = ProductCostPrice.objects.get(supplier=data['supplier'], product_id=cleaned_data['product'], is_latest=True) except ProductCostPrice.DoesNotExist: existing_price = None if not existing_price: raise forms.ValidationError('No match found, please enter new price') else: if data['invoice_type'] == 1: return existing_price.cost_price_gross elif data['invoice_type'] == 2: exchange = EuroExchangeRate.objects.latest('exchange_date') calc = exchange.exchange_rate * float(existing_price.cost_price_gross) calc = Decimal(str(calc)) return calc return cleaned_data If the invoice is of type 2 (a euro invoice) then the system should grab the latest exchange rate and apply that to the matching UK pound price pulled through to get euro result. Should performing a decimal conversion be a problem within def clean method? Thanks

    Read the article

  • jQuery: use filter(), but work with both results

    - by Tomalak
    In jQuery, filter() reduces your result to those elements that fulfill a certain condition. This splits the list in two parts. Working with the "good half" of the elements is easy: $("some selector").filter(function() { // determine result... return result; }).each( /* do something */ ); But how can I work with the "other half" of my elements, too - but without doing the equivalent of this: $("some selector").filter(function() { // determine result... return !result; }).each( /* do something */ ); Basically, I'd like to feed two separate /* do something */ parts to a single filter. One for those that match, and one for the others - without having to select and filter twice.

    Read the article

  • SearchView - Choose between two target Activities according to the query result

    - by vitorgreati
    My application has to do the following: - if the user enters a query that matches exactly an object in my database, a Activity that shows this object should appear; - if the query doesn't match an exact object, a ArrayList with related objects will be returned and an Activity will display this list. So, as I'm using a SearchView on my ActionBar, I want to know how to open the right Activity based on the result of the query, something like this: if(objectFound) openActivityThatShowsThisObject(); else openActivityWithRelatedResults(); I saw in other question that I could use a facade Activity, but I don't know if that is a good approach. Any help will be appreciated, thanks!

    Read the article

  • Finding shared list IDs in a MySQL table using bitwise operands

    - by landons
    I want to find items in common from the "following_list" column in a table of users: +----+--------------------+-------------------------------------+ | id | name | following_list | +----+--------------------+-------------------------------------+ | 9 | User 1 | 26,6,12,10,21,24,19,16 | | 10 | User 2 | 21,24 | | 12 | User 3 | 9,20,21,26,30 | | 16 | User 4 | 6,52,9,10 | | 19 | User 5 | 9,10,6,24 | | 21 | User 6 | 9,10,6,12 | | 24 | User 7 | 9,10,6 | | 46 | User 8 | 45 | | 52 | User 9 | 10,12,16,21,19,20,18,17,23,25,24,22 | +----+--------------------+-------------------------------------+ I was hoping to be able to sort by the number of matches for a given user id. For example, I want to match all users except #9 against #9 to see which of the IDs in the "following_list" column they have in common. I found a way of doing this through the "SET" datatype and some bit trickery: http://dev.mysql.com/tech-resources/articles/mysql-set-datatype.html#bits However, I need to do this on an arbitrary list of IDs. I was hoping this could be done entirely through the database, but this is a little out of my league. Any bit gurus out there? Thanks, Landon

    Read the article

  • Open source LINQ search engine for website

    - by Noel
    I want to add a search engine to my website. I want it to handler boolean searches and give me a list of results in order or best match. I need it to be able to work with LINQ, because I want to add additional where clauses to the final query that gets run. I am looking for the best open source .NET search engine that works with LINQ. I like lucene.net but the problem is the LINQ interface (LINQ to Lucene) hasn't been updated since 2008. Are there any good options out there?

    Read the article

< Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >