Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 121/171 | < Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >

  • Multithreading for loop while maintaining order

    - by David
    I started messing around with multithreading for a CPU intensive batch process I'm running. Essentially I'm trying to condense multiple single page tiffs into single PDF documents. This works fine with a foreach loop or standard iteration but can be very slow for several 100 page documents. I tried the following based on a some examples I found to use multithreading and it has significant performance improvements however it obliterates the page order instead of 1,2,3,4 it will be 1,3,4,2,6,5 on what thread completes first. My question is how would I utilize this technique while maintaining the page order and if I can will it negate the performance benefit of the multithreading? Thank you in advance. PdfDocument doc = new PdfDocument(); string mail = textBox1.Text; string[] split = mail.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); int counter = split.Count(); // Source must be array or IList. var source = Enumerable.Range(0, 100000).ToArray(); // Partition the entire source array. var rangePartitioner = Partitioner.Create(0, counter); double[] results = new double[counter]; // Loop over the partitions in parallel. Parallel.ForEach(rangePartitioner, (range, loopState) => { // Loop over each range element without a delegate invocation. for (int i = range.Item1; i < range.Item2; i++) { f_prime = split[i].Replace(" " , ""); PdfPage page = doc.AddPage(); XGraphics gfx = XGraphics.FromPdfPage(page); XImage image = XImage.FromFile(f_prime); double x = 0; gfx.DrawImage(image, x, 0); } });

    Read the article

  • Web developement learning env

    - by David Oneill
    I am currently learning Ruby on Rails. I currently do all my development on my laptop. However, I know in all "real world" situations, I will be connecting to a dedicated server that will hold the site. So here is my question: what are the pros and cons of developing on the machine I use vs running the website on a separate server?

    Read the article

  • How can I save a screenshot directly to a file in Windows?

    - by David
    In Windows XP, one can press Alt-PrintScreen to copy an image of the active window, or Ctrl-PrintScreen to copy an image of the full desktop. This can then be pasted into applications that accept images: Photoshop, Microsoft Word, etc. I'm wondering: Is there a way to save the screenshot directly to a file? Do I really have to open Photoshop simply to paste an image, then save it?

    Read the article

  • Server RAID 5 failed...all I have left is my compiled website

    - by David Murdoch
    Yesterday, 2 of the 3 drives in my dev server's RAID 5 decided to die on me (with no warning). I've come to grips with the fact that my data is most likely lost unless I shell out some major bucks for professional data-resortoration. People, don't be an idiot like me and treat your RAID as a data backup! Luckily I published the site about 4 hours before my files went bye-bye. Is there any way to run some [magical] program to restore my compiled site to their original files? Also: I develop on one machine with the files stored on the server...is there some visual studio 2010 web cache on my local machine (the one that didn't crash) that I may be able to use?

    Read the article

  • Jquery data() returning undefined

    - by David Lockwood
    I have been doing a simple jquery data() test. However it is returning undefined. It works on jsfiddle though (http://jsfiddle.net/yrCdj/). I have a jinja2 loop which populates a div and I want to tag it with some metadata for use later : {% for s in siteInfo[:markers[0]] %} <div class="sitebox2"> <script> $(".sitebox2:last").append('<a href="/sites/d?siteid={{s[5]}}">{{s[0]}}</a><br>Distance from {{loc}} is {{s[6]}} km.<br>'); $(".sitebox2:last").data('fruit', 'apple'); </script> </div> {% endfor %} I then try to call this data to test if it is working: <script type="text/javascript"> $(".sitebox2").each(function(k, v) { var f = $(v).data('fruit'); alert(f); }); </script> It returns undefined. Any ideas on what is going wrong?

    Read the article

  • Flexible string handling in Visual Studio 2008 C++

    - by David
    I'm slowly starting to get the hang of the _T stuff in Visual Studio 2008 c++, but a few things still elude me. I can see the benefit of the flexibility, but if I can't get the basics soon, I think I'll go back to the standard way of doing this - much less confusing. The idea with the code below is that it scans the parameters for -d and then stores the text that follows that in the string variable fileDir. It also ignores any other parameters. Any help is appreciated. //Console application Parameters::Parameters(int argc, _TCHAR* argv[]) { _Tstring fileDir; // Is there some kind of _t variable to use here for a string? for (int i = 0; i < argc; i = i + 1) { if (_tccmp(argv[i], _T("-d")) == 0) // this appeared to accept anything starting with - { i = i + 1; fileDir = argv[i] } } _tprintf("Parameter value found: %s\n", fileDir); }

    Read the article

  • T-SQL get SELECTed value of stored procedure

    - by David
    In T-SQL, this is allowed: DECLARE @SelectedValue int SELECT @SelectedValue = MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 So, it's possible to get the value of a SELECT and stuff it in a variable (provided it's scalar, obviously). If I put the same select logic in a stored procedure: CREATE PROCEDURE GetMyInt AS SELECT MyIntField FROM MyTable WHERE MyPrimaryKeyField = 1 Can I get the output of this stored procedure and stuff it in a variable? Something like: DECLARE @SelectedValue int SELECT @SelectedValue = EXEC GetMyInt (I know the syntax above is not allowed because I tried it!)

    Read the article

  • SoundManager + FFMPEG causing loud popping sound when streaming MP3s?

    - by David
    Hi there, I built an application that plays both uploaded original mp3 files, and copies that have been converted with FFMPEG. I am finding that in some cases the FFMPEG files have a horrible popping/clicking/screeching sound for a split second at startup (hear below). But when I analyze the file in an audio editor there is nothing there, so it seems to be either the browser or soundManager reacting badly to something in that file. Wondering if there is any way I can fix this either by adjusting FFMPEG settings, soundManager settings, or..... Any suggestions? I've uploaded the offending sound in the link below (before the music starts playing). Thanks for your help! Hear sound

    Read the article

  • Manage more Images to move in View

    - by David Pollak
    hi everyone, I'm creating an app which has more UIImageView on a View, they should move normally from a side to the other. I have an issue: after entering the second image, the two UIImageView start to behave crazy (!) because they don' move freely, but they are like restricted in two different areas not touching each other even if I said different things the first thing that I want to do, is to let them move normally; this is the code I am using: `- (void)viewDidLoad { [super viewDidLoad]; pos = CGPointMake(14.0, 7.0); [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(onTimer) userInfo:nil repeats:YES]; }` - (void) onTimer { pallone.center = CGPointMake(pallone.center.x+pos.x, pallone.center.y+pos.y); if(pallone.center.x > 320 || pallone.center.x < 0) pos.x = -pos.x; if(pallone.center.y > 480 || pallone.center.y < 0) pos.y = -pos.y; } and for the other image that has to enter after: - (IBAction)spara{ cos = CGPointMake(8.0, 4.0); [NSTimer scheduledTimerWithTimeInterval:0.05 target:self selector:@selector(inTimer) userInfo:nil repeats:YES]; } - (void)inTimer{ bomba.center = CGPointMake(bomba.center.x+pos.x, bomba.center.y+pos.y); if(bomba.center.x > 50 || bomba.center.x < 0) pos.x = -pos.x; if(bomba.center.y > 480 || bomba.center.y < 0) pos.y = -pos.y; } what should I change ? and if I'd like the images to move only in one way (y) ? how do I do this ? I know, I'm a newbie thanks in advance

    Read the article

  • PHP - Why does my computation produce a different result when I assign it to a variable?

    - by David
    I want to round a number to a specific number of significant digits - basically I want the following function: round(12345.67, 2) -> 12000 round(8888, 3) -> 8890 I have the following, but there's a strange problem. function round_to_sf($number, $sf) { $mostsigplace = floor(log10(abs($number)))+1; $num = $number / pow(10, ($mostsigplace-$sf)); echo ($number / pow(10, ($mostsigplace-$sf))).' '.$num.'<BR>'; } round_to_sf(41918.522, 1); Produces the following output: 4.1918522 -0 How can the result of a computation be different when it's assigned to a variable?

    Read the article

  • h2 & linux. how to start the database?

    - by David
    sorry im rather new to linux ubuntu. i have an application that i made that runs with tomcat and connects to an h2 database. it all works fine on my windows laptop. im now moving it onto my linux computer to run all the time. but im having trouble with starting the database. i have downloaded h2 from their website. and its sitting on my desktop. the question is. how to start the database. and is their any other commands i need to know to run and operate it. thankyous

    Read the article

  • How to reset keyboard for an entry field?

    - by David.Chu.ca
    I am using tag field as a flag for text fields text view fields for auto-jumping to the next field: - (BOOL)findNextEntryFieldAsResponder:(UIControl *)field { BOOL retVal = NO; for (UIView* aView in mEntryFields) { if (aView.tag == (field.tag + 1)) { [aView becomeFirstResponder]; retVal = YES; break; } } return retVal; } It works fine in terms of auto-jumping to the next field when Next key is pressed. However, my case is that the keyboards are different some fields. For example, one fields is numeric & punctuation, and the next one is default (alphabetic keys). For the numeric & punctuation keyboard is OK, but the next field will stay as the same layout. It requires user to press 123 to go back ABC keyboard. I am not sure if there is any way to reset the keyboard for a field as its keyboard defined in xib? Not sure if there is any APIs available? I guess I have to do something is the following delegate? -(void)textFieldDidBegingEditing:(UITextField*) textField { // reset to the keyboard to request specific keyboard view? .... } OK. I found a solution close to my case by slatvik: -(void) textFieldDidBeginEditing:(UITextField*) textField { textField.keyboardType = UIKeybardTypeAlphabet; } However, in the case of the previous text fields is numeric, the keyboard stays numeric when auto-jumped to the next field. Is there any way to set keyboard to alphabet mode?

    Read the article

  • Configure Django project in a subdirectory using mod_python. Admin not working.

    - by David
    HI guys. I was trying to configure my django project in a subdirectory of the root, but didn't get things working.(LOcally it works perfect). I followed the django official django documentarion to deploy a project with mod_python. The real problem is that I am getting "Page not found" errors, whenever I try to go to the admin or any view of my apps. Here is my python.conf file located in /etc/httpd/conf.d/ in Fedora 7 LoadModule python_module modules/mod_python.so SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE mysite.settings PythonOption django.root /mysite PythonDebug On PythonPath "['/var/www/vhosts/mysite.com/httpdocs','/var/www/vhosts/mysite.com/httpdocs/mysite'] + sys.path" I know /var/www/ is not the best place to put my django project, but I just want to send a demo of my work in progress to my customer, later I will change the location. For example. If I go to www.domain.com/mysite/ I get the index view I configured in mysite.urls. But I cannot access to my app.urls (www.domain.com/mysite/app/) and any of the admin.urls.(www.domain.com/mysite/admin/) Here is mysite.urls: urlpatterns = patterns('', url(r'^admin/password_reset/$', 'django.contrib.auth.views.password_reset', name='password_reset'), (r'^password_reset/done/$', 'django.contrib.auth.views.password_reset_done'), (r'^reset/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', 'django.contrib.auth.views.password_reset_confirm'), (r'^reset/done/$', 'django.contrib.auth.views.password_reset_complete'), (r'^$', 'app.views.index'), (r'^admin/', include(admin.site.urls)), (r'^app/', include('mysite.app.urls')), (r'^photologue/', include('photologue.urls')), ) I also tried changing admin.site.urls with ''django.contrib.admin.urls' , but it didn't worked. I googled a lot to solve this problem and read how other developers configure their django project, but didn't find too much information to deploy django in a subdirectory. I have the admin enabled in INSTALLED_APPS and the settings.py is ok. Please if you have any guide or telling me what I am doing wrong it will be much appreciated. THanks.

    Read the article

  • Easily digestible UI tips for developers

    - by David
    What are some key UI design tips that every developer should know? While there are a number of UI resources for developers (for example, Joel Spolsky's User Interface Design for Programmers), I'm interested in more of a bullet list that can be communicated in 1 to 2 pages. I'm interested in more tactical, day-to-day UI tips, as opposed to overarching UI design goals that would be covered in a UI design meeting (presumably attended by at least one person with a good UI sense). A collection of these tips might cover about 80% of the cases that an everyday programmer would come across.

    Read the article

  • document directory for different iphone app targets

    - by David
    I have two targets for my app which both unarchive serialized objects, however the objects made by the two apps are not compatible. these objects seem to be saved to the same document directory so that one app will try to unarchive the other's objects. how do I get the apps to create separate sandboxes so they do not have access each others' saved objects? or do I need to just have each version create differently named files?

    Read the article

  • Not Equal two Generic Lists

    - by David Johnson
    I have two generic lists, both containing different data, except 4 fields, which I want to compare to another list and find items that do not match in either list. I need to basically replace where it says equals below, with not equals! var unMatchedData = from liveLines in liveList join oldList in comapreSnapshotList on new {liveLines.ClientNo, liveLines.SequenceNo, liveLines.LineNo, liveLines.Text} equals new {oldList.ClientNo, oldList.SequenceNo, oldList.LineNo, oldList.Text} select new KNOWTXTS { ClientNo = liveLines.ClientNo, SequenceNo = liveLines.SequenceNo, LineNo = liveLines.LineNo, Text = liveLines.Text };

    Read the article

  • Use CSS (and maybe JavaScript) to make an element be square (or maintain a specific aspect ratio)

    - by David Pfeffer
    I have a div that I want to have the following characteristics: Width = 50% of its parent element Height equal to whatever it needs to be in order to maintain a certain aspect ratio. I need to use percentages because the object will resize left-right when the browser is resized. I want the object to be resized top-bottom to ensure the object maintains the same aspect ratio. I don't think there's any way to use pure CSS to do this, but does anyone know of a way? Alternatively, is there an easy JavaScript way to do this? (JQuery is fine.)

    Read the article

  • Is there a C# equivalent of typeof for properties/methods/members?

    - by David
    A classes Type metadata can be obtained in several ways. Two of them are: var typeInfo = Type.GetType("MyClass") and var typeInfo = typeof(MyClass) The advantage of the second way is that typos will be caught by the compiler, and the IDE can understand what I'm talking about (allowing features like refactoring to work without silently breaking the code) Does there exist an equivalent way of strongly referencing members/properties/methods for metadata and reflection? Can I replace: var propertyInfo = typeof(MyClass).GetProperty("MyProperty") with something like: var propertyInfo = property(MyClass.MyProperty)

    Read the article

  • Facebook API, export group wall entries

    - by Guy David
    After trying to find a reference to an API/tutorial to such thing, I have come here. I would like to scan a specific group wall, pulling all posts from it, with PHP or C#. In the end, I would like to have a nested-array containing each posts, with the next details: An array of the related comments Likes Views Obviously, I don't ask for any code, only a reference to the related API I will need to use. EDIT: If this is not possible, should I consider cURL as an option?

    Read the article

  • Retain numerical precision in an R data frame?

    - by David
    When I create a dataframe from numeric vectors, R seems to truncate the value below the precision that I require in my analysis: data.frame(x=0.99999996) returns 1 (see update 1) I am stuck when fitting spline(x,y) and two of the x values are set to 1 due to rounding while y changes. I could hack around this but I would prefer to use a standard solution if available. example Here is an example data set d <- data.frame(x = c(0.668732936336141, 0.95351462456867, 0.994620622127435, 0.999602102672081, 0.999987126195509, 0.999999955814133, 0.999999999999966), y = c(38.3026509783688, 11.5895099585560, 10.0443344234229, 9.86152339768516, 9.84461434575695, 9.81648333804257, 9.83306725758297)) The following solution works, but I would prefer something that is less subjective: plot(d$x, d$y, ylim=c(0,50)) lines(spline(d$x, d$y),col='grey') #bad fit lines(spline(d[-c(4:6),]$x, d[-c(4:6),]$y),col='red') #reasonable fit Update 1 Since posting this question, I realize that this will return 1 even though the data frame still contains the original value, e.g. > dput(data.frame(x=0.99999999996)) returns structure(list(x = 0.99999999996), .Names = "x", row.names = c(NA, -1L), class = "data.frame") Update 2 After using dput to post this example data set, and some pointers from Dirk, I can see that the problem is not in the truncation of the x values but the limits of the numerical errors in the model that I have used to calculate y. This justifies dropping a few of the equivalent data points (as in the example red line).

    Read the article

< Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >