Search Results

Search found 1903 results on 77 pages for 'james lamiell'.

Page 47/77 | < Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >

  • Optimal Sharing of heavy computation job using Snow and/or multicore

    - by James
    Hi, I have the following problem. First my environment, I have two 24-CPU servers to work with and one big job (resampling a large dataset) to share among them. I've setup multicore and (a socket) Snow cluster on each. As a high-level interface I'm using foreach. What is the optimal sharing of the job? Should I setup a Snow cluster using CPUs from both machines and split the job that way (i.e. use doSNOW for the foreach loop). Or should I use the two servers separately and use multicore on each server (i.e. split the job in two chunks, run them on each server and then stich it back together). Basically what is an easy way to: 1. Keep communication between servers down (since this is probably the slowest bit). 2. Ensure that the random numbers generated in the servers are not highly correlated.

    Read the article

  • Writing a new line to file in PHP

    - by James P
    My code: $i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file); For some reason, it's writing \n as a string, so the file looks like this: 40119\n40122\n40120\n42155\n36925\n45881\n42145\n45880 From Google'ing it tells me to use \r\n, but \r is a carriage return which doesn't seem to be what I want to do. I just want the file to look like this: 40119 40122 40120 42155 36925 45881 42145 45880 Thanks.

    Read the article

  • Getting the Leftmost Bit

    - by James
    I have a 5 bit integer that I'm working with. Is there a native function in Objective-C that will let me know which bit is the leftmost? i.e. I have 01001, it would return 8 or the position. Thanks

    Read the article

  • Eclipse jvm.dll error when loading

    - by Dan James Palmer
    Trying to open Eclipse after a couple of months and get this error: So I checked that folder to see if it existed, and it did: I checked my PATH Was correct and it was also correct: When this error first occurred I had 3 Java installations. JRE 7 Update 10, JDK 7 Update 7 32bit and 64 bit. I uninstall ALL and restarted my machine. Eclipse then stated, as expected that I needed a JRE or a JDK. So I downloaded and installed the latest JDK and now I get this error, despite everything appearing to be correct. Any ideas?

    Read the article

  • Keeping an application on top and in focus - always

    - by James Newton-King
    I am creating a kiosk application and I want to ensure it is always, no matter what, on top of other Windows applications and the Windows task bar. I am already blocking Windows keyboard commands (alt-tab, etc) but there are still situations that could cause an application to launch and steal the screen. Is it possible to hook into Windows from .NET and continually test whether the application has focus and is on top, and if not then give it focus and make it on top?

    Read the article

  • How to copy newly added document with metadata to another document library?

    - by James
    I need to copy the item that user just added (for example. myresume.doc or financial.xls) with the metadata (doc lib obtains the columns from content type, ct obtains the columns from site colum) and copy the item with metadata in a folder called "NativeFile". Every doc library has this folder. I know itemadded can be used but then I heard itemadded fires before user have a chance to complete the metadata for the item they just added. What are my options? (new to sp, so some sample code would greatly help. or some good link similar to this issue) Sharepoint 2007, itemadded or itemadding or itemupdating or itemupdated....

    Read the article

  • Center aligned form with equal width labels

    - by James Goodwin
    I have a very simple web form which consists of labels and input fields, however I can not seem to find a way of aligning the form in the center of the page and for the labels to have an equal width so that they appear neatly next to each other, one under the other. The structure of my page is basically: <body> <div class="form"> <form method="post"> <fieldset> <label>Mobile:</label><input type="text" name="msisdn"><br/> <label>Code:</label><input type="text" name="code"><br/> <br/> <input type="image" src="submit-button.gif" alt="Submit"> <br/> <input type="checkbox" name="ts_and_cs"><label> Accept Terms and Conditions</label> <br/><br/> </fieldset> </form> </div> </body> Usually I would fix this by doing float:left on the label fields and setting a width on the labels, however for this I need the labels and input fields to be centered on the page. Also I am not able to set the width of the page (or any containing divs) as the page will be displayed on mobile devices with different screen sizes. Any suggestions as to how best style the form? Thanks

    Read the article

  • Soap Web Service PHP

    - by James Radford
    Is it possible to send a complexType to a SOAP web service by creating the complexType locally, i.e. create the type by creating a class and then sending the instance of that class back to the service? Admittedly this is only possible if I can get the definition of the type from the service provider. I'm looking to send a complexType back to a web service. So if this approach wont work please suggest an alternative...

    Read the article

  • How to optimize this user ranking query

    - by James Simpson
    I have 2 databases (users, userRankings) for a system that needs to have rankings updated every 10 minutes. I use the following code to update these rankings which works fairly well, but there is still a full table scan involved which slows things down with a few hundred thousand users. mysql_query("TRUNCATE TABLE userRankings"); mysql_query("INSERT INTO userRankings (userid) SELECT id FROM users ORDER BY score DESC"); mysql_query("UPDATE users a, userRankings b SET a.rank = b.rank WHERE a.id = b.userid"); In the userRankings table, rank is the primary key and userid is an index. Both tables are MyISAM (I've wondered if it might be beneficial to make userRankings InnoDB).

    Read the article

  • How to strip a GET property from the URL using PHP

    - by James
    I have the following function that get's the current page URL: <?php // get current page url function currentPageUrl() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } echo $pageURL; } ?> Which prints: http://localhost/gallery.php?id=23&type=main I want to remove "&type=main" which is present in the url. So before echoing $pageURL I add the following line: $pageUrl = preg_replace("&type=main", "", $pageURL); But it still returns the full url including type=main. How can I get rid of that from the url?

    Read the article

  • C# WebBrowser Invoke issue

    - by James Jeffrey
    I am logging into facebook using a web browser. Everything works, but the problem is when I invoke the button click I need to check if the password is correct but, the check seems to happen before the button is invoked which makes no sense at all because the checking code is after the invoke. private void Facebook_Login(String username, String password) { webBrowser1.Url = new Uri("http://m.facebook.com"); while (webBrowser1.ReadyState != WebBrowserReadyState.Complete) Application.DoEvents(); HtmlElementCollection inputs = webBrowser1.Document.GetElementsByTagName("input"); foreach(HtmlElement input in inputs) { if (input.GetAttribute("name") == "email") { input.SetAttribute("value", "[email protected]"); } if (input.GetAttribute("name") == "pass") { input.SetAttribute("value", "kelaroostj"); // dont worry that pass wont work lol. } if (input.GetAttribute("name") == "login") { input.InvokeMember("click"); } } while (webBrowser1.ReadyState != WebBrowserReadyState.Complete) Application.DoEvents(); HtmlElementCollection bs = webBrowser1.Document.GetElementsByTagName("b"); foreach(HtmlElement b in bs) { MessageBox.Show(b.InnerHtml); } Log_Message("Logged into Facebook with: [email protected]"); }

    Read the article

  • JAVA Inheritance Generics and Casting.

    - by James Moore
    Hello, I have two classes which both extends Example. public class ClassA extends Example { public ClassA() { super("a", "class"); } .... } public class ClassB extends Example { public ClassB() { super("b", "class"); } .... } public class Example () { public String get(String x, String y) { return "Hello"; } } So thats all very well. So suppose we have another class called ExampleManager. With example manager I want to use a generic type and consequently return that generic type. e.g. public class ExampleManager<T extends Example> { public T getExample() { return new T("example","example"); // So what exactly goes here? } } So where I am returning my generic type how do i get this to actually work correctly and cast Example as either classA or classB? Many Thanks

    Read the article

  • Modelling multiple simultaneous states

    - by James P.
    How can you go about modelling an object that can have multiple simultaneous states? For example, you could have a person that's waiting for a bus. That's one state. But they could also be reading a newspaper while waiting for the bus. Furthermore, they could be thinking about something while reading the newspaper. They could also be sniffing their nose because they have a cold. That's a four states in all taking place at the same time. Obviously using booleans would be tedious and unflexible. Also, a conventional state pattern would mean that states are exclusive and can't be simultaneous in nature. The only thing I can think of is a State pattern combined with a Composite. Would this do or is there a way of taking things further?

    Read the article

  • mysql_real_escape_string() just makes an empty string?

    - by James P
    I am using a jQuery AJAX request to a page called like.php that connects to my database and inserts a row. This is the like.php code: <?php // Some config stuff define(DB_HOST, 'localhost'); define(DB_USER, 'root'); define(DB_PASS, ''); define(DB_NAME, 'quicklike'); $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('ERROR: ' . mysql_error()); $sel = mysql_select_db(DB_NAME, $link) or die('ERROR: ' . mysql_error()); $likeMsg = mysql_real_escape_string(trim($_POST['likeMsg'])); $timeStamp = time(); if(empty($likeMsg)) die('ERROR: Message is empty'); $sql = "INSERT INTO `likes` (like_message, timestamp) VALUES ('$likeMsg', $timeStamp)"; $result = mysql_query($sql, $link) or die('ERROR: ' . mysql_error()); echo mysql_insert_id(); mysql_close($link); ?> The problematic line is $likeMsg = mysql_real_escape_string(trim($_POST['likeMsg']));. It seems to just return an empty string, and in my database under the like_message column all I see is blank entries. If I remove mysql_real_escape_string() though, it works fine. Here's my jQuery code if it helps. $('#like').bind('keydown', function(e) { if(e.keyCode == 13) { var likeMessage = $('#changer p').html(); if(likeMessage) { $.ajax({ cache: false, url: 'like.php', type: 'POST', data: { likeMsg: likeMessage }, success: function(data) { $('#like').unbind(); writeLikeButton(data); } }); } else { $('#button_container').html(''); } } }); All this jQuery code works fine, I've tested it myself independently. Any help is greatly appreciated, thanks.

    Read the article

  • Finding N contiguous zero bits in an integer to the left of the MSB position of another integer

    - by James Morris
    The problem is: given an integer val1 find the position of the highest bit set (Most Significant Bit) then, given a second integer val2 find a contiguous region of unset bits, with the minimum number of zero bits given by width to the left of the position (ie, in the higher bits). Here is the C code for my solution: typedef unsigned int t; unsigned const t_bits = sizeof(t) * CHAR_BIT; _Bool test_fit_within_left_of_msb( unsigned width, t val1, t val2, unsigned* offset_result) { unsigned offbit = 0; unsigned msb = 0; t mask; t b; while(val1 >>= 1) ++msb; while(offbit + width < t_bits - msb) { mask = (((t)1 << width) - 1) << (t_bits - width - offbit); b = val2 & mask; if (!b) { *offset_result = offbit; return true; } if (offbit++) /* this conditional bothers me! */ b <<= offbit - 1; while(b <<= 1) offbit++; } return false; } Aside from faster ways of finding the MSB of the first integer, the commented test for a zero offbit seems a bit extraneous, but necessary to skip the highest bit of type t if it is set. I have also implemented similar algorithms but working to the right of the MSB of the first number, so they don't require this seemingly extra condition. How can I get rid of this extra condition, or even, are there far more optimal solutions? Edit: Some background not strictly required. The offset result is a count of bits from the high bit, not from the low bit as maybe expected. This will be part of a wider algorithm which scans a 2D array for a 2D area of zero bits. Here, for testing, the algorithm has been simplified. val1 represents the first integer which does not have all bits set found in a row of the 2D array. From this the 2D version would scan down which is what val2 represents. Here's some output showing success and failure: t_bits:32 t_high: 10000000000000000000000000000000 ( 2147483648 ) --------- ----------------------------------- *** fit within left of msb test *** ----------------------------------- val1: 00000000000000000000000010000000 ( 128 ) val2: 01000001000100000000100100001001 ( 1091569929 ) msb: 7 offbit:0 + width: 8 = 8 mask: 11111111000000000000000000000000 ( 4278190080 ) b: 01000001000000000000000000000000 ( 1090519040 ) offbit:8 + width: 8 = 16 mask: 00000000111111110000000000000000 ( 16711680 ) b: 00000000000100000000000000000000 ( 1048576 ) offbit:12 + width: 8 = 20 mask: 00000000000011111111000000000000 ( 1044480 ) b: 00000000000000000000000000000000 ( 0 ) offbit:12 iters:10 ***** found room for width:8 at offset: 12 ***** ----------------------------------- *** fit within left of msb test *** ----------------------------------- val1: 00000000000000000000000001000000 ( 64 ) val2: 00010000000000001000010001000001 ( 268469313 ) msb: 6 offbit:0 + width: 13 = 13 mask: 11111111111110000000000000000000 ( 4294443008 ) b: 00010000000000000000000000000000 ( 268435456 ) offbit:4 + width: 13 = 17 mask: 00001111111111111000000000000000 ( 268402688 ) b: 00000000000000001000000000000000 ( 32768 ) ***** mask: 00001111111111111000000000000000 ( 268402688 ) offbit:17 iters:15 ***** no room found for width:13 ***** (iters is the count of iterations of the inner while loop)

    Read the article

  • C# Excel Exception

    - by Andrew James Watt
    I am trying to copy all data from worksheet1 and paste the values into worksheet2 at the same position I am using office 2003 and the Interlop library. Here is my code; public void CreateExcelWorksheet() { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); if (xlApp == null) { Console.WriteLine("EXCEL could not be started. Check that your office installation."); return; } xlApp.Visible = true; Workbook wb = xlApp.Workbooks.OpenXML(@"C:\XML_Export.xml", Type.Missing, 2); Worksheet worksheet1 = wb.Worksheets[1] as Worksheet; Worksheet worksheet2 = wb.Worksheets[2] as Worksheet; worksheet1.UsedRange.Copy(Type.Missing); worksheet2.PasteSpecial(Microsoft.Office.Interop.Excel.XlPasteType.xlPasteValues, false, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing); } For some reason after the paste command the following exception occurs: Exception from HRESULT: 0x800A03EC Could anyone help?

    Read the article

  • Positioning a tooltip relative to another div in JQuery

    - by James P
    Here's my tooltips markup and CSS: <div class="tooltip">Click here to like it</div> .tooltip { position: absolute; display: none; background: url('images/tooltip.gif') no-repeat; width: 100%; height: 40px; font-size: 0.8em; line-height: 40px; padding: 0px 0px 0px 8px; } Now, I have a div on my page called #button_container. I would like to place this .tooltip div 150px to the right of that div via JQuery. I understand I need to set this tooltips top and left attributes, but not sure how. Idealy the tooltips top attribute should be the same as #button_container (although #button_container isn't positioned absolutely) and 150 less than #button_container's left attribute. I don't really know where to get started on this so any help would be very much appreciated. Thanks.

    Read the article

  • How Do I Prevent Rails From Treating Edit Fields_For Differently From New Fields_For

    - by James
    I am using rails3 beta3 and couchdb via couchrest. I am not using active record. I want to add multiple "Sections" to a "Guide" and add and remove sections dynamically via a little javascript. I have looked at all the screencasts by Ryan Bates and they have helped immensely. The only difference is that I want to save all the sections as an array of sections instead of individual sections. Basically like this: "sections" => [{"title" => "Foo1", "content" => "Bar1"}, {"title" => "Foo2", "content" => "Bar2"}] So, basically I need the params hash to look like that when the form is submitted. When I create my form I am doing the following: <%= form_for @guide, :url => { :action => "create" } do |f| %> <%= render :partial => 'section', :collection => @guide.sections %> <%= f.submit "Save" %> <% end %> And my section partial looks like this: <%= fields_for "sections[]", section do |guide_section_form| %> <%= guide_section_form.text_field :section_title %> <%= guide_section_form.text_area :content, :rows => 3 %> <% end %> Ok, so when I create the guide with sections, it is working perfectly as I would like. The params hash is giving me a sections array just like I would want. The problem comes when I want edit guide/sections and save them again because rails is inserting the id of the guide in the id and name of each form field, which is screwing up the params hash on form submission. Just to be clear, here is the raw form output for a new resource: <input type="text" size="30" name="sections[][section_title]" id="sections__section_title"> <textarea rows="3" name="sections[][content]" id="sections__content" cols="40"></textarea> And here is what it looks like when editing an existing resource: <input type="text" value="Foo1" size="30" name="sections[cd2f2759895b5ae6cb7946def0b321f1][section_title]" id="sections_cd2f2759895b5ae6cb7946def0b321f1_section_title"> <textarea rows="3" name="sections[cd2f2759895b5ae6cb7946def0b321f1][content]" id="sections_cd2f2759895b5ae6cb7946def0b321f1_content" cols="40">Bar1</textarea> How do I force rails to always use the new resource behavior and not automatically add the id to the name and value. Do I have to create a custom form builder? Is there some other trick I can do to prevent rails from putting the id of the guide in there? I have tried a bunch of stuff and nothing is working. Thanks in advance!

    Read the article

< Previous Page | 43 44 45 46 47 48 49 50 51 52 53 54  | Next Page >