Search Results

Search found 2396 results on 96 pages for 'alex nauda'.

Page 45/96 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Using ThreadPool.QueueUserWorkItem - thread unexpectedly exits

    - by alex
    I have the following method: public void PutFile(string ID, Stream content) { try { ThreadPool.QueueUserWorkItem(o => putFileWorker(ID, content)); } catch (Exception ex) { OnPutFileError(this, new ExceptionEventArgs { Exception = ex }); } } The putFileWorker method looks like this: private void putFileWorker(string ID, Stream content) { //Get bucket name: var bucketName = getBucketName(ID) .ToLower(); //get file key var fileKey = getFileKey(ID); try { //if the bucket doesn't exist, create it if (!Amazon.S3.Util.AmazonS3Util.DoesS3BucketExist(bucketName, s3client)) s3client.PutBucket(new PutBucketRequest { BucketName = bucketName, BucketRegion = S3Region.EU }); PutObjectRequest request = new PutObjectRequest(); request.WithBucketName(bucketName) .WithKey(fileKey) .WithInputStream(content); S3Response response = s3client.PutObject(request); var xx = response.Headers; OnPutFileCompleted(this, new ValueEventArgs { Value = ID }); } catch (Exception e) { OnPutFileError(this, new ExceptionEventArgs { Exception = e }); } } I've created a little console app to test this. I wire up event handlers for the OnPutFileError and OnPutFileCompleted events. If I call my PutFile method, and step into this, it gets to the "//if the bucket doesn't exist, create it" line, then exits. No exception, no errors, nothing. It doesn't complete (i've set breakpoints on my event handlers too) - it just exits. If I run the same method without the ThreadPool.QueueUserWorkItem then it runs fine... Am I missing something?

    Read the article

  • Multiple Default Routes in ASP.NET MVC to different Default Actions

    - by Alex
    I have multiple controllers with different actions (no "Index" actions). The actions I consider "default" actions, are named differently. I want to create default routes for their names and have the first available action (from my list of default actions) executed if only the controller name is provided in the route. So, for example, I have the following actions which I want to consider default and want checked for their existence in a controller in this order: List() Draw() ViewSingle() The routing should somehow search for /{controller} and then take the first available action from the list above as default action, e.g.: /ControllerA -> ControllerA.List() /ControllerB -> ControllerB.Draw() /ControllerC -> ControllerC.ViewSingle() /ControllerD -> ControllerD.Draw() /ControllerE -> ControllerE.List() Is this possible? I tried creating additional Default actions like this but couldn't get it to work: routes.MapRoute("Default1", "{controller}/{action}", new { controller = UrlParameter.Optional, action = "List" } routes.MapRoute("Default2", "{controller}/{action}", new { controller = UrlParameter.Optional, action = "Draw" } routes.MapRoute("Default3", "{controller}/{action}", new { controller = UrlParameter.Optional, action = "ViewSingle" } Help?

    Read the article

  • Can I get the matched DOM string with PHP and DOMDocument?

    - by alex
    I've got my HTML inside of $html. dom = new DOMDocument(); $dom->loadHTML($html); $xpath = new DOMXPath($dom); $tags = $xpath->query('//div[@id="header"]'); foreach($tags as $tag) { var_dump($tag->nodeValue); // the innerHTML of that element var_dump($tag); // object(DOMElement)#3 (0) { } } Is there a way to get that node, or remove it? Basically, I'm parsing an existing website and need to remove elements from it. What method do I call to do that? Thanks

    Read the article

  • SQL Group By Modulo of Row Count

    - by Alex Czarto
    I have the following sample data: Id Name Quantity 1 Red 1 2 Red 3 3 Blue 1 4 Red 1 5 Yellow 3 So for this example, there are a total of 5 Red, 1 Blue, and 3 Yellow. I am looking for a way to group them by Color, but with a maximum of 2 items per group (sorting is not important). Like so: Name QuantityInPackage Red 2 Red 2 Red 1 Blue 1 Yellow 2 Yellow 1 Any suggestions on how to accomplish this using T-SQL on MS-SQL 2005?

    Read the article

  • how to precompile a jquery ui autocomplete widget?

    - by Alex
    Hello, I have a jquery ui autocomplete widget in a form and I'd like to preselect its value from a database. My autocomplete works in the following way: the id is a number, tha label and the value are the same and are a concatenation of id + " - " + description. When a value from the autocomplete is selected, a hidden field's value is set to the value of id. Then, the hidden field value is saved to the db when the form is submitted. When the user comes back on the page for editing, I need to reload the value from the db: I set the idden field value again and then I would like to precompile the value of the autocomplete widget with the concatenation of id + " - " + description taken form the db. I think I should trigger the event of selecting a row in the autocomplete, but I don't know how to do. Do you have any ideas? Thank you Here is the code of the autocomplete: $('#codice_contratto').autocomplete({ source: 'do_contratto.php', select: function(event, ui) { $('#id_contratto').val(ui.item.id); } });

    Read the article

  • Django version in GAE

    - by Alex
    I'm tring to use Django 1.1 in GAE, But when I uncomment use_library('django', '1.1') in this script import os os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' from google.appengine.dist import use_library #use_library('django', '1.1') # Google App Engine imports. from google.appengine.ext.webapp import util # Force Django to reload its settings. from django.conf import settings settings._target = None import django.core.handlers.wsgi import django.core.signals import django.db import django.dispatch.dispatcher # Unregister the rollback event handler. django.dispatch.dispatcher.disconnect( django.db._rollback_on_exception, django.core.signals.got_request_exception) def main(): # Create a Django application for WSGI. application = django.core.handlers.wsgi.WSGIHandler() # Run the WSGI CGI handler with that application. util.run_wsgi_app(application) if __name__ == "__main__": main() I receives AttributeError: 'module' object has no attribute 'disconnect' What is going on?

    Read the article

  • How to copy child nodes to another xml document?

    - by Alex
    Below is my xml XML1 <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>1</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>2</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG> XML2 <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>3</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> </CATALOG> i need output like this <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>1</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>2</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>3</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> </CATALOG> How i write this in classic asp ?

    Read the article

  • ASP.NET EnqityDataSource WhereParameters, creates new property.

    - by Alex
    I am trying to populate GridView, using EntityDataSource(code behind), I need to able to sort GridView. However when I sort i get error: A property with name 'aspnet_Users.UserId1' does not exist in metadata for entity type So I beleive it is because I generate where parameter in code behind: ActiveEnqDataSource.WhereParameters.Add(new SessionParameter("aspnet_Users.UserId", TypeCode.Object, "UserName")); Full code is : ActiveEnqDataSource.ConnectionString = db.Connection.ConnectionString; ActiveEnqDataSource.DefaultContainerName = "Entities"; ActiveEnqDataSource.EntitySetName = "Enquiries"; ActiveEnqDataSource.Include = "UserCars.CarModel.CarMake, Category, aspnet_Users"; ActiveEnqDataSource.EnableUpdate = true; ActiveEnqDataSource.EnableInsert = true; ActiveEnqDataSource.EnableDelete = true; ActiveEnqDataSource.AutoGenerateWhereClause = true; ActiveEnqDataSource.WhereParameters.Add(new SessionParameter("aspnet_Users.UserId", TypeCode.Object, "UserName")); Any suggestions? Thank you very much! The gridview itself renders perfectly, only thing I cannot sort it, any "whereParameters" I add, Add 1 to the property e.g UserId1,EnquiryStatus1, ProdauctName1. etc...

    Read the article

  • What is the MacVim default font?

    - by Alex
    Hey there, I love using macvim, and I really like the default font, but at work I recently got some bigger monitors, and I want to make the text bigger. It says in the macvim docs that it is Bitstream Vera, but trying to set the font like so: :set guifont=Bitstream\ Vera\ Sans\ Mono:h16 results in an invalid font(s) error. So what is the default font then? I'm running the latest version of macvim and I am running Snow Leopard. Thanks!!

    Read the article

  • Why scala not allowing '$' identifier in case statement?

    - by Alex R
    this works as expected scala 3 match { case x:Int = 2*x } res1: Int = 6 why does this fail? scala 3 match { case $x:Int = 2*$x } :1: error: '=' expected but ':' found. 3 match { case $x:Int = 2*$x } ^ scala 3 match { case `$x`:Int = 2*$x } :1: error: '=' expected but ':' found. 3 match { case `$x`:Int = 2*$x } ^ scala 3 match { case `$x` : Int = 2*$x } :1: error: '=' expected but ':' found. 3 match { case `$x` : Int = 2*$x } '$' is supposed to be a valid identifier character, as demonstrated here: scala var y = 1 y: Int = 1 scala var $y = 2 $y: Int = 2 Thanks

    Read the article

  • How to copy matplotlib figure?

    - by Alex
    I have FigureCanvasWxAgg instance with a figure displayed on a frame. If user clicks on the canvas another frame with a new FigureCanvasWxAgg containing the same figure will be shown. By now closing the new frame can result in destroying the C++ part of the figure so that it won't be available for the first frame. How can I save the figure? Python deepcopy from copy module does't work in this case. Thanks in advance.

    Read the article

  • How to display a picture stored in database in the ASP.NET DetailsView?

    - by Alex
    Hi, I'm having a problem of displaying a picture in the DetailsView..what is the way to bind it with the DetailsView?My picture is retrieved from database and put with other needed information in a dataset..how can i extract it from dataset and bind with a particular field of DetailsView in order to display it? I would really appreciate any help Thanks

    Read the article

  • Multiple Application Support Directories for iPhone Simulator?

    - by Alex G
    I am developing an iPhone app with someone else. The app works fine for me, but he is running into a bug. We think this bug is related to the fact that he is getting multiple Application directories for this same app. In my ~/Library/Application Support/iPhone Simulator/User/Applications, I only have one folder at all times. He says that he will get 3 or 4 directories when he is only working on this one app. We think this is our problem because our bug has to do with displaying images that are stored in the app's Documents folder. Does anyone know why he is ending up with multiple directories or how to stop it? Edit: Here is the code for writing the image to a file: NSData *image = [NSData dataWithContentsOfURL:[NSURL URLWithString:[currentArticle articleImage]]]; NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *imagePath = [array objectAtIndex:0]; NSFileManager *NSFM = [NSFileManager defaultManager]; BOOL isDir = YES; if(![NSFM fileExistsAtPath:imagePath isDirectory:&isDir]) if(![NSFM createDirectoryAtPath:imagePath attributes:nil]) NSLog(@"error"); imagePath = [imagePath stringByAppendingFormat:@"/images"]; if(![NSFM fileExistsAtPath:imagePath isDirectory:&isDir]) if(![NSFM createDirectoryAtPath:imagePath attributes:nil]) NSLog(@"error"); imagePath = [imagePath stringByAppendingFormat:@"/%@.jpg", [currentArticle uniqueID]]; [image writeToFile:imagePath atomically:NO]; And here is the code for getting the path when I need the image: - (NSString *)imagePath { NSArray *array = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *imagePath = [array objectAtIndex:0]; return [imagePath stringByAppendingFormat:@"/images/%@.jpg", [self uniqueID]]; } The app works great for me, but my partner says that the images don't show up intermittently, and he notices that he gets multiple directories in his Applications folder.

    Read the article

  • Simple question about WinForms and ListView

    - by Alex
    Hello I have a ListView in my WinForms application. ListWiew has 4 columns. So i want to write string in fourth column on every LisViewItem. When i try it. foreach (ListViewItem item in lvData.Items) { item.SubItems[3].Text ="something"; } i get an exception InvalidArgument=Value of '4' is not valid for 'index'. Parameter name: index What's wrong?

    Read the article

  • Can one use polygon() or equivalent in lattice and ggplot2 plots?

    - by Alex Reynolds
    Is it possible to annotate lattice (or ggplot2) figures with elements created with polygon() (or elements created with a similar function) from the graphics library? I'm not too familiar with either library beyond examples of simple graphs posted on the web and printed in Deepayan Sarkar's book. Therefore, while I have code for what I've been doing in R with the graphics library, pointing me to relevant, equivalent functions and usage examples for lattice or ggplot2 specifically would be appreciated. Thanks.

    Read the article

  • How to walk through two files simultaneously in Perl?

    - by Alex Reynolds
    I have two text files that contain columnar data of the variety position-value. Here is an example of the first file (file A): 100 1 101 1 102 0 103 2 104 1 ... Here is an example of the second file (B): 20 0 21 0 ... 100 2 101 1 192 3 193 1 ... Instead of reading one of the two files into a hash table, which is prohibitive due to memory constraints, what I would like to do is walk through two files simultaneously, in a stepwise fashion. What this means is that I would like to stream through lines of either A or B and compare position values. If the two positions are equal, then I perform a calculation on the values associated with that position. Otherwise, if the positions are not equal, I move through lines of file A or file B until the positions are equal (when I again perform my calculation) or I reach EOF of both files. Is there a way to do this in Perl?

    Read the article

  • How do I add programmatically-generated new files to source control?

    - by Alex Basson
    This is something I've never really understood about source control, specifically Subversion (the only source control I've ever used, which isn't saying much). I'm considering moving to git or Mercurial, so if that affects the answer to my question, please indicate as such. Ok. As I understand it, every time I create a new file, I have to tell SVN about it, so that it knows to add it to the repository and place it under control. Something like: svn add newfile That's fine if I'm the one creating the file: I know I created it, I know its name, I know where it lives, so it's easy to tell SVN about it. But now suppose I'm using a framework of some kind, like Rails, Django, Symfony, etc., and suppose I've already done the initial commit. All of these frameworks create new files programmatically, often many at once, in different directories, etc. etc. How do I tell the source control about these new files? Do I have to hunt each one of them down individually and add them? Is there an easier way? (Or am I possibly misunderstanding something fundamental about source control?)

    Read the article

  • iphone maps GPS icon

    - by Alex L
    I would like to make a button that centers the map on the current GPS location. Google Maps app has that icon on bottom left. Where can I get that icon. Is it embedded in the SDK?

    Read the article

  • Setting up DomainKeys/DKIM in a PHP-based SMTP client

    - by Alex
    It looks like there are some great libraries out there to do DomainKeys signing of emails on C#/.NET, but I'm having a really hard time finding the same kind of support for PHP. Maybe I'm not looking in the right place? The only one I found is http://php-dkim.sourceforge.net/; it looks incredibly hacky and supports PHP4 only. Considering how popular PHP is, and how critical DomainKeys are for email classification as non-spam, I'd expect better tools; do you know of any? Any other tricks you'd recommend?

    Read the article

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