Daily Archives

Articles indexed Friday April 30 2010

Page 27/114 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Socket select() Handling Abrupt Disconnections

    - by Genesis
    I am currently trying to fix a bug in a proxy server I have written relating to the socket select() call. I am using the Poco C++ libraries (using SocketReactor) and the issue is actually in the Poco code which may be a bug but I have yet to receive any confirmation of this from them. What is happening is whenever a connection abruptly terminates the socket select() call is returning immediately which is what I believe it is meant to do? Anyway, it returns all of the disconnected sockets within the readable set of file descriptors but the problem is that an exception "Socket is not connected" is thrown when Poco tries to fire the onReadable event handler which is where I would be putting the code to deal with this. Given that the exception is silently caught and the onReadable event is never fired, the select() call keeps returning immediately resulting in an infinite loop in the SocketReactor. I was considering modifying the Poco code so that rather than catching the exception silently it fires a new event called onDisconnected or something like that so that a cleanup can be performed. My question is, are there any elegant ways of determining whether a socket has closed abnormally using select() calls? I was thinking of using the exception message to determine when this has occured but this seems dirty to me.

    Read the article

  • Magento and configurable product attributes

    - by artega
    I have an issue with displaying product custom attributes. I've read every resources through google but still no success. The problem is that I have to show size attribute of configurable product on category grid and list view. Every solution on google suggested something like $_product->getAttributeText('size') but I ended up at just a single string - "S" or "M" instead of an array. How can I fetch all possible sizes of all simple products which belongs to particular configurable product without much hassle?

    Read the article

  • field<t> invalid cast

    - by Zwempha
    I'm having problems when using linq on a datatable.asenumerable(). This throws InvalidCastException. DateTime date=r.Field<DateTime>("date"); This works fine. DateTime date = DateTime.Parse(r.Field<string>("date")); What am I missing? Regards Sven

    Read the article

  • How to Create a Simple Dictation Pad in Delphi2009+Vista

    - by XBasic3000
    the code are not so complecated.. private { Private declarations } SpSharedRecoContext1 : TSpSharedRecoContext; fMyGrammar : ISpeechRecoGrammar; procedure SpSharedRecoContext1Recognition(ASender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; RecognitionType: SpeechRecognitionType; const Result: ISpeechRecoResult); procedure SpSharedRecoContext1Hypothesis(ASender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; const Result: ISpeechRecoResult); procedure TForm1.FormCreate(Sender: TObject); begin SpSharedRecoContext1 := TSpSharedRecoContext.Create(self); SpSharedRecoContext1.OnHypothesis := SpSharedRecoContext1Hypothesis; SpSharedRecoContext1.OnRecognition :=SpSharedRecoContext1Recognition; fMyGrammar := SpSharedRecoContext1.CreateGrammar(0); fMyGrammar.DictationSetState(SGDSActive); end; procedure TForm1.SpSharedRecoContext1Recognition(ASender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; RecognitionType: SpeechRecognitionType; const Result: ISpeechRecoResult); begin Memo1.Text := Result.PhraseInfo.GetText(0,-1,true); end; procedure TForm1.SpSharedRecoContext1Hypothesis(ASender: TObject; StreamNumber: Integer; StreamPosition: OleVariant; const Result: ISpeechRecoResult); begin Memo1.Text := Result.PhraseInfo.GetText(0,-1,true); end; My Problem, was the vista-OS voice command will intercept on my program. if i say "START", instead of writing start on memo1 it press the start menu on my desktop. or what ever command like START CANCEL EDIT DELETE SELECT etc. please help..... sorry for my english

    Read the article

  • Using INotifyPropertyChanged in background threads

    - by digitaldias
    Following up on a previous blog post where I exemplify databinding to objects, a reader was having some trouble with getting the UI to update. Here’s the rough UI: The idea is, when pressing Start, a background worker process starts ticking at the specified interval, then proceeds to increment the databound Elapsed value. The problem is that event propagation is limeted to current thread, meaning, you fire an event in one thread, then other threads of the same application will not catch it. The Code behind So, somewhere in my ViewModel, I have a corresponding bethod Start that initiates a background worker, for example: public void Start( ) { BackgroundWorker backgroundWorker = new BackgroundWorker( ); backgroundWorker.DoWork += IncrementTimerValue; backgroundWorker.RunWorkerAsync( ); } protected void IncrementTimerValue( object sender, DoWorkEventArgs e ) { do { if( this.ElapsedMs == 100 ) this.ElapsedMs = 0; else this.ElapsedMs++; }while( true ); } Assuming that there is a property: public int ElapsedMs { get { return _elapsedMs; } set { if( _elapsedMs == value ) return; _elapsedMs = value; NotifyThatPropertyChanged( "ElapsedMs" ); } } The above code will not work. If you step into this code in debug, you will find that INotifyPropertyChanged is called, but it does so in a different thread, and thus the UI never catches it, and does not update. One solution Knowing that the background thread updates the ElapsedMs member gives me a chance to activate BackgroundWorker class’ progress reporting mechanism to simply alert the main thread that something has happened, and that it is probably a good idea to refresh the ElapsedMs binding. public void Start( ) { BackgroundWorker backgroundWorker = new BackgroundWorker( ); backgroundWorker.DoWork += IncrementTimerValue; // Listen for progress report events backgroundWorker.WorkerReportsProgress = true; // Tell the UI that ElapsedMs needs to update backgroundWorker.RunWorkerCompleted += ( sender, e ) => { NotifyThatPropertyChanged( "ElapsedMs" ) }; backgroundWorker.RunWorkerAsync( ); } protected void IncrementTimerValue( object sender, DoWorkEventArgs e ) { do { if( this.ElapsedMs == 100 ) this.ElapsedMs = 0; else this.ElapsedMs++; // report any progress ( sender as BackgroundWorker ).ReportProgress( 0 ); }while( true ); } What happens above now is that I’ve used the BackgroundWorker cross thread mechanism to alert me of when it is ok for the UI to update it’s ElapsedMs field. Because the property itself is being updated in a different thread, I’m removing the NotifyThatPropertyChanged call from it’s Set method, and moving that responsability to the anonymous method that I created in the Start method. This is one way of solving the issue of having a background thread update your UI. I would be happy to hear of other cross-threading mechanisms for working in a MCP/MVC/MVVM pattern.

    Read the article

  • PLS HLP Chrome & Internet Explorer won't connect after infected Fire Fox works.

    - by Zack
    HI Guys Please Help I am pretty New Here. I'm having problems. Cannot connect with chrome or Internet Explorer. Fire Fox works fine. It seems it happens when I was infected by a "Trojan Horse Generic 17.BWIK" and a "Trojan Horse SHeur.UHL", when I reply to a post for a Thread I posted. I have removed the treat and got Fire Fox working, "so i think", but not G'Chrome or IE still cannot connect. I do not want to loose Chrome History so re-setting would be my last option and uninstall and install will be out of the question. Is there a way around this? I am using XP Pro on a desktop and DSL connection. Be aware from "Fake_Antispyware.FAH", which I had on my computer, I just found out while doing this, according to my AVG anti-virus security. Please can you direct me for a cure. Thank you in advance for your sincere willingness contributions.

    Read the article

  • How do I combine 3 date columns from 3 tables in Foxpro sql?

    - by Tass-man
    I am writing a foxpro sql & need to combine three date columns from three different tables into a new date column. As an example if the three tables are A,B,& C and the date Columns are Adate, Bdate and Cdate, how do I combine them as distinct and separate dates into a column called TransDate and in the SQL? I would appreciate samples of the code if possible, as I am very new at this

    Read the article

  • Please help, looking for any answer for long time :How to use SqlDataSource Control to work with Dro

    - by Shantanu Gupta
    I am trying to fetch a column value from a datasource when some value is selected from a dropdownlist on its change event. <asp:DropDownList ID="ddlCityName" runat="server" DataSourceID="dsCity" DataTextField="CityName" DataValueField="CityID" AutoPostBack="True" OnTextChanged="CityName_OnTextChanged"> </asp:DropDownList> <asp:SqlDataSource ID="dsCity" runat="server" ConnectionString="<%$ ConnectionStrings:GmapConnectionString %>" SelectCommand="SELECT * FROM [vcity]" ></asp:SqlDataSource> Here I want to fetch any other column's value that is not binded to a ddlCityName from sqldatasource. I have four columns in datasource i.e. name, id, address, phno. I want to fetch an address of a person who selects some value from ddl.

    Read the article

  • How to build an easy Rails authentication with OpenID and OAuth1.0a-2.0?

    - by Andrei
    Hi, I'am looking for an easy authentication for my users mostly via facebook, but keeping OpenID and other OAuth alternatives as well. For the case if something will go very bad, I will ask my users to optionally provide their email address, which should be obtained via OpenID or OAuth if possible. The same thing is about their name. I am a newbie in Rails, so I started with Railscasts.com #160 (authlogic) and #170 (authlogic and OpenID), however, I had some problems trying to sign in with my Google Account. As I understand, it will take some effort to adjust #170 for my objectives. On the other hand, there is gem authlogic_rpx which will possibly provide me the needed functionality (see http://rails-authlogic-rpx-sample.heroku.com/signin). What would you do? Is it reasonable to put one more step (RPX) in the authentication logic?

    Read the article

  • how to copy files from TFS to clear case??

    - by barry
    Can i use powershell script to copy a set of files from a folder to Clear Case..?? i have the task of synchronising files from TFS to Clear Case.. like i need to take a set of files aftr a certain date from tfs server and synchronise these files to Clear case..

    Read the article

  • Jquery animation in firefox

    - by Ravindra Soni
    i am using following code for animation using jquery. when i click on a list element, the corresponding div slides down and opacity goes to ‘1’. When i click other list element, the previos one goes up and fades, and the next one come down. var id_prev; var id_new; $("#tag ul li ").click(function(event){ var i = $(this).index()+1; var id_new="#person"+i; if(id_new != id_prev){ $(id_prev).animate({top:'300px',opacity:'0'},500); $(id_prev).delay(200).css({'z-index':'0'}); $(id_new).delay(200).css({'z-index':'300'}); $(id_new).delay(200).animate({top:'300px',opacity:'0'},500); $(id_new).delay(200).animate({top:'330px',opacity:'1'},500); id_prev = id_new; } });

    Read the article

  • Java Caching on distributed environment

    - by Naren
    Hi, I am supposed to create a simple replicated cache using java for internal purpose which will be used in a distributed environment. I have seen oracle has implemented Replicated Cache Service. http://wiki.tangosol.com/display/COH32UG/Replicated+Cache+Service The problem I am facing is while doing an update or remove, I acquire lock on other cache's to the point the cache get's updated and notifies others of the change. This is eventually going into a dead lock situation, while removing. Is there any strategy I should follow while updating or removing from cache's. Can I implement a replicated cache without having a primary cache?? Thanks, Naren

    Read the article

  • Custom webserver caching

    - by Mark Kinsella
    I'm working with a custom webserver on an embedded system and having some problems correctly setting my HTTP Headers for caching. Our webserver is generating all dynamic content as XML and we're using semi-static XSL files to display it with some dynamic JSON requests thrown in for good measure along with semi-static images. I say "semi-static" because the problems occur when we need to do a firmware update which might change the XSL and image files. Here's what needs to be done: cache the XSL and image files and do not cache the XML and JSON responses. I have full control over the HTTP response and am currently: Using ETags with the XSL and image files, using the modified time and size to generate the ETag Setting Cache-Control: no-cache on the XML and JSON responses As I said, everything works dandy until a firmware update when the XSL and image files are sometimes cached. I've seen it work fine with the latest versions of Firefox and Safari but have had some problems with IE. I know one solution to this problem would be simply rename the XSL and image files after each version (eg. logo-v1.1.png, logo-v1.2.png) and set the Expires header to a date in the future but this would be difficult with the XSL files and I'd like to avoid this. Note: There is a clock on the unit but requires the user to set it and might not be 100% reliable which is what might be causing my caching issues when using ETags. What's the best practice that I should employ? I'd like to avoid as many webserver requests as possible but invalidating old XSL and image files after a software update is the #1 priority.

    Read the article

  • Hidden Features of Delphi

    - by JosephStyons
    The "Hidden Features" series here on StackOverflow has generated some really interesting feedback. So what about my favorite IDE, Delphi? What are some hidden features there? I'll start with one of my own: You can invoke inline find by typing Ctrl+E, then typing your search term.

    Read the article

  • Adding an observer to UIImageView? observer & notifications

    - by sagar
    Each class has almost one method named addObserver [imgVURL addObserver:<#(NSObject *)observer#> forKeyPath:<#(NSString *)keyPath#> options:<#(NSKeyValueObservingOptions)options#> context:<#(void *)context#>] Here, imgVURL is an image which is going to be load an image asynchronously. When image will be loaded dynamically - other class will set an image from loaded data. Now, my question is how can we add an observer to UIImageView's instance. Observer and notifications are same or not ? If it is not then what's different ? Let's have some sample code That I did in my project to understand my question. // locating image view from Scroll view by it's tag imgVURL=(UIImageView*)[scrMain viewWithTag:(kTagImagesTag+i)]; // ImageViewURL is a class which contains methods of // didReceiveResponse // didReceiveData // connection ImageViewURL *tmp=[[ImageViewURL alloc] init]; // it has a nonatomic property which will take the reference of my image view tmp.imgV=imgVURL; // now I will pass a url from my an array to property strURL // in strUrl I have custom setter // in which I am initializing a connection tmp.strUrl=[NSURL URLWithString:[[tblmain objectAtIndex:i] valueForKey:@"url"]]; // from ImageViewURL.m file -(void)connectionDidFinishLoading:(NSURLConnection *)connection { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; // NSLog@"ImageView Ref From - %@",imgV); // see imgV has reference of my -> imgVURL (nonatomic,assign) imgV.image=[UIImage imageWithData:myWebData]; [connection release]; connection=nil; } // as you can see in above code many many images are loaded asynchronously // now How can I add an observer to an imageview whether it received or not.

    Read the article

  • Animated transitions in WPF

    - by arconaut
    I can't figure out what I'm missing here. Here's the problem: Consider a (Control|Data)Template with a Trigger that switches visibility of some inner UI elements. E.g. show a TextBlock when IsReadOnly==true and show a TextBox when IsReadOnly==false. Everything is perfect if you do this without animation - one or two setters would do the job. But what if you want a fancy animation? Then you would specify which animations to start in EnterActions and ExitActions. But the problem is what exactly the animations should do? Modifying width/height seems really ugly, because fixed sizes in WPF are almost always a wrong way to go and also it's absolutely unflexible. So far, the best I've come up with is modifying MaxHeight/MaxWidth to some extent, this gives just a little more flexibility but still seems brutal. How do you tell WPF to animate Width/Height of an element from 0 to "as much as needed"? UPD: Currently I do animate Opacity and RenderTransform, and it works. It's just that sometimes I'd like to see animations where elements slide around without transformation. This is not a critical question, but a quite interesting one for me.

    Read the article

  • Is sending a hashed password over the wire a security hole?

    - by Ubiquitous Che
    I've come across a system that is in use by a company that we are considering partnering with on a medium-sized (for us, not them) project. They have a web service that we will need to integrate with. My current understanding of proper username/password management is that the username may be stored as plaintext in the database. Every user should have a unique pseudo-random salt, which may also be stored in plaintext. The text of their password must be concatenated with the salt and then this combined string may be hashed and stored in the database in an nvarchar field. So long as passwords are submitted to the website (or web service) over plaintext, everything should be just lovely. Feel free to rip into my understanding as summarized above if I'm wrong. Anyway, back to the subject at hand. The WebService run by this potential partner doesn't accept username and password, which I had anticipated. Instead, it accepts two string fields named 'Username' and 'PasswordHash'. The 'PasswordHash' value that I have been given does indeed look like a hash, and not just a value for a mis-named password field. This is raising a red flag for me. I'm not sure why, but I feel uncomfortable sending a hashed password over the wire for some reason. Off the top of my head I can't think of a reason why this would be a bad thing... Technically, the hash is available on the database anyway. But it's making me nervous, and I'm not sure if there's a reason for this or if I'm just being paranoid.

    Read the article

  • The difference between desktop-series HDD drives and server-series

    - by FractalizeR
    Hello. What are the main differences between desktop-series hard disks and server-series? The obvious things I can see are: durability (server hardware mostly more qualitative and have more warranty) and power consumption (server hardware more focused on performance, than on power economy). Also server disks are usually a little faster, but it seems, that it is not always the case. May be there are some other reasons, that make you choose server-oriented series (Seagate ES drives, for example) over desktop-oriented ones (Seagate Barracuda series)? What are they?

    Read the article

  • Where to find a tag based file manager?

    - by samoanbiscuit
    I'm a CS uni student in a country with limited bandwidth, and I find that I download files (particularly install files) for reuse\reinstallation\giving to my friends.. I've kept these files in different folders, and now find it extremely hard to find them, and keeping track of obselete files (the almost weekly releases of iTunes versions, or latest 7zip release or the .Net framework installers). What I would like to find is a file manager that could support tags, so instead of hierachical folders, i could find\view files according to their tags...

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >