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
7,499,219
09/21/2011 11:47:59
956,862
09/21/2011 11:47:59
1
0
Efficient sorting of a pile of cards
**Which is the efficient way and stable procedure to sort a pile of cards? Shall I prefer Quick sort to merge sort or Radix sort?**
sorting
null
null
null
null
09/21/2011 16:24:14
not a real question
Efficient sorting of a pile of cards === **Which is the efficient way and stable procedure to sort a pile of cards? Shall I prefer Quick sort to merge sort or Radix sort?**
1
9,790,551
03/20/2012 16:10:05
716,082
04/19/2011 22:06:10
522
23
Duplicate entry for key 'PRIMARY'
I'm trying to import a csv (that is a data extract from a SQL Server db) into MySQL. I'm using this command to load the file: LOAD DATA INFILE '/Users/Tyler/Desktop/playersToTeams.txt' INTO TABLE players_to_teams FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; And I get this error: Error Code: 1062. Duplicate entry '124547' for key 'PRIMARY' When I run: `grep 124547 playersToTeams.txt`: 119683,True,True,124547,1493,2011-08-31 02:22:56.630000000,,,,,http://bucknellbison.cstv.com///sports/m-wrestl/mtt/stolfi_joe00.html,,,,,, 124547,True,True,129411,14726,2011-08-31 02:22:56.630000000,Free/Breast,,,,http://usctrojans.collegesports.com/sports/m-swim/mtt/walling_emmett00.html,,,,,, I can see that the 4th column of the first entry has the same number as the first column (pk, id), but the 4th column doesn't have any sort of index on it. Here's the create schema created by sql workbench: CREATE TABLE `players_to_teams` ( `id` int(11) NOT NULL AUTO_INCREMENT, `IsActive` tinyint(1) DEFAULT NULL, `IsVisible` tinyint(1) DEFAULT NULL, `PlayerId` int(11) DEFAULT NULL, `TeamId` int(11) DEFAULT NULL, `CreationDate` datetime DEFAULT NULL, `Position` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `Number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `Club` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `BT` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `BioLink` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `OtherBioLink` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `StartYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `EndYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `NeulionPlayerID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `SeasonYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `GamesPlayed` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=124549 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci$$ If I rerun the `LOAD DATA` command, without changing anything, I get a different error, this time the number is 2 more than the previous time (124549 vs. 124547). Running it again skips to 124552. Any ideas what is causing this duplicate error? Thanks
mysql
sql-server
import
null
null
null
open
Duplicate entry for key 'PRIMARY' === I'm trying to import a csv (that is a data extract from a SQL Server db) into MySQL. I'm using this command to load the file: LOAD DATA INFILE '/Users/Tyler/Desktop/playersToTeams.txt' INTO TABLE players_to_teams FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; And I get this error: Error Code: 1062. Duplicate entry '124547' for key 'PRIMARY' When I run: `grep 124547 playersToTeams.txt`: 119683,True,True,124547,1493,2011-08-31 02:22:56.630000000,,,,,http://bucknellbison.cstv.com///sports/m-wrestl/mtt/stolfi_joe00.html,,,,,, 124547,True,True,129411,14726,2011-08-31 02:22:56.630000000,Free/Breast,,,,http://usctrojans.collegesports.com/sports/m-swim/mtt/walling_emmett00.html,,,,,, I can see that the 4th column of the first entry has the same number as the first column (pk, id), but the 4th column doesn't have any sort of index on it. Here's the create schema created by sql workbench: CREATE TABLE `players_to_teams` ( `id` int(11) NOT NULL AUTO_INCREMENT, `IsActive` tinyint(1) DEFAULT NULL, `IsVisible` tinyint(1) DEFAULT NULL, `PlayerId` int(11) DEFAULT NULL, `TeamId` int(11) DEFAULT NULL, `CreationDate` datetime DEFAULT NULL, `Position` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `Number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `Club` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `BT` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `BioLink` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `OtherBioLink` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `StartYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `EndYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `NeulionPlayerID` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `SeasonYear` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `GamesPlayed` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=124549 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci$$ If I rerun the `LOAD DATA` command, without changing anything, I get a different error, this time the number is 2 more than the previous time (124549 vs. 124547). Running it again skips to 124552. Any ideas what is causing this duplicate error? Thanks
0
5,965,415
05/11/2011 13:55:18
726,991
04/27/2011 10:07:21
6
0
jsp & hibernate
i get this eeror when i deploy my jsp page :i use hibernate i want to create a simple form jsp with one class java javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20 my faces-config: <?xml version="1.0" encoding="UTF-8"?> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> <managed-bean> <managed-bean-name>modelTime</managed-bean-name> <managed-bean-class>org.projet.ModelTime</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <navigation-rule> <display-name> home</display-name> <from-view-id> /index.jsp</from-view-id> <navigation-case> <from-outcome>newTimesheet</from-outcome> <to-view-id> /newTimesheet.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config> my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Time</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> <context-param> <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> </web-app> my newTimesheet.jsp: <%@ page session="true" isThreadSafe="true" import="org.projet.*,java.net.*, java.io.*, java.util.*,net.sf.hibernate.*,net.sf.hibernate.cfg.*,net.sf.hibernate.expression.*" %> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>NewTimesheet</title> </head> <body topmargin="0" leftmargin="0" vlink="#0000FF" alink="#0000FF"> <div align="left"> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="84%" height="228" align="left"> <tr> <td width="13%" height="35" align="left" valign="top">&nbsp;</td> <td width="87%" height="35" align="left" valign="bottom"> <font face="Arial"><b>Create a new &quot;timesheet&quot;</b></font></td> </tr> <tr> <td width="14%" height="192" align="left" valign="top">&nbsp;</td> <td width="86%" height="192" align="left" valign="top"> <form method="POST" action="newTimesheet.jsp"> <input type="hidden" name="CID" value="1"> <font face="Courier New"><font size="2"><br> <br> Category:&nbsp;&nbsp;&nbsp;&nbsp; </font> <input type="text" name="formCategoryMsg" size="38"><font size="2"><br> Description:&nbsp; </font><input type="text" name="formCategoryDescription" size="38"><br> &nbsp;</font></p> <p align="left"><font face="Courier New"> <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></font></p> </form> <p>&nbsp;</td> </tr> </table> </div> </body> </html> <%! any solution? thankshibe
hibernate
jsp
null
null
null
null
open
jsp & hibernate === i get this eeror when i deploy my jsp page :i use hibernate i want to create a simple form jsp with one class java javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20 my faces-config: <?xml version="1.0" encoding="UTF-8"?> <faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"> <managed-bean> <managed-bean-name>modelTime</managed-bean-name> <managed-bean-class>org.projet.ModelTime</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <navigation-rule> <display-name> home</display-name> <from-view-id> /index.jsp</from-view-id> <navigation-case> <from-outcome>newTimesheet</from-outcome> <to-view-id> /newTimesheet.jsp</to-view-id> </navigation-case> </navigation-rule> </faces-config> my web.xml: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Time</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsp</url-pattern> </servlet-mapping> <context-param> <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>client</param-value> </context-param> <context-param> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name> <param-value>resources.application</param-value> </context-param> <listener> <listener-class>com.sun.faces.config.ConfigureListener</listener-class> </listener> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.faces</url-pattern> </servlet-mapping> </web-app> my newTimesheet.jsp: <%@ page session="true" isThreadSafe="true" import="org.projet.*,java.net.*, java.io.*, java.util.*,net.sf.hibernate.*,net.sf.hibernate.cfg.*,net.sf.hibernate.expression.*" %> <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>NewTimesheet</title> </head> <body topmargin="0" leftmargin="0" vlink="#0000FF" alink="#0000FF"> <div align="left"> <table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="84%" height="228" align="left"> <tr> <td width="13%" height="35" align="left" valign="top">&nbsp;</td> <td width="87%" height="35" align="left" valign="bottom"> <font face="Arial"><b>Create a new &quot;timesheet&quot;</b></font></td> </tr> <tr> <td width="14%" height="192" align="left" valign="top">&nbsp;</td> <td width="86%" height="192" align="left" valign="top"> <form method="POST" action="newTimesheet.jsp"> <input type="hidden" name="CID" value="1"> <font face="Courier New"><font size="2"><br> <br> Category:&nbsp;&nbsp;&nbsp;&nbsp; </font> <input type="text" name="formCategoryMsg" size="38"><font size="2"><br> Description:&nbsp; </font><input type="text" name="formCategoryDescription" size="38"><br> &nbsp;</font></p> <p align="left"><font face="Courier New"> <input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></font></p> </form> <p>&nbsp;</td> </tr> </table> </div> </body> </html> <%! any solution? thankshibe
0
8,655,949
12/28/2011 12:31:12
1,119,288
12/28/2011 12:28:01
1
0
jquery autocomplete
$().ready(function() { $("#cont_name2").autocomplete("<?php echo SITEURL;?>calendar/gl_calendar/gl_auto_uname", { width: 260, matchContains: true, //mustMatch: true, //minChars: 0, multiple: true //highlight: false, //multipleSeparator: ",", //selectFirst: false }); $("#cont_name2").result(function(event, data, formatted) { //$("#meeting_hidden_id").val(''); // $("#meeting_hidden_email").val(''); var hidden_id = $("#meeting_hidden_id"); remove_id_from_hidden(hidden_id); hidden_id.val( (hidden_id.val() ? hidden_id.val() + "," : hidden_id.val()) + data[1]); var hidden_email = $("#meeting_hidden_email"); hidden_email.val( (hidden_email.val() ? hidden_email.val() + "," : hidden_email.val()) + data[2]); var meeting_email = $("#meeting_to"); meeting_email.val( (meeting_email.val() ? meeting_email.val() + "," : meeting_email.val()) + data[2]); }); }); How to remove the duplicate id using this code?
jquery
autocomplete
null
null
null
null
open
jquery autocomplete === $().ready(function() { $("#cont_name2").autocomplete("<?php echo SITEURL;?>calendar/gl_calendar/gl_auto_uname", { width: 260, matchContains: true, //mustMatch: true, //minChars: 0, multiple: true //highlight: false, //multipleSeparator: ",", //selectFirst: false }); $("#cont_name2").result(function(event, data, formatted) { //$("#meeting_hidden_id").val(''); // $("#meeting_hidden_email").val(''); var hidden_id = $("#meeting_hidden_id"); remove_id_from_hidden(hidden_id); hidden_id.val( (hidden_id.val() ? hidden_id.val() + "," : hidden_id.val()) + data[1]); var hidden_email = $("#meeting_hidden_email"); hidden_email.val( (hidden_email.val() ? hidden_email.val() + "," : hidden_email.val()) + data[2]); var meeting_email = $("#meeting_to"); meeting_email.val( (meeting_email.val() ? meeting_email.val() + "," : meeting_email.val()) + data[2]); }); }); How to remove the duplicate id using this code?
0
10,719,580
05/23/2012 12:07:55
930,555
09/06/2011 11:39:23
6
0
Subversion release management system
We are using Subversion and things are going well with it. We are actively using branches and tags as appropriate to indicate releases at the appropriate levels. However, we are looking for a release management tool. Essentially, what it needs to do is relatively simple: 1. Grab the relevant code from Subversion (based on a tag). 2. Do preparatory work (for example: put it in a tar, exclude certain directories). 3. Audit trail ("User X is performing this release") 4. Email trail (Send an email indicating a release request). 5. Perform the install. We've previously created our own web-based system to handle this sort of thing (release requests). Really, it's more of the _workflow_ that we are after. I'm aware that SVN itself can be used to update different servers, but this isn't appropriate for us. We don't want production servers updating using SVN itself due to the security tiers in use. Currently, a tar file is extracted as appropriate for a release by our operations team. Developers do not have this level of access, so there is a degree of seperation. We don't need a _build_ management tool, as the software is in Perl and we are happy with how that is going. It is all safe and sound in Subversion. The key is the deployment, once everything is tagged and ready! Looking forward to your input.
svn
release-management
null
null
null
05/23/2012 19:27:25
not constructive
Subversion release management system === We are using Subversion and things are going well with it. We are actively using branches and tags as appropriate to indicate releases at the appropriate levels. However, we are looking for a release management tool. Essentially, what it needs to do is relatively simple: 1. Grab the relevant code from Subversion (based on a tag). 2. Do preparatory work (for example: put it in a tar, exclude certain directories). 3. Audit trail ("User X is performing this release") 4. Email trail (Send an email indicating a release request). 5. Perform the install. We've previously created our own web-based system to handle this sort of thing (release requests). Really, it's more of the _workflow_ that we are after. I'm aware that SVN itself can be used to update different servers, but this isn't appropriate for us. We don't want production servers updating using SVN itself due to the security tiers in use. Currently, a tar file is extracted as appropriate for a release by our operations team. Developers do not have this level of access, so there is a degree of seperation. We don't need a _build_ management tool, as the software is in Perl and we are happy with how that is going. It is all safe and sound in Subversion. The key is the deployment, once everything is tagged and ready! Looking forward to your input.
4
11,681,215
07/27/2012 03:53:17
1,556,567
07/27/2012 03:39:04
1
0
Rewrite/redirect aspx with specific quesry string to specific wordpress page
I've searched through and can't find a working solution... I've ported a site from asp.net to php. As instructed, I left the internal links as .aspx for seo. For static pages outside wordpress, with no query string, I can work it fine: RewriteEngine on RewriteRule ^testimonials.aspx$ /testimonials.php [NC,R=301] But, I have some links which include query strings... These links now have to point to pages that are currently inside a wordpress installation. How can I get myawesomesite.com/catalog.aspx?n=My%incredible%20product to redirect to myawesomesite.com/catalog/my-new-incredible-product/ AND myawesomesite.com/catalog.aspx?n=My%other%20product to redirect to myawesomesite.com/catalog/my-new-other-product/ etc... (in the destination, 'catalog' is the directory that wordpress is installed in) I've tried all kinds of things but am no expert. I know I need to do something to get apache to catch the query strings...
php
asp.net
wordpress
.htaccess
redirect
null
open
Rewrite/redirect aspx with specific quesry string to specific wordpress page === I've searched through and can't find a working solution... I've ported a site from asp.net to php. As instructed, I left the internal links as .aspx for seo. For static pages outside wordpress, with no query string, I can work it fine: RewriteEngine on RewriteRule ^testimonials.aspx$ /testimonials.php [NC,R=301] But, I have some links which include query strings... These links now have to point to pages that are currently inside a wordpress installation. How can I get myawesomesite.com/catalog.aspx?n=My%incredible%20product to redirect to myawesomesite.com/catalog/my-new-incredible-product/ AND myawesomesite.com/catalog.aspx?n=My%other%20product to redirect to myawesomesite.com/catalog/my-new-other-product/ etc... (in the destination, 'catalog' is the directory that wordpress is installed in) I've tried all kinds of things but am no expert. I know I need to do something to get apache to catch the query strings...
0
5,789,686
04/26/2011 11:33:26
445,126
09/11/2010 14:33:35
1,090
40
how can I use images from buttons on a form I have no control over the HTML?
I need to swap out the default form buttons on an HTML form, but I can not change the HTML as it is being returned by a SOAP service any pointers?
javascript
jquery
html
css
null
null
open
how can I use images from buttons on a form I have no control over the HTML? === I need to swap out the default form buttons on an HTML form, but I can not change the HTML as it is being returned by a SOAP service any pointers?
0
7,107,191
08/18/2011 12:10:00
500,610
11/08/2010 11:19:05
79
0
Submit a form and then insert values in a php function
I have a form where i want to submit two entries. Its the entry_id and email. I have a php function that begins something like this: public function theFunction($data) { if (false && !empty($data['email']) && !empty($data['entry_id']) ) { $sql = $this->db->select() ->from('votes') ->where('entry_id = ?', $data['entry_id']) ->where('email = ?', $data['email']) ->order('created DESC'); But how am i supposed to call this function from a php file and bringing the values from the form with me, this is far as i've come but it doesent seem to work: $fields = array("email","entry_id"); $data = array(); foreach($fields as $field){ $data[$field] = $_POST[$field]; } echo theFunction($data); Does anyone know how i should do?
php
function
null
null
null
null
open
Submit a form and then insert values in a php function === I have a form where i want to submit two entries. Its the entry_id and email. I have a php function that begins something like this: public function theFunction($data) { if (false && !empty($data['email']) && !empty($data['entry_id']) ) { $sql = $this->db->select() ->from('votes') ->where('entry_id = ?', $data['entry_id']) ->where('email = ?', $data['email']) ->order('created DESC'); But how am i supposed to call this function from a php file and bringing the values from the form with me, this is far as i've come but it doesent seem to work: $fields = array("email","entry_id"); $data = array(); foreach($fields as $field){ $data[$field] = $_POST[$field]; } echo theFunction($data); Does anyone know how i should do?
0
1,685,221
11/06/2009 03:25:04
105,066
05/11/2009 23:43:17
496
14
accurately measure time python function takes
I need to measure the time certain parts of my program take (not for debugging but as a feature in the output). Accuracy is important because the total time will be a fraction of a second. I was going to use the [time module][1] when I came across [timeit][2], which claims to *avoid a number of common traps for measuring execution times*. Unfortunately it has an awful interface, taking a string as input which it then eval's. So, do I need to use this module to measure time accurately, or will time suffice? And what are the pitfalls it refers to? Thanks [1]: http://docs.python.org/library/time.html [2]: http://docs.python.org/library/timeit.html
python
profiling
time
timeit
null
null
open
accurately measure time python function takes === I need to measure the time certain parts of my program take (not for debugging but as a feature in the output). Accuracy is important because the total time will be a fraction of a second. I was going to use the [time module][1] when I came across [timeit][2], which claims to *avoid a number of common traps for measuring execution times*. Unfortunately it has an awful interface, taking a string as input which it then eval's. So, do I need to use this module to measure time accurately, or will time suffice? And what are the pitfalls it refers to? Thanks [1]: http://docs.python.org/library/time.html [2]: http://docs.python.org/library/timeit.html
0
851,466
05/12/2009 06:46:11
27,328
10/13/2008 06:22:10
197
6
Populate an enum with values from database
I have a table which maps String->Integer. Rather than create an enum statically, I want to populate the enum with values from a database. Is this possible ? So, rather than delcaring this statically: public enum Size { SMALL(0), MEDIUM(1), LARGE(2), SUPERSIZE(3) }; I want to create this enum dynamically since the numbers {0,1,2,3} are basically random (because they are autogenerated by the database's AUTOINCREMENT column).
enumeration
java
hashmap
jdk
null
null
open
Populate an enum with values from database === I have a table which maps String->Integer. Rather than create an enum statically, I want to populate the enum with values from a database. Is this possible ? So, rather than delcaring this statically: public enum Size { SMALL(0), MEDIUM(1), LARGE(2), SUPERSIZE(3) }; I want to create this enum dynamically since the numbers {0,1,2,3} are basically random (because they are autogenerated by the database's AUTOINCREMENT column).
0
5,850,028
05/01/2011 17:20:48
733,498
05/01/2011 17:20:48
1
0
Advantages of closing file handle in perl
Advantage of closing file handle in Perl is that "$." gets 1) reset 2) cleans up buffer 3) gives command status 4) none Please tell me the correct answer with explanation (if possible)
perl
file
file-handling
null
null
05/01/2011 22:23:13
not a real question
Advantages of closing file handle in perl === Advantage of closing file handle in Perl is that "$." gets 1) reset 2) cleans up buffer 3) gives command status 4) none Please tell me the correct answer with explanation (if possible)
1
8,938,927
01/20/2012 09:04:30
918,477
08/04/2011 18:41:25
69
10
detect proxy in java/jap
I'm working on project using **java**, in which ip address will be identity of the client/user. So, i'm facing one problem, where user can spoof their host identity, that can lead to false identity of user. So, anyone know, how to detect, whether host is using proxy or not. InetAddress thisIp = InetAddress.getLocalHost(); I'm using above code to detect the host ip address.
java
jsp
proxy
null
null
null
open
detect proxy in java/jap === I'm working on project using **java**, in which ip address will be identity of the client/user. So, i'm facing one problem, where user can spoof their host identity, that can lead to false identity of user. So, anyone know, how to detect, whether host is using proxy or not. InetAddress thisIp = InetAddress.getLocalHost(); I'm using above code to detect the host ip address.
0
1,588,984
10/19/2009 14:26:51
105,445
05/12/2009 15:29:14
163
12
How to make "No Duplicates" column in Sql Server 2008 ?
I have simple table in my SQL Server DataBase. This table contain two columns: `ID int, Name nvarchar(50)`. The ID column is the primary key for my table. **I want the "Name" column to be "(No Duplicates)" but this column isn't primary column. How could i do this like MS Access ??.**
sql-server
ms-access
biginteger
null
null
null
open
How to make "No Duplicates" column in Sql Server 2008 ? === I have simple table in my SQL Server DataBase. This table contain two columns: `ID int, Name nvarchar(50)`. The ID column is the primary key for my table. **I want the "Name" column to be "(No Duplicates)" but this column isn't primary column. How could i do this like MS Access ??.**
0
8,263,622
11/25/2011 00:00:06
1,064,803
11/24/2011 23:53:13
1
0
search for current running application on Mac by using Objective-C
I am a new Objective-C programmer. I am from Java background. I am currently learning Objective-C by myself. I have a problem about finding the address of current running application. Is anyone have example code of this issue?
objective-c
null
null
null
null
12/14/2011 02:33:14
not a real question
search for current running application on Mac by using Objective-C === I am a new Objective-C programmer. I am from Java background. I am currently learning Objective-C by myself. I have a problem about finding the address of current running application. Is anyone have example code of this issue?
1
8,271,809
11/25/2011 16:24:44
1,065,952
11/25/2011 16:13:51
1
0
c# Youtube mp4 downloader
I want get video mp4 from Youtube like is done by http://saveyoutube.com/ , but, the method with get_video, don't work anymore, because of the update of youtube. It's has been 2 days that i'm looking for a way to make a c# downloader script. All my attempt end with a fail. Can someone help me pleaz.
c#
youtube
null
null
null
11/25/2011 16:53:21
not a real question
c# Youtube mp4 downloader === I want get video mp4 from Youtube like is done by http://saveyoutube.com/ , but, the method with get_video, don't work anymore, because of the update of youtube. It's has been 2 days that i'm looking for a way to make a c# downloader script. All my attempt end with a fail. Can someone help me pleaz.
1
5,846,681
05/01/2011 05:32:00
158,851
08/18/2009 22:56:45
362
3
Properties of Reference Types in C#
Greetings Overflowers, Properties of reference types expose the internal state of classes offering such properties <br /> What is your preferred way to offer the information without exposing your classes ? Regards
c#
oop
properties
null
null
05/01/2011 06:43:30
not a real question
Properties of Reference Types in C# === Greetings Overflowers, Properties of reference types expose the internal state of classes offering such properties <br /> What is your preferred way to offer the information without exposing your classes ? Regards
1
5,094,489
02/23/2011 17:27:52
22,683
09/26/2008 13:09:07
1,125
32
How do I dynamically create an Expression<Func<MyClass, bool>> predicate from Expression<Func<MyClass, string>>?
I trying to append where predicates and my goal is to create the same expression as: Services.Where(s => s.Name == "Modules" && s.Namespace == "Namespace"); I have the following code: Expression<Func<Service,string>> sel1 = s => s.Name; Expression<Func<Service,string>> sel2 = s => s.Namespace; var val1 = Expression.Constant("Modules"); var val2 = Expression.Constant("Namespace"); Expression e1 = Expression.Equal(sel1.Body, val1); Expression e2 = Expression.Equal(sel2.Body, val2); var andExp = Expression.AndAlso(e1, e2); ParameterExpression argParam = Expression.Parameter(typeof(string), "s"); var lambda = Expression.Lambda<Func<string, bool>>(andExp, argParam); This create the following output: s => ((s.Name == "Modules") AndAlso (s.Namespace == "Namespace")) However, this is faulty since the parameter for **Name** and **Namespace** isn't the same. If I change one of the expression selector to: Expression<Func<Service,string>> sel2 = srv => srv.Namespace; The output will be: s => ((s.Name == "Modules") AndAlso (srv.Namespace == "Namespace")) How can I create a valid expression with use of **sel1** and **sel2**?
c#
linq
expression-trees
linq-expressions
null
null
open
How do I dynamically create an Expression<Func<MyClass, bool>> predicate from Expression<Func<MyClass, string>>? === I trying to append where predicates and my goal is to create the same expression as: Services.Where(s => s.Name == "Modules" && s.Namespace == "Namespace"); I have the following code: Expression<Func<Service,string>> sel1 = s => s.Name; Expression<Func<Service,string>> sel2 = s => s.Namespace; var val1 = Expression.Constant("Modules"); var val2 = Expression.Constant("Namespace"); Expression e1 = Expression.Equal(sel1.Body, val1); Expression e2 = Expression.Equal(sel2.Body, val2); var andExp = Expression.AndAlso(e1, e2); ParameterExpression argParam = Expression.Parameter(typeof(string), "s"); var lambda = Expression.Lambda<Func<string, bool>>(andExp, argParam); This create the following output: s => ((s.Name == "Modules") AndAlso (s.Namespace == "Namespace")) However, this is faulty since the parameter for **Name** and **Namespace** isn't the same. If I change one of the expression selector to: Expression<Func<Service,string>> sel2 = srv => srv.Namespace; The output will be: s => ((s.Name == "Modules") AndAlso (srv.Namespace == "Namespace")) How can I create a valid expression with use of **sel1** and **sel2**?
0
8,653,720
12/28/2011 08:49:10
546,029
12/17/2010 12:06:41
380
5
Is it possible to pass a shipping address via SetExpressCheckout when using PayPal Checkout Express?
Just playing around with the PayPal API, trying to implement Checkout Express so I can accept credit cards, prioritizing those who don't have a paypal account hence I set `encoder["LANDINGPAGE"] = "Billing";`. In my application the user will be redirected to the PayPal site from the select payment option menu, hence they would have already entered their address into my shipping form, is there anyway to pass this address to PayPal when using CheckoutExpress ? I am trying in vain testing with the values below but it seems when user gets redirected the credit card details entry page on PayPal the address fields are blank. public string ECSetExpressCheckoutCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode) { NVPCallerServices caller = new NVPCallerServices(); IAPIProfile profile = ProfileFactory.createSignatureAPIProfile(); // Set up your API credentials, PayPal end point, API operation and version. profile.APIUsername = "seller_324454235454_biz_api1.isp.net.au"; profile.APIPassword = "135454354"; profile.APISignature = "An5ns1Kso7MWUSSDFggfdgdfGHHGDSddGnbHJgMVp-rU03jS"; profile.Environment="sandbox"; caller.APIProfile = profile; NVPCodec encoder = new NVPCodec(); encoder["VERSION"] = "51.0"; encoder["METHOD"] = "SetExpressCheckout"; // Add request-specific fields to the request. encoder["RETURNURL"] = returnURL; encoder["CANCELURL"] = cancelURL; encoder["AMT"] = amount; encoder["PAYMENTACTION"] = paymentType; encoder["CURRENCYCODE"] = currencyCode; encoder["LANDINGPAGE"] = "Billing"; encoder["PAYMENTREQUEST_0_SHIPTOSTREET"] = "345/3 Moomy St."; encoder["PAYMENTREQUEST_0_SHIPTOCITY"] = "Umpa Lumpa"; encoder["PAYMENTREQUEST_0_SHIPTONAME"] = "Johnny Walker"; encoder["PAYMENTREQUEST_0_SHIPTOSTATE"] = "NSW"; encoder["PAYMENTREQUEST_0_SHIPTOZIP"] = "2673"; encoder["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = "AU"; encoder["PAYMENTREQUEST_0_SHIPPINGAMT"] = "56.00"; encoder["NOSHIPPING"] = "0"; // Execute the API operation and obtain the response. string pStrrequestforNvp= encoder.Encode(); string pStresponsenvp=caller.Call(pStrrequestforNvp); NVPCodec decoder = new NVPCodec(); decoder.Decode(pStresponsenvp); string Response = decoder["ACK"] == "Success" ? decoder["TOKEN"]: "ERROR"; return Response; }
c#
asp.net
api
paypal
paypal-api
null
open
Is it possible to pass a shipping address via SetExpressCheckout when using PayPal Checkout Express? === Just playing around with the PayPal API, trying to implement Checkout Express so I can accept credit cards, prioritizing those who don't have a paypal account hence I set `encoder["LANDINGPAGE"] = "Billing";`. In my application the user will be redirected to the PayPal site from the select payment option menu, hence they would have already entered their address into my shipping form, is there anyway to pass this address to PayPal when using CheckoutExpress ? I am trying in vain testing with the values below but it seems when user gets redirected the credit card details entry page on PayPal the address fields are blank. public string ECSetExpressCheckoutCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode) { NVPCallerServices caller = new NVPCallerServices(); IAPIProfile profile = ProfileFactory.createSignatureAPIProfile(); // Set up your API credentials, PayPal end point, API operation and version. profile.APIUsername = "seller_324454235454_biz_api1.isp.net.au"; profile.APIPassword = "135454354"; profile.APISignature = "An5ns1Kso7MWUSSDFggfdgdfGHHGDSddGnbHJgMVp-rU03jS"; profile.Environment="sandbox"; caller.APIProfile = profile; NVPCodec encoder = new NVPCodec(); encoder["VERSION"] = "51.0"; encoder["METHOD"] = "SetExpressCheckout"; // Add request-specific fields to the request. encoder["RETURNURL"] = returnURL; encoder["CANCELURL"] = cancelURL; encoder["AMT"] = amount; encoder["PAYMENTACTION"] = paymentType; encoder["CURRENCYCODE"] = currencyCode; encoder["LANDINGPAGE"] = "Billing"; encoder["PAYMENTREQUEST_0_SHIPTOSTREET"] = "345/3 Moomy St."; encoder["PAYMENTREQUEST_0_SHIPTOCITY"] = "Umpa Lumpa"; encoder["PAYMENTREQUEST_0_SHIPTONAME"] = "Johnny Walker"; encoder["PAYMENTREQUEST_0_SHIPTOSTATE"] = "NSW"; encoder["PAYMENTREQUEST_0_SHIPTOZIP"] = "2673"; encoder["PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE"] = "AU"; encoder["PAYMENTREQUEST_0_SHIPPINGAMT"] = "56.00"; encoder["NOSHIPPING"] = "0"; // Execute the API operation and obtain the response. string pStrrequestforNvp= encoder.Encode(); string pStresponsenvp=caller.Call(pStrrequestforNvp); NVPCodec decoder = new NVPCodec(); decoder.Decode(pStresponsenvp); string Response = decoder["ACK"] == "Success" ? decoder["TOKEN"]: "ERROR"; return Response; }
0
540,030
02/12/2009 04:32:13
5,830
09/11/2008 13:33:14
130
7
What is the best way to meditate to increase programming productivity?
Recently, I've added regular exercise to my life. It has given me more overall energy and I have been more productive at work. However, I have also heard that meditation can help you be more focused, and, consequently, more productive. There is a lot of different advice out there, but it is difficult to tell which route go: music, silence, brain-wave sounds, eyes open, eyes closed, seated, laying down, kata. What has worked for you?
productivity
null
null
null
null
11/30/2011 03:20:05
off topic
What is the best way to meditate to increase programming productivity? === Recently, I've added regular exercise to my life. It has given me more overall energy and I have been more productive at work. However, I have also heard that meditation can help you be more focused, and, consequently, more productive. There is a lot of different advice out there, but it is difficult to tell which route go: music, silence, brain-wave sounds, eyes open, eyes closed, seated, laying down, kata. What has worked for you?
2
2,967,584
06/03/2010 15:49:33
23,524
09/29/2008 17:05:10
2,577
51
Machine leaning algorithm for data classification.
I'm looking for some guidance about which techniques/algorithms I should research to solve the following problem. I've currently got an algorithm that clusters similar-sounding mp3s using acoustic fingerprinting. In each cluster, I have all the different metadata (song/artist/album) for each file. For that cluster, I'd like to pick the "best" song/artist/album metadata that matches an existing row in my database, or if there is no best match, decide to insert a new row. For a cluster, there is generally some correct metadata, but individual files have many types of problems: - Artist/songs are completely misnamed, or just slightly mispelled - the artist/song/album is missing, but the rest of the information is there - the song is actually a live recording, but only some of the files in the cluster are labeled as such. - there may be very little metadata, in some cases just the file name, which might be artist - song.mp3, or artist - album - song.mp3, or another variation A simple voting algorithm works fairly well, but I'd like to have something I can train on a large set of data that might pick up more nuances than what I've got right now. Any links to papers or similar projects would be greatly appreciated. Thanks!
machine-learning
classification
null
null
null
07/16/2012 18:22:50
not constructive
Machine leaning algorithm for data classification. === I'm looking for some guidance about which techniques/algorithms I should research to solve the following problem. I've currently got an algorithm that clusters similar-sounding mp3s using acoustic fingerprinting. In each cluster, I have all the different metadata (song/artist/album) for each file. For that cluster, I'd like to pick the "best" song/artist/album metadata that matches an existing row in my database, or if there is no best match, decide to insert a new row. For a cluster, there is generally some correct metadata, but individual files have many types of problems: - Artist/songs are completely misnamed, or just slightly mispelled - the artist/song/album is missing, but the rest of the information is there - the song is actually a live recording, but only some of the files in the cluster are labeled as such. - there may be very little metadata, in some cases just the file name, which might be artist - song.mp3, or artist - album - song.mp3, or another variation A simple voting algorithm works fairly well, but I'd like to have something I can train on a large set of data that might pick up more nuances than what I've got right now. Any links to papers or similar projects would be greatly appreciated. Thanks!
4
9,692,988
03/13/2012 22:11:00
146,633
07/28/2009 19:24:32
450
9
Open secound window how in Objective-C
I try to do somthink Objectiv-C but i can't find out of how i can open a secound window and close my window i use right now. i need it for Customer Login GUI, i have got the domain and password now, i need now to find out of how i can close my window and open a secound window. hobe i can be helping here. if i can open a window from my XIB file, its will be nice, but im not sure how, i use standart project whit "MainMenu.xib" file. my login code its - (IBAction) login:(id)sender { NSLog(@"Password: %@ and Domain: %@",inputPassword.stringValue,inputDomain.stringValue); } so its not woow code here, but still i need to open a secound window :)
objective-c
window
null
null
null
03/14/2012 00:22:57
not constructive
Open secound window how in Objective-C === I try to do somthink Objectiv-C but i can't find out of how i can open a secound window and close my window i use right now. i need it for Customer Login GUI, i have got the domain and password now, i need now to find out of how i can close my window and open a secound window. hobe i can be helping here. if i can open a window from my XIB file, its will be nice, but im not sure how, i use standart project whit "MainMenu.xib" file. my login code its - (IBAction) login:(id)sender { NSLog(@"Password: %@ and Domain: %@",inputPassword.stringValue,inputDomain.stringValue); } so its not woow code here, but still i need to open a secound window :)
4
1,603,040
10/21/2009 19:25:17
83,741
03/27/2009 18:11:34
363
27
Long-running transactions structured approach
I'm looking for a structured approach to long-running (hours or more) transactions. As mentioned [here][1], these type of interactions are usually handled by optimistic locking and manual merge strategies. It would be very handy to have some more structured approach to this type of problem using standard transactions. Various long-running interactions such as user registration, order confirmation etc. all have transaction-like semantics, and it is both error-prone and tedious to invent your own fragile manual roll-back and/or time-out/clean-up strategies. Taking a RDBMS as an example, I realize that it would be a major performance cost associated with keeping all the transactions open. As an alternative, I could imagine having a database supporting two isolation levels/strategies simultaneously, one for short-running and one for long-running conversations. Long-running conversations could then for instance have more strict limitations on data access to facilitate them taking more time (read-only semantics on some data, optimistic locking semantics etc). Are there any solutions which could do something similar? [1]: http://stackoverflow.com/questions/1425742/best-way-to-manage-transactions "here"
conversation
transactions
long-running
xa
null
04/05/2012 14:27:54
not a real question
Long-running transactions structured approach === I'm looking for a structured approach to long-running (hours or more) transactions. As mentioned [here][1], these type of interactions are usually handled by optimistic locking and manual merge strategies. It would be very handy to have some more structured approach to this type of problem using standard transactions. Various long-running interactions such as user registration, order confirmation etc. all have transaction-like semantics, and it is both error-prone and tedious to invent your own fragile manual roll-back and/or time-out/clean-up strategies. Taking a RDBMS as an example, I realize that it would be a major performance cost associated with keeping all the transactions open. As an alternative, I could imagine having a database supporting two isolation levels/strategies simultaneously, one for short-running and one for long-running conversations. Long-running conversations could then for instance have more strict limitations on data access to facilitate them taking more time (read-only semantics on some data, optimistic locking semantics etc). Are there any solutions which could do something similar? [1]: http://stackoverflow.com/questions/1425742/best-way-to-manage-transactions "here"
1
11,155,476
06/22/2012 11:39:26
1,474,654
06/22/2012 11:25:12
1
0
PHP removing decimal from a special situation
$online = mysql_num_rows($countonline); echo "<br>&nbsp;&nbsp;&nbsp;<b>Something:<font color='blue'></b> ".$online*2; I want to write *1.5 but get a result without decimals as I need it to be as accurate as possible and 2* would be lying as the online counter is more close to 1.5* all the time. As the online variable isn't stable and is a different value almost all the time, I would like to know how to use round correctly with what used above. Thank you.
php
remove
decimal
float
round
06/22/2012 23:13:07
too localized
PHP removing decimal from a special situation === $online = mysql_num_rows($countonline); echo "<br>&nbsp;&nbsp;&nbsp;<b>Something:<font color='blue'></b> ".$online*2; I want to write *1.5 but get a result without decimals as I need it to be as accurate as possible and 2* would be lying as the online counter is more close to 1.5* all the time. As the online variable isn't stable and is a different value almost all the time, I would like to know how to use round correctly with what used above. Thank you.
3
11,507,334
07/16/2012 15:19:44
284,758
03/02/2010 20:52:18
4,385
229
Multi-File Assembly for ASP.NET (MVC) Project
I want to adjust my MVC project, so that I can [build a multi-file assembly][1]. My intent, as a proof of concept, is to make the root web.config a part of the MVC assembly. The rationale for doing so, would be to prevent tampering with the web.config file. The presumed "I must modify" section of the MVC project is here: <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> </Target> I don't recall how I can "influence" the imports. For example, is there a property I can set to make the `csc` build step produce modules instead of assemblies? And even if I achieved that, I need a list (viz. itemGroup) of the resulting module(s), so that I can feed that into the linker (either "csc /out" or "al /out /target"). Anyone done this before? Pointers? [1]: http://msdn.microsoft.com/en-us/library/226t7yxe.aspx
asp.net
.net
asp.net-mvc
visual-studio-2010
msbuild
null
open
Multi-File Assembly for ASP.NET (MVC) Project === I want to adjust my MVC project, so that I can [build a multi-file assembly][1]. My intent, as a proof of concept, is to make the root web.config a part of the MVC assembly. The rationale for doing so, would be to prevent tampering with the web.config file. The presumed "I must modify" section of the MVC project is here: <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'"> <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" /> </Target> I don't recall how I can "influence" the imports. For example, is there a property I can set to make the `csc` build step produce modules instead of assemblies? And even if I achieved that, I need a list (viz. itemGroup) of the resulting module(s), so that I can feed that into the linker (either "csc /out" or "al /out /target"). Anyone done this before? Pointers? [1]: http://msdn.microsoft.com/en-us/library/226t7yxe.aspx
0
8,945,244
01/20/2012 17:14:41
101,954
05/06/2009 01:31:59
805
18
Play counter example to Lift for statefulness
In Chris Hagan's [answer regarding Lift vs Play][1] he states that Lift's statefulness does actually make it easier to code, giving this example for Lift: private def inviteUser(group:Group) = { a(() =>{ SpamServer ! Spam( self=> List( Text("Who would you like to invite?"), UserInformation.findAll.map(user=> a(()=>{ self.done GroupServer ! GroupInvite(currentUser.is,user.name.is,group.name) Call("pendingInvitation",user.name.is) }, <div>{user.name}</div>))),true) Call("buildingUserlist") }, Text("Invite")) } I am looking for the Play counter example to Chris Hagan's Lift example using the same application fragment in order to simplify the process of understanding the difference between Lift and Play in handling statefulness. [1]: http://stackoverflow.com/a/8469087/101954
scala
playframework
lift
stateful
null
null
open
Play counter example to Lift for statefulness === In Chris Hagan's [answer regarding Lift vs Play][1] he states that Lift's statefulness does actually make it easier to code, giving this example for Lift: private def inviteUser(group:Group) = { a(() =>{ SpamServer ! Spam( self=> List( Text("Who would you like to invite?"), UserInformation.findAll.map(user=> a(()=>{ self.done GroupServer ! GroupInvite(currentUser.is,user.name.is,group.name) Call("pendingInvitation",user.name.is) }, <div>{user.name}</div>))),true) Call("buildingUserlist") }, Text("Invite")) } I am looking for the Play counter example to Chris Hagan's Lift example using the same application fragment in order to simplify the process of understanding the difference between Lift and Play in handling statefulness. [1]: http://stackoverflow.com/a/8469087/101954
0
5,836,950
04/29/2011 20:15:42
724,047
04/25/2011 17:02:13
25
0
SQL Query date range
Working from an oracle 10g environment. Suppose you were given: *NOTE (Duration is in Weeks) CLASSNAME INSTURCTOR DAYS STARTDATE *DURATION TIMESTART TIMEEND ------------------------- ----------------------- ------------- --------- -------- -------- Power Dance Robert Backman MWF 03-MAR-11 2 0930 1100 Power Dance Lynn Parker MWF 03-MAY-11 2 0930 1100 Power Dance Lynn Parker MTTh 18-MAY-11 2 1230 0100 Club Stretch Kevin Lopez MT 24-OCT-11 3 1930 2015 Club Stretch Kevin Lopez F 17-JUN-11 3 1130 1300 Hatha Yoga Susan Wanzer MW 25-MAY-11 3 1900 2000 A user wants to be able to query the Classname, Instructor, Timestart, and TimeEnd for a class given a specific date. I understand how to find the EndDate using (Duration * 7) + StartDate. The trouble I am having is finding out which classes are running on a day of the week. As in say the user enters in 24-JUN-11, the only class that should show up should be Club Stretch.
sql
query
date
oracle10g
null
null
open
SQL Query date range === Working from an oracle 10g environment. Suppose you were given: *NOTE (Duration is in Weeks) CLASSNAME INSTURCTOR DAYS STARTDATE *DURATION TIMESTART TIMEEND ------------------------- ----------------------- ------------- --------- -------- -------- Power Dance Robert Backman MWF 03-MAR-11 2 0930 1100 Power Dance Lynn Parker MWF 03-MAY-11 2 0930 1100 Power Dance Lynn Parker MTTh 18-MAY-11 2 1230 0100 Club Stretch Kevin Lopez MT 24-OCT-11 3 1930 2015 Club Stretch Kevin Lopez F 17-JUN-11 3 1130 1300 Hatha Yoga Susan Wanzer MW 25-MAY-11 3 1900 2000 A user wants to be able to query the Classname, Instructor, Timestart, and TimeEnd for a class given a specific date. I understand how to find the EndDate using (Duration * 7) + StartDate. The trouble I am having is finding out which classes are running on a day of the week. As in say the user enters in 24-JUN-11, the only class that should show up should be Club Stretch.
0
4,872,107
02/02/2011 08:15:26
598,487
02/01/2011 14:03:36
8
0
Samsung Galaxy Tab size on run time
How to get Samsung Galaxy Tab size on run time? If I use //Code Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = display.getWidth(); It gives 320*480 size. But its not the tab size. Is there any other way to get the tab size in runtime?. Thanks, Yuvaraj.K
android
null
null
null
null
null
open
Samsung Galaxy Tab size on run time === How to get Samsung Galaxy Tab size on run time? If I use //Code Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = display.getWidth(); It gives 320*480 size. But its not the tab size. Is there any other way to get the tab size in runtime?. Thanks, Yuvaraj.K
0
10,533,397
05/10/2012 11:52:40
1,380,169
05/07/2012 16:03:02
1
1
Problems with starting a GWT project in development and host modes
I have created a small project with GWT 2.4, Spring 3.0, Maven 2. When I try to start the project in development mode, I get the following error message: Missing required argument 'module[s]' Google Web Toolkit 2.4.0 ... module[s] Specifies the name(s) of the module(s) to host When I start it in the host mode, I am able to open the html page that was defined as a welcome page but the gwt part does not appear in the page. gwtEvaluation.gwt.xml: <?xml version="1.0" encoding="UTF-8"?> <module rename-to="evaluation"> <inherits name="com.google.gwt.user.User" /> <inherits name="com.google.gwt.user.theme.standard.Standard" /> <entry-point class="de.idealo.evaluation.gwt.webapp.client.GwtEvaluation" /> <source path="client" /> <source path="shared" /> </module> GwtEvaluation.java: public class GwtEvaluation implements EntryPoint { private VerticalPanel mainPanel = new VerticalPanel(); private FlexTable stocksFlexTable = new FlexTable(); private HorizontalPanel addPanel = new HorizontalPanel(); private TextBox newSymbolTextBox = new TextBox(); private Button addStockButton = new Button("Add"); private Label lastUpdatedLabel = new Label(); @Override public void onModuleLoad() { // Create table for stock data. stocksFlexTable.setText(0, 0, "Symbol"); stocksFlexTable.setText(0, 1, "Price"); stocksFlexTable.setText(0, 2, "Change"); stocksFlexTable.setText(0, 3, "Remove"); // Assemble Add Stock panel. addPanel.add(newSymbolTextBox); addPanel.add(addStockButton); // Assemble Main panel. mainPanel.add(stocksFlexTable); mainPanel.add(addPanel); mainPanel.add(lastUpdatedLabel); // Associate the Main panel with the HTML host page. RootPanel.get("stockList").add(mainPanel); // Move cursor focus to the input box. newSymbolTextBox.setFocus(true); } } gwtEvaluation.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>GWT evaluation project</title> <script type="text/javascript" language="javascript" src="gwtEvaluation/gwtEvaluation.nocache.js"> </script> </head> <body> <h1>GWT evaluation project</h1> <div id="gwtEvaluation"></div> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> <noscript> <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"> Your web browser must have JavaScript enabled in order for this application to display correctly. </div> </noscript> </body> </html> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Evaluation of Google Web Toolkit</display-name> <servlet> <servlet-name>gwtEvaluation</servlet-name> <servlet-class>de.idealo.evaluation.gwt.webapp.server.ShopViewServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>gwtEvaluation</servlet-name> <url-pattern>/gwtEvaluation/shops</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>gwtEvaluation.html</welcome-file> </welcome-file-list> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> </web-app> The project name is "gwt-evaluation". What might be the problem?
gwt
maven-2
spring-3
gwt-2.4
null
05/11/2012 14:50:07
too localized
Problems with starting a GWT project in development and host modes === I have created a small project with GWT 2.4, Spring 3.0, Maven 2. When I try to start the project in development mode, I get the following error message: Missing required argument 'module[s]' Google Web Toolkit 2.4.0 ... module[s] Specifies the name(s) of the module(s) to host When I start it in the host mode, I am able to open the html page that was defined as a welcome page but the gwt part does not appear in the page. gwtEvaluation.gwt.xml: <?xml version="1.0" encoding="UTF-8"?> <module rename-to="evaluation"> <inherits name="com.google.gwt.user.User" /> <inherits name="com.google.gwt.user.theme.standard.Standard" /> <entry-point class="de.idealo.evaluation.gwt.webapp.client.GwtEvaluation" /> <source path="client" /> <source path="shared" /> </module> GwtEvaluation.java: public class GwtEvaluation implements EntryPoint { private VerticalPanel mainPanel = new VerticalPanel(); private FlexTable stocksFlexTable = new FlexTable(); private HorizontalPanel addPanel = new HorizontalPanel(); private TextBox newSymbolTextBox = new TextBox(); private Button addStockButton = new Button("Add"); private Label lastUpdatedLabel = new Label(); @Override public void onModuleLoad() { // Create table for stock data. stocksFlexTable.setText(0, 0, "Symbol"); stocksFlexTable.setText(0, 1, "Price"); stocksFlexTable.setText(0, 2, "Change"); stocksFlexTable.setText(0, 3, "Remove"); // Assemble Add Stock panel. addPanel.add(newSymbolTextBox); addPanel.add(addStockButton); // Assemble Main panel. mainPanel.add(stocksFlexTable); mainPanel.add(addPanel); mainPanel.add(lastUpdatedLabel); // Associate the Main panel with the HTML host page. RootPanel.get("stockList").add(mainPanel); // Move cursor focus to the input box. newSymbolTextBox.setFocus(true); } } gwtEvaluation.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>GWT evaluation project</title> <script type="text/javascript" language="javascript" src="gwtEvaluation/gwtEvaluation.nocache.js"> </script> </head> <body> <h1>GWT evaluation project</h1> <div id="gwtEvaluation"></div> <iframe src="javascript:''" id="__gwt_historyFrame" tabIndex='-1' style="position:absolute;width:0;height:0;border:0"></iframe> <noscript> <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif"> Your web browser must have JavaScript enabled in order for this application to display correctly. </div> </noscript> </body> </html> web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <display-name>Evaluation of Google Web Toolkit</display-name> <servlet> <servlet-name>gwtEvaluation</servlet-name> <servlet-class>de.idealo.evaluation.gwt.webapp.server.ShopViewServiceImpl</servlet-class> </servlet> <servlet-mapping> <servlet-name>gwtEvaluation</servlet-name> <url-pattern>/gwtEvaluation/shops</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>gwtEvaluation.html</welcome-file> </welcome-file-list> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class> </listener> </web-app> The project name is "gwt-evaluation". What might be the problem?
3
8,544,214
12/17/2011 10:53:03
1,103,321
12/17/2011 10:04:09
1
0
fetch teacher and subject wise details in mysql and php
***table tution*** **institute | teacher | subject | students** -------------------------------------------- institute1 | john | maths | mary institute1 | john | maths | stacy institute2 | john | maths | david institute2 | john | science | bruce institute1 | tim | maths | steve institute2 | tim | science | harry institute1 | john | science | peter each teacher in each subject should have limited students, suppose 25 students should be present for each subject in class. So, here I request a sql query to fetch the details of each teacher in a searched institute and their subject strength where institute is equal to searched institue. Show only that teacher details which is not having strength of 25 students in each subject where institue is equal to searched institute.
php
mysql
null
null
null
null
open
fetch teacher and subject wise details in mysql and php === ***table tution*** **institute | teacher | subject | students** -------------------------------------------- institute1 | john | maths | mary institute1 | john | maths | stacy institute2 | john | maths | david institute2 | john | science | bruce institute1 | tim | maths | steve institute2 | tim | science | harry institute1 | john | science | peter each teacher in each subject should have limited students, suppose 25 students should be present for each subject in class. So, here I request a sql query to fetch the details of each teacher in a searched institute and their subject strength where institute is equal to searched institue. Show only that teacher details which is not having strength of 25 students in each subject where institue is equal to searched institute.
0
2,122,943
01/23/2010 11:18:07
257,366
01/23/2010 11:18:07
1
0
connection smart device with sql in asp.net
how to connect smart device with sql database in asp.net c#?
connection-string
null
null
null
null
01/24/2010 21:21:35
not a real question
connection smart device with sql in asp.net === how to connect smart device with sql database in asp.net c#?
1
10,176,957
04/16/2012 15:21:28
1,255,188
03/07/2012 16:25:37
59
0
access Oracle sql server remotely
Ok, so I started working on my machine locally but I still need to access the database on the remote server. I was using this... > DriverManager.registerDriver(new OracleDriver()); > conn = DriverManager.getConnection("jdbc:oracle:thin:@dukeorrac01:1521:ORDB1","nrsc","nrsc"); But that doesn't seem to be accessing a remote server. I assume I need some sort of IP address in there somewhere. I realize I should use a datasource but I didn't set all this up and I don't have time to learn how to implement that (will do that after this project). How do I access that remotely? P.S. I'm using jboss as my locally running server.
sql
database
oracle
jboss
null
null
open
access Oracle sql server remotely === Ok, so I started working on my machine locally but I still need to access the database on the remote server. I was using this... > DriverManager.registerDriver(new OracleDriver()); > conn = DriverManager.getConnection("jdbc:oracle:thin:@dukeorrac01:1521:ORDB1","nrsc","nrsc"); But that doesn't seem to be accessing a remote server. I assume I need some sort of IP address in there somewhere. I realize I should use a datasource but I didn't set all this up and I don't have time to learn how to implement that (will do that after this project). How do I access that remotely? P.S. I'm using jboss as my locally running server.
0
8,282,395
11/26/2011 23:21:08
242,104
01/02/2010 00:39:13
371
10
How to pass object between views with a storyboard Created Tab Bar Controller
I have 2 views controlled by a tab bar view controller created by the template Xcode 4 gives out using the storyboard. My first view on the first tab is a data entry page, my second view on the second tab graphs this data. I have an object where the first view stores this data. How do I not only pass this object to my second view but also ensure it gets updated when someone changes one of the UITextfields on the first view? Many thanks
iphone
ios
ios5
null
null
null
open
How to pass object between views with a storyboard Created Tab Bar Controller === I have 2 views controlled by a tab bar view controller created by the template Xcode 4 gives out using the storyboard. My first view on the first tab is a data entry page, my second view on the second tab graphs this data. I have an object where the first view stores this data. How do I not only pass this object to my second view but also ensure it gets updated when someone changes one of the UITextfields on the first view? Many thanks
0
11,319,046
07/03/2012 20:56:27
131,270
06/30/2009 19:01:01
1,221
12
Is there a way to partition entity framework EMDX's?
With a large model, it would be really useful to have multiple entity framework designer surfaces that address a particular domain (authetication, customFeature1, customFeature2, etc) and have those EDMX's reference entities in other EMDX's. Is there a way to work with a paradigm similar to what you get with SQL Management Studio diagrams?
entity-framework
entity-framework-4.3
edmx
edmx-designer
null
null
open
Is there a way to partition entity framework EMDX's? === With a large model, it would be really useful to have multiple entity framework designer surfaces that address a particular domain (authetication, customFeature1, customFeature2, etc) and have those EDMX's reference entities in other EMDX's. Is there a way to work with a paradigm similar to what you get with SQL Management Studio diagrams?
0
1,805,306
11/26/2009 19:25:50
219,647
11/26/2009 19:25:50
1
0
Which language to choose Java or PHP from job perspective for a n00b?
Background: Graduated from a college program of 3 years in computer science. Work experience: 8 months working on LAMP Question: I am a n00b at programming. I still have to have a complete grip over one language. I was wondering which language should I choose, PHP or Java? I am looking at these languages from job prospective. I have read various market trends on popular websites. Java is definitely ahead in job market. However I don't see jobs for java programmer at junior level. Most are for senior positions. Php on the other hand, has many job openings for entry level programmers. I don't know why but I am staying away from microsoft technologies. Please help me decide. I am in based in Toronto, Canada. Thanks Neochap
programming-language
php
null
null
null
11/27/2009 00:13:54
not constructive
Which language to choose Java or PHP from job perspective for a n00b? === Background: Graduated from a college program of 3 years in computer science. Work experience: 8 months working on LAMP Question: I am a n00b at programming. I still have to have a complete grip over one language. I was wondering which language should I choose, PHP or Java? I am looking at these languages from job prospective. I have read various market trends on popular websites. Java is definitely ahead in job market. However I don't see jobs for java programmer at junior level. Most are for senior positions. Php on the other hand, has many job openings for entry level programmers. I don't know why but I am staying away from microsoft technologies. Please help me decide. I am in based in Toronto, Canada. Thanks Neochap
4
7,531,853
09/23/2011 16:07:18
661,078
03/15/2011 17:22:23
362
3
Encrypt Data in one "slot" in database
I read over a great tutorial on how to encrypt the data using a symmetrical key in one column. [Click here to view it.][1] [1]: http://dotnetslackers.com/articles/sql/IntroductionToSQLServerEncryptionAndSymmetricKeyEncryptionTutorial.aspx This has helped me set up a column for encryption, which is what I need. My problem is that I will constantly be updating rows in my database - so copying over one whole original column to the encrypted columm like the tutorial shows doesn't work. Is there a way that I can insert a value that is given to me (using C#/asp) and direclty encrypt it as I insert it into the database, rather than having to place it in one column and copying it over, and then dropping the other column?
c#
asp.net
sql-server-2005
encryption
insert
null
open
Encrypt Data in one "slot" in database === I read over a great tutorial on how to encrypt the data using a symmetrical key in one column. [Click here to view it.][1] [1]: http://dotnetslackers.com/articles/sql/IntroductionToSQLServerEncryptionAndSymmetricKeyEncryptionTutorial.aspx This has helped me set up a column for encryption, which is what I need. My problem is that I will constantly be updating rows in my database - so copying over one whole original column to the encrypted columm like the tutorial shows doesn't work. Is there a way that I can insert a value that is given to me (using C#/asp) and direclty encrypt it as I insert it into the database, rather than having to place it in one column and copying it over, and then dropping the other column?
0
9,409,402
02/23/2012 08:25:06
1,190,317
02/05/2012 07:19:21
26
1
How to make DotNetNuke Captcha control to show an error if it left blanke
I took a captcha control on my page : <dnn:CaptchaControl ID="CaptchaControl1" runat="server" CaptchaHeight="50px" CaptchaWidth="150px" ErrorMessage="incorrect" /> if captcha is incorrect the error message will be shown but if it left blank it shows no error.is there any way to make it show an error when it is blank? thanks
dotnetnuke
captcha
null
null
null
null
open
How to make DotNetNuke Captcha control to show an error if it left blanke === I took a captcha control on my page : <dnn:CaptchaControl ID="CaptchaControl1" runat="server" CaptchaHeight="50px" CaptchaWidth="150px" ErrorMessage="incorrect" /> if captcha is incorrect the error message will be shown but if it left blank it shows no error.is there any way to make it show an error when it is blank? thanks
0
6,962,600
08/05/2011 21:00:43
280,574
02/24/2010 18:12:01
56
7
load jars from runtime and execute code in them
I have a java console app that I'm writing, and I want people to be able to write plugins for it and then to distribute those plugins as jars. I want users to be able to drop a plugin (jar) into a "plugins" folder, restart the app, and have the plugin loaded and running. I don't want the user to have to specify a class/method to execute for the plugin or anything like that. I can load the jars with a wildcard classpath to the "plugins" directory, but I need some way for those plugins to register themselves with the application by running a "register()" method that each plugin will need to define somewhere. How can the plugin (jar) specify where(package and class) it's "register()" method is defined so my app will know to call it? I realize that OSGi can accomplish this, but this is a fairly small application and I would prefer not to use OSGi if a simpler solution exists. Background: These plugins register events from the app that they want to handle. The user will be able to disable the handling of specific events on a per plugin basis, so the configuration for these plugins will be stored in the app's database. When a plugin registers itself, the app will check the database to see if a configuration exists for that plugin, and if not it will create a new default configuration for it in the database.
java
null
null
null
null
null
open
load jars from runtime and execute code in them === I have a java console app that I'm writing, and I want people to be able to write plugins for it and then to distribute those plugins as jars. I want users to be able to drop a plugin (jar) into a "plugins" folder, restart the app, and have the plugin loaded and running. I don't want the user to have to specify a class/method to execute for the plugin or anything like that. I can load the jars with a wildcard classpath to the "plugins" directory, but I need some way for those plugins to register themselves with the application by running a "register()" method that each plugin will need to define somewhere. How can the plugin (jar) specify where(package and class) it's "register()" method is defined so my app will know to call it? I realize that OSGi can accomplish this, but this is a fairly small application and I would prefer not to use OSGi if a simpler solution exists. Background: These plugins register events from the app that they want to handle. The user will be able to disable the handling of specific events on a per plugin basis, so the configuration for these plugins will be stored in the app's database. When a plugin registers itself, the app will check the database to see if a configuration exists for that plugin, and if not it will create a new default configuration for it in the database.
0
6,743,328
07/19/2011 06:57:24
843,932
07/14/2011 05:50:16
11
1
Protocol used for downloading file from file server.
Which protocol can be used when downloading a file from a File server? Is it FTP or any other like HTTP?
http
ftp
null
null
null
07/19/2011 08:23:24
not a real question
Protocol used for downloading file from file server. === Which protocol can be used when downloading a file from a File server? Is it FTP or any other like HTTP?
1
1,087,537
07/06/2009 15:11:45
23,339
09/29/2008 04:41:02
736
37
Remove border on activex ie control
For the application im building, i use an activex ie control. It works greate but i cant work out how to remove the border around it. I have tried overriding the invoke call and setting DISPID_BORDERSTYLE to zero but it looks like it never gets hit. Any ideas?
visual-studio-2008
wxwidgets
activex
windows
c++
null
open
Remove border on activex ie control === For the application im building, i use an activex ie control. It works greate but i cant work out how to remove the border around it. I have tried overriding the invoke call and setting DISPID_BORDERSTYLE to zero but it looks like it never gets hit. Any ideas?
0
7,038,215
08/12/2011 09:34:01
568,975
01/09/2011 17:35:13
316
1
Is it possible to read big xlsx files in PHP?
I have big xlsx file (16 000 rows and 14 columns), I tried to use PHPExcel to read it, but I got error: `Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 58 bytes) in Z:\home\xlsx.qqq\www\PHPExcel\Classes\PHPExcel\Worksheet.php on line 961`. Is it possible to read big xlsx file in php without such errors? Thanx!
php
excel
php5
xlsx
null
08/12/2011 10:31:52
not a real question
Is it possible to read big xlsx files in PHP? === I have big xlsx file (16 000 rows and 14 columns), I tried to use PHPExcel to read it, but I got error: `Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 58 bytes) in Z:\home\xlsx.qqq\www\PHPExcel\Classes\PHPExcel\Worksheet.php on line 961`. Is it possible to read big xlsx file in php without such errors? Thanx!
1
9,903,912
03/28/2012 08:39:37
527,505
12/02/2010 04:30:11
173
3
Override colorbox onClose
I am using the following which works great. I am just wondering if it would be possible to override the onClosed after the box is loaded $.colorbox({href:"fff.html", onClosed:function(){ reload(true); } }); I know that I can use the resize function after the box is loaded to resize the dimensions. Would it be possible to use the close functions similarly to accomplish my goal?
javascript
jquery
colorbox
null
null
null
open
Override colorbox onClose === I am using the following which works great. I am just wondering if it would be possible to override the onClosed after the box is loaded $.colorbox({href:"fff.html", onClosed:function(){ reload(true); } }); I know that I can use the resize function after the box is loaded to resize the dimensions. Would it be possible to use the close functions similarly to accomplish my goal?
0
2,450,515
03/15/2010 21:10:48
14,841
09/17/2008 03:21:22
637
47
F# operator over-loading question
The following code fails in 'Evaluate' with: "This expression was expected to have type Complex but here has type double list" Am I breaking some rule on operator over-loading on '(+)'? Things are OK if I change '(+)' to 'Add'. open Microsoft.FSharp.Math /// real power series [kn; ...; k0] => kn*S^n + ... + k0*S^0 type Powers = double List let (+) (ls:Powers) (rs:Powers) = let rec AddReversed (ls:Powers) (rs:Powers) = match ( ls, rs ) with | ( l::ltail, r::rtail ) -> ( l + r ) :: AddReversed ltail rtail | ([], _) -> rs | (_, []) -> ls ( AddReversed ( ls |> List.rev ) ( rs |> List.rev) ) |> List.rev let Evaluate (ks:Powers) ( value:Complex ) = ks |> List.fold (fun (acc:Complex) (k:double)-> acc * value + Complex.Create(k, 0.0) ) Complex.Zero
f#
operator-overloading
null
null
null
null
open
F# operator over-loading question === The following code fails in 'Evaluate' with: "This expression was expected to have type Complex but here has type double list" Am I breaking some rule on operator over-loading on '(+)'? Things are OK if I change '(+)' to 'Add'. open Microsoft.FSharp.Math /// real power series [kn; ...; k0] => kn*S^n + ... + k0*S^0 type Powers = double List let (+) (ls:Powers) (rs:Powers) = let rec AddReversed (ls:Powers) (rs:Powers) = match ( ls, rs ) with | ( l::ltail, r::rtail ) -> ( l + r ) :: AddReversed ltail rtail | ([], _) -> rs | (_, []) -> ls ( AddReversed ( ls |> List.rev ) ( rs |> List.rev) ) |> List.rev let Evaluate (ks:Powers) ( value:Complex ) = ks |> List.fold (fun (acc:Complex) (k:double)-> acc * value + Complex.Create(k, 0.0) ) Complex.Zero
0
7,574,231
09/27/2011 18:53:07
322,513
04/21/2010 16:49:19
159
1
OCaml: applied to too many arguments
Why the code if some_bool_var then begin output_string some_file "some string"; (* <--- error here *) end generates "applied to too many arguments" error. But if I change it to if some_bool_var then output_string some_file "some string"; it compiles fine. Why is it so? Thank you.
ocaml
null
null
null
null
null
open
OCaml: applied to too many arguments === Why the code if some_bool_var then begin output_string some_file "some string"; (* <--- error here *) end generates "applied to too many arguments" error. But if I change it to if some_bool_var then output_string some_file "some string"; it compiles fine. Why is it so? Thank you.
0
9,197,047
02/08/2012 16:09:06
442,695
09/08/2010 17:46:31
1,400
67
iOS: Use IB to create custom cell for programmatically created UITableView
I have a view controller where I programmatically add the UITableView. However, I would like to use IB to create my custom UITableViewCell to be used in my programmatically create UITableView. How would I do this if I don't have a UITableView in the controller in IB since I create it programmatically? I'm using Xcode 4.2.1 with storyboards.
iphone
uitableview
uitableviewcell
ios5
xcode4.2
null
open
iOS: Use IB to create custom cell for programmatically created UITableView === I have a view controller where I programmatically add the UITableView. However, I would like to use IB to create my custom UITableViewCell to be used in my programmatically create UITableView. How would I do this if I don't have a UITableView in the controller in IB since I create it programmatically? I'm using Xcode 4.2.1 with storyboards.
0
10,807,803
05/29/2012 22:47:33
1,296,361
03/27/2012 17:37:59
28
0
FrameLayout image shrinks
i'm working on an app, it loads the photo from the gallery( the photo is taken from device camera), and do other app relevant features and save, the problem i'm facing is that the image which loads compress vertically and horizontally which makes the image shrink, which is not required i'm using the following code for xml file <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="bottom" android:orientation="vertical" > <FrameLayout android:id="@+id/frame" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/previous_btn" android:layout_weight="0.88" > <ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="match_parent" android:scaleType="matrix" /> </FrameLayout> <Button android:id="@+id/previous_btn" android:layout_width="100dip" android:layout_height="wrap_content" android:text="Previous" /> <Button android:id="@+id/next_btn" android:layout_width="100dip" android:layout_height="wrap_content" android:layout_toRightOf="@+id/previous_btn" android:text="Next" /> <Button android:id="@+id/button" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_toRightOf="@+id/next_btn" android:text="Save Picture" /> </RelativeLayout> Help me please to solve this issue!!! Best regards
android
compression
size
framelayout
null
null
open
FrameLayout image shrinks === i'm working on an app, it loads the photo from the gallery( the photo is taken from device camera), and do other app relevant features and save, the problem i'm facing is that the image which loads compress vertically and horizontally which makes the image shrink, which is not required i'm using the following code for xml file <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="bottom" android:orientation="vertical" > <FrameLayout android:id="@+id/frame" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/previous_btn" android:layout_weight="0.88" > <ImageView android:id="@+id/imageView" android:layout_width="fill_parent" android:layout_height="match_parent" android:scaleType="matrix" /> </FrameLayout> <Button android:id="@+id/previous_btn" android:layout_width="100dip" android:layout_height="wrap_content" android:text="Previous" /> <Button android:id="@+id/next_btn" android:layout_width="100dip" android:layout_height="wrap_content" android:layout_toRightOf="@+id/previous_btn" android:text="Next" /> <Button android:id="@+id/button" android:layout_width="100dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_toRightOf="@+id/next_btn" android:text="Save Picture" /> </RelativeLayout> Help me please to solve this issue!!! Best regards
0
6,311,900
06/10/2011 20:47:14
563,762
01/05/2011 10:30:29
587
13
iOS 5 and app store
Not sure if this has been asked yet, but it is a very important question for our app development company: we are debating the installation of iOS 5 on our devices, but need these devices to develop and test apps for the app store. Would installing iOS 5 disrupt that process? That is, would we still be able to upload and test apps on Xcode 4.3 and iOS 5? Thank you!
objective-c
ios
xcode
apple
ios5
06/15/2011 01:55:11
off topic
iOS 5 and app store === Not sure if this has been asked yet, but it is a very important question for our app development company: we are debating the installation of iOS 5 on our devices, but need these devices to develop and test apps for the app store. Would installing iOS 5 disrupt that process? That is, would we still be able to upload and test apps on Xcode 4.3 and iOS 5? Thank you!
2
11,428,371
07/11/2012 08:17:45
1,502,929
07/05/2012 04:33:37
1
0
Pull data from the Sales Order
if I can pull data on the sales order? here is my script sql cr.execute = (" SELECT sale_order.partner_id, sale_order.name, res_partner.name, res_partner_address.city, res_partner_address.partner_id, sale_order_line.name, product_template.name " " FROM public.sale_order, public.res_partner, public.res_partner_address, public.product_template, public.product_product " " WHERE sale_order.partner_id = res_partner.id AND res_partner_address.partner_id = res_partner.id AND sale_order_line.order_id = sale_order.id AND product_template.name = product_product.name_template AND product_product.id = sale_order_line.product_id AND product_template.procure_method = 'make_to_order' AND res_partner_address.city") so when I clicked the button save..., the data saved in new database ? what wrong to my script ?
postgresql
openerp
null
null
null
07/11/2012 13:51:58
not a real question
Pull data from the Sales Order === if I can pull data on the sales order? here is my script sql cr.execute = (" SELECT sale_order.partner_id, sale_order.name, res_partner.name, res_partner_address.city, res_partner_address.partner_id, sale_order_line.name, product_template.name " " FROM public.sale_order, public.res_partner, public.res_partner_address, public.product_template, public.product_product " " WHERE sale_order.partner_id = res_partner.id AND res_partner_address.partner_id = res_partner.id AND sale_order_line.order_id = sale_order.id AND product_template.name = product_product.name_template AND product_product.id = sale_order_line.product_id AND product_template.procure_method = 'make_to_order' AND res_partner_address.city") so when I clicked the button save..., the data saved in new database ? what wrong to my script ?
1
8,643,133
12/27/2011 09:40:29
763,053
05/20/2011 16:07:45
717
6
OpenGL does not work on integrated Intel Graphics Cards
SO, today is a sad day for I have realized that due to my Intel graphics card (which is integrated to my motherboard), I cannot write in OpenGL. Is there a fix around this? I desperately need some info. Did some Google searches, but not much revealed a way around this. I've heard of MESA. Is this the only option? I'm running Ubuntu 11.10
opengl
3d
intel
video-card
null
04/01/2012 05:42:34
off topic
OpenGL does not work on integrated Intel Graphics Cards === SO, today is a sad day for I have realized that due to my Intel graphics card (which is integrated to my motherboard), I cannot write in OpenGL. Is there a fix around this? I desperately need some info. Did some Google searches, but not much revealed a way around this. I've heard of MESA. Is this the only option? I'm running Ubuntu 11.10
2
10,734,464
05/24/2012 09:13:26
1,117,753
12/27/2011 14:16:16
307
24
Android: Not able to get accurate latitude and longitude value
In my application I want latitude and longitude value by GPS and/ or Network. My code work but some time it give accurate value some time it not give the accurate value, some time it give the value which is 10 or 20 meter far from the accurate place. Code: mlocListener = new MyLocationListener(getApplicationContext()); /* Use the LocationManager class to obtain GPS locations */ LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, mlocListener); } else if (mlocManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { mlocManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 10000, 0, mlocListener); } Location gpsLocation = mlocManager .getLastKnownLocation(LocationManager.GPS_PROVIDER); Location netLocation = mlocManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (gpsLocation != null) { mlocListener.latitude = gpsLocation.getLatitude(); mlocListener.longitude = gpsLocation.getLongitude(); double lat = (double) (gpsLocation.getLatitude()); double lng = (double) (gpsLocation.getLongitude()); Toast.makeText(this, "Location attributes using GPS Provider", Toast.LENGTH_LONG).show(); } else if (netLocation != null) { mlocListener.latitude = netLocation.getLatitude(); mlocListener.longitude = netLocation.getLongitude(); double lat = (double) (netLocation.getLatitude()); double lng = (double) (netLocation.getLongitude()); Toast.makeText(this, "Location attributes using NETWORK Provider", Toast.LENGTH_SHORT).show(); }
android
geolocation
gps
latitude-longitude
gprs
null
open
Android: Not able to get accurate latitude and longitude value === In my application I want latitude and longitude value by GPS and/ or Network. My code work but some time it give accurate value some time it not give the accurate value, some time it give the value which is 10 or 20 meter far from the accurate place. Code: mlocListener = new MyLocationListener(getApplicationContext()); /* Use the LocationManager class to obtain GPS locations */ LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (mlocManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 0, mlocListener); } else if (mlocManager .isProviderEnabled(LocationManager.NETWORK_PROVIDER)) { mlocManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 10000, 0, mlocListener); } Location gpsLocation = mlocManager .getLastKnownLocation(LocationManager.GPS_PROVIDER); Location netLocation = mlocManager .getLastKnownLocation(LocationManager.NETWORK_PROVIDER); if (gpsLocation != null) { mlocListener.latitude = gpsLocation.getLatitude(); mlocListener.longitude = gpsLocation.getLongitude(); double lat = (double) (gpsLocation.getLatitude()); double lng = (double) (gpsLocation.getLongitude()); Toast.makeText(this, "Location attributes using GPS Provider", Toast.LENGTH_LONG).show(); } else if (netLocation != null) { mlocListener.latitude = netLocation.getLatitude(); mlocListener.longitude = netLocation.getLongitude(); double lat = (double) (netLocation.getLatitude()); double lng = (double) (netLocation.getLongitude()); Toast.makeText(this, "Location attributes using NETWORK Provider", Toast.LENGTH_SHORT).show(); }
0
11,107,148
06/19/2012 18:31:16
1,452,265
06/12/2012 21:05:22
6
0
Primery key Dupication Exception
I am Doing a project in C# using sql server as a data base. So the problom is there is a algo in my project which returns a single value every time ;and i have save that value to database(as my project requirement); but if the algo repeate a value that will also save at database which is not required(Duplication) and cause some problems . I need help to overcome this problem that a unique value save only ones when it occurs ;no repeateion in database. i tried to make that colum a primary key but then i found primary key violation exception.
c#
sql
sql-server
c#-4.0
exception-handling
null
open
Primery key Dupication Exception === I am Doing a project in C# using sql server as a data base. So the problom is there is a algo in my project which returns a single value every time ;and i have save that value to database(as my project requirement); but if the algo repeate a value that will also save at database which is not required(Duplication) and cause some problems . I need help to overcome this problem that a unique value save only ones when it occurs ;no repeateion in database. i tried to make that colum a primary key but then i found primary key violation exception.
0
2,045,969
01/12/2010 00:45:30
225,253
12/05/2009 03:31:24
31
2
MPQueue - what is it and how do I use it?
I encountered a bug that has me beat. Fortunately, I found a work around here (not necessary reading to answer this q) - http://lists.apple.com/archives/quartz-dev/2009/Oct/msg00088.html The problem is, I don't understand all of it. I am ok with the event taps etc, but I am supposed to 'set up a thread-safe queue) using MPQueue, add events to it pull them back off later. Can anyone tell me what an MPQueue is, and how I create one - also how to add items and read/remove items? Google hasn't helped at all.
c
cocoa
queue
multithreading
null
null
open
MPQueue - what is it and how do I use it? === I encountered a bug that has me beat. Fortunately, I found a work around here (not necessary reading to answer this q) - http://lists.apple.com/archives/quartz-dev/2009/Oct/msg00088.html The problem is, I don't understand all of it. I am ok with the event taps etc, but I am supposed to 'set up a thread-safe queue) using MPQueue, add events to it pull them back off later. Can anyone tell me what an MPQueue is, and how I create one - also how to add items and read/remove items? Google hasn't helped at all.
0
11,557,966
07/19/2012 09:37:50
900,572
08/18/2011 12:20:29
13
2
How to create Multiple Text files to download in Django
Thanks in Advance. I have to create a project in Django with a model consisting a title field and One TextField. Users have the option to enter title and content. In the listing page, I need an option to download this Notes. When I clicked on the Download Button against one Row, the corresponding content should be downloaded. I haven't found any usefull codes over Internet. Please help me
python
django
django-views
text-files
null
07/19/2012 13:23:33
not a real question
How to create Multiple Text files to download in Django === Thanks in Advance. I have to create a project in Django with a model consisting a title field and One TextField. Users have the option to enter title and content. In the listing page, I need an option to download this Notes. When I clicked on the Download Button against one Row, the corresponding content should be downloaded. I haven't found any usefull codes over Internet. Please help me
1
9,659,519
03/11/2012 22:28:14
314,166
04/06/2010 21:02:07
8,295
363
Isn't comma sometimes redundant?
In Ruby, many things that were required in other languages but were felt redundant are removed from the language specification. Among them, one significant example is the semicolon. Unless you want to put statements consecutively, you can omit semicolons. But there is another character that I usually feel redundant and is still required in Ruby. That is the comma. Isn't comma redundant in some cases, i.e., when method arguments or array elements or hash elements are put on the same line consecutively, or when they are surrounded by a pair of parentheses even when they are on different lines? Why cannot Ruby be without commas as with shell scripts, and used only optionally to indicate that method arguments/array elements/hash elements continue onto the next line? If Matz went on and made semicolon optional, why didn't he do it for commas? [This question][1] which I voted to close, made me think about this question. [1]: http://stackoverflow.com/questions/9659053
ruby
comma
null
null
null
03/16/2012 02:11:55
not constructive
Isn't comma sometimes redundant? === In Ruby, many things that were required in other languages but were felt redundant are removed from the language specification. Among them, one significant example is the semicolon. Unless you want to put statements consecutively, you can omit semicolons. But there is another character that I usually feel redundant and is still required in Ruby. That is the comma. Isn't comma redundant in some cases, i.e., when method arguments or array elements or hash elements are put on the same line consecutively, or when they are surrounded by a pair of parentheses even when they are on different lines? Why cannot Ruby be without commas as with shell scripts, and used only optionally to indicate that method arguments/array elements/hash elements continue onto the next line? If Matz went on and made semicolon optional, why didn't he do it for commas? [This question][1] which I voted to close, made me think about this question. [1]: http://stackoverflow.com/questions/9659053
4
10,791,272
05/28/2012 22:57:35
1,019,490
10/29/2011 06:50:32
1
0
I have stored an external xml file using XLST document function. How do I loop through the XML?
I have an 'external' document. Ex. school.xml into a varible named 'myvariable'. For simplicity lets say it looks like this: <school> <class>A</class> <class>B</class> <class>C</class> </school> I have a 'main' xml file. Ex. myfile.xml. In that file, I want to use the XLST document function to load school.xml. I then want to loop through each class and format it nicely into, maybe, a HTML table format or something. How can I do this? What is the code?
xslt
null
null
null
null
06/18/2012 23:17:10
not a real question
I have stored an external xml file using XLST document function. How do I loop through the XML? === I have an 'external' document. Ex. school.xml into a varible named 'myvariable'. For simplicity lets say it looks like this: <school> <class>A</class> <class>B</class> <class>C</class> </school> I have a 'main' xml file. Ex. myfile.xml. In that file, I want to use the XLST document function to load school.xml. I then want to loop through each class and format it nicely into, maybe, a HTML table format or something. How can I do this? What is the code?
1
9,625,035
03/08/2012 21:14:33
1,075,119
12/01/2011 09:41:05
61
0
HTML on Firefox doesn't display well
Here is a piece of HTML that does not display well in Firefox (10) <!DOCTYPE html> <html> <head> <title>Test</title> <style> * { margin: 0; padding: 0; } .block6 { float: left; margin: 0 10px; width: 460px; } .block { position: relative; } .block:after { clear: both; content: ""; display: block; margin-bottom: 40px; } header { margin-bottom: 40px; } .wie { text-align: center; } .w { margin: 0 auto; padding: 0 10px; text-align: left; width: 960px; } </style> </head> <body> <header> <div class="wie"> <div class="w"> <div class="block"> <div class="block6"> aa </div> <div class="block6"> bb </div> </div> <!-- block --> </div> <!-- w --> </div> <!-- wie --> </header> </body> </html> The problem is that an "extra" space on the top is displayed. If I set: header { margin-bottom: 0; } The extra space disappears. I think the error is in the block or block6 class. Any suggestion? In Chrome displays well.
html
css
null
null
null
null
open
HTML on Firefox doesn't display well === Here is a piece of HTML that does not display well in Firefox (10) <!DOCTYPE html> <html> <head> <title>Test</title> <style> * { margin: 0; padding: 0; } .block6 { float: left; margin: 0 10px; width: 460px; } .block { position: relative; } .block:after { clear: both; content: ""; display: block; margin-bottom: 40px; } header { margin-bottom: 40px; } .wie { text-align: center; } .w { margin: 0 auto; padding: 0 10px; text-align: left; width: 960px; } </style> </head> <body> <header> <div class="wie"> <div class="w"> <div class="block"> <div class="block6"> aa </div> <div class="block6"> bb </div> </div> <!-- block --> </div> <!-- w --> </div> <!-- wie --> </header> </body> </html> The problem is that an "extra" space on the top is displayed. If I set: header { margin-bottom: 0; } The extra space disappears. I think the error is in the block or block6 class. Any suggestion? In Chrome displays well.
0
1,349,640
08/28/2009 22:14:51
114,916
05/30/2009 21:42:40
2,044
54
ASP.NET MVC (Domain Model, Repository, Fluent, Services - Structure for my Project)
In my ASP.NET MVC web application, I have: - Domain Model, created by LINQ to SQL - Repositories such as <code>UserRepository</code> and <code>OrderRepository</code> - IQueryable Fluents as IQueryable Extension Methods such as <code>public IQueryable&lt;Order> GetNewOrders(this IQueryable&lt;Order>)</code> - Services such as <code>UserService</code> and <code>OrderService</code> - Utility Classes and Extension Methods such as <code>CryptoUtility</code> (doing Hashing etc.) and String etc. extensions - ViewModels which are special for each MVC View - The ASP.NET MVC project itself (Controllers, Views) I'm looking for the best project structure/organization for my case, especially separating into different assemblies and how dependencies should look like between these layers. Web resources unfortunately don't go into good detail about this. One hint: Currently Repository, Services, IQueryable Fluents etc. work directly against domain model implementation, I don't have an interface definition for them. I considered it unnecessary but maybe this is needed for loose coupling? My Services have an interface (e.g. IOrderService), and my repositories implement IRepository&lt;T>. Appreciate your input on organizing this in a concise manner, and especially what layer should depend on what & assembly organization. Thank you!
c#
project-structure
.net
asp.net-mvc
dependencies
null
open
ASP.NET MVC (Domain Model, Repository, Fluent, Services - Structure for my Project) === In my ASP.NET MVC web application, I have: - Domain Model, created by LINQ to SQL - Repositories such as <code>UserRepository</code> and <code>OrderRepository</code> - IQueryable Fluents as IQueryable Extension Methods such as <code>public IQueryable&lt;Order> GetNewOrders(this IQueryable&lt;Order>)</code> - Services such as <code>UserService</code> and <code>OrderService</code> - Utility Classes and Extension Methods such as <code>CryptoUtility</code> (doing Hashing etc.) and String etc. extensions - ViewModels which are special for each MVC View - The ASP.NET MVC project itself (Controllers, Views) I'm looking for the best project structure/organization for my case, especially separating into different assemblies and how dependencies should look like between these layers. Web resources unfortunately don't go into good detail about this. One hint: Currently Repository, Services, IQueryable Fluents etc. work directly against domain model implementation, I don't have an interface definition for them. I considered it unnecessary but maybe this is needed for loose coupling? My Services have an interface (e.g. IOrderService), and my repositories implement IRepository&lt;T>. Appreciate your input on organizing this in a concise manner, and especially what layer should depend on what & assembly organization. Thank you!
0
1,672,131
11/04/2009 07:11:11
133,466
07/05/2009 23:02:59
306
1
what does this pointer do?
char* p = "hello world"; programmers usually assigns the address of an variable to a pointer. But in the above case, where is the pointer pointing to? and what in the world is int** r = &p; pointing to?
c
null
null
null
null
null
open
what does this pointer do? === char* p = "hello world"; programmers usually assigns the address of an variable to a pointer. But in the above case, where is the pointer pointing to? and what in the world is int** r = &p; pointing to?
0
294,256
11/16/2008 19:24:22
3,153
08/27/2008 02:45:05
10,703
206
Favorite, non obvious feature of svn?
What is your favorite, non obvious feature of svn?
svn
null
null
null
null
09/20/2011 01:45:49
not constructive
Favorite, non obvious feature of svn? === What is your favorite, non obvious feature of svn?
4
4,731,511
01/19/2011 03:39:14
254,626
01/20/2010 06:07:59
6
0
What's the time to release the image of the imageView?
self.currentContentImv = [[UIImageView alloc] initWithFrame: CGRectMake(0, 0, 1024, 768)];<br/> UIImage *currentImg = [[UIImage alloc] initWithContentsOfFile: @"whatever..."]];<br/> self.currentContentImv.image = currentImg;<br/> [currentImg release];<br/> ## I create a UIImage and set to the property of the ImageView, then I release the currentImg, whether there is a problem in these code ? Sometimes it's will be crashed, so in this situation how could I write it? Thanks very much!
iphone
objective-c
ipad
ios
null
null
open
What's the time to release the image of the imageView? === self.currentContentImv = [[UIImageView alloc] initWithFrame: CGRectMake(0, 0, 1024, 768)];<br/> UIImage *currentImg = [[UIImage alloc] initWithContentsOfFile: @"whatever..."]];<br/> self.currentContentImv.image = currentImg;<br/> [currentImg release];<br/> ## I create a UIImage and set to the property of the ImageView, then I release the currentImg, whether there is a problem in these code ? Sometimes it's will be crashed, so in this situation how could I write it? Thanks very much!
0
9,865,480
03/26/2012 01:07:38
266,457
02/04/2010 18:27:47
898
32
Reporting Services scatter chart origin/axis placement negative values
Shown are two scatter charts on the same set of data, which contains some negative values. One is in Excel 2010 with the origin centered, the other is with Reporting Services. I would like the chart to display as in Excel. In SQL Server Reporting Services 2005-2012, is there any way to set the placement of the origin? Excel ![enter image description here][1] SSRS ![enter image description here][2] [1]: http://i.stack.imgur.com/Tu3Nw.png [2]: http://i.stack.imgur.com/lslNJ.png
sql-server
reporting-services
null
null
null
null
open
Reporting Services scatter chart origin/axis placement negative values === Shown are two scatter charts on the same set of data, which contains some negative values. One is in Excel 2010 with the origin centered, the other is with Reporting Services. I would like the chart to display as in Excel. In SQL Server Reporting Services 2005-2012, is there any way to set the placement of the origin? Excel ![enter image description here][1] SSRS ![enter image description here][2] [1]: http://i.stack.imgur.com/Tu3Nw.png [2]: http://i.stack.imgur.com/lslNJ.png
0
7,397,136
09/13/2011 05:16:36
941,833
09/13/2011 05:16:36
1
0
fetching the last updated(NAV) record
I have the table it consisting of NAV value. Every day we have to update the NAV value in our table. In our website we want to provide the link to fetch Latest NAV value. For this purpose i want the query to fetch the last update NAv record.
html
title
body
tr
br
09/13/2011 14:18:56
not a real question
fetching the last updated(NAV) record === I have the table it consisting of NAV value. Every day we have to update the NAV value in our table. In our website we want to provide the link to fetch Latest NAV value. For this purpose i want the query to fetch the last update NAv record.
1
9,752,375
03/17/2012 17:56:38
784,846
06/05/2011 15:40:53
21
0
Which Windows GUI frameworks are currently worth learning?
I'm planning to write a Windows app to help myself with some exploratory testing tasks (note taking, data generation, defect logging) and I've got stuck at the early stage of choosing a framework/language. My sole experience is with web development and from what I can see, WinForms, WPF, Silverlight, Swing etc are all simultaneously obsolete and thriving depending on who you ask. While my main aim is to create the app, obviously I'd like to learn something useful while doing so rather than picking up skills with something that's never going to be seen on a project at work. Which Java or C# frameworks would people recommend learning?
windows
gui
null
null
null
03/18/2012 14:00:43
not constructive
Which Windows GUI frameworks are currently worth learning? === I'm planning to write a Windows app to help myself with some exploratory testing tasks (note taking, data generation, defect logging) and I've got stuck at the early stage of choosing a framework/language. My sole experience is with web development and from what I can see, WinForms, WPF, Silverlight, Swing etc are all simultaneously obsolete and thriving depending on who you ask. While my main aim is to create the app, obviously I'd like to learn something useful while doing so rather than picking up skills with something that's never going to be seen on a project at work. Which Java or C# frameworks would people recommend learning?
4
11,454,719
07/12/2012 15:01:12
1,486,147
06/27/2012 15:29:33
20
0
Java: Regular expressions vs if statements
I have an array and I want to search it for strings which start with "test" (for example); what is the most efficient way to search for these set prefixes? Regular expressions or if statements? Regex: boolean found = false; for (String line: ArrayList){ Pattern pattern = Pattern.compile("^test"); //regex Matcher matcher = pattern.matcher(line); while (matcher.find()) { found = true; } if(found){ doSomething(); } } } if Statement: for (String line : ArrayList) { if (line.startsWith("test"){ doSomething(); } Which is most efficient? Which method is most effective for longer strings? If I want to find Strings that start with "test" but then only ones which have "foo" after "test", which method is better? If Regex is the answer, what is the correct syntax for saying starts with "test" followed by "foo" or "bar" but not both?
java
regex
if-statement
null
null
null
open
Java: Regular expressions vs if statements === I have an array and I want to search it for strings which start with "test" (for example); what is the most efficient way to search for these set prefixes? Regular expressions or if statements? Regex: boolean found = false; for (String line: ArrayList){ Pattern pattern = Pattern.compile("^test"); //regex Matcher matcher = pattern.matcher(line); while (matcher.find()) { found = true; } if(found){ doSomething(); } } } if Statement: for (String line : ArrayList) { if (line.startsWith("test"){ doSomething(); } Which is most efficient? Which method is most effective for longer strings? If I want to find Strings that start with "test" but then only ones which have "foo" after "test", which method is better? If Regex is the answer, what is the correct syntax for saying starts with "test" followed by "foo" or "bar" but not both?
0
11,214,986
06/26/2012 19:54:34
1,483,820
06/26/2012 19:48:41
1
0
What program would I use to update my iPhone application every time it is opened?
My application is fairly simple, however, it requires that some of the text fields, labels, images, etc. are updated when the application is opened? would I use my SQLite to accomplish this, or is there an easier way considering that it is not very much information?
iphone
objective-c
xcode
application
null
06/27/2012 12:00:31
not a real question
What program would I use to update my iPhone application every time it is opened? === My application is fairly simple, however, it requires that some of the text fields, labels, images, etc. are updated when the application is opened? would I use my SQLite to accomplish this, or is there an easier way considering that it is not very much information?
1
10,405,795
05/01/2012 23:33:38
100,460
05/03/2009 19:58:48
93
2
Heroku serving bad home page on custom domain
What could be causing an app that is hosted on heroku to serve a different home pages? This renders correctly http://ninezoom.herokuapp.com/ This does not http://9zoom.com/ This is fine though http://9zoom.com/features
ruby-on-rails
heroku
null
null
null
null
open
Heroku serving bad home page on custom domain === What could be causing an app that is hosted on heroku to serve a different home pages? This renders correctly http://ninezoom.herokuapp.com/ This does not http://9zoom.com/ This is fine though http://9zoom.com/features
0
10,177,947
04/16/2012 16:25:33
923,406
09/01/2011 12:00:57
26
0
App Engine copy datastore
I am now on python 2.7 and have datastore admin working I want to copy the datastore from one app to another. All the documentation I find refers to Python 2.5 where is the how to do this for Python 2.7
google-app-engine
application
null
null
null
null
open
App Engine copy datastore === I am now on python 2.7 and have datastore admin working I want to copy the datastore from one app to another. All the documentation I find refers to Python 2.5 where is the how to do this for Python 2.7
0
10,076,173
04/09/2012 16:17:02
307,072
04/01/2010 16:25:04
384
18
What is the Difference between Web.config and global.asax?
What is the Difference between Web.config and global.asax ?
asp.net
null
null
null
null
04/09/2012 17:19:40
not a real question
What is the Difference between Web.config and global.asax? === What is the Difference between Web.config and global.asax ?
1
8,859,063
01/14/2012 00:31:24
1,027,620
11/03/2011 12:02:26
268
4
Playing around with jQuery objects and variables
$('div#Settings ul li').click(function () { var url, template; var self = $(this); if (!$(self).hasClass('selected')) { var ContextMenu = CreateContext($(self)); var id = $(self).attr('id'); etc... function CreateContext(item) { var ContextMenu = $('div#ContextMenu'); if (!$(ContextMenu).length) { $('<div id="ContextMenu"></div>').appendTo('body'); CreateContext(item); } $(ContextMenu).slideUp(150, 'swing', function () { $(ContextMenu).insertAfter(item); }); $(item).addClass('selected').siblings().removeClass('selected'); return $(ContextMenu); } On the first call to `CreateContext(item)` I cannot use the variable `ContextMenu` later in the `.click` code. However, if CreateContext is called twice, everything works fine. I am getting an undefined variable when i `console.log(ContextMenu)` the first time. The second time it gets the object correctly. How can I fix this? Thanks.
javascript
jquery
null
null
null
null
open
Playing around with jQuery objects and variables === $('div#Settings ul li').click(function () { var url, template; var self = $(this); if (!$(self).hasClass('selected')) { var ContextMenu = CreateContext($(self)); var id = $(self).attr('id'); etc... function CreateContext(item) { var ContextMenu = $('div#ContextMenu'); if (!$(ContextMenu).length) { $('<div id="ContextMenu"></div>').appendTo('body'); CreateContext(item); } $(ContextMenu).slideUp(150, 'swing', function () { $(ContextMenu).insertAfter(item); }); $(item).addClass('selected').siblings().removeClass('selected'); return $(ContextMenu); } On the first call to `CreateContext(item)` I cannot use the variable `ContextMenu` later in the `.click` code. However, if CreateContext is called twice, everything works fine. I am getting an undefined variable when i `console.log(ContextMenu)` the first time. The second time it gets the object correctly. How can I fix this? Thanks.
0
11,422,163
07/10/2012 21:20:49
1,515,970
07/10/2012 20:34:57
1
0
android listfragment doesn't show the content
I've been trying to show on my main fragmentActivity a tabHost which contains a ListView. However my listView doesn't appear at all. the elements are uploading but the view isn't showing them. The fragment which show the tabHost public class GestionListeNote extends Fragment implements OnTabChangeListener { private static final String TAG = "FragmentTabs"; public static final String TAB_ALL = "All"; public static final String TAB_TOPAY = "To Pay"; public static final String TAB_PAID = "Paid"; public static final String TAB_SEND = "Send"; private View mRoot; private TabHost mTabHost; private int mCurrentTab; @Override public void onAttach(Activity activity) { super.onAttach(activity); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.tabs_fragment, null); mTabHost = (TabHost) mRoot.findViewById(android.R.id.tabhost); setupTabs(); return mRoot; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true); mTabHost.setOnTabChangedListener(this); mTabHost.setCurrentTab(mCurrentTab); // manually start loading stuff in the first tab updateTab(TAB_ALL, R.id.tab_1); } private void setupTabs() { mTabHost.setup(); // important! mTabHost.addTab(newTab(TAB_ALL, R.string.allNotes, R.id.tab_1)); mTabHost.addTab(newTab(TAB_TOPAY, R.string.notesToPay, R.id.tab_2)); mTabHost.addTab(newTab(TAB_PAID, R.string.notesPaid, R.id.tab_3)); mTabHost.addTab(newTab(TAB_SEND, R.string.notesSend, R.id.tab_4)); } private TabSpec newTab(String tag, int labelId, int tabContentId) { Log.d(TAG, "buildTab(): tag=" + tag); View indicator = LayoutInflater.from(getActivity()).inflate( R.layout.tab, (ViewGroup) mRoot.findViewById(android.R.id.tabs), false); ((TextView) indicator.findViewById(R.id.text)).setText(labelId); TabSpec tabSpec = mTabHost.newTabSpec(tag); tabSpec.setIndicator(indicator); tabSpec.setContent(tabContentId); return tabSpec; } @Override public void onTabChanged(String tabId) { Log.d(TAG, "onTabChanged(): tabId=" + tabId); if (TAB_ALL.equals(tabId)) { updateTab(tabId, R.id.tab_1); mCurrentTab = 0; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_TOPAY.equals(tabId)) { updateTab(tabId, R.id.tab_2); mCurrentTab = 1; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_PAID.equals(tabId)) { updateTab(tabId, R.id.tab_3); mCurrentTab = 2; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_SEND.equals(tabId)) { updateTab(tabId, R.id.tab_4); mCurrentTab = 3; Log.d(TAG, "current tab=" + mCurrentTab); return; } } private void updateTab(String tabId, int placeholder) { FragmentManager fm = getFragmentManager(); if (fm.findFragmentByTag(tabId) == null) { fm.beginTransaction() .replace(placeholder, new ListeNotesFragment(tabId), tabId) .commit(); } } That's my ListFragment who show my elements public class ListeNotesFragment extends ListFragment implements LoaderCallbacks<Void> { private static final String TAG = "FragmentTabs"; private String mTag; private MyAdapter mAdapter; private ArrayList<String> mItems; private LayoutInflater mInflater; private int mTotal; private int mPosition; private static final String[] All = { "Lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "Fusce", "pharetra", "luctus", "sodales" }; private static final String[] ToPay = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV" }; private static final String[] Paid = { "Test" }; private static final String[] Send = { "Test" }; private static final int SLEEP = 1000; private final int allBarColor = R.color.all_bar; private final int topayBarColor = R.color.topay_bar; private final int paidBarColor = R.color.paid_bar; private final int sendBarColor = R.color.send_bar; public ListeNotesFragment() { } public ListeNotesFragment(String tag) { mTag = tag; mTotal = GestionListeNote.TAB_ALL.equals(mTag) ? All.length : (GestionListeNote.TAB_TOPAY.equals(mTag) ? ToPay.length : (GestionListeNote.TAB_PAID.equals(mTag) ? Paid.length : Send.length ) ); Log.d(TAG, "mTotal =" + mTotal); Log.d(TAG, "Constructor: tag=" + tag); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // this is really important in order to save the state across screen // configuration changes for example setRetainInstance(true); mInflater = LayoutInflater.from(getActivity()); // you only need to instantiate these the first time your fragment is // created; then, the method above will do the rest if (mAdapter == null) { mItems = new ArrayList<String>(); mAdapter = new MyAdapter(getActivity(), mItems); } getListView().setAdapter(mAdapter); // initiate the loader to do the background work getLoaderManager().initLoader(0, null, this); } @Override public Loader<Void> onCreateLoader(int id, Bundle args) { AsyncTaskLoader<Void> loader = new AsyncTaskLoader<Void>(getActivity()) { @Override public Void loadInBackground() { try { // simulate some time consuming operation going on in the // background Thread.sleep(SLEEP); } catch (InterruptedException e) { } return null; } }; // somehow the AsyncTaskLoader doesn't want to start its job without // calling this method loader.forceLoad(); Log.d(TAG, "Stop sleep"); return loader; } @Override public void onLoadFinished(Loader<Void> loader, Void result) { // add the new item and let the adapter know in order to refresh the // views mItems.add(GestionListeNote.TAB_ALL.equals(mTag) ? All[mPosition] : (GestionListeNote.TAB_TOPAY.equals(mTag) ? ToPay[mPosition] : (GestionListeNote.TAB_PAID.equals(mTag) ? Paid[mPosition] : Send[mPosition]) ) ); mAdapter.notifyDataSetChanged(); Log.d(TAG, "item =" + mItems.get(mPosition)); // advance in your list with one step mPosition++; if (mPosition < mTotal - 1) { getLoaderManager().restartLoader(0, null, this); Log.d(TAG, "onLoadFinished(): loading next..."); } else { Log.d(TAG, "onLoadFinished(): done loading!"); } } @Override public void onLoaderReset(Loader<Void> loader) { } private class MyAdapter extends ArrayAdapter<String> { public MyAdapter(Context context, List<String> objects) { super(context, R.layout.list_item, R.id.text, objects); Log.d(TAG, "affiche contenu"); } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; Wrapper wrapper; Log.d(TAG, "affiche vue"); if (view == null) { view = mInflater.inflate(R.layout.list_item, null); wrapper = new Wrapper(view); view.setTag(wrapper); } else { wrapper = (Wrapper) view.getTag(); } wrapper.getTextView().setText(getItem(position)); wrapper.getBar().setBackgroundColor( GestionListeNote.TAB_ALL.equals(mTag) ? getResources().getColor(allBarColor) : (GestionListeNote.TAB_TOPAY.equals(mTag) ? getResources().getColor(topayBarColor) : (GestionListeNote.TAB_PAID.equals(mTag) ? getResources().getColor(paidBarColor) :getResources().getColor(sendBarColor)) ) ); return view; } } // use an wrapper (or view holder) object to limit calling the // findViewById() method, which parses the entire structure of your // XML in search for the ID of your view private class Wrapper { private final View mRoot; private TextView mText; private View mBar; public Wrapper(View root) { mRoot = root; Log.d(TAG, "initialise view"); } public TextView getTextView() { if (mText == null) { mText = (TextView) mRoot.findViewById(R.id.text); Log.d(TAG, "initialise TextView"); } Log.d(TAG, "initialise view"); return mText; } public View getBar() { if (mBar == null) { mBar = mRoot.findViewById(R.id.bar); Log.d(TAG, "initialise view"); } Log.d(TAG, "initialise view"); return mBar; } } below the xml main <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <fragment android:layout_width="match_parent" android:layout_height="wrap_content" class="org.newnote.android.AddNoteButton" /> <fragment android:id="@+id/tabs_fragment" android:layout_width="match_parent" android:layout_height="match_parent" class="org.newnote.android.GestionListeNote" /> </LinearLayout> liste_item <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="@dimen/list_item_height" android:gravity="left|center_vertical"> <View android:id="@+id/bar" android:layout_width="10dp" android:layout_height="fill_parent" /> <TextView android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="10dp" android:gravity="center" /> </LinearLayout> tabs_fragment <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#EFEFEF" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" > <FrameLayout android:id="@+id/tab_1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_2" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_4" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> </LinearLayout> </TabHost> Tab <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="80dp" android:layout_height="@dimen/tab_height" android:gravity="center" android:padding="@dimen/tab_padding" android:background="@drawable/tab_selector"> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textSize="@dimen/text_small" android:textStyle="bold" android:textColor="@drawable/tab_text_selector" /> </LinearLayout> I don't understand why my fragment doesn't show the elements Hope you could help me.
android
listview
fragment
null
null
null
open
android listfragment doesn't show the content === I've been trying to show on my main fragmentActivity a tabHost which contains a ListView. However my listView doesn't appear at all. the elements are uploading but the view isn't showing them. The fragment which show the tabHost public class GestionListeNote extends Fragment implements OnTabChangeListener { private static final String TAG = "FragmentTabs"; public static final String TAB_ALL = "All"; public static final String TAB_TOPAY = "To Pay"; public static final String TAB_PAID = "Paid"; public static final String TAB_SEND = "Send"; private View mRoot; private TabHost mTabHost; private int mCurrentTab; @Override public void onAttach(Activity activity) { super.onAttach(activity); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRoot = inflater.inflate(R.layout.tabs_fragment, null); mTabHost = (TabHost) mRoot.findViewById(android.R.id.tabhost); setupTabs(); return mRoot; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setRetainInstance(true); mTabHost.setOnTabChangedListener(this); mTabHost.setCurrentTab(mCurrentTab); // manually start loading stuff in the first tab updateTab(TAB_ALL, R.id.tab_1); } private void setupTabs() { mTabHost.setup(); // important! mTabHost.addTab(newTab(TAB_ALL, R.string.allNotes, R.id.tab_1)); mTabHost.addTab(newTab(TAB_TOPAY, R.string.notesToPay, R.id.tab_2)); mTabHost.addTab(newTab(TAB_PAID, R.string.notesPaid, R.id.tab_3)); mTabHost.addTab(newTab(TAB_SEND, R.string.notesSend, R.id.tab_4)); } private TabSpec newTab(String tag, int labelId, int tabContentId) { Log.d(TAG, "buildTab(): tag=" + tag); View indicator = LayoutInflater.from(getActivity()).inflate( R.layout.tab, (ViewGroup) mRoot.findViewById(android.R.id.tabs), false); ((TextView) indicator.findViewById(R.id.text)).setText(labelId); TabSpec tabSpec = mTabHost.newTabSpec(tag); tabSpec.setIndicator(indicator); tabSpec.setContent(tabContentId); return tabSpec; } @Override public void onTabChanged(String tabId) { Log.d(TAG, "onTabChanged(): tabId=" + tabId); if (TAB_ALL.equals(tabId)) { updateTab(tabId, R.id.tab_1); mCurrentTab = 0; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_TOPAY.equals(tabId)) { updateTab(tabId, R.id.tab_2); mCurrentTab = 1; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_PAID.equals(tabId)) { updateTab(tabId, R.id.tab_3); mCurrentTab = 2; Log.d(TAG, "current tab=" + mCurrentTab); return; } if (TAB_SEND.equals(tabId)) { updateTab(tabId, R.id.tab_4); mCurrentTab = 3; Log.d(TAG, "current tab=" + mCurrentTab); return; } } private void updateTab(String tabId, int placeholder) { FragmentManager fm = getFragmentManager(); if (fm.findFragmentByTag(tabId) == null) { fm.beginTransaction() .replace(placeholder, new ListeNotesFragment(tabId), tabId) .commit(); } } That's my ListFragment who show my elements public class ListeNotesFragment extends ListFragment implements LoaderCallbacks<Void> { private static final String TAG = "FragmentTabs"; private String mTag; private MyAdapter mAdapter; private ArrayList<String> mItems; private LayoutInflater mInflater; private int mTotal; private int mPosition; private static final String[] All = { "Lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit", "Fusce", "pharetra", "luctus", "sodales" }; private static final String[] ToPay = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV" }; private static final String[] Paid = { "Test" }; private static final String[] Send = { "Test" }; private static final int SLEEP = 1000; private final int allBarColor = R.color.all_bar; private final int topayBarColor = R.color.topay_bar; private final int paidBarColor = R.color.paid_bar; private final int sendBarColor = R.color.send_bar; public ListeNotesFragment() { } public ListeNotesFragment(String tag) { mTag = tag; mTotal = GestionListeNote.TAB_ALL.equals(mTag) ? All.length : (GestionListeNote.TAB_TOPAY.equals(mTag) ? ToPay.length : (GestionListeNote.TAB_PAID.equals(mTag) ? Paid.length : Send.length ) ); Log.d(TAG, "mTotal =" + mTotal); Log.d(TAG, "Constructor: tag=" + tag); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // this is really important in order to save the state across screen // configuration changes for example setRetainInstance(true); mInflater = LayoutInflater.from(getActivity()); // you only need to instantiate these the first time your fragment is // created; then, the method above will do the rest if (mAdapter == null) { mItems = new ArrayList<String>(); mAdapter = new MyAdapter(getActivity(), mItems); } getListView().setAdapter(mAdapter); // initiate the loader to do the background work getLoaderManager().initLoader(0, null, this); } @Override public Loader<Void> onCreateLoader(int id, Bundle args) { AsyncTaskLoader<Void> loader = new AsyncTaskLoader<Void>(getActivity()) { @Override public Void loadInBackground() { try { // simulate some time consuming operation going on in the // background Thread.sleep(SLEEP); } catch (InterruptedException e) { } return null; } }; // somehow the AsyncTaskLoader doesn't want to start its job without // calling this method loader.forceLoad(); Log.d(TAG, "Stop sleep"); return loader; } @Override public void onLoadFinished(Loader<Void> loader, Void result) { // add the new item and let the adapter know in order to refresh the // views mItems.add(GestionListeNote.TAB_ALL.equals(mTag) ? All[mPosition] : (GestionListeNote.TAB_TOPAY.equals(mTag) ? ToPay[mPosition] : (GestionListeNote.TAB_PAID.equals(mTag) ? Paid[mPosition] : Send[mPosition]) ) ); mAdapter.notifyDataSetChanged(); Log.d(TAG, "item =" + mItems.get(mPosition)); // advance in your list with one step mPosition++; if (mPosition < mTotal - 1) { getLoaderManager().restartLoader(0, null, this); Log.d(TAG, "onLoadFinished(): loading next..."); } else { Log.d(TAG, "onLoadFinished(): done loading!"); } } @Override public void onLoaderReset(Loader<Void> loader) { } private class MyAdapter extends ArrayAdapter<String> { public MyAdapter(Context context, List<String> objects) { super(context, R.layout.list_item, R.id.text, objects); Log.d(TAG, "affiche contenu"); } @Override public View getView(int position, View convertView, ViewGroup parent) { View view = convertView; Wrapper wrapper; Log.d(TAG, "affiche vue"); if (view == null) { view = mInflater.inflate(R.layout.list_item, null); wrapper = new Wrapper(view); view.setTag(wrapper); } else { wrapper = (Wrapper) view.getTag(); } wrapper.getTextView().setText(getItem(position)); wrapper.getBar().setBackgroundColor( GestionListeNote.TAB_ALL.equals(mTag) ? getResources().getColor(allBarColor) : (GestionListeNote.TAB_TOPAY.equals(mTag) ? getResources().getColor(topayBarColor) : (GestionListeNote.TAB_PAID.equals(mTag) ? getResources().getColor(paidBarColor) :getResources().getColor(sendBarColor)) ) ); return view; } } // use an wrapper (or view holder) object to limit calling the // findViewById() method, which parses the entire structure of your // XML in search for the ID of your view private class Wrapper { private final View mRoot; private TextView mText; private View mBar; public Wrapper(View root) { mRoot = root; Log.d(TAG, "initialise view"); } public TextView getTextView() { if (mText == null) { mText = (TextView) mRoot.findViewById(R.id.text); Log.d(TAG, "initialise TextView"); } Log.d(TAG, "initialise view"); return mText; } public View getBar() { if (mBar == null) { mBar = mRoot.findViewById(R.id.bar); Log.d(TAG, "initialise view"); } Log.d(TAG, "initialise view"); return mBar; } } below the xml main <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <fragment android:layout_width="match_parent" android:layout_height="wrap_content" class="org.newnote.android.AddNoteButton" /> <fragment android:id="@+id/tabs_fragment" android:layout_width="match_parent" android:layout_height="match_parent" class="org.newnote.android.GestionListeNote" /> </LinearLayout> liste_item <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="@dimen/list_item_height" android:gravity="left|center_vertical"> <View android:id="@+id/bar" android:layout_width="10dp" android:layout_height="fill_parent" /> <TextView android:id="@+id/text" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="10dp" android:gravity="center" /> </LinearLayout> tabs_fragment <TabHost xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#EFEFEF" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="wrap_content" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" > <FrameLayout android:id="@+id/tab_1" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_2" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_3" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@+id/tab_4" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </FrameLayout> </LinearLayout> </TabHost> Tab <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="80dp" android:layout_height="@dimen/tab_height" android:gravity="center" android:padding="@dimen/tab_padding" android:background="@drawable/tab_selector"> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:textSize="@dimen/text_small" android:textStyle="bold" android:textColor="@drawable/tab_text_selector" /> </LinearLayout> I don't understand why my fragment doesn't show the elements Hope you could help me.
0
9,492,534
02/29/2012 01:55:26
341,683
05/14/2010 23:31:15
1,038
12
Weird segfault in CodeBlocks with c++11
The C++11 standard includes a new method to hardcode vectors. And using it, I hardcoded this data in `int main()`: std::vector <std::vector <double> > A = {{1, 2, 3, 1}, {2, 5, 4, 2}, {1, 4, 7, 3}, {1, 7, 9, 1}}; however, when i add this line: std::vector <std::vector <double> > b = {{1}, {2}, {3}, {4}}; under the first line, CodeBlocks/GCC says: `internal compiler error: Segmentation fault` why?
c++
gcc
c++11
segmentation-fault
null
03/14/2012 11:17:30
too localized
Weird segfault in CodeBlocks with c++11 === The C++11 standard includes a new method to hardcode vectors. And using it, I hardcoded this data in `int main()`: std::vector <std::vector <double> > A = {{1, 2, 3, 1}, {2, 5, 4, 2}, {1, 4, 7, 3}, {1, 7, 9, 1}}; however, when i add this line: std::vector <std::vector <double> > b = {{1}, {2}, {3}, {4}}; under the first line, CodeBlocks/GCC says: `internal compiler error: Segmentation fault` why?
3
11,266,462
06/29/2012 17:39:58
1,464,381
06/18/2012 17:32:22
10
1
Regarding detail of line of code in java project
Is there any plugin or tool is there that can be installed in eclipse that will calculate the line of code in all the packages for the entire project and provides us with the detailed metrics. Please advise.
java
eclipse
null
null
null
06/30/2012 16:55:29
not a real question
Regarding detail of line of code in java project === Is there any plugin or tool is there that can be installed in eclipse that will calculate the line of code in all the packages for the entire project and provides us with the detailed metrics. Please advise.
1
10,204,154
04/18/2012 06:41:35
867,610
07/28/2011 13:47:58
23
0
Late evaluation in c#?
I am working on an application in c#. To make this application work, I have found myself doing some things that feel quite unnatural for the language I have selected. After going through many refactorings and refinements, I have come to the realization that the functionality that I am trying to implement is really a form of ‘lazy evaluation’ (I think). This is what I would like... // Criteria 1: Lazy evaluation of expressions int x = LazyEvaluated.New<int>(); int y = LazyEvaluated.New<int>(); int z = LazyEvaluated.New<int>(); z.Assign(x + y); Assert.ThrowsException(z.Evalutate()); x.Assign(1); Assert.ThrowsException(z.Evalutate()); y.Assign(2); Assert.Equals(3, z.Evaluate()); x.Assign(3); Assert.Equals(5, z.Evaluate()); // Criteria 2: Referencing relative to parent object Car myCar = LazyEvaluated.New<Car>(); Engine engineInMyCar = LazyEvaluated.New<Engine>(); double displacementOfMyEngine = LazyEvaluated.New<double>(); engineInMyCar = myCar.Engine; displacementOfMyEngine = engineInMyCar.Displacement; Car subaru = new Car(new FlatFourEngine()); Car falcon = new Car(new InlineSixEngine()); myCar.Assign(subaru); Assert.IsTypeOf<FlatFourEngine>(engineInMyCar.Evaluate()); Assert.IsEqual(2.0, displacementOfMyEngine.Evaluate()); myCar.Assign(falcon); Assert.IsTypeOf<InlineSixEngine>(engineInMyCar.Evaluate()); Assert.IsEqual(4.0, displacementOfMyEngine.Evaluate()); And these are the simple class definitions that I have used for illustration... public class Car { private readonly Engine engine; public Car(Engine engine) { this.engine = engine; } public Engine Engine { get { return engine; } } } public abstract class Engine { public abstract double Displacement { get; } } public class FlatFourEngine : Engine { public override double Displacement { get { return 2.0; } } } public class InlineSixEngine : Engine { public override double Displacement { get { return 4.0; } } } The reason I want this functionality is mostly for separation-of-concerns. To illustrate, let’s take the car analogue a bit further. My car is made up of lots of bits; engine, tyres, interior etc. My tyres need to be changed every 2 years by a tyre shop. My engine needs to have an oil change every 6 months by a mechanic. The interior needs to be vacuumed every 3 months by a detailer. It would be nice to able to do something along the lines of... tyreShop.ReplaceTyres(myCar.Tyres, every2Years); mechanic.ChangeOil(myCar.Engine, every6Months); detailer.VacuumInterior(myCar.Interior, every3Months); Some reasons for this approach; - I would like to set-and-forget. Once I schedule a part of my car in for a service, I want it to happen on an ongoing basis without any further input from me. - I don’t want to have to call each of my service centres and notify them the instant that I purchase a new car. In fact, they don’t need to know that I have a new car until it comes time for a service. If they try to service my car and it doesn’t exist, then it’s ok for them to throw an exception. - I want each of my services to be as simple and focussed as possible. Why give the tyre shop a reference to my entire car (including engine, interior, etc), when the only thing they really care about is the tyres? - I don’t want the tyreshop to give me a new set of tyres and force me to fit (assign) them to the car myself. I do not have any formal education in CS, and my only programming experience is with c & c# languages. I’ve just spent the last 6 months getting familiar with c# & .Net. For the most part, I really like the language and early-evaluation in general. But I am now questioning whether I would have been better off tackling my particular problem in a different language with inbuilt support for lazy evaluation. My questions are; 1. If I were to start again, what would be the best language to tackle such a problem in? 2. Are there any existing platforms for c# that provide support for lazy evaluation? 3. What are the alternatives for making this work in c#? Are there any particular design patterns I should read up on?
c#
programming-languages
lazy-evaluation
null
null
null
open
Late evaluation in c#? === I am working on an application in c#. To make this application work, I have found myself doing some things that feel quite unnatural for the language I have selected. After going through many refactorings and refinements, I have come to the realization that the functionality that I am trying to implement is really a form of ‘lazy evaluation’ (I think). This is what I would like... // Criteria 1: Lazy evaluation of expressions int x = LazyEvaluated.New<int>(); int y = LazyEvaluated.New<int>(); int z = LazyEvaluated.New<int>(); z.Assign(x + y); Assert.ThrowsException(z.Evalutate()); x.Assign(1); Assert.ThrowsException(z.Evalutate()); y.Assign(2); Assert.Equals(3, z.Evaluate()); x.Assign(3); Assert.Equals(5, z.Evaluate()); // Criteria 2: Referencing relative to parent object Car myCar = LazyEvaluated.New<Car>(); Engine engineInMyCar = LazyEvaluated.New<Engine>(); double displacementOfMyEngine = LazyEvaluated.New<double>(); engineInMyCar = myCar.Engine; displacementOfMyEngine = engineInMyCar.Displacement; Car subaru = new Car(new FlatFourEngine()); Car falcon = new Car(new InlineSixEngine()); myCar.Assign(subaru); Assert.IsTypeOf<FlatFourEngine>(engineInMyCar.Evaluate()); Assert.IsEqual(2.0, displacementOfMyEngine.Evaluate()); myCar.Assign(falcon); Assert.IsTypeOf<InlineSixEngine>(engineInMyCar.Evaluate()); Assert.IsEqual(4.0, displacementOfMyEngine.Evaluate()); And these are the simple class definitions that I have used for illustration... public class Car { private readonly Engine engine; public Car(Engine engine) { this.engine = engine; } public Engine Engine { get { return engine; } } } public abstract class Engine { public abstract double Displacement { get; } } public class FlatFourEngine : Engine { public override double Displacement { get { return 2.0; } } } public class InlineSixEngine : Engine { public override double Displacement { get { return 4.0; } } } The reason I want this functionality is mostly for separation-of-concerns. To illustrate, let’s take the car analogue a bit further. My car is made up of lots of bits; engine, tyres, interior etc. My tyres need to be changed every 2 years by a tyre shop. My engine needs to have an oil change every 6 months by a mechanic. The interior needs to be vacuumed every 3 months by a detailer. It would be nice to able to do something along the lines of... tyreShop.ReplaceTyres(myCar.Tyres, every2Years); mechanic.ChangeOil(myCar.Engine, every6Months); detailer.VacuumInterior(myCar.Interior, every3Months); Some reasons for this approach; - I would like to set-and-forget. Once I schedule a part of my car in for a service, I want it to happen on an ongoing basis without any further input from me. - I don’t want to have to call each of my service centres and notify them the instant that I purchase a new car. In fact, they don’t need to know that I have a new car until it comes time for a service. If they try to service my car and it doesn’t exist, then it’s ok for them to throw an exception. - I want each of my services to be as simple and focussed as possible. Why give the tyre shop a reference to my entire car (including engine, interior, etc), when the only thing they really care about is the tyres? - I don’t want the tyreshop to give me a new set of tyres and force me to fit (assign) them to the car myself. I do not have any formal education in CS, and my only programming experience is with c & c# languages. I’ve just spent the last 6 months getting familiar with c# & .Net. For the most part, I really like the language and early-evaluation in general. But I am now questioning whether I would have been better off tackling my particular problem in a different language with inbuilt support for lazy evaluation. My questions are; 1. If I were to start again, what would be the best language to tackle such a problem in? 2. Are there any existing platforms for c# that provide support for lazy evaluation? 3. What are the alternatives for making this work in c#? Are there any particular design patterns I should read up on?
0
5,566,996
04/06/2011 13:18:26
511,125
11/17/2010 17:41:52
469
33
Java:Clarifications in Java Interview Questions
I recently attended the Java Interview Questions and had the below queries for which i dont know the answers 1> I have below class class CricketTeam{ String name; //this is the complete name(inclusive of first and last name) } Cricket Players name are as below: `1> Sachin Tendulkar ` `2> Gautam Gambhir ` `3> Ricky Ponting ` `4> Shahid Afridi ` `5> Kevin Pieterson ` `6> MS Dhoni ` I want to sort the above Cricket Players name by their `last name only`.Suugestions/code provided would be appreciated. 2> what are the advantages of using `enhanced for loop` against `iterator` in java.what are the advantages of using enhanced for loop in java and why was it introduced in java at the first place when the `iterator` could do the job.?
java
interview-questions
null
null
null
12/01/2011 18:58:52
not constructive
Java:Clarifications in Java Interview Questions === I recently attended the Java Interview Questions and had the below queries for which i dont know the answers 1> I have below class class CricketTeam{ String name; //this is the complete name(inclusive of first and last name) } Cricket Players name are as below: `1> Sachin Tendulkar ` `2> Gautam Gambhir ` `3> Ricky Ponting ` `4> Shahid Afridi ` `5> Kevin Pieterson ` `6> MS Dhoni ` I want to sort the above Cricket Players name by their `last name only`.Suugestions/code provided would be appreciated. 2> what are the advantages of using `enhanced for loop` against `iterator` in java.what are the advantages of using enhanced for loop in java and why was it introduced in java at the first place when the `iterator` could do the job.?
4
7,861,978
10/22/2011 19:12:31
311,168
04/07/2010 16:14:22
156
0
How Can I Escape the NBSP (&nbsp;) in Message Board
I write on a message board that displays the `&nbsp;` as a space (rightly so). But occasionally I want to actually write the NBSP as `&nbsp;` without it being rendered as a space. Is there a way to escape this so that it can be written?
escaping
render
nbsp
null
null
10/25/2011 20:33:25
off topic
How Can I Escape the NBSP (&nbsp;) in Message Board === I write on a message board that displays the `&nbsp;` as a space (rightly so). But occasionally I want to actually write the NBSP as `&nbsp;` without it being rendered as a space. Is there a way to escape this so that it can be written?
2
11,016,697
06/13/2012 14:09:54
858,345
07/22/2011 16:38:55
4
0
Sending parameters with ajax not working
I'm trying to send some variables using ajax to a php page and then displaying them in a div but it isn't working. Html code : <div id="center"> <form> <input type="text" id="toSearch" class="inputText" title="Search for ..."> <select name="thelist1" id="ecoElem" class="comboBox"> <option>-- Ecosystem Element --</option> </select> <select name="thelist2" id="ecoActor" class="comboBox"> <option>-- Ecosystem Actor --</option> </select> <input type="button" value="Search" id="searchButton" onclick="loadData();"> </form> </div> The loadData function : function loadData(){ if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else{ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } searchT = document.getElementById('toSearch').value; ecoElem = document.getElementById('ecoElem').value; ecoActor = document.getElementById('ecoActor').value; xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200){ document.getElementById('resBox').innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST","databaseRead.php",true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("text=" + searchT + "&elem=" + ecoElem + "&actor=" + ecoActor);} and finally the php page : <?php mysql_select_db('stakeholder',$connect); $searchT = $_POST['text']; $ecoElem = $_POST['elem']; $ecoActor = $_POST['actor']; echo $searchT; ?> That's it , I've been working on this for a few hours but still can't figure it out.
javascript
html
ajax
null
null
null
open
Sending parameters with ajax not working === I'm trying to send some variables using ajax to a php page and then displaying them in a div but it isn't working. Html code : <div id="center"> <form> <input type="text" id="toSearch" class="inputText" title="Search for ..."> <select name="thelist1" id="ecoElem" class="comboBox"> <option>-- Ecosystem Element --</option> </select> <select name="thelist2" id="ecoActor" class="comboBox"> <option>-- Ecosystem Actor --</option> </select> <input type="button" value="Search" id="searchButton" onclick="loadData();"> </form> </div> The loadData function : function loadData(){ if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } else{ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } searchT = document.getElementById('toSearch').value; ecoElem = document.getElementById('ecoElem').value; ecoActor = document.getElementById('ecoActor').value; xmlhttp.onreadystatechange = function(){ if (xmlhttp.readyState == 4 && xmlhttp.status == 200){ document.getElementById('resBox').innerHTML = xmlhttp.responseText; } } xmlhttp.open("POST","databaseRead.php",true); xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xmlhttp.send("text=" + searchT + "&elem=" + ecoElem + "&actor=" + ecoActor);} and finally the php page : <?php mysql_select_db('stakeholder',$connect); $searchT = $_POST['text']; $ecoElem = $_POST['elem']; $ecoActor = $_POST['actor']; echo $searchT; ?> That's it , I've been working on this for a few hours but still can't figure it out.
0
1,836,616
12/02/2009 23:26:09
223,355
12/02/2009 23:26:09
1
0
How to configure a Apache primary web server to handle the SSL connections from users (Tomcat Servlet/JSP container)
How to configure a Apache primary web server to handle the SSL connections from users (Tomcat Servlet/JSP container)
tomcat
containers
apache
null
null
null
open
How to configure a Apache primary web server to handle the SSL connections from users (Tomcat Servlet/JSP container) === How to configure a Apache primary web server to handle the SSL connections from users (Tomcat Servlet/JSP container)
0
11,453,895
07/12/2012 14:19:49
923,406
09/01/2011 12:00:57
49
2
Outlook 2010 - update Google Calendar
I use Exchange with an email account and Google Apps for bussiness with another email account. I have Outlook with TWO profiles one normal for exchange and anther with the Google update to outlook so it works direct with Google (Only available with Google Apps for Business). When I run a straight Outlook I can add to view google calendar with Add Internet calendar and it uses ical. This allows me to view the google calendar but not update it. Why can you not update Google Calendar from Outlook over the ical interface?
ms-office
google-apps
null
null
null
07/18/2012 15:08:32
off topic
Outlook 2010 - update Google Calendar === I use Exchange with an email account and Google Apps for bussiness with another email account. I have Outlook with TWO profiles one normal for exchange and anther with the Google update to outlook so it works direct with Google (Only available with Google Apps for Business). When I run a straight Outlook I can add to view google calendar with Add Internet calendar and it uses ical. This allows me to view the google calendar but not update it. Why can you not update Google Calendar from Outlook over the ical interface?
2
9,622,991
03/08/2012 18:41:00
562,910
10/25/2010 16:15:30
112
2
vim-ruby-debugger How to Set Up? "Error detected.."
With vim-ruby-debugger, I get the error below when running :Rdebugger with Rails 3 in Ubuntu in gvim What should my Gemfile look like ..do I remove ruby-debug19? ..do I add: gem 'ruby-debug-ide19', :require => 'ruby-debug-ide' Do I add anything to ~/.vimrc ? Are there clear instructions anywhere? Loading debugger... Killing server with pid 9628 Debugger started 127.0.0.1:39768 can not be opened Error detected while processing function 168..164..<SNR>38_send_message_to_debugger line 33: SystemExit: (eval):34:in `exit': exit
ruby-on-rails
vim
null
null
null
null
open
vim-ruby-debugger How to Set Up? "Error detected.." === With vim-ruby-debugger, I get the error below when running :Rdebugger with Rails 3 in Ubuntu in gvim What should my Gemfile look like ..do I remove ruby-debug19? ..do I add: gem 'ruby-debug-ide19', :require => 'ruby-debug-ide' Do I add anything to ~/.vimrc ? Are there clear instructions anywhere? Loading debugger... Killing server with pid 9628 Debugger started 127.0.0.1:39768 can not be opened Error detected while processing function 168..164..<SNR>38_send_message_to_debugger line 33: SystemExit: (eval):34:in `exit': exit
0
11,032,508
06/14/2012 11:53:11
1,166,739
01/24/2012 10:25:02
3
0
Ajax response missing the javascript code
here is my code : new Ajax.Request(product_url, { method: 'post', onSuccess: function(transport) { $$('body')[0].insert(transport.responseText); } }); } here the text i am inserting have some javascript. but i can't see javascript to body. any help ?
javascript
ajax
null
null
null
06/14/2012 12:13:22
not a real question
Ajax response missing the javascript code === here is my code : new Ajax.Request(product_url, { method: 'post', onSuccess: function(transport) { $$('body')[0].insert(transport.responseText); } }); } here the text i am inserting have some javascript. but i can't see javascript to body. any help ?
1
5,903,405
05/05/2011 20:00:04
637,364
02/28/2011 08:34:57
72
0
Can't find error in stored procedure
I can't fint the error in this code? Preciate some help! I also wonder how put values into this stored procedure from PHP/SQL <pre><code> " -- SP create new article DROP PROCEDURE IF EXISTS {$spCreateArticle}; DELIMITER // CREATE PROCEDURE {$spCreateArticle} ( IN articleUserId INT, IN articleSubject CHAR(50), IN articleText TEXT, ) BEGIN INSERT INTO {$tableArticle} (articleUserId, articleSubject, articleText, articleDate) VALUES (spArticleUserId, spArticleSubject, spArticleText, NOW()); END // DELIMITER ; ", </code></pre>
stored-procedures
null
null
null
null
null
open
Can't find error in stored procedure === I can't fint the error in this code? Preciate some help! I also wonder how put values into this stored procedure from PHP/SQL <pre><code> " -- SP create new article DROP PROCEDURE IF EXISTS {$spCreateArticle}; DELIMITER // CREATE PROCEDURE {$spCreateArticle} ( IN articleUserId INT, IN articleSubject CHAR(50), IN articleText TEXT, ) BEGIN INSERT INTO {$tableArticle} (articleUserId, articleSubject, articleText, articleDate) VALUES (spArticleUserId, spArticleSubject, spArticleText, NOW()); END // DELIMITER ; ", </code></pre>
0
10,235,214
04/19/2012 19:18:46
1,344,842
04/19/2012 18:57:03
1
0
How do I collapse multiple rows into a single row in Excel 2007?
I have a large Excel table (591 cols, 2645 rows) with a basic format that looks something like this: | Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 5 | Data 5 | |======+========+========+========+========+========+========+========| | 0.01 | 0.35 | | | | | 0.1351 | 0.2398 | | 0.02 | | 0.42 | | | | 0.4314 | 0.4342 | | 0.03 | | | 0.99 | | | 0.3414 | 0.4321 | | 0.04 | | | | 0.12 | | 0.4351 | 0.4256 | | 0.05 | | | | | 0.66 | 0.7894 | 0.9874 | This is basically a recording of a data stream where some fields are sampled only once every time step, while others are sampled on every individual time step. An entire "record", then, is recorded once the loop is finished (ie, "Data 1" is written again). The final data record, for the purposes of data processing and analysis, looks something like this: | Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 5 | Data 5 | |======+========+========+========+========+========+========+========| | 0.05 | 0.35 | 0.42 | 0.99 | 0.12 | 0.66 | 0.7894 | 0.9874 | Notice that the timestamp is equal to a timestamp found in the table, that the recurring data fields are equal to the data values at that time, and that the periodic data fields are equal to the last reported value for each of those fields. The record for a single loop then would basically consist of the final value recorded for any field within the given timeframe. I can do this easily for a single step of this, but I have 2600+ row of data to process per data set and half a dozen data sets to process. Is there a clean/simple/pragmatic way to do this across the entire data file? I could brute force this any number of ways, but I'm hoping to not have to reinvent the wheel. If I could write the output to a new worksheet, that'd be great.
excel
null
null
null
null
null
open
How do I collapse multiple rows into a single row in Excel 2007? === I have a large Excel table (591 cols, 2645 rows) with a basic format that looks something like this: | Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 5 | Data 5 | |======+========+========+========+========+========+========+========| | 0.01 | 0.35 | | | | | 0.1351 | 0.2398 | | 0.02 | | 0.42 | | | | 0.4314 | 0.4342 | | 0.03 | | | 0.99 | | | 0.3414 | 0.4321 | | 0.04 | | | | 0.12 | | 0.4351 | 0.4256 | | 0.05 | | | | | 0.66 | 0.7894 | 0.9874 | This is basically a recording of a data stream where some fields are sampled only once every time step, while others are sampled on every individual time step. An entire "record", then, is recorded once the loop is finished (ie, "Data 1" is written again). The final data record, for the purposes of data processing and analysis, looks something like this: | Time | Data 1 | Data 2 | Data 3 | Data 4 | Data 5 | Data 5 | Data 5 | |======+========+========+========+========+========+========+========| | 0.05 | 0.35 | 0.42 | 0.99 | 0.12 | 0.66 | 0.7894 | 0.9874 | Notice that the timestamp is equal to a timestamp found in the table, that the recurring data fields are equal to the data values at that time, and that the periodic data fields are equal to the last reported value for each of those fields. The record for a single loop then would basically consist of the final value recorded for any field within the given timeframe. I can do this easily for a single step of this, but I have 2600+ row of data to process per data set and half a dozen data sets to process. Is there a clean/simple/pragmatic way to do this across the entire data file? I could brute force this any number of ways, but I'm hoping to not have to reinvent the wheel. If I could write the output to a new worksheet, that'd be great.
0
3,299,109
07/21/2010 12:22:50
397,920
07/21/2010 12:17:39
1
0
How exactly javascript and DOM works .......
why DOM is required for javascript ...how exactly javascript works......I am new to this plz help Thanks
javascript
dom
null
null
null
07/21/2010 12:27:54
not a real question
How exactly javascript and DOM works ....... === why DOM is required for javascript ...how exactly javascript works......I am new to this plz help Thanks
1
10,196,239
04/17/2012 17:43:05
929,155
09/05/2011 15:43:18
61
0
Where I can learn how to implement the physics of 'Where is my water'?
I'm working on a game where the water acts as a property that can be used to solve puzzles and interact with other screen elements and I'm very much interested in learning how they managed to get such a fluid physics interaction. Can that be accomplished with Box2D using particles?
android
iphone
box2d
physics
null
04/18/2012 18:08:12
not a real question
Where I can learn how to implement the physics of 'Where is my water'? === I'm working on a game where the water acts as a property that can be used to solve puzzles and interact with other screen elements and I'm very much interested in learning how they managed to get such a fluid physics interaction. Can that be accomplished with Box2D using particles?
1
11,398,885
07/09/2012 16:03:39
809,240
06/21/2011 20:53:51
57
0
Finding path from A to B using a minimal spanning tree - C/C++
Say we find a minimal spanning tree. Now, we just need a path from A to Z in the MST. How can we do this in O(n^2) time? We start at root A. then we look at all edges in the tree of the form Ax (where x is any vertex). Then, say we find: AB, AC, AD, etc... Then for each one, we look for edges of form: Bx, Cx, Dx...this is clearly not O(n^2). So what is a better / efficient way to find path A -> Z given a MST? Thanks
c++
algorithm
tree
graph-algorithm
minimum-spanning-tree
null
open
Finding path from A to B using a minimal spanning tree - C/C++ === Say we find a minimal spanning tree. Now, we just need a path from A to Z in the MST. How can we do this in O(n^2) time? We start at root A. then we look at all edges in the tree of the form Ax (where x is any vertex). Then, say we find: AB, AC, AD, etc... Then for each one, we look for edges of form: Bx, Cx, Dx...this is clearly not O(n^2). So what is a better / efficient way to find path A -> Z given a MST? Thanks
0
8,009,920
11/04/2011 13:30:27
1,001,425
10/18/2011 15:03:36
1
0
Presta Shop module
i am currently creating a webstore with prestashop and i would like to add the functionality for grouping features. Do you know any module for that?Thank you in advance.
prestashop
null
null
null
null
02/02/2012 14:06:09
off topic
Presta Shop module === i am currently creating a webstore with prestashop and i would like to add the functionality for grouping features. Do you know any module for that?Thank you in advance.
2
724,251
04/07/2009 05:35:57
69,803
02/23/2009 08:38:02
142
11
Best ajax framework for drag and drop support
I have to build an app and the drag and drop functionality seems to be the most onerous part. What is the best Ajax framework for Drag and Drop according to one or more of the following parameters: 1. Learning curve 2. Code size 3. Browser compatibility
ajax
drag-and-drop
null
null
null
09/20/2011 14:17:11
not constructive
Best ajax framework for drag and drop support === I have to build an app and the drag and drop functionality seems to be the most onerous part. What is the best Ajax framework for Drag and Drop according to one or more of the following parameters: 1. Learning curve 2. Code size 3. Browser compatibility
4
8,276,034
11/26/2011 03:24:36
504,482
11/11/2010 12:15:30
17
1
Entering data for a ManyToMany relation with an intermediary model, which itself has a manytomany field
My situation should be fairly common: I want to save a model from a form, where the user needs to choose one or more choices for a many to many relation, and then for each of these choices choose one or more additional values that characterize the relation. For example, you have a customer object, which can select several destinations, and for each destination they can select several activities: someone visited Miami and did kayaking and karaoke, and Cancun and did snorkelling and horse-riding These would be the relevant models: class Customer(models.Model): name = models.CharField() destinations = models.ManytoManyField(Destination, through='VistitorDestination')) class Destination(models.Model): destination = models.CharField() class Activity(models.Model): activity = models.CharField() # Intermediary Model class VisitorDestination(models.Model): customer = models.ForeignKey(Customer) destination = models.ForeignKey(Destionation) # aditional details activities = models.ManytoManyField(Activity) I tried to set up a form: destinationChoices = [(o.pk, o.destination) for o in Destination.objects.all()] class VisitorForm(ProfileForm): destinations = forms.MultipleChoiceField(choices=destinationChoices, widget=forms.CheckboxSelectMultiple) activities = ? class Meta: model = visitor and view to edit / enter details for a visitor: def edit_visitor(request): visitor = request.user.get_profile() if request.method == 'POST': form = form_class(data=request.POST, files=request.FILES, instance=visitor) if form.is_valid(): visitor = form.save(commit=False) visitor.save() # first remove any existing VisitorDestination entries for this visitor visitor.destinations.clear() for destination_pk in form.cleaned_data['destinations']: destination= Destination.objects.get(pk=destination_pk) activity = ? visitorDestination= TeacherSubject(visitor=visitor, destination=destination, activity=?) visitorDestination.save() return HttpResponseRedirect(success_url) else: form = form_class(instance=visitor) context = RequestContext(request) return render_to_response(template_name, { 'form': form, 'visitor': visitor, }, context_instance=context) But I don't know how to include the additional m2m in the through table, or which widget to use for it. In fact, can it be done in a single go, or would you have to enter a visitor object first, and then use a separate form to enter the visitor-destination info? Any suggestions welcome! Thanks
django
django-forms
many-to-many
null
null
null
open
Entering data for a ManyToMany relation with an intermediary model, which itself has a manytomany field === My situation should be fairly common: I want to save a model from a form, where the user needs to choose one or more choices for a many to many relation, and then for each of these choices choose one or more additional values that characterize the relation. For example, you have a customer object, which can select several destinations, and for each destination they can select several activities: someone visited Miami and did kayaking and karaoke, and Cancun and did snorkelling and horse-riding These would be the relevant models: class Customer(models.Model): name = models.CharField() destinations = models.ManytoManyField(Destination, through='VistitorDestination')) class Destination(models.Model): destination = models.CharField() class Activity(models.Model): activity = models.CharField() # Intermediary Model class VisitorDestination(models.Model): customer = models.ForeignKey(Customer) destination = models.ForeignKey(Destionation) # aditional details activities = models.ManytoManyField(Activity) I tried to set up a form: destinationChoices = [(o.pk, o.destination) for o in Destination.objects.all()] class VisitorForm(ProfileForm): destinations = forms.MultipleChoiceField(choices=destinationChoices, widget=forms.CheckboxSelectMultiple) activities = ? class Meta: model = visitor and view to edit / enter details for a visitor: def edit_visitor(request): visitor = request.user.get_profile() if request.method == 'POST': form = form_class(data=request.POST, files=request.FILES, instance=visitor) if form.is_valid(): visitor = form.save(commit=False) visitor.save() # first remove any existing VisitorDestination entries for this visitor visitor.destinations.clear() for destination_pk in form.cleaned_data['destinations']: destination= Destination.objects.get(pk=destination_pk) activity = ? visitorDestination= TeacherSubject(visitor=visitor, destination=destination, activity=?) visitorDestination.save() return HttpResponseRedirect(success_url) else: form = form_class(instance=visitor) context = RequestContext(request) return render_to_response(template_name, { 'form': form, 'visitor': visitor, }, context_instance=context) But I don't know how to include the additional m2m in the through table, or which widget to use for it. In fact, can it be done in a single go, or would you have to enter a visitor object first, and then use a separate form to enter the visitor-destination info? Any suggestions welcome! Thanks
0
5,581,890
04/07/2011 13:30:48
696,889
04/07/2011 13:30:48
1
0
Sorting from Alphanumeric to nonAlphnumeric
I have a array of data: ! A B E $ N I'd like it to be sorted from Alphanumeric to Non-Alphanumeric. Example: A B E N ! $ How would I go about accomplishing this?
c#
sorting
null
null
null
null
open
Sorting from Alphanumeric to nonAlphnumeric === I have a array of data: ! A B E $ N I'd like it to be sorted from Alphanumeric to Non-Alphanumeric. Example: A B E N ! $ How would I go about accomplishing this?
0
9,275,873
02/14/2012 11:13:10
1,208,910
02/14/2012 11:05:03
1
0
Euler angles and extrude direction
I'm creating a c++ ifc importer. I have a direction vector ,long this I'm extrude a section, the section is a list of 2d points. For calculate the extrusion direction i have to multiplicate a non trasformed direction for a trasformation matrix. This matrix have the trasformation in x,y and z(like euler angles). I must calculate the rotation angle around the extrude direction, I have a matrix class that returns the euler angles from a matrix(matrix.ExtractEulerXYZ(x,y,z)). The problem is that I can have a direction vector that have a rotation in x or y or z , how i can select the correct angle from x,y or z from the extrude direction? Thanks.
c++
null
null
null
null
null
open
Euler angles and extrude direction === I'm creating a c++ ifc importer. I have a direction vector ,long this I'm extrude a section, the section is a list of 2d points. For calculate the extrusion direction i have to multiplicate a non trasformed direction for a trasformation matrix. This matrix have the trasformation in x,y and z(like euler angles). I must calculate the rotation angle around the extrude direction, I have a matrix class that returns the euler angles from a matrix(matrix.ExtractEulerXYZ(x,y,z)). The problem is that I can have a direction vector that have a rotation in x or y or z , how i can select the correct angle from x,y or z from the extrude direction? Thanks.
0
4,573,662
01/01/2011 09:25:30
555,910
12/28/2010 11:05:57
9
0
any body knows if there any real biometrics application such as face recognition ,voice recognition,iris recognition is available for android mobile?
any body knows if there any real biometrics application such as face recognition ,voice recognition,iris recognition is available for android mobile? or this features are in build in any other android mobile?please help me
android
biometrics
null
null
null
01/02/2011 07:38:41
off topic
any body knows if there any real biometrics application such as face recognition ,voice recognition,iris recognition is available for android mobile? === any body knows if there any real biometrics application such as face recognition ,voice recognition,iris recognition is available for android mobile? or this features are in build in any other android mobile?please help me
2
9,935,455
03/30/2012 00:21:34
1,269,686
03/14/2012 17:25:22
1
0
Android OutOfMemoryError when loading GridView bitmaps
I'm trying to load some very small images (average size is 90kb) into a gridview in Android. Whenever I load more than 9 images then I am getting memory issues. I have tried scaling the images to a smaller size and although this works to a certain extent it is not really a true solution as the picture quality is awful. The code is below private Context mContext; private ArrayList<Bitmap> photos = new ArrayList<Bitmap>(); public Bitmap [] mThumbIds; public ImageAdapter(Context c) { mContext = c; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } public Bitmap scaleBitmap(String imagePath) { Bitmap resizedBitmap = null; try { int inWidth = 0; int inHeight = 0; InputStream in; in = new FileInputStream(imagePath); // decode image size (decode metadata only, not the whole image) BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(in, null, options); in.close(); in = null; // save width and height inWidth = options.outWidth; inHeight = options.outHeight; // decode full image pre-resized in = new FileInputStream(imagePath); options = new BitmapFactory.Options(); // calc rought re-size (this is no exact resize) options.inSampleSize = Math.max(inWidth/300, inHeight/300); // decode full image Bitmap roughBitmap = BitmapFactory.decodeStream(in, null, options); // calc exact destination size Matrix m = new Matrix(); RectF inRect = new RectF(0, 0, roughBitmap.getWidth(), roughBitmap.getHeight()); RectF outRect = new RectF(0, 0, 300, 300); m.setRectToRect(inRect, outRect, Matrix.ScaleToFit.CENTER); float[] values = new float[9]; m.getValues(values); // resize bitmap resizedBitmap = Bitmap.createScaledBitmap(roughBitmap, (int) (roughBitmap.getWidth() * values[0]), (int) (roughBitmap.getHeight() * values[4]), true); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return resizedBitmap; } public void populateGrid() { File sdDir = new File("mnt/sdcard/Pictures"); File[] sdDirFiles = sdDir.listFiles(); for(File singleFile : sdDirFiles) { String filePath = singleFile.getAbsolutePath(); Bitmap bmp = scaleBitmap(filePath); photos.add(bmp); } mThumbIds = photos.toArray(new Bitmap[(photos.size())]); } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } imageView.setImageBitmap(mThumbIds[position]); return imageView; } @Override public int getCount() { return mThumbIds.length; } } Any help would be greatly appreciated.
android
memory
null
null
null
null
open
Android OutOfMemoryError when loading GridView bitmaps === I'm trying to load some very small images (average size is 90kb) into a gridview in Android. Whenever I load more than 9 images then I am getting memory issues. I have tried scaling the images to a smaller size and although this works to a certain extent it is not really a true solution as the picture quality is awful. The code is below private Context mContext; private ArrayList<Bitmap> photos = new ArrayList<Bitmap>(); public Bitmap [] mThumbIds; public ImageAdapter(Context c) { mContext = c; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } public Bitmap scaleBitmap(String imagePath) { Bitmap resizedBitmap = null; try { int inWidth = 0; int inHeight = 0; InputStream in; in = new FileInputStream(imagePath); // decode image size (decode metadata only, not the whole image) BitmapFactory.Options options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(in, null, options); in.close(); in = null; // save width and height inWidth = options.outWidth; inHeight = options.outHeight; // decode full image pre-resized in = new FileInputStream(imagePath); options = new BitmapFactory.Options(); // calc rought re-size (this is no exact resize) options.inSampleSize = Math.max(inWidth/300, inHeight/300); // decode full image Bitmap roughBitmap = BitmapFactory.decodeStream(in, null, options); // calc exact destination size Matrix m = new Matrix(); RectF inRect = new RectF(0, 0, roughBitmap.getWidth(), roughBitmap.getHeight()); RectF outRect = new RectF(0, 0, 300, 300); m.setRectToRect(inRect, outRect, Matrix.ScaleToFit.CENTER); float[] values = new float[9]; m.getValues(values); // resize bitmap resizedBitmap = Bitmap.createScaledBitmap(roughBitmap, (int) (roughBitmap.getWidth() * values[0]), (int) (roughBitmap.getHeight() * values[4]), true); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return resizedBitmap; } public void populateGrid() { File sdDir = new File("mnt/sdcard/Pictures"); File[] sdDirFiles = sdDir.listFiles(); for(File singleFile : sdDirFiles) { String filePath = singleFile.getAbsolutePath(); Bitmap bmp = scaleBitmap(filePath); photos.add(bmp); } mThumbIds = photos.toArray(new Bitmap[(photos.size())]); } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } imageView.setImageBitmap(mThumbIds[position]); return imageView; } @Override public int getCount() { return mThumbIds.length; } } Any help would be greatly appreciated.
0
6,911,043
08/02/2011 11:06:43
618,685
02/15/2011 22:31:32
277
19
Which language and ORM to use with existing SQL database? (schema reflection)
I build integrations with *already existing* SQL databases. Ofter raw SQL queries do the trick but some task call for an ORM. Most ORM in turn require defining the whole schema redundantly in the code. Which (scripting?) language / ORM is subjectively nicest for working with existing databases without redefining the whole schema? I know that e.g. [SQLAlchemy can reflect database schema][1], but still seems to require defining table relationships by hand ([another question][2]). Object relationships are already defined in SQL Foreign Keys. [1]: http://www.sqlalchemy.org/docs/core/schema.html#metadata-reflection [2]: http://stackoverflow.com/questions/6777524/how-to-automatically-reflect-table-relationships-in-sqlalchemy-or-sqlsoup-orm
sql
orm
data
foreign-keys
null
08/02/2011 11:10:26
not constructive
Which language and ORM to use with existing SQL database? (schema reflection) === I build integrations with *already existing* SQL databases. Ofter raw SQL queries do the trick but some task call for an ORM. Most ORM in turn require defining the whole schema redundantly in the code. Which (scripting?) language / ORM is subjectively nicest for working with existing databases without redefining the whole schema? I know that e.g. [SQLAlchemy can reflect database schema][1], but still seems to require defining table relationships by hand ([another question][2]). Object relationships are already defined in SQL Foreign Keys. [1]: http://www.sqlalchemy.org/docs/core/schema.html#metadata-reflection [2]: http://stackoverflow.com/questions/6777524/how-to-automatically-reflect-table-relationships-in-sqlalchemy-or-sqlsoup-orm
4
9,097,294
02/01/2012 14:15:50
1,057,002
11/21/2011 01:18:40
6
0
How to change page url?
How to get page url and then rename the url based on query result at a time in the address bar ?
php
html
null
null
null
02/02/2012 12:35:42
not a real question
How to change page url? === How to get page url and then rename the url based on query result at a time in the address bar ?
1
11,708,507
07/29/2012 10:29:06
1,271,518
03/15/2012 12:34:27
61
0
backbone.js - can't get rid of the outter div of the view
I'm using Backbone 0.9.2 and I have a mustache template that uses twitter bootstrap and looks something like this: <div class="modal hide something" id="something-modal"> ... </div> I tried getting rid of the extra "div" that backbone adds, because i want the view to be 1-to-1 as my template. My render function looks something like: render: function(){ var $content = $(this.template()), existing_spots = $content.find('.spots-list'), new_spot; this.collection.each(function (spot) { new_sweetspot = new SpotView({ model: spot }); existing_spots.append(new_spot.render().el); }); $content.find("[rel=tooltip]").tooltip(); this.setElementsBindings($content); //this.$el.html($content).unwrap('div'); // didn't work! this.$el.html($content); console.log(this.$el); return this; } I know that by adding: tagName: "div", className: "modal", for example i'll get rid of it, but i want the control of the view's elements to be of the template, not of the JS code. this.SetElement will cause the list NOT to be updated (it'll be empty), this.$el = $content; won't work as well. Thanks in advance.
javascript
backbone.js
null
null
null
null
open
backbone.js - can't get rid of the outter div of the view === I'm using Backbone 0.9.2 and I have a mustache template that uses twitter bootstrap and looks something like this: <div class="modal hide something" id="something-modal"> ... </div> I tried getting rid of the extra "div" that backbone adds, because i want the view to be 1-to-1 as my template. My render function looks something like: render: function(){ var $content = $(this.template()), existing_spots = $content.find('.spots-list'), new_spot; this.collection.each(function (spot) { new_sweetspot = new SpotView({ model: spot }); existing_spots.append(new_spot.render().el); }); $content.find("[rel=tooltip]").tooltip(); this.setElementsBindings($content); //this.$el.html($content).unwrap('div'); // didn't work! this.$el.html($content); console.log(this.$el); return this; } I know that by adding: tagName: "div", className: "modal", for example i'll get rid of it, but i want the control of the view's elements to be of the template, not of the JS code. this.SetElement will cause the list NOT to be updated (it'll be empty), this.$el = $content; won't work as well. Thanks in advance.
0
8,059,355
11/09/2011 01:29:23
149,522
08/03/2009 06:15:42
497
3
Need program or scripts for automating backup archive retention and deletion
We have a dedicated backup server with a few TB of disk that runs nightly NTBACKUP and SQL Server backup jobs against the production servers and collects the resulting backup files for archiving. Problem is, we don't have a good method for handing archive retention once we've collected the backup data. We are trying to use some DOS scripts to move files around and delete old ones, but it isn't working well and we want a clean solution. We have two basic policies: 1. For NTBACKUP, take one full backup on the first day of the month, incremental backups each night, retaining three months' backups on the server. 2. For SQL Server backups, take a full backup every night, retaining one week's worth of full backups plus three months' backup from the first day of the month. Transaction logs are taken every 15 minutes, and we retain only the previous day's transaction logs. ...and two basic questions: 1. Are these reasonable retention policies? Any better suggestions? 2. Is there a simple tool, script, or product out there that can automate this for us?
windows
backup
null
null
null
11/10/2011 20:47:50
off topic
Need program or scripts for automating backup archive retention and deletion === We have a dedicated backup server with a few TB of disk that runs nightly NTBACKUP and SQL Server backup jobs against the production servers and collects the resulting backup files for archiving. Problem is, we don't have a good method for handing archive retention once we've collected the backup data. We are trying to use some DOS scripts to move files around and delete old ones, but it isn't working well and we want a clean solution. We have two basic policies: 1. For NTBACKUP, take one full backup on the first day of the month, incremental backups each night, retaining three months' backups on the server. 2. For SQL Server backups, take a full backup every night, retaining one week's worth of full backups plus three months' backup from the first day of the month. Transaction logs are taken every 15 minutes, and we retain only the previous day's transaction logs. ...and two basic questions: 1. Are these reasonable retention policies? Any better suggestions? 2. Is there a simple tool, script, or product out there that can automate this for us?
2
7,911,508
10/27/2011 03:46:52
13,760
09/16/2008 20:47:33
1,558
45
Are there any bad design patterns?
There are a lot of design patterns and its pretty obvious that the patterns themselves are not silver bullets. However, in your experience, have there been any patterns that have consistently resulted in problems further on? I guess I'm asking if there are certain patterns that after some time turn from a solution into a problem in their own right?
design
design-patterns
null
null
null
10/27/2011 05:05:18
not constructive
Are there any bad design patterns? === There are a lot of design patterns and its pretty obvious that the patterns themselves are not silver bullets. However, in your experience, have there been any patterns that have consistently resulted in problems further on? I guess I'm asking if there are certain patterns that after some time turn from a solution into a problem in their own right?
4
3,569,183
08/25/2010 18:44:02
364,969
06/11/2010 22:22:36
219
1
Intended URL redirect + default redirect after login?
When a user tries to access our website via a link (for instance going to www.website.com/privatepage) they are redirected to a login page. Once they login, we want to redirect them to that intended URL - how do you do this? Also we have a use case where a user logs in from the homepage, or goes directly to the login page with no intended URL - in this case we'd like to redirect them to a default page. Can anyone help me figure this out? Thanks, Walker
php
javascript
html
codeigniter
redirect
null
open
Intended URL redirect + default redirect after login? === When a user tries to access our website via a link (for instance going to www.website.com/privatepage) they are redirected to a login page. Once they login, we want to redirect them to that intended URL - how do you do this? Also we have a use case where a user logs in from the homepage, or goes directly to the login page with no intended URL - in this case we'd like to redirect them to a default page. Can anyone help me figure this out? Thanks, Walker
0
6,823,069
07/25/2011 22:19:29
544,941
12/16/2010 15:13:30
32
0
Why shouldn't I use tabs for indentation?
In the Ruby community "everyone" is using spaces (mostly two spaces) for indentation. Since I prefer an indentation level of four spaces I use tabs instead. I think tabs are great because they let the editor show your preferred indentation level. Those who want to read my code with an indentation level of two spaces can easily do that without modifying the file. But clearly I'm missing something obvious here, since nobody else is using tabs for indentation. For example, [these guidelines](http://www.caliban.org/ruby/rubyguide.shtml#indentation) recommends you to never use tabs, since they "include the practice of mixing tabs with spaces"(?) I can't remember that I have done that a single time in my whole life. Does anyone else got better arguments for spaces? There has to be, since everyone is using them.
ruby
indentation
null
null
null
07/25/2011 23:02:16
off topic
Why shouldn't I use tabs for indentation? === In the Ruby community "everyone" is using spaces (mostly two spaces) for indentation. Since I prefer an indentation level of four spaces I use tabs instead. I think tabs are great because they let the editor show your preferred indentation level. Those who want to read my code with an indentation level of two spaces can easily do that without modifying the file. But clearly I'm missing something obvious here, since nobody else is using tabs for indentation. For example, [these guidelines](http://www.caliban.org/ruby/rubyguide.shtml#indentation) recommends you to never use tabs, since they "include the practice of mixing tabs with spaces"(?) I can't remember that I have done that a single time in my whole life. Does anyone else got better arguments for spaces? There has to be, since everyone is using them.
2
11,542,730
07/18/2012 13:37:30
611,020
02/10/2011 08:15:49
80
4
Google maps plugin, show user logged in right now
The plugin is based on Google Maps and turns it and shows on the map the place from where last comment was done by some user. So the map is interactive it turns like every second to a new location from where some request just came.
google-maps
google-maps-api-3
null
null
null
07/18/2012 14:17:09
off topic
Google maps plugin, show user logged in right now === The plugin is based on Google Maps and turns it and shows on the map the place from where last comment was done by some user. So the map is interactive it turns like every second to a new location from where some request just came.
2
10,466,741
05/05/2012 23:14:23
393,406
07/16/2010 02:04:05
2,101
89
jQuery/Sizzle to select Text nodes only (or, how to transform XPath expression to Sizzle)
I have the following XPath expression to get all `textNodes` within a element. var textnodes = document.evaluate('descendant::text()', element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); Which works flawlessly across Chrome and Firefox, but IE. Since Sizzle is browser-proof, I wanted to know, is there a way to select textNodes only with Sizzle/jQuery? As we all know, IE is a big deal, and there is no XPath for IE9 too (what about 10th?). Or, in other words, how would I transform my XPath expression to Sizzle?
javascript
jquery
xpath
sizzle
null
null
open
jQuery/Sizzle to select Text nodes only (or, how to transform XPath expression to Sizzle) === I have the following XPath expression to get all `textNodes` within a element. var textnodes = document.evaluate('descendant::text()', element, null, XPathResult.ORDERED_NODE_ITERATOR_TYPE, null); Which works flawlessly across Chrome and Firefox, but IE. Since Sizzle is browser-proof, I wanted to know, is there a way to select textNodes only with Sizzle/jQuery? As we all know, IE is a big deal, and there is no XPath for IE9 too (what about 10th?). Or, in other words, how would I transform my XPath expression to Sizzle?
0