Search Results

Search found 5313 results on 213 pages for 'steve care'.

Page 51/213 | < Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >

  • How to drop/restart a client connection to a flaky socket server

    - by Steve Prior
    I've got Java code which makes requests via sockets from a server written in C++. The communication is simply that the java code writes a line for a request and the server then writes a line in response, but sometimes it seems that the server doesn't respond, so I've implemented an ExecutorService based timeout which tries to drop and restart the connection. To work with the connection I keep: Socket server; PrintWriter out; BufferedReader in; so setting up the connection is a matter of: server = new Socket(hostname, port); out = new PrintWriter(new OutputStreamWriter(server.getOutputStream())); in = new BufferedReader(new InputStreamReader(socket.getInputStream())); If it weren't for the timeout code the request/receive steps are simply: String request="some request"; out.println(request); out.flush(); String response = in.readLine(); When I received a timeout I was trying to close the connection with: in.close(); out.close(); socket.close(); but one of these closes seems to block and never return. Can anyone give me a clue why one of these would block and what would be the proper way to abandon the connection and not end up with resource leak issues?

    Read the article

  • Adding on touch event to images inside gridview

    - by Steve
    I have a gridview where each item has a image and a textview (an app), i added the onItemClick to the gridview in order to launch the app, i also removed the orange selection and made selector in xml so when pressed the text would change to grey and on release it would return to white. My problem is that i need the image to apply an alpha value when pressed and restore the previous alpha on release i tested a lot of ways and none did worked correctly. I came close with the updated answer from the autor of the question: How to set alpha value for drawable in a StateListDrawable?, but some how the state pressed never gets called, i don´t know if this is because i am using the onitemClick to launch the app or not. Also i since i can´t define the alpha on imageview xml i don´t know what else to do Any help will be appreciated

    Read the article

  • in haskell, why do I need to specify type constraints, why can't the compiler figure them out?

    - by Steve
    Consider the function, add a b = a + b This works: *Main> add 1 2 3 However, if I add a type signature specifying that I want to add things of the same type: add :: a -> a -> a add a b = a + b I get an error: test.hs:3:10: Could not deduce (Num a) from the context () arising from a use of `+' at test.hs:3:10-14 Possible fix: add (Num a) to the context of the type signature for `add' In the expression: a + b In the definition of `add': add a b = a + b So GHC clearly can deduce that I need the Num type constraint, since it just told me: add :: Num a => a -> a -> a add a b = a + b Works. Why does GHC require me to add the type constraint? If I'm doing generic programming, why can't it just work for anything that knows how to use the + operator? In C++ template programming, you can do this easily: #include <string> #include <cstdio> using namespace std; template<typename T> T add(T a, T b) { return a + b; } int main() { printf("%d, %f, %s\n", add(1, 2), add(1.0, 3.4), add(string("foo"), string("bar")).c_str()); return 0; } The compiler figures out the types of the arguments to add and generates a version of the function for that type. There seems to be a fundamental difference in Haskell's approach, can you describe it, and discuss the trade-offs? It seems to me like it would be resolved if GHC simply filled in the type constraint for me, since it obviously decided it was needed. Still, why the type constraint at all? Why not just compile successfully as long as the function is only used in a valid context where the arguments are in Num? Thank you.

    Read the article

  • actionscript 3 website load movieclips (frames) from library

    - by steve
    Here is my current code that doesn't function: import flash.display.*; import fl.transitions.*; import flash.events.MouseEvent; stop(); var contentBox:MovieClip = new MovieClip(); contentBox.width = 400; contentBox.height = 500; contentBox.x = 400; contentBox.y = 0; var closeBtn:close_btn = new close_btn(); closeBtn.x = 850; closeBtn.y = 15; var bagLink:MovieClip = new bag_link_mc(); bagLink.x = 900; bagLink.y = 0; menu_bag_button.addEventListener(MouseEvent.CLICK, bagClick); function bagClick(event:MouseEvent):void{ if(MovieClip(root).currentFrame == 835) { } else { MovieClip(root).addChild (contentBox); MovieClip(root).contentBox.addChild (bagLink); MovieClip(root).contentBox.addChild (closeBtn); MovieClip(root).gotoAndPlay(806); } } closeBtn.addEventListener(MouseEvent.CLICK, closeBag); function closeBag (event:MouseEvent):void{ MovieClip(root).removeChild(contentBox); MovieClip(root).gotoAndPlay(850); } I don't know ActionScript at all, so this may be the complete wrong way of approaching it. The setup is as follows: site loads, there's a big menu in the center (frame 805). When you click on a menu item from there, the whole menu moves to the side, and the right side I want a "contentBox" movieclip, filled with "bagLink" (which is site content) and to have a close button (closeBtn.) It also needs to know that if you click the same link again on the left side that it doesn't reanimate, it just stays (which I achieved with the "if" statement.) Finally, if someone clicks another link, it needs to clear "contentBox" and refill it with whatever movieClip that was clicked. I know this is a lot to ask, but I'm in dire need of help as this is due on Wednesday...

    Read the article

  • How do I get a Horizontal ListBox to scroll horizontally in WP7?

    - by Steve Steiner
    I'm attempting to use the code below to make a horizontal listbox in WP7 silverlight. The items appear horizontally but the scrolling is still vertical. Am I doing something wrong in wpf? Is this a WP7 specific bug?. <Style TargetType="ListBox" x:Name="HorizontalListBox"> <Setter Property="ItemsPanel"> <Setter.Value> <ItemsPanelTemplate> <VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True" CanHorizontallyScroll="True" CanVerticallyScroll="False"/> </ItemsPanelTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • Refactoring Rspec specs

    - by Steve Weet
    I am trying to cleanup my specs as they are becoming extremely repetitive. I have the following spec describe "Countries API" do it "should render a country list" do co1 = Factory(:country) co2 = Factory(:country) result = invoke :GetCountryList, "empty_auth" result.should be_an_instance_of(Api::GetCountryListReply) result.status.should be_an_instance_of(Api::SoapStatus) result.status.code.should eql 0 result.status.errors.should be_an_instance_of Array result.status.errors.length.should eql 0 result.country_list.should be_an_instance_of Array result.country_list.first.should be_an_instance_of(Api::Country) result.country_list.should have(2).items end it_should_behave_like "All Web Services" it "should render a non-zero status for an invalid request" end The block of code that checks the status will appear in all of my specs for 50-60 APIs. My first thought was to move that to a method and that refactoring certainly makes things much drier as follows :- def status_should_be_valid(status) status.should be_an_instance_of(Api::SoapStatus) status.code.should eql 0 status.errors.should be_an_instance_of Array status.errors.length.should eql 0 end describe "Countries API" do it "should render a country list" do co1 = Factory(:country) co2 = Factory(:country) result = invoke :GetCountryList, "empty_auth" result.should be_an_instance_of(Api::GetCountryListReply) status_should_be_valid(result.status) result.country_list.should be_an_instance_of Array result.country_list.first.should be_an_instance_of(Api::Country) result.country_list.should have(2).items end end This works however I can not help feeling that this is not the "right" way to do it and I should be using shared specs, however looking at the method for defining shared specs I can not easily see how I would refactor this example to use a shared spec. How would I do this with shared specs and without having to re-run the relatively costly block at the beginning namely co1 = Factory(:country) co2 = Factory(:country) result = invoke :GetCountryList, "empty_auth"

    Read the article

  • relating to objects inside an object

    - by steve
    Got a problem, I have an an array of objects inside a constructor of a class. I'm trying to use the array to relate to a property in the object but I can't relate to them. lessonObjectsArray(0) = lessonObject1 lessonObjectsArray(1) = lessonObject2 lessonObjectsArray(2) = lessonObject3 the properties of the object "lessonObject1" are lessonName, videoLink, pdfLink I thought it would be tbTest.text = lessonObjectsArray(0).lessonObject1.lessonName just doesnt work

    Read the article

  • PHP cookies in a session handler

    - by steve
    I have run into a very interesting problem trying to debug my custom php session handler. For some reason unknown to me I can set cookies all the way through the session handler right up until the very start of the write function. As far as I know session handler calls go in this order. open - read - write - close The open function sets a cookie just fine. function open($save_path,$session_name) { require_once('database.php'); require_once('websiteinfo.php'); mysql_connect($sqllocation,$sql_session_user,$sql_session_pass); @mysql_select_db($sql_default_db); date_default_timezone_set('America/Los_Angeles'); setcookie("test","test"); return TRUE; } The read function can set a cookie right up until the very moment it returns a value. function read($session_id) { $time = time(); $query = "SELECT * FROM 'sessions' WHERE 'expires' > '$time'"; $query_result = mysql_query($query); $data = ''; /* fetch the array and start sifting through it */ while($session_array = mysql_fetch_array($query_result)) { /* strip the slashes from the session array */ $session_array = $this->strip($session_array); /* authenticate the user and if so return the session data */ if($this->auth_check($session_array,$session_id)) { $data = $session_array['data']; } } setcookie("testcookie1","value1",time()+1000,'/'); return $data; } The very first line of the write function is setting another cookie and it cannot because the headers are already sent. Any ideas anyone? Thanks in advance

    Read the article

  • Agile web development with rails

    - by Steve
    Hi.. This code is from the agile web development with rails book.. I don't understand this part of the code... User is a model which has name,hashed_password,salt as its fields. But in the code they are mentioning about password and password confirmation, while there are no such fields in the model. Model has only hashed_password. I am sure mistake is with me. Please clear this for me :) User Model has name,hashed_password,salt. All the fields are strings require 'digest/sha1' class User < ActiveRecord::Base validates_presence_of :name validates_uniqueness_of :name attr_accessor :password_confirmation validates_confirmation_of :password validate :password_non_blank def self.authenticate(name, password) user = self.find_by_name(name) if user expected_password = encrypted_password(password, user.salt) if user.hashed_password != expected_password user = nil end end user end def password @password end def password=(pwd) @password = pwd return if pwd.blank? create_new_salt self.hashed_password = User.encrypted_password(self.password, self.salt) end private def password_non_blank errors.add(:password,"Missing password")if hashed_password.blank? end def create_new_salt self.salt = self.object_id.to_s + rand.to_s end def self.encrypted_password(password, salt) string_to_hash = password + "wibble" + salt Digest::SHA1.hexdigest(string_to_hash) end end

    Read the article

  • Is there any way to perform pre-/post-switch commands using TortoiseSVN?

    - by Steve
    We need to perform some tasks when switching from one Subversion branch to another using TortoiseSVN. Is there any way to, say, call a batch file before and after the switch? The only thing I can find are pre-/post-update and commit hooks, but none of those get executed when switching between branches. EDIT: I am looking for client-side hooks. TortoiseSVN has client-side hook scripts for pre-/post-update and commit, but nothing (that I can find) for pre-/post-switch. Initially, I thought adding hooks for client-side pre-/post-update would be executed when switching between branches, but this does not seem to be the case.

    Read the article

  • jQuery .find() doesn't return data in IE but does in Firefox and Chrome

    - by Steve Hiner
    I helped a friend out by doing a little web work for him. Part of what he needed was an easy way to change a couple pieces of text on his site. Rather than having him edit the HTML I decided to provide an XML file with the messages in it and I used jQuery to pull them out of the file and insert them into the page. It works great... In Firefox and Chrome, not so great in IE7. I was hoping one of you could tell me why. I did a fair but of googling but couldn't find what I'm looking for. Here's the XML: <?xml version="1.0" encoding="utf-8" ?> <messages> <message type="HeaderMessage"> This message is put up in the header area. </message> <message type="FooterMessage"> This message is put in the lower left cell. </message> </messages> And here's my jQuery call: <script type="text/javascript"> $(document).ready(function() { $.get('messages.xml', function(d) { //I have confirmed that it gets to here in IE //and it has the xml loaded. //alert(d); gives me a message box with the xml text in it //alert($(d).find('message')); gives me "[object Object]" //alert($(d).find('message')[0]); gives me "undefined" //alert($(d).find('message').Length); gives me "undefined" $(d).find('message').each(function() { //But it never gets to here in IE var $msg = $(this); var type = $msg.attr("type"); var message = $msg.text(); switch (type) { case "HeaderMessage": $("#HeaderMessageDiv").html(message); break; case "FooterMessage": $("#footermessagecell").html(message); break; default: } }); }); }); </script> Is there something I need to do differently in IE? Based on the message box with [object Object] I'm assumed that .find was working in IE but since I can't index into the array with [0] or check it's Length I'm guessing that means .find isn't returning any results. Any reason why that would work perfectly in Firefox and Chrome but fail in IE? I'm a total newbie with jQuery so I hope I haven't just done something stupid. That code above was scraped out of a forum and modified to suit my needs. Since jQuery is cross-platform I figured I wouldn't have to deal with this mess. Edit: I've found that if I load the page in Visual Studio 2008 and run it then it will work in IE. So it turns out it always works when run through the development web server. Now I'm thinking IE just doesn't like doing .find in XML loaded off of my local drive so maybe when this is on an actual web server it will work OK. I have confirmed that it works fine when browsed from a web server. Must be a peculiarity with IE. I'm guessing it's because the web server sets the mime type for the xml data file transfer and without that IE doesn't parse the xml correctly.

    Read the article

  • Method for SharePoint list/item locking across processes/machines?

    - by Steve
    In general, is there a decent way in SharePoint to control race conditions due to two processes or even two machines in the farm operating on the same list or list item at the same time? That is, is there any mechanism either built in or that can be fabricated via the Object Model for doing cross-process or cross-machine locking of individual list items? I want to write a timer job that performs a bunch of manipulations on a list. This list is written to by the SharePoint UI and then read by the UI. I want to be able to make sure that the UI doesn't either write to or read from the list when it is in an inconsistent state due to the timer job being in the middle of a manipulation. Is there any way to do this? Also, I want to allow for multiple instances of the timer job to run simultaneously. This, again, will require a lock to be sure that the two jobs don't attempt to operate on the same list/item at the same time. TIA for any help!

    Read the article

  • fastest public web app framework for quick DB apps?

    - by Steve Eisner
    I'd like to pick up a new tech for my toolbox - something for rapid prototyping of web apps. Brief requirements: public access (not hosted on my machine) - like Google's appengine, etc no tricky configuration necessary to build a simple web app host DB access (small storage provided) including some kind of SQLish query language easy front end HTML templating ability to access as a JSON service C# or Java,PHP or Python - or a fun new language to learn is OK free! An example app, very simple: render an AJAXy editable (add/delete/edit/drag) list of rich-data list items via some template language, so I can quickly mock up a UI for a client. ie. I can do most of the work client-side, but need convenient back end to handle the permanent storage. (In fact I suppose it doesn't even need HTML templating if I can directly access a DB via AJAX calls.) I realize this is a bit vague but am wondering if anyone has recommendations. A Rails host might be best for this (but probably not free) or maybe App Engine, or some other choice I'm not aware of? I've been doing everything with heavyweight servers (ASP.NET etc) for so long that I'm just not up on the latest... Thanks - I'll follow up on comments if this isn't clear enough :)

    Read the article

  • Joining tables with composite keys in a legacy system in hibernate

    - by Steve N
    Hi, I'm currently trying to create a pair of Hibernate annotated classes to load (read only) from a pair of tables in a legacy system. The legacy system uses a consistent (if somewhat dated) approach to keying tables. The tables I'm attempting to map are as follows: Customer CustomerAddress -------------------------- ---------------------------- customerNumber:string (pk) customerNumber:string (pk_1) name:string sequenceNumber:int (pk_2) street:string postalCode:string I've approached this by creating a CustomerAddress class like this: @Entity @Table(name="CustomerAddress") @IdClass(CustomerAddressKey.class) public class CustomerAddress { @Id @AttributeOverrides({ @AttributeOverride(name = "customerNumber", column = @Column(name="customerNumber")), @AttributeOverride(name = "sequenceNumber", column = @Column(name="sequenceNumber")) }) private String customerNumber; private int sequenceNumber; private String name; private String postalCode; ... } Where the CustomerAddressKey class is a simple Serializable object with the two key fields. The Customer object is then defined as: @Entity @Table(name = "Customer") public class Customer { private String customerNumber; private List<CustomerAddress> addresses = new ArrayList<CustomerAddress>(); private String name; ... } So, my question is: how do I express the OneToMany relationship on the Customer table?

    Read the article

  • JSF form does not get submitted when form is disabled by JavaScript

    - by Steve
    This is the submit button: <h:commandButton actionListener="#{regBean.findReg}" action="#{regBean.navigate}" value="Search" /> This is the form: <h:form onsubmit="this.disabled=true;busyProcess();return true;"> If the submit button is pressed, the page shows a "busy" icon until request is processed. The problem is, the form is never submitted and the request never reaches the backend. However, if I instead take out the "disabled" call like so: <h:form onsubmit="busyProcess();return true;"> Then everything works. Any ideas?

    Read the article

  • jQuery click listener on <object> in IE failing

    - by Steve Meisner
    $("#listView object.modal").click(function(){ // Get the ID of the clicked link: var link = $(this).closest("h2").attr("title"); var id = $(this).closest("div").attr("id"); showDialog(link, id); return false; }); This fires a modal (jQuery UI). It it working in FF, Chrome/Safari but not in IE 7/8. Is there something I'm missing here? Big Picture: We're using a swf to render custom type and there is a link in the rendered (flash) content. We're hoping to catch the link action in the jQuery listener so we don't have to extend our swf have an optional param to return false on link click. We thought we got around it, until IE testing commenced... Let me know if any more info is needed. Thanks!

    Read the article

  • Domain Redirection While Maintaining Original URL

    - by Steve
    I have two domains ("this_site.com" and "that_site.com") that I want to point to the same place (same set of files). BUT What I really want to do is maintain the original URL in the address bar while the visitor accesses the different pages. Example: The primary domain holding the web files is "this_site.com". If I type in "that_site.com" in the address bar, I want the address bar to keep displaying "that_site.com" no matter where they go on the web site. Normal domain redirection causes the URL displayed in the address bar to change to the 'master' domain (i.e. the visitor that typed in "that_site.com" will see the address bar's URL change to "this_site.com"). Is there some sort of .htaccess trick that I can employ to do this? What I'm trying to do is NOT confuse visitors who visit one URL and find themselves on a different URL as well as avoid the additional expense and trouble of having to maintain two separate hosting accounts.

    Read the article

  • Is there a way to specify java annotations in antlr grammar files?

    - by Steve B.
    I'm looking for a way to include a few additional strings in output .java files generated from antlr. Is there a comprehensive listing of available directives? For example, given parser output like this: package com.foo.bar; //<-- this can be generated with @header { .... } //antlr generated import org.antlr.runtime.*; ... //<-- is there a way to generate anything here? public class MyParser { //<--- or here? public void f1(){ ... } } Is there a way to generate strings that appear after the import statements (e.g. class-level annotations) or possibly method annotations?

    Read the article

  • Automatically Host User Domains in Rails/Apache

    - by Steve F
    Hi, I'm currently developing a user facing web application that gives each new user their own subdomain on the site, which is fine (using subdomain_fu), but is there a way to let a user map their own domain to this subdomain? I know how to do this manually through SSH-ing into the server and editing the Apache Vhosts file by hand, but is there a way to do this automatically so that a user simply enters their domain into a box on the site (obviously they'd have to change their own DNS elsewhere)? I'm using Ruby 1.8 and Rails 2.3.3 on top of Apache. Essentially letting; http://user.application.com/article-1 be accessed from http://userdomain.com/article-1 Thanks for any help!

    Read the article

< Previous Page | 47 48 49 50 51 52 53 54 55 56 57 58  | Next Page >