Search Results

Search found 2217 results on 89 pages for 'pat james'.

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

  • 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

  • jCarousel, IE6 and Fixed Width

    - by Pat Long - Munkii Yebee
    We are using jCarousel on our websites to display images. Simple enough. We have fairly flexible layouts so the carousels are not always the same width. FF, IE7+, Chrome, Safari etc work perfectly well taking up the space available. However IE6 ends up sending the jCarousel script into a loop and warns that a script is stopping the page from loading correctly. To stop IE6 from failing we are having to specify a fixed width in CSS for the carousel container. Is this a problem that others have had with IE6 and jCarousel?

    Read the article

  • Conditionals in Antlr String Templates

    - by Pat Long - Munkii Yebee
    We are using Antlr StringTemplates to give control over how a Entity's Name is output. The basic Stringtemplate is $FirstName$ $Initial$ $LastName$, $Suffix$, $Degree$ I want to add some smarts to that template so that the commas are only output when necessary i.e. The first comma is only output when there is a Suffix or Degree and the second commas is only output if there is a suffix. I tried the following template string bit it does not work. I guess I have misunderstood $FirstName$ $Initial$ $LastName$ <if(Suffix|Degree)>,<endif>, $Suffix$ <if(Suffix)>,<endif> $Degree$ If it helps we process the templates using this C# StringTemplate stringtemplate = new Antlr.StringTemplate.StringTemplate(template.Data); foreach (Pair<string, string> pair in dictionary) { if (pair.First != null && pair.Second != null) { stringtemplate.SetAttribute(pair.First, pair.Second); } } return stringtemplate.ToString();

    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

  • 301 redirect vs parking

    - by Pat
    I have several domain names registered, each a slight variant of each other. E.g, fastcar.com fast-car.com fastcar.co.uk fast-car.co.uk etc.. I don't wish to be penalized for duplicate content or spammy links by any of the major search engines. Should I park them all directly on the main domain I wish to promote, 301 redirect them to the main domain or not use them at all? Thanks

    Read the article

  • Hybrid EAV/CR model via WCF (and statically-typed language)?

    - by Pat
    Background I'm working on the architecture for a cloud-based LOB application, using Silverlight for the client, WCF, ASP.NET/C# for server and SQL Server for storage. The data model requires some flexibility per user (ability to add custom properties and define validation rules for them, for example), and a hybrid EAV/CR persistence model on the server side will suit nicely. Problem I need an efficient and maintainable technology and approach to handle the transformation from the persisted EAV model to/from WCF (and similarly allow the client to bind to the resulting data - DataGrid is a key UI element)? Admission: I don't yet know enough about WCF to understand if it supports ExpandoObject directly, but I suspect it will. Options I started off looking at WCF RIA services, but quickly discovered they're heavily dependent upon both static type data and compile-time code generation. Neither of these appeal. The options I'm considering include: Using WCF RIA services and pass the data over the network directly in EAV form (i.e. Dictionary), and handle the binding issue purely on the client side (like this) Using a dynamic language (probably IronPython) to handle both ends of the communication, with plumbing to generate the necessary CLR type data on the client to allow binding, and transform to/from EAV form on the server (spam preventer stopped me from posting a URL here, I'll try it in a comment). Dynamic LINQ (CreateClass() and friends), although I'm way out of my depth there and don't know what the limitations on that approach might be yet. I'm interested in comments on these approaches as well as alternative approaches that might solve the problem. Other Notes The Silverlight client will not be the only consumer of the service, making me slightly uncomfortable with option #1 above. While the data model is flexible, it's not expected to be modified heavily. For argument's sake, we could assume that we might have 25 distinct data models active at a given time, with something like 10-20 unique data fields/rules each. Modifications to the data model will happen infrequently (typically when a new user is initially configured).

    Read the article

  • Using Custom MapType with Google Maps API

    - by Pat Long - Munkii Yebee
    I realise there are a couple of examples such as Maoki's Add Your Own Custom Map and Mike Williams' [link text][Google Maps API Tutorial] however I have looked at these and still end up with a Grey box. The API will not call my "getTileUrl" callback function. This is the javascript I am using var map = new GMap2(document.getElementById("map")); map.setUIToDefault(); var copyCollection = new GCopyrightCollection('Map Data:'); var copyright = new GCopyright(1, new GLatLngBounds(new GLatLng(-90, -180), new GLatLng(90, 180)), 0, "©2006 RunwayFinder.com"); copyCollection.addCopyright(copyright); var tilelayers = [new GTileLayer(copyCollection, 3, 11)]; tilelayers[0].getTileUrl = function (a, b) { var z = 17 - b; var f = "http://localhost:25213/test.jpg?x=" + a.x + "&y=" + a.y + "&zoom=" + z + "&width=100&height=100"; return f; }; var custommap = new GMapType(tilelayers, new GMercatorProjection(12), "Chart", { errorMessage: "No chart data available" }); map.addMapType(custommap); Can anyone see what it is i am doing wrong?

    Read the article

  • Modifying jQuery ajax request Connectino header

    - by Pat
    I'm trying to modify the Connection header with the following code with no success jQuery.ajax ( { url: URL, async: boolVariable, beforeSend: function(xhr) { xhr.setRequestHeader("Connection", "close"); } } ) The request headers via Firebug show: Connection keep-alive X-Requested-With XMLHttpRequest Any odd bugs/problems with setting this particular header known? Or is there something I'm doing wrong?

    Read the article

  • Tool to generate a GUI (WinForms or WPF) from a class.

    - by Pat
    Say we've got a class like public class Doer { public int Timeout {get;set;} public string DoIt(string input) { string toReturn; // Do something that involves a Timeout return toReturn; } } Is there a tool that would create a Form or Control for prototyping this class? The GUI might have a NumericUpDown control with a label of "Timeout" and a GroupBox with a TextBox for "input" and a button labeled "DoIt" with an eventhandler that calls Doer.DoIt with the Text property of the input TextBox and puts the response in another TextBox.

    Read the article

  • Getting size of a specific byte array from an array of pointers to bytes

    - by Pat James
    In the following example c code, used in an Arduino project, I am looking for the ability to get the size of a specific byte array within an array of pointers to bytes, for example void setup() { Serial.begin(9600); // for debugging byte zero[] = {8, 169, 8, 128, 2,171,145,155,141,177,187,187,2,152,2,8,134,199}; byte one[] = {8, 179, 138, 138, 177 ,2,146, 8, 134, 8, 194,2,1,14,199,7, 145, 8,131, 8,158,8,187,187,191}; byte two[] = {29,7,1,8, 169, 8, 128, 2,171,145,155,141,177,187,187,2,152,2,8,134,199, 2, 2, 8, 179, 138, 138, 177 ,2,146, 8, 134, 8, 194,2,1,14,199,7, 145, 8,131, 8,158,8,187,187,191}; byte* numbers[3] = {zero, one, two }; function(numbers[1], sizeof(numbers[1])/sizeof(byte)); //doesn't work as desired, always passes 2 as the length function(numbers[1], 25); //this works } void loop() { } void function( byte arr[], int len ) { Serial.print("length: "); Serial.println(len); for (int i=0; i<len; i++){ Serial.print("array element "); Serial.print(i); Serial.print(" has value "); Serial.println((int)arr[i]); } } In this code, I understand that sizeof(numbers1)/sizeof(byte)) doesn't work because numbers1 is a pointer and not the byte array value. Is there a way in this example that I can, at runtime, get at the length of a specific (runtime-determined) byte array within an array of pointers to bytes? Understand that I am limited to developing in c (or assembly) for an Arduino environment. Also open to other suggestions rather than the array of pointers to bytes. The overall objective is to organize lists of bytes which can be retrieved, with length, at runtime.

    Read the article

  • How do I call overloaded Java methods in Clojure.

    - by Pat Wallace
    For this example Java class: package foo; public class TestInterop { public String test(int i) { return "Test(int)"; } public String test(Object i) { return "Test(Object)"; } } When I start Clojure and try to call the test(int) method, the test(Object) method is called instead, because Clojure automatically boxes the integer into a java.lang.Integer object. How do I force Clojure to call the test(int) method? user=> (.test (new foo.TestInterop) 10) "Test(Object)" I want to call methods like Component.add(Component comp, int index) in AWT, but instead keep calling add(Component comp, Object constraints), so the buttons on my toolbar always appear in the wrong order.

    Read the article

  • Jquery date in a adropdown with interval

    - by Zoom Pat
    I am trying to use Jquery to display dates in a dropdown with interval of half month... so the first value would be the coming month's 1st, then second will be the coming month's 15th and third value would be next to next month's first and so on... If today date is less than 15th then the first value would be the 15th of current month. What will be the best or a cleaner way to do this... (want to display in the dropdown) Thanks

    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

  • Calculate an Internet (aka IP, aka RFC791) checksum in C#

    - by Pat
    Interestingly, I can find implementations for the Internet Checksum in almost every language except C#. Does anyone have an implementation to share? Remember, the internet protocol specifies that: "The checksum field is the 16 bit one's complement of the one's complement sum of all 16 bit words in the header. For purposes of computing the checksum, the value of the checksum field is zero." More explanation can be found from Dr. Math. There are some efficiency pointers available, but that's not really a large concern for me at this point. Please include your tests! (Edit: Valid comment regarding testing someone else's code - but I am going off of the protocol and don't have test vectors of my own and would rather unit test it than put into production to see if it matches what is currently being used! ;-) Edit: Here are some unit tests that I came up with. They test an extension method which iterates through the entire byte collection. Please comment if you find fault in the tests. [TestMethod()] public void InternetChecksum_SimplestValidValue_ShouldMatch() { IEnumerable<byte> value = new byte[1]; // should work for any-length array of zeros ushort expected = 0xFFFF; ushort actual = value.InternetChecksum(); Assert.AreEqual(expected, actual); } [TestMethod()] public void InternetChecksum_ValidSingleByteExtreme_ShouldMatch() { IEnumerable<byte> value = new byte[]{0xFF}; ushort expected = 0xFF; ushort actual = value.InternetChecksum(); Assert.AreEqual(expected, actual); } [TestMethod()] public void InternetChecksum_ValidMultiByteExtrema_ShouldMatch() { IEnumerable<byte> value = new byte[] { 0x00, 0xFF }; ushort expected = 0xFF00; ushort actual = value.InternetChecksum(); Assert.AreEqual(expected, actual); }

    Read the article

  • Modifying jQuery ajax request Connection header

    - by Pat
    I'm trying to modify the Connection header with the following code with no success jQuery.ajax({ url: URL, async: boolVariable, beforeSend: function(xhr) { xhr.setRequestHeader("Connection", "close"); } }) The request headers via Firebug show: Connection keep-alive X-Requested-With XMLHttpRequest Any odd bugs/problems with setting this particular header known? Or is there something I'm doing wrong?

    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

  • Alternatives to HTML for website creation?

    - by Pat
    Hello It seems the most common aproach to web design is to use HTML/XHTML & CSS in conjunction with other technologies or languages like Javascript or PHP. On a theoretical level, I'm interested to know what other languages or technologies could be used to build an entire site without using a single HTML tag or CSS style for styling/positioning? Could a website be made only using XML or PHP alone, including actual styling and positioning? Presumably Flash sites are till embedded in HTML tags? Thanks

    Read the article

  • Easiest way to retrofit retry logic on LINQ to SQL migration to SQL Azure

    - by Pat James
    I have a couple of existing ASP .NET web forms and MVC applications that currently use LINQ to SQL with a SQL Server 2008 Express database on a Windows VPS: one VPS for both IIS and SQL. I am starting to outgrow the VPS's ability to effectively host both SQL and IIS and am getting ready to split them up. I am considering migrating the database to SQL Azure and keeping IIS on the VPS. After doing initial research it sounds like implementing retry logic in the data access layer is a must-do when adopting SQL Azure. I suspect this is even more critical to implement in my situation where IIS will be on a VPS outside of the Azure infrastructure. I am looking for pointers on how to do this with the least effort and impact on my existing code base. Is there a good retry pattern that can be applied once at the LINQ to SQL data access layer, as opposed to having to wrap all of my LINQ to SQL operations in try/catch/wait/retry logic?

    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

  • Using Interface Builder tags

    - by pat
    I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do: UILabel *label = (UILabel *)[cell viewWithTag:1]; I'm wondering if I should wrap it up like so: if([[cell viewWithTag:1] isKindOfClass [UITableViewCell class]]) { UILabel *label = (UILabel *)[cell viewWithTag:1]; } Any discussion on this would be appreciated. Thanks

    Read the article

  • How can I explain to a programmer that CSS positioning has many benefits over table based layouts?

    - by Pat
    I have a friend who wishes to work as a freelance web developer, but insists that tables are the way forwards for layouts. Several points he maintains in favour of tables: 1 This is what was taught at the beginning of 10 years of programming & computer science degrees. 2 Large companies use tables to achieve 'technical' things. 3 It saves time I have coded him some examples of CSS exactly matching table based layouts, and provided many links to articles explaining SEO and accessibility benefits. From the perspective of a client, I have been explaining to him that I wouldn't hire someone using outdated methods as their main strategy for layout. As he is my friend and I wish him every success, I believe it is important for him to gain the best start when pitching for work. The question again: How can I explain to a programmer that CSS positioning has many benefits over table based layouts?

    Read the article

  • Jquery date in a dropdown with interval

    - by Zoom Pat
    I am trying to use Jquery to display dates in a dropdown with interval of half month... so the first value would be the coming month's 1st, then second will be the coming month's 15th and third value would be next to next month's first and so on... If today date is less than 15th then the first value would be the 15th of current month. What will be the best or a cleaner way to do this... (want to display in the dropdown) Thanks

    Read the article

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