Search Results

Search found 1975 results on 79 pages for 'james davies'.

Page 9/79 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Calling end invoke on an asynchronous call when an exception has fired in WCF.

    - by james.ingham
    Hey, I currently have an asynchronous call with a callback, which fires this method on completion: private void TestConnectionToServerCallback(IAsyncResult iar) { bool result; try { result = testConnectionDelegate.EndInvoke(iar); Console.WriteLine("Connection made!"); } catch (EndpointNotFoundException e) { Console.WriteLine("Server Timeout. Are you connected?"); result = false; } ... } With the EndpointNotFoundException firing when the server is down or no connection can be made. My question is this, if I want to recall the testConnectionDelegate with some kind of re-try button, must I first call testConnectionDelegate.EndInvoke where the exception is caught? When I do call end invoke in the catch, I get another exception on result = testConnectionDelegate.EndInvoke(iar); whenever I call this method for the second time. This is "CommunicationObjectFaultedException". I'm assuming this is because I didn't end it properly, which is what I think I have to do. Any help would be appreciated. Thanks - James

    Read the article

  • How does one calculate CPU utilization programmatically ?

    - by Scott Davies
    Hi, I have a benchmarking program that calculates the time (in milliseconds and ticks), for a persistance to Entity Framework 4.0. Is there a way to calculate CPU load ? I am guessing that I would need to query Windows to find out my CPU frequency, how many cores, etc. Does this sound right ? If so, what part of the .NET framework relates to querying the system ? I am guessing System.Diagnostics ? Thanks, Scott

    Read the article

  • asyncsocket Write Issue

    - by James
    I am attempting to use asyncsocket to communicate GPS data from a server app on my iPhone to a client app on my macbook. The two devices connect without any problems, and when the first data is sent from the iPhone to the laptop in asyncsocket's didConnectToHost method, the data is sent without hiccup. When I subsequently try to write additional data to the laptop from the locationManager method, however, no data is written. Here is the code: - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { lat = [NSNumber numberWithFloat:newLocation.coordinate.latitude]; [lat retain]; NSLog(@"lat: %1.0f", [lat floatValue]); NSString *msg = [NSString stringWithFormat:@"%1.0f", [lat floatValue]]; NSData *msgData = [msg dataUsingEncoding:NSUTF8StringEncoding]; [listenSocket writeData:msgData withTimeout:-1 tag:0]; } listensocket is my instance of ASyncSocket. I know that no data is being sent because after the initial successful transfer, the didWriteDataWithTag method is not called. Can anyone explain this? Thanks! James

    Read the article

  • Why is my multithreaded Java program not maxing out all my cores on my machine?

    - by James B
    Hi, I have a program that starts up and creates an in-memory data model and then creates a (command-line-specified) number of threads to run several string checking algorithms against an input set and that data model. The work is divided amongst the threads along the input set of strings, and then each thread iterates the same in-memory data model instance (which is never updated again, so there are no synchronization issues). I'm running this on a Windows 2003 64-bit server with 2 quadcore processors, and from looking at Windows task Manager they aren't being maxed-out, (nor are they looking like they are being particularly taxed) when I run with 10 threads. Is this normal behaviour? It appears that 7 threads all complete a similar amount of work in a similar amount of time, so would you recommend running with 7 threads instead? Should I run it with more threads?...Although I assume this could be detrimental as the JVM will do more context switching between the threads. Alternatively, should I run it with fewer threads? Alternatively, what would be the best tool I could use to measure this?...Would a profiling tool help me out here - indeed, is one of the several profilers better at detecting bottlenecks (assuming I have one here) than the rest? Note, the server is also running SQL Server 2005 (this may or may not be relevant), but nothing much is happening on that database when I am running my program. Note also, the threads are only doing string matching, they aren't doing any I/O or database work or anything else they may need to wait on. Thanks in advance, -James

    Read the article

  • Javascript/PHP and timezones

    - by James
    Hi, I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here: http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/ So this gives me the offset along with the DST indicator. Now, I want to use these in my PHP scripts in order to ouput the local date/time for the user....but what's best for this? I figure I have 2 options: a) Pick a random timezone which has the same offset and DST setting from the output of timezone_abbreviations_list(). Then call date_timezone_set() with this in order to apply the correct treatment to the time. b) Continue treating the date as UTC but just do some timestamp addition to add the appropriate number of hours on. My feeling is that option B is the best way. The reason for this is that with A, I could be using a timezone which although correct in terms of offset/dst, may have some obscur rules in place behind the scene that could give surprising results (I don't know of any but nonetheless I don't think I can rule it out). I'd then re-check the timezone using Javascript at the start of each session in order to capture when either the user's timezone changes (very unlikely) or they pass in to the DST period. Sorry for the brain dump - I'm really just after some sort of reassurance that the approaches above are valid. Thanks, James.

    Read the article

  • Disable chaching in JPA (eclipselink)

    - by James
    Hi, I want to use JPA (eclipselink) to get data from my database. The database is changed by a number of other sources and I therefore want to go back to the database for every find I execute. I have read a number of posts on disabling the cache but this does not seem to be working. Any ideas? I am trying to execute the following code: EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("default"); EntityManager em = entityManagerFactory.createEntityManager(); MyLocation one = em.createNamedQuery("MyLocation.findMyLoc").getResultList().get(0); MyLocation two = em.createNamedQuery("MyLocation.findMyLoc").getResultList().get(0); System.out.println(one==two); one==two is true while I want it to be false. I have tried adding each/all the following to my persistence.xml <property name="eclipselink.cache.shared.default" value="false"/> <property name="eclipselink.cache.size.default" value="0"/> <property name="eclipselink.cache.type.default" value="None"/> I have also tried adding the @Cache annotation to the Entity itself: @Cache( type=CacheType.NONE, // Cache nothing expiry=0, alwaysRefresh=true ) Am I misunderstanding something? Thank you, James

    Read the article

  • Data Mappers, Models and Images

    - by James
    Hi, I've seen and read plenty of blog posts and forum topics talking about and giving examples of Data Mapper / Model implementations in PHP, but I've not seen any that also deal with saving files/images. I'm currently working on a Zend Framework based project and I'm doing some image manipulation in the model (which is being passed a file path), and then I'm leaving it to the mapper to save that file to the appropriate location - is this common practise? But then, how do you deal with creating say 3 different size images from the one passed in? At the moment I have a "setImage($path_to_tmp_name)" which checks the image type, resizes and then saves back to the original filename. A call to "getImagePath()" then returns the current file path which the data mapper can use and then change with a call to "setImagePath($path)" once it's saved it to the appropriate location, say "/content/my_images". Does this sound practical to you? Also, how would you deal with getting the URL to that image? Do you see that as being something that the model should be providing? It seems to me like that model should worry about where the images are being stored or ultimately how they're accessed through a browser and so I'm inclined to put that in the ini file and just pass the URL prefix to the view through the controller. Does that sound reasonable? I'm using GD for image manipulation - not that that's of any relevance. UPDATE: I've been wondering if the image resizing should be done in the model at all. The model could require that it's provided a "main" image and a "thumb" image, both of certain dimensions. I've thought about creating a "getImageSpecs()" function in the model that would return something that defines the required sizes, then a separate image manipulation class could carry out the resizing and (perhaps in the controller?) and just pass the final paths in to the model using something like "setImagePaths($images)". Any thoughts much appreciated :) James.

    Read the article

  • How do I write test code to exercise a C# generic Pair<TKey, TValue> ?

    - by Scott Davies
    Hi, I am reading through Jon Skeet's "C# in Depth", first edition (which is a great book). I'm in section 3.3.3, page 84, "Implementing Generics". Generics always confuse me, so I wrote some code to exercise the sample. The code provided is: using System; using System.Collections.Generic; public sealed class Pair<TFirst, TSecond> : IEquatable<Pair<TFirst, TSecond>> { private readonly TFirst first; private readonly TSecond second; public Pair(TFirst first, TSecond second) { this.first = first; this.second = second; } ...property getters... public bool Equals(Pair<TFirst, TSecond> other) { if (other == null) { return false; } return EqualityComparer<TFirst>.Default.Equals(this.First, other.First) && EqualityComparer<TSecond>.Default.Equals(this.Second, other.Second); } My code is: class MyClass { public static void Main (string[] args) { // Create new pair. Pair thePair = new Pair(new String("1"), new String("1")); // Compare a new pair to previous pair by generating a second pair. if (thePair.Equals(new Pair(new string("1"), new string("1")))) System.Console.WriteLine("Equal"); else System.Console.WriteLine("Not equal"); } } The compiler complains: "Using the generic type 'ManningListing36.Paie' requires 2 type argument(s) CS0305" What am I doing wrong ? Thanks, Scott

    Read the article

  • Stopping and Play button for Audio (Android)

    - by James Rattray
    I have this problem, I have some audio I wish to play... And I have two buttons for it, 'Play' and 'Stop'... Problem is, after I press the stop button, and then press the Play button, nothing happens. -The stop button stops the song, but I want the Play button to play the song again (from the start) Here is my code: final MediaPlayer mp = MediaPlayer.create(this, R.raw.megadeth); And then the two public onclicks: (For playing...) button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click button.setText("Playing!"); try { mp.prepare(); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } mp.start(); // } }); And for stopping the track... final Button button2 = (Button) findViewById(R.id.cancel); button2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { mp.stop(); mp.reset(); } }); Can anyone see the problem with this? If so could you please fix it... (For suggest) Thanks alot... James

    Read the article

  • Is it possible to dynamically discover tables in an Entity Framework model ?

    - by Scott Davies
    Hi, I have co-workers working on an Entity Framework model that changes structure (entities), over time as software development progresses. I've written some utilities that interact with the tables within the model, but I'd like to have the code dynamically discover the tables. Is there a way I can do this ? Perhaps with ADO.NET to get the table names and then store them in a collection ? Thanks, Scott

    Read the article

  • Is the first persistance of an Entity Data Model in EF 4.0 slower due to the connection cost ?

    - by Scott Davies
    Hi, I've got a console app written that persists an object graph via Entity Framework 4.0. I loop through this to dump the execution times for each persistance. The first persistance is always the largest. Is this due to EF making the initial connection to the database and/or JIT'ing ? Here's a sample of the output: Persisted graph in **3318** millseconds. Persisted graph in 25 millseconds. Persisted graph in 26 millseconds. Persisted graph in 22 millseconds. Thanks, Scott

    Read the article

  • Returning a variable in a public void...

    - by James Rattray
    Hello, I'm abit new to programming Android App's, however I have come across a problem, I can't find a way to make global variables -unlike other coding like php or VB.NET, are global variables possible? If not can someone find a way (and if possible implement the way into the code I will provide below) to get a value from the variable 'songtoplay' so I can use in another Public Void... Here is the code: final Spinner hubSpinner = (Spinner) findViewById(R.id.myspinner); ArrayAdapter adapter = ArrayAdapter.createFromResource( this, R.array.colours, android.R.layout.simple_spinner_item); adapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); hubSpinner.setAdapter(adapter); // hubSpinner.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) { //code Object ttestt = hubSpinner.getSelectedItem(); final String test2 = ttestt.toString(); Toast message1 = Toast.makeText(Textbox.this, test2, Toast.LENGTH_LONG); message1.show(); String songtoplay = test2; // Need songtoplay to be available in another 'Public Void' } public void onNothingSelected(AdapterView<?> parentView) { //Code } }); Basically, it gets the value from the Spinner 'hubSpinner' and displays it in a Toast. I then want it to return a value for string variable 'songtoplay' -or find a way to make it global or useable in another Public Void, (Which is will a button, -loading the song to be played) Please help me, Thanks alot. James

    Read the article

  • Will a mulitouch touch screen equipped PC allow me to simulate real Android UI's without an Android device ?

    - by Scott Davies
    Hi, I have recently purchased a Samsung Galaxy Tab as an Android 2.x testbed (I am aware that 2.3 might not run on it, but it appears to be a good 1.x - 2.x device with a large enough screen to approximate the variety of screens on different phones). I would wait for Honeycomb equipped devices (such as the Motorola XOOM mentioned at CES 2011), but these are slated for some time in Q1 (likely end of Q1 for the Canadian market). If I get a multitouch capable PC and install the Android SDK and simulator, will I be able to use the multitouch functionality of the PC with the simulator to approximate a real device ? Does anyone use a multitouch touch screen PC for Android development ? I assume that this would work as the PC would recognize my fingers like the mouse, but I'd like to find out before purchasing the PC. Thanks for your help, Scott

    Read the article

  • When to use certain optimizations such as -fwhole-program and -fprofile-generate with several shared libraries

    - by James
    Probably a simple answer; I get quite confused with the language used in the GCC documentation for some of these flags! Anyway, I have three libraries and a programme which uses all these three. I compile each of my libraries seperately with individual (potentially) different sets of warning flags. However, I compile all three libraries with the same set of optimisation flags. I then compile my main programme linking in these three libraries with its own set of warning flags and the same optimisation flags used during the libraries' compilation. 1) Do I have to compile the libraries with optimisation flags present or can I just use these flags when compiling the final programme and linking to the libraries? If the latter, will it then optimise all or just some (presumably that which is called) of the code in these libraries? 2) I would like to use -fwhole-program -flto -fuse-linker-plugin and the linker plugin gold. At which stage do I compile with these on ... just the final compilation or do these flags need to be present during the compilation of the libraries? 3) Pretty much the same as 2) however with, -fprofile-generate -fprofile-arcs and -fprofile-use. I understand one first runs a programme with generate, and then with use. However, do I have to compile each of the libraries with generate/use etc. or just the final programme? And if it is just the last programme, when I then compeil with -fprofile-use will it also optimise the libraries functionality? Many thanks, James

    Read the article

  • Book resources for x86/x64 assembly programming on Win platform

    - by Scott Davies
    Hello, I ran a search for assembly language resources on stackoverflow.com and found some interesting results, but they seemed to boil down to two groups: 1) Assembly references to old ia32 architecture, such as the 80386 to Pentium 2) Windows agnostic books. Most of the commenters make the point that assembler is CPU dependent and that the OS is irrelevant, but it seems pointless to me to pick a book that has assembly examples that refer to MS-DOS interrupts and memory layouts. Likewise, learning assembler on Linux would seem to produce Linux executables Are there any: 1) Modern 2) x86/x64 3) on Windows platform - book resources available ? The reason I am targeting the Win platform is I would like to do low-level, OS internals programming, to supplement my Win C/C++ work. Thanks

    Read the article

  • Random Movement in a Fixed Container

    - by James Barracca
    I'm looking to create something that can move randomly inside of a fixed div container. I love the way the object moves in this example that I found searching this website... http://jsfiddle.net/Xw29r/15/ The code on the jsfiddle contains the following: $(document).ready(function(){ animateDiv(); }); function makeNewPosition(){ // Get viewport dimensions (remove the dimension of the div) var h = $(window).height() - 50; var w = $(window).width() - 50; var nh = Math.floor(Math.random() * h); var nw = Math.floor(Math.random() * w); return [nh,nw]; } function animateDiv(){ var newq = makeNewPosition(); var oldq = $('.a').offset(); var speed = calcSpeed([oldq.top, oldq.left], newq); $('.a').animate({ top: newq[0], left: newq[1] }, speed, function(){ animateDiv(); }); }; function calcSpeed(prev, next) { var x = Math.abs(prev[1] - next[1]); var y = Math.abs(prev[0] - next[0]); var greatest = x > y ? x : y; var speedModifier = 0.1; var speed = Math.ceil(greatest/speedModifier); return speed; }? CSS: div.a { width: 50px; height:50px; background-color:red; position:fixed; }? However, I don't believe the code above constricts that object at all. I need my object to move randomly inside of a container that is let's say for now... 1200px in width and 500px in height. Can someone steer me in the right direction? I'm super new to coding so I'm having a hard time finding an answer on my own. Thanks so much! James

    Read the article

  • Errors in UILabel

    - by Todd Davies
    I'm trying to use the FXlabel when following this (Adding a gradient label section) tutorial. This is some of the code inside my viewDidLoad method: self.logoLabel = [[FXLabel alloc] initWithFrame:CGRectMake(14, 11, 280, 87)]; [logoLabel setFont:[UIFont boldSystemFontOfSize:45]]; [logoLabel setTextColor:[UIColor whiteColor]]; [logoLabel setShadowColor:[UIColor blackColor]]; [logoLabel setShadowOffset:CGSizeMake(0, 2)]; [logoLabel setTextAlignment:UITextAlignmentCenter]; [logoLabel setBackgroundColor:[UIColor clearColor]]; [logoLabel setText:@"Attorney Biz"]; [logoLabel setGradientStartColor:[UIColor colorWithRed:163.0/255 green:203.0/255 blue:222.0/255 alpha:1.0]]; [logoLabel setGradientEndColor:[UIColor whiteColor]]; Unfortnuately, I get an error "No visible @interface for 'UILabel' declares the selector 'setGradientStartColor'" at the second-to-last line and "No visible @interface for 'UILabel' declares the selector 'setGradientEndColor'" Can somebody explain how to remove these errors?

    Read the article

  • C# (With .NET & Visual Studio) WebForms - How can I get the title of a page ..?

    - by Ashley Davies
    Prety long question; How can I do the following in C#: Open a webpage (Prefferably not visible) Check whether the page redirects to a different page (Site is down, 404, etc.) Check if the title is not equal to a said string Then seperately, (They need to click a confirm button) open their browser, and go to the adress of the first (It'll be the only one) hyperlink on the site. I literally have been looking on google for ages and haven't found anything similar to what I need. Whether you give me a link to a site with a tutorial on this area of programming or actual source code doesn't make a difference to me.

    Read the article

  • How do you escape double quotes inside a SQL fulltext 'contains' function?

    - by Richard Davies
    How do you escape a double quote character inside a MS SQL 'contains' function? SELECT decision FROM table WHERE CONTAINS(decision, '34" AND wide') Normally contains() expects double quotes to surround an exact phrase to match, but I want to search for an actual double quote character. I've tried escaping it with \, `, and even another double quote, but none of that has worked. P.S. I realize a simple example like this could also be done using the LIKE statement, but I need to use the fulltext search function. The query I provided here has been simplified from my actual query for example purposes.

    Read the article

  • JavaScript Prototype and Encapsulation

    - by Adam Davies
    Sorry I'm probably being a realy noob here...but: I have the following javascript object: jeeni.TextField = (function(){ var tagId; privateMethod = function(){ console.log("IN: privateMethod"); } publicMethod = function(){ console.log("IN: publicMethod: " + this.tagId); } jeeni.TextField = function(id){ console.log("Constructor"); this.tagId = id; } jeeni.TextField.prototype = { constructor: jeeni.TextField, foo: publicMethod }; return jeeni.TextField; }()); Now when I run the following code I get the corresponding result: var textField1 = new jeeni.TextField(21); // Outputs: Constructor textField1.foo(); // Outputs: IN: publicMethod: 21 console.log(textField1.tagId); // Outputs: 21 console.log(textField1.privateMethod); // Outputs: undefined So my question is why is privateMethod hidden and tagId is not. I want them both to be private scope. Please help a noob. Thanks

    Read the article

  • WebLogic Server Virtual Developer Day and Upcoming Developer Webcasts

    - by james.bayer
    We have a series of Virtual Developer Days for WebLogic for different geographies coming up as well as developer-oriented webcasts focusing on building a sample application with popular modern technologies.  The first one is Feb 1st, 2011 for North America, but there are others coming up through mid-March as well.  Check them out and register below. Virtual Developer Days for WebLogic AMER Conference begins: February 1, 2011 at 9:30am PST EUROPE/RUSSIA Conference begins: Thursday Feb 10, 2011 - 9:30 a.m. UK Time / 10:30 a.m. CET INDIA Conference begins: Thursday Feb 17, 2011 -  9:30am India time Register here for the Virtual Developer Day in your geography.   WebLogic Developer Webcasts Watch this brief video to learn more about the developer webcasts where we’ll build an application over several weeks focusing on different features like JPA, Data Grids, JMS, JAX-RS and more.  Register here for the WebLogic developer webcasts.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >