Search Results

Search found 1375 results on 55 pages for 'rob sanders'.

Page 43/55 | < Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >

  • How can I use cURL to open multiple URLs simultaneously with PHP?

    - by Rob
    Here is my current code: $SQL = mysql_query("SELECT url FROM urls") or die(mysql_error()); //Query the urls table while($resultSet = mysql_fetch_array($SQL)){ //Put all the urls into one variable // Now for some cURL to run it. $ch = curl_init($resultSet['url']); //load the urls curl_setopt($ch, CURLOPT_TIMEOUT, 2); //No need to wait for it to load. Execute it and go. curl_exec($ch); //Execute curl_close($ch); //Close it off } //While loop I'm relatively new to cURL. By relatively new, I mean this is my first time using cURL. Currently it loads one for two seconds, then loads the next one for 2 seconds, then the next. however, I want to make it load ALL of them at the same time. I'm sure its possible, I'm just unsure as to how. If someone could point me in the right direction, I'd appreciate it.

    Read the article

  • Common methods/implementation across multiple WCF Services

    - by Rob
    I'm looking at implementing some WCF Services as part of an API for 3rd parties to access data within a product I work on. There are currently a set of services exposed as "classic" .net Web Services and I need to emulate the behaviour of these, at least in part. The existing services all have an AcquireAuthenticationToken method that takes a set of parameters (username, password, etc) and return a session token (represented as a GUID), which is then passed in on calls to any other method (There's also a ReleaseAuthenticationToken method, no guesses needed as to what that does!). What I want to do is implement multiple WCF services, such as: ProductData UserData and have both of these services share a common implementation of Acquire/Release. From the base project that is created by VS2k8, it would appear I will start with, per service: public class ServiceName : IServiceName { } public interface IServiceName { } Therefore my questions would be: Will WCF tolerate me adding a base class to this, public class ServiceName : ServiceBase, IServiceName, or does the fact that there's an interface involved mean that won't work? If "No it won't work" to Question 1, could I change IServiceName so it extends another interface, IServiceBase, thus forcing the presence of Acquire/Release methods, but then having to supply the implementation in each service. Are 1 and 2 both really bad ideas and there's actually a much better solution that, knowing next to nothing about WCF, I just haven't thought of?

    Read the article

  • How do I supply values to an referenced assembly without calling a method it explicitly?

    - by Rob
    Currently I have a static class that I use as my logging module. I’ve added the class to my visual studio solution. Within the class I’ve specified the name and location of the log file to use. Which lets me do stuff like this – which I like and want. Logger.Information(“Page_Load”,”controls loaded correctly”); I’d like to refactor the code and move the logging functionality into a separately compiled assembly, if I did this I would then need to pass in the log file name and location to save the files too. However I don’t want to have to supply this information every time I call the ‘Logging’ method, this would be bad... Logger.Informtaion(“Page_Load”,”controls loaded correctly”,”logfile.txt”,”c:\temp”); Is there any way I can supply this information without having to specify it within each page or via the method call.

    Read the article

  • How do I cast from int to generic type Integer?

    - by Rob Kent
    I'm relatively new to Java and am used to generics in C# so have struggled a bit with this code. Basically I want a generic method for getting a stored Android preference by key and this code, albeit ugly, works for a Boolean but not an Integer, when it blows up with a ClassCastException. Can anyone tell me why this is wrong and maybe help me improve the whole routine (using wildcards?)? public static <T> T getPreference(Class<T> argType, String prefKey, T defaultValue, SharedPreferences sharedPreferences) { ... try { if (argType == Boolean.class) { Boolean def = (Boolean) defaultValue; return argType.cast(sharedPreferences.getBoolean(prefKey, def)); } else if (argType == Integer.class) { Integer def = (Integer) defaultValue; return argType.cast(sharedPreferences.getInt(prefKey, def)); } else { AppGlobal.logWarning("getPreference: Unknown type '%s' for preference '%s'. Returning default value.", argType.getName(), prefKey); return defaultValue; } } catch (ClassCastException e) { AppGlobal.logError("Cast exception when reading pref %s. Using default value.", prefKey); return defaultValue; } } I've tried various ways - using the native int, casting to an Integer, but nothing works.

    Read the article

  • What is a good program for storing “chunks” of commonly used source code

    - by Rob Wiley
    I've looked at CodeLocker (poorly styled and relatively unflexible, but free) and Source Code Library (Overzone software - very nicely styled, looks flexible, but very expensive - $80). Ideally, I'm looking for a relatively simple, inexpensive program (not an online website) that I can save text data (source code) with a title and keywords, maybe even a description. It would also have some type of search functionality.

    Read the article

  • Why do they initialize pointers this way?

    - by Rob
    In almost all of the books I read and examples I go through I see pointers initialized this way. Say that I have a class variable NSString *myString that I want to initialize. I will almost always see that done this way: -(id)init { if (self = [super init]) { NSString *tempString = [[NSString alloc] init]; myString = tempString; [tempString release]; } return self; } Why can't I just do the following? -(id)init { if (self = [super init]) { myString = [[NSString alloc] init]; } return self; } I don't see why the extra tempString is ever needed in the first place, but I could be missing something here with memory management. Is the way I want to do things acceptable or will it cause some kind of leak? I have read the Memory Management Guide on developer.apple.com and unless I am just missing something, I don't see the difference.

    Read the article

  • DateTime.ParseExact string format exception.

    - by Rob Ferno
    I am trying to convert a string into datetime with the following C# code, DateTime dTo = DateTime.ParseExact(dateTo, "mm/dd/yyyy", CultureInfo.InvariantCulture); eachtime I pass dateTo as 1/1/2010 it fails, instead it needs the string to be 01/01/2010. What string format should I use to support both 01/01/2010 and 1/1/2010?

    Read the article

  • Is "self" necessary?

    - by Rob
    Is using "self" ever necessary in Objective-C or maybe just a good practice? I have gone from using it all the time to not using it at all and I don't seem to really notice any difference. Isn't it just implied anyway?

    Read the article

  • Is it possible to wrap an asynchronous event and its callback in a function that returns a boolean?

    - by Rob Flaherty
    I'm trying to write a simple test that creates an image element, checks the image attributes, and then returns true/false. The problem is that using the onload event makes the test asynchronous. On it own this isn't a problem (using a callback as I've done in the code below is easy), but what I can't figure out is how to encapsulate this into a single function that returns a boolean. I've tried various combinations of closures, recursion, and self-executing functions but have had no luck. So my question: am I being dense and overlooking something simple, or is this in fact not possible, because, no matter what, I'm still trying to wrap an asynchronous function in synchronous expectations? Here's the code: var supportsImage = function(callback) { var img = new Image(); img.onload = function() { //Check attributes and pass true or false to callback callback(true); }; img.src = 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs='; }; supportsImage(function(status){ console.log(status); }); To be clear, what I want is to be able to wrap this in something such that it can be used like: if (supportsImage) { //Do some crazy stuff } Thanks! (Btw, I know there are a ton of SO questions regarding confusion about synchronous vs. asynchronous. Apologies if this can be reduced to something previously answered.)

    Read the article

  • How to parse mathematical expressions involving parentheses

    - by Rob P.
    Please forgive my title, I really don't know how to phrase it better. This isn't a school assignment or anything, but I realize it's a mostly academic question. But, what I've been struggling to do is parse 'math' text and come up with an answer. For Example - I can figure out how to parse '5 + 5' or '3 * 5' - but I fail when I try to correctly chain operations together. (5 + 5) * 3 It's mostly just bugging me that I can't figure it out. If anyone can point me in a direction, I'd really appreciate it. EDIT Thanks for all of the quick responses. I'm sorry I didn't do a better job of explaining. First - I'm not using regular expressions. I also know there are already libraries available that will take, as a string, a mathematical expression and return the correct value. So, I'm mostly looking at this because, sadly, I don't "get it". Second - What I've tried doing (is probably misguided) but I was counting '(' and ')' and evaluating the deepest items first. In simple examples, this worked; but my code is not pretty and more complicated stuff crashes. When I 'calculated' the lowest level, I was modifying the string. So... (5 + 5) * 3 Would turn into 10 * 3 Which would then evaluate to 30 But it just felt 'wrong'. I hope that helps clarify things. I'll certainly check out the links provided.

    Read the article

  • Bizarre static_cast trick?

    - by Rob
    While perusing the Qt source code I came across this gem: template <class T> inline T qgraphicsitem_cast(const QGraphicsItem *item) { return int(static_cast<T>(0)->Type) == int(QGraphicsItem::Type) || (item && int(static_cast<T>(0)->Type) == item->type()) ? static_cast<T>(item) : 0; } Notice the static_cast<T>(0)->Type? I've been using C++ for many years but have never seen 0 being used in a static_cast before. What is this code doing and is it safe? Background: If you derive from QGraphicsItem you are meant to declare an unique enum value called Type that and implement a virtual function called type that returns it, e.g.: class Item : public QGraphicsItem { public: enum { Type = MAGIC_NUMBER }; int type() const { return Type; } ... }; You can then do this: QGraphicsItem* item = new Item; ... Item* derivedItem = qgraphicsitem_cast<Item*>(item); This will probably help explain what that static_cast is trying to do.

    Read the article

  • Why Isn't My .Net Object Serializable?

    - by Rob P.
    I've got a 'MyDataTable' class that inherits from System.Data.DataTable I've implemented ISerializable in my class and have a 'Public Overrides Sub GetObjectData...' But when I try to serialize the an object of 'MyDataTable' I get an error saying that 'MyDataTable' is not marked as serializable. If I used a DataTable instead - my code serializes correctly. If I add a serializable attribute to the 'MyDataTable' class - it serializes correctly, but I'm told that is unnecessary if I implement ISerializable. Can someone point me in the right direction?

    Read the article

  • Convert date in text format to datetime format in T-SQL

    - by Rob
    I have a client supplied file that is loaded in to our SQL Server database. This file contains text based date values i.e. (05102010) and I need to read them from a db column and convert them to a normal date time value = '2010-05-10 00:00:00.000' as part of a clean-up process. Any guidance would be greatly appreciated.

    Read the article

  • iPhone time comparison

    - by Rob
    I am trying to figure out how to create an 'if' statement that uses a time value as a condition. For example: if (time <= 10:00) { score = 3; } else if (time <= 20:00) { score = 5; } else { score = 9; } I know that a string of "5:23" cannot be compared this way but I don't think I can just turn a string value like that directly into an integer. Any thoughts?

    Read the article

  • INotifyPropertyChanged event listener within respective class not firing on client side (silverlight)

    - by Rob
    I'm trying to work out if there's a simple way to internalize the handling of a property change event on a Custom Entity as I need to perform some bubbling of the changes to a child collection within the class when the Background Property is changed via a XAML binding: public class MyClass : INotifyPropertyChanged { [Key] public int MyClassId { get; set; } [DataMember] public ObservableCollection<ChildMyClass> MyChildren { get; set; } public string _backgroundColor; [DataMember] public string BackgroundColor { get { return this._backgroundColor; } set { this._backgroundColor = value; if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs("BackgroundColor")); } } } public MyClass() { this.BackgroundColor = "#FFFFFFFF"; this.PropertyChanged += MyClass_PropertyChanged; } public event PropertyChangedEventHandler PropertyChanged; void MyClass_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { //Do something here - fires client side but not server side } } I can listen to the event by externalizing it without any problems but it's an ugly way to handle something that want to set and forget inside my class e.g.: public class SomeOtherClass { public SomeOtherClass() { MyClass mc = new MyClass(); mc.PropertyChanged += MyClass_PropertyChanged; } void MyClass_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { MyClass mc = (MyClass)sender; mc.UpdateChildren(); } }

    Read the article

  • iPhone producing strange results on 'if' statement

    - by Rob
    I have a UIPicker where the user inputs a specified time (i.e. 13:00, 13:01, 13:02, etc.) - which determines their score. Once they hit the button an alert comes up with the score that is determined through this 'if-else' statement. Everything seems to work great MOST of the time - but I am getting some erratic behavior. This is the code: //Gets my value from the UIPicker and then converts it into a format that can be used in the 'if' statement. NSInteger runRow = [runTimePicker selectedRowInComponent:2]; NSString *runSelected = [runTimePickerData objectAtIndex:runRow]; NSString *runSelectedFixed = [runSelected stringByReplacingOccurrencesOfString:@":" withString:@"."]; //The actual 'if' statment. if ([runSelectedFixed floatValue] <= 13.00) { runScore = 100; } else if ([runSelectedFixed floatValue] <= 13.06) { runScore = 99; } else if ([runSelectedFixed floatValue] <= 13.12) { runScore = 97; } else if ([runSelectedFixed floatValue] <= 13.18) { runScore = 96; } else if ([runSelectedFixed floatValue] <= 13.24) { runScore = 94; } else if ([runSelectedFixed floatValue] <= 13.30) { runScore = 93; } else if ([runSelectedFixed floatValue] <= 13.36) { runScore = 92; } else if ([runSelectedFixed floatValue] <= 13.42) { runScore = 90; } else if ([runSelectedFixed floatValue] <= 13.48) { runScore = 89; } else if ([runSelectedFixed floatValue] <= 13.54) { runScore = 88; } Now, when I test the program, I will get the expected result when I choose '13:00' which is '100'. I also get the expected result of '99' when I choose all of the times between '13:01 and 13:05'. BUT, when I choose '13:06' it gives me a score of '97'. I also get a score of '97' on '13:07 through 13:12' - which is the desired result. Why would I get a '97' right on '13:12' but not get a '99' right on '13:06'???? Could this be a memory leak or something???

    Read the article

  • md5_file() not working with IP addresses?

    - by Rob
    Here is my code relating to the question: $theurl = trim($_POST['url']); $md5file = md5_file($theurl); if ($md5file != '96a0cec80eb773687ca28840ecc67ca1') { echo 'Hash doesn\'t match. Incorrect file. Reupload it and try again'; When I run this script, it doesn't even output an error. It just stops. It loads for a bit, and then it just stops. Further down the script I implement it again, and it fails here, too: while($row=mysql_fetch_array($execquery, MYSQL_ASSOC)){ $hash = @md5_file($row['url']); $url = $row['url']; mysql_query("UPDATE urls SET hash='" . $hash . "' WHERE url='" . $url . "'") or die("MYSQL is indeed gay: ".mysql_error()); if ($hash != '96a0cec80eb773687ca28840ecc67ca1'){ $status = 'down'; }else{ $status = 'up'; } mysql_query("UPDATE urls SET status='" . $status . "' WHERE url='" . $url . "'") or die("MYSQL is indeed gay: ".mysql_error()); } And it checks all the URL's just fine, until it gets to one with an IP instead of a domain, such as: http://188.72.215.195/config.php In which, again, the script then just loads for a bit, and then stops. Any help would be much appreciated, if you need any more information just ask.

    Read the article

  • Is it possible to resolve domain names to an IP address with PHP?

    - by Rob
    Well, very simple question. So that's good news for you, I guess. More thorough explanation: I have a PHP script allowing me to add urls to a database. I want the script to resolve the url to an IP address as well, to store that, too. However, some of the URLs are like this: http://111.111.111.111/~example/index.php So it also needs to work with that. I'm not SURE that this is possible, but it only makes sense it would be. So: Is it possible, and if so, how?

    Read the article

  • Setting custom control properties

    - by Rob
    I though it would be very simple but I can not get it today. I have a user control, with a grid control contained in it. public Unit Width { get { return CustomerGrid.Width; } set { CustomerGrid.Width = value; } } I expose the width property and when I set it in the designer it works at run-time but not design time. What class do I inherit from or method to override to get my controls to function at design time. Note I tried to inherit from WebControl but got the message Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class

    Read the article

  • PHP Arrays: Pop an array of single-element arrays into one array.

    - by Rob Drimmie
    Using a proprietary framework, I am frequently finding myself in the situation where I get a resultset from the database in the following format: array(5) { [0] => array(1) { ["id"] => int(241) } [1] => array(1) { ["id"] => int(2) } [2] => array(1) { ["id"] => int(81) } [3] => array(1) { ["id"] => int(560) } [4] => array(1) { ["id"] => int(10) } } I'd much rather have a single array of ids, such as: array(5) { [0] => int(241) [1] => int(2) [2] => int(81) [3] => int(560) [4] => int(10) } To get there, I frequently find myself writing: $justIds = array(); foreach( $allIds as $id ) { $justIds[] = $id["id"]; } Is there a more efficient way to do this?

    Read the article

< Previous Page | 39 40 41 42 43 44 45 46 47 48 49 50  | Next Page >