PostId
int64
13
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
3
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-33
210k
OwnerUndeletedAnswerCountAtPostTime
int64
0
5.77k
Title
stringlengths
10
250
BodyMarkdown
stringlengths
12
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
47
30.1k
OpenStatus_id
int64
0
4
6,222,771
06/03/2011 03:47:25
344,769
05/19/2010 05:58:50
2,595
164
PHP - System Practices, Technologies & Tools
I am a PHP system developer and am about to reprogram a system and I have decided to implement many new technologies, as I do just about every time I make a new system. I am looking at general practices (such as versioning your system), tools and I will give examples of the ones I am using or will be implementing shortly. ------------ **Caching:** * APC * MemCache * .htaccess **Compression:** * GZip * JSMin * Custom CSS Compressor **Database:** * MySQL **Dependency Management:** * HeadJS **Frameworks:** * jQuery [have thought about using Javelin] * [No PHP Framework due to performance hit] **Profiling:** * XHProf (PHP) **Testing:** * PHPUnit * Selenium * QUnit **Version Control:** * GitHub ----------- The reason I am asking is because I keep coming across more technologies or things that should be done for systems that I am simply unaware of. Here is a list of a few other technologies that I have looked at but don't quite seem to help. I am looking at things to optimize development and provide a better and importantly **faster** system. * Pagelets / BigPipe (From Facebook: Not available to the public and open source ones don't seem to have that great of a benefit) * Haste (From Facebook: Not available to the public - CSS/JS Dependency Management) * XHP (Major performance hit) * SVN (More complicated than GitHub) If there are many missing sections above (Testing only recently has entered our system scopes), please let me know.
php
technologies
system-design
null
null
06/03/2011 04:04:05
not a real question
PHP - System Practices, Technologies & Tools === I am a PHP system developer and am about to reprogram a system and I have decided to implement many new technologies, as I do just about every time I make a new system. I am looking at general practices (such as versioning your system), tools and I will give examples of the ones I am using or will be implementing shortly. ------------ **Caching:** * APC * MemCache * .htaccess **Compression:** * GZip * JSMin * Custom CSS Compressor **Database:** * MySQL **Dependency Management:** * HeadJS **Frameworks:** * jQuery [have thought about using Javelin] * [No PHP Framework due to performance hit] **Profiling:** * XHProf (PHP) **Testing:** * PHPUnit * Selenium * QUnit **Version Control:** * GitHub ----------- The reason I am asking is because I keep coming across more technologies or things that should be done for systems that I am simply unaware of. Here is a list of a few other technologies that I have looked at but don't quite seem to help. I am looking at things to optimize development and provide a better and importantly **faster** system. * Pagelets / BigPipe (From Facebook: Not available to the public and open source ones don't seem to have that great of a benefit) * Haste (From Facebook: Not available to the public - CSS/JS Dependency Management) * XHP (Major performance hit) * SVN (More complicated than GitHub) If there are many missing sections above (Testing only recently has entered our system scopes), please let me know.
1
3,593,870
08/29/2010 07:07:17
375,799
06/25/2010 00:13:20
1,171
47
SELECT / INSERT version of an UPSERT: is there a design pattern for high concurrency?
I want to do the SELECT / INSERT version of an UPSERT. Below is a template of the existing code: // CREATE TABLE Table (RowID INT NOT NULL IDENTITY(1,1), RowValue VARCHAR(50)) IF NOT EXISTS (SELECT * FROM Table WHERE RowValue = @VALUE) BEGIN INSERT Table VALUES (@Value) SELECT @id = SCOPEIDENTITY() END ELSE SELECT @id = RowID FROM Table WHERE RowValue = @VALUE) The query will be called from many concurrent sessions. My performance tests show that it will consistently throw primary key violations under a specific load. Is there a high-concurrency method for this query that will allow it to maintain performance while still avoiding the insertion of data that already exists?
sql-server
tsql
sql-server-2008
design-patterns
concurrency
null
open
SELECT / INSERT version of an UPSERT: is there a design pattern for high concurrency? === I want to do the SELECT / INSERT version of an UPSERT. Below is a template of the existing code: // CREATE TABLE Table (RowID INT NOT NULL IDENTITY(1,1), RowValue VARCHAR(50)) IF NOT EXISTS (SELECT * FROM Table WHERE RowValue = @VALUE) BEGIN INSERT Table VALUES (@Value) SELECT @id = SCOPEIDENTITY() END ELSE SELECT @id = RowID FROM Table WHERE RowValue = @VALUE) The query will be called from many concurrent sessions. My performance tests show that it will consistently throw primary key violations under a specific load. Is there a high-concurrency method for this query that will allow it to maintain performance while still avoiding the insertion of data that already exists?
0
7,116,759
08/19/2011 03:51:29
263,944
02/01/2010 23:32:34
31
3
Sending data to multiple sockets at exact same time
I'm want to design a ruby / rails solution to send out to several listening sockets on a local lan at the exact same time. I want the receiving servers to receive the message at exact same time / or micro second level. What is the best strategy that I can use that will effectively allow the receiving socket to receive it at the exact same time. Naturally my requirements are extremely time sensitive. I'm basing some of my research / design on the two following articles: - http://onestepback.org/index.cgi/Tech/Ruby/MulticastingInRuby.red - http://www.tutorialspoint.com/ruby/ruby_socket_programming.htm Now currently I'm working on a TCP solution and not UDP because of it's guaranteed delivery. Also, was going to stand up ready connected connections to all outbound ports. Then iterate over each connection and send the minimal packet of data. Recently, I'm looking at multicasting now and possibly reverting back to a UDP approach with a return a passive response, but ensure the message was sent back either via UDP / TCP. Note - The new guy syndrome here with sockets. Is it better to just use UDP and send a broad packet spam to the entire subnet without guaranteed immediate delivery?
ruby-on-rails
ruby
sockets
null
null
null
open
Sending data to multiple sockets at exact same time === I'm want to design a ruby / rails solution to send out to several listening sockets on a local lan at the exact same time. I want the receiving servers to receive the message at exact same time / or micro second level. What is the best strategy that I can use that will effectively allow the receiving socket to receive it at the exact same time. Naturally my requirements are extremely time sensitive. I'm basing some of my research / design on the two following articles: - http://onestepback.org/index.cgi/Tech/Ruby/MulticastingInRuby.red - http://www.tutorialspoint.com/ruby/ruby_socket_programming.htm Now currently I'm working on a TCP solution and not UDP because of it's guaranteed delivery. Also, was going to stand up ready connected connections to all outbound ports. Then iterate over each connection and send the minimal packet of data. Recently, I'm looking at multicasting now and possibly reverting back to a UDP approach with a return a passive response, but ensure the message was sent back either via UDP / TCP. Note - The new guy syndrome here with sockets. Is it better to just use UDP and send a broad packet spam to the entire subnet without guaranteed immediate delivery?
0
9,794,991
03/20/2012 21:08:46
179,581
09/26/2009 20:46:53
2,259
32
Restoring sshuttle without restarting os
I am experiencing an annoying problem with [sshuttle](https://github.com/apenwarr/sshuttle) running it on 10.7.3, MBA with the latest firmware update -- after I stop it (ctrl+c twice), or loose connection, or close the lid, I cannot restore it until I restart my laptop. The restarting takes notably more time, than it would normally take. I have tried to flush ipfw rules - not helping. Could you advice me how to restore sshuttle connection (without restarting the laptop)? The following processes remain running as root, which I do not know how to kill (tried `sudo kill -9 <pid>` with no luck): root 14464 python ./main.py python -v -v --firewall 12296 12296 root 14396 python ./main.py python -v -v --firewall 12297 12297 root 14306 python ./main.py python -v -v --firewall 12298 12298 root 3678 python ./main.py python -v -v --firewall 12299 12299 root 2263 python ./main.py python -v -v --firewall 12300 12300 The command I use to run proxy: ./sshuttle --dns -r [email protected] 10.0.0.0/8 -vv The last message I get trying to restore the connection: ... firewall manager: starting transproxy. s: Ready: 1 r=[4] w=[] x=[] s: < channel=0 cmd=PING len=7 s: > channel=0 cmd=PONG len=7 (fullness=554) s: mux wrote: 15/15 s: Waiting: 1 r=[4] w=[] x=[] (fullness=561/0) >> ipfw -q add 12300 check-state ip from any to any >> ipfw -q add 12300 skipto 12301 tcp from any to 127.0.0.0/8 >> ipfw -q add 12300 fwd 127.0.0.1,12300 tcp from any to 10.0.0.0/8 not ipttl 42 keep-state setup >> ipfw -q add 12300 divert 12300 udp from any to 10.0.1.1/32 53 not ipttl 42 >> ipfw -q add 12300 divert 12300 udp from any 12300 to any not ipttl 42
proxy
ssh
transparentproxy
null
null
04/05/2012 17:33:48
off topic
Restoring sshuttle without restarting os === I am experiencing an annoying problem with [sshuttle](https://github.com/apenwarr/sshuttle) running it on 10.7.3, MBA with the latest firmware update -- after I stop it (ctrl+c twice), or loose connection, or close the lid, I cannot restore it until I restart my laptop. The restarting takes notably more time, than it would normally take. I have tried to flush ipfw rules - not helping. Could you advice me how to restore sshuttle connection (without restarting the laptop)? The following processes remain running as root, which I do not know how to kill (tried `sudo kill -9 <pid>` with no luck): root 14464 python ./main.py python -v -v --firewall 12296 12296 root 14396 python ./main.py python -v -v --firewall 12297 12297 root 14306 python ./main.py python -v -v --firewall 12298 12298 root 3678 python ./main.py python -v -v --firewall 12299 12299 root 2263 python ./main.py python -v -v --firewall 12300 12300 The command I use to run proxy: ./sshuttle --dns -r [email protected] 10.0.0.0/8 -vv The last message I get trying to restore the connection: ... firewall manager: starting transproxy. s: Ready: 1 r=[4] w=[] x=[] s: < channel=0 cmd=PING len=7 s: > channel=0 cmd=PONG len=7 (fullness=554) s: mux wrote: 15/15 s: Waiting: 1 r=[4] w=[] x=[] (fullness=561/0) >> ipfw -q add 12300 check-state ip from any to any >> ipfw -q add 12300 skipto 12301 tcp from any to 127.0.0.0/8 >> ipfw -q add 12300 fwd 127.0.0.1,12300 tcp from any to 10.0.0.0/8 not ipttl 42 keep-state setup >> ipfw -q add 12300 divert 12300 udp from any to 10.0.1.1/32 53 not ipttl 42 >> ipfw -q add 12300 divert 12300 udp from any 12300 to any not ipttl 42
2
11,548,753
07/18/2012 19:19:25
1,502,245
07/04/2012 18:09:55
1
0
Encrypted Text Message
I keep getting a text messages on my google samsung nexus s 4g running 4.0.4 The sender is unknown and i receive the same message 6 times now. first time about 1 month ago (june 20th 2012) each time it is sent its one hour a part on the hour. the latest time i got them were today (wed jul 18th 2012) received at 1,2,3 pm the message body is this: &#0;&#0;BMy���2��~d4eA~ݹycӇb ��iٕ�ytAO�>�v�ASF�h4�A�v�(0�闟E� �e 2 here is also a link to the snippet of the same string http://snipt.org/vqff6 Question: Is there any ways someone can decode this or provide more insight on what this may be?
encryption
null
null
null
null
07/19/2012 14:02:42
off topic
Encrypted Text Message === I keep getting a text messages on my google samsung nexus s 4g running 4.0.4 The sender is unknown and i receive the same message 6 times now. first time about 1 month ago (june 20th 2012) each time it is sent its one hour a part on the hour. the latest time i got them were today (wed jul 18th 2012) received at 1,2,3 pm the message body is this: &#0;&#0;BMy���2��~d4eA~ݹycӇb ��iٕ�ytAO�>�v�ASF�h4�A�v�(0�闟E� �e 2 here is also a link to the snippet of the same string http://snipt.org/vqff6 Question: Is there any ways someone can decode this or provide more insight on what this may be?
2
5,695,224
04/17/2011 17:45:12
712,146
04/17/2011 13:19:36
1
0
Groovy reveal letter
Im building the pelmanism game 4 by 4 board which has 8 pairs of letters abcdefgh as it is a 4 by 4 board. and so far Ive came up with the programme below but im having difficulty in getting the programme in revealing the hidden letter which i have inputted in when asked for row and column number, can anyone help much appreciated.. println "This is a game of Pelmanism" println "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" println "You must match two cards on the 4 by 4 board." println "Each card has a matching pair of characters." println "You can turnover two cards at a time to see the characters." println "The characters that are matched will be removed." println "The characters that not matched will be hidden." println (" ") import javax.swing.* def int ask (question) { def txt txt = JOptionPane.showInputDialog (question) int answer = Integer.parseInt(txt) return answer } int row, column row = ask ("Enter row number (number between 1 and 4)") column = ask ("Enter column number (number between 1 and 4)") def battle = new Object [4][4] for (i in 0..3) { for (j in 0..3) { battle[i][j] = "X" } } println (" 1 2 3 4") println (" -----------------") for (i in 0..3) { print (i+1) print (" ") for (j in 0..3) { printf ("| %s ", battle[i][j]) } println("|") println (" -----------------") }
groovy
null
null
null
null
05/12/2011 14:16:21
not a real question
Groovy reveal letter === Im building the pelmanism game 4 by 4 board which has 8 pairs of letters abcdefgh as it is a 4 by 4 board. and so far Ive came up with the programme below but im having difficulty in getting the programme in revealing the hidden letter which i have inputted in when asked for row and column number, can anyone help much appreciated.. println "This is a game of Pelmanism" println "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" println "You must match two cards on the 4 by 4 board." println "Each card has a matching pair of characters." println "You can turnover two cards at a time to see the characters." println "The characters that are matched will be removed." println "The characters that not matched will be hidden." println (" ") import javax.swing.* def int ask (question) { def txt txt = JOptionPane.showInputDialog (question) int answer = Integer.parseInt(txt) return answer } int row, column row = ask ("Enter row number (number between 1 and 4)") column = ask ("Enter column number (number between 1 and 4)") def battle = new Object [4][4] for (i in 0..3) { for (j in 0..3) { battle[i][j] = "X" } } println (" 1 2 3 4") println (" -----------------") for (i in 0..3) { print (i+1) print (" ") for (j in 0..3) { printf ("| %s ", battle[i][j]) } println("|") println (" -----------------") }
1
9,317,608
02/16/2012 19:17:13
644,978
03/04/2011 15:24:22
308
3
Chained Select Menu works great, but requires small tweak. AJAX / PHP / MySQL
Currently I have my chained select menus working great. However currently when the page loads **the first dropdown menu is completely empty**. I would prefer to populate the <select> menu initially with ALL the results from: **SELECT * FROM employees** and then if the user chooses an option from 2nd dropdown, it would then initiate the AJAX and filter the results based on the selection. Is this possible? Here are my files: **dept_form.html (HTML Form) :** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Employees by Department</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> <script src="ajax.js" type="text/javascript"></script> <script src="dept.js" type="text/javascript"></script> <style type="text/css" media="all">@import "style.css";</style> </head> <body> <!-- dept_form_ajax.html --> <p>Select a department and click 'GO' to see the employees in that department.</p> <form action="" method="get" id="dept_form"> <select id="results"></select> <p> <select id="did" name="did"> <option value="1">Human Resources</option> <option value="2">Accounting</option> <option value="3">Marketing</option> <option value="4">Redundancy Department</option> </select> </p> </form> </body> </html> **ajax.js :** // ajax.js /* This page defines a function for creating an Ajax request object. * This page should be included by other pages that * need to perform an XMLHttpRequest. */ /* Function for creating the XMLHttpRequest object. * Function takes no arguments. * Function returns a browser-specific XMLHttpRequest object * or returns the Boolean value false. */ function getXMLHttpRequestObject() { // Initialize the object: var ajax = false; // Choose object type based upon what's supported: if (window.XMLHttpRequest) { // IE 7, Mozilla, Safari, Firefox, Opera, most browsers: ajax = new XMLHttpRequest(); } else if (window.ActiveXObject) { // Older IE browsers // Create type Msxml2.XMLHTTP, if possible: try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { // Create the older type instead: try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } // End of main IF-ELSE IF. // Return the value: return ajax; } // End of getXMLHttpRequestObject() function. **dept.js :** // dept.js /* This page does all the magic for applying * Ajax to an employees listing form. * The department_id is sent to a PHP * script which will return data in HTML format. */ // Have a function run after the page loads: window.onload = init; // Function that adds the Ajax layer: function init() { // Get an XMLHttpRequest object: var ajax = getXMLHttpRequestObject(); // Attach the function call to the form submission, if supported: if (ajax) { // Check for DOM support: if (document.getElementById('results')) { // Add an onsubmit event handler to the form: $('#did').change(function() { // Call the PHP script. // Use the GET method. // Pass the department_id in the URL. // Get the department_id: var did = document.getElementById('did').value; // Open the connection: ajax.open('get', 'dept_results_ajax.php?did=' + encodeURIComponent(did)); // Function that handles the response: ajax.onreadystatechange = function() { // Pass it this request object: handleResponse(ajax); } // Send the request: ajax.send(null); return false; // So form isn't submitted. } // End of anonymous function. )} // End of DOM check. } // End of ajax IF. } // End of init() function. // Function that handles the response from the PHP script: function handleResponse(ajax) { // Check that the transaction is complete: if (ajax.readyState == 4) { // Check for a valid HTTP status code: if ((ajax.status == 200) || (ajax.status == 304) ) { // Put the received response in the DOM: var results = document.getElementById('results'); results.innerHTML = ajax.responseText; // Make the results box visible: results.style.display = 'block'; } else { // Bad status code, submit the form. document.getElementById('dept_form').submit(); } } // End of readyState IF. } // End of handleResponse() function. **dept_results_ajax.php** <?php # dept_results_ajax.php // No need to make a full HTML document! // Validate the received department ID: $did = 0; // Initialized value. if (isset($_GET['did'])) { // Received by the page. $did = (int) $_GET['did']; // Type-cast to int. } // Make sure the department ID is a positive integer: if ($did > 0) { // Get the employees from the database... // Include the database connection script: require_once('mysql.inc.php'); // Query the database: $q = "SELECT * FROM employees WHERE department_id=$did ORDER BY last_name, first_name"; $r = mysql_query($q, $dbc); // Check that some results were returned: if (mysql_num_rows($r) > 0) { // Retrieve the results: while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { ?> <option value="<?php echo $row['last_name']; ?>"><?php echo $row['last_name']; ?></option> <?php } // End of WHILE loop. } else { // No employees. echo '<p class="error">There are no employees listed for the given department.</p>'; } // Close the database connection. mysql_close($dbc); } else { // Invalid department ID! echo '<p class="error">Please select a valid department from the drop-down menu in order to view its employees.</p>'; } ?> Can someone explain the change I need to make in my scripts to achieve what I require. Many thanks for any pointers. Very much appreciated.
php
mysql
ajax
select
menu
null
open
Chained Select Menu works great, but requires small tweak. AJAX / PHP / MySQL === Currently I have my chained select menus working great. However currently when the page loads **the first dropdown menu is completely empty**. I would prefer to populate the <select> menu initially with ALL the results from: **SELECT * FROM employees** and then if the user chooses an option from 2nd dropdown, it would then initiate the AJAX and filter the results based on the selection. Is this possible? Here are my files: **dept_form.html (HTML Form) :** <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Employees by Department</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js" type="text/javascript"></script> <script src="ajax.js" type="text/javascript"></script> <script src="dept.js" type="text/javascript"></script> <style type="text/css" media="all">@import "style.css";</style> </head> <body> <!-- dept_form_ajax.html --> <p>Select a department and click 'GO' to see the employees in that department.</p> <form action="" method="get" id="dept_form"> <select id="results"></select> <p> <select id="did" name="did"> <option value="1">Human Resources</option> <option value="2">Accounting</option> <option value="3">Marketing</option> <option value="4">Redundancy Department</option> </select> </p> </form> </body> </html> **ajax.js :** // ajax.js /* This page defines a function for creating an Ajax request object. * This page should be included by other pages that * need to perform an XMLHttpRequest. */ /* Function for creating the XMLHttpRequest object. * Function takes no arguments. * Function returns a browser-specific XMLHttpRequest object * or returns the Boolean value false. */ function getXMLHttpRequestObject() { // Initialize the object: var ajax = false; // Choose object type based upon what's supported: if (window.XMLHttpRequest) { // IE 7, Mozilla, Safari, Firefox, Opera, most browsers: ajax = new XMLHttpRequest(); } else if (window.ActiveXObject) { // Older IE browsers // Create type Msxml2.XMLHTTP, if possible: try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { // Create the older type instead: try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } // End of main IF-ELSE IF. // Return the value: return ajax; } // End of getXMLHttpRequestObject() function. **dept.js :** // dept.js /* This page does all the magic for applying * Ajax to an employees listing form. * The department_id is sent to a PHP * script which will return data in HTML format. */ // Have a function run after the page loads: window.onload = init; // Function that adds the Ajax layer: function init() { // Get an XMLHttpRequest object: var ajax = getXMLHttpRequestObject(); // Attach the function call to the form submission, if supported: if (ajax) { // Check for DOM support: if (document.getElementById('results')) { // Add an onsubmit event handler to the form: $('#did').change(function() { // Call the PHP script. // Use the GET method. // Pass the department_id in the URL. // Get the department_id: var did = document.getElementById('did').value; // Open the connection: ajax.open('get', 'dept_results_ajax.php?did=' + encodeURIComponent(did)); // Function that handles the response: ajax.onreadystatechange = function() { // Pass it this request object: handleResponse(ajax); } // Send the request: ajax.send(null); return false; // So form isn't submitted. } // End of anonymous function. )} // End of DOM check. } // End of ajax IF. } // End of init() function. // Function that handles the response from the PHP script: function handleResponse(ajax) { // Check that the transaction is complete: if (ajax.readyState == 4) { // Check for a valid HTTP status code: if ((ajax.status == 200) || (ajax.status == 304) ) { // Put the received response in the DOM: var results = document.getElementById('results'); results.innerHTML = ajax.responseText; // Make the results box visible: results.style.display = 'block'; } else { // Bad status code, submit the form. document.getElementById('dept_form').submit(); } } // End of readyState IF. } // End of handleResponse() function. **dept_results_ajax.php** <?php # dept_results_ajax.php // No need to make a full HTML document! // Validate the received department ID: $did = 0; // Initialized value. if (isset($_GET['did'])) { // Received by the page. $did = (int) $_GET['did']; // Type-cast to int. } // Make sure the department ID is a positive integer: if ($did > 0) { // Get the employees from the database... // Include the database connection script: require_once('mysql.inc.php'); // Query the database: $q = "SELECT * FROM employees WHERE department_id=$did ORDER BY last_name, first_name"; $r = mysql_query($q, $dbc); // Check that some results were returned: if (mysql_num_rows($r) > 0) { // Retrieve the results: while ($row = mysql_fetch_array($r, MYSQL_ASSOC)) { ?> <option value="<?php echo $row['last_name']; ?>"><?php echo $row['last_name']; ?></option> <?php } // End of WHILE loop. } else { // No employees. echo '<p class="error">There are no employees listed for the given department.</p>'; } // Close the database connection. mysql_close($dbc); } else { // Invalid department ID! echo '<p class="error">Please select a valid department from the drop-down menu in order to view its employees.</p>'; } ?> Can someone explain the change I need to make in my scripts to achieve what I require. Many thanks for any pointers. Very much appreciated.
0
5,672,450
04/15/2011 04:38:22
458,548
09/26/2010 05:52:04
89
10
Silverlight 5 hardware acceleration
In order to gain the benefits of Hardware acceleration or any performance improvements in Silverlight 5 (beta), whether the client need to have IE9+. Can performance improvement be gained using IE6/IE7. Whether performance features of Silverlight 5 are browser dependent? Thanks.
silverlight
hardware-acceleration
null
null
null
null
open
Silverlight 5 hardware acceleration === In order to gain the benefits of Hardware acceleration or any performance improvements in Silverlight 5 (beta), whether the client need to have IE9+. Can performance improvement be gained using IE6/IE7. Whether performance features of Silverlight 5 are browser dependent? Thanks.
0
10,544,994
05/11/2012 03:20:41
446,262
09/13/2010 11:41:58
190
1
Axis call hang tomcat
I have tomcat application which uses webservice using apache axis. Everything works fine if single user is using application. Multiple user are also working fine except in one condition. I have webservice call which can take 30 sec. When more than one user call a controller which uses this particular method, both thread seems to go into deadlock condition. Worst part is it hangs whole application. I am able to reproduce this condition in local environment many times, so i am very confident that this particular call block if requested by more than one user at same time. I also tried setting timeout in web service call using axis specific method ((Stub)service).setTimeout(1000*60); but its also not working. Is anyone face this condition before. I have no clue why single thread blocking hang whole tomcat. Tomcat is working but it stopped responding to any other request. I am using spring for my web application.
spring
apache
tomcat6
axis
hang
null
open
Axis call hang tomcat === I have tomcat application which uses webservice using apache axis. Everything works fine if single user is using application. Multiple user are also working fine except in one condition. I have webservice call which can take 30 sec. When more than one user call a controller which uses this particular method, both thread seems to go into deadlock condition. Worst part is it hangs whole application. I am able to reproduce this condition in local environment many times, so i am very confident that this particular call block if requested by more than one user at same time. I also tried setting timeout in web service call using axis specific method ((Stub)service).setTimeout(1000*60); but its also not working. Is anyone face this condition before. I have no clue why single thread blocking hang whole tomcat. Tomcat is working but it stopped responding to any other request. I am using spring for my web application.
0
8,536,904
12/16/2011 16:11:45
641,843
03/02/2011 19:45:05
335
1
MySQL slow first query for key limit 1
I have a 500mb table and perform queries to that for a specific key. Since the table reached over 400k rows the first query is approx 3 sec and the follwing very fast, down to 0.001 sec. Can I solve this with a better table structure and without increasing the database memory? The table and keys are set as following: CREATE TABLE IF NOT EXISTS `mytable` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `isbn` varchar(13) NOT NULL, `dist_id` varchar(20) NOT NULL, `title` varchar(150) NOT NULL, `title_under` varchar(250) NOT NULL, `author` varchar(250) NOT NULL, `pub` varchar(100) NOT NULL, `pub_place` varchar(40) NOT NULL, `date` varchar(4) NOT NULL, `edition` varchar(40) NOT NULL, `subject` varchar(240) NOT NULL, `holdings` varchar(250) NOT NULL, `image` varchar(150) NOT NULL, `rating_g` float(5,2) NOT NULL, `rating_r` int(11) NOT NULL, `last_change` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `isbn` (`isbn`), FULLTEXT KEY `title_title_under` (`title`,`title_under`), FULLTEXT KEY `author` (`author`), FULLTEXT KEY `isbn_title_title_under_author_date_edition_subject` (`isbn`,`title`,`title_under`,`author`,`date`,`edition`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=492755 ; Explain of the mentioned query gives: EXPLAIN SELECT * FROM mytable WHERE id =304243 LIMIT 1 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE mytable const PRIMARY PRIMARY 8 const 1 Show index of the table gives: SHOW INDEX FROM mytable Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment mytable 0 PRIMARY 1 id A 492753 NULL NULL BTREE mytable 0 isbn 1 isbn A 492753 NULL NULL BTREE mytable 1 tit.. 1 title NULL 1 NULL NULL FULLTEXT mytable 1 tit.. 2 title.. NULL 1 NULL NULL FULLTEXT mytable 1 author 1 author NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 1 isbn NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 2 title NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 3 title.. NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 4 author NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 5 date NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 6 edition NULL 1 NULL NULL FULLTEXT
mysql
phpmyadmin
myisam
null
null
null
open
MySQL slow first query for key limit 1 === I have a 500mb table and perform queries to that for a specific key. Since the table reached over 400k rows the first query is approx 3 sec and the follwing very fast, down to 0.001 sec. Can I solve this with a better table structure and without increasing the database memory? The table and keys are set as following: CREATE TABLE IF NOT EXISTS `mytable` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `isbn` varchar(13) NOT NULL, `dist_id` varchar(20) NOT NULL, `title` varchar(150) NOT NULL, `title_under` varchar(250) NOT NULL, `author` varchar(250) NOT NULL, `pub` varchar(100) NOT NULL, `pub_place` varchar(40) NOT NULL, `date` varchar(4) NOT NULL, `edition` varchar(40) NOT NULL, `subject` varchar(240) NOT NULL, `holdings` varchar(250) NOT NULL, `image` varchar(150) NOT NULL, `rating_g` float(5,2) NOT NULL, `rating_r` int(11) NOT NULL, `last_change` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`id`), UNIQUE KEY `isbn` (`isbn`), FULLTEXT KEY `title_title_under` (`title`,`title_under`), FULLTEXT KEY `author` (`author`), FULLTEXT KEY `isbn_title_title_under_author_date_edition_subject` (`isbn`,`title`,`title_under`,`author`,`date`,`edition`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=492755 ; Explain of the mentioned query gives: EXPLAIN SELECT * FROM mytable WHERE id =304243 LIMIT 1 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE mytable const PRIMARY PRIMARY 8 const 1 Show index of the table gives: SHOW INDEX FROM mytable Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment mytable 0 PRIMARY 1 id A 492753 NULL NULL BTREE mytable 0 isbn 1 isbn A 492753 NULL NULL BTREE mytable 1 tit.. 1 title NULL 1 NULL NULL FULLTEXT mytable 1 tit.. 2 title.. NULL 1 NULL NULL FULLTEXT mytable 1 author 1 author NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 1 isbn NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 2 title NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 3 title.. NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 4 author NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 5 date NULL 1 NULL NULL FULLTEXT mytable 1 isbn_.. 6 edition NULL 1 NULL NULL FULLTEXT
0
1,651,058
10/30/2009 16:55:34
181,948
09/30/2009 16:01:31
8
0
Loading Images from different UserControls in Silverlight
Loading images in Silverlight has many options depending on what you want to do, but this small problem has me slightly confused. Hopefully somebody here can help me out! In the web project, within the ClientBin directory I have a directory called Images which contains a png file. In the MainPage.xaml file, I can create an Image object, call it mainImage and then in the code behind use this in the constructor: BitmapImage src = new BitmapImage(new Uri("Images/myImage.png", UriKind.Relative)); mainImage.SetValue(Image.SourceProperty, src); This all works fine, however when I create a UserControl with the same functionality and then create an instance of that control on the MainPage.xaml the application runs but I get no images. Why is this? I will also point out that the new user control has been created in a Controls folder and so has a different namespace (solutionName.Controls or whatever) Any help would be great, and if you need any more info please ask (tried to keep it brief) Kris
silverlight
null
null
null
null
null
open
Loading Images from different UserControls in Silverlight === Loading images in Silverlight has many options depending on what you want to do, but this small problem has me slightly confused. Hopefully somebody here can help me out! In the web project, within the ClientBin directory I have a directory called Images which contains a png file. In the MainPage.xaml file, I can create an Image object, call it mainImage and then in the code behind use this in the constructor: BitmapImage src = new BitmapImage(new Uri("Images/myImage.png", UriKind.Relative)); mainImage.SetValue(Image.SourceProperty, src); This all works fine, however when I create a UserControl with the same functionality and then create an instance of that control on the MainPage.xaml the application runs but I get no images. Why is this? I will also point out that the new user control has been created in a Controls folder and so has a different namespace (solutionName.Controls or whatever) Any help would be great, and if you need any more info please ask (tried to keep it brief) Kris
0
8,859,920
01/14/2012 03:27:03
10,659
09/16/2008 00:45:01
4,358
274
C# Where is my main menu?
The menu works fine. GenerateMember is on. The problem is that I'm trying to manipulate it in code (to put in a few dynamic items) and I can't find it. MainMenuStrip is null. Menu is null. It can't be in controls because it doesn't inherit from a Control. Where is it???
c#
menubar
null
null
null
01/15/2012 01:56:53
not a real question
C# Where is my main menu? === The menu works fine. GenerateMember is on. The problem is that I'm trying to manipulate it in code (to put in a few dynamic items) and I can't find it. MainMenuStrip is null. Menu is null. It can't be in controls because it doesn't inherit from a Control. Where is it???
1
325,392
11/28/2008 09:50:33
38,578
11/18/2008 13:45:23
6
1
Again a jquery doubt...
I am calling a .txt file from a jquery ajax call, it has some special characters like "±". this ± is delimiter for a set of array...data i want to split it out and push into a js array. but it is not treated as ± symbol when interpreted like this. so how do i get that data as just like browser content?
jquery
ajax
request
response
html
null
open
Again a jquery doubt... === I am calling a .txt file from a jquery ajax call, it has some special characters like "±". this ± is delimiter for a set of array...data i want to split it out and push into a js array. but it is not treated as ± symbol when interpreted like this. so how do i get that data as just like browser content?
0
7,248,877
08/30/2011 19:44:09
67,878
02/18/2009 15:15:33
135
2
In Lua how do you import modules?
Do you use require "name" or local name = require "name" Also, do you explicitly declare system modules as local variables? E.g. local io = require "io" Please explain your choice. Programming in Lua 2ed says "if she prefers to use a shorter name for a module, she can set a local name for it" and nothing about `local m = require "mod"` being faster than `require "mod"`. If there's no difference I'd rather use the cleaner `require "mod"` declaration and wouldn't bother writing declarations for pre-loaded system modules.
import
module
lua
declaration
require
null
open
In Lua how do you import modules? === Do you use require "name" or local name = require "name" Also, do you explicitly declare system modules as local variables? E.g. local io = require "io" Please explain your choice. Programming in Lua 2ed says "if she prefers to use a shorter name for a module, she can set a local name for it" and nothing about `local m = require "mod"` being faster than `require "mod"`. If there's no difference I'd rather use the cleaner `require "mod"` declaration and wouldn't bother writing declarations for pre-loaded system modules.
0
1,175,973
07/24/2009 06:12:59
11,464
09/16/2008 08:13:57
603
13
Enterprise library for .NET
what enterprise library are you using for your enterprise projects? beside Microsoft Enterprise Library? Thanks
enterprise-library
.net
null
null
null
06/17/2012 15:56:45
not constructive
Enterprise library for .NET === what enterprise library are you using for your enterprise projects? beside Microsoft Enterprise Library? Thanks
4
7,096,971
08/17/2011 17:30:37
899,143
08/17/2011 17:30:37
1
0
Looping a querySelectorAll array
So I am working on a javascript screen scraper, and I have come to this : <tr > <td class="c"><a href="page.php?id=20">Item1</a></td> <td><a href="page2.php?id=22987">Item2</a></td> <td class="r np vm">irrelevent</td> <td class="r">Item3</td> <td>also irrelevent</td> <td class="r np vm" >Item4</td> <td class="r">Item5</td> </tr> There are 50 of these type TRs, and I want to get the values for the following on all 50 occurrences: - Item 1 - the ID on item 2 - Item 2 - Item 3 - Item 4 - Item 5 for each occurrence I want to do: GM_xmlhttpRequest({ method: 'GET', url: 'http://www.mysite.com/collect.php?item1=' + item1 + '&item2id=' + id + '&item2=' + item2 + '&item3=' + item3 + '&item4=' + item4 + '&item5=' + five; }); The way I have been collecting data on the other pages is with document.querySelectorAll, and I have been very pleased with its efficiency. But I'm not really what to do here. var item1 = document.querySelectorAll(' table.sep tbody tr td.c a'); var item2id = i have no idea :p var item2 = document.querySelectorAll(' table.sep tbody tr td a'); var item3 = document.querySelectorAll(' table.sep tbody tr td.r'); var item4 = document.querySelectorAll(' table.sep tbody tr td.r'); var item5 = document.querySelectorAll(' table.sep tbody tr td.r'); those are the CSS paths for the elements, but I don't want to have to go through item1[1].innerHTML all the way to item1[50].innerHTML . So any help making a loop that gets these things would be VERY VERY VERY appreciated. Thanks, Denver
javascript
screen-scraping
null
null
null
05/22/2012 10:17:34
too localized
Looping a querySelectorAll array === So I am working on a javascript screen scraper, and I have come to this : <tr > <td class="c"><a href="page.php?id=20">Item1</a></td> <td><a href="page2.php?id=22987">Item2</a></td> <td class="r np vm">irrelevent</td> <td class="r">Item3</td> <td>also irrelevent</td> <td class="r np vm" >Item4</td> <td class="r">Item5</td> </tr> There are 50 of these type TRs, and I want to get the values for the following on all 50 occurrences: - Item 1 - the ID on item 2 - Item 2 - Item 3 - Item 4 - Item 5 for each occurrence I want to do: GM_xmlhttpRequest({ method: 'GET', url: 'http://www.mysite.com/collect.php?item1=' + item1 + '&item2id=' + id + '&item2=' + item2 + '&item3=' + item3 + '&item4=' + item4 + '&item5=' + five; }); The way I have been collecting data on the other pages is with document.querySelectorAll, and I have been very pleased with its efficiency. But I'm not really what to do here. var item1 = document.querySelectorAll(' table.sep tbody tr td.c a'); var item2id = i have no idea :p var item2 = document.querySelectorAll(' table.sep tbody tr td a'); var item3 = document.querySelectorAll(' table.sep tbody tr td.r'); var item4 = document.querySelectorAll(' table.sep tbody tr td.r'); var item5 = document.querySelectorAll(' table.sep tbody tr td.r'); those are the CSS paths for the elements, but I don't want to have to go through item1[1].innerHTML all the way to item1[50].innerHTML . So any help making a loop that gets these things would be VERY VERY VERY appreciated. Thanks, Denver
3
8,881,284
01/16/2012 14:20:09
1,152,001
01/16/2012 14:12:36
1
0
ExtJS not rendering my controls
I have a Panel (Ext.define('Ext.chooser.Panel', {extend: 'Ext.panel.Panel'...) which contains another custom panel ( items: {xtype: 'iconbrowser',) and renders correctly as far as I can see. However the sub-panel contains a combo box which is not rendering (in fact nothing renders in the sub-panel unless i use renderTo tags and point it at DIV's outside of the ExtJs framework this.items = [ Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Select a single state', displayField: 'name', width: 320, labelWidth: 130, store: store, queryMode: 'local', typeAhead: true //add renderTo here to have this render elsewhere in the document })] Does anybody have any clues as to where i am going wrong?
extjs4
null
null
null
null
null
open
ExtJS not rendering my controls === I have a Panel (Ext.define('Ext.chooser.Panel', {extend: 'Ext.panel.Panel'...) which contains another custom panel ( items: {xtype: 'iconbrowser',) and renders correctly as far as I can see. However the sub-panel contains a combo box which is not rendering (in fact nothing renders in the sub-panel unless i use renderTo tags and point it at DIV's outside of the ExtJs framework this.items = [ Ext.create('Ext.form.field.ComboBox', { fieldLabel: 'Select a single state', displayField: 'name', width: 320, labelWidth: 130, store: store, queryMode: 'local', typeAhead: true //add renderTo here to have this render elsewhere in the document })] Does anybody have any clues as to where i am going wrong?
0
8,483,442
12/13/2011 01:54:03
857,071
07/22/2011 00:47:33
324
12
2d Platformer Terrain generation in java
I am making a 2d platformer, and am trying to get some auto-terrain generation. I have found a Perlin noise function, however it isn't really helping, it is generated noise, but there are some platforms high in the air, and sometimes the perlin noise will output something good, but most of the time it isn't that "playable". How can I make simple terrain generation for a 2d platformer, in Java? A point in the right direction would be perfect.
java
2d
auto-generate
terrain
2d-games
null
open
2d Platformer Terrain generation in java === I am making a 2d platformer, and am trying to get some auto-terrain generation. I have found a Perlin noise function, however it isn't really helping, it is generated noise, but there are some platforms high in the air, and sometimes the perlin noise will output something good, but most of the time it isn't that "playable". How can I make simple terrain generation for a 2d platformer, in Java? A point in the right direction would be perfect.
0
7,257,809
08/31/2011 13:43:27
578,083
01/17/2011 05:22:12
145
5
how to create a container with rounded corner using css1?
I want to create a container which will have rounded corner without using images(only using border and div tags). And it should work with all the browsers.
css
null
null
null
null
08/31/2011 22:02:21
not a real question
how to create a container with rounded corner using css1? === I want to create a container which will have rounded corner without using images(only using border and div tags). And it should work with all the browsers.
1
3,094,416
06/22/2010 15:03:17
280,564
02/24/2010 17:59:49
20
1
EF 4.0 Dynamic Proxies POCO Object Does not match target type.
I am using EF 4.0 and POCO's. I stumbled across this error while inserting to records into the data base. Property accessor 'QualityReasonID' on object 'BI.Entities.QualityReason' threw the following exception:'Object does not match target type.' There errors occur on the Databind to a GridView after saving a new record to the database. I identified what is happening but I am not sure WHY it is occurring or If I am using EF/POCO's incorrectly. Any insight would be appreciated. The exception is occuring because the object types in the IEnumerable are not the same. The orginal entrys in the talbe of type System.Data.Entity.DynamicProxies.QualityReason_E483AD567288B459706092F1825F53B1F93C65C5329F8095DD1D848B5D039F04} While the new one is BI.Entities.QuailtyReason. Here is how I insert the new object. public void createQualityReason(QualityReason qReasons) { dbcontext.QualityReasons.AddObject(qReasons); dbcontext.SaveChanges(); } I resolved the error by changing the fetch code from: public IEnumerable<QualityReason> fetchQualityReasons() { IEnumerable<QualityReason> queryReasons = dbcontext.QualityReasons.AsEnumerable(); return queryReasons; } to public IEnumerable<QualityReason> fetchQualityReasons() { IEnumerable<QualityReason> queryReasons = from data in dbcontext.QualityReasons.AsEnumerable() select new QualityReason { QualityReasonID = data.QualityReasonID, QualityReasonName = data.QualityReasonName }; return queryReasons; } So to get around the error I have to select into the POCO class explicitly each time. This feels like I am going something wrong. Any thoughts?
entity-framework
entity-framework-4
poco
dynamic-proxy
null
null
open
EF 4.0 Dynamic Proxies POCO Object Does not match target type. === I am using EF 4.0 and POCO's. I stumbled across this error while inserting to records into the data base. Property accessor 'QualityReasonID' on object 'BI.Entities.QualityReason' threw the following exception:'Object does not match target type.' There errors occur on the Databind to a GridView after saving a new record to the database. I identified what is happening but I am not sure WHY it is occurring or If I am using EF/POCO's incorrectly. Any insight would be appreciated. The exception is occuring because the object types in the IEnumerable are not the same. The orginal entrys in the talbe of type System.Data.Entity.DynamicProxies.QualityReason_E483AD567288B459706092F1825F53B1F93C65C5329F8095DD1D848B5D039F04} While the new one is BI.Entities.QuailtyReason. Here is how I insert the new object. public void createQualityReason(QualityReason qReasons) { dbcontext.QualityReasons.AddObject(qReasons); dbcontext.SaveChanges(); } I resolved the error by changing the fetch code from: public IEnumerable<QualityReason> fetchQualityReasons() { IEnumerable<QualityReason> queryReasons = dbcontext.QualityReasons.AsEnumerable(); return queryReasons; } to public IEnumerable<QualityReason> fetchQualityReasons() { IEnumerable<QualityReason> queryReasons = from data in dbcontext.QualityReasons.AsEnumerable() select new QualityReason { QualityReasonID = data.QualityReasonID, QualityReasonName = data.QualityReasonName }; return queryReasons; } So to get around the error I have to select into the POCO class explicitly each time. This feels like I am going something wrong. Any thoughts?
0
10,284,080
04/23/2012 16:04:30
1,351,598
04/23/2012 14:41:22
1
3
CodeFirst Reverse Engineering...Is it worth the hassle?
My company has an extremely large and complex SQL Server database. I would like to use Entity Framework via a Code Centric - Code First Approach. The reverse engineering of such a monster seems cumbersome. I can definitely see the benefit of having it in Code First. The frequent versioning of EF also makes me a bit uncomfortable. Should I stick to Database First?
entity-framework
entity-framework-4.1
code-first
null
null
null
open
CodeFirst Reverse Engineering...Is it worth the hassle? === My company has an extremely large and complex SQL Server database. I would like to use Entity Framework via a Code Centric - Code First Approach. The reverse engineering of such a monster seems cumbersome. I can definitely see the benefit of having it in Code First. The frequent versioning of EF also makes me a bit uncomfortable. Should I stick to Database First?
0
4,809,076
01/26/2011 19:31:54
310,291
03/02/2010 15:22:39
1,907
16
Why Java and C# is not designed for being Agile and depends on Vendor Tools for refactoring ?
Designing an API is hard because you cannot refactor Packages when client code are not under your control. Second even when that code is under your control you need to buy special IDE to do that (see http://stackoverflow.com/questions/4807859/easiest-way-to-refactor-package-in-c-or-java ) Why since refactoring and agile is so important Java and C# didn't evolve to support statement such as using package.* so that you can refactor this packages inside the big one without using any tool and above all without impacting client's code which are not under your control ?
c#
java
.net
null
null
01/26/2011 19:37:24
not a real question
Why Java and C# is not designed for being Agile and depends on Vendor Tools for refactoring ? === Designing an API is hard because you cannot refactor Packages when client code are not under your control. Second even when that code is under your control you need to buy special IDE to do that (see http://stackoverflow.com/questions/4807859/easiest-way-to-refactor-package-in-c-or-java ) Why since refactoring and agile is so important Java and C# didn't evolve to support statement such as using package.* so that you can refactor this packages inside the big one without using any tool and above all without impacting client's code which are not under your control ?
1
6,183,323
05/31/2011 05:23:50
524,723
11/30/2010 05:28:27
664
71
How to use html2pdf to print html pages
**I am using html2pdf library inorder to generate pdf from html file. i dont know how to check out width arrangements. i had got this library from source forge. if anyone know how to solve width problem or manual about html2pdf.** ***please intimate me in advance...***
php
html2pdf
null
null
null
05/31/2011 10:53:31
not a real question
How to use html2pdf to print html pages === **I am using html2pdf library inorder to generate pdf from html file. i dont know how to check out width arrangements. i had got this library from source forge. if anyone know how to solve width problem or manual about html2pdf.** ***please intimate me in advance...***
1
1,489,934
09/29/2009 00:03:36
161,094
08/21/2009 22:33:18
41
4
Where can I get a good vertical menu for asp.net mvc
Anyone have any idea where I can get a good collapsible (and stay open when selected) vertical menu for an asp.net mvc project?
jquery
null
null
null
null
null
open
Where can I get a good vertical menu for asp.net mvc === Anyone have any idea where I can get a good collapsible (and stay open when selected) vertical menu for an asp.net mvc project?
0
4,620,016
01/06/2011 21:23:26
379,568
06/30/2010 00:02:50
21
1
Boost.Spirit.Qi: Take a rule's attribute and set it as a field of an enclosing rule's struct attribute?
Like, many of these other questions, I'm trying to parse a simple grammar into a tree of structs using Boost.Spirit.Qi. I'll try to distill what I'm trying to do to the simplest possible case. I have: struct Integer { int value; }; BOOST_FUSION_ADAPT_STRUCT(Integer, (int, value)) Later, inside of a grammar struct, I have the following member variable: qi::rule<Iterator, Integer> integer; which I am defining with integer = qi::int_; When I try to actually parse an integer, however, using qi::phrase_parse(iter, end, g, space, myInteger); `myInteger.value` is always uninitialized after a successful parse. Similarly, I have tried the following definitions (obviously the ones that don't compile are wrong): integer = qi::int_[qi::_val = qi::_1]; //compiles, uninitialized value integer = qi::int_[qi::_r1 = qi::_1]; //doesn't compile integer = qi::int_[phoenix::bind(&Integer::value, qi::_val) = qi::_1]; //doesn't integer = qi::int_[phoenix::at_c<0>(qi::_val) = qi::_1]; //doesn't Clearly I am misunderstanding something about Spirit, Phoenix, or something else. My understanding is that `qi::_1` is the first attribute of `qi::int_`, here, and should represent the parsed integer, when the part in the square brackets gets executed as a function object. I am then assuming that the function object will take the enclosing `integer` attribute `qi::_val` and try and assign the parsed integer to it. My guess was that because of my `BOOST_FUSION_ADAPT_STRUCT` call, the two would be compatible, and that certainly seems to be the case from a static analysis perspective, but the data is not being preserved. Is there a reference(&) designation I am missing somewhere or something?
c++
boost-spirit
boost-spirit-qi
boost-phoenix
null
null
open
Boost.Spirit.Qi: Take a rule's attribute and set it as a field of an enclosing rule's struct attribute? === Like, many of these other questions, I'm trying to parse a simple grammar into a tree of structs using Boost.Spirit.Qi. I'll try to distill what I'm trying to do to the simplest possible case. I have: struct Integer { int value; }; BOOST_FUSION_ADAPT_STRUCT(Integer, (int, value)) Later, inside of a grammar struct, I have the following member variable: qi::rule<Iterator, Integer> integer; which I am defining with integer = qi::int_; When I try to actually parse an integer, however, using qi::phrase_parse(iter, end, g, space, myInteger); `myInteger.value` is always uninitialized after a successful parse. Similarly, I have tried the following definitions (obviously the ones that don't compile are wrong): integer = qi::int_[qi::_val = qi::_1]; //compiles, uninitialized value integer = qi::int_[qi::_r1 = qi::_1]; //doesn't compile integer = qi::int_[phoenix::bind(&Integer::value, qi::_val) = qi::_1]; //doesn't integer = qi::int_[phoenix::at_c<0>(qi::_val) = qi::_1]; //doesn't Clearly I am misunderstanding something about Spirit, Phoenix, or something else. My understanding is that `qi::_1` is the first attribute of `qi::int_`, here, and should represent the parsed integer, when the part in the square brackets gets executed as a function object. I am then assuming that the function object will take the enclosing `integer` attribute `qi::_val` and try and assign the parsed integer to it. My guess was that because of my `BOOST_FUSION_ADAPT_STRUCT` call, the two would be compatible, and that certainly seems to be the case from a static analysis perspective, but the data is not being preserved. Is there a reference(&) designation I am missing somewhere or something?
0
7,766,807
10/14/2011 11:15:40
675,006
03/24/2011 13:52:43
15
2
Can I use Jinja2 template inheritance where child templates having a variable base template
Based on the origin of a request I want to use another base template in a session. I now solved the problem using different base templates which include the children : {% include top_html %}, where top_html is a variable. Is there a nice way to do this with template inheritance in jinja. Maybe I can use {% extends base_html %}, where base_html is a variable, but I can't oversee whats the impact? I recently switched from django to ninja2. Solving this with one base template, makes the children complicated. F.i. when I add a new origin, I have to change all the children. That why my solution is : using variable top templates, which include the one and only base template, which is extended by its children.
python
templates
jinja2
null
null
null
open
Can I use Jinja2 template inheritance where child templates having a variable base template === Based on the origin of a request I want to use another base template in a session. I now solved the problem using different base templates which include the children : {% include top_html %}, where top_html is a variable. Is there a nice way to do this with template inheritance in jinja. Maybe I can use {% extends base_html %}, where base_html is a variable, but I can't oversee whats the impact? I recently switched from django to ninja2. Solving this with one base template, makes the children complicated. F.i. when I add a new origin, I have to change all the children. That why my solution is : using variable top templates, which include the one and only base template, which is extended by its children.
0
781,318
04/23/2009 11:32:28
94,921
04/23/2009 11:32:28
1
0
Problem with sql query. Should i be using union?
Have a problem that seems easy on paper but i'm having a big problem figuring out how best to write a single query. I have a table <pre> CREATE TABLE `profile_values` ( `fid` int(10) unsigned NOT NULL default '0', `uid` int(10) unsigned NOT NULL default '0', `value` text, PRIMARY KEY (`uid`,`fid`), KEY `fid` (`fid`) ) </pre> The point of this table is to store profile information on a user. E.g. a typically row would look like this.. <pre> fid | uid | value __________________ 1 | 77 | Mary 11 | 77 | Poppins 1 | 123 | Steve 11 | 123 | Davis </pre> Note: <pre> 'fid' of '1' represents the first name 'fid' of '11' represents the last name 'uid' is a users id within the site. </pre> What I am trying to achieve is to bring back all uid's that satisfy the condition of first name like 'S%' and last name like 'D%'. The reason i need this is because i have an autocomplete search box for users on the site. So if i type 'S' in the search box i will see list of all users that begin with the letter 'S', if i now type a whitespace and 'D' i should now be able to see the list of users who match both conditions. Does anyone have any idea how this can be accomplished? Thanks in advance.
mysql
sql
null
null
null
null
open
Problem with sql query. Should i be using union? === Have a problem that seems easy on paper but i'm having a big problem figuring out how best to write a single query. I have a table <pre> CREATE TABLE `profile_values` ( `fid` int(10) unsigned NOT NULL default '0', `uid` int(10) unsigned NOT NULL default '0', `value` text, PRIMARY KEY (`uid`,`fid`), KEY `fid` (`fid`) ) </pre> The point of this table is to store profile information on a user. E.g. a typically row would look like this.. <pre> fid | uid | value __________________ 1 | 77 | Mary 11 | 77 | Poppins 1 | 123 | Steve 11 | 123 | Davis </pre> Note: <pre> 'fid' of '1' represents the first name 'fid' of '11' represents the last name 'uid' is a users id within the site. </pre> What I am trying to achieve is to bring back all uid's that satisfy the condition of first name like 'S%' and last name like 'D%'. The reason i need this is because i have an autocomplete search box for users on the site. So if i type 'S' in the search box i will see list of all users that begin with the letter 'S', if i now type a whitespace and 'D' i should now be able to see the list of users who match both conditions. Does anyone have any idea how this can be accomplished? Thanks in advance.
0
10,750,102
05/25/2012 07:17:25
665,123
03/17/2011 21:16:16
35
7
Rails 3 RSpec controller testing Failure/Error:
I am testing my Rails 3.2 app and I faced an error when I tried to test my controller. This is my controller class WidgetsController < ApplicationController #skip_before_filter :authenticate, :only => [:new, :create] before_filter :authenticate, :except=>[:disabled] def index @widgets = current_user.widgets.all respond_to do |format| format.html # index.html.erb format.json { render json: @widgets } end end def new @widget = Widget.new end def create @widget = Widget.new(params[:widget]) @widget.user_id = current_user.id @widget.score = 0 @widget.total_score = 0 @widget.click_number = 0 @widget.average = 0 respond_to do |format| if @widget.save format.html { redirect_to edit_widget_path(@widget), notice: 'Widget was successfully created.' } format.json { render json: @widget, status: :created, location: @widget } else format.html { render action: "new" } format.json { render json: @widget.errors, status: :unprocessable_entity } raise 'there is an error when creation' end end end def show @widget = Widget.find_by_uuid(params[:uuid]) end def edit @widget = Widget.find_by_uuid(params[:uuid]) end def update @widget = Widget.find_by_uuid(params[:uuid]) respond_to do |format| if @widget.update_attributes(params[:widget]) format.html { redirect_to edit_widget_path(@widget), notice: 'Widget was successfully updated.' } format.json { render json: @widget, status: :created, location: @widget } else format.html { render action: "edit" } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end def destroy @widget = Widget.find_by_uuid(params[:uuid]).destroy redirect_to widgets_path end #generate widget def generate respond_to do |format| format.js {} end rescue #TODO add widget not found page render :template => 'application/widget_not_found', :status => :not_found end protected def authenticate unless current_user redirect_to root_url end end end This is my controller spec require 'spec_helper' describe WidgetsController do login_admin describe "User" do it "should have a current_user" do subject.current_user.should_not be_nil end end def mock_widget(stubs={}) @mock_widget ||= mock_model(Widget, stubs).as_null_object end describe "GET index" do it "assigns all widgets as @widgets" do Widget.stub(:all) { [mock_widget] } get :index assigns(:widgets).should eq([mock_widget]) end end end I just want to see that I can get data on index page. However I have seen this error on command line when I run `$rspec spec/controllers/widgets_controller_spec.rb` .F Failures: 1) WidgetsController GET index assigns all widgets as @widgets Failure/Error: assigns(:widgets).should eq([mock_widget]) expected: [#<Widget:0x3ffb0c3c9d70 @name="Widget_1001">] got: [] (compared using ==) Diff: @@ -1,2 +1,2 @@ -[#<Widget:0x3ffb0c3c9d70 @name="Widget_1001">] +[] # ./spec/controllers/widgets_controller_spec.rb:20:in `block (3 levels) in <top (required)>' Finished in 0.11937 seconds 2 examples, 1 failure Failed examples: rspec ./spec/controllers/widgets_controller_spec.rb:17 # WidgetsController GET index assigns all widgets as @widgets I did this tutorial http://www.codethinked.com/rails-3-baby-steps-part-4 and I did not face with any problems. How should I fix it? What does this error mean?
ruby-on-rails-3
controller
rspec-rails
null
null
null
open
Rails 3 RSpec controller testing Failure/Error: === I am testing my Rails 3.2 app and I faced an error when I tried to test my controller. This is my controller class WidgetsController < ApplicationController #skip_before_filter :authenticate, :only => [:new, :create] before_filter :authenticate, :except=>[:disabled] def index @widgets = current_user.widgets.all respond_to do |format| format.html # index.html.erb format.json { render json: @widgets } end end def new @widget = Widget.new end def create @widget = Widget.new(params[:widget]) @widget.user_id = current_user.id @widget.score = 0 @widget.total_score = 0 @widget.click_number = 0 @widget.average = 0 respond_to do |format| if @widget.save format.html { redirect_to edit_widget_path(@widget), notice: 'Widget was successfully created.' } format.json { render json: @widget, status: :created, location: @widget } else format.html { render action: "new" } format.json { render json: @widget.errors, status: :unprocessable_entity } raise 'there is an error when creation' end end end def show @widget = Widget.find_by_uuid(params[:uuid]) end def edit @widget = Widget.find_by_uuid(params[:uuid]) end def update @widget = Widget.find_by_uuid(params[:uuid]) respond_to do |format| if @widget.update_attributes(params[:widget]) format.html { redirect_to edit_widget_path(@widget), notice: 'Widget was successfully updated.' } format.json { render json: @widget, status: :created, location: @widget } else format.html { render action: "edit" } format.json { render json: @widget.errors, status: :unprocessable_entity } end end end def destroy @widget = Widget.find_by_uuid(params[:uuid]).destroy redirect_to widgets_path end #generate widget def generate respond_to do |format| format.js {} end rescue #TODO add widget not found page render :template => 'application/widget_not_found', :status => :not_found end protected def authenticate unless current_user redirect_to root_url end end end This is my controller spec require 'spec_helper' describe WidgetsController do login_admin describe "User" do it "should have a current_user" do subject.current_user.should_not be_nil end end def mock_widget(stubs={}) @mock_widget ||= mock_model(Widget, stubs).as_null_object end describe "GET index" do it "assigns all widgets as @widgets" do Widget.stub(:all) { [mock_widget] } get :index assigns(:widgets).should eq([mock_widget]) end end end I just want to see that I can get data on index page. However I have seen this error on command line when I run `$rspec spec/controllers/widgets_controller_spec.rb` .F Failures: 1) WidgetsController GET index assigns all widgets as @widgets Failure/Error: assigns(:widgets).should eq([mock_widget]) expected: [#<Widget:0x3ffb0c3c9d70 @name="Widget_1001">] got: [] (compared using ==) Diff: @@ -1,2 +1,2 @@ -[#<Widget:0x3ffb0c3c9d70 @name="Widget_1001">] +[] # ./spec/controllers/widgets_controller_spec.rb:20:in `block (3 levels) in <top (required)>' Finished in 0.11937 seconds 2 examples, 1 failure Failed examples: rspec ./spec/controllers/widgets_controller_spec.rb:17 # WidgetsController GET index assigns all widgets as @widgets I did this tutorial http://www.codethinked.com/rails-3-baby-steps-part-4 and I did not face with any problems. How should I fix it? What does this error mean?
0
1,899,439
12/14/2009 07:23:26
229,374
12/11/2009 04:57:40
1
0
UI Development vs Server Side Development
I have recently been given the opportunity to move from large scale server development to UI development (applications on handheld devices etc) and am trying to find the pros and cons of each world before making a final decision. The general impression I get is that server development allows for a wider range of languages and technologies while UI development is more about choosing the right libraries for the job - but then again, I have no experience in the UI world. Any advice on this?
career-development
null
null
null
null
02/03/2012 05:28:15
not constructive
UI Development vs Server Side Development === I have recently been given the opportunity to move from large scale server development to UI development (applications on handheld devices etc) and am trying to find the pros and cons of each world before making a final decision. The general impression I get is that server development allows for a wider range of languages and technologies while UI development is more about choosing the right libraries for the job - but then again, I have no experience in the UI world. Any advice on this?
4
1,474,382
09/24/2009 21:56:05
30,176
10/21/2008 23:40:29
3,228
113
A Good and SIMPLE Measure of Randomness
What is the best algorithm to take a long sequence of integers (say 100,000 of them) and return a measurement of how random the sequence is? The function should return a single result, say 0 if the sequence is not all all random, up to, say 1 if perfectly random. It can give something in-between if the sequence is somewhat random, e.g. 0.95 might be a reasonably random sequence, whereas 0.50 might have some non-random parts and some random parts. If I were to pass the first 100,000 digits of Pi to the function, it should give a number very close to 1. If I passed the sequence 1, 2, ... 100,000 to it, it should return 0. Is there such an animal?
random
null
null
null
null
null
open
A Good and SIMPLE Measure of Randomness === What is the best algorithm to take a long sequence of integers (say 100,000 of them) and return a measurement of how random the sequence is? The function should return a single result, say 0 if the sequence is not all all random, up to, say 1 if perfectly random. It can give something in-between if the sequence is somewhat random, e.g. 0.95 might be a reasonably random sequence, whereas 0.50 might have some non-random parts and some random parts. If I were to pass the first 100,000 digits of Pi to the function, it should give a number very close to 1. If I passed the sequence 1, 2, ... 100,000 to it, it should return 0. Is there such an animal?
0
11,625,942
07/24/2012 07:17:56
1,500,804
07/04/2012 07:20:54
6
0
NullPointerException making me go insane.
Writing a UPnP control point application. However I keep getting a nullpointerexception: The first bit of code here is what causes the npe. In bold, the call to createAbsoluteURL. The rest are methods inside a different class (URIUtil), holding the different calls to createAbsoluteURL/URI content = new MediaStoreContent( context, **new URLBuilder() { public String getURL(DIDLObject object) { return URIUtil.createAbsoluteURL( addy, getHttpServerService().getLocalPort(), URI.create("/" + object.getId()) ).toString(); }** public String getObjectId(String urlPath) { return urlPath.substring(1); // Cut the slash } } ); public static URL createAbsoluteURL(InetAddress address, int localStreamPort, URI relativeOrNot) throws IllegalArgumentException { try { if (address instanceof Inet6Address) { return createAbsoluteURL(new URL("http://[" + address.getHostAddress() + "]:" + localStreamPort), relativeOrNot); } else if (address instanceof Inet4Address) { return createAbsoluteURL(new URL("http://" + address.getHostAddress() + ":" + localStreamPort), relativeOrNot); } else { throw new IllegalArgumentException("InetAddress is neither IPv4 nor IPv6: " + address); } } catch (Exception ex) { throw new IllegalArgumentException("Address, port, and URI can not be converted to URL", ex); } } public static URL createAbsoluteURL(URL base, URI relativeOrNot) throws IllegalArgumentException { if (base == null && !relativeOrNot.isAbsolute()) { throw new IllegalArgumentException("Base URL is null and given URI is not absolute"); } else if (base == null && relativeOrNot.isAbsolute()) { try { return relativeOrNot.toURL(); } catch (Exception ex) { throw new IllegalArgumentException("Base URL was null and given URI can't be converted to URL"); } } else { try { assert base != null; URI baseURI = base.toURI(); URI absoluteURI = createAbsoluteURI(baseURI, relativeOrNot); return absoluteURI.toURL(); } catch (Exception ex) { throw new IllegalArgumentException( "Base URL is not an URI, or can't create absolute URI (null?), " + "or absolute URI can not be converted to URL", ex); } } } public static URI createAbsoluteURI(URI base, URI relativeOrNot) throws IllegalArgumentException { if (base == null && !relativeOrNot.isAbsolute()) { throw new IllegalArgumentException("Base URI is null and given URI is not absolute"); } else if (base == null && relativeOrNot.isAbsolute()) { return relativeOrNot; } else { assert base != null; // If the given base URI has no path we give it a root path if (base.getPath().length() == 0) { try { base = new URI(base.getScheme(), base.getAuthority(), "/", base.getQuery(), base.getFragment()); } catch (Exception ex) { throw new IllegalArgumentException(ex); } } return base.resolve(relativeOrNot); } } Here is my log: E/AndroidRuntime( 9824): Caused by: java.lang.NullPointerException E/AndroidRuntime( 9824): at org.teleal.cling.android.browser.MediaServerS erviceImpl$ContentHttpServerConnection.<init>(MediaServerServiceImpl.java:159) E/AndroidRuntime( 9824): at org.teleal.cling.android.browser.MediaServerS erviceImpl.onCreate(MediaServerServiceImpl.java:72) E/AndroidRuntime( 9824): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2959) E/AndroidRuntime( 9824): ... 10 more
nullpointerexception
null
null
null
null
07/24/2012 15:53:46
too localized
NullPointerException making me go insane. === Writing a UPnP control point application. However I keep getting a nullpointerexception: The first bit of code here is what causes the npe. In bold, the call to createAbsoluteURL. The rest are methods inside a different class (URIUtil), holding the different calls to createAbsoluteURL/URI content = new MediaStoreContent( context, **new URLBuilder() { public String getURL(DIDLObject object) { return URIUtil.createAbsoluteURL( addy, getHttpServerService().getLocalPort(), URI.create("/" + object.getId()) ).toString(); }** public String getObjectId(String urlPath) { return urlPath.substring(1); // Cut the slash } } ); public static URL createAbsoluteURL(InetAddress address, int localStreamPort, URI relativeOrNot) throws IllegalArgumentException { try { if (address instanceof Inet6Address) { return createAbsoluteURL(new URL("http://[" + address.getHostAddress() + "]:" + localStreamPort), relativeOrNot); } else if (address instanceof Inet4Address) { return createAbsoluteURL(new URL("http://" + address.getHostAddress() + ":" + localStreamPort), relativeOrNot); } else { throw new IllegalArgumentException("InetAddress is neither IPv4 nor IPv6: " + address); } } catch (Exception ex) { throw new IllegalArgumentException("Address, port, and URI can not be converted to URL", ex); } } public static URL createAbsoluteURL(URL base, URI relativeOrNot) throws IllegalArgumentException { if (base == null && !relativeOrNot.isAbsolute()) { throw new IllegalArgumentException("Base URL is null and given URI is not absolute"); } else if (base == null && relativeOrNot.isAbsolute()) { try { return relativeOrNot.toURL(); } catch (Exception ex) { throw new IllegalArgumentException("Base URL was null and given URI can't be converted to URL"); } } else { try { assert base != null; URI baseURI = base.toURI(); URI absoluteURI = createAbsoluteURI(baseURI, relativeOrNot); return absoluteURI.toURL(); } catch (Exception ex) { throw new IllegalArgumentException( "Base URL is not an URI, or can't create absolute URI (null?), " + "or absolute URI can not be converted to URL", ex); } } } public static URI createAbsoluteURI(URI base, URI relativeOrNot) throws IllegalArgumentException { if (base == null && !relativeOrNot.isAbsolute()) { throw new IllegalArgumentException("Base URI is null and given URI is not absolute"); } else if (base == null && relativeOrNot.isAbsolute()) { return relativeOrNot; } else { assert base != null; // If the given base URI has no path we give it a root path if (base.getPath().length() == 0) { try { base = new URI(base.getScheme(), base.getAuthority(), "/", base.getQuery(), base.getFragment()); } catch (Exception ex) { throw new IllegalArgumentException(ex); } } return base.resolve(relativeOrNot); } } Here is my log: E/AndroidRuntime( 9824): Caused by: java.lang.NullPointerException E/AndroidRuntime( 9824): at org.teleal.cling.android.browser.MediaServerS erviceImpl$ContentHttpServerConnection.<init>(MediaServerServiceImpl.java:159) E/AndroidRuntime( 9824): at org.teleal.cling.android.browser.MediaServerS erviceImpl.onCreate(MediaServerServiceImpl.java:72) E/AndroidRuntime( 9824): at android.app.ActivityThread.handleCreateServic e(ActivityThread.java:2959) E/AndroidRuntime( 9824): ... 10 more
3
6,201,838
06/01/2011 13:22:10
191,997
10/18/2009 12:36:17
3,348
168
In NHibernate ID Generator section in mapping files, What is the meaning of assigned and select?
In `NHibernate` ID Generator section in mapping files, What is the meaning of assigned and select?
c#
nhibernate
orm
id-generator
null
null
open
In NHibernate ID Generator section in mapping files, What is the meaning of assigned and select? === In `NHibernate` ID Generator section in mapping files, What is the meaning of assigned and select?
0
2,343,719
02/26/2010 18:03:22
270,016
02/10/2010 04:58:33
25
0
C++ templated functor in lambda expression
I'm trying to pass a functor that is a templated class to the create_thread method of boost thread_group class along with two parameters to the functor. However I can't seem to get beyond my current compile error. With the below code: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <boost/thread.hpp> #include <vector> using namespace boost::lambda; using namespace std; namespace bl = boost::lambda; template<typename ftor, typename data> class Foo { public: explicit Foo() { } void doFtor () { _threads.create_thread(bind(&Foo<ftor, data>::_ftor, _list.begin(), _list.end())); //_threads.create_thread(bind(_ftor, _list.begin(), _list.end())); _threads.join_all(); } private: boost::thread_group _threads; ftor _ftor; vector<data> _list; }; template<typename data> class Ftor { public: //template <class Args> struct sig { typedef void type; } explicit Ftor () {} void operator() (typename vector<data>::iterator &startItr, typename vector<data>::iterator &endItr) { for_each(startItr, endItr, cout << bl::_1 << constant(".")); } } I also tried typedef-ing 'type' as I thought my problem might have something to do with the Sig Template as the functor itself is templated. The error I am getting is: error: no matching function for call to ‘boost::lambda::function_adaptor<Ftor<int> Foo<Ftor<int>, int>::*>::apply(Ftor<int> Foo<Ftor<int>, int>::* const&, const __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>> >&, const __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >&)’ with a bunch of preamble beforehand. Thanks in advance for any help!
c++
functor
templates
lambda
null
null
open
C++ templated functor in lambda expression === I'm trying to pass a functor that is a templated class to the create_thread method of boost thread_group class along with two parameters to the functor. However I can't seem to get beyond my current compile error. With the below code: #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <boost/thread.hpp> #include <vector> using namespace boost::lambda; using namespace std; namespace bl = boost::lambda; template<typename ftor, typename data> class Foo { public: explicit Foo() { } void doFtor () { _threads.create_thread(bind(&Foo<ftor, data>::_ftor, _list.begin(), _list.end())); //_threads.create_thread(bind(_ftor, _list.begin(), _list.end())); _threads.join_all(); } private: boost::thread_group _threads; ftor _ftor; vector<data> _list; }; template<typename data> class Ftor { public: //template <class Args> struct sig { typedef void type; } explicit Ftor () {} void operator() (typename vector<data>::iterator &startItr, typename vector<data>::iterator &endItr) { for_each(startItr, endItr, cout << bl::_1 << constant(".")); } } I also tried typedef-ing 'type' as I thought my problem might have something to do with the Sig Template as the functor itself is templated. The error I am getting is: error: no matching function for call to ‘boost::lambda::function_adaptor<Ftor<int> Foo<Ftor<int>, int>::*>::apply(Ftor<int> Foo<Ftor<int>, int>::* const&, const __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>> >&, const __gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >&)’ with a bunch of preamble beforehand. Thanks in advance for any help!
0
9,285,605
02/14/2012 23:11:25
774,031
05/28/2011 04:49:07
1
0
Invalid index n for this SqlParameterCollection with Count=n
NHibernate throws an Exception: "Invalid index n for this SqlParameterCollection with Count=n." when I attempt to save a Meter object. The problem is with the CurrentReading property. If I comment that mapping out, all is well. Also if I manually set the CurrentReading in the database NHibernate queries it fine. I'm relatively new to NHibernate, any help would be greatly appreciated. I have the following classes: public class Meter { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual MeterReading CurrentReading { get; protected set; } private IList<MeterReading> _readings; public virtual ReadOnlyCollection<MeterReading> Readings { get { return new ReadOnlyCollection<MeterReading>(_readings); } } public virtual void AddMeterReading(MeterReading MeterReading) { _readings.Add(MeterReading); if (CurrentReading == null || MeterReading.ReadingTimestamp > CurrentReading.ReadingTimestamp) { CurrentReading = MeterReading; } } } public class MeterReading { public virtual Guid Id { get; set; } public virtual decimal Usage { get; set; } public virtual DateTime ReadingTimestamp { get; set; } } And this fluent nhibernate mapping file: public sealed class MeterMap : ClassMap<Meter> { public MeterMap() { Id(x => x.Id); References(m => m.CurrentReading) .Column("CurrentMeterReadingId") .LazyLoad() .Cascade.None() .Nullable(); HasMany(x => x.Readings) .KeyColumn("MeterId") .Access.CamelCaseField(Prefix.Underscore) .LazyLoad() .Inverse() .Cascade.All(); } } public sealed class MeterReadingMap : ClassMap<MeterReading> { public MeterReadingMap() { Id(x => x.Id); Map(x => x.ReadingTimestamp) .Not.Nullable(); Map(x => x.Usage) .Precision(18) .Scale(8) .Not.Nullable(); } }
sql-server-2005
nhibernate
c#-4.0
fluent-nhibernate
null
null
open
Invalid index n for this SqlParameterCollection with Count=n === NHibernate throws an Exception: "Invalid index n for this SqlParameterCollection with Count=n." when I attempt to save a Meter object. The problem is with the CurrentReading property. If I comment that mapping out, all is well. Also if I manually set the CurrentReading in the database NHibernate queries it fine. I'm relatively new to NHibernate, any help would be greatly appreciated. I have the following classes: public class Meter { public virtual Guid Id { get; set; } public virtual string Name { get; set; } public virtual MeterReading CurrentReading { get; protected set; } private IList<MeterReading> _readings; public virtual ReadOnlyCollection<MeterReading> Readings { get { return new ReadOnlyCollection<MeterReading>(_readings); } } public virtual void AddMeterReading(MeterReading MeterReading) { _readings.Add(MeterReading); if (CurrentReading == null || MeterReading.ReadingTimestamp > CurrentReading.ReadingTimestamp) { CurrentReading = MeterReading; } } } public class MeterReading { public virtual Guid Id { get; set; } public virtual decimal Usage { get; set; } public virtual DateTime ReadingTimestamp { get; set; } } And this fluent nhibernate mapping file: public sealed class MeterMap : ClassMap<Meter> { public MeterMap() { Id(x => x.Id); References(m => m.CurrentReading) .Column("CurrentMeterReadingId") .LazyLoad() .Cascade.None() .Nullable(); HasMany(x => x.Readings) .KeyColumn("MeterId") .Access.CamelCaseField(Prefix.Underscore) .LazyLoad() .Inverse() .Cascade.All(); } } public sealed class MeterReadingMap : ClassMap<MeterReading> { public MeterReadingMap() { Id(x => x.Id); Map(x => x.ReadingTimestamp) .Not.Nullable(); Map(x => x.Usage) .Precision(18) .Scale(8) .Not.Nullable(); } }
0
10,553,475
05/11/2012 14:36:58
1,237,296
02/28/2012 07:10:12
71
2
what is the use of writing a class inside an interface
I found the following example in one of the java forum. interface employee{ class Role{ public String rollname; public int Role id; public Object person; } Role getRole(); // other methods } I have executed the above code snippet and it is compiling successfully. Which means we can have a class inside an interface. My question is what is the use of having such classes. Thanks,<br> Anil Kumar C
java
null
null
null
null
null
open
what is the use of writing a class inside an interface === I found the following example in one of the java forum. interface employee{ class Role{ public String rollname; public int Role id; public Object person; } Role getRole(); // other methods } I have executed the above code snippet and it is compiling successfully. Which means we can have a class inside an interface. My question is what is the use of having such classes. Thanks,<br> Anil Kumar C
0
6,636,022
07/09/2011 16:26:43
134,713
07/08/2009 05:51:58
4,029
145
Interview question and discussion in C
This was the question asked to me in an interview in c: #include<stdio.h> void main() { char *ch; ch=fun1(); printf(ch); } fun1() { char *arr[100]; strcpy(arr,"name"); return arr; } I was given the above program and was asked to figure out the problems in the above code. below was my answer - function declaration is wrong.the return type should be `char **` - syntax of `printf` is wrong - `arr` scope is limited to the function `fun1` then ***Interviewer*** : what would be your solution to the problem? ***Me***: you need to make the arr variable as global and fix the remaining issues mentioned above. ***Interviewer***: Dont you think global variables are dangerous? ***Me***: Yes ofcourse,since we cannot say where it is being accessed in which functions and sometimes it gets almost impossible to find which function has changed the value ***Ineterviewer*** :give me a solution without a global variable ***Me***:???? what would be your solution for this?
c++
c
interview-questions
global-variables
null
07/09/2011 19:23:43
not a real question
Interview question and discussion in C === This was the question asked to me in an interview in c: #include<stdio.h> void main() { char *ch; ch=fun1(); printf(ch); } fun1() { char *arr[100]; strcpy(arr,"name"); return arr; } I was given the above program and was asked to figure out the problems in the above code. below was my answer - function declaration is wrong.the return type should be `char **` - syntax of `printf` is wrong - `arr` scope is limited to the function `fun1` then ***Interviewer*** : what would be your solution to the problem? ***Me***: you need to make the arr variable as global and fix the remaining issues mentioned above. ***Interviewer***: Dont you think global variables are dangerous? ***Me***: Yes ofcourse,since we cannot say where it is being accessed in which functions and sometimes it gets almost impossible to find which function has changed the value ***Ineterviewer*** :give me a solution without a global variable ***Me***:???? what would be your solution for this?
1
11,080,171
06/18/2012 09:31:46
1,455,656
06/14/2012 08:06:55
3
0
Need some help to focus a strategy
Somebody ask me to build a system/application to run and manage a public Hotspot. The features this app will have are stuff like giving daily passwords trough SMS and monitoring the navigation.In first istance I tought studing zebra.h (from quagga suite), build my own routing code and run it on a small system like minix3, would been the best choice... But then I read about openBSD an OS that allready have features like routing and server daemons. If i choose the second option the only thing I'm not sure is this: can I ask (and wondering how) openBSD to forward all the network traffic trough an application. Hope have been clear enough I'm only looking for some advices. Thanks in advance
c++
c
routing
hotspot
null
06/18/2012 10:31:24
not a real question
Need some help to focus a strategy === Somebody ask me to build a system/application to run and manage a public Hotspot. The features this app will have are stuff like giving daily passwords trough SMS and monitoring the navigation.In first istance I tought studing zebra.h (from quagga suite), build my own routing code and run it on a small system like minix3, would been the best choice... But then I read about openBSD an OS that allready have features like routing and server daemons. If i choose the second option the only thing I'm not sure is this: can I ask (and wondering how) openBSD to forward all the network traffic trough an application. Hope have been clear enough I'm only looking for some advices. Thanks in advance
1
6,297,256
06/09/2011 18:07:24
103,682
05/08/2009 17:02:48
3,090
165
Hidden input field missing from DOM?
I have a problem embarrassing problem with hidden field not being part of DOM; at least I cannot find it using JavaScript. Field has "id" and "name" attributes, it is in the form, has a value and can be seen when looking at the view source in browser. So, I attach a click handler to a button, which looks for a hidden field using either document.getElementById or using jquery selectors (any combination of the selectors, by Id, by class name etc) and it is not part of DOM. How is this possible, or is it even possible? What could be a cause if this?
javascript
jquery
html
dom
null
null
open
Hidden input field missing from DOM? === I have a problem embarrassing problem with hidden field not being part of DOM; at least I cannot find it using JavaScript. Field has "id" and "name" attributes, it is in the form, has a value and can be seen when looking at the view source in browser. So, I attach a click handler to a button, which looks for a hidden field using either document.getElementById or using jquery selectors (any combination of the selectors, by Id, by class name etc) and it is not part of DOM. How is this possible, or is it even possible? What could be a cause if this?
0
7,312,437
09/05/2011 20:21:50
170,365
09/08/2009 18:48:04
1,735
11
How are these Clouds made?
http://mrdoob.com/131/Clouds I just stumbled onto this, and I think it is amazing! I want to learn to make this, is this using HTML5? What is this using? Thanks in advance!
self-improvement
null
null
null
null
09/05/2011 20:43:20
not a real question
How are these Clouds made? === http://mrdoob.com/131/Clouds I just stumbled onto this, and I think it is amazing! I want to learn to make this, is this using HTML5? What is this using? Thanks in advance!
1
11,098,324
06/19/2012 09:39:42
1,374,400
05/04/2012 07:50:38
1
0
PhoneGap database
I developed a simple application with databases (PhoneGap) in Xcode (IOS), but I can not find the DB file, here is the path (link) where I search my database but i don't found it: /Users/myname/Library/Application Support/iPhone Simulator/5.0/Applications/4D1D37B0-F2EA-4FB0-8B60-F746BC9E73B2/Library/WebKit/Databases/file__0
database
phonegap
null
null
null
06/19/2012 15:45:33
not a real question
PhoneGap database === I developed a simple application with databases (PhoneGap) in Xcode (IOS), but I can not find the DB file, here is the path (link) where I search my database but i don't found it: /Users/myname/Library/Application Support/iPhone Simulator/5.0/Applications/4D1D37B0-F2EA-4FB0-8B60-F746BC9E73B2/Library/WebKit/Databases/file__0
1
3,129,611
06/28/2010 01:29:03
117,700
06/04/2009 23:04:34
1,892
5
learning how to do basic image processing
what are the best tools for c# to do image processing? i am a beginner and want to learn the basics
c#
null
null
null
null
02/29/2012 16:45:22
not constructive
learning how to do basic image processing === what are the best tools for c# to do image processing? i am a beginner and want to learn the basics
4
5,714,542
04/19/2011 09:51:14
561,545
01/03/2011 17:38:56
336
2
Finding & using the currently active Chatbox in the Skype Client thru the WinAPI & Delphi?
By using the Skype API, I can send a message to a contact fairly easy. However, what I am trying to do, is enter the message in the Chat Box of the currently focused Contact, without sending the message. By using Winspector, I found that the Classname of the Chatbox is TChatRichEdit, which is placed on a TChatEntryControl, which is placed on a TConversationForm. (Obviously the Skype Client is coded in Delphi ;) ) By using the Win API, how can I find the correct **TConversationForm>TChatEntryControl>TChatRichEdit**, and then enter a message into it? What would be the best way to go about this? Also, the TConversationForm contains the name of the contact aswell, so I guess that makes it a bit easier?
windows
delphi
winapi
skype
handles
null
open
Finding & using the currently active Chatbox in the Skype Client thru the WinAPI & Delphi? === By using the Skype API, I can send a message to a contact fairly easy. However, what I am trying to do, is enter the message in the Chat Box of the currently focused Contact, without sending the message. By using Winspector, I found that the Classname of the Chatbox is TChatRichEdit, which is placed on a TChatEntryControl, which is placed on a TConversationForm. (Obviously the Skype Client is coded in Delphi ;) ) By using the Win API, how can I find the correct **TConversationForm>TChatEntryControl>TChatRichEdit**, and then enter a message into it? What would be the best way to go about this? Also, the TConversationForm contains the name of the contact aswell, so I guess that makes it a bit easier?
0
11,441,819
07/11/2012 21:32:02
1,513,338
07/09/2012 23:44:49
1
0
Force unmount from broken NFS server
I have a Linux client connected to an NFS server that occasionally goes down. When this happens, any process (such as ls or touch) that tries to touch the mount point hangs, as expected. Attempting to unmount, via: # unmount -lf /mnt/mount_point yields the following: umount2: Device or resource busy umount.nfs: /mnt/mount_point: device is busy umount2: Device or resource busy umount.nfs: /mnt/mount_point: device is busy Further, attempts to discover which process is using the mount (with `fuser /mnt/mount_point`, or even `ps -e`) do nothing but hang. Using a Solaris client, I am unable to reproduce the issue, which makes me think that it's something particular to Linux. Does anyone know of a way to force NFS to abandon the bad mount point in this situation? Thanks very much, --Dan
linux
nfs
unmount
null
null
07/11/2012 21:42:54
off topic
Force unmount from broken NFS server === I have a Linux client connected to an NFS server that occasionally goes down. When this happens, any process (such as ls or touch) that tries to touch the mount point hangs, as expected. Attempting to unmount, via: # unmount -lf /mnt/mount_point yields the following: umount2: Device or resource busy umount.nfs: /mnt/mount_point: device is busy umount2: Device or resource busy umount.nfs: /mnt/mount_point: device is busy Further, attempts to discover which process is using the mount (with `fuser /mnt/mount_point`, or even `ps -e`) do nothing but hang. Using a Solaris client, I am unable to reproduce the issue, which makes me think that it's something particular to Linux. Does anyone know of a way to force NFS to abandon the bad mount point in this situation? Thanks very much, --Dan
2
6,095,520
05/23/2011 09:48:50
268,114
02/07/2010 13:00:16
40
2
Store data without a database?
If i would like to store emails, but don't have a database (e.g. MySQL), what should i do? The data should be accessible and writable from PHP, but regular "visitors" MUST NOT see the data. Hope you can help. Thanks in advance.
php
database
data
store
null
null
open
Store data without a database? === If i would like to store emails, but don't have a database (e.g. MySQL), what should i do? The data should be accessible and writable from PHP, but regular "visitors" MUST NOT see the data. Hope you can help. Thanks in advance.
0
4,435,875
12/14/2010 04:30:11
462,475
09/30/2010 04:54:20
11
0
C programming size of ellipsis
What is the size of ellipsis in c? i.e., sizeof(...) ?
c
null
null
null
null
null
open
C programming size of ellipsis === What is the size of ellipsis in c? i.e., sizeof(...) ?
0
11,702,915
07/28/2012 16:53:35
695,377
04/06/2011 17:53:48
171
5
Planning on a SSD, bought Mountain Lion. What should I do?
I own a MBP 13" mid 2009 running Snow Leopard. Now, I just bought Montain Lion and haven't installed it yet. I am planning to get a new SSD to replace my optical drive. I am wondering what I should do - upgrade to Mountain Lion on the HDD and then when I get the SSD remove the system from the HDD and install a fresh one on the SSD (is that even possible?), or just do nothing until I get the SSD and then install Mountain Lion on the SSD. (Can I do that without installing Snow Leopard first?) I am really confused right now, would love an explained answer. BTW How can I use the optical drive as an external one after I get it out of the MBP? Thanks!
osx-mountain-lion
ssd
macbookpro
optical-drive
null
07/28/2012 18:12:27
off topic
Planning on a SSD, bought Mountain Lion. What should I do? === I own a MBP 13" mid 2009 running Snow Leopard. Now, I just bought Montain Lion and haven't installed it yet. I am planning to get a new SSD to replace my optical drive. I am wondering what I should do - upgrade to Mountain Lion on the HDD and then when I get the SSD remove the system from the HDD and install a fresh one on the SSD (is that even possible?), or just do nothing until I get the SSD and then install Mountain Lion on the SSD. (Can I do that without installing Snow Leopard first?) I am really confused right now, would love an explained answer. BTW How can I use the optical drive as an external one after I get it out of the MBP? Thanks!
2
8,376,451
12/04/2011 15:48:04
1,080,180
12/04/2011 15:23:32
1
0
pattern matching algorithm for large database of dna
**is there any pre existing effiecient algorithms in pattern matching (large data of dna)????** there are so many algorithms like Knuth-Morris-Pratt algorithm,Boyer-Moore algorithm,Index based forward backward multiple pattern algorithms are there but they are efficient and performs very poor when the is large so please help me to know about efficient algorithms in pattern matching...
algorithm
design-patterns
null
null
null
12/05/2011 15:53:29
not a real question
pattern matching algorithm for large database of dna === **is there any pre existing effiecient algorithms in pattern matching (large data of dna)????** there are so many algorithms like Knuth-Morris-Pratt algorithm,Boyer-Moore algorithm,Index based forward backward multiple pattern algorithms are there but they are efficient and performs very poor when the is large so please help me to know about efficient algorithms in pattern matching...
1
8,836,116
01/12/2012 13:47:24
640,733
03/02/2011 07:22:39
375
19
How can i design the cell dynamic in UITableView iPhone?
I have designed my `UITableViewCell` in iPhone. Unfortunately i need to redesign the Cell. I will explain my problem. My previous/current cell design like below, Header(11.1.2012) //single row event1 time1 Header(12.1.2012) //single row event1 time1 Header(13.1.2012) //single row event1 time1 Header(13.1.2012) //single row event2 time2 Header(13.1.2012) //single row event3 time3 Header(11.1.2012) event1 is a singel row in tableviewcell. But, i need to change the design like this, Header(11.1.2012) //single row event1 time1 Header(12.1.2012) //single row event1 time1 Header(13.1.2012) //single row event1 time1 event2 time2 event3 time3 Really i confused to do this? Can anyone please suggest any ideas and sample code to do like this? Please help me. Thanks in advance.
ios
design
uitableview
uitableviewcell
null
01/17/2012 05:39:10
too localized
How can i design the cell dynamic in UITableView iPhone? === I have designed my `UITableViewCell` in iPhone. Unfortunately i need to redesign the Cell. I will explain my problem. My previous/current cell design like below, Header(11.1.2012) //single row event1 time1 Header(12.1.2012) //single row event1 time1 Header(13.1.2012) //single row event1 time1 Header(13.1.2012) //single row event2 time2 Header(13.1.2012) //single row event3 time3 Header(11.1.2012) event1 is a singel row in tableviewcell. But, i need to change the design like this, Header(11.1.2012) //single row event1 time1 Header(12.1.2012) //single row event1 time1 Header(13.1.2012) //single row event1 time1 event2 time2 event3 time3 Really i confused to do this? Can anyone please suggest any ideas and sample code to do like this? Please help me. Thanks in advance.
3
2,838,162
05/14/2010 23:01:06
54,818
01/13/2009 23:14:50
493
33
Can't debug Ruby on Rails application in Netbeans 6.8
Every time I try to debug my Rails app via Netbeans I get a ... "Could not connect to web server - cannot show http://localhost:3000" Rails - 2.3.5 Ruby - 1.8.7-p249 Anyone know how to resolve this? Thanks
netbeans
ruby-on-rails
debugging
null
null
null
open
Can't debug Ruby on Rails application in Netbeans 6.8 === Every time I try to debug my Rails app via Netbeans I get a ... "Could not connect to web server - cannot show http://localhost:3000" Rails - 2.3.5 Ruby - 1.8.7-p249 Anyone know how to resolve this? Thanks
0
180,800
10/07/2008 23:18:45
18,471
09/19/2008 02:34:55
153
15
Any free or commercial Blogging engine recommendations?
I've recently been thinking about moving from Live Spaces and hosting my own blog. I'm not keen to write my own blog engine from scratch (time constraints, etc). What kind of functionality should I be looking for in a free or commercial solution? Sitemap? RSS feeds? Tag support? Offline editor? Any recommendations? Edit: Also happy for recommendations on other blogging sites too
blogs
recommendations
features
null
null
05/05/2012 13:52:58
off topic
Any free or commercial Blogging engine recommendations? === I've recently been thinking about moving from Live Spaces and hosting my own blog. I'm not keen to write my own blog engine from scratch (time constraints, etc). What kind of functionality should I be looking for in a free or commercial solution? Sitemap? RSS feeds? Tag support? Offline editor? Any recommendations? Edit: Also happy for recommendations on other blogging sites too
2
11,048,942
06/15/2012 10:27:50
1,412,548
05/23/2012 12:05:13
24
0
Ruby on Rails vs PHP
I'm going to ask you an opinion based on your experience on which is better to use for development! i have read that Ruby on Rails is a very powerful language. Now, based on my needs, web development and iOS app development where should i be focused more? Is it more easy to build iOS app based on php or Ruby on Rais? Thanks..
php
ruby-on-rails
null
null
null
06/15/2012 10:44:46
not constructive
Ruby on Rails vs PHP === I'm going to ask you an opinion based on your experience on which is better to use for development! i have read that Ruby on Rails is a very powerful language. Now, based on my needs, web development and iOS app development where should i be focused more? Is it more easy to build iOS app based on php or Ruby on Rais? Thanks..
4
8,267,514
11/25/2011 10:15:38
1,064,559
11/24/2011 19:30:40
1
1
about c# code string and int
I want that c# prints word like "internet" like this: internet internet internet internet internet internet internet internet This is my code: string word = ("internet"); for (int i = 0; i < word.Length ; i++) { Console.WriteLine(word); With my code i get like that internet internet internet internet internet internet internet internet
c#
null
null
null
null
11/25/2011 16:27:39
not a real question
about c# code string and int === I want that c# prints word like "internet" like this: internet internet internet internet internet internet internet internet This is my code: string word = ("internet"); for (int i = 0; i < word.Length ; i++) { Console.WriteLine(word); With my code i get like that internet internet internet internet internet internet internet internet
1
4,526,868
12/24/2010 14:39:27
545,520
12/17/2010 01:00:27
6
1
jquery ajax failed with large data
Passing huge ammount of data from jquery ajax is failed,is there any way to reolve this issue.I given type as POST.Thanks in Advance. Regards, Raju
jquery
null
null
null
null
12/26/2010 06:44:15
not a real question
jquery ajax failed with large data === Passing huge ammount of data from jquery ajax is failed,is there any way to reolve this issue.I given type as POST.Thanks in Advance. Regards, Raju
1
10,549,073
05/11/2012 09:47:11
1,254,581
03/07/2012 11:45:38
32
0
Slicing PNG files for the User Interface of a Windows program
I am not familiar with Photoshop and graphic, what options should be selected on this dialog when slicing PNG files for the user interface of a Windows program? I just want to keep the image quality without loss. Thanks. ![photoshop][1] [1]: http://i.stack.imgur.com/FqCTd.jpg
image
image-processing
graphics
png
photoshop
05/15/2012 23:08:24
off topic
Slicing PNG files for the User Interface of a Windows program === I am not familiar with Photoshop and graphic, what options should be selected on this dialog when slicing PNG files for the user interface of a Windows program? I just want to keep the image quality without loss. Thanks. ![photoshop][1] [1]: http://i.stack.imgur.com/FqCTd.jpg
2
8,060,138
11/09/2011 03:53:24
960,574
09/23/2011 07:06:17
11
0
How to put progress bar in <li> element in Jquery Mobile?
I m new for jquery mobile.I m creating an app wich have to show list of items in <li> element, so i need to show progress bar in each <li> element that will show my deal progress.The progressbar have to be deisplayed in diffrenet colors. Thanks in advance.
jquery-mobile
null
null
null
null
11/09/2011 15:27:26
not a real question
How to put progress bar in <li> element in Jquery Mobile? === I m new for jquery mobile.I m creating an app wich have to show list of items in <li> element, so i need to show progress bar in each <li> element that will show my deal progress.The progressbar have to be deisplayed in diffrenet colors. Thanks in advance.
1
8,800,673
01/10/2012 08:59:05
1,140,433
01/10/2012 08:37:12
1
0
Create multiple users using AWS
I am creating an app in which I will be using AWS services for messaging(SQS/SNS) and data hosting (S3). Now this is what i am trying to accomplish: When I send message then that message should only be visible to the another user of that app, who is in my friend list. Similarly when I want to share any bucket or folders, only friend or group of friend can see the content in the shared folder. I have tried to use IAM to create users and then assign policy for S3 folder or SQS/SNS. But with IAM there is upper limit for the number of users around 5000, but I want to scale this number to over 1 million. Is this possible? I also tried to use TVM for it, but in TVM all the tokens created are having the same policy, based on the parent IAM user. Is there any way I can differentiate between 2 tokens of TVM and set a policy to differentiate them, such that both tokens can not access the resources of each other, until given a permission? Any Other thoughts or different approach on this app will be welcome. Thanks
amazon-web-services
null
null
null
null
null
open
Create multiple users using AWS === I am creating an app in which I will be using AWS services for messaging(SQS/SNS) and data hosting (S3). Now this is what i am trying to accomplish: When I send message then that message should only be visible to the another user of that app, who is in my friend list. Similarly when I want to share any bucket or folders, only friend or group of friend can see the content in the shared folder. I have tried to use IAM to create users and then assign policy for S3 folder or SQS/SNS. But with IAM there is upper limit for the number of users around 5000, but I want to scale this number to over 1 million. Is this possible? I also tried to use TVM for it, but in TVM all the tokens created are having the same policy, based on the parent IAM user. Is there any way I can differentiate between 2 tokens of TVM and set a policy to differentiate them, such that both tokens can not access the resources of each other, until given a permission? Any Other thoughts or different approach on this app will be welcome. Thanks
0
8,697,327
01/02/2012 04:11:58
1,031,508
11/05/2011 19:46:47
22
0
Jquery tab transitions
I'm using some jquery tabs that basically just uses an ul of links to each corresponding id of the tab content. What I'm trying to do is set a delay between each tab to display a loading indicator. I've looked at several methods of doing this, but am not sure what would be the best method to use, i.e. using a .delay function, or setTimeout or something else entirely? Any suggestions? Thanks Simple html example: <div id="tabs"> <ul> <li><a href="#1">Tab 1</a></li> <li><a href="#2">Tab 2</a></li> <li><a href="#3">Tab 3</a></li> </ul> </div> <div id="tab-content"> <div id="1"> Tab 1 </div> <div id="2"> Tab 2 </div> <div id="3"> Tab 3 </div>
jquery
tabs
timeout
delay
null
null
open
Jquery tab transitions === I'm using some jquery tabs that basically just uses an ul of links to each corresponding id of the tab content. What I'm trying to do is set a delay between each tab to display a loading indicator. I've looked at several methods of doing this, but am not sure what would be the best method to use, i.e. using a .delay function, or setTimeout or something else entirely? Any suggestions? Thanks Simple html example: <div id="tabs"> <ul> <li><a href="#1">Tab 1</a></li> <li><a href="#2">Tab 2</a></li> <li><a href="#3">Tab 3</a></li> </ul> </div> <div id="tab-content"> <div id="1"> Tab 1 </div> <div id="2"> Tab 2 </div> <div id="3"> Tab 3 </div>
0
4,824,350
01/28/2011 02:44:41
106,111
05/13/2009 08:59:24
446
2
How to know which one in HTML elements is as block or inline
Actually I don't know what is the exactly keyword to google :) I want to know, in all HTML elements which one is display by block or inline by default. Let me know
html
null
null
null
null
null
open
How to know which one in HTML elements is as block or inline === Actually I don't know what is the exactly keyword to google :) I want to know, in all HTML elements which one is display by block or inline by default. Let me know
0
10,670,474
05/20/2012 03:03:24
1,383,359
05/09/2012 00:13:59
178
0
Java Fonts, CodePoints, Characters
## Aside I'm not sure if this is a Java or a Font question, however, I'm using the java.awt.Font class. ## Context I am using the java.awt.Font class to draw glyphs to the screen. There are functions that allow me to pass it a character to draw. There are functions that allow me to pass it a code point to draw. ## Question What is the relation between (char ch) and (int codepoint) for characters that are a-z, A-Z, 0-9? Does some standard guarantee that for these alphanumeric characters, the code point value is just the char's ascii value? Thanks!
java
fonts
null
null
null
null
open
Java Fonts, CodePoints, Characters === ## Aside I'm not sure if this is a Java or a Font question, however, I'm using the java.awt.Font class. ## Context I am using the java.awt.Font class to draw glyphs to the screen. There are functions that allow me to pass it a character to draw. There are functions that allow me to pass it a code point to draw. ## Question What is the relation between (char ch) and (int codepoint) for characters that are a-z, A-Z, 0-9? Does some standard guarantee that for these alphanumeric characters, the code point value is just the char's ascii value? Thanks!
0
8,561,784
12/19/2011 13:06:34
666,254
03/18/2011 15:18:53
137
0
Update cocos2d by replacing libs?
I'm updating cocos 2.0 alpha to 2.0 beta by simply replacing the lib folders. I've managed to get it building successfully, but with tons of the same warning: ccCArray.h Unknown warning group 'Warc-perform-Selector-leaks' ignored What's this about? thanks!
iphone
xcode
cocos2d-iphone
null
null
null
open
Update cocos2d by replacing libs? === I'm updating cocos 2.0 alpha to 2.0 beta by simply replacing the lib folders. I've managed to get it building successfully, but with tons of the same warning: ccCArray.h Unknown warning group 'Warc-perform-Selector-leaks' ignored What's this about? thanks!
0
11,072,782
06/17/2012 16:06:11
1,435,660
06/04/2012 17:16:10
13
0
Simple 3D designs for mobile applications
Where i can find simple and small 3D Models (obj files) to be used directly in Mobile applications? All i need are simple designs for "cars", "motorbike" for racing moto game implementation in Android. Thanks alot!
android
opengl-es
3d
mobile-application
null
06/20/2012 19:48:53
off topic
Simple 3D designs for mobile applications === Where i can find simple and small 3D Models (obj files) to be used directly in Mobile applications? All i need are simple designs for "cars", "motorbike" for racing moto game implementation in Android. Thanks alot!
2
7,107,990
08/18/2011 13:14:57
876,724
08/03/2011 13:45:02
3
0
C# start an included app
Hello stackoverflow users!! I have a little C#.Net project and I want to start an application with endings(bad english) like executable.exe -o 99. But I want the "executable.exe" beeing with my C# project. So it means in the end it should be 1 app. For someone its easy, because he works with it but its a little bit difficult for me I hope someone can help me. Thanks forward.
c#
.net
windows
execution
null
08/18/2011 13:30:54
not a real question
C# start an included app === Hello stackoverflow users!! I have a little C#.Net project and I want to start an application with endings(bad english) like executable.exe -o 99. But I want the "executable.exe" beeing with my C# project. So it means in the end it should be 1 app. For someone its easy, because he works with it but its a little bit difficult for me I hope someone can help me. Thanks forward.
1
10,120,881
04/12/2012 09:26:10
643,514
03/03/2011 18:50:56
585
53
How to resize image before_save with dragonfly?
In my model i have: attr_accessible :photo image_accessor :photo before_save :resize_image def resize_image self.photo = self.photo.process(:resize, '40x40') end but after save it removes my photo_uid from record in database (or doesnt write photo_uid at all)
ruby-on-rails
ruby-on-rails-3
dragonfly-gem
null
null
null
open
How to resize image before_save with dragonfly? === In my model i have: attr_accessible :photo image_accessor :photo before_save :resize_image def resize_image self.photo = self.photo.process(:resize, '40x40') end but after save it removes my photo_uid from record in database (or doesnt write photo_uid at all)
0
8,960,776
01/22/2012 11:40:12
319,773
04/18/2010 17:15:58
506
28
Android socket.close() causes "the system call was canceled"?
My MainActivity starts another thread called UdpListener. In onResume, the thread will be started (this works), in onPause it should stop, but socket.close() causes an error message in LogCat "**the system call was canceled**". The UdpListener itself works fine in JUnit tests so this must be some kind of Android problem. These are the corresponding methods of my thread: private void setThreadRunning(boolean running) throws MyOwnException { this.running = running; if (running) { try { serverSocket = new DatagramSocket(9800); } catch (SocketException e) { exceptionThrown = true; this.running = false; Log.e(TAG, e.getMessage()); if (serverSocket != null && !serverSocket.isClosed()) { serverSocket.close(); } throw new MyOwnException(e); } } else { if (serverSocket != null && !serverSocket.isClosed()) { serverSocket.close(); } } } public void stopThread() throws MyOwnException { setThreadRunning(false); } MainActivity.onPause(): @Override public void onPause() { super.onPause(); try { udpListener.stopThread(); } catch (MyOwnException e) { //TODO AlertDialog } } serverSocket.close() of else branch will be executed and causes the LogCat entry, but why?
android
multithreading
exception
android-lifecycle
null
null
open
Android socket.close() causes "the system call was canceled"? === My MainActivity starts another thread called UdpListener. In onResume, the thread will be started (this works), in onPause it should stop, but socket.close() causes an error message in LogCat "**the system call was canceled**". The UdpListener itself works fine in JUnit tests so this must be some kind of Android problem. These are the corresponding methods of my thread: private void setThreadRunning(boolean running) throws MyOwnException { this.running = running; if (running) { try { serverSocket = new DatagramSocket(9800); } catch (SocketException e) { exceptionThrown = true; this.running = false; Log.e(TAG, e.getMessage()); if (serverSocket != null && !serverSocket.isClosed()) { serverSocket.close(); } throw new MyOwnException(e); } } else { if (serverSocket != null && !serverSocket.isClosed()) { serverSocket.close(); } } } public void stopThread() throws MyOwnException { setThreadRunning(false); } MainActivity.onPause(): @Override public void onPause() { super.onPause(); try { udpListener.stopThread(); } catch (MyOwnException e) { //TODO AlertDialog } } serverSocket.close() of else branch will be executed and causes the LogCat entry, but why?
0
10,533,583
05/10/2012 12:04:26
1,016,383
10/27/2011 11:38:01
15
0
Reload deleted DOM elements of components in ExtJS4
I read about, how ExtJS4 keeps all the data of the components in separate objects and just renders DOM stuff on demand. I have the problem, that a `<div>` gets a `innerHTML = ''` to hide some data and afterwards fills the `innerHTML` if the data is demanded. If I render a component into that `<div>` it gets deleted when the hide functionallity is activated. But all the component data is stored in a separate object, so is it possible to just re-render the stuff with its last state or just tell ExtJS to delete the DOM stuff by itself before it gets deleted and afterwards re-render it?
extjs4
null
null
null
null
null
open
Reload deleted DOM elements of components in ExtJS4 === I read about, how ExtJS4 keeps all the data of the components in separate objects and just renders DOM stuff on demand. I have the problem, that a `<div>` gets a `innerHTML = ''` to hide some data and afterwards fills the `innerHTML` if the data is demanded. If I render a component into that `<div>` it gets deleted when the hide functionallity is activated. But all the component data is stored in a separate object, so is it possible to just re-render the stuff with its last state or just tell ExtJS to delete the DOM stuff by itself before it gets deleted and afterwards re-render it?
0
11,053,282
06/15/2012 15:03:26
1,459,032
06/15/2012 14:58:04
1
0
clear div and add new content in while loop
I need to clear the <div> and insert new content I get from the database after each while loop in php. Can someone help me out with this problem? Also I need to sleep in the loop for about 10 sec. The general flow is like this - while() { read from database; sleep; clear div; ///I nead help here; Add content to div ///I need help here } Thanks
php
javascript
jquery
html5
null
06/15/2012 15:08:30
not a real question
clear div and add new content in while loop === I need to clear the <div> and insert new content I get from the database after each while loop in php. Can someone help me out with this problem? Also I need to sleep in the loop for about 10 sec. The general flow is like this - while() { read from database; sleep; clear div; ///I nead help here; Add content to div ///I need help here } Thanks
1
4,511,576
12/22/2010 17:00:04
385,882
07/07/2010 19:11:01
43
0
Creating Graph - Which Language?
I have an idea for creating graph like the "social graph" application from facebook,for my site.<br/> I want this to be on application on the internet and as a software,that will the user on the center and the his friends from the site sorrounding him, with a features to zoom to specific people and to show his last message at the forum,his name,his picture and to search for a specific user.<br/> I don`t know which programming should I use?<br/> I know HTML(4/5),CSS,JavaScript,Server Side Languages(PHP/Ruby/Python) and C#.<br/> I would like to get suggestions about programming language and about specific technology.<br/> Thanks a lot,Yosy Attias
graphics
programming-languages
null
null
null
04/20/2012 11:09:52
not constructive
Creating Graph - Which Language? === I have an idea for creating graph like the "social graph" application from facebook,for my site.<br/> I want this to be on application on the internet and as a software,that will the user on the center and the his friends from the site sorrounding him, with a features to zoom to specific people and to show his last message at the forum,his name,his picture and to search for a specific user.<br/> I don`t know which programming should I use?<br/> I know HTML(4/5),CSS,JavaScript,Server Side Languages(PHP/Ruby/Python) and C#.<br/> I would like to get suggestions about programming language and about specific technology.<br/> Thanks a lot,Yosy Attias
4
8,584,599
12/21/2011 03:03:54
1,053,045
11/18/2011 03:23:56
123
1
Checking if a file exists (Perl)
How would you go about writing a perl script to check if a file exists? For example, if I want to check whether $file exists in $location. Currently I'm using a lengthy subroutine (see below) which I'm sure there is an easier way to do? # This subroutine checks to see whether a file exists in /home sub exists_file { @list = qx{ls /home}; foreach(@list) { chop($_); if ($_ eq $file) { return 1; } }
perl
null
null
null
null
null
open
Checking if a file exists (Perl) === How would you go about writing a perl script to check if a file exists? For example, if I want to check whether $file exists in $location. Currently I'm using a lengthy subroutine (see below) which I'm sure there is an easier way to do? # This subroutine checks to see whether a file exists in /home sub exists_file { @list = qx{ls /home}; foreach(@list) { chop($_); if ($_ eq $file) { return 1; } }
0
8,387,889
12/05/2011 15:44:49
84,539
03/30/2009 09:34:26
3,507
78
What is the most secure way of encrypting/decrypting data?
Now I know that is a very open question such as "How long is a piece of string" but I am a newbie to this game. From my basic understanding (before I delve into this subject) I believe AES 256bit encryption is very secure. My needs are to generate private and public keys using .Net using the most secure encryption possible. Now I know from an experts point of view this maybe a naive question but please help me expand my knowledge and suggest the best approaches, algorithms and anything else to consider in this type of project. Many thanks.
c#
.net
security
encryption
.net-4.0
12/05/2011 16:00:49
not constructive
What is the most secure way of encrypting/decrypting data? === Now I know that is a very open question such as "How long is a piece of string" but I am a newbie to this game. From my basic understanding (before I delve into this subject) I believe AES 256bit encryption is very secure. My needs are to generate private and public keys using .Net using the most secure encryption possible. Now I know from an experts point of view this maybe a naive question but please help me expand my knowledge and suggest the best approaches, algorithms and anything else to consider in this type of project. Many thanks.
4
5,712,673
04/19/2011 06:53:16
663,769
03/17/2011 05:57:15
11
0
query in mysql with range
. Write a single SQL query to determine the count of people in the following salary ranges less than 1,00,000 (equal to or greater than 1,00,000) and less than 5,00,000 greater than or equal to 5,00,000
mysql
query
null
null
null
04/19/2011 07:39:25
not a real question
query in mysql with range === . Write a single SQL query to determine the count of people in the following salary ranges less than 1,00,000 (equal to or greater than 1,00,000) and less than 5,00,000 greater than or equal to 5,00,000
1
3,605,725
08/31/2010 02:53:06
389,651
07/12/2010 16:13:07
203
0
I want to make a flowchart application in a browser. Which SVG Library to use?
As a fun project, I am going to make a simple flowchart app to learn some new html features, but I am unsure whether this is more appropriate for canvas or SVG (and which lib to use). I believe that SVG is more appropriate here since everything is basically shapes connected to lines (sounds like vector graphics to me), but if you think otherwise let me know why. As for libraries, I read the Raphael vs Jquery SVG library debate on here... but this took place a year and a half ago. What are your thoughts on the current state of these libraries or a newer one that has matured?
javascript
jquery
svg
raphael
null
05/22/2012 23:28:42
not constructive
I want to make a flowchart application in a browser. Which SVG Library to use? === As a fun project, I am going to make a simple flowchart app to learn some new html features, but I am unsure whether this is more appropriate for canvas or SVG (and which lib to use). I believe that SVG is more appropriate here since everything is basically shapes connected to lines (sounds like vector graphics to me), but if you think otherwise let me know why. As for libraries, I read the Raphael vs Jquery SVG library debate on here... but this took place a year and a half ago. What are your thoughts on the current state of these libraries or a newer one that has matured?
4
8,737,161
01/05/2012 03:15:47
1,095,178
12/13/2011 06:41:49
1
0
live migration of open mpi processes
Please has any one done a live migration of open mpi processes to another nodes with C/C++? Please help if you have done it before or if you know of any tool that can do it.
migration
live
mpi
null
null
05/15/2012 16:06:06
not a real question
live migration of open mpi processes === Please has any one done a live migration of open mpi processes to another nodes with C/C++? Please help if you have done it before or if you know of any tool that can do it.
1
5,304,411
03/14/2011 20:55:22
401,995
07/24/2010 03:40:57
798
8
How do you get vertex buffer of mesh?
Is it possible to get vertex buffer from mesh? how?
c++
directx
null
null
null
03/15/2011 22:22:19
not a real question
How do you get vertex buffer of mesh? === Is it possible to get vertex buffer from mesh? how?
1
6,820,252
07/25/2011 17:53:09
858,105
07/22/2011 14:20:00
1
0
JQuery AJAX fails with IE
I have a function for doing ajax calls (line numbers supplied): 9 function doAjax(url, args){ 10 var retVal; 11 retVal = $.ajax({ 12 type: "GET", 13 url: url, 14 data: args, 15 async: false, 16 }).responseText; 17 if(retVal==null || retVal=="")retval=99; 18 return retVal; 19 } When I use IE8, I get an error stating: User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; .NET4.0C; .NET4.0E) Timestamp: Mon, 25 Jul 2011 17:45:36 UTC Message: Expected identifier, string or number Line: 17 Char: 21 Code: 0 URI: local host web server This script works perfectly fine with FireFox. Being a novice, I am at a loss as to why this is generating an error. Can anyone point me in the right direction?
javascript
jquery-ajax
null
null
null
null
open
JQuery AJAX fails with IE === I have a function for doing ajax calls (line numbers supplied): 9 function doAjax(url, args){ 10 var retVal; 11 retVal = $.ajax({ 12 type: "GET", 13 url: url, 14 data: args, 15 async: false, 16 }).responseText; 17 if(retVal==null || retVal=="")retval=99; 18 return retVal; 19 } When I use IE8, I get an error stating: User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; GTB7.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; .NET4.0C; .NET4.0E) Timestamp: Mon, 25 Jul 2011 17:45:36 UTC Message: Expected identifier, string or number Line: 17 Char: 21 Code: 0 URI: local host web server This script works perfectly fine with FireFox. Being a novice, I am at a loss as to why this is generating an error. Can anyone point me in the right direction?
0
10,076,501
04/09/2012 16:41:29
691,220
04/04/2011 13:53:46
37
0
Basic coding topics/implementations for a programmer
I'm inspired by [this][1] post from Coding Horror, what are the most basics things in terms of code that every programmer (or aspiring programmer) should know? For example, how to implement X function, or how Z works, from most basic and easy to advanced topics. I tend to do mostly web work (frontend and some basic backend stuff) so there is a lot of somewhat advanced backend topics that I don't know and I really want to learn. PS: Also this kind of things that are awesome and very helpful: [swap variables in PHP][2] [1]: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html [2]: http://tech.petegraham.co.uk/2007/03/29/php-swap-variables-one-liner/
theory
null
null
null
null
04/09/2012 20:54:49
not a real question
Basic coding topics/implementations for a programmer === I'm inspired by [this][1] post from Coding Horror, what are the most basics things in terms of code that every programmer (or aspiring programmer) should know? For example, how to implement X function, or how Z works, from most basic and easy to advanced topics. I tend to do mostly web work (frontend and some basic backend stuff) so there is a lot of somewhat advanced backend topics that I don't know and I really want to learn. PS: Also this kind of things that are awesome and very helpful: [swap variables in PHP][2] [1]: http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html [2]: http://tech.petegraham.co.uk/2007/03/29/php-swap-variables-one-liner/
1
4,813,501
01/27/2011 06:44:26
591,774
01/27/2011 06:44:26
1
0
connecting sql server using c# .net
my code is as follows: string constring = "Data Source=132.186.127.169"+ "Initial Catalog=CadPool1;" + "Integrated Security=True"; SqlConnection con; con = new SqlConnection(constring); con.Open(); string query="SELECT * from CadPoolProjectTable1"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); MessageBox.Show("selected"); con.Close(); i am getting error at the line "con.Open();" the error is: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) please help me out!!!!!!!!!!!!!!!!!
c#
.net
null
null
null
null
open
connecting sql server using c# .net === my code is as follows: string constring = "Data Source=132.186.127.169"+ "Initial Catalog=CadPool1;" + "Integrated Security=True"; SqlConnection con; con = new SqlConnection(constring); con.Open(); string query="SELECT * from CadPoolProjectTable1"; SqlCommand cmd = new SqlCommand(query, con); cmd.ExecuteNonQuery(); MessageBox.Show("selected"); con.Close(); i am getting error at the line "con.Open();" the error is: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) please help me out!!!!!!!!!!!!!!!!!
0
7,487,019
09/20/2011 14:38:16
527,937
12/02/2010 12:08:31
134
0
Why an open descriptor is not closed on program exit?
I have a small program below on 2.6.16-rc3, which uses busy box (on jffs2 file system). If I run the program multiple times, it starts to fail second time onwards . When the program quits, the descriptors shall be auto closed and next time it shall start fresh , right ? Why I am getting -1 some times? (Note - On my Fedora Linux PC , it works fine) root@badge 07:29:32 ~ >touch Hello.txt root@badge 07:29:37 ~ >./a.out FP = 3 root@badge 07:29:38 ~ >./a.out FP = -1 root@badge 07:29:40 ~ >./a.out FP = 3 root@badge 07:29:41 ~ >./a.out FP = -1 root@badge 07:29:42 ~ >./a.out FP = 3 root@badge 07:29:43 ~ >./a.out FP = 3 root@badge 07:29:43 ~ >./a.out FP = -1 root@badge 07:29:45 ~ > Program: -------- #include <stdio.h> int main() { int fp; fp = open ("Hello.txt"); printf("FP = %d\n", fp); return 0; // No close() is used. On exit, it shall be closed. } Text File: -------- -rw-r--r-- 1 root root 0 Sep 20 07:22 Hello.txt
c
linux
busybox
null
null
null
open
Why an open descriptor is not closed on program exit? === I have a small program below on 2.6.16-rc3, which uses busy box (on jffs2 file system). If I run the program multiple times, it starts to fail second time onwards . When the program quits, the descriptors shall be auto closed and next time it shall start fresh , right ? Why I am getting -1 some times? (Note - On my Fedora Linux PC , it works fine) root@badge 07:29:32 ~ >touch Hello.txt root@badge 07:29:37 ~ >./a.out FP = 3 root@badge 07:29:38 ~ >./a.out FP = -1 root@badge 07:29:40 ~ >./a.out FP = 3 root@badge 07:29:41 ~ >./a.out FP = -1 root@badge 07:29:42 ~ >./a.out FP = 3 root@badge 07:29:43 ~ >./a.out FP = 3 root@badge 07:29:43 ~ >./a.out FP = -1 root@badge 07:29:45 ~ > Program: -------- #include <stdio.h> int main() { int fp; fp = open ("Hello.txt"); printf("FP = %d\n", fp); return 0; // No close() is used. On exit, it shall be closed. } Text File: -------- -rw-r--r-- 1 root root 0 Sep 20 07:22 Hello.txt
0
8,530,735
12/16/2011 06:49:22
903,746
08/20/2011 13:16:24
21
0
Jquery web cam plugin pemissions
I'm using http://www.xarg.org/project/jquery-webcam-plugin/ in my application.If i want to take picture means first it ask allow and deny option in flash player settings but i don't want this two option.How can i ignore this two option.
webcam
null
null
null
null
null
open
Jquery web cam plugin pemissions === I'm using http://www.xarg.org/project/jquery-webcam-plugin/ in my application.If i want to take picture means first it ask allow and deny option in flash player settings but i don't want this two option.How can i ignore this two option.
0
8,449,973
12/09/2011 18:23:01
1,088,752
12/08/2011 23:11:51
6
0
How to get the path without the filename in windows through tcl
How to get the path without the filename in windows through tcl I have the full path like this: c:\My_Designs\ipcore_script\test\src\IP_CORE\mux\sus.do I need only the path and want to strip off the filename like: c:\My_Designs\ipcore_script\test\src\IP_CORE\mux
tcl
null
null
null
null
null
open
How to get the path without the filename in windows through tcl === How to get the path without the filename in windows through tcl I have the full path like this: c:\My_Designs\ipcore_script\test\src\IP_CORE\mux\sus.do I need only the path and want to strip off the filename like: c:\My_Designs\ipcore_script\test\src\IP_CORE\mux
0
10,554,314
05/11/2012 15:27:00
484,025
10/22/2010 09:15:19
335
7
.htaccess if file doesn't exist show from here
I am having problem with my set-up, and frankly I am about to loose it :( in my .htaccess I have this 4 lines: RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /home/myaccount/webapps/my_app/webroot/$1 [L] RewriteCond /home/myaccount/webapps/my_app/webroot/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /home/myaccount/webapps/my_framework/webroot/$1 [L] What it should do is this if I request a file that doesn't exists: http://mydomain.com/file_not_here.js it should check in webroot dir http://mydomain.com/webroot/file_not_here.js if file still doesn't exist there, then check in the framework webroot dir /home/myaccount/webapps/my_framework/webroot/file_not_here.js http://mydomain.com/ points to my_app no external url points to my_framework dir Please advise
apache
.htaccess
mod-rewrite
null
null
05/15/2012 16:45:58
off topic
.htaccess if file doesn't exist show from here === I am having problem with my set-up, and frankly I am about to loose it :( in my .htaccess I have this 4 lines: RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /home/myaccount/webapps/my_app/webroot/$1 [L] RewriteCond /home/myaccount/webapps/my_app/webroot/%{REQUEST_FILENAME} -f RewriteRule ^(.+) /home/myaccount/webapps/my_framework/webroot/$1 [L] What it should do is this if I request a file that doesn't exists: http://mydomain.com/file_not_here.js it should check in webroot dir http://mydomain.com/webroot/file_not_here.js if file still doesn't exist there, then check in the framework webroot dir /home/myaccount/webapps/my_framework/webroot/file_not_here.js http://mydomain.com/ points to my_app no external url points to my_framework dir Please advise
2
10,229,501
04/19/2012 13:48:40
407,356
07/31/2010 08:14:36
104
7
CVS to GIT seems silly. Am I missing something?
Good afternoon, I have recently started a new project at home. I wont bore you with details as they dont matter. Point is, I thought I would take the time to look into all this hype about GIT. A lot of the libraries I end up using seem to be on GitHub and so I thought it would be beneficial to learn it. So I done some reading. Lots of blog articles, lots of Stackoverflow questions. Also adopted GIT in my most recent project at home just to get a feel for it. Now before I get flamed for poo-poo'ing GIT, all my considerations for this question are for **changing from CVS to GIT**. That is to say, we already have a project up and running with a stable HEAD and 3-4 branches for different clients and configurations that a small team of 3-6 people are using without too many issues. If you are sitting at square 1 waiting to start a project and wondering what source control system to use, I understand entirely why you would go for GIT. With that bit out the way, let me actually ask my question. I have been asked to see if there are any real business advantages to moving from CVS to GIT. After a few weeks of reading, I still cannot really find anything that would make a real compelling case to actually make the switch. As I say I have been doing a lot of reading and for the most part, GIT-Fans seem to be pushing it based on 3 main advantages; speed, easy-branching and a handful of features that SVN just doesn't offer (partial file commits, stging ect). After reading in relative detail about each of these issues, i'm still left thinking 'so what?' **Speed:** I'm not saying the following links is a particularly comprehensive argument for switching to GIT but it highlight all the points i'm going to make in this post and its open now on a tab so its easy to link. http://thinkvitamin.com/code/why-you-should-switch-from-subversion-to-git/ So this guy does a few crude benchmarks of creating a branch and switching to it in both GIT and SVN. He concludes that it takes 1/3rd of a second in GIT and 13 seconds in SVN. Now I don't know what kind of a team you readers work in but, mine can certainly spare 13 seconds every now and again to create a branch if need be. We have a pretty fancy coffee machine here and that fails to produce a cup in less than 13 seconds so this is hardly a game-changer. I appreciate he details that branching is quite a lightweight process so lets consider **my** use-case. I do a load of work during the day and commit the stable stuff in the evening before I go home. On a big commit, where I have added several hundred files as well as changed, moved and re-factored existing ones, CVS will of performed the commit before I can put my coat on and tidy my desk or wrapper and cups so GIT's super speed is not really selling it to me here. **Easy branching:** Again, referring to the above link he paints a picture of absolute hatred when using branches in SVN/CVS. Surely people aren't finding it that difficult ? When I want to try out an idea, I right click my project node in Eclipse, select "Switch to different branch", select "new", type the name and i'm away, committing and updating without 'polluting the mainline' as CVS apparent does. Now, i'm not the only one that doesn't consider this process on-parr with rocket science surely !? Likewise, when I have decided that the new ideas in this branch are stable and good, I right click the project again, select "merge with another branch or version", select HEAD and wait my obligatory 13seconds and we are back in HEAD but with working changes implemented...happy days, all without GIT. Yes, fair enough this process may not go as smoothly if someone has made a few changes to associated files in the mean time, but this only adds a few more right-clicks to the process where I have to tell the system which lines of the file to use and which to discard/move. I understand the process is the same with GIT so there is no real +/- here, just the same. **Truly distributed** The aforementioned post also details a scary scenario where you repository provider sustains a hard-disk corruption and you loose your online repository. He then goes on to detail that because GIT is has a local repository, this would be no more of an inconvenience than to simply push to a new / repaired server and your away again. Now I consider it standard practice for the first thing to do in the morning is check the repository for any changes made over-night and do an update/merge if needed so, should I go home tonight and find my repository has been burnt to the ground in the morning, I would of lost...well...nothing. I would create a new repo, commit my local files to the server, the other 5 employees would do the same, there would maybe be a bit of merge fuss but no more than there would of been had we of been committing our local changes to an already existing server and we are away once more. No big deal. **GIT Staging** Another feature touted as wonderful that you cannot achieve using SVN/CVS is staging where you 'craft your commit' to include on the files you want. This is apparently unachievable using SVN/CVS. May I introduce these people to change-sets ? ---- Now i'm not ignorant enough to think that I am the only person on the internet that is able to see through all these comparisons to see GIT as simply another version control system and really, nothing special. So I can only conclude that I must be missing or misunderstanding something and would appreciate others' input for this exact reason. I must present in a meeting in a little over a week, a case for moving from CVS to GIT and really, at this point I don't see there is one. I don't think GIT could bring anything beneficial to the table over CVS other than helping those that don't like leaving branches on CVS for the rest of the team to see. What's more, I see some real **disadvantages** in using GIT. Lets reverse the idea of loosing a central repository. You have been working on 101 fancy new ideas over the weekend and been committing like a mad-man to your wonderfully fast, localised repository, excited by the idea of getting the new features reviewed and cleared to push up to the server. But wait, what's this? And irreversible BSOD error? An entire cup-o-coffee over your CPU ? Laptop stolen, lost, ran over ? All of these issues, while extremely annoying in an SVN setup would only result in me loosing a bit of tech, all my work would have been safely stored on the server each time I did a commit to my little test-branch. However, using GIT, all those changes were local and now, you may as well of watched TV all weekend because all that work, all those commits are now gone and the outside world has no record of it what-so-ever! Now all those little 13 second branch-times seem a little more appealing eh ? What's more about this 'offline-mode' stuff. I can't remember the last time I was actually without an internet connection. Even walking the dog in the forest, if I absolutely **had** to do some work, I could commit to on line repository using edge / 3G signal, would take about 5mins sure, but I could if I wanted to. Has anyone actually ever been doing serious work without an internet connection of some description in the last...I don't know...3-5 years ? Thank you for reading this wall of text and I look forward to hearing your views. While it does seem to me that it is a case of a community getting over-excited about a new, shiny technology, I actually do really like these newer features of GIT, I just don't think it creates a strong enough case to move from CVS to GIT in a functioning business environment. If someone could open my eyes in this respect, I would be eternally grateful.
git
svn
version-control
cvs
null
04/19/2012 14:58:26
not a real question
CVS to GIT seems silly. Am I missing something? === Good afternoon, I have recently started a new project at home. I wont bore you with details as they dont matter. Point is, I thought I would take the time to look into all this hype about GIT. A lot of the libraries I end up using seem to be on GitHub and so I thought it would be beneficial to learn it. So I done some reading. Lots of blog articles, lots of Stackoverflow questions. Also adopted GIT in my most recent project at home just to get a feel for it. Now before I get flamed for poo-poo'ing GIT, all my considerations for this question are for **changing from CVS to GIT**. That is to say, we already have a project up and running with a stable HEAD and 3-4 branches for different clients and configurations that a small team of 3-6 people are using without too many issues. If you are sitting at square 1 waiting to start a project and wondering what source control system to use, I understand entirely why you would go for GIT. With that bit out the way, let me actually ask my question. I have been asked to see if there are any real business advantages to moving from CVS to GIT. After a few weeks of reading, I still cannot really find anything that would make a real compelling case to actually make the switch. As I say I have been doing a lot of reading and for the most part, GIT-Fans seem to be pushing it based on 3 main advantages; speed, easy-branching and a handful of features that SVN just doesn't offer (partial file commits, stging ect). After reading in relative detail about each of these issues, i'm still left thinking 'so what?' **Speed:** I'm not saying the following links is a particularly comprehensive argument for switching to GIT but it highlight all the points i'm going to make in this post and its open now on a tab so its easy to link. http://thinkvitamin.com/code/why-you-should-switch-from-subversion-to-git/ So this guy does a few crude benchmarks of creating a branch and switching to it in both GIT and SVN. He concludes that it takes 1/3rd of a second in GIT and 13 seconds in SVN. Now I don't know what kind of a team you readers work in but, mine can certainly spare 13 seconds every now and again to create a branch if need be. We have a pretty fancy coffee machine here and that fails to produce a cup in less than 13 seconds so this is hardly a game-changer. I appreciate he details that branching is quite a lightweight process so lets consider **my** use-case. I do a load of work during the day and commit the stable stuff in the evening before I go home. On a big commit, where I have added several hundred files as well as changed, moved and re-factored existing ones, CVS will of performed the commit before I can put my coat on and tidy my desk or wrapper and cups so GIT's super speed is not really selling it to me here. **Easy branching:** Again, referring to the above link he paints a picture of absolute hatred when using branches in SVN/CVS. Surely people aren't finding it that difficult ? When I want to try out an idea, I right click my project node in Eclipse, select "Switch to different branch", select "new", type the name and i'm away, committing and updating without 'polluting the mainline' as CVS apparent does. Now, i'm not the only one that doesn't consider this process on-parr with rocket science surely !? Likewise, when I have decided that the new ideas in this branch are stable and good, I right click the project again, select "merge with another branch or version", select HEAD and wait my obligatory 13seconds and we are back in HEAD but with working changes implemented...happy days, all without GIT. Yes, fair enough this process may not go as smoothly if someone has made a few changes to associated files in the mean time, but this only adds a few more right-clicks to the process where I have to tell the system which lines of the file to use and which to discard/move. I understand the process is the same with GIT so there is no real +/- here, just the same. **Truly distributed** The aforementioned post also details a scary scenario where you repository provider sustains a hard-disk corruption and you loose your online repository. He then goes on to detail that because GIT is has a local repository, this would be no more of an inconvenience than to simply push to a new / repaired server and your away again. Now I consider it standard practice for the first thing to do in the morning is check the repository for any changes made over-night and do an update/merge if needed so, should I go home tonight and find my repository has been burnt to the ground in the morning, I would of lost...well...nothing. I would create a new repo, commit my local files to the server, the other 5 employees would do the same, there would maybe be a bit of merge fuss but no more than there would of been had we of been committing our local changes to an already existing server and we are away once more. No big deal. **GIT Staging** Another feature touted as wonderful that you cannot achieve using SVN/CVS is staging where you 'craft your commit' to include on the files you want. This is apparently unachievable using SVN/CVS. May I introduce these people to change-sets ? ---- Now i'm not ignorant enough to think that I am the only person on the internet that is able to see through all these comparisons to see GIT as simply another version control system and really, nothing special. So I can only conclude that I must be missing or misunderstanding something and would appreciate others' input for this exact reason. I must present in a meeting in a little over a week, a case for moving from CVS to GIT and really, at this point I don't see there is one. I don't think GIT could bring anything beneficial to the table over CVS other than helping those that don't like leaving branches on CVS for the rest of the team to see. What's more, I see some real **disadvantages** in using GIT. Lets reverse the idea of loosing a central repository. You have been working on 101 fancy new ideas over the weekend and been committing like a mad-man to your wonderfully fast, localised repository, excited by the idea of getting the new features reviewed and cleared to push up to the server. But wait, what's this? And irreversible BSOD error? An entire cup-o-coffee over your CPU ? Laptop stolen, lost, ran over ? All of these issues, while extremely annoying in an SVN setup would only result in me loosing a bit of tech, all my work would have been safely stored on the server each time I did a commit to my little test-branch. However, using GIT, all those changes were local and now, you may as well of watched TV all weekend because all that work, all those commits are now gone and the outside world has no record of it what-so-ever! Now all those little 13 second branch-times seem a little more appealing eh ? What's more about this 'offline-mode' stuff. I can't remember the last time I was actually without an internet connection. Even walking the dog in the forest, if I absolutely **had** to do some work, I could commit to on line repository using edge / 3G signal, would take about 5mins sure, but I could if I wanted to. Has anyone actually ever been doing serious work without an internet connection of some description in the last...I don't know...3-5 years ? Thank you for reading this wall of text and I look forward to hearing your views. While it does seem to me that it is a case of a community getting over-excited about a new, shiny technology, I actually do really like these newer features of GIT, I just don't think it creates a strong enough case to move from CVS to GIT in a functioning business environment. If someone could open my eyes in this respect, I would be eternally grateful.
1
10,544,197
05/11/2012 01:16:55
1,388,022
05/10/2012 20:01:04
18
0
Changing Name Format from "Last, First MI." to "First MI. Last" in Java
So What I am doing is trying take the names that I am given by the program after it retrieves them from unstructured text, and display them in a user specified Format of either "First MI. Last" or "Last, First MI". Any ideas? So far it checks to see if a comma is present in the string. if so I want to switch the order of the words in the string and remove the comma, and if there is a middle initial and it doesnt' contain a period after it, I want to add one. if (entity instanceof Entity) { // if so, cast it to a variable Entity ent = (Entity) entity; SName name = ent.getName(); String nameStr = name.getString(); String newName = ""; // Now you have the name to mess with // NOW, this is where i need help if (choiceStr.equals("First MI. Last")) { String formattedName = WordUtils .capitalizeFully(nameStr); for (int i = 0; i < formattedName.length(); i++) { if (formattedName.charAt(i) != ',') { newName += formattedName.charAt(i); } } } name.setString(newName); network.updateConcept(ent);
java
format
name
changing
null
null
open
Changing Name Format from "Last, First MI." to "First MI. Last" in Java === So What I am doing is trying take the names that I am given by the program after it retrieves them from unstructured text, and display them in a user specified Format of either "First MI. Last" or "Last, First MI". Any ideas? So far it checks to see if a comma is present in the string. if so I want to switch the order of the words in the string and remove the comma, and if there is a middle initial and it doesnt' contain a period after it, I want to add one. if (entity instanceof Entity) { // if so, cast it to a variable Entity ent = (Entity) entity; SName name = ent.getName(); String nameStr = name.getString(); String newName = ""; // Now you have the name to mess with // NOW, this is where i need help if (choiceStr.equals("First MI. Last")) { String formattedName = WordUtils .capitalizeFully(nameStr); for (int i = 0; i < formattedName.length(); i++) { if (formattedName.charAt(i) != ',') { newName += formattedName.charAt(i); } } } name.setString(newName); network.updateConcept(ent);
0
4,112,724
11/06/2010 10:26:17
288,774
03/08/2010 12:48:58
104
16
Technically, what is the difference between custom email & commercial email delivery solution?
nowadays there are many commercial email sending services for applications around. To give some examples, [sendlook][1], [mailchimp][2] & so forth. What i want to know is, looking from a technical perspective, what is the difference between regular mail() running from a VPS account compared to those commercial email delivery services? **Why** do this services pop up everywhere? Is there a reason, i would ever need to use them, instead of regular php mail() ? Keeping a regular VPS server with 512mb RAM and XEON CPU in mind, would eventually problems arise when sending out email? If yes, what would be the number of emails i would have to send? Thank you for reading, have a nice day. [1]: http://sendloop.com/ [2]: http://www.mailchimp.com/
email
commercial
null
null
null
11/06/2010 12:56:04
off topic
Technically, what is the difference between custom email & commercial email delivery solution? === nowadays there are many commercial email sending services for applications around. To give some examples, [sendlook][1], [mailchimp][2] & so forth. What i want to know is, looking from a technical perspective, what is the difference between regular mail() running from a VPS account compared to those commercial email delivery services? **Why** do this services pop up everywhere? Is there a reason, i would ever need to use them, instead of regular php mail() ? Keeping a regular VPS server with 512mb RAM and XEON CPU in mind, would eventually problems arise when sending out email? If yes, what would be the number of emails i would have to send? Thank you for reading, have a nice day. [1]: http://sendloop.com/ [2]: http://www.mailchimp.com/
2
441,037
01/13/2009 22:11:31
46,775
12/16/2008 18:41:03
47
0
What is your ultimate development environment for working with Dojo widgets?
I'm new to working with the Dojo lib and want to know: what's the ultimate development environment to work on Dojo widgets with? I'm hoping for something with at least javascript syntax checking, and code completion support for the standard dojo widgets and functions. What development environment -- whether free or purchased -- are you happiest with for such work?
dojo
null
null
null
null
01/19/2012 22:11:14
not constructive
What is your ultimate development environment for working with Dojo widgets? === I'm new to working with the Dojo lib and want to know: what's the ultimate development environment to work on Dojo widgets with? I'm hoping for something with at least javascript syntax checking, and code completion support for the standard dojo widgets and functions. What development environment -- whether free or purchased -- are you happiest with for such work?
4
2,901,831
05/25/2010 03:36:16
30,917
10/23/2008 18:13:33
1,364
13
Algorithm for autocomplete?
I am referring to the algorithm that is used to give query suggestions when a user type a search term in google. I am mainly interested in how google algorithm is able to show: 1. Most important results (most likely queries rather than anything that matches) 2. Match substrings 3. Fuzzy matches I know you could use Trie or generalized trie to find matches but it wouldn't meet the above requirements... Similar questions asked earlier [here][1] [1]: http://stackoverflow.com/questions/1783652/what-is-the-best-autocomplete-suggest-algorithm-datastructure-c-c Thanks
algorithm
autocomplete
scalability
data-structures
autosuggest
null
open
Algorithm for autocomplete? === I am referring to the algorithm that is used to give query suggestions when a user type a search term in google. I am mainly interested in how google algorithm is able to show: 1. Most important results (most likely queries rather than anything that matches) 2. Match substrings 3. Fuzzy matches I know you could use Trie or generalized trie to find matches but it wouldn't meet the above requirements... Similar questions asked earlier [here][1] [1]: http://stackoverflow.com/questions/1783652/what-is-the-best-autocomplete-suggest-algorithm-datastructure-c-c Thanks
0
9,042,053
01/28/2012 01:01:43
721,395
04/23/2011 03:47:48
105
2
Backend script?
I'm not even sure how to approach this one. How would you have a backend script on a site that runs 24/7 and say sends an email every minute. Is something like this possible to write in php. For example I don't want the actual page to be open in the browser the server (Godaddy in my case) would automatically do it. I dont need a physical script. Just a technology that would allow me to do so!!!!!
php
web-services
backend
null
null
01/28/2012 05:46:23
not a real question
Backend script? === I'm not even sure how to approach this one. How would you have a backend script on a site that runs 24/7 and say sends an email every minute. Is something like this possible to write in php. For example I don't want the actual page to be open in the browser the server (Godaddy in my case) would automatically do it. I dont need a physical script. Just a technology that would allow me to do so!!!!!
1
10,804,566
05/29/2012 18:21:59
1,424,390
05/29/2012 18:09:07
1
0
How I will generate Xml For the Below code ... code for void getxml() method inside Order class which depends upon Delivery & Recipient Class
public class OrderXml { public enum DeliveryType { FTP, Email, HDD, Tape, Aspera, MLT }; public class Order { public int UserId { get; private set; } public int OrderBinId { get; private set; } public int TenantId { get; private set; } public Delivery Delivery { get; set; } public Recipient Recipient { get; private set; } public string[] AssetDmGuids { get; set; } public Order(int orderBinId, string[] assetDmGuids, DeliveryType type, int recipientId, string recipientName) { Delivery = new Delivery(type); Recipient = new Recipient(recipientId, recipientName); // UserId = SessionHelper.Instance.GetUserId(); // TenantId = SessionHelper.Instance.GetTenantID().ToString(); OrderBinId = orderBinId; AssetDmGuids = assetDmGuids; } public void GetXml() { } } public class Recipient { int _id; string _name = string.Empty; public Recipient(int id, string name) { this._id = id; this._name = name; } public int Id { get { return _id; } } public string Name { get { return _name; } } } public class Delivery { DeliveryType _deliveryType; string _ftpLocation = string.Empty; string _ftpPath = string.Empty; string[] _emailAddresses; string _deliveryAddress = string.Empty; string _deliveryComments = string.Empty; string _asperaLocation = string.Empty; public string FtpPath { get { return _ftpPath; } set { _ftpPath = value; } } public string[] EmailAddresses { get { return _emailAddresses; } set { _emailAddresses = value; } } public string DeliveryAddress { get { return _deliveryAddress; } set { _deliveryAddress = value; } } public string DeliveryComments { get { return _deliveryComments; } set { _deliveryComments = value; } } public string AsperaLocation { get { return _asperaLocation; } set { _asperaLocation = value; } } public string FtpLocation { get { return _ftpLocation; } set { _ftpLocation = value; } } public Delivery(DeliveryType type) { _deliveryType = type; } } public static void Main() { Order ord = new Order(1, new string[] { "123", "124", "125" }, DeliveryType.Tape, 1, "vh1"); } }
c#
null
null
null
null
null
open
How I will generate Xml For the Below code ... code for void getxml() method inside Order class which depends upon Delivery & Recipient Class === public class OrderXml { public enum DeliveryType { FTP, Email, HDD, Tape, Aspera, MLT }; public class Order { public int UserId { get; private set; } public int OrderBinId { get; private set; } public int TenantId { get; private set; } public Delivery Delivery { get; set; } public Recipient Recipient { get; private set; } public string[] AssetDmGuids { get; set; } public Order(int orderBinId, string[] assetDmGuids, DeliveryType type, int recipientId, string recipientName) { Delivery = new Delivery(type); Recipient = new Recipient(recipientId, recipientName); // UserId = SessionHelper.Instance.GetUserId(); // TenantId = SessionHelper.Instance.GetTenantID().ToString(); OrderBinId = orderBinId; AssetDmGuids = assetDmGuids; } public void GetXml() { } } public class Recipient { int _id; string _name = string.Empty; public Recipient(int id, string name) { this._id = id; this._name = name; } public int Id { get { return _id; } } public string Name { get { return _name; } } } public class Delivery { DeliveryType _deliveryType; string _ftpLocation = string.Empty; string _ftpPath = string.Empty; string[] _emailAddresses; string _deliveryAddress = string.Empty; string _deliveryComments = string.Empty; string _asperaLocation = string.Empty; public string FtpPath { get { return _ftpPath; } set { _ftpPath = value; } } public string[] EmailAddresses { get { return _emailAddresses; } set { _emailAddresses = value; } } public string DeliveryAddress { get { return _deliveryAddress; } set { _deliveryAddress = value; } } public string DeliveryComments { get { return _deliveryComments; } set { _deliveryComments = value; } } public string AsperaLocation { get { return _asperaLocation; } set { _asperaLocation = value; } } public string FtpLocation { get { return _ftpLocation; } set { _ftpLocation = value; } } public Delivery(DeliveryType type) { _deliveryType = type; } } public static void Main() { Order ord = new Order(1, new string[] { "123", "124", "125" }, DeliveryType.Tape, 1, "vh1"); } }
0
11,348,030
07/05/2012 15:50:55
1,444,829
06/08/2012 15:00:43
1
0
I cant open a file
Hello i am working on a option meny for my drawing programm. The problem is that the file that i open dosent draw anything from it. The file contains 266 Kb so i know save works. i am wondering what i have do wrong here? The method of open i am using is called Binary Formater [Serializable] class SaveANDOpen { Lines l = new Lines(); SaveFileDialog saveDialog = new SaveFileDialog(); BinaryFormatter formatter = new BinaryFormatter(); OpenFileDialog openDialog = new OpenFileDialog(); public void openit() { if (openDialog.ShowDialog() == DialogResult.OK) { FileStream fileopen = new FileStream(openDialog.FileName, FileMode.Open); l.gates = (LinkedList<Shape>)formatter.Deserialize(fileopen); fileopen.Close(); } } } l.gates is a linkedlist with contains many shapes in the Line class. The lineclass draws lines between the shapes. Greetings Unknown Programmer =)
open
null
null
null
null
07/28/2012 10:57:06
not a real question
I cant open a file === Hello i am working on a option meny for my drawing programm. The problem is that the file that i open dosent draw anything from it. The file contains 266 Kb so i know save works. i am wondering what i have do wrong here? The method of open i am using is called Binary Formater [Serializable] class SaveANDOpen { Lines l = new Lines(); SaveFileDialog saveDialog = new SaveFileDialog(); BinaryFormatter formatter = new BinaryFormatter(); OpenFileDialog openDialog = new OpenFileDialog(); public void openit() { if (openDialog.ShowDialog() == DialogResult.OK) { FileStream fileopen = new FileStream(openDialog.FileName, FileMode.Open); l.gates = (LinkedList<Shape>)formatter.Deserialize(fileopen); fileopen.Close(); } } } l.gates is a linkedlist with contains many shapes in the Line class. The lineclass draws lines between the shapes. Greetings Unknown Programmer =)
1
7,251,503
08/31/2011 00:58:24
920,751
08/31/2011 00:58:24
1
0
FB.Canvas.setAutoResize() just got updated?
Just about an hour ago, FB.Canvas.setAutoResize() started going crazy and my iFrame application stopped displaying its iframe content. I could not find the problem until I commented out that function call. I added this function call in order to fix the height issue across the different browsers, but then somehow it stopped working as it used to, without any notice from Facebook.
iframe
facebook-javascript-sdk
null
null
null
08/31/2011 04:26:24
not a real question
FB.Canvas.setAutoResize() just got updated? === Just about an hour ago, FB.Canvas.setAutoResize() started going crazy and my iFrame application stopped displaying its iframe content. I could not find the problem until I commented out that function call. I added this function call in order to fix the height issue across the different browsers, but then somehow it stopped working as it used to, without any notice from Facebook.
1
8,655,981
12/28/2011 04:28:40
667,903
04/11/2010 15:23:16
123
3
Google Map Zoom variable not being recognised
I'm using a Wordpress plugin called RomeLuv Google Maps for Wordpress, which builds Google Maps from map location values in posts' custom meta tags. The plugin works fine, except for **the zoom level of the map**, which **by default is zoomed in as close as possible** ([example here][1]). The zoom level was hard coded to 17 in the plugin code. I changed this to 10, but the map remains at closest zoom. The plugin outputs the following code, copied from viewing the source code of the generated web page: <div id="romeluv-global-map" style="width: 100%; height:600px; "></div> <script type="text/javascript"> var map = new google.maps.Map(document.getElementById("romeluv-global-map"), { zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var bounds = new google.maps.LatLngBounds(); var marker, i; var myIcon = new google.maps.MarkerImage("http://www.doig.com.au/test/volunteer/wp-content/uploads/firstaid.png", null, null, null, new google.maps.Size(32,37)); marker = new google.maps.Marker({ position: new google.maps.LatLng(-22.9794430, -43.2320800), map: map, icon: myIcon }); bounds.extend(marker.position); google.maps.event.addListener(marker, "mousedown", (function(marker, i) { return function() { infowindow.setContent("<p style='width:95%'><a class='romeluv-google-map-link' href='http://www.doig.com.au/test/volunteer/midwife/'><b>Midwife</b></a><br /> <i>Midwifery</i> <br />Address: <b>Rio De Janeiro, Brazil </b><br /><br /></p>"); infowindow.open(map, marker); } })(marker, i)); // Fit these bounds to the map map.fitBounds(bounds); </script> Is the zoom level being incorrectly implemented here? [1]: http://www.doig.com.au/test/volunteer/map/
google-maps
null
null
null
null
null
open
Google Map Zoom variable not being recognised === I'm using a Wordpress plugin called RomeLuv Google Maps for Wordpress, which builds Google Maps from map location values in posts' custom meta tags. The plugin works fine, except for **the zoom level of the map**, which **by default is zoomed in as close as possible** ([example here][1]). The zoom level was hard coded to 17 in the plugin code. I changed this to 10, but the map remains at closest zoom. The plugin outputs the following code, copied from viewing the source code of the generated web page: <div id="romeluv-global-map" style="width: 100%; height:600px; "></div> <script type="text/javascript"> var map = new google.maps.Map(document.getElementById("romeluv-global-map"), { zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var bounds = new google.maps.LatLngBounds(); var marker, i; var myIcon = new google.maps.MarkerImage("http://www.doig.com.au/test/volunteer/wp-content/uploads/firstaid.png", null, null, null, new google.maps.Size(32,37)); marker = new google.maps.Marker({ position: new google.maps.LatLng(-22.9794430, -43.2320800), map: map, icon: myIcon }); bounds.extend(marker.position); google.maps.event.addListener(marker, "mousedown", (function(marker, i) { return function() { infowindow.setContent("<p style='width:95%'><a class='romeluv-google-map-link' href='http://www.doig.com.au/test/volunteer/midwife/'><b>Midwife</b></a><br /> <i>Midwifery</i> <br />Address: <b>Rio De Janeiro, Brazil </b><br /><br /></p>"); infowindow.open(map, marker); } })(marker, i)); // Fit these bounds to the map map.fitBounds(bounds); </script> Is the zoom level being incorrectly implemented here? [1]: http://www.doig.com.au/test/volunteer/map/
0
7,525,753
09/23/2011 07:40:01
239,599
12/28/2009 14:26:48
8,907
419
Terminology: is DHTML a predecessor of HTML5?
In the end of 1990s everyone talked about how cool it is "to program DHTML". In fact, it was an umbrella term for HTML+CSS+JavaScript, there was no specific version of HTML, nor a public standard of what it means. Now it's 2011 and everyone talks of HTML5, which is also a combination of HTML, CSS, JavaScript and some more additions like WebSockets, Localstorage etc. So the question is, would it be correct to call DHTML a predecessor of HTML5, just the latter being a public standard? Or am I missing some point?
html5
terminology
dhtml
null
null
09/29/2011 03:30:25
not constructive
Terminology: is DHTML a predecessor of HTML5? === In the end of 1990s everyone talked about how cool it is "to program DHTML". In fact, it was an umbrella term for HTML+CSS+JavaScript, there was no specific version of HTML, nor a public standard of what it means. Now it's 2011 and everyone talks of HTML5, which is also a combination of HTML, CSS, JavaScript and some more additions like WebSockets, Localstorage etc. So the question is, would it be correct to call DHTML a predecessor of HTML5, just the latter being a public standard? Or am I missing some point?
4
9,585,022
03/06/2012 13:53:14
1,230,951
02/24/2012 14:14:49
9
0
loading and unloading silverlight application on button click
Hi I have a set of silverlight applications built on MVVM light framework (having multiple views and viewmodels corresponding to each view). Now I need to create a framework exposing each of the applications as a button. clicking the button should load the corresponding application. Clicking another button should unload this application and load the application. How can I accomplish this task. In order to use MEF should I have to modify each of the application? or Is there any other way to do this?
silverlight
silverlight-4.0
mef
xap
null
06/06/2012 12:34:54
not a real question
loading and unloading silverlight application on button click === Hi I have a set of silverlight applications built on MVVM light framework (having multiple views and viewmodels corresponding to each view). Now I need to create a framework exposing each of the applications as a button. clicking the button should load the corresponding application. Clicking another button should unload this application and load the application. How can I accomplish this task. In order to use MEF should I have to modify each of the application? or Is there any other way to do this?
1
1,171,709
07/23/2009 13:26:31
128,623
06/25/2009 04:55:19
104
0
PHP help, I have a "for loop" problems?
Here is my code: $today = date('Y-m-d'); for ($i = 1; $i <= 10; $i ++){ $var_b[$i] = date('Y-m-d', strtotime('-' . $i .' day', strtotime($today))); $var2_b[$i] = date('d', strtotime($var_b[$i])); Error message: Parse error: syntax error, unexpected T_STRING in XXX\index.php on line XX
php
for-loop
null
null
null
07/24/2012 02:36:35
too localized
PHP help, I have a "for loop" problems? === Here is my code: $today = date('Y-m-d'); for ($i = 1; $i <= 10; $i ++){ $var_b[$i] = date('Y-m-d', strtotime('-' . $i .' day', strtotime($today))); $var2_b[$i] = date('d', strtotime($var_b[$i])); Error message: Parse error: syntax error, unexpected T_STRING in XXX\index.php on line XX
3
9,424,116
02/24/2012 01:27:41
834,113
07/07/2011 18:08:08
1
0
What UI Framework to use for OpenGL game when sharing code between Android and iOS?
I am writing a game using C/C++ and OpenGL ES, and I am targeting both iOS and Android. My goal is to share the majority of the rendering/gameplay/UI code between both platforms, and have an OS-specific wrapper that handles things like touch events, resources, networking, etc. For the shared UI, I can either write my own system, or use an existing toolkit/framework. My UI will mostly consist of buttons, toolbars, possibly a simple menu system, tooltips/overlays, scroll views, and font rendering. These are my requirements: - Skinnable - definitely necessary to provide my own image-based graphics to the buttons/toolbars/etc. - Scalable - I will be targeting devices of varying screen resolutions and sizes, so something that allows you to build UI using dpi or percentages is a must - Platform-independent - most UI toolkits out there, even when cross-platform, use OS-native rendering or widgets. Since this will run on both iOS and Android, I need something that defines its own widgets and renders to OpenGL directly. Here are the frameworks I am aware of right now. I have not yet looked into any of them deeply, so opinions are welcome: - Cocos2D-x - NUI - Clutter - Crazy Eddie's GUI (CEGUI) - MyGUI - Gwen So, what framework do you recommend, and why? Or do you recommend I just write a UI framework customized for my own game? *Please no suggestions for alternate ways of coding the game - I'm invested in using C++ and OpenGL ES for various reasons, and I am already comfortable with using the Android NDK for native support on Android.*
android
c++
ios
user-interface
opengl-es
02/24/2012 01:47:19
not constructive
What UI Framework to use for OpenGL game when sharing code between Android and iOS? === I am writing a game using C/C++ and OpenGL ES, and I am targeting both iOS and Android. My goal is to share the majority of the rendering/gameplay/UI code between both platforms, and have an OS-specific wrapper that handles things like touch events, resources, networking, etc. For the shared UI, I can either write my own system, or use an existing toolkit/framework. My UI will mostly consist of buttons, toolbars, possibly a simple menu system, tooltips/overlays, scroll views, and font rendering. These are my requirements: - Skinnable - definitely necessary to provide my own image-based graphics to the buttons/toolbars/etc. - Scalable - I will be targeting devices of varying screen resolutions and sizes, so something that allows you to build UI using dpi or percentages is a must - Platform-independent - most UI toolkits out there, even when cross-platform, use OS-native rendering or widgets. Since this will run on both iOS and Android, I need something that defines its own widgets and renders to OpenGL directly. Here are the frameworks I am aware of right now. I have not yet looked into any of them deeply, so opinions are welcome: - Cocos2D-x - NUI - Clutter - Crazy Eddie's GUI (CEGUI) - MyGUI - Gwen So, what framework do you recommend, and why? Or do you recommend I just write a UI framework customized for my own game? *Please no suggestions for alternate ways of coding the game - I'm invested in using C++ and OpenGL ES for various reasons, and I am already comfortable with using the Android NDK for native support on Android.*
4
9,752,979
03/17/2012 19:21:51
1,135,155
01/06/2012 20:47:22
1
0
VirtualBox on Mac and Serial Port
On my Mac OS X 10.6.8 i've installed Virtual Box. I've an USB-Serial-Port-Connector connected; which is on port /dev/tty.usbserial . I've tested it with cutecom and it works. But i can't use this serial port in a virtual machine. I've tried it with the settings: port number: COM1 port mode: Host Device port path: /dev/tty.usbserial and tried to start the virtual machine, the computer crashes. Has anybody an idea ?
osx
serial-port
virtualbox
null
null
03/19/2012 13:54:51
off topic
VirtualBox on Mac and Serial Port === On my Mac OS X 10.6.8 i've installed Virtual Box. I've an USB-Serial-Port-Connector connected; which is on port /dev/tty.usbserial . I've tested it with cutecom and it works. But i can't use this serial port in a virtual machine. I've tried it with the settings: port number: COM1 port mode: Host Device port path: /dev/tty.usbserial and tried to start the virtual machine, the computer crashes. Has anybody an idea ?
2
9,630,744
03/09/2012 08:05:47
325,016
04/24/2010 17:25:09
584
7
Should you declare enums inside or outside a class?
Should you declare enums inside or outside a class if the said enums are only used in the class member functions? namespace nspace { // need to append OC, as this pollutes the current namespace enum OUTSIDE_CLASS {OC_POINTS, OC_LINES, OC_LINE_LOOP, :::}; enum OTHER_ENUM {OE_POINTS}; class VertexBuffer { public: enum INSIDE_CLASS {POINTS, LINES, LINE_LOOP, :::}; void foo(OUTSIDE_CLASS e); void bar(INSIDE_CLASS e); } }; // usage nspace::VertexBuffer v; v.foo(nspae::VB_POINTS); v.bar(nspace::VertexBuffer::POINTS); // more pedantic
c++
coding-style
enums
namespaces
null
03/10/2012 00:49:47
not constructive
Should you declare enums inside or outside a class? === Should you declare enums inside or outside a class if the said enums are only used in the class member functions? namespace nspace { // need to append OC, as this pollutes the current namespace enum OUTSIDE_CLASS {OC_POINTS, OC_LINES, OC_LINE_LOOP, :::}; enum OTHER_ENUM {OE_POINTS}; class VertexBuffer { public: enum INSIDE_CLASS {POINTS, LINES, LINE_LOOP, :::}; void foo(OUTSIDE_CLASS e); void bar(INSIDE_CLASS e); } }; // usage nspace::VertexBuffer v; v.foo(nspae::VB_POINTS); v.bar(nspace::VertexBuffer::POINTS); // more pedantic
4
11,733,339
07/31/2012 04:57:03
1,328,167
04/12/2012 04:57:48
11
0
Python: How to run a def in the background
How can I run a python definition now, but do more stuff after a certain time. So it's kind of running the script silently in the background until certain condition is met? Thank you
python
null
null
null
null
07/31/2012 12:04:51
not a real question
Python: How to run a def in the background === How can I run a python definition now, but do more stuff after a certain time. So it's kind of running the script silently in the background until certain condition is met? Thank you
1
7,567,489
09/27/2011 10:14:48
966,747
09/27/2011 10:02:48
1
0
samsung galaxy -FM radio , app to change the radio station from the handsfree
i have been to a android developer with an idea to to develop an android app with that app i can change the radio station using the handsfree call receive button the developer have said tht this app is not possible as the api of the radio of the samsung galaxy phone is not availbe this is very comman in nokia phone .
android
radio
radio-group
samsung-rfs-filesystem
null
09/27/2011 11:26:37
not a real question
samsung galaxy -FM radio , app to change the radio station from the handsfree === i have been to a android developer with an idea to to develop an android app with that app i can change the radio station using the handsfree call receive button the developer have said tht this app is not possible as the api of the radio of the samsung galaxy phone is not availbe this is very comman in nokia phone .
1
11,505,707
07/16/2012 13:45:37
1,169,194
01/25/2012 12:25:49
58
6
Some nice OO library to handle directories in PHP
Is there any nice "common" OO library for handling files and directories, like recursive copy, delete, read and such? Native php functions sucs and their like OO approuch. Any tips on this would be helpfull I dont want re-invent the weel.
php
oop
php5
filesystems
null
07/17/2012 08:15:17
not constructive
Some nice OO library to handle directories in PHP === Is there any nice "common" OO library for handling files and directories, like recursive copy, delete, read and such? Native php functions sucs and their like OO approuch. Any tips on this would be helpfull I dont want re-invent the weel.
4
4,097,639
11/04/2010 14:27:53
497,231
11/04/2010 14:05:43
1
0
Simple server/client string exchange protocol
i am looking for an abstract and clean way to exchange strings between two python programs. The protocol is really simple: client/server sends a string to the server/client and it takes the corresponding action - via a handler, i suppose - and replies OR NOT to the other side with another string. Strings can be three things: an acknowledgement, signalling one side that the other on is still alive; a pickled class containing a command, if going from the "client" to the "server", or a response, if going from the "server" to the "client"; and finally a "lock" command, that signals a side of the conversation that the other is working and no further questions should be asked until another lock packet is received. I have been looking at the python's built in SocketServer.TCPServer, but it's way too low level, it does not easily support reconnection and the client has to use the socket interface, which i preferred to be encapsulated. I then explored the twisted framework, particularly the LineOnlyReceiver protocol and server examples, but i found the initial learning curve to be too steep, the online documentation assuming a little too much knowledge and a general lack of examples and good documentation (except the 2005 O'reilly book, is this still valid?). I then tryied the pyliblo library, which is perfect for the task, alas it is monodirectional, there is no way to "answer" a client, and i need the answer to be associated to the specific command. So my question is: is there an existing framework/library/module that allows me to have a client object in the server, to read the commands from and send the replies to, and a server object in the client, to read the replies from and send the commands to, that i can use after a simple setup (client, the server address is host:port, server, you are listening on port X) having the underlying socket, reconnection engine and so on handled? thanks in advance to any answer (pardon my english and inexperience, this is my first question)
python
string
networking
protocols
null
null
open
Simple server/client string exchange protocol === i am looking for an abstract and clean way to exchange strings between two python programs. The protocol is really simple: client/server sends a string to the server/client and it takes the corresponding action - via a handler, i suppose - and replies OR NOT to the other side with another string. Strings can be three things: an acknowledgement, signalling one side that the other on is still alive; a pickled class containing a command, if going from the "client" to the "server", or a response, if going from the "server" to the "client"; and finally a "lock" command, that signals a side of the conversation that the other is working and no further questions should be asked until another lock packet is received. I have been looking at the python's built in SocketServer.TCPServer, but it's way too low level, it does not easily support reconnection and the client has to use the socket interface, which i preferred to be encapsulated. I then explored the twisted framework, particularly the LineOnlyReceiver protocol and server examples, but i found the initial learning curve to be too steep, the online documentation assuming a little too much knowledge and a general lack of examples and good documentation (except the 2005 O'reilly book, is this still valid?). I then tryied the pyliblo library, which is perfect for the task, alas it is monodirectional, there is no way to "answer" a client, and i need the answer to be associated to the specific command. So my question is: is there an existing framework/library/module that allows me to have a client object in the server, to read the commands from and send the replies to, and a server object in the client, to read the replies from and send the commands to, that i can use after a simple setup (client, the server address is host:port, server, you are listening on port X) having the underlying socket, reconnection engine and so on handled? thanks in advance to any answer (pardon my english and inexperience, this is my first question)
0