Search Results

Search found 2579 results on 104 pages for 'mike t'.

Page 58/104 | < Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >

  • how to match a regulas expresion like (%i1) in python pexpect

    - by mike
    I want to use maxima from python using pexpect, whenever maxima starts it will print a bunch of stuff of this form: $ maxima Maxima 5.27.0 http://maxima.sourceforge.net using Lisp SBCL 1.0.57-1.fc17 Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) i would like to start up pexpect like so: import pexpect cmd = 'maxima' child = pexpect.spawn(cmd) child.expect (' match all that stuff up to and including (%i1)') child.sendline ('integrate(sin(x),x)') chil.expect( match (%o1 ) ) print child.before how do i match the starting banner up to the prompt (%i1)? and so on, also maxima increments the (%i1)'s by one as the session goes along, so the next expect would be: child.expect ('match (%i2)') child.sendline ('integrate(sin(x),x)') chil.expect( match (%o2 ) ) print child.before how do i match the (incrementing) integers?

    Read the article

  • sql median value of column

    - by Mike
    Is there a way in sql (or tsql) to select the median of a column of numbers? I know you can sort by the column and pick the middle value, but it would be nice if there was a built-in function

    Read the article

  • Commission Detail Service (REST)

    - by Mike
    Hi, Can someone who uses CJ's Commission Detail Service (REST) tell me what a sample XML response is for this query. None of CJ's Web Services documentation indicates exactly how the XML is formatted and as I don't have any commission payments yet I can only guess the result.

    Read the article

  • Can someone explain this "endian-ness" function for me?

    - by Mike
    Write a program to determine whether a computer is big-endian or little-endian. bool endianness() { int i = 1; char *ptr; ptr = (char*) &i; return (*ptr); } So I have the above function. I don't really get it. ptr = (char*) &i, which I think means a pointer to a character at address of where i is sitting, so if an int is 4 bytes, say ABCD, are we talking about A or D when you call char* on that? and why? Would some one please explain this in more detail? Thanks. So specifically, ptr = (char*) &i; when you cast it to char*, what part of &i do I get?

    Read the article

  • Delphi 6 OleServer.pas Invoke memory leak

    - by Mike Davis
    There's a bug in delphi 6 which you can find some reference online for when you import a tlb the order of the parameters in an event invocation is reversed. It is reversed once in the imported header and once in TServerEventDIspatch.Invoke. you can find more information about it here: http://cc.embarcadero.com/Item/16496 somewhat related to this issue there appears to be a memory leak in TServerEventDispatch.Invoke with a parameter of a Variant of type Var_Array (maybe others, but this is the more obvious one i could see). The invoke code copies the args into a VarArray to be passed to the event handler and then copies the VarArray back to the args after the call, relevant code pasted below: // Set our array to appropriate length SetLength(VarArray, ParamCount); // Copy over data for I := Low(VarArray) to High(VarArray) do VarArray[I] := OleVariant(TDispParams(Params).rgvarg^[I]); // Invoke Server proxy class if FServer <> nil then FServer.InvokeEvent(DispID, VarArray); // Copy data back for I := Low(VarArray) to High(VarArray) do OleVariant(TDispParams(Params).rgvarg^[I]) := VarArray[I]; // Clean array SetLength(VarArray, 0); There are some obvious work-arounds in my case: if i skip the copying back in case of a VarArray parameter it fixes the leak. to not change the functionality i thought i should copy the data in the array instead of the variant back to the params but that can get complicated since it can hold other variants and seems to me that would need to be done recursively. Since a change in OleServer will have a ripple effect i want to make sure my change here is strictly correct. can anyone shed some light on exactly why memory is being leaked here? I can't seem to look up the callstack any lower than TServerEventDIspatch.Invoke (why is that?) I imagine that in the process of copying the Variant holding the VarArray back to the param list it added a reference to the array thus not allowing it to be release as normal but that's just a rough guess and i can't track down the code to back it up. Maybe someone with a better understanding of all this could shed some light?

    Read the article

  • What do I use when a cron job isn't enough? (php)

    - by mike
    I'm trying to figure out the most efficient way to running a pretty hefty PHP task thousands of times a day. It needs to make an IMAP connection to Gmail, loop over the emails, save this info to the database and save images locally. Running this task every so often using a cron isn't that big of a deal, but I need to run it every minute and I know eventually the crons will start running on top of each other and cause memory issues. What is the next step up when you need to efficiently run a task multiple times a minute? I've been reading about beanstalk & pheanstalk and I'm not entirely sure if that will do what I need. Thoughts???

    Read the article

  • A view "transparent" to touches in some areas

    - by Mike
    I have this transparent view that covers the whole screen. I using this view to group objects because I need to run them together around a specific anchor point. Lets call this view transparentView. At some point, transparentView contains two subviews. Two vertical bars full of icons, one on the left and one on the right of the screen. I need these bars and their icons to respond to touches, so I have to set transparentView setUserInteraction to YES. The area between the two vertical bars are totally transparent. transparentView is on top of other views and I need these other views to respond to taps but, the transparent area of transparentView are intercepting the taps and not letting them go thru to the view below. This transparent view is a UIImageView based class. I have tried to forward taps on that class, using - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.nextResponder touchesBegan: touches withEvent:event]; } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [self.nextResponder touchesMoved: touches withEvent:event]; } - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { [self.nextResponder touchesEnded: touches withEvent:event]; } - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [self touchesEnded:touches withEvent:event]; } but this is not working. How can I do that? thanks.

    Read the article

  • How to test a lamda expression var query result is null?

    - by mike
    var query = from emp in dbEmp.Employees join dept in dbEmp.Departments on emp.DeptID equals dept.DeptID where dept.DepartmentName.Contains(this.TextBox1.Text) select new { EmpID = emp.EmpID, EmpName = emp.EmpName, Age = emp.Age, Address = emp.Address, DeptName = dept.DepartmentName }; if (query==null) Label1.Text = "no results match your search"; GridView1.DataSource = query; GridView1.DataBind(); Everything works in the right way, but the label doesn't show the message when query result returns null. The label can show without condition(querry==null). So how to test if a var query result returns nothing? Thanks

    Read the article

  • How does Batcher Merge work at a high level?

    - by Mike
    I'm trying to grasp the concept of a Batcher Sort. However, most resources I've found online focus on proof entirely or on low-level pseudocode. Before I look at proofs, I'd like to understand how Batcher Sort works. Can someone give a high level overview of how Batcher Sort works(particularly the merge) without overly verbose pseudocode(I want to get the idea behind the Batcher Sort, not implement it)? Thanks!

    Read the article

  • Getting clusters of rows close together in time

    - by Mike
    I have a table basically like so ID | ItemID | Start | End | --------------------------------------------------------------- 1 234 10/20/09 8:34:22 10/20/09 8:35:10 2 274 10/20/09 8:35:30 10/20/09 8:36:27 3 272 10/21/09 12:15:00 10/21/09 12:17:00 4 112 10/21/09 12:20:14 10/21/09 12:21:21 5 15 10/21/09 12:22:39 10/21/09 12:24:15 There are two "clusters" of entries here, 1-2 and 3-5 separated by a gap in time, specifically 30 minutes is what I'm interested in. What I would like is the first and last rows of the cluster of entries. This is fairly easy to achieve by retrieving all the rows and looping through them in order of start time, but I'd like to have it in SQL if possible. I'm using SQL Server 2008, thanks.

    Read the article

  • SQL Like question

    - by mike
    Is there a way to reverse the SQL Like operator so it searches a field backwards? For example, I have a value in a field that looks like this "Xbox 360 Video Game". If I write a query like below, it returns the result fine. SELECT id FROM table WHERE title like "%Xbox%Game%" However, when I search like this, it doesn't find any results. SELECT id FROM table WHERE title like "%Video%Xbox%" I need it to match in any direction. How can I get around this?

    Read the article

  • rpy2: Converting a data.frame to a numpy array

    - by Mike Dewar
    I have a data.frame in R. It contains a lot of data : gene expression levels from many (125) arrays. I'd like the data in Python, due mostly to my incompetence in R and the fact that this was supposed to be a 30 minute job. I would like the following code to work. To understand this code, know that the variable path contains the full path to my data set which, when loaded, gives me a variable called immgen. Know that immgen is an object (a Bioconductor ExpressionSet object) and that exprs(immgen) returns a data frame with 125 columns (experiments) and tens of thousands of rows (named genes). robjects.r("load('%s')"%path) # loads immgen e = robjects.r['data.frame']("exprs(immgen)") expression_data = np.array(e) This code runs, but expression_data is simply array([[1]]). I'm pretty sure that e doesn't represent the data frame generated by exprs() due to things like: In [40]: e._get_ncol() Out[40]: 1 In [41]: e._get_nrow() Out[41]: 1 But then again who knows? Even if e did represent my data.frame, that it doesn't convert straight to an array would be fair enough - a data frame has more in it than an array (rownames and colnames) and so maybe life shouldn't be this easy. However I still can't work out how to perform the conversion. The documentation is a bit too terse for me, though my limited understanding of the headings in the docs implies that this should be possible. Anyone any thoughts?

    Read the article

  • Masspay and MySql

    - by Mike
    Hi, I am testing Paypal's masspay using their 'MassPay NVP example' and I having difficulty trying to amend the code so inputs data from my MySql database. Basically I have user table in MySql which contains email address, status of payment (paid,unpaid) and balance. CREATE TABLE `users` ( `user_id` int(10) unsigned NOT NULL auto_increment, `email` varchar(100) collate latin1_general_ci NOT NULL, `status` enum('unpaid','paid') collate latin1_general_ci NOT NULL default 'unpaid', `balance` int(10) NOT NULL default '0', PRIMARY KEY (`user_id`) ) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci Data : 1 [email protected] paid 100 2 [email protected] unpaid 11 3 [email protected] unpaid 20 4 [email protected] unpaid 1 5 [email protected] unpaid 20 6 [email protected] unpaid 15 I then have created a query which selects users with an unpaid balance of $10 and above : $conn = db_connect(); $query=$conn->query("SELECT * from users WHERE balance >='10' AND status = ('unpaid')"); What I would like to is for each record returned from the query for it to populate the code below: Now the code which I believe I need to amend is as follows: for($i = 0; $i < 3; $i++) { $receiverData = array( 'receiverEmail' => "[email protected]", 'amount' => "example_amount",); $receiversArray[$i] = $receiverData; } However I just can't get it to work, I have tried using mysqli_fetch_array and then replaced "[email protected]" with $row['email'] and "example_amount" with row['balance'] in various methods of coding but it doesn't work. Also I need it to loop to however many rows that were retrieved from the query as <3 in the for loop above. So the end result I am looking for is for the $nvpStr string to pass with something like this: $nvpStr = "&EMAILSUBJECT=test&RECEIVERTYPE=EmailAddress&CURRENCYCODE=USD&[email protected]&L_Amt=11&[email protected]&L_Amt=11&[email protected]&L_Amt=20&[email protected]&L_Amt=20&[email protected]&L_Amt=15"; Thanks

    Read the article

  • i18n redirection breaks my tests ....

    - by Mike
    I have a big application covered by more than a thousand tests via rspec. We just made the choice to redirect any page like : / /foo /foo/4/bar/34 ... TO : /en /en/foo /fr/foo/4/bar/34 .... So I made a before filter in application.rb like so : if params[:locale].blank? headers["Status"] = "301 Moved Permanently" redirect_to request.env['REQUEST_URI'].sub!(%r(^(http.?://[^/]*)?(.*))) { "#{$1}/#{I18n.locale}#{$2}" } end It's working great but ... It's breaking a lot of my tests, ex : it "should return 404" do Video.should_receive(:failed_encodings).and_return([]) get :last_failed_encoding response.status.should == "404 Not Found" end To fix this test, I should do : get :last_failed_encoding, :locale => "en" But ... seriously I don't want to fix all my test one by one ... I tried to make the locale a default parameter like this : class ActionController::TestCase alias_method(:old_get, :get) unless method_defined?(:old_get) def get(path, parameters = {}, headers = nil) parameters.merge({:locale => "fr"}) if parameters[:locale].blank? old_get(path, parameters, headers) end end ... but couldnt make this work ... Any idea ??

    Read the article

  • Get JS file via HTTPS from a HTTP page

    - by Mike
    Okay, so what are the ramifications of getting a JS file via an HTTPS call while on a HTTP page. I assume it would just be a little bit of extra overhead. Would there be any warnings about this call from any certain browser? Don't ask why. It's just hypothetical.

    Read the article

  • Needs some help with an apache mod-rewrite issue

    - by mike
    I've modified my .htaccess file to have the following statement RewriteCond $1 !^index.php$ RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS] This allows me to use product URL's like this: http://domain.com/product_name However, when trying to access a file at the same level as index.php, it always calls the RewriteRule above and errors out. I need to be able to access files like below, but each URL currently attempts to load index.php. http://domain.com/about.htm http://domain.com/terms.htm http://domain.com/robots.txt etc Any suggestions on how I can modify my htaccess file to get this to work correctly?

    Read the article

  • foreach loop from multiple arrays c#

    - by Mike
    This should be a simple question. All I want to know is if there is a better way of coding this. I want to do a foreach loop for every array, without having to redeclare the foreach loop. Is there a way c# projects this? I was thinking of putting this in a Collection...? Please, critique my code. foreach (TextBox tb in vert) { if (tb.Text == box.Text) conflicts.Add(tb); } foreach (TextBox tb in hort) { if (tb.Text == box.Text) conflicts.Add(tb); } foreach (TextBox tb in cube) { if (tb.Text == box.Text) conflicts.Add(tb); }

    Read the article

  • UILocalNotification crash

    - by Miky Mike
    Hi everyone, could you please help me ? I'm setting up an UILocalNotification and It crashes when I try to set its userInfo dictionary. My dictionary is not empty (It contains 88 objects). Here is the code : NSDictionary* myUserInfo = [NSDictionary dictionaryWithObject: fetchedObjects forKey: @"textbody"]; UILocalNotification *localNotif = [[UILocalNotification alloc] init]; if (localNotif == nil) return; // défining the interval NSTimeInterval oneMinute = 60; localNotif.timeZone = [NSTimeZone localTimeZone]; NSDate *fireDate = [[NSDate alloc]initWithTimeIntervalSinceNow:oneMinute]; localNotif.fireDate = fireDate; localNotif.userInfo = myUserInfo; [fetchedObjects release]; and the console gives me this : Property list invalid for format: 200 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unable to serialize userInfo: (null)' Any idea ?

    Read the article

  • Generating a error code per property in Hibernate validator

    - by Mike Q
    Hi all, I am looking at using hibernate validator for a requirement of mine. I want to validate a bean where properties may have multiple validation checks. e.g. class MyValidationBean { @NotNull @Length( min = 5, max = 10 ) private String myProperty; } But if this property fails validation I want a specific error code to be associated with the ConstraintViolation, regardless of whether it failed because of @Required or @Length, although I would like to preserve the error message. class MyValidationBean { @NotNull @Length( min = 5, max = 10 ) @ErrorCode( "1234" ) private String myProperty; } Something like the above would be good but it doesn't have to be structured exactly like that. I can't see a way to do this with hibernate validator. Is it possible? Thanks.

    Read the article

  • why the hell does x,y = zip(*zip(a,b)) work in Python?

    - by Mike Dewar
    OK I love Python's zip() function. Use it all the time, it's brilliant. Every now and again I want to do the opposite of zip(), think "I used to know how to do that", then google python unzip, then remember that one uses this magical * to unzip a zipped list of tuples. Like this: x = [1,2,3] y = [4,5,6] zipped = zip(x,y) unzipped_x, unzipped_y = zip(*zipped) unzipped_x Out[30]: (1, 2, 3) unzipped_y Out[31]: (4, 5, 6) What on earth is going on? What is that magical asterisk doing? Where else can it be applied and what other amazing awesome things in Python are so mysterious and hard to google?

    Read the article

  • solving origin of a vectors

    - by Mike
    I have two endpoints (xa,ya) and (xb,yb) of two vectors, respectively a and b, originating from a same point (xo, yo). Also, I know that |a|=|b|+s, where s is a constant. I tried to compute the origin (xo, yo) but seem to fail at some point. How to solve this?

    Read the article

  • Android ScrollView jumps around when resized

    - by Mike
    I have a ScrollView that contains an number of other views (TextViews, ImageViews, etc.). The ScrollView is taller than the screen. I have an AsyncTask that updates the children of the ScrollView based on an http response. I've discovered an interesting behavior that I can't figure out how to work around. If I set any of the children's visibilities to View.INVISIBLE as part of the AsyncTask.onPostExecute(), everything works fine. However, if I set any of the children's visibilities to View.GONE, the ScrollView jumps down from the top when onPostExecute() is called. Exactly how far seems to vary. I'm guessing that re-laying out the ScrollView is causing it to scroll away from the top for some reason. So the question is: is there a way to either prevent or work around this behavior? PS. Using ScrollView.jump(FOCUS_UP) as a workaround isn't ideal since that'll force the user to the top even if they had intended to scroll down. EDIT: Actually, I was wrong. The problem wasn't with a child view being marked gone, the problem was with a sibling view being marked gone and the ScrollView getting resized. My ScrollView is inside a LinearLayout that also contains a Button. When the button is set to GONE, the ScrollView gets resized to take up the available space, causing it to scroll away from the top. Different cause, still looking for a workaround though if possible.

    Read the article

  • Find all records in database that are within a certain distance of a set of lat and long points

    - by Mike L
    I've seen all the examples and here's what I got so far. my table is simple: schools (table name) - School_ID - lat - long - county - extrainfo here's my code: <?php $con = mysql_connect("xxx","xxx","xxx"); if (!$con) { die('Could not connect: ' . mysql_error()); } else {} mysql_select_db("xxx", $con); $latitude = "36.265541"; $longitude = "-119.207153"; $distance = "1"; //miles $qry = "SELECT *, (3958.75 * ACOS(SIN(" . $latitude . " / 57.2958)*SIN(lat / 57.2958)+COS(" . $latitude . " / 57.2958)*COS(lat / 57.2958)*COS(long / 57.2958 - " . $longitude . " / 57.2958))) as distance FROM schools WHERE (3958.75 * ACOS(SIN(" . $latitude . " / 57.2958)*SIN(lat / 57.2958)+COS(" . $latitude . " / 57.2958)*COS(lat / 57.2958)*COS(long / 57.2958 - " . $longitude . " / 57.2958))) <= " . $distance; $results = mysql_query($qry); if (mysql_num_rows($results) > 0) { while($row = mysql_fetch_assoc($results)) { print_r($row); } } else {} mysql_close($con); ?> but I get this error when I try to run it: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

    Read the article

< Previous Page | 54 55 56 57 58 59 60 61 62 63 64 65  | Next Page >