Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 94/1194 | < Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >

  • JSF-JSP cancel button returns a number format exception

    - by Barca
    I have a cancel button on a JSF-JSP page. It is handled by a method on the corresponding java class: public String cancel_action() { return "CANCEL"; This is configured in faces-config.xml as following: <navigation-rule> <from-view-id>/page2.jsp</from-view-id> <navigation-case> <from-outcome>CANCEL</from-outcome> <to-view-id>/page1.jsp</to-view-id> </navigation-case> </navigation-rule> Not sure why it is returning a number format exception. Any help will be highly appreciated.

    Read the article

  • Creating a Doctrine query with a different number of ids

    - by frapet
    Is it possible to create a Doctrine query with a differnt number of ids coming from a submitted form? And if yes how? What I am trying to do is this: .... if ($input->isValid()) { $q = Doctrine_Query::create() ->from('Imm_Model_Images i') ->whereIn('i.ImageID = ?', array($input->ids)); $result = $q->fetchArray(); PS: ids come form the submitted form in an array as ids[]. Added Edit: chaged the above line: ->whereIn('i.ImageID = ?', array($input->ids)); with: ->whereIn('i.ImageID = array($input->ids)'); ...and it seems to work.

    Read the article

  • Increment number in string

    - by iform
    Hi, I am stumped... I am trying to get the following output until a certain condition is met. test_1.jpg test_2.jpg .. test_50.jpg The solution (if you could remotely call it that) that I have is fileCount = 0 while (os.path.exists(dstPath)): fileCount += 1 parts = os.path.splitext(dstPath) dstPath = "%s_%d%s" % (parts[0], fileCount, parts[1]) however...this produces the following output. test_1.jpg test_1_2.jpg test_1_2_3.jpg .....etc The Question: How do I get change the number in its current place (without appending numbers to the end)? Ps. I'm using this for a file renaming tool.

    Read the article

  • program to determine number of duplicates in a sentence

    - by bhavna raghuvanshi
    public class duplicate { public static void main(String[] args)throws IOException { System.out.println("Enter words separated by spaces ('.' to quit):"); Set<String> s = new HashSet<String>(); Scanner input = new Scanner(System.in); while (true) { String token = input.next(); if (".".equals(token)) break; if (!s.add(token)) System.out.println("Duplicate detected: " + token); } System.out.println(s.size() + " distinct words:\n" + s); } } my program detects and prints duplicate words but i need to print the number of duplicate words also. pls help me do it.

    Read the article

  • Split a sting array into a number array in javascript

    - by Wesley Skeen
    I am reading a value from a dropdown list depending on what option is selected. I am using jqPlot to graph the values. jqPlot expects an array of values like [91, 6, 2, 57, 29, 40, 95] but when I read the value in from the dropdown box it is coming in as a whole string "[91, 6, 2, 57, 29, 40, 95]" I tried splitting it but I got ["91", "6", "2", "57", "29", "40", "95"] which wont display the graph correctly. Is there anybody that has encountered something like this before and what can I do to make my values convert into a number array. Thanks for any help

    Read the article

  • How to get the number of unread gmail mails (on android)

    - by Lord Otori
    I've been trying to get the number of unread gmail mails with no luck. I've read Gmail.java and gmail4j both links taken out of this site from this question: Android - How can I find out how many unread email the user has? But still after having read all of that and a couple of other sites that talked about this particular subject my question remains: Q: How can I get the Gmail Unread Count? Sorry if it seams a bit insistent but I clearly lack the knowledge to find this out on my own from the source. PS: I would like to clarify that I want to do it without having to ask the user for credentials. Just 2 add some colors to the question let me show you the looks of my app.

    Read the article

  • Pass variable number of variables to a class in PHP

    - by user325282
    I need to pass a variable number of strings to instantiate different classes. I can always do a switch on the size of the array: switch(count($a)) { case 1: new Class(${$a[0]}); break; case 2: new Class(${$a[0]}, ${$a[1]}); break; etc... There has to be a better way to do this. If I have an array of strings ("variable1", "variable2", 'variable3", ...), how can I instantiate a Class without manually accounting for every possibility?

    Read the article

  • How to find the largest power of 2 less than the given number

    - by nazar_art
    I need to find the largest power of 2 less than the given number. And I stuck and can't find any solution. Code: public class MathPow { public int largestPowerOf2 (int n) { int res = 2; while (res < n) { res =(int)Math.pow(res, 2); } return res; } } This doesn't work correctly. Testing output: Arguments Actual Expected ------------------------- 9 16 8 100 256 64 1000 65536 512 64 256 32 How to solve this issue?

    Read the article

  • Query returning an ascending group number

    - by Dougman
    I have a query like below that has groups (COL1) and that group's values (COL2). select col1, col2 from (select 'A' col1, 1 col2 from dual union all select 'A' col1, 2 col2 from dual union all select 'B' col1, 1 col2 from dual union all select 'B' col1, 2 col2 from dual union all select 'C' col1, 1 col2 from dual union all select 'C' col1, 2 col2 from dual ) order by col1, col2; The output of this query looks like: COL1 COL2 ---- ---- A 1 A 2 B 1 B 2 C 1 C 2 What I need is a query that will return an ordered number increasing for each different group (COL1). It seems like there would be a simple way to accomplish this (maybe with analytics) but for some reason it is escaping me. GRPNUM COL1 COL2 ------ ---- ---- 1 A 1 1 A 2 2 B 1 2 B 2 3 C 1 3 C 2 I am running Oracle 10gR2.

    Read the article

  • mysql count(*) left join group by - the number of files in a folder

    - by Flavius
    Hi I have the following tables CREATE TABLE `files` ( `fileid` int(11) NOT NULL AUTO_INCREMENT, `filename` varchar(255) NOT NULL, `filesize` int(11) NOT NULL, `folder` int(11) NOT NULL, PRIMARY KEY (`fileid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; CREATE TABLE `folders` ( `directoryid` int(11) NOT NULL AUTO_INCREMENT, `directoryname` varchar(255) NOT NULL, PRIMARY KEY (`directoryid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; How to get a list of all folders and the number of files they hold, including folders who have no (zero) files? Recursion must not be taken into account. Found it select folders.directoryid, folders.directoryname, count(files.fileid) as no_files from folders left join files on files.folder = folders.directoryid group by folders.directoryid, folders.directoryname I hope it will help someone.

    Read the article

  • Find number of serialized objects

    - by tmosier
    Hello all. My issue is trying to determine a number of objects created, the objects being serialized from an XML document. The XML document should be set up for simplicity, so any developer can add an additional object and need no further modification to the code. However each of these objects need to be handled/updated seperately, and specifically, some of the objects are of different sub-classes, which need to be handled differently. Here is some pseudocode for what I am going for class A { public B myClassB; public void Update() { // for every object of whatever type in myClassB // update logic } } XML: <\data <\object1 etc... So what would be my simplest course of action, allowing other to add objects via the XML, but still ensuring the proper logic happenes for each?

    Read the article

  • Matching two sections same number of times

    - by Leszczu
    Hello, i need a HTML to parse: <span>some text<span><span><span>text</span></span></span></span> I need to remove unnecessary <span> occurrences, so that output is: <span>some text<span>text</span></span> I wrote a regex, which does this once: /<SPAN>[^<]*<\/SPAN>/i How to make this work same number of times on both <span> and </span>?

    Read the article

  • Calculating number of online visitors?

    - by Syom
    i need to show the number of online visitors, but there is a problem with selecting algoritm to do it! maybe i must create a table in DB, where i'll store ip addresses of visitors and time of visit! by so i can show the count of ip addresses, which's time = NOW() - 10 minutes, for example...("now()-10 minutes" is just to show the logic, i know that this is not a function:) is this goog way to go? or maybe it's better to use AJAX methods to store the data? please give me an idea. Thanks

    Read the article

  • count number of rows to be affected before update in trigger

    - by tomaszsobczak
    Hi, I want to know number of rows that will be affected by UPDATE query in BEFORE per statement trigger . Is that possible? The problem is that i want to allow only queries that will update up to 4 rows. If affected rows count is 5 or more i want to raise error. I don't want to do this in code because i need this check on db level. Is this at all possible? Thanks in advance for any clues on that

    Read the article

  • Python: Matching & Stripping port number from socket data

    - by tobywuk
    Hello, I have data coming in to a python server via a socket. Within this data is the string '<port>80</port>' or which ever port is being used. I wish to extract the port number into a variable. The data coming in is not XML, I just used the tag approach to identifying data for future XML use if needed. I do not wish to use an XML python library, but simply use something like regexp and strings. What would you recommend is the best way to match and strip this data? I am currently using this code with no luck: p = re.compile('<port>\w</port>') m = p.search(data) print m Thank you :)

    Read the article

  • Print number in engineering format

    - by jmurrayufo
    I am trying to print a number into engineering format with python, but I cannot seem to get it to work. The syntax SEEMS simple enough, but it just doesn't work. >>> import decimal >>> x = decimal.Decimal(1000000) >>> print x 1000000 >>>> print x.to_eng_string() 1000000 I cannot figure out why this is. The two values are not equal (one is a string, the other is an int). Setting various contexts in decimal doesn't seem to help either. Any clues or ideas?

    Read the article

  • How to calculate square root in PHP [explained] [on hold]

    - by Enes Imsirovic
    At first code ! Don't forget embed the JQuery ! <html> <head> <title>Simple jQuery and PHP Square Root example</title> <script src="js/jquery-1.10.1.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { $('#form').submit(function(){ var number = $('#number').val(); $.ajax({type:"post",url:"calculate.php",data:"number=" +number,success:function(msg){$('#result').hide(); $("#result").html("<h3>" + msg + "</h3>").fadeIn("slow"); } }); return false; }); }); </script> </head> <body> <form id="form" action="calculate.php" method="post"> Enter number: <input id="number" type="text" name="number" /> <input id="submit" type="submit" value="Calculate Square Root" name="submit"/> </form> <p id="result"></p> </body> </html> Second code witch would be connected with first : calculate.php <?php if($_POST['number']==null){ echo "Please Enter a Number"; }else { if (!is_numeric($_POST['number'])) { echo "Please enter only numbers"; }else{ echo "Square Root of " .$_POST['number'] ." is ".sqrt($_POST['number']); } } ?> Chiefly for begginers, to see the power of PHP :) xD Load this on your localhost.. PHP files and JS : https://mega.co.nz/#!Et8zWSBb!KX2PFxa2Pzw_l-wi6QU8xi_eKTlHbtQuBsT_DvXrifk At least it look like this : http://imgur.com/vNnDRQ3

    Read the article

  • How do I count the times each number appears in columns of numbers?

    - by Andy C.
    I am sure this must be easy, but I am inexperienced. About the best way to think of my problem is to think of it as trying to sort and then count lottery numbers. To stay simple, let's do a Pick 3 game. Let's look at 10 drawings. I would split each drawn number into a separate column: DATE BALL#1 BALL#2 BALL#3 3/1 1 3 5 3/2 3 7 8 3/3 2 2 1 3/4 5 7 6 3/5 2 3 1 3/6 0 5 9 3/7 3 7 0 3/8 6 8 4 3/9 2 4 3 3/10 7 1 2 I would like to be able to build formulas into cells that would tell me how many times each number appeared overall, and how many times each number appeared in the position it occurred. Like this (using the above example): Number Overall Count Ball#1 Count Ball#2 Count Ball#3 Count 0 2 1 0 1 1 4 1 1 2 (That is, The number zero appears twice overall, and came up once as the first number drawn; zero times as the middle ball; and once as the third ball. Likewise, the number 1 was drawn four times in our 10-day period. It was the first ball once, the second ball once and the third ball twice.) And so on. All help appreciated. I have access to Excel and Microsoft Works, or of course if there is a Google Docs way to handle this All thanks for any help.

    Read the article

  • Why mysql 5.5 slower than 5.1 (linux,using mysqlslap)

    - by Zenofo
    my.cnf (5.5 and 5.1 is the same) : back_log=200 max_connections=512 max_connect_errors=999999 key_buffer=512M max_allowed_packet=8M table_cache=512 sort_buffer=8M read_buffer_size=8M thread_cache=8 thread_concurrency=4 myisam_sort_buffer_size=128M interactive_timeout=28800 wait_timeout=7200 mysql 5.5: ..mysql5.5/bin/mysqlslap -a --concurrency=10 --number-of-queries 5000 --iterations=5 -S /tmp/mysql_5.5.sock --engine=innodb Benchmark Running for engine innodb Average number of seconds to run all queries: 15.156 seconds Minimum number of seconds to run all queries: 15.031 seconds Maximum number of seconds to run all queries: 15.296 seconds Number of clients running queries: 10 Average number of queries per client: 500 mysql5.1: ..mysql5.5/bin/mysqlslap -a --concurrency=10 --number-of-queries 5000 --iterations=5 -S /tmp/mysql_5.1.sock --engine=innodb Benchmark Running for engine innodb Average number of seconds to run all queries: 13.252 seconds Minimum number of seconds to run all queries: 13.019 seconds Maximum number of seconds to run all queries: 13.480 seconds Number of clients running queries: 10 Average number of queries per client: 500 Why mysql 5.5 slower than 5.1 ? BTW:I'm tried mysql5.5/bin/mysqlslap and mysql5.1/bin/mysqlslap,result is the same

    Read the article

  • On saving a new record an associated id changes to 9 figure number

    - by Dave
    Hi, I have a table of venues, with each venue belonging to an area and a type. I recently dropped the table and added to it some addressline fields. I have re-migrated it but now the area_id field saves as a random? 9 figure number. Both the area_id and venuetype_id integers are created in the same way from the create new form and the venuetype_id saves as normal but not the area_id. Can anyone offer any help? whats shown in the console => [#<Venue id: 4, name: "sdf", addressline1: "", addressline2: "", addressline3 : "", addressline4: "", icontoppx: 234, iconleftpx: 234, area_id: 946717224, ven uetype_id: 8, created_at: "2011-03-17", updated_at: "2011-03-17 23:33:53">] irb(main):030:0> the area_id should be 8 in the above example. The area and venuetype id's are slected from dropdown boxes on the new venue form. new form <%= form_for @venue do |f| %> <p>name: <br> <%= f.text_field :name %></p> <p>top: <br> <%= f.text_field :icontoppx %></p> <p>left: <br> <%= f.text_field :iconleftpx %></p> <p>addressline1: <br> <%= f.text_field :addressline1 %></p> <p>addressline2: <br> <%= f.text_field :addressline2 %></p> <p>addressline3: <br> <%= f.text_field :addressline3 %></p> <p>addressline4: <br> <%= f.text_field :addressline4 %></p> <p>area: <br> <%= f.collection_select(:area_id, Area.all, :id, :name) %></p> <p>venuetype: <br> <%= f.collection_select(:venuetype_id, Venuetype.all, :id, :name) %></p> <br><br> <div class="button"><%= submit_tag %></div> <% end %> Areas table class CreateAreas < ActiveRecord::Migration def self.up create_table :areas do |t| t.string :name t.timestamps end end def self.down drop_table :areas end end Thanks very much for any help!

    Read the article

  • JQgrid - Get Row Number instead of ID

    - by mariojjsimoes
    Hello, all, I am creating a JQGrid from a database table that does not contain a single field primary key. Therefore, the field i am supplying as id is not unique and the same one exists in several rows. Because of this, when passing a reference to the data with ondblClickRow to a function external to the grid i need to use the rownumber and not the id. To test, I'm using ondblClickRow: function(id){alert($("#grid1").getInd('rowid'));}, , and i should be getting and alert with the row number, except that it isn't working. I've been over the documentation and can't understand what i am doing wrong... Any help would be greatly appreciated! Thanks in advance, Mario. Bellow is my full grid: jQuery(document).ready(function(){ var mygrid = jQuery("#grid1").jqGrid({ datatype: 'xmlstring', datastr : grid1RsXML, width: 1024, height: 500, colNames:['DEVICE_ID','JOB_SIZE_IN_BYTES', 'USER_NAME','HOST_NAME','DAY_OF_WEEK','JOB_ID'], colModel:[ {name:'DEVICE_ID',index:'DEVICE_ID', width:55, sortable:true}, {name:'JOB_SIZE_IN_BYTES',index:'JOB_SIZE_IN_BYTES', width:40, sortable:true}, {name:'USER_NAME',index:'USER_NAME', width:60, sortable:true}, {name:'HOST_NAME',index:'HOST_NAME', width:50,align:"right", sortable:true}, {name:'DAY_OF_WEEK',index:'DAY_OF_WEEK', width:10, sortable:true}, {name:'JOB_ID',index:'JOB_ID', width:30, sortable:true} ], rowNum:1000, autowidth: true, //rowList:[10,20,30], rowList:[1], pager: '#grid1Pager', sortname: 'DEVICE_ID', viewrecords: true, rownumbers: true, sortorder: "desc", sortable: true, gridview : true, xmlReader: { root : "recordset", row: "record", repeatitems: false, id: "DEVICE_ID" }, caption:"All Jobs - Double Click for detailed history", ondblClickRow: function(id){alert($("#grid1").getInd('rowid'));}, toolbar: [true,"top"], url: grid1RsXML });

    Read the article

  • Boost.Program_options fixed number of tokens

    - by kloffy
    Boost.Program_options provides a facility to pass multiple tokens via command line arguments as follows: std::vector<int> nums; po::options_description desc("Allowed options"); desc.add_options() ("help", "Produce help message.") ("nums", po::value< std::vector<int> >(&nums)->multitoken(), "Numbers.") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); However, what is the preferred way of accepting only a fixed number of arguments? The only solution I could come is to manually assign values: int nums[2]; po::options_description desc("Allowed options"); desc.add_options() ("help", "Produce help message.") ("nums", "Numbers.") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); if (vm.count("nums")) { // Assign nums } This feels a bit clumsy. Is there a better solution?

    Read the article

  • Server port 16080 problem: webserver adds the port number 16080 in the URL

    - by Juri
    Hello everybody. On my wordpress website one little thing doesn't work. Sometimes the Webserver adds the port number 16080 in the URL, which leads to an error (network timeout). Wrong: http://www.example.com:16080/about-us/weekly-program/?month=may&yr=2010 Correct: http://www.example.com/about-us/weekly-program/?month=may&yr=2010 Has someone a "Server port 16080 problem fix"? Is it possible, that I need to add a ServerName directive to the config file to tell the domain name of the server? Cheers Juri !!!update!!! PS: Here is the site configuration, don't ask me to change the 16080 to 80, because that screwes up everyone else's websites... Please let me know what you think of the configuration: ## Default Virtual Host Configuration <VirtualHost *:16080> ServerName example.com ServerAdmin [email protected] DocumentRoot "/Library/WebServer/Documents/WMsites/example.com/wordpress" DirectoryIndex "index.html" "index.php" CustomLog "/var/log/httpd/access_log" "%{PC-Remote-Addr}i %l %u %t \"%r\" %>s %b" ErrorLog "/var/log/httpd/error_log" ErrorDocument 404 /error.html <IfModule mod_ssl.c> SSLEngine Off SSLLog "/var/log/httpd/ssl_engine_log" SSLCertificateFile "/etc/certificates/Default.crt" SSLCertificateKeyFile "/etc/certificates/Default.key" SSLCipherSuite "ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:!SSLv2:+EXP:+eNULL" </IfModule> <IfModule mod_dav.c> DAVLockDB "/var/run/davlocks/.davlock100" DAVMinTimeout 600 </IfModule> <Directory "/Library/WebServer/Documents/WMsites/example.com/wordpress"> Options All -Indexes -ExecCGI -Includes +MultiViews <IfModule mod_dav.c> DAV Off </IfModule> AllowOverride All </Directory> <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_METHOD} ^TRACE RewriteRule .* - [F] </IfModule> <IfModule mod_alias.c> </IfModule> LogLevel warn ServerAlias www.example.com ServerAlias example.com </VirtualHost>

    Read the article

  • MD5 wrong number of arguments (1 for 0) Error

    - by Salil
    Hi All, I have following error on my Server which is working properly on my local on following line . event_id = MD5.new("event-init-flash-#{Asteroid::now}").to_s #line 232 ERROR: wrong number of arguments (1 for 0) /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:232:in initialize' /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:232:in new' /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:232:in make_flash_connection' /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star/server.rb:70:in receive_data' /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star.rb:87:in run' /ruby/gems/gems/shooting_star-3.2.7/bin/../lib/shooting_star.rb:87:in start' /ruby/gems/gems/shooting_star-3.2.7/bin/shooting_star:61 /ruby/gems/bin/shooting_star:19:in `load' /ruby/gems/bin/shooting_star:19 POST /10 HTTP/1.1 Host: 67.222.55.30:8080 Content-length: 103 I used shooting_star to create an Chat Application. Ref:- http://github.com/genki/shooting-star Following are the REQUIREMENTS of the shooting_star Linux or xBSD OS having epoll or kqueue. Increase ulimit of nofile up to over 100,000. (edit /etc/security/limits.conf file.) prototype.js 1.5.0+ Ruby 1.8.5+ Ruby on Rails 1.2.0+ My Local Configuration are O.S Linux Ruby ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-linux] Rails 2.3.4 shooting_star 3.2.7 prototype.js 1.6.0.3 My Server Configuration are O.S Linux Ruby ruby 1.8.6 (2009-08-04 patchlevel 383) [x86_64-linux] Rails 2.3.4 shooting_star 3.2.7 prototype.js 1.6.0.3 I just want to know what is the problem why it's not working on server if everything is fine in local. Regards, Salil Gaikwad

    Read the article

< Previous Page | 90 91 92 93 94 95 96 97 98 99 100 101  | Next Page >