Search Results

Search found 28563 results on 1143 pages for 'strange but true'.

Page 24/1143 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • [java] Efficiency of while(true) ServerSocket Listen

    - by Submerged
    I am wondering if a typical while(true) ServerSocket listen loop takes an entire core to wait and accept a client connection (Even when implementing runnable and using Thread .start()) I am implementing a type of distributed computing cluster and each computer needs every core it has for computation. A Master node needs to communicate with these computers (invoking static methods that modify the algorithm's functioning). The reason I need to use sockets is due to the cross platform / cross language capabilities. In some cases, PHP will be invoking these java static methods. I used a java profiler (YourKit) and I can see my running ServerSocket listen thread and it never sleeps and it's always running. Is there a better approach to do what I want? Or, will the performance hit be negligible? Please, feel free to offer any suggestion if you can think of a better way (I've tried RMI, but it isn't supported cross-language. Thanks everyone

    Read the article

  • Left Join 3 Tables and Show True or False on Empty Cells

    - by Jason Shultz
    Ok, this may be confusing so I hope I explain it correctly. I have 4 tables: business photos video category I want to display "featured" businesses on the home page (or elsewhere) and I want to show a Yes or No in the table row based upon whether or not there are photos or videos for that business. Example: Joes Crab Shack has no videos or photos but is featured. So, when his row is echoed out it will show the Business Name and Business Owner but there will be no data in the photo or video cells thus in the video and photos column it will say No. Otherwise, if the opposite was true, it would say Yes. Here's my pastebin

    Read the article

  • missing value true / false: error in loop not in one-off

    - by vincent hay
    I am new on R and I have a problem with a test in a loop that I want to code. With a data frame (tabetest) like the one here after: Date 25179M103 1 14977 77.7309 2 14978 77.2567 3 14979 77.7507 I have: if(tabetest[3,"Date"]-tabetest[1,"Date"]1){print("ok")} [1] "ok" But: j=1 > position = 1 > price=tabetest for (i in 1:nrow(tabetest)-position){if(tabetest[i+position,"Date"]-tabetest[position,"Date"]>20){price[i+position,j]=price[i+position,j]/price[position,j]-1};position=position+1} Returns an error. R says that there is a missing value where true/false is required in: if (tabetest[i + position, "Date"] - tabetest[position, "Date"] > I have spent quite some time on that error but still don't understand where it comes from. Thanks for your help, Vincent

    Read the article

  • How to counter the "one true language" perspective?

    - by Rob Wells
    How do you work with someone when they haven't been able to see that there is a range of other languages out there beyond "The One True Path"? I mean someone who hasn't realised that the modern software professional has a range of tools in his toolbox. The person whose knee jerk reaction is, for example, "We must do this is C++!" "Everything must be done in C++!" What's the best approach to open people up to the fact that "not everything is a nail"? How may I introduce them to having a well-equipped toolbox, selecting the best tool for the job at hand?

    Read the article

  • what the true nature of @ in Transct-SQL

    - by Richard77
    Hello, I reading some old ScottGu's blogs on Linq2SQL. Now I'm doing the SPROC part. I'd like to know what's the exact meaning of @variable. See this from ScottGu's Blog ALTER PROCEDURE dbo.GetCustomersDetails ( @customerID nchar(5), @companyName nvarchar(40) output ) AS SELECT @companyName = CompanyName FROM Customers WHERE CustomerID = @customerID SELECT * FROM Orders WHERE CustomerID = @customerID ORDER BY OrderID I'm kind of lost as, so far, I've though of anything preceded by a '@' as a placeholder for user input. But, in the example above, it looks like '@companyName' is used as a regular variable like in C# for instance (SELECT @companyName = ...). But, @companyName is not known yet. So, what the true nature a something preceded by a '@' like above? a vriable? a simple placeholder to accommodate user entered value? Thanks for helping

    Read the article

  • Efficiency of while(true) ServerSocket Listen

    - by Submerged
    I am wondering if a typical while(true) ServerSocket listen loop takes an entire core to wait and accept a client connection (Even when implementing runnable and using Thread .start()) I am implementing a type of distributed computing cluster and each computer needs every core it has for computation. A Master node needs to communicate with these computers (invoking static methods that modify the algorithm's functioning). The reason I need to use sockets is due to the cross platform / cross language capabilities. In some cases, PHP will be invoking these java static methods. I used a java profiler (YourKit) and I can see my running ServerSocket listen thread and it never sleeps and it's always running. Is there a better approach to do what I want? Or, will the performance hit be negligible? Please, feel free to offer any suggestion if you can think of a better way (I've tried RMI, but it isn't supported cross-language. Thanks everyone

    Read the article

  • Facebooker Session is not created when config.cache_classes = true

    - by Michal
    I am using Facebooker (along with devise & devise_facebook_connectable). The problem is that user can't sign in with Facebook Connect in production environment unless I set config.cache_classes to false (which I don't want to do in production obviously). When cache_classes = true, Facebooker::Session.current is nil. Trying to set it manually creates other problems, so I assume it's not the solution. Using Rails 2.3.8 (tried on 2.3.5 too) and Facebooker 1.0.70 (tries on 1.0.69 too) and passenger 2.2.11. Any hints?

    Read the article

  • ajax strange error with sending multiple parameter

    - by kawtousse
    hi everyone, please check with me where is the error in this ajax code to send 2 parameters: var xhr = getXhr(); // On défini ce qu'on va faire quand on aura la réponse xhr.onreadystatechange = function(){ // On ne fait quelque chose que si on a tout reçu et que le serveur est ok if(xhr.readyState == 4 && xhr.status == 200) { selects = xhr.responseText; // On se sert de innerHTML pour rajouter les options a la liste //document.getElementById('prjsel').innerHTML = selects; } }; xhr.open("POST","ServletEdition",true); xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); id=document.getElementById(idIdden).value; fu=document.getElementById("formUpdate").value; //alert(fu); var i=1; xhr.send("id=" +id+", fu="+i); i cant got the value of fu i don't know why. thanks

    Read the article

  • ControlTemplate with "Control.IsMouseOver" Value="True" and "Control.IsMouseOver" Value="False">

    - by Vinjamuri
    In my WPF control, I have below code. If I don't have a trigger with false, I can see the my storyboard, but if I have both ture and false triggers, I don't see any thing. How to fix this? Appreciate your help! <Trigger Property="Control.IsMouseOver" Value="True"> <StoryBoard> Image with Opacity 1 </StoryBoard> </Trigger> <Trigger Property="Control.IsMouseOver" Value="False"> <StoryBoard> Image with Opacity 0 </StoryBoard> </Trigger>

    Read the article

  • How to do a true Java ping?

    - by stjowa
    I have a device on a network that I am attempting to ping through my Java program. Through my windows command prompt, I can ping the device address fine and do a tracert on the address fine. Online, I have seen that in order to do a ping through Java you have to do the following: InetAddress.getByName(address).isReachable(timeout); But, when I use this code on my device address, it always returns false in my program. I am using the correct IPv4 address with a good timeout value. Also, if I use a localhost address, it works fine. Why can I ping the device through cmd, but not through my program? I have heard in various places that this is not a true ping. Is there a better way to emulate a ping in Java? Thanks

    Read the article

  • Strange error: cannot convert from 'int' to 'ios_base::openmode'

    - by Dylan Klomparens
    I am using g++ to compile some code. I wrote the following snippet: bool WriteAccess = true; string Name = "my_file.txt"; ofstream File; ios_base::open_mode Mode = std::ios_base::in | std::ios_base::binary; if(WriteAccess) Mode |= std::ios_base::out | std::ios_base::trunc; File.open(Name.data(), Mode); And I receive these errors... any idea why? Error 1: invalid conversion from ‘int’ to ‘std::_Ios_Openmode’ Error 2: initializing argument 2 of ‘std::basic_filebuf<_CharT, _Traits* std::basic_filebuf<_CharT, _Traits::open(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits]’ As far as I could tell from a Google search, g++ is actually breaking the C++ standard here. Which I find quite astonishing, since they generally conform very strictly to the standard. Is this the case? Or am I doing something wrong. My reference for the standard: http://www.cplusplus.com/reference/iostream/ofstream/open/

    Read the article

  • capistrano deployment with use_sudo=true - permissions problem

    - by Pavel K.
    i am trying to do a deployment with capistrano to newly installed Ubuntu server i am deploying to directory /var/www, owned by root, so i need to set use_sudo to true while i execute commands with run "#{try_sudo} command" without problem, svn checkout doesn't work with sudo prefix i try set :deploy_via, :export and it throws Can't make directory '/var/www/pr_name/releases/20091217171253': Permission denied during checkout i imagine adding "try_sudo" prefix to "svn export" would help, but where can i edit the one it uses in deploy_via? -- if on other hand i don't use use_sudo, and set /var/www/ directory ownership to myuser, i still cannot deploy - some of my deployment commands set folders ownership to apache user www-data and then i get something like: changing ownership of `/var/www/pr_name/current/specificdirectory': Operation not permitted which, if i understand correctly, has to be done with sudo

    Read the article

  • Dictionary.ContainsKey return False, but a want True

    - by SkyN
    namespace Dic { public class Key { string name; public Key(string n) { name = n; } } class Program { static string Test() { Key a = new Key("A"); Key b = new Key("A"); System.Collections.Generic.Dictionary<Key, int> d = new System.Collections.Generic.Dictionary<Key, int>(); d.Add(a, 1); return d.ContainsKey(b).ToString(); } static void Main(string[] args) { System.Console.WriteLine(Test()); } } } I want TRUE!!!

    Read the article

  • IO.Directory.Exists always returns true

    - by roygbiv
    I am executing a IO.Directory.Exists on a network share from an ASP.NET application running under a specific Application Pool with a specific user account. The call always returns true. I have tried several variations: \\server\share$\directory \\192.168.0.1\share$\directory H:\directory I have checked that directory and share permissions are available to the account. The path does have spaces in it \\server\share$\directory\name name\test test, which should make no difference, however I have read otherwise. I will continue to check permissions, as it does work from my local machine (with the built in VS web-server and I am an administrator on the network), but when deployed to the IIS 6.0 virtual directory, and run under the Application Pool, it does not work.

    Read the article

  • empty() returning TRUE on object's non-empty property

    - by Michal M
    I've got a very weird and unexpected problem. empty() is returning TRUE on a non-empty property for a reason unknown to me. class MyObject { private $_property; public function __construct($property) { $this->_property = $property; } public function __get($name) { $priv_name = "_{$name}"; if (isset($this->$priv_name)) { return $this->$priv_name; } else { return NULL; } } } $obj = new MyObject('string value'); echo $obj->property; // Output 'string value' echo empty($obj->property); // Output 1 (means, that property is empty) Would this mean, that the __get() magic function is not called when using empty()? btw. I'm running PHP version 5.0.4

    Read the article

  • Why this java application print "true"?

    - by user292084
    This is my first Class Hello.java public class Hello { String name = ""; } This is my second Class Test1.java public class Test1 { public static void main(String[] args) { Hello h = new Hello(); Test1 t = new Test1(); t.build(h); System.out.println((h.name)); } void build(Hello h){ h.name = "me"; } } When I run Test1.java, it prints "me". I think I understand, because of "reference transfer". This is my third Class Test2.java public class Test2 { public static void main(String[] args) { Hello h = null; Test2 t = new Test2(); t.build(h); System.out.println(((h == null))); } void build(Hello h){ h = new Hello(); } } When I run Test2.java, it prints "true", why ? Is it "reference transfer" no longer? I am confused.

    Read the article

  • config.cache_classes = true in production mode has problems in IE

    - by techno_log
    Hi Dears, In my rails app. I am using link_to_function to bring an ajax tabs in one page.Everything works fine in Moazilla and other browsers. But in IE the tabs are not loading only when the server is started in production mode(doesn't matter whether its webrick or mongrel). In development mode everything is fine. So I figured out that the issue was with one line config.cache_classes = true in app/config/environments/production.rb when i changed the above code to config.cache_classes = false everything works fine. So I assume caching causes problem in rails. When I Googled about this I found many have the issues with caching. So my question is 1) is there any other fix for this? 2) Does this fix (config.cache_classes = false) causes any performance issues. If then how to overcome that? Any comments and suggestions are welcome. Techno_log

    Read the article

  • Visual Studio 2008 error while debugging an app with "uiAccess=true" in the manifest

    - by Jon Tackabury
    I have a C# WinForms application that has "uiAccess" set to "True" in it's manifest file. When I try to start/debug it in Visual Studio 2008 SP1 under Windows 7 x64 (RTM) I get this error: Running an Accessibility application requires following the steps described in Help. The help button is a broken link, and clicking ok just closes the application. It is digitally signed, and I can start it just fine in Windows Explorer. Here is the same bug in MS Connect, but unfortunately it's closed: https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=384183 Question: Can anyone else using Vista/Win7 x64 (with UAC enabled) confirm that they experience the same problem? Has anyone seen this problem before and have any idea how to work around it?

    Read the article

  • Java JFrame is very strange

    - by rodion
    When I am running this, JLabel is not visible, but when I resize window (with mouse) JLabel is showed. Why? import javax.swing.*; import java.awt.*; public class FrmTaoLogin extends JFrame { private JPanel pnlLeft = new JPanel(); public FrmTaoLogin() { super(); pnlLeft.setBorder(BorderFactory.createEtchedBorder()); pnlLeft.add(new JLabel("test1")); getContentPane().add(pnlLeft,BorderLayout.SOUTH); setDefaultCloseOperation(EXIT_ON_CLOSE); setSize(200, 200); } public static void main(String[] args) { FrmTaoLogin FrmLogin = new FrmTaoLogin(); FrmLogin.setVisible(true); } }

    Read the article

  • Convert Yes/No/Null from SQL to True/False in a DataTable

    - by Scott Chamberlain
    I have a Sql Database (which I have no control over the schema) that has a Column that will have the varchar value of "Yes", "No", or it will be null. For the purpose of what I am doing null will be handled as No. I am programming in c# net 3.5 using a data table and table adapter to pull the data down. I would like to directly bind the column using a binding source to a check box I have in my program however I do not know how or where to put the logic to convert the string Yes/No/null to boolean True/False; Reading a null from the SQL server and writing back a No on a update is acceptable behavior. Any help is greatly appreciated. EDIT -- This is being developed for windows.

    Read the article

  • form_for [@parent,@son],:remote=>true not asking for JS

    - by Cibernox
    Hi. I have a plain old form. That form is used to create new objects of a nested model. #restaurant.rb has_many :courses #courses.rb belongs_to :restaurant #routes.rb resources :restaurants do resources :courses end In my views(in haml), i have that code: %li.course{'data-random'=>random} = form_for([restaurant,course], :remote=>true) do |f| .name= f.text_field :name, :placeholder=>'Name here' .cat= f.hidden_field :category .price= f.text_field :price,:placeholder=>'Price here' .save = hidden_field_tag :random,random = f.submit "Save" I espected that form to be answered by action create of courses_controller with JS (create.js.erb), but it is submited like a normal form, and is answered with html. What am I doing wrong? This problem is similar to this but the only answer don't make sense to me. Thanks Inside

    Read the article

  • Submit form if ajax validator returns true using jquery

    - by Anthony
    I am not sure where I'm going wrong. The idea is that before the form is submitted, one of the input fields is sent to a server-side validator via ajax. If the response is 1, the input is valid and the form should be submitted. If the response is 0, the form should not be submitted. The issue is that I can't figure out how to set a variable within the ajax request function that will prevent the form from being submitted. This is what I have: $("#form").submit(function() { var valid= false; var input = $("#input").val(); $.ajax({ type: "POST", url: "validator.php", data: "input=" + input, success: function(msg){ valid = (msg == 1) ? true : false; if(!valid) { $("#valid_input").html("Please enter valid info"); } else { $("#valid_input").html(""); } } }); return valid; });

    Read the article

  • Django 1.2: Dates in admin forms don't work with Locales (I10N=True)

    - by equalium
    I have an application in Django 1.2. Language is selectable (I18N and Locale = True) When I select the english lang. in the site, the admin works OK. But when I change to any other language this is what happens with date inputs (spanish example): Correctly, the input accepts the spanish format %d/%m/%Y (Even selecting from the calendar, the date inserts as expected). But when I save the form and load it again, the date shows in the english form: %Y-%m-%d The real problem is that when I load the form to change any other text field and try to save it I get an error telling me to enter a valid date, so I have to write all dates again or change the language in the site to use the admin. I haven't specified anything for DATE_INPUT_FORMATS in settings nor have I overridden forms or models. Surely I am missing something but I can't find it. Can anybody give me a hint?

    Read the article

  • Ruby: map tags into a boolean condition to get a true/false result

    - by cgyDeveloper
    I have an array of tags per item like so: item1 = ['new', 'expensive'] item2 = ['expensive', 'lame'] I also have a boolean expression as a string based on possible tags: buy_it = "(new || expensive) && !lame" How can I determine if an item matches the buying criteria based on the tags associated with it? My original thought was to do a gsub on all words in buy_it to become 'true' or 'false' based on them existing in the itemx tags array and then exec the resulting string to get a boolean result. But since the Ruby community is usually more creative than me, is there a better solution?

    Read the article

  • javascript switch(true)

    - by ntan
    Hi i am trying to handle an ajax json response here is my code success: function (j) { switch(true) { case (j.choice1): alert("choice2"); break; case (j.choice2): alert("choice2"); break; default: alert("default"); break; } } based on what j is return i do my action BUT i keep getting the default. I have alert the j values and come correct.Some how case (j.choice1) case (j.choice2) is not working. I tried case (j.choice1!="") (j.choice2!="") But in this scenario i keep getting the first choice. What am i missing

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >