Search Results

Search found 1330 results on 54 pages for 'rob mcdonell'.

Page 37/54 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • preg_match_all to parse an xml-like attribute string

    - by Rob
    I have a string like so: option_alpha="value" option_beta="some other value" option_gamma="X" ...etc. I'm using this to parse them into name & value pairs: preg_match_all("/([a-z0-9_]+)\s*=\s*[\"\'](.+?)[\"\']/is", $var_string, $matches) Which works fine, unless it encounters an empty attribute value: option_alpha="value" option_beta="" option_gamma="X" What have I done wrong in my regex?

    Read the article

  • Is there a function that can read a php function post-parsing?

    - by Rob
    I've got a php file echoing hashes from a MySQL database. This is necessary for a remote program I'm using, but at the same time I need my other php script opening and checking it for specified strings POST parsing. If it checks for the string pre-parsing, it'll just get the MySQL query rather than the strings to look for. I'm not sure if any functions do this. Does fopen() read the file prior to parsing? or file_get_contents()? If so, is there a function that'll read the file after the php and mysql code runs? The file with the hashes query and echo is in the same directory as the php file reading it, if that makes a difference. Perhaps fopen reads it post-parse, and I've done something wrong, but at first I was storing the hashes directly in the file, and it was working fine. After I changed it to echo the contents of the MySQL table, it bugged out.

    Read the article

  • Why is PLINQ slower than LINQ for this code?

    - by Rob Packwood
    First off, I am running this on a dual core 2.66Ghz processor machine. I am not sure if I have the .AsParallel() call in the correct spot. I tried it directly on the range variable too and that was still slower. I don't understand why... Here are my results: Process non-parallel 1000 took 146 milliseconds Process parallel 1000 took 156 milliseconds Process non-parallel 5000 took 5187 milliseconds Process parallel 5000 took 5300 milliseconds using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; namespace DemoConsoleApp { internal class Program { private static void Main() { ReportOnTimedProcess( () => GetIntegerCombinations(), "non-parallel 1000"); ReportOnTimedProcess( () => GetIntegerCombinations(runAsParallel: true), "parallel 1000"); ReportOnTimedProcess( () => GetIntegerCombinations(5000), "non-parallel 5000"); ReportOnTimedProcess( () => GetIntegerCombinations(5000, true), "parallel 5000"); Console.Read(); } private static List<Tuple<int, int>> GetIntegerCombinations( int iterationCount = 1000, bool runAsParallel = false) { IEnumerable<int> range = Enumerable.Range(1, iterationCount); IEnumerable<Tuple<int, int>> integerCombinations = from x in range from y in range select new Tuple<int, int>(x, y); return runAsParallel ? integerCombinations.AsParallel().ToList() : integerCombinations.ToList(); } private static void ReportOnTimedProcess( Action process, string processName) { var stopwatch = new Stopwatch(); stopwatch.Start(); process(); stopwatch.Stop(); Console.WriteLine("Process {0} took {1} milliseconds", processName, stopwatch.ElapsedMilliseconds); } } }

    Read the article

  • "Invalid Procedure Call or Argument", but only in a compiled or P-Code EXE

    - by Rob Perkins
    I have a VB6 program which I've been maintaining for ten years. There is a subroutine in the program called "Prepare Copy", which looks like this: Public Sub PrepareCopy() Set CopiedShapes = New Collection End Sub Where CopiedShapes is dimmed out as a VB6 Collection. That code is now kicking out a Runtime Error 5 -- Invalid Procedure Call or Argument. It appears from the interstitial debugging code that the error arises between the Public Sub PrepareCopy() and the Set CopiedShapes = New Collection lines. That's right. The VB6 error is happening between two lines of my code. I can think of no other explanation for this. It's behaving this way on my development machine and two client computers. It is only happening in runtime code, and does not appear to make a difference whether I compile it or use P-Code What I'm asking for here is speculation as to what causes this sort of thing to happen.

    Read the article

  • SQL server 2008 trigger not working correct with multiple inserts

    - by Rob
    I've got the following trigger; CREATE TRIGGER trFLightAndDestination ON checkin_flight AFTER INSERT,UPDATE AS BEGIN IF NOT EXISTS ( SELECT 1 FROM Flight v INNER JOIN Inserted AS i ON i.flightnumber = v.flightnumber INNER JOIN checkin_destination AS ib ON ib.airport = v.airport INNER JOIN checkin_company AS im ON im.company = v.company WHERE i.desk = ib.desk AND i.desk = im.desk ) BEGIN RAISERROR('This combination of of flight and check-in desk is not possible',16,1) ROLLBACK TRAN END END What i want the trigger to do is to check the tables Flight, checkin_destination and checkin_company when a new record for checkin_flight is added. Every record of checkin_flight contains a flightnumber and desknumber where passengers need to check in for this destination. The tables checkin_destination and checkin_company contain information about companies and destinations restricted to certain checkin desks. When adding a record to checkin_flight i need information from the flight table to get the destination and flightcompany with the inserted flightnumber. This information needs to be checked against the available checkin combinations for flights, destinations and companies. I'm using the trigger as stated above, but when i try to insert a wrong combination the trigger allows it. What am i missing here?

    Read the article

  • What's the best way to call an IBAction from within code?

    - by Rob
    Say for instance I have an IBAction that is hooked up to a button in interface builder. - (IBAction)functionToBeCalled:(id)sender { // do something here } Within my code, say for instance in another method, what is the best way to call that IBAction? If I try to call it like this, I receive an error: [self functionToBeCalled:]; But, if I try to call it like this (cheating a bit, I think), it works fine: [self functionToBeCalled:0]; What is the proper way to call it though?

    Read the article

  • How to get Tkinter to input text and submit with button

    - by Rob
    Hi I was wondering if anybody could help me submit code from the test fields to the login fields from Tkinter import * import tkMessageBox if ( __name__ == "__main__" ): import resources.lib.mechanize as mechanize mechanize # Start Browser br = mechanize.Browser(factory=mechanize.RobustFactory()) # User-Agent (Firefox) br.addheaders = [('User-agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.6')] br.open('http://razetheworld.com/wp-login.php?redirect_to=http%3A%2F%2Frazetheworld.com') br.select_form(name="loginform") br['log'] = 'entryWidget_U must enter here' br['pwd'] = 'entryWidget_P must enter here' br.submit(name="wp-submit") print br.geturl() def displayText(): """ Display the Entry text value. """ global entryWidget_U global entryWidget_P if entryWidget_U.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Username") else: tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_U.get().strip()) if entryWidget_P.get().strip() == "": tkMessageBox.showerror("Tkinter Entry Widget", "Enter a Password") else: tkMessageBox.showinfo("Tkinter Entry Widget", "Text value =" + entryWidget_P.get().strip()) if __name__ == "__main__": root = Tk() root.title("Tkinter Entry Widget") root["padx"] = 40 root["pady"] = 20 # Create a text frame to hold the text Label and the Entry widget textFrame_U = Frame(root) textFrame_P = Frame(root) #Create a Label in textFrame entryLabel = Label(textFrame_U) entryLabel["text"] = "Enter Username:" entryLabel.pack(side=LEFT) entryLabel = Label(textFrame_P) entryLabel["text"] = "Enter Password:" entryLabel.pack(side=LEFT) # Create an Entry Widget in textFrame entryWidget_U = Entry(textFrame_U) entryWidget_U["width"] = 50 entryWidget_U.pack(side=LEFT) entryWidget_P = Entry(textFrame_P) entryWidget_P["width"] = 50 entryWidget_P.pack(side=LEFT) textFrame_U.pack() textFrame_P.pack() button = Button(root, text="Login", command=#Run br.submit(name="wp-submit")) button.pack() root.mainloop()

    Read the article

  • How to read and write UTF-8 to disk on the Android?

    - by Rob Kent
    I cannot read and write extended characters (French accented characters, for example) to a text file using the standard InputStreamReader methods shown in the Android API examples. When I read back the file using: InputStreamReader tmp = new InputStreamReader(in); BufferedReader reader = new BufferedReader(tmp); String str; while ((str = reader.readLine()) != null) { ... the string read is truncated at the extended characters instead of at the end-of-line. The second half of the string then comes on the next line. I'm assuming that I need to persist my data as UTF-8 but I cannot find any examples of that, and I'm new to Java. Can anyone provide me with an example or a link to relevant documentation?

    Read the article

  • Opening txt files in Internet Explorer 8 parses some html

    - by Rob
    I'm not sure if it's just me, but whenever I open .txt files in internet explorer, it always parses the HTML, so forms, buttons, fields all show up. It does this on multiple computers, and I'm fairly sure it hasn't always done this. I know FireFox doesn't, FireFox loads it as a text file. Does anyone else have this problem? If so, have you solved it? If so again, how?

    Read the article

  • How would I create a technology standards document for my company?

    - by Rob O
    I'm a Director of Product Engineering for my company. My CEO has asked me to create a technology standards document, explaining things like the technology we use, our policy on adapting to new technology, and design standards like percent of code covered by unit tests. I've never had to do something like this, and I've spent a significant amount of time searching the web for examples, but I haven't found any at all. The closest I've found are documents describing technical specifications for an individual product. However, I'm trying to define this for the entire company. Can someone provide examples of how this document could be formatted/organized, and what the typical content would be? Thanks!

    Read the article

  • Findbugs and comparing

    - by Rob Goodwin
    I recently started using the findbugs static analysis tool in a java build I was doing. The first report came back with loads of High Priority warnings. Being the obsessive type of person, I was ready to go knock them all out. However, I must be missing something. I get most of the warnings when comparing things. Such as the following code: public void setSpacesPerLevel(int value) { if( value >= 0) { ... produces a high priority warning at the if statement that reads. File: Indenter.java, Line: 60, Type: BIT_AND_ZZ, Priority: High, Category: CORRECTNESS Check to see if ((...) & 0) == 0 in sample.Indenter.setSpacesPerLevel(int) I am comparing an int to an int, seems like a common thing. I get quite a few of that type of error with similar simple comparisons. I have alot of other high priority warnings on what appears to be simple code blocks. Am I missing something here? I realize that static analysis can produce false positives, but the errors I am seeing seem too trivial of a case to be a false positive. This one has me scratching my head as well. for(int spaces = 0;spaces < spacesPerLevel;spaces++){... Which gives the following findbugs warning: File: Indenter.java, Line: 160, Type: IL_INFINITE_LOOP, Priority: High, Category: CORRECTNESS There is an apparent infinite loop in sample.Indenter.indent() This loop doesn't seem to have a way to terminate (other than by perhaps throwing an exception). Any ideas? So basically I have a handful of files and 50-60 high priority warnings similar to the ones above. I am using findbugs 1.3.9 and calling it from the findbugs ant task

    Read the article

  • HTTPS on iPhone

    - by Rob
    I need to be able to use https to connect to a server and I'm wondering if there's recommended way of doing this on the iPhone that's NOT: - an undocumented api call - does not require manually storing certificates in the app bundle Thanks all.

    Read the article

  • Store more than 24 hours in a DateTime

    - by Rob
    I work in a bizarre and irrational industry where we need to be able to represent the time of day as 06:00:00 to 30:00:00 instead of 0:00:00 to 24:00:00. Is there any way to do this using the DateTime type? If I try to construct a date time with an hour value greater than 24 it throws an exception.

    Read the article

  • Div at bottom of window and adaptable height div

    - by Rob
    Is there a way to get a div to always be at the bottom of the window, and another div to change its height to fill any space that it leaves, and that div will scroll if its content is too long. (I never want the window to scroll). This is best illustrated by a picture: The green div will always put itself at the bottom of the window, and the orange div will fill the gap. When the window is smaller, like in the right hand image, the orange div will be smaller and will scroll. The green div can be toggled. Sometimes the green div will have display: none, and then the orange div will stretch to the bottom. When the green div has display: block again, it will look like the picture again. It has to work in IE6. So far I can get the green div to go to the bottom by: position: absolute; bottom: 0; But I don't know how to get the orange div to do what I want.

    Read the article

  • Expected specifier-qualifier-list before 'CGPoint'

    - by Rob
    My project compiles and runs fine unless I try to compile my Unit Test Bundle it bombs out on the following with an "Expected specifier-qualifier-list before 'CGPoint'" error on line 5: #import <Foundation/Foundation.h> #import "Force.h" @interface WorldObject : NSObject { CGPoint coordinates; float altitude; NSMutableDictionary *forces; } @property (nonatomic) CGPoint coordinates; @property (nonatomic) float altitude; @property (nonatomic,retain) NSMutableDictionary *forces; - (void)setObject:(id)anObject inForcesForKey:(id)aKey; - (void)removeObjectFromForcesForKey:(id)aKey; - (id)objectFromForcesForKey:(id)aKey; - (void)applyForces; @end I have made sure that my Unit Test Bundle is a target of my WorldObject.m and it's header is imported in my testing header: #define USE_APPLICATION_UNIT_TEST 1 #import <SenTestingKit/SenTestingKit.h> #import <UIKit/UIKit.h> #import "Force.h" #import "WorldObject.h" @interface LogicTests : SenTestCase { Force *myForce; WorldObject *myWorldObject; } @end

    Read the article

  • Error message when trying to insert method into touchesBegan

    - by Rob
    I am trying to create a new method within my TapDetectingImageView file and it's giving me a warning that it cannot find the method even though I have it declared in the .h file. The specific three warnings all point to the @end line in the .m file when I build it and they say: "Incomplete implementation of class 'TapDetectingImageView' ; 'Method definition for '-functionA:' not found" ; "Method definition for '-functionB:' not found" What am I missing? Am I not allowed to do this in a protocol file like TapDetectingImageView? In my .h file is: @interface TapDetectingImageView : UIImageView <AVAudioPlayerDelegate> { id <TapDetectingImageViewDelegate> delegate; } @property (nonatomic, assign) id <TapDetectingImageViewDelegate> delegate; -(void) functionA:(NSString*)aVariable; -(void) functionB:(NSString*)aVariable; @end In my .m file is: -(void)functionA:(NSString*)aVariable { // do stuff in this function with aVariable } -(void)functionB:(NSString*)aVariable { // do stuff in this function with aVariable }

    Read the article

  • What does this PHP (function/construct?) do, and where can I find more documentation on it?

    - by Rob
    Simple question. Here is this code. $r = rand(0,1); $c = ($r==0)? rand(65,90) : rand(97,122); $inputpass .= chr($c); I understand what it does in the end result, but I'd like a better explanation on how it works, so I can use it myself. Sorry if this is a bad question. If you're unsure of what I'm asking about, its the (function?) used here: $c = ($r==0)? rand(65,90) : rand(97,122);

    Read the article

  • Is there a Symfony callback at the termination of a session?

    - by Rob Wilkerson
    I have an application that is authenticating against an external server in a filter. In that filter, I'm trying to set a couple of session attributes on the user by using Symfony's setAttribute() method: $this->getContext()->getUser()->setAttribute( 'myAttribute', 'myValue' ); What I'm finding is that, if I dump $_SESSION immediately after setting the attribute. On the other hand, if I call getAttribute( 'myAttribute' ), I get back exactly what I put in. All along, I've assumed that reading/writing to user attributes was synonymous with reading/writing to the session, but that seems to be an incorrect assumption. Is there a timing issue? I'm not getting any non-object errors, so it seems that the user is fully initialized. Where is the disconnect here? Thanks. UPDATE The reason this was happening is because I had some code in myUser::shutdown() that cleared out a bunch of stuff. Because myUser is loosely equivalent to $_SESSION (at least with respect to attributes), I assumed that the shutdown() method would be called at the end of each session. It's not. It seems to get called at the close of each request which is why my attributes never seemed to get set. Now, though, I'm left wondering whether there's a session closing callback. Anyone know?

    Read the article

  • PHP & WP: Render Certain Markup Based on True False Condition

    - by rob
    So, I'm working on a site where on the top of certain pages I'd like to display a static graphic and on some pages I would like to display an scrolling banner. So far I set up the condition as follows: <?php $regBanner = true; $regBannerURL = get_bloginfo('stylesheet_directory'); //grabbing WP site URL ?> and in my markup: <div id="banner"> <?php if ($regBanner) { echo "<img src='" . $regBannerURL . "/style/images/main_site/home_page/mock_banner.jpg' />"; } else { echo 'Slider!'; } ?> </div><!-- end banner --> In my else statement, where I'm echoing 'Slider!' I would like to output the markup for my slider: <div id="slider"> <img src="<?php bloginfo('stylesheet_directory') ?>/style/images/main_site/banners/services_banners/1.jpg" alt="" /> <img src="<?php bloginfo('stylesheet_directory') ?>/style/images/main_site/banners/services_banners/2.jpg" alt="" /> <img src="<?php bloginfo('stylesheet_directory') ?>/style/images/main_site/banners/services_banners/3.jpg" alt="" /> ............. </div> My question is how can I throw the div and all those images into my else echo statement? I'm having trouble escaping the quotes and my slider markup isn't rendering.

    Read the article

  • iPhone inputting NSUserDefaults into a UITextField

    - by Rob
    I am writing a program where I where the first time a user runs it - they will have to fill out about 10 different UITextFields. I am trying to save the fields so that on subsequent runs of the program that whatever they previously put will already be displayed in those UITextFields so the wont have to re-input it in - unless they want to edit something in which case they still have that option. I think that I have figured out a good way to save the strings using NSUserDefaults but now I am trying to figure out how to have those fields populate a UITextField - it doesnt seem as easy as if they were UILabels. This is the route I am attempting: // in the viewDidLoad portion. NSUserDefaults *userData = [NSUserDefaults standardUserDefaults]; //Hooks. NSString *placeHolderName = [userData stringForKey:@"name"]; txtName.text = @"%@", placeHolderName; When I do this, it simply displays the '%@' in the textfields. I want whatever variable being held by placeHolderName to be automatically put into that UITextField. Is this possible?

    Read the article

  • Is it possible to make a PHP script run itself every hour or so without the use of a cronjob?

    - by Rob
    I'm pretty sure I've seen this done in a php script once, although I cant find the script. It was some script that would automatically check for updates to that script, and then replace itself if there was an update. I don't actually need all that, I just want to be able to make my PHP script automatically run every 30 minutes to an hour, but I'd like to do it without cronjobs, if its possible. Any suggestions? Or is it even possible? EDIT: After reading through a possible duplicate that RC linked to, I'd like to clarify. I'd like to do this completely without using resources outside of the PHP script. AKA no outside cronjobs that send a GET request. I'd also like to do it without keeping the script running constantly and sleeping for 30 minutes

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >