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
10,908,949
06/06/2012 06:06:48
885,321
08/09/2011 06:06:17
8
2
Generic Dialog Ok not triggered the second time
i have created a static instance of a generic dialog in my program static GenericDialog SaveDialog = null; and below is the code to display the dialog public boolean DispSaveDialog() { //gd.addStringField("Identity : ", "annot"); if(SaveDialog == null) { SaveDialog = new GenericDialog("Save"); Panel idnPanel = new Panel(); idnPanel.add(new Label("Identity")); idnTextComp = new TextField("annot"); csPrefix = idnTextComp.getText(); TextListener tl = new TextListener() { @Override public void textValueChanged(TextEvent e) { // TODO Auto-generated method stub csPrefix = idnTextComp.getText(); } }; idnTextComp.addTextListener(tl); idnPanel.add(idnTextComp); SaveDialog.addPanel(idnPanel); final TextComponent textComponent = new TextField(); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String label = e.getActionCommand(); //csPrefix = gd.getNextString(); if (label=="Browse") { String csFilename = imp.getTitle(); csTextFileName = FileNameProcess( csFilename ); } textComponent.setText(csTextFileName); } }; Button btBrowse = new Button("Browse"); btBrowse.addActionListener(al); Panel panel = new Panel(); panel.add(new Label("Folder : ")); //textComponent.setBounds(gd.getBounds()); panel.add(textComponent); panel.add( btBrowse ); SaveDialog.addPanel(panel); } SaveDialog.showDialog(); return true; } the issue i am facing is, when i open the dialog the second time, the OK and Cancel events are not triggered. i have a feeling that the issue is silly, sorry and thanks in advance.
java
imagej
null
null
null
null
open
Generic Dialog Ok not triggered the second time === i have created a static instance of a generic dialog in my program static GenericDialog SaveDialog = null; and below is the code to display the dialog public boolean DispSaveDialog() { //gd.addStringField("Identity : ", "annot"); if(SaveDialog == null) { SaveDialog = new GenericDialog("Save"); Panel idnPanel = new Panel(); idnPanel.add(new Label("Identity")); idnTextComp = new TextField("annot"); csPrefix = idnTextComp.getText(); TextListener tl = new TextListener() { @Override public void textValueChanged(TextEvent e) { // TODO Auto-generated method stub csPrefix = idnTextComp.getText(); } }; idnTextComp.addTextListener(tl); idnPanel.add(idnTextComp); SaveDialog.addPanel(idnPanel); final TextComponent textComponent = new TextField(); ActionListener al = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String label = e.getActionCommand(); //csPrefix = gd.getNextString(); if (label=="Browse") { String csFilename = imp.getTitle(); csTextFileName = FileNameProcess( csFilename ); } textComponent.setText(csTextFileName); } }; Button btBrowse = new Button("Browse"); btBrowse.addActionListener(al); Panel panel = new Panel(); panel.add(new Label("Folder : ")); //textComponent.setBounds(gd.getBounds()); panel.add(textComponent); panel.add( btBrowse ); SaveDialog.addPanel(panel); } SaveDialog.showDialog(); return true; } the issue i am facing is, when i open the dialog the second time, the OK and Cancel events are not triggered. i have a feeling that the issue is silly, sorry and thanks in advance.
0
9,688,269
03/13/2012 16:41:37
1,266,991
03/13/2012 16:25:40
1
0
.Net CodeBase element
I have reviewed serveral other posts about how to get the CLR to find an assembly that is not in the same folder or any subfolder of the executable and am unable to get it to work for me. ClassLibrary1.dll is an unsigned assembly. The examples show: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ClassLibrary1"/> <codeBase version="1.0.0.0" href=file:///C:\somepath\subfolder\ClassLibrary1.dll"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> I created a console application and put the above with the proper path in its configuration file, but still get a message indicating that it cannot find ClassLibrary1.dll. I used FUSLOGVW and it did not even check in the folder supplied in the CodeBase element. Does anyone know why this does not work? Thanks in advance, Ken
.net
null
null
null
null
null
open
.Net CodeBase element === I have reviewed serveral other posts about how to get the CLR to find an assembly that is not in the same folder or any subfolder of the executable and am unable to get it to work for me. ClassLibrary1.dll is an unsigned assembly. The examples show: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ClassLibrary1"/> <codeBase version="1.0.0.0" href=file:///C:\somepath\subfolder\ClassLibrary1.dll"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> I created a console application and put the above with the proper path in its configuration file, but still get a message indicating that it cannot find ClassLibrary1.dll. I used FUSLOGVW and it did not even check in the folder supplied in the CodeBase element. Does anyone know why this does not work? Thanks in advance, Ken
0
11,559,911
07/19/2012 11:29:14
549,720
12/21/2010 09:33:42
23
2
Should we write new Java Appengine book now?
We have 4 years working witn java appengine . Old appenigne ebboks is outofdate . For 4 years appengine have many change ( price model is biggest changes ) Should we write new Java Appengine book now ? And who can donate for this work ?
google-app-engine
null
null
null
null
07/20/2012 02:07:56
not a real question
Should we write new Java Appengine book now? === We have 4 years working witn java appengine . Old appenigne ebboks is outofdate . For 4 years appengine have many change ( price model is biggest changes ) Should we write new Java Appengine book now ? And who can donate for this work ?
1
3,645,485
09/05/2010 08:35:59
173,634
09/15/2009 10:21:27
127
0
Different outcome between a user clicking a jQuery UI button and using jQuery click() on it?
I have a form to create a Ruby on Rails object. A part of the form uses radio buttons to choose an attribute. I then use [jQuery UI to display the buttons][1], like so. <head> <script type="text/javascript"> $(document).ready(function() { $("#typeRadios").buttonset(); }); </script> </head> <body> <div id="typeRadios"> <input id="character_chartype_a" name="character[chartype]" type="radio" value="A" /><label for="character_chartype_a">A</label> <input id="character_chartype_a" name="character[chartype]" type="radio" value="B" /><label for="character_chartype_b">B</label> </div> </body> This all works fine. I click a button, and then when the form is submitted the attribute is saved correctly. The problem is, I need to be able to click one of the buttons programmatically. At the moment, I'm doing this: // data.chartype = a $("label[for='character_chartype_"+data.chartype+"']").click(); This works in the sense that visually the button appears clicked, but when the form is submitted, the attribute isn't saved. What is causing this behaviour? Thanks for reading. [1]: http://jqueryui.com/demos/button/#radio
jquery
jquery-ui
button
click
null
null
open
Different outcome between a user clicking a jQuery UI button and using jQuery click() on it? === I have a form to create a Ruby on Rails object. A part of the form uses radio buttons to choose an attribute. I then use [jQuery UI to display the buttons][1], like so. <head> <script type="text/javascript"> $(document).ready(function() { $("#typeRadios").buttonset(); }); </script> </head> <body> <div id="typeRadios"> <input id="character_chartype_a" name="character[chartype]" type="radio" value="A" /><label for="character_chartype_a">A</label> <input id="character_chartype_a" name="character[chartype]" type="radio" value="B" /><label for="character_chartype_b">B</label> </div> </body> This all works fine. I click a button, and then when the form is submitted the attribute is saved correctly. The problem is, I need to be able to click one of the buttons programmatically. At the moment, I'm doing this: // data.chartype = a $("label[for='character_chartype_"+data.chartype+"']").click(); This works in the sense that visually the button appears clicked, but when the form is submitted, the attribute isn't saved. What is causing this behaviour? Thanks for reading. [1]: http://jqueryui.com/demos/button/#radio
0
6,290,782
06/09/2011 09:34:08
623,784
02/18/2011 20:52:15
13
1
Question about UIWebview and Universal Application
I have an Universal Application and my question is, if it is possible to load two different html files in my UIWebview depending on the iDevice. Thanks for any answers.
iphone
html
uiwebview
universal
null
null
open
Question about UIWebview and Universal Application === I have an Universal Application and my question is, if it is possible to load two different html files in my UIWebview depending on the iDevice. Thanks for any answers.
0
6,406,792
06/20/2011 04:23:00
804,781
06/18/2011 18:58:54
8
0
CSS positioning for screen resolution
I would to know how can i make this CSS code fit into any resolution? Thank you body { font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:50px; } .output-div-container { border:1px solid silver; background-color:#F8F8F8; padding:10px; } .input-div { text-align:center; background-color:#FEFFF0; border:1px solid #868A15; padding:5px; } .ajax-div { margin:50px; border:1px solid #3333CC; background-color: #6699FF; padding:3px; width : 500px; } #box { width : 270px; height : auto; overflow : auto ; border : 1px solid #C5C5C5; background : #F8F8F8; position : absolute; left : 460px; top : 286px; border-top : none; text-align : left; display : none; } tr { cursor : pointer; }
css
screen-resolution
null
null
null
04/22/2012 08:51:33
too localized
CSS positioning for screen resolution === I would to know how can i make this CSS code fit into any resolution? Thank you body { font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:50px; } .output-div-container { border:1px solid silver; background-color:#F8F8F8; padding:10px; } .input-div { text-align:center; background-color:#FEFFF0; border:1px solid #868A15; padding:5px; } .ajax-div { margin:50px; border:1px solid #3333CC; background-color: #6699FF; padding:3px; width : 500px; } #box { width : 270px; height : auto; overflow : auto ; border : 1px solid #C5C5C5; background : #F8F8F8; position : absolute; left : 460px; top : 286px; border-top : none; text-align : left; display : none; } tr { cursor : pointer; }
3
11,602,979
07/22/2012 18:41:01
960,485
09/23/2011 05:46:23
331
0
Attempted to read or write protected memory. This is often an indication that other memory is corrupt
I have rdcl reports in my Windows application. When i try to export it into PDF of Excel it throws an error saying "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." what can be a reason ? and how to solve it? Thanks
c#
.net
winforms
null
null
07/23/2012 11:21:12
not a real question
Attempted to read or write protected memory. This is often an indication that other memory is corrupt === I have rdcl reports in my Windows application. When i try to export it into PDF of Excel it throws an error saying "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." what can be a reason ? and how to solve it? Thanks
1
2,417,203
03/10/2010 13:33:51
245,549
01/07/2010 13:20:49
696
1
Interplay between visibility of class and fields.
I learned that a class can be either public or package-private (the last value is the default one). A field of a class also can be either public or package-private. These "statuses" have the same meaning. If something is package-private it is visible only within the same class. It is public it is visible from everywhere (from any package). What is not clear to me is how these statuses interplay. In particular I have interest in the following two cases: 1. The class is public but its field is package private. Will be this field visible only from within the package? 2. The class is package-private and it has a public field. Where will be sing this field? In general I do not understand why we bother if a class is public or package-private if, in any case, for any individual component of a class (field and methods) we indicate if it is public or package-private.
java
publik
packages
visibility
null
null
open
Interplay between visibility of class and fields. === I learned that a class can be either public or package-private (the last value is the default one). A field of a class also can be either public or package-private. These "statuses" have the same meaning. If something is package-private it is visible only within the same class. It is public it is visible from everywhere (from any package). What is not clear to me is how these statuses interplay. In particular I have interest in the following two cases: 1. The class is public but its field is package private. Will be this field visible only from within the package? 2. The class is package-private and it has a public field. Where will be sing this field? In general I do not understand why we bother if a class is public or package-private if, in any case, for any individual component of a class (field and methods) we indicate if it is public or package-private.
0
2,455,786
03/16/2010 15:42:54
265,143
02/03/2010 09:44:42
5,608
192
Career Day in kindergarten: how to demonstrate programming in 20 minutes?
I was invited to the kindergarten group of my elder daughter to talk, and aswer the kids' questions, about my profession. There are 26 kids of age 4-6 in the group (plus 3 teachers who are fairly scared of anything related to programming and IT themselves, but bold enough to learn new tricks). I would have about 20-30 minutes, without projector or anything. (They have an old computer though, which by its look may be a 486, and I am not even sure if it's functioning.) My research turned up excellent earlier threads, with lots of good tips: > [How would you explain your job to a 5-year old?][1] > [Career Day: how do I make “computer programmer” sound cool to 8 year olds?][2] > [What things can I teach a group of children about programming in one day?][3] My situation is different from each of the above though. So any advice on **how to teach the kids (and their teachers) in a fun way about programming** is appreciated. [1]: http://stackoverflow.com/questions/526357/how-would-you-explain-your-job-to-a-5-year-old [2]: http://stackoverflow.com/questions/207278/career-day-how-do-i-make-computer-programmer-sound-cool-to-8-year-olds [3]: http://stackoverflow.com/questions/2427799/what-things-can-i-teach-a-group-of-children-about-programming-in-one-day
kids
children
teaching
subjective
null
03/07/2012 11:38:40
not constructive
Career Day in kindergarten: how to demonstrate programming in 20 minutes? === I was invited to the kindergarten group of my elder daughter to talk, and aswer the kids' questions, about my profession. There are 26 kids of age 4-6 in the group (plus 3 teachers who are fairly scared of anything related to programming and IT themselves, but bold enough to learn new tricks). I would have about 20-30 minutes, without projector or anything. (They have an old computer though, which by its look may be a 486, and I am not even sure if it's functioning.) My research turned up excellent earlier threads, with lots of good tips: > [How would you explain your job to a 5-year old?][1] > [Career Day: how do I make “computer programmer” sound cool to 8 year olds?][2] > [What things can I teach a group of children about programming in one day?][3] My situation is different from each of the above though. So any advice on **how to teach the kids (and their teachers) in a fun way about programming** is appreciated. [1]: http://stackoverflow.com/questions/526357/how-would-you-explain-your-job-to-a-5-year-old [2]: http://stackoverflow.com/questions/207278/career-day-how-do-i-make-computer-programmer-sound-cool-to-8-year-olds [3]: http://stackoverflow.com/questions/2427799/what-things-can-i-teach-a-group-of-children-about-programming-in-one-day
4
8,927,486
01/19/2012 14:11:49
734,630
05/02/2011 14:42:12
147
4
updating records with prepared statements, checking if update worked
I have a query that updates a record on my database, it works fine but i wanted to know how to check if the update has happened so i can return true and display the right message? Now i know with a SELECT query i can do: if(stmt->fetch()) If that is true i return true and saying "records found" but i haven't got a clue how to do it for an update query? Anyone know how to? $query = "UPDATE user SET password = ? WHERE email = ?"; if($stmt = $conn->prepare($query)) { $stmt->bind_param('ss', $pwd, $userEmail); $stmt->execute(); //Check if update worked } Thanks for the help.
php
mysql
update
prepared-statement
null
null
open
updating records with prepared statements, checking if update worked === I have a query that updates a record on my database, it works fine but i wanted to know how to check if the update has happened so i can return true and display the right message? Now i know with a SELECT query i can do: if(stmt->fetch()) If that is true i return true and saying "records found" but i haven't got a clue how to do it for an update query? Anyone know how to? $query = "UPDATE user SET password = ? WHERE email = ?"; if($stmt = $conn->prepare($query)) { $stmt->bind_param('ss', $pwd, $userEmail); $stmt->execute(); //Check if update worked } Thanks for the help.
0
10,396,429
05/01/2012 10:28:14
1,334,926
04/15/2012 18:36:24
1
0
epub file read and display in adnroid
i weak in English sorry ,i want to build a epub reader application in android like fbreader, GMreader,pageturn etc. if any one known and tell me that how to start and which jar file and plugin is required, i know the about fbreader plugin, but i don't know that how it plugin using programming please tell me step by step.
java
android
null
null
null
05/01/2012 11:06:37
not a real question
epub file read and display in adnroid === i weak in English sorry ,i want to build a epub reader application in android like fbreader, GMreader,pageturn etc. if any one known and tell me that how to start and which jar file and plugin is required, i know the about fbreader plugin, but i don't know that how it plugin using programming please tell me step by step.
1
4,361,591
12/05/2010 22:18:40
509,754
11/16/2010 16:18:00
26
9
php calandar script with events need help please
i'm currently working creating a calendar script that allows you to add events to the database and they appear as tool-tips i want it too connect to the database if it isn't already connected and as the numbers are increasing and its creating the calandar if the day is equal to the $day in the event calandar it prints out a out the event and day with added class heres what i have right now but its not working right. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Calandar</title> <link rel="stylesheet" href="css/master.css" type="text/css" media="screen" charset="utf-8" /> <script src="js/jquery-1.3.min.js" type="text/javascript"> </script> <script src="js/coda.js" type="text/javascript"> </script> </head> <body> <table cellspacing="0"> <thead> <tr> <?php include 'connect.php'; $days = mysql_query("Select * FROM calandar ORDER BY id"); while($dayz = mysql_fetch_array($days)){ if(is_array($dayz)){ foreach($dayz as $key => $value) $$key = stripslashes($value); } echo "<th>".$day."</th>"; } ?> </tr> </thead> <tbody> <?php $date = time(); $dayt = date('j', $date); $month = date('m', $date); $year = date('Y', $date); $first_day = mktime(0,0,0,$month, 1, $year); $month_title = date('F', $first_day); $days_of_week = date('D', $first_day); switch($days_of_week){ case "Mon": $blank = 0; break; case "Tue": $blank = 1; break; case "Wed": $blank = 2; break; case "Thu": $blank = 3; break; case "Fri": $blank = 4; break; case "Sat": $blank = 5; break; case "Sun": $blank = 6; break; } $days_in_month = cal_days_in_month(0, $month, $year); //counts days goes up to 7 $day_count = 1; echo "<tr>"; //take care of blank days while($blank > 0) { echo "<td></td>"; $blank = $blank-1; $day_count++; } $day_num = 1; //count days until its equal to the days in the current month $days = mysql_query("Select * FROM events ORDER BY id"); while($dayz = mysql_fetch_array($days)){ if(is_array($dayz)){ foreach($dayz as $key => $value) $$key = stripslashes($value); } while($day_num <= $days_in_month) { if($day === $day_num){ echo $day_num. ","; echo "<td class='date_has_event'> $day_num <div class='events'> <ul> <li> <span class='title'> $title </span> <span class='desc'> $desc </span> </li> </ul> </div> </td>"; }else{ echo $day_num; echo "<td> $day_num </td>"; } $day_num++; $day_count++; //echo "<td> $day_num </td>"; //$day_num++; //$day_count++; //if statement to check if its been a full week if($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } } while($day_count > 1 && $day_count <= 7) { echo"<td></td>"; $day_count++; } echo "</tr>"; ?> </tbody> <tfoot> <th>Mon</th><th>Tue</th><th>Wed</th> <th>Thu</th><th>Fri</th><th>Sat</th> <th>Sun</th> </tfoot> </table> <input type="hidden" name="today" id="today" value="<?php echo $dayt ?>"> <script type="text/javascript"> $(function () { var day = $("#today").val(); $("td").each(function(i){ //alert(i); if(i - 1 == day){ $(this).addClass("today"); } }); }); </script> </body> </html>
php
jquery
null
null
null
null
open
php calandar script with events need help please === i'm currently working creating a calendar script that allows you to add events to the database and they appear as tool-tips i want it too connect to the database if it isn't already connected and as the numbers are increasing and its creating the calandar if the day is equal to the $day in the event calandar it prints out a out the event and day with added class heres what i have right now but its not working right. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Calandar</title> <link rel="stylesheet" href="css/master.css" type="text/css" media="screen" charset="utf-8" /> <script src="js/jquery-1.3.min.js" type="text/javascript"> </script> <script src="js/coda.js" type="text/javascript"> </script> </head> <body> <table cellspacing="0"> <thead> <tr> <?php include 'connect.php'; $days = mysql_query("Select * FROM calandar ORDER BY id"); while($dayz = mysql_fetch_array($days)){ if(is_array($dayz)){ foreach($dayz as $key => $value) $$key = stripslashes($value); } echo "<th>".$day."</th>"; } ?> </tr> </thead> <tbody> <?php $date = time(); $dayt = date('j', $date); $month = date('m', $date); $year = date('Y', $date); $first_day = mktime(0,0,0,$month, 1, $year); $month_title = date('F', $first_day); $days_of_week = date('D', $first_day); switch($days_of_week){ case "Mon": $blank = 0; break; case "Tue": $blank = 1; break; case "Wed": $blank = 2; break; case "Thu": $blank = 3; break; case "Fri": $blank = 4; break; case "Sat": $blank = 5; break; case "Sun": $blank = 6; break; } $days_in_month = cal_days_in_month(0, $month, $year); //counts days goes up to 7 $day_count = 1; echo "<tr>"; //take care of blank days while($blank > 0) { echo "<td></td>"; $blank = $blank-1; $day_count++; } $day_num = 1; //count days until its equal to the days in the current month $days = mysql_query("Select * FROM events ORDER BY id"); while($dayz = mysql_fetch_array($days)){ if(is_array($dayz)){ foreach($dayz as $key => $value) $$key = stripslashes($value); } while($day_num <= $days_in_month) { if($day === $day_num){ echo $day_num. ","; echo "<td class='date_has_event'> $day_num <div class='events'> <ul> <li> <span class='title'> $title </span> <span class='desc'> $desc </span> </li> </ul> </div> </td>"; }else{ echo $day_num; echo "<td> $day_num </td>"; } $day_num++; $day_count++; //echo "<td> $day_num </td>"; //$day_num++; //$day_count++; //if statement to check if its been a full week if($day_count > 7) { echo "</tr><tr>"; $day_count = 1; } } } while($day_count > 1 && $day_count <= 7) { echo"<td></td>"; $day_count++; } echo "</tr>"; ?> </tbody> <tfoot> <th>Mon</th><th>Tue</th><th>Wed</th> <th>Thu</th><th>Fri</th><th>Sat</th> <th>Sun</th> </tfoot> </table> <input type="hidden" name="today" id="today" value="<?php echo $dayt ?>"> <script type="text/javascript"> $(function () { var day = $("#today").val(); $("td").each(function(i){ //alert(i); if(i - 1 == day){ $(this).addClass("today"); } }); }); </script> </body> </html>
0
6,913,584
08/02/2011 14:20:44
542,218
12/14/2010 16:16:38
1
1
sencha touch app very slow on iPhone Device
am trying to test my app on iPhone device , i tested it on android device and it works good , and tested it on the iPhone emulator using Xcode and it's extremely fast and reliable , but when i tried it using Ad Hoc on iPhone device it was extremely slow and junky any ideas please help ? !
iphone
sencha-touch
ad-hoc-distribution
null
null
null
open
sencha touch app very slow on iPhone Device === am trying to test my app on iPhone device , i tested it on android device and it works good , and tested it on the iPhone emulator using Xcode and it's extremely fast and reliable , but when i tried it using Ad Hoc on iPhone device it was extremely slow and junky any ideas please help ? !
0
11,697,061
07/27/2012 23:58:55
1,558,898
07/27/2012 23:20:38
1
0
Template Member Function Overloading and Multiple Inheritance in C++
I am observing behavior in the below code which I cannot readily explain and would like to understand the theory of better. I cannot seem to find an online documentation source or existing question which covers this particular situation. For reference, I am using Visual Studio C++ 2010 to compile and run the following code: #include <iostream> using namespace std; struct Bottom_Class { template<typename This_Type> void Dispatch() { // A: When this comment is removed, the program does not compile // citing an ambiguous call to Print_Hello // ((This_Type*)this)->Print_Hello(); // B: When this comment is removed instead, the program compiles and // generates the following output: // >> "Goodbye from Top Class!" // ((This_Type*)this)->Print_Goodbye<void>(); } void Print_Hello() {cout << "Hello from Bottom Class!" << endl;} template<typename This_Type> void Print_Goodbye() {cout << "Goodbye from Bottom Class!" << endl;} }; struct Top_Class { void Print_Hello() {cout << "Hello from Top Class!" << endl;} template<typename This_Type> void Print_Goodbye() {cout << "Goodbye from Top Class!" << endl;} }; template<typename Top_Type,typename Bottom_Type> struct Merged_Class : public Top_Type, public Bottom_Type {}; typedef Merged_Class<Top_Class,Bottom_Class> My_Merged_Class; void main() { My_Merged_Class my_merged_object; my_merged_object.Dispatch<My_Merged_Class>(); } Why does this work differently for the templated member function vs. non-templated member function cases ? How does the compiler decide (in the templated case) that Top_Class::Print_Goodbye<void>() is the appropriate overload rather than Bottom_Class::Print_Goodbye<void>() ? Thank you in advance for your consideration.
c++
templates
polymorphism
multiple-inheritance
method-overloading
null
open
Template Member Function Overloading and Multiple Inheritance in C++ === I am observing behavior in the below code which I cannot readily explain and would like to understand the theory of better. I cannot seem to find an online documentation source or existing question which covers this particular situation. For reference, I am using Visual Studio C++ 2010 to compile and run the following code: #include <iostream> using namespace std; struct Bottom_Class { template<typename This_Type> void Dispatch() { // A: When this comment is removed, the program does not compile // citing an ambiguous call to Print_Hello // ((This_Type*)this)->Print_Hello(); // B: When this comment is removed instead, the program compiles and // generates the following output: // >> "Goodbye from Top Class!" // ((This_Type*)this)->Print_Goodbye<void>(); } void Print_Hello() {cout << "Hello from Bottom Class!" << endl;} template<typename This_Type> void Print_Goodbye() {cout << "Goodbye from Bottom Class!" << endl;} }; struct Top_Class { void Print_Hello() {cout << "Hello from Top Class!" << endl;} template<typename This_Type> void Print_Goodbye() {cout << "Goodbye from Top Class!" << endl;} }; template<typename Top_Type,typename Bottom_Type> struct Merged_Class : public Top_Type, public Bottom_Type {}; typedef Merged_Class<Top_Class,Bottom_Class> My_Merged_Class; void main() { My_Merged_Class my_merged_object; my_merged_object.Dispatch<My_Merged_Class>(); } Why does this work differently for the templated member function vs. non-templated member function cases ? How does the compiler decide (in the templated case) that Top_Class::Print_Goodbye<void>() is the appropriate overload rather than Bottom_Class::Print_Goodbye<void>() ? Thank you in advance for your consideration.
0
2,147,748
01/27/2010 14:47:51
220,386
11/28/2009 07:54:40
126
5
Caching is orthogonal to recursion... Explain ?
Although it's true that some recursive-nameserver configurations are (sloppily) referred to as "caching", e.g., by RHEL/Fedora/CentOS, that's a really bad name for that function -- because caching is orthogonal to recursion. Theoretically, you could write a nameserver that does recursive service but doesn't cache its results. (That would be a bit perverse, and I don't know of any.) Conversely, nameserver packages that cache but know nothing about how to recurse and instead do less-helpful alternative iterative service are common: dnsmasq, pdnsd, etc. ... ... Above text source: http://linuxgazette.net/170/lan.html Please explain what does the author means by "caching is orthogonal to recursion" ?
networking
caching
recursion
nameservers
c
01/27/2010 15:29:44
off topic
Caching is orthogonal to recursion... Explain ? === Although it's true that some recursive-nameserver configurations are (sloppily) referred to as "caching", e.g., by RHEL/Fedora/CentOS, that's a really bad name for that function -- because caching is orthogonal to recursion. Theoretically, you could write a nameserver that does recursive service but doesn't cache its results. (That would be a bit perverse, and I don't know of any.) Conversely, nameserver packages that cache but know nothing about how to recurse and instead do less-helpful alternative iterative service are common: dnsmasq, pdnsd, etc. ... ... Above text source: http://linuxgazette.net/170/lan.html Please explain what does the author means by "caching is orthogonal to recursion" ?
2
7,086,607
08/17/2011 00:08:32
219,159
11/26/2009 06:30:34
9,311
468
Nodpi images vs. Android 1.5
I have an image in my app that I don't want to scale on loading. At the same time, I want to retain compatibility with Android 1.5. So here's the deal. If I place the image under `drawable`, Android 1.6+ thinks it's MDPI, and scales accordingly. If I place the image under `drawable-nodpi`, Android 1.6+ does not scale it, but Android 1.5 cannot find it. If I place a copy in both folders, Android 1.6 prefers the one in `drawable`, and scales it as if MDPI. And I don't want to ship two copies of the same file, so this was a last resort measure anyway. Can you think of any way out? Preferably a way that does not involve two copies of the file.
android
drawable
scaling
screen-resolution
null
null
open
Nodpi images vs. Android 1.5 === I have an image in my app that I don't want to scale on loading. At the same time, I want to retain compatibility with Android 1.5. So here's the deal. If I place the image under `drawable`, Android 1.6+ thinks it's MDPI, and scales accordingly. If I place the image under `drawable-nodpi`, Android 1.6+ does not scale it, but Android 1.5 cannot find it. If I place a copy in both folders, Android 1.6 prefers the one in `drawable`, and scales it as if MDPI. And I don't want to ship two copies of the same file, so this was a last resort measure anyway. Can you think of any way out? Preferably a way that does not involve two copies of the file.
0
2,293,219
02/19/2010 00:10:21
270,547
02/10/2010 19:10:59
141
24
Is it possible to host a WinForm form within a WPF Form via a container/wrapper?
Is there a way to host/display a full WinForms form (not just a single control) within some sort of container or wrapper type control within a WPF form? I’m looking for something similar in concept to a virtual include from php or iframe in html. Possibly by compiling it into an OCX or DLL.
c#
wpf
winforms-interop
visual-studio-2008
null
null
open
Is it possible to host a WinForm form within a WPF Form via a container/wrapper? === Is there a way to host/display a full WinForms form (not just a single control) within some sort of container or wrapper type control within a WPF form? I’m looking for something similar in concept to a virtual include from php or iframe in html. Possibly by compiling it into an OCX or DLL.
0
6,985,844
08/08/2011 17:11:05
633,426
02/25/2011 01:51:48
50
0
Deleting Specific Variables in R
How can I delete certain variables that are saved in session in R? Thank you.
r
variables
delete
null
null
06/07/2012 13:19:43
not a real question
Deleting Specific Variables in R === How can I delete certain variables that are saved in session in R? Thank you.
1
11,542,088
07/18/2012 13:04:34
1,534,843
07/18/2012 12:59:34
1
0
[Urgent Please..]PHP Script to add contact to google(gmail), yahoo, aol and hotmail
Dear Everyone and partners, I am stuck with google, yahoo, hotmail and aol code. I need the user of my website could add the contact us page to contactbook in google, yahoo, hotmail and aol.. Please if you have something value so much about this that will be very appreciated. Thanx so much
google
add
yahoo
hotmail
aol
07/18/2012 20:58:48
not a real question
[Urgent Please..]PHP Script to add contact to google(gmail), yahoo, aol and hotmail === Dear Everyone and partners, I am stuck with google, yahoo, hotmail and aol code. I need the user of my website could add the contact us page to contactbook in google, yahoo, hotmail and aol.. Please if you have something value so much about this that will be very appreciated. Thanx so much
1
4,045,188
10/28/2010 16:47:57
82,368
03/25/2009 04:27:50
1,249
32
Build the list {1,2,3} with the minimum assignment statements in C
Rewrite this to minimize the assignment statements /* Build the list {1, 2, 3} in the heap and store its head pointer in a local stack variable. Returns the head pointer to the caller. */ struct node* BuildOneTwoThree() { struct node* head = NULL; struct node* second = NULL; struct node* third = NULL; head = malloc(sizeof(struct node)); // allocate 3 nodes in the hea second = malloc(sizeof(struct node)); third = malloc(sizeof(struct node)); head->data = 1; // setup first node head->next = second; // note: pointer assignment rule second->data = 2; // setup second node second->next = third; third->data = 3; // setup third link third->next = NULL; // At this point, the linked list referenced by "head" // matches the list in the drawing. return head; } From http://cslibrary.stanford.edu/
c
linked-list
null
null
null
10/29/2010 01:48:45
not a real question
Build the list {1,2,3} with the minimum assignment statements in C === Rewrite this to minimize the assignment statements /* Build the list {1, 2, 3} in the heap and store its head pointer in a local stack variable. Returns the head pointer to the caller. */ struct node* BuildOneTwoThree() { struct node* head = NULL; struct node* second = NULL; struct node* third = NULL; head = malloc(sizeof(struct node)); // allocate 3 nodes in the hea second = malloc(sizeof(struct node)); third = malloc(sizeof(struct node)); head->data = 1; // setup first node head->next = second; // note: pointer assignment rule second->data = 2; // setup second node second->next = third; third->data = 3; // setup third link third->next = NULL; // At this point, the linked list referenced by "head" // matches the list in the drawing. return head; } From http://cslibrary.stanford.edu/
1
3,707,628
09/14/2010 09:30:02
447,174
09/14/2010 09:30:02
1
0
How to tell Terminal which version of Ruby to use?
I have two related questions that I was hoping someone could help out with. 1. I recently installed Ruby 1.9.2 on my Mac (running Snow Leopard 10.6.4) and I haven’t been able to figure out how to get Terminal to use the new Ruby as a default, rather than the factory-installed Ruby 1.8.7. The old Ruby 1.8.7 is located in my ~/usr/bin/ruby directory while the new Ruby 1.9.2 is in ~/usr/local/bin/ruby. Someone said that I need to put the new version of Ruby's directory in the PATH prior to the old version's directory so that the system looks there first - is this correct? If so, can anyone provide step by step instructions on how to do this? 2. I’ve created a new directory but can’t seem to figure out the correct way to add that directory to my PATH using the Terminal bash shell. I tried using the instructions that I found here (http://www.macgasm.net/2008/04/10/ad...thin-terminal/) twice but they didn't work for me. The directory containing my program ("Ruby_Programs") shows up in the PATH but when I try to run "ruby newprogram.rb" from the command line it results in ":ruby: No such file or directory -- newprogram.rb (LoadError)". The file definitely exists and is a functional Ruby program. I did change the name of the directory to "Ruby Programs" and then back to "Ruby_Programs" - could that have somehow caused this problem? Any help would be greatly appreciated. Here is my current PATH: $ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sbrriffe/src:/usr/X11/bin:/Users/sbriffe/Ruby_Programs/:
ruby
osx
null
null
null
null
open
How to tell Terminal which version of Ruby to use? === I have two related questions that I was hoping someone could help out with. 1. I recently installed Ruby 1.9.2 on my Mac (running Snow Leopard 10.6.4) and I haven’t been able to figure out how to get Terminal to use the new Ruby as a default, rather than the factory-installed Ruby 1.8.7. The old Ruby 1.8.7 is located in my ~/usr/bin/ruby directory while the new Ruby 1.9.2 is in ~/usr/local/bin/ruby. Someone said that I need to put the new version of Ruby's directory in the PATH prior to the old version's directory so that the system looks there first - is this correct? If so, can anyone provide step by step instructions on how to do this? 2. I’ve created a new directory but can’t seem to figure out the correct way to add that directory to my PATH using the Terminal bash shell. I tried using the instructions that I found here (http://www.macgasm.net/2008/04/10/ad...thin-terminal/) twice but they didn't work for me. The directory containing my program ("Ruby_Programs") shows up in the PATH but when I try to run "ruby newprogram.rb" from the command line it results in ":ruby: No such file or directory -- newprogram.rb (LoadError)". The file definitely exists and is a functional Ruby program. I did change the name of the directory to "Ruby Programs" and then back to "Ruby_Programs" - could that have somehow caused this problem? Any help would be greatly appreciated. Here is my current PATH: $ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/sbrriffe/src:/usr/X11/bin:/Users/sbriffe/Ruby_Programs/:
0
8,722,126
01/04/2012 04:46:33
268,730
02/08/2010 14:58:32
401
13
C# Xml Serialization & Deserialization
I am trying to serialize an object & save it into a Sql server 2008 xml field. I also have some deserialization code that re-hydrates the object. I am able to serialize & save the object into the db, but get a "Root element missing" exception. [XmlRoot("Patient")] public class PatientXml { private AddressXml _address = null; private EmergencyContactXml _emergencyContact = null; private PersonalXml _personal = null; [XmlElement] public PersonalXml Personal { get { return _personal; } set { _personal = value; } } [XmlElement] public AddressXml Address { get { return _address; } set { _address = value; } } [XmlElement] public EmergencyContactXml EmergencyContact { get { return _emergencyContact; } set { _emergencyContact = value; } } public PatientXml(){} public PatientXml(Patient patient) { _address = new AddressXml(patient.Address); _emergencyContact = new EmergencyContactXml(patient.EmergencyInfo); _personal = new PersonalXml(patient); } } public class PersonalXml { private string _firstName = string.Empty, _lastName = string.Empty, _dateOfBirth = string.Empty, _phone = string.Empty; [XmlAttribute] public string FirstName { get { return _firstName; } set { _firstName = value; } } [XmlAttribute] public string LastName { get { return _lastName; } set { _lastName = value; } } [XmlAttribute] public string DateOfBirth { get { return _dateOfBirth; } set { _dateOfBirth = value; } } [XmlAttribute] public string Phone { get { return _phone; } set { _phone = value; } } public PersonalXml(){} public PersonalXml(Patient patient) { _firstName = patient.FirstName; _lastName = patient.LastName; _dateOfBirth = patient.DateOfBirth.ToShortDateString(); _phone = patient.Phone; } } public class AddressXml { private string _address1 = string.Empty, _address2 = string.Empty, _city = string.Empty, _state = string.Empty, _zip = string.Empty; [XmlAttribute] public string Address1 { get { return _address1; } set { _address1 = value; } } [XmlAttribute] public string Address2 { get { return _address2; } set { _address2 = value; } } [XmlAttribute] public string City { get { return _city; } set { _city = value; } } [XmlAttribute] public string State { get { return _state; } set { _state = value; } } [XmlAttribute] public string Zip { get { return _zip; } set { _zip = value; } } public AddressXml(){} public AddressXml(Address address) { _address1 = address.Address1; _address2 = address.Address2; _city = address.City; _state = address.State; _zip = address.ZipCode; } } public class EmergencyContactXml { private string _name = string.Empty, _phone = string.Empty, _relationship = string.Empty; [XmlAttribute] public string Name { get { return _name; } set { _name = value; } } [XmlAttribute] public string Phone { get { return _phone; } set { _phone = value; } } [XmlAttribute] public string Relationship { get { return _relationship; } set { _relationship = value; } } public EmergencyContactXml(){} public EmergencyContactXml(EmergencyContact contact) { _name = contact.ContactName; _phone = contact.Phone; _relationship = contact.Relationship; } } Serialized Xml output: <Patient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Personal FirstName="Test" LastName="User 1" DateOfBirth="3/13/1966" Phone="6304449866" /><Address Address1="123 Some St" City="Bartlett" State="CT" Zip="60111" /><EmergencyContact Name="Dr Chanduwarthana" Phone="6309769484" Relationship="Father" /></Patient> Serization & Deserialization code: public static class XmlSerializer { public static string Serialize<T>(T item) { MemoryStream memStream = new MemoryStream(); using (XmlTextWriter textWriter = new XmlTextWriter(memStream, Encoding.Unicode)) { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); serializer.Serialize(textWriter, item); memStream = textWriter.BaseStream as MemoryStream; } if (memStream != null) return Encoding.Unicode.GetString(memStream.ToArray()); else return null; } public static T Deserialize<T>(string xmlString) { if (string.IsNullOrWhiteSpace(xmlString)) return default(T); using (MemoryStream memStream = new MemoryStream()) { using (XmlTextWriter textWriter = new XmlTextWriter(memStream, Encoding.Unicode)) { memStream.Position = 0; System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); return (T)serializer.Deserialize(memStream); } } } }
c#
c#-4.0
c#-3.0
xml-serialization
c#-2.0
null
open
C# Xml Serialization & Deserialization === I am trying to serialize an object & save it into a Sql server 2008 xml field. I also have some deserialization code that re-hydrates the object. I am able to serialize & save the object into the db, but get a "Root element missing" exception. [XmlRoot("Patient")] public class PatientXml { private AddressXml _address = null; private EmergencyContactXml _emergencyContact = null; private PersonalXml _personal = null; [XmlElement] public PersonalXml Personal { get { return _personal; } set { _personal = value; } } [XmlElement] public AddressXml Address { get { return _address; } set { _address = value; } } [XmlElement] public EmergencyContactXml EmergencyContact { get { return _emergencyContact; } set { _emergencyContact = value; } } public PatientXml(){} public PatientXml(Patient patient) { _address = new AddressXml(patient.Address); _emergencyContact = new EmergencyContactXml(patient.EmergencyInfo); _personal = new PersonalXml(patient); } } public class PersonalXml { private string _firstName = string.Empty, _lastName = string.Empty, _dateOfBirth = string.Empty, _phone = string.Empty; [XmlAttribute] public string FirstName { get { return _firstName; } set { _firstName = value; } } [XmlAttribute] public string LastName { get { return _lastName; } set { _lastName = value; } } [XmlAttribute] public string DateOfBirth { get { return _dateOfBirth; } set { _dateOfBirth = value; } } [XmlAttribute] public string Phone { get { return _phone; } set { _phone = value; } } public PersonalXml(){} public PersonalXml(Patient patient) { _firstName = patient.FirstName; _lastName = patient.LastName; _dateOfBirth = patient.DateOfBirth.ToShortDateString(); _phone = patient.Phone; } } public class AddressXml { private string _address1 = string.Empty, _address2 = string.Empty, _city = string.Empty, _state = string.Empty, _zip = string.Empty; [XmlAttribute] public string Address1 { get { return _address1; } set { _address1 = value; } } [XmlAttribute] public string Address2 { get { return _address2; } set { _address2 = value; } } [XmlAttribute] public string City { get { return _city; } set { _city = value; } } [XmlAttribute] public string State { get { return _state; } set { _state = value; } } [XmlAttribute] public string Zip { get { return _zip; } set { _zip = value; } } public AddressXml(){} public AddressXml(Address address) { _address1 = address.Address1; _address2 = address.Address2; _city = address.City; _state = address.State; _zip = address.ZipCode; } } public class EmergencyContactXml { private string _name = string.Empty, _phone = string.Empty, _relationship = string.Empty; [XmlAttribute] public string Name { get { return _name; } set { _name = value; } } [XmlAttribute] public string Phone { get { return _phone; } set { _phone = value; } } [XmlAttribute] public string Relationship { get { return _relationship; } set { _relationship = value; } } public EmergencyContactXml(){} public EmergencyContactXml(EmergencyContact contact) { _name = contact.ContactName; _phone = contact.Phone; _relationship = contact.Relationship; } } Serialized Xml output: <Patient xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Personal FirstName="Test" LastName="User 1" DateOfBirth="3/13/1966" Phone="6304449866" /><Address Address1="123 Some St" City="Bartlett" State="CT" Zip="60111" /><EmergencyContact Name="Dr Chanduwarthana" Phone="6309769484" Relationship="Father" /></Patient> Serization & Deserialization code: public static class XmlSerializer { public static string Serialize<T>(T item) { MemoryStream memStream = new MemoryStream(); using (XmlTextWriter textWriter = new XmlTextWriter(memStream, Encoding.Unicode)) { System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); serializer.Serialize(textWriter, item); memStream = textWriter.BaseStream as MemoryStream; } if (memStream != null) return Encoding.Unicode.GetString(memStream.ToArray()); else return null; } public static T Deserialize<T>(string xmlString) { if (string.IsNullOrWhiteSpace(xmlString)) return default(T); using (MemoryStream memStream = new MemoryStream()) { using (XmlTextWriter textWriter = new XmlTextWriter(memStream, Encoding.Unicode)) { memStream.Position = 0; System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(T)); return (T)serializer.Deserialize(memStream); } } } }
0
10,780,813
05/28/2012 07:22:27
1,421,158
05/28/2012 07:14:17
1
0
security in linux
In "CENT OS 6.0" we can change the password of root even if we don't know the password of root(or if we forgot our password) This is the method... 1. At the boot loader menu, spam "e" to edit the kernel 2. Select the second line (it begins with the word kernel) 3. Edit the line by pressing "e" 4. At the end of this line, add the word "single", without quotes 5. Exit out of this line by pressing enter 6. Boot off of the kernel while having that line highlighted by pressing "b" 7. It will boot into single user mode 8. Type "passwd", without quotes, and it will prompt you for a new password 9. Enter your new root password and login suppose if any normal user change the root password with this method then other users will be affected (if server is hacked)... then how is linux is secure ???
linux
security
null
null
null
05/28/2012 07:35:54
off topic
security in linux === In "CENT OS 6.0" we can change the password of root even if we don't know the password of root(or if we forgot our password) This is the method... 1. At the boot loader menu, spam "e" to edit the kernel 2. Select the second line (it begins with the word kernel) 3. Edit the line by pressing "e" 4. At the end of this line, add the word "single", without quotes 5. Exit out of this line by pressing enter 6. Boot off of the kernel while having that line highlighted by pressing "b" 7. It will boot into single user mode 8. Type "passwd", without quotes, and it will prompt you for a new password 9. Enter your new root password and login suppose if any normal user change the root password with this method then other users will be affected (if server is hacked)... then how is linux is secure ???
2
10,641,737
05/17/2012 18:48:21
1,382,541
05/08/2012 15:56:37
6
0
how to set this cookie to never expire
here my code function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } it works fine with jquery action, but it expires after few days not sure how much , how to make it never expire? thanks
jquery
cookies
setcookie
null
null
05/18/2012 11:47:29
not a real question
how to set this cookie to never expire === here my code function setCookie(c_name,value,exdays) { var exdate=new Date(); exdate.setDate(exdate.getDate() + exdays); var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()); document.cookie=c_name + "=" + c_value; } function getCookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i<ARRcookies.length;i++) { x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); x=x.replace(/^\s+|\s+$/g,""); if (x==c_name) { return unescape(y); } } } it works fine with jquery action, but it expires after few days not sure how much , how to make it never expire? thanks
1
3,873,042
10/06/2010 13:38:28
468,009
10/06/2010 13:33:51
1
0
Can you sell software built with Ruby on Rails?
Can you sell software built using Ruby on Rails? If so are there any pitfalls in doing so? Is it any different to selling software built with PHP for example?
ruby-on-rails
null
null
null
null
10/06/2010 17:40:25
off topic
Can you sell software built with Ruby on Rails? === Can you sell software built using Ruby on Rails? If so are there any pitfalls in doing so? Is it any different to selling software built with PHP for example?
2
6,970,204
08/07/2011 01:50:11
769,870
05/25/2011 15:38:21
93
1
Visual C++ String Parsing
I wrote my own terminal program that reads from the serial port to read data from a microcontroller. Data is presented as follows: >0C82949>0D23949>0A75249> etc... These are ASCII. Some things to note are that all elements start with >_0xx which is the header where xx is some chars such as >0C8 or >0D2 etc... this tells me what the rest of the data is such as if >0C8 is the speed of the car then 2949 holds the actual speed. The microcontroller writes the data really fast so at one time i can see 40 elements at a time. I want to quickly search this for an ">0C8" entry and only print out ">0C82949" out of the bunch: an example if i only want 0D2: Read from Serial Port: >0C82949>0D23949>0A75249> Output: 0D23949 would anyone know how to do this?? I am aware that since it is so fast i would have to create threads which i can do, i am just not sure how to approach this issue for parsing. Any ideas would be greatly appreciated. **I am using Visual C++**
string
parsing
visual-c++
null
null
null
open
Visual C++ String Parsing === I wrote my own terminal program that reads from the serial port to read data from a microcontroller. Data is presented as follows: >0C82949>0D23949>0A75249> etc... These are ASCII. Some things to note are that all elements start with >_0xx which is the header where xx is some chars such as >0C8 or >0D2 etc... this tells me what the rest of the data is such as if >0C8 is the speed of the car then 2949 holds the actual speed. The microcontroller writes the data really fast so at one time i can see 40 elements at a time. I want to quickly search this for an ">0C8" entry and only print out ">0C82949" out of the bunch: an example if i only want 0D2: Read from Serial Port: >0C82949>0D23949>0A75249> Output: 0D23949 would anyone know how to do this?? I am aware that since it is so fast i would have to create threads which i can do, i am just not sure how to approach this issue for parsing. Any ideas would be greatly appreciated. **I am using Visual C++**
0
1,644,233
10/29/2009 14:44:19
2,218
08/21/2008 00:19:31
359
10
TabInfo IconFile
I'm wondering how to correctly use the IconFile property of a TabInfo object in DotNetNuke? I am building a custom overlay menu that will be displaying the tab name, description, and an icon similar to the Admin and Host pages that use the 'console' DesktopModule. If I have a TabInfo object that has an IconFile set for it the value of the IconFile field is something like 'FileID=83'. I'm assuming this needs to be run through some sort of File API to determine what the URL of the file is.
dotnetnuke
null
null
null
null
null
open
TabInfo IconFile === I'm wondering how to correctly use the IconFile property of a TabInfo object in DotNetNuke? I am building a custom overlay menu that will be displaying the tab name, description, and an icon similar to the Admin and Host pages that use the 'console' DesktopModule. If I have a TabInfo object that has an IconFile set for it the value of the IconFile field is something like 'FileID=83'. I'm assuming this needs to be run through some sort of File API to determine what the URL of the file is.
0
8,438,079
12/08/2011 21:40:01
753,958
05/14/2011 19:56:18
109
15
What is the correct order to validate parameters?
For reference, I would like to note that [this question][1] is taken into considderation for **how** the prarameters are tested. [1]: http://stackoverflow.com/questions/1157139/what-is-the-correct-way-to-validate-the-arguments-of-a-constructor Lets take the following two snippets as an example: public void DoSomething1(Dictionary<string, string> param1, Object param2) { if (null == param1) throw new ArgumentNullException("param1"); if(!param1.Keys.Contains("somekey")) throw new ArgumentException("param1 must contain key \"somekey\""); if(null == param2) throw new ArgumentNullException("param2"); // now we do some stuff } public void DoSomething2(Dictionary<string, string> param1, Object param2) { if (null == param1) throw new ArgumentNullException("param1"); if (null == param2) throw new ArgumentNullException("param2"); if(!param1.Keys.Contains("somekey")) throw new ArgumentException("param1 must contain key \"somekey\""); // now we do some stuff } Both methods will accomplish the same protection to the inner workings of the method. **My Question Is...** What is the correct approach / order to test parameters passed to a method (such as in this example) **and why**? **Please site references to backup your answer.**
c#
exception-handling
theory
null
null
12/08/2011 21:58:57
not constructive
What is the correct order to validate parameters? === For reference, I would like to note that [this question][1] is taken into considderation for **how** the prarameters are tested. [1]: http://stackoverflow.com/questions/1157139/what-is-the-correct-way-to-validate-the-arguments-of-a-constructor Lets take the following two snippets as an example: public void DoSomething1(Dictionary<string, string> param1, Object param2) { if (null == param1) throw new ArgumentNullException("param1"); if(!param1.Keys.Contains("somekey")) throw new ArgumentException("param1 must contain key \"somekey\""); if(null == param2) throw new ArgumentNullException("param2"); // now we do some stuff } public void DoSomething2(Dictionary<string, string> param1, Object param2) { if (null == param1) throw new ArgumentNullException("param1"); if (null == param2) throw new ArgumentNullException("param2"); if(!param1.Keys.Contains("somekey")) throw new ArgumentException("param1 must contain key \"somekey\""); // now we do some stuff } Both methods will accomplish the same protection to the inner workings of the method. **My Question Is...** What is the correct approach / order to test parameters passed to a method (such as in this example) **and why**? **Please site references to backup your answer.**
4
9,945,280
03/30/2012 14:49:15
971,337
09/29/2011 14:20:31
25
0
Command line is prompting for password, cannot send password using java eclipse
I have a program that i am running and it brings up the command prompt screen, i give it my arguments, but then it asks for a password. I send it a password but i get an error, thinking the password is part of the previous arguments, here is some of my code: Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe /k \"" + CD + AND + Keytool + Genkey + Keyalg + Keysize + Alias + Validity + Keystore + "/K && " + Password); The error is "Illegal Option password" Any Ideas? I think i need to use a outputstreamwriter but I am not quite sure how. Thanks
java
process
cmd
runtime.exec
null
null
open
Command line is prompting for password, cannot send password using java eclipse === I have a program that i am running and it brings up the command prompt screen, i give it my arguments, but then it asks for a password. I send it a password but i get an error, thinking the password is part of the previous arguments, here is some of my code: Process p = Runtime.getRuntime().exec("cmd /c start cmd.exe /k \"" + CD + AND + Keytool + Genkey + Keyalg + Keysize + Alias + Validity + Keystore + "/K && " + Password); The error is "Illegal Option password" Any Ideas? I think i need to use a outputstreamwriter but I am not quite sure how. Thanks
0
11,435,920
07/11/2012 15:18:56
1,517,973
07/11/2012 13:52:16
1
0
Sql query for week over week
Can anyone help me out in writing a query with the following scenario. I need a report to be generated week over week in T-Sql. The start date would be 22nd of every month. The first week should retrieve the data only from 22nd to the following Saturday. Second week would be from Sunday to Saturday And the last week would be from Sunday till 21st of next month. Also need a query for Month over month starting from 22nd to 21st of every month. I am able to get the result by writing a case statement with hard coded values. However I need dynamically generated values so that I can use in SSRS report. Thanks in advance, Paul
broadcastreceiver
null
null
null
null
07/12/2012 17:10:47
not a real question
Sql query for week over week === Can anyone help me out in writing a query with the following scenario. I need a report to be generated week over week in T-Sql. The start date would be 22nd of every month. The first week should retrieve the data only from 22nd to the following Saturday. Second week would be from Sunday to Saturday And the last week would be from Sunday till 21st of next month. Also need a query for Month over month starting from 22nd to 21st of every month. I am able to get the result by writing a case statement with hard coded values. However I need dynamically generated values so that I can use in SSRS report. Thanks in advance, Paul
1
7,509,151
09/22/2011 03:13:05
251,257
01/15/2010 03:25:09
384
8
Changing table info with Rails migration
In my original migration, I had this: create_table :credit_purchases do |t| t.column :amount, :decimal, :precision => 8, :scale => 2, :null => false t.column :time, :datetime, :null => false end Which produced the following MySQL table definition: CREATE TABLE `credit_purchases` ( `id` int(11) NOT NULL AUTO_INCREMENT, `amount` decimal(8,2) NOT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`), ) When I run this, it doesn't change the definition at all: change_column :credit_purchases, :amount, :decimal, :precision => 8, :scale => 2 change_column :credit_purchases, :time, :datetime I'd expect the definition result to be: CREATE TABLE `credit_purchases` ( `id` int(11) NOT NULL AUTO_INCREMENT, `amount` decimal(8,2) DEFAULT NULL, `time` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) What do I have to do to produce the desired result?
mysql
ruby-on-rails
database
table
migration
null
open
Changing table info with Rails migration === In my original migration, I had this: create_table :credit_purchases do |t| t.column :amount, :decimal, :precision => 8, :scale => 2, :null => false t.column :time, :datetime, :null => false end Which produced the following MySQL table definition: CREATE TABLE `credit_purchases` ( `id` int(11) NOT NULL AUTO_INCREMENT, `amount` decimal(8,2) NOT NULL, `time` datetime NOT NULL, PRIMARY KEY (`id`), ) When I run this, it doesn't change the definition at all: change_column :credit_purchases, :amount, :decimal, :precision => 8, :scale => 2 change_column :credit_purchases, :time, :datetime I'd expect the definition result to be: CREATE TABLE `credit_purchases` ( `id` int(11) NOT NULL AUTO_INCREMENT, `amount` decimal(8,2) DEFAULT NULL, `time` datetime DEFAULT NULL, PRIMARY KEY (`id`), ) What do I have to do to produce the desired result?
0
10,475,262
05/06/2012 23:47:33
529,043
12/03/2010 07:09:50
7,696
451
Serve pdf using :remote => true
I have a form_tag that generates a pdf and serves it to the user. The final send_data is like : send_data pdf.render, type: 'application/pdf', :filename => filename, :compress => true This works fine with a standar form, but it does not work when i try to use ajax to set :remote => true. The ultimate thing i want to do is use :disable_with to disable the button while the pdf is generating. Any ideas on how i could fix this ?
ruby-on-rails
ajax
ruby-on-rails-3
jquery-ajax
null
null
open
Serve pdf using :remote => true === I have a form_tag that generates a pdf and serves it to the user. The final send_data is like : send_data pdf.render, type: 'application/pdf', :filename => filename, :compress => true This works fine with a standar form, but it does not work when i try to use ajax to set :remote => true. The ultimate thing i want to do is use :disable_with to disable the button while the pdf is generating. Any ideas on how i could fix this ?
0
4,894,948
02/04/2011 05:42:30
568,960
01/09/2011 17:24:02
70
1
How to populate message box from a text box when user enters a value?
I am using 3 text boxes for range selections. I want to show range value in a message box when user enters range in text box. Suppose user enters 1)100 in 1st text box , I want to show "you are selected <100". 2)100 in 1st text box and 500 in 2nd text box I want to show "you are selected 101 - 500 " 3) 500 in 2nd text box and 1000 in 3rd text box I want to show "you are selected 501 - 1000 " After entering a value in 3rd text box ,I want to show all ranges in message box. How can I do this? Regards, SJ
asp.net
null
null
null
null
null
open
How to populate message box from a text box when user enters a value? === I am using 3 text boxes for range selections. I want to show range value in a message box when user enters range in text box. Suppose user enters 1)100 in 1st text box , I want to show "you are selected <100". 2)100 in 1st text box and 500 in 2nd text box I want to show "you are selected 101 - 500 " 3) 500 in 2nd text box and 1000 in 3rd text box I want to show "you are selected 501 - 1000 " After entering a value in 3rd text box ,I want to show all ranges in message box. How can I do this? Regards, SJ
0
7,337,931
09/07/2011 17:21:20
906,547
08/22/2011 19:47:06
8
0
How to configure sendmail to send (using PHP mail()) mails OUT?
I have a local server under Ubuntu 8.04 HARDY, and have active the sendmail daemon, if i send email by the PHP function mail(), the email is received by the daemon, but the email not go out the local network, this is the log: Sep 7 19:17:52 linuxserver sm-mta[7616]: p85BNZU1016734: to=<brabadan@xxxx.es>, ctladdr=<www-data@linuxserver.intranet.xxxx.es> (33/33), delay=2+05:54:17, xdelay=00:00:00, mailer=esmtp, pri=29019496, relay=mail.xxxx.es., dsn=4.0.0, stat=Deferred: Connection timed out with mail.xxxx.es. Sep 7 19:14:50 linuxserver sendmail[7633]: p87HEn80007633: to=brabadan@xxxx.es, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=35530, relay=127.0.0.1 [127.0.0.1], dsn=2.0.0, stat=Sent (p87HEoNa007634 Message accepted for delivery) I supose the problem is a missconfiguration but in the pass this work ok, but in one moment during last 3 month the sistem cant send emails out. its possible to be necesary configure SMTP server to send emails using a real world server? Cheers.
sendmail
null
null
null
null
09/08/2011 05:03:40
off topic
How to configure sendmail to send (using PHP mail()) mails OUT? === I have a local server under Ubuntu 8.04 HARDY, and have active the sendmail daemon, if i send email by the PHP function mail(), the email is received by the daemon, but the email not go out the local network, this is the log: Sep 7 19:17:52 linuxserver sm-mta[7616]: p85BNZU1016734: to=<brabadan@xxxx.es>, ctladdr=<www-data@linuxserver.intranet.xxxx.es> (33/33), delay=2+05:54:17, xdelay=00:00:00, mailer=esmtp, pri=29019496, relay=mail.xxxx.es., dsn=4.0.0, stat=Deferred: Connection timed out with mail.xxxx.es. Sep 7 19:14:50 linuxserver sendmail[7633]: p87HEn80007633: to=brabadan@xxxx.es, ctladdr=www-data (33/33), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=35530, relay=127.0.0.1 [127.0.0.1], dsn=2.0.0, stat=Sent (p87HEoNa007634 Message accepted for delivery) I supose the problem is a missconfiguration but in the pass this work ok, but in one moment during last 3 month the sistem cant send emails out. its possible to be necesary configure SMTP server to send emails using a real world server? Cheers.
2
11,337,027
07/05/2012 01:55:42
737,071
05/03/2011 23:19:10
179
3
Simple Opengl and Graphics Questions
<br> Im trying to get to grips with some basics of OpenGl and 3D Grachics. And I was wandering if some could answer a few questions? :)<br> 1. Is COP and the "Camera" the same thing? Which in turn refers to the "User" looking at the screen? 2. Can someone please explain to me the relation between the Projection Perspective and the Viewport if there is one? Because at the moment to me they seem to be the same thing. Or is the PP the Window which is then scaled to fit the viewport? 3. In OpenGL when setting up gluPerspective the zNear value is the distance of the Camera from the Projection Perspective so the combination of the fovy and zNear defines the size of the Window (assuming that the Window == the Projection Perspective and I undestand something :/ ) into the World. 4. When creating a window (only using gl and glu), after you have initalized everything you enter while(!quit) loop that has a render function(this is question is a bit silly), does everything in all case get drawn in this render function which has glBegin() and glEnd(). Lets assume I have a biggish world with lots of features and so on. Does everything that needs to get drawn fit in between those functions such that this Render function can in time become really large? Sorry I know these questions are really naive but they are a few things that I'm having a bit of trouble understanding.
opengl
graphics
3d
null
null
07/06/2012 04:08:13
not constructive
Simple Opengl and Graphics Questions === <br> Im trying to get to grips with some basics of OpenGl and 3D Grachics. And I was wandering if some could answer a few questions? :)<br> 1. Is COP and the "Camera" the same thing? Which in turn refers to the "User" looking at the screen? 2. Can someone please explain to me the relation between the Projection Perspective and the Viewport if there is one? Because at the moment to me they seem to be the same thing. Or is the PP the Window which is then scaled to fit the viewport? 3. In OpenGL when setting up gluPerspective the zNear value is the distance of the Camera from the Projection Perspective so the combination of the fovy and zNear defines the size of the Window (assuming that the Window == the Projection Perspective and I undestand something :/ ) into the World. 4. When creating a window (only using gl and glu), after you have initalized everything you enter while(!quit) loop that has a render function(this is question is a bit silly), does everything in all case get drawn in this render function which has glBegin() and glEnd(). Lets assume I have a biggish world with lots of features and so on. Does everything that needs to get drawn fit in between those functions such that this Render function can in time become really large? Sorry I know these questions are really naive but they are a few things that I'm having a bit of trouble understanding.
4
6,944,037
08/04/2011 15:18:52
229,555
12/11/2009 10:53:03
365
2
How to run java script code before page load?
I have working in asp.net web application. Here I need to run javascript before page load. I have gone through <body oninit="funinit();" onprerender="funRender();" onload="funload();"> </body> <script type="text/javascript" language="javascript"> function funinit() { alert("funinit"); } function funload() { alert("funload"); } function funRender() { alert("funRender"); } </script> here only funload() is working. plz give me any solution to run script before page load.
javascript
jquery
asp.net
null
null
null
open
How to run java script code before page load? === I have working in asp.net web application. Here I need to run javascript before page load. I have gone through <body oninit="funinit();" onprerender="funRender();" onload="funload();"> </body> <script type="text/javascript" language="javascript"> function funinit() { alert("funinit"); } function funload() { alert("funload"); } function funRender() { alert("funRender"); } </script> here only funload() is working. plz give me any solution to run script before page load.
0
10,182,951
04/16/2012 23:08:15
961,885
09/23/2011 20:04:33
11
0
Country state dropdown in php and javascript
Hi guys i read almost all titles which is related my question however i couldnt figure out what i am doing wrong i have 2 table country and states what i am trying to do is retreive data from states table when selected country is united states when i try to retreive states with isocode "US" i dont have any problem it is working however when i try to get states according to country id which is 226 for US id in my table i cannot retreive states please help me to find out what i am missing thanks a lot. here is the code im trying to retreive state data with iso_code thanks a lot for your help. var US = <?php // Connect to MySQL //mysql_connect(); //mysql_select_db(); $d = mysql_query( "SELECT * FROM states" ) or die( mysql_error() ); $states = array(); while( $r = mysql_fetch_assoc($d) ) { $states[] = $r['st_name']; } echo json_encode( $states ); ?>; function ChangeCountry(country) { var formField = ""; switch (country) { case "US": formField = "<select>"; for (var i = 0; i < US.length; i++) { formField += "<option>" + US[i] + "</option>"; } formField += "</select>"; break; document.getElementById("states").innerHTML = formField; } window.onload = function() { document.getElementById("country").onchange = function() { ChangeCountry(this.options[this.selectedIndex].value); } } <select id="country" name="country"> <?php $query = "SELECT * FROM countries "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['iso1_code']."\">".$row['name']."</option>\n "; } ?> </select> <select id="states" name="states" style="width:150px;" onkeyup="sync()"> <?php $query = "SELECT * FROM states "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['states_id']."\">".$row['st_name']."</option>\n "; } ?> </select>
php
javascript
drop-down-menu
state
country
null
open
Country state dropdown in php and javascript === Hi guys i read almost all titles which is related my question however i couldnt figure out what i am doing wrong i have 2 table country and states what i am trying to do is retreive data from states table when selected country is united states when i try to retreive states with isocode "US" i dont have any problem it is working however when i try to get states according to country id which is 226 for US id in my table i cannot retreive states please help me to find out what i am missing thanks a lot. here is the code im trying to retreive state data with iso_code thanks a lot for your help. var US = <?php // Connect to MySQL //mysql_connect(); //mysql_select_db(); $d = mysql_query( "SELECT * FROM states" ) or die( mysql_error() ); $states = array(); while( $r = mysql_fetch_assoc($d) ) { $states[] = $r['st_name']; } echo json_encode( $states ); ?>; function ChangeCountry(country) { var formField = ""; switch (country) { case "US": formField = "<select>"; for (var i = 0; i < US.length; i++) { formField += "<option>" + US[i] + "</option>"; } formField += "</select>"; break; document.getElementById("states").innerHTML = formField; } window.onload = function() { document.getElementById("country").onchange = function() { ChangeCountry(this.options[this.selectedIndex].value); } } <select id="country" name="country"> <?php $query = "SELECT * FROM countries "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['iso1_code']."\">".$row['name']."</option>\n "; } ?> </select> <select id="states" name="states" style="width:150px;" onkeyup="sync()"> <?php $query = "SELECT * FROM states "; $result = mysql_query($query); while($row = mysql_fetch_array($result)) { echo "<option value=\"".$row['states_id']."\">".$row['st_name']."</option>\n "; } ?> </select>
0
8,948,087
01/20/2012 21:30:04
329,637
04/30/2010 09:27:00
15,366
553
Is there any major programming language that doesn't support any form of reflection?
Wikipedia defines reflection as follows: > In computer science, reflection is the process by which a computer > program can observe (do type introspection) and modify its own > structure and behavior at runtime.[1] Is there any major programming language (widely used in Academia or Industry) that doesn't support any form of reflection? All the examples I'm currently thinking of have at least limited support. But for C I'm for example not sure.
c
reflection
programming-languages
null
null
01/21/2012 14:17:58
not constructive
Is there any major programming language that doesn't support any form of reflection? === Wikipedia defines reflection as follows: > In computer science, reflection is the process by which a computer > program can observe (do type introspection) and modify its own > structure and behavior at runtime.[1] Is there any major programming language (widely used in Academia or Industry) that doesn't support any form of reflection? All the examples I'm currently thinking of have at least limited support. But for C I'm for example not sure.
4
11,468,931
07/13/2012 10:44:12
1,115,410
12/25/2011 15:37:49
1
0
subtract the full url after the hash
i want to load my pages on my website with AJAX and jQuery. It works fine but the url's looks [***http://mywebsite.com/#mywebsite.com/thepage***][1] i want to subtract the url so it looks like [***http://mywebsite.com/#thepage***][2] i hope someone know how to do that. This is the code: if(window.location.hash) { } else { window.location="#THE_FULL_URL"; } var newHash = "", $mainContent = $("#wrapper"), $pageWrap = $("#wrapper"), $el; $("a").live("click", function(event){ window.location.hash = $(this).attr('href'); return false; }); $(window).bind('hashchange', function(){ var hash = location.hash; document.title = ( hash.replace(/^.*#/, '') || 'blank' ) + '.'; newHash = window.location.hash.substring(1); if (newHash) { $mainContent .find(".content") .fadeOut(200, function() { $mainContent.hide().load(newHash + " .content", function() { $mainContent.fadeIn(); fix(); }); }); }; }); $(window).trigger('hashchange'); [1]: http:// [2]: http://
java
jquery
ajax
hash
location
null
open
subtract the full url after the hash === i want to load my pages on my website with AJAX and jQuery. It works fine but the url's looks [***http://mywebsite.com/#mywebsite.com/thepage***][1] i want to subtract the url so it looks like [***http://mywebsite.com/#thepage***][2] i hope someone know how to do that. This is the code: if(window.location.hash) { } else { window.location="#THE_FULL_URL"; } var newHash = "", $mainContent = $("#wrapper"), $pageWrap = $("#wrapper"), $el; $("a").live("click", function(event){ window.location.hash = $(this).attr('href'); return false; }); $(window).bind('hashchange', function(){ var hash = location.hash; document.title = ( hash.replace(/^.*#/, '') || 'blank' ) + '.'; newHash = window.location.hash.substring(1); if (newHash) { $mainContent .find(".content") .fadeOut(200, function() { $mainContent.hide().load(newHash + " .content", function() { $mainContent.fadeIn(); fix(); }); }); }; }); $(window).trigger('hashchange'); [1]: http:// [2]: http://
0
1,790,425
11/24/2009 14:28:56
187,610
10/10/2009 10:43:56
1
1
Invalid PHP JSON encoding
I'm working on a project in PHP (5.3.1) where I need to send a JSON string to a webservice (in python), but the result I get from json_encode does not pass as a valid JSON (i'm using JSLint to check validity). I should add that the structure I'm trying to encode is fairly big (13K encoded), and consists partially of UTF8 data, and while json_encode does handle it, i get spaces in weird places in the result. For example, I could get {"hello":tru e} or {"hell o":true} which results in an error from the webservice since the JSON is invalid (or data, like in the second example). I've also tried to use Zend framework for JSON encoding, but that didn't make much different. Is there a known issue with JSON in PHP? Did anyone encounter that behavior and found a solution?
php
json
encode
utf-8
invalid
null
open
Invalid PHP JSON encoding === I'm working on a project in PHP (5.3.1) where I need to send a JSON string to a webservice (in python), but the result I get from json_encode does not pass as a valid JSON (i'm using JSLint to check validity). I should add that the structure I'm trying to encode is fairly big (13K encoded), and consists partially of UTF8 data, and while json_encode does handle it, i get spaces in weird places in the result. For example, I could get {"hello":tru e} or {"hell o":true} which results in an error from the webservice since the JSON is invalid (or data, like in the second example). I've also tried to use Zend framework for JSON encoding, but that didn't make much different. Is there a known issue with JSON in PHP? Did anyone encounter that behavior and found a solution?
0
3,033,758
06/13/2010 20:19:27
349,159
05/24/2010 17:14:11
1
0
Application runs on eclipse emulator, but not others
I'm new to android app development but I've successfully created my first real application in eclipse. It runs perfectly in the eclipse emulator so I compiled it and tried to install it on another emulator. It installs successfully, but won't run at all. I'm not even sure how to begin finding the error since everything works so well in eclipse. Can someone refer me to a resource to help me start troubleshooting the problem. I think it might have something to do with the compilation, but I just don't know. Thanks!
android
android-emulator
null
null
null
null
open
Application runs on eclipse emulator, but not others === I'm new to android app development but I've successfully created my first real application in eclipse. It runs perfectly in the eclipse emulator so I compiled it and tried to install it on another emulator. It installs successfully, but won't run at all. I'm not even sure how to begin finding the error since everything works so well in eclipse. Can someone refer me to a resource to help me start troubleshooting the problem. I think it might have something to do with the compilation, but I just don't know. Thanks!
0
9,937,447
03/30/2012 05:30:44
1,302,478
03/30/2012 05:28:16
1
0
Uploading videos to youtube from native android app
Has anyone tried to upload a video to YouTube using a native android application? What form of authentication is most recommended?
android
youtube-api
null
null
null
null
open
Uploading videos to youtube from native android app === Has anyone tried to upload a video to YouTube using a native android application? What form of authentication is most recommended?
0
11,219,422
06/27/2012 04:30:12
1,484,530
06/27/2012 04:27:15
1
0
Script to find total time of window Idle or lock state
I would like to build a script which can calculate total time when my workstation was in lock or in idle state. Other way around is: If we can find how much time my PC was active (was not in lock or idle state) Kindly suggest. Best Regards, Milan Jain
batch-script
null
null
null
null
06/28/2012 11:02:22
not a real question
Script to find total time of window Idle or lock state === I would like to build a script which can calculate total time when my workstation was in lock or in idle state. Other way around is: If we can find how much time my PC was active (was not in lock or idle state) Kindly suggest. Best Regards, Milan Jain
1
5,542,443
04/04/2011 18:06:43
686,389
03/31/2011 19:18:41
6
0
generating dmp files from an inproc com dll running in dllhost.exe
I am writing an inproc com dll that runs in the dllhost.exe surrogate, but I see an issue debugging it. in exe's that I've written, I have a top level exception handler that creates a .dmp file i can load in windbg and then crashes, and I'm unsure of how to do this from dllhost. Is there another way to generate stack dumps from dllhost.exe on a crash? i've seen this page (http://support.microsoft.com/kb/910904), but it seems to involve the component services program. Is there some registry setting for this? Because it's something that will be installed on other computers. Thanks
c++
windows
com
null
null
null
open
generating dmp files from an inproc com dll running in dllhost.exe === I am writing an inproc com dll that runs in the dllhost.exe surrogate, but I see an issue debugging it. in exe's that I've written, I have a top level exception handler that creates a .dmp file i can load in windbg and then crashes, and I'm unsure of how to do this from dllhost. Is there another way to generate stack dumps from dllhost.exe on a crash? i've seen this page (http://support.microsoft.com/kb/910904), but it seems to involve the component services program. Is there some registry setting for this? Because it's something that will be installed on other computers. Thanks
0
8,781,550
01/08/2012 21:34:07
960,014
09/22/2011 21:13:05
1
0
What is a fallback interface and what is it used for?
I am starting to play with Linux IP routing for a project I am involved in and I have read the term "fallback interface" thrown around quite a bit. What is the use of a fallback interface? and when is it used?
linux
networking
interface
null
null
01/08/2012 23:19:03
off topic
What is a fallback interface and what is it used for? === I am starting to play with Linux IP routing for a project I am involved in and I have read the term "fallback interface" thrown around quite a bit. What is the use of a fallback interface? and when is it used?
2
1,662,737
11/02/2009 18:00:17
201,113
11/02/2009 18:00:17
1
0
initializing a const multidimensional array in c++
I'm currently working through some exercises in a c++ book, which uses text based games as its teaching tool. The exercise I am stuck on involves getting the pc to select a word from a const array of words (strings), mixing the letters up and asking the player to guess the word. This was easy, but as a follow on the book asks to add the option to provide a hint to the player to help them guess, firstly as a parallel array (again, no problem) and then as a 2 dimensional array. This is where I'm stuck. My (shortened) array of words is as follows: const string WORDS[NUM_WORDS] = {"wall", "glasses"}; I need to provide a hint for each of these words but not sure how to go about it. Posting this from phone so extensive googling is not an option! My parallel array was as follows: const string HINTS[NUM_WORDS] = "brick...", "worn on head"}; Just need to combine the two. Thanks in advance, Barry
c++
const
arrays
multidimensional
null
null
open
initializing a const multidimensional array in c++ === I'm currently working through some exercises in a c++ book, which uses text based games as its teaching tool. The exercise I am stuck on involves getting the pc to select a word from a const array of words (strings), mixing the letters up and asking the player to guess the word. This was easy, but as a follow on the book asks to add the option to provide a hint to the player to help them guess, firstly as a parallel array (again, no problem) and then as a 2 dimensional array. This is where I'm stuck. My (shortened) array of words is as follows: const string WORDS[NUM_WORDS] = {"wall", "glasses"}; I need to provide a hint for each of these words but not sure how to go about it. Posting this from phone so extensive googling is not an option! My parallel array was as follows: const string HINTS[NUM_WORDS] = "brick...", "worn on head"}; Just need to combine the two. Thanks in advance, Barry
0
8,412,625
12/07/2011 08:59:25
1,083,189
12/06/2011 09:23:37
1
0
Microsoft Project Leveling Resources
I use microsoft project for management of multiple projects across multiple resources. When I use Resource Leveling feature to level tasks from particular periodlet's say from 07DEC2011-12DEC2011, it correctly chooses tasks between this interval and performs leveling. However when it performs leveling it can acllocate task A which was scheduled let's say on 07DEC2011 to date 01DEC2011(which has already passed), the reason might be on date 01DEC2011 we haven't used resource fully. I do want this to happen and would want tasks between above period to be assigned on or beyond today(07DEC2011). Is there any feature available in Microsoft Project?
microsoft
project
null
null
null
12/08/2011 17:48:45
off topic
Microsoft Project Leveling Resources === I use microsoft project for management of multiple projects across multiple resources. When I use Resource Leveling feature to level tasks from particular periodlet's say from 07DEC2011-12DEC2011, it correctly chooses tasks between this interval and performs leveling. However when it performs leveling it can acllocate task A which was scheduled let's say on 07DEC2011 to date 01DEC2011(which has already passed), the reason might be on date 01DEC2011 we haven't used resource fully. I do want this to happen and would want tasks between above period to be assigned on or beyond today(07DEC2011). Is there any feature available in Microsoft Project?
2
10,373,807
04/29/2012 16:30:29
951,623
09/18/2011 20:19:43
11
0
Heap corruption with large memory allocation sizes C++
/*This code causes a heap corruption corresponding to Visual Studio 2010 What causes heap corruption? and what part of this code is causing it?*/ #define size 65536 int main() { int* a = new int[size];//size is equal to srand(time(NULL)); for(int i = 0 ; i < size; i++) { a[i]= 1 + rand() % 10; } for(int i = 0; (size / 2) / pow((double)2, i)>= 1; i++) { int n = pow((double)2, i); int offset = 0; for(int j = 0; j < (size / 2) / pow((double)2, i); j++) { int* tmp = new int[n]; merge(a + offset, n, a + offset + n, n, tmp); memcpy(a + offset, tmp, n*2 * sizeof(int)); offset += pow((double)2, i+1); } } for(int i = 0; i < size; i++) { cout<<a[i]<<" "; } cout<<endl; system("PAUSE"); return 0; }
c++
null
null
null
null
04/30/2012 19:37:35
too localized
Heap corruption with large memory allocation sizes C++ === /*This code causes a heap corruption corresponding to Visual Studio 2010 What causes heap corruption? and what part of this code is causing it?*/ #define size 65536 int main() { int* a = new int[size];//size is equal to srand(time(NULL)); for(int i = 0 ; i < size; i++) { a[i]= 1 + rand() % 10; } for(int i = 0; (size / 2) / pow((double)2, i)>= 1; i++) { int n = pow((double)2, i); int offset = 0; for(int j = 0; j < (size / 2) / pow((double)2, i); j++) { int* tmp = new int[n]; merge(a + offset, n, a + offset + n, n, tmp); memcpy(a + offset, tmp, n*2 * sizeof(int)); offset += pow((double)2, i+1); } } for(int i = 0; i < size; i++) { cout<<a[i]<<" "; } cout<<endl; system("PAUSE"); return 0; }
3
3,239,097
07/13/2010 16:13:21
259,764
01/27/2010 03:46:48
1,507
108
Methods of a "belongs to" and "has many" relationships
Let's say that I have two tables in my database: users countries I have two defined relationships on each user `belongsTo` a country and each country `hasMany` users.. (**CakePHP** model relationships) And I want to crate the model `findUsersFromCountry($countryID)` in wich class/model this method will be? It must be inside the `User` model or the `Country` model?
php
oop
cakephp
entity-relationship
null
null
open
Methods of a "belongs to" and "has many" relationships === Let's say that I have two tables in my database: users countries I have two defined relationships on each user `belongsTo` a country and each country `hasMany` users.. (**CakePHP** model relationships) And I want to crate the model `findUsersFromCountry($countryID)` in wich class/model this method will be? It must be inside the `User` model or the `Country` model?
0
4,066,005
11/01/2010 00:55:25
246,408
01/08/2010 13:16:51
4,495
119
Transcendental math functions in 64-bit Delphi compiler
Following my [previous question][1] (I assume that 64-bit compiler uses only SSE instructions for floating point calculations): - How transcendental math functions (sin, atan, exp, log, etc.) are implemented in 64-bit Delphi compiler? AFAIK there are no SSE hardware implementations. What software library is used, what about the **performance and accuracy compared with the current FPU hardware implementation**? [See also][2] [1]: http://stackoverflow.com/questions/4064189/floating-point-support-in-64-bit-compiler [2]: http://stackoverflow.com/questions/2284860/how-does-c-compute-sin-and-other-math-functions
delphi
math
delphi-xe2
null
null
11/04/2010 02:25:11
not constructive
Transcendental math functions in 64-bit Delphi compiler === Following my [previous question][1] (I assume that 64-bit compiler uses only SSE instructions for floating point calculations): - How transcendental math functions (sin, atan, exp, log, etc.) are implemented in 64-bit Delphi compiler? AFAIK there are no SSE hardware implementations. What software library is used, what about the **performance and accuracy compared with the current FPU hardware implementation**? [See also][2] [1]: http://stackoverflow.com/questions/4064189/floating-point-support-in-64-bit-compiler [2]: http://stackoverflow.com/questions/2284860/how-does-c-compute-sin-and-other-math-functions
4
5,680,722
04/15/2011 18:14:09
484,338
10/22/2010 14:47:40
45
1
mysqlserver just freaked out after running OpenEMM.sh start... any mysql gods out there smiling on me today?
So nothings changed in the mysql config... and plugin.frm is there and i checked all the permissions on ibdata1.... Anyone have any magic ideas? 110416 00:00:25 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data ^G/opt/bitnami/mysql/bin/mysqld.bin: Can't find file: './mysql/plugin.frm' (errno: 13) 110416 0:00:25 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 110416 0:00:25 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'create'. InnoDB: Cannot continue operation. 110416 00:00:25 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/domU-12-31-38-04-61-21.pid ended
mysql
ubuntu
null
null
null
04/16/2011 07:40:56
off topic
mysqlserver just freaked out after running OpenEMM.sh start... any mysql gods out there smiling on me today? === So nothings changed in the mysql config... and plugin.frm is there and i checked all the permissions on ibdata1.... Anyone have any magic ideas? 110416 00:00:25 mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data ^G/opt/bitnami/mysql/bin/mysqld.bin: Can't find file: './mysql/plugin.frm' (errno: 13) 110416 0:00:25 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 110416 0:00:25 InnoDB: Operating system error number 13 in a file operation. InnoDB: The error means mysqld does not have the access rights to InnoDB: the directory. InnoDB: File name ./ibdata1 InnoDB: File operation call: 'create'. InnoDB: Cannot continue operation. 110416 00:00:25 mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/domU-12-31-38-04-61-21.pid ended
2
10,503,406
05/08/2012 17:23:59
576,050
01/14/2011 18:40:29
333
6
Gridview paging style in asp.net
i have a gridview, and need a specific pagination style, for the Paging, here's what the output i need, can anyone tell me how can i achieve this: ![Custom pagination design in gridview][1] [1]: http://i.stack.imgur.com/75hPV.png
asp.net
gridview
pagination
styling
null
05/09/2012 17:27:22
not a real question
Gridview paging style in asp.net === i have a gridview, and need a specific pagination style, for the Paging, here's what the output i need, can anyone tell me how can i achieve this: ![Custom pagination design in gridview][1] [1]: http://i.stack.imgur.com/75hPV.png
1
6,787,233
07/22/2011 08:10:00
850,019
07/18/2011 12:33:03
6
0
Python, how to ready bytes from file and save it?
i want to read bytes from file and then write this bytes to another file and save it how do i do this? There is no code, i don't know how to do this?
python
null
null
null
null
06/22/2012 11:49:50
not a real question
Python, how to ready bytes from file and save it? === i want to read bytes from file and then write this bytes to another file and save it how do i do this? There is no code, i don't know how to do this?
1
8,387,116
12/05/2011 14:49:54
689,777
04/03/2011 12:08:20
421
12
how to create a comment system like stackoverflow
i am using asp.net to create a basic comment system , it goes like this: 1- i have two text-boxes for the username and the comment it self, the content of these text-boxes are inserted within a database. 2- retrieve the database content using a dataset to a grid-view. ... everything works great by my question is: **how do i allow replies to comments like in stackoverflow. like user A says "hi" then user B says "@A - hi". how do i order them so that the reply is below the first comment?** hope everything makes sense, thanks
jquery
asp.net
dataset
comments
null
12/06/2011 17:10:03
not a real question
how to create a comment system like stackoverflow === i am using asp.net to create a basic comment system , it goes like this: 1- i have two text-boxes for the username and the comment it self, the content of these text-boxes are inserted within a database. 2- retrieve the database content using a dataset to a grid-view. ... everything works great by my question is: **how do i allow replies to comments like in stackoverflow. like user A says "hi" then user B says "@A - hi". how do i order them so that the reply is below the first comment?** hope everything makes sense, thanks
1
8,290,208
11/28/2011 00:12:40
776,967
05/31/2011 02:02:20
25
1
Improving MySQL Query Performance
I have a large table which is nothing but responses of users and I need to generate chart data from that table. Doing it at the time of chart creation is taking more time to load the page. Is it possible to have all of the calculations that I need to be done on mysql itself and I directly access data from that. I think using stored procedures and views, we can do that. Can any one point me in the right direction on which process will not affect performance to users at the time of responding to questions and at the time of viewing charts. Thanks, Murali.
php
mysql
performance
null
null
11/28/2011 03:49:34
not a real question
Improving MySQL Query Performance === I have a large table which is nothing but responses of users and I need to generate chart data from that table. Doing it at the time of chart creation is taking more time to load the page. Is it possible to have all of the calculations that I need to be done on mysql itself and I directly access data from that. I think using stored procedures and views, we can do that. Can any one point me in the right direction on which process will not affect performance to users at the time of responding to questions and at the time of viewing charts. Thanks, Murali.
1
8,374,467
12/04/2011 09:42:28
219,438
11/26/2009 14:00:10
98
1
Open source applications using JPA 2
I'm working on the comparison of JPA2 implementations OpenJPA, EclipseLink and Hibernate EntityManager. Do you know about any non-trivial open-source applications using them? Thank you.
java
hibernate
jpa
eclipselink
openjpa
12/05/2011 10:01:44
not constructive
Open source applications using JPA 2 === I'm working on the comparison of JPA2 implementations OpenJPA, EclipseLink and Hibernate EntityManager. Do you know about any non-trivial open-source applications using them? Thank you.
4
11,421,499
07/10/2012 20:34:31
573,110
07/28/2010 17:32:05
216
3
Dojo dnd (drag and drop) 1.7.2 - How to maintain a separate (non-dojo-dnd) list?
I'm using Dojo dnd version 1.7.2 and it's generally working really well. I'm happy. My app maintains many arrays of items, and as the user drags and drops items around, I need to ensure that my arrays are updated to reflect the contents the user is seeing. I need to run some code around the time of `Source`.`onDndDrop` ... If I use `dojo.connect` to set up a handler on my Source for `onDndDrop` or `onDrop`, my code seems to get called too late. That is, the `source` that's passed to the handler doesn't actually have the item in it any more. This is a problem because I want to call `source.getItem(nodes[0].id)` to get at the actual data that's being dragged around so I can find it in my arrays and update them to reflect the change the user is making. Perhaps I'm going about this wrong; and there's a better way?
dojo
dnd
dojo-dnd
null
null
null
open
Dojo dnd (drag and drop) 1.7.2 - How to maintain a separate (non-dojo-dnd) list? === I'm using Dojo dnd version 1.7.2 and it's generally working really well. I'm happy. My app maintains many arrays of items, and as the user drags and drops items around, I need to ensure that my arrays are updated to reflect the contents the user is seeing. I need to run some code around the time of `Source`.`onDndDrop` ... If I use `dojo.connect` to set up a handler on my Source for `onDndDrop` or `onDrop`, my code seems to get called too late. That is, the `source` that's passed to the handler doesn't actually have the item in it any more. This is a problem because I want to call `source.getItem(nodes[0].id)` to get at the actual data that's being dragged around so I can find it in my arrays and update them to reflect the change the user is making. Perhaps I'm going about this wrong; and there's a better way?
0
10,667,734
05/19/2012 18:16:07
1,392,672
05/13/2012 21:30:35
10
1
Java File - Open A File And Write To It
I know we are supposed to add a snipit of code to our questions, but I am seriously dumbfounded and can't wrap my head or find any examples to follow from. Basically I want to open file **C:\A.txt** , which already has contents in it, and write a string at the end. Basically like this. File A.txt contains: John Bob Larry I want to open it and write Sue at the end so the file now contains: John Bob Larry Sue Sorry for no code example, my brain is dead this morning....
java
file
null
null
null
05/21/2012 11:10:54
not a real question
Java File - Open A File And Write To It === I know we are supposed to add a snipit of code to our questions, but I am seriously dumbfounded and can't wrap my head or find any examples to follow from. Basically I want to open file **C:\A.txt** , which already has contents in it, and write a string at the end. Basically like this. File A.txt contains: John Bob Larry I want to open it and write Sue at the end so the file now contains: John Bob Larry Sue Sorry for no code example, my brain is dead this morning....
1
10,839,771
05/31/2012 19:09:17
358,524
06/04/2010 14:07:32
67
2
jQuery ajax:error runs even if the response is OK 200
I have a form which submit a form via AJAX with :remote => true. Looking at the server log and FireBug, I get the response 200 OK and it returns JSON in the form of: { "email": "test@test.com"} then I have these two handlers: $('#new_invitation').bind("ajax:success", function(event, data, status, xhr) { alert('test'); }); $('#new_invitation').bind("ajax:error", function() { alert('error'); }); and even if I get back a 200OK, it is the error handler that fires. The only time I managed to make the success handler work was when I send a empty response with 200 in the header. I can't figure out why this isnt working :-S
jquery
ruby-on-rails-3
jquery-ajax
null
null
null
open
jQuery ajax:error runs even if the response is OK 200 === I have a form which submit a form via AJAX with :remote => true. Looking at the server log and FireBug, I get the response 200 OK and it returns JSON in the form of: { "email": "test@test.com"} then I have these two handlers: $('#new_invitation').bind("ajax:success", function(event, data, status, xhr) { alert('test'); }); $('#new_invitation').bind("ajax:error", function() { alert('error'); }); and even if I get back a 200OK, it is the error handler that fires. The only time I managed to make the success handler work was when I send a empty response with 200 in the header. I can't figure out why this isnt working :-S
0
5,347,025
03/18/2011 01:12:33
665,337
03/18/2011 01:10:52
1
0
'OUTPUT' DML does not work in SQL Server 2008 R2
I am trying to use the OUTPUT DML command in SQL Server 2008 R2 against a database but it highlights with the red squiggly, and says 'OUTPUT' Stored Procedure not found! What gives?:! http://msdn.microsoft.com/en-us/library/ms177564.aspx Thanks,
sql
sql-server-2008
null
null
null
03/18/2011 10:08:08
not a real question
'OUTPUT' DML does not work in SQL Server 2008 R2 === I am trying to use the OUTPUT DML command in SQL Server 2008 R2 against a database but it highlights with the red squiggly, and says 'OUTPUT' Stored Procedure not found! What gives?:! http://msdn.microsoft.com/en-us/library/ms177564.aspx Thanks,
1
10,519,823
05/09/2012 16:04:25
1,380,706
05/07/2012 21:05:26
6
0
FQL NOT IN Equivalent operator like <> , EXCEPT, !=
I'm trying to develop this code: $users = $facebook->api(array( 'method' => 'fql.query', 'query' => "SELECT uid, last_name, pic_big" + " FROM user WHERE uid IN (" + " SELECT uid" + " FROM page_fan" + " WHERE page_id='411133928921438'" + " AND uid IN (" + " SELECT uid2 FROM friend WHERE uid1 = me()" + " )" + ")" )); The idea is that i don't want to use the operator IN but NOT IN, but FQL doesn't support operators like NOT IN, EXCEPT... How can i do it with FQL?...
php
fql
null
null
null
null
open
FQL NOT IN Equivalent operator like <> , EXCEPT, != === I'm trying to develop this code: $users = $facebook->api(array( 'method' => 'fql.query', 'query' => "SELECT uid, last_name, pic_big" + " FROM user WHERE uid IN (" + " SELECT uid" + " FROM page_fan" + " WHERE page_id='411133928921438'" + " AND uid IN (" + " SELECT uid2 FROM friend WHERE uid1 = me()" + " )" + ")" )); The idea is that i don't want to use the operator IN but NOT IN, but FQL doesn't support operators like NOT IN, EXCEPT... How can i do it with FQL?...
0
8,971,059
01/23/2012 11:41:49
968,497
09/28/2011 06:28:12
1
0
Representative application to learn a new web language
I am thinking of trying out a few new web programming languages. Writing a hello world program is nice, but does not give a good overview of the language. Do you have any suggestions of what could be a representative application that showcases good and bad sides of the language and makes it perhaps easier to compare.
php
python
ruby-on-rails
web
dart
01/23/2012 20:41:49
off topic
Representative application to learn a new web language === I am thinking of trying out a few new web programming languages. Writing a hello world program is nice, but does not give a good overview of the language. Do you have any suggestions of what could be a representative application that showcases good and bad sides of the language and makes it perhaps easier to compare.
2
8,943,461
01/20/2012 15:07:27
1,118,749
12/28/2011 05:40:41
3
0
How to restore Panel from Terminal in Backtrack 5?
Guys I've accidentally deleted the panel in Backtrack 5 GNOME so can anyone tell me the commands to restore the panel ?
linux
panel
gnome
null
null
01/22/2012 15:17:55
off topic
How to restore Panel from Terminal in Backtrack 5? === Guys I've accidentally deleted the panel in Backtrack 5 GNOME so can anyone tell me the commands to restore the panel ?
2
3,021,711
06/11/2010 09:36:39
355,526
06/01/2010 14:40:49
8
0
OWL: get Class from an existent Antology
How can I get an existent Class from an Ontology with owlAPI? This is a fragment of my ontology: ... <owl:Class rdf:ID="StringDocu"> <owl:equivalentClass> <owl:Restriction> <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> <owl:onProperty rdf:resource="#hasContent"/> </owl:Restriction> </owl:equivalentClass> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >String Docu</rdfs:label> <rdfs:subClassOf rdf:resource="#Docu"/> <owl:disjointWith rdf:resource="#URIDocu"/> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >This class concerns a docu with the content specified as common text.</rdfs:comment> </owl:Class> ... I start whit this code: String ontologyUri = "http://mysite.com/my_ontology.owl"; OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.createOntology(IRI.create(ontologyUri)); OWLDataFactory factory = manager.getOWLDataFactory(); and now I want to retrieve the "StringDocu" class. How can I get this?
java
owl
null
null
null
null
open
OWL: get Class from an existent Antology === How can I get an existent Class from an Ontology with owlAPI? This is a fragment of my ontology: ... <owl:Class rdf:ID="StringDocu"> <owl:equivalentClass> <owl:Restriction> <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> <owl:onProperty rdf:resource="#hasContent"/> </owl:Restriction> </owl:equivalentClass> <rdfs:label rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >String Docu</rdfs:label> <rdfs:subClassOf rdf:resource="#Docu"/> <owl:disjointWith rdf:resource="#URIDocu"/> <rdfs:comment rdf:datatype="http://www.w3.org/2001/XMLSchema#string" >This class concerns a docu with the content specified as common text.</rdfs:comment> </owl:Class> ... I start whit this code: String ontologyUri = "http://mysite.com/my_ontology.owl"; OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = manager.createOntology(IRI.create(ontologyUri)); OWLDataFactory factory = manager.getOWLDataFactory(); and now I want to retrieve the "StringDocu" class. How can I get this?
0
8,190,645
11/18/2011 23:58:32
974
08/11/2008 09:02:40
5,480
113
Why does my call from flash to Javascript fail in IE9?
I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this: ExternalInterface.call( "myLovelyFunction", string1, string2); and the code in the JS looks something like this: function myLovelyFunction(string1, string2) { /* Do some UI things */ } In IE9, the function does absolutely nothing, but the console complains with: SCRIPT438: Object doesn't support property or method 'SetReturnValue' index.php, line 1 character 1 line 1, character 1 is obviously pointing at nothing in particular. I can make it work fine by switching on compatability view, although the console error doesn't go away. Is there anything about IE9 that causes this, and more importantly, how do I fix this?
javascript
flash
internet-explorer
internet-explorer-9
null
null
open
Why does my call from flash to Javascript fail in IE9? === I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this: ExternalInterface.call( "myLovelyFunction", string1, string2); and the code in the JS looks something like this: function myLovelyFunction(string1, string2) { /* Do some UI things */ } In IE9, the function does absolutely nothing, but the console complains with: SCRIPT438: Object doesn't support property or method 'SetReturnValue' index.php, line 1 character 1 line 1, character 1 is obviously pointing at nothing in particular. I can make it work fine by switching on compatability view, although the console error doesn't go away. Is there anything about IE9 that causes this, and more importantly, how do I fix this?
0
2,311,072
02/22/2010 13:22:41
271,007
02/11/2010 10:55:07
284
24
How to create endless stories for telenovela or tv-series programmatically?
Do you know any (web) sources that describe ways to continually produce stories from an initial base of parameters/objects and some given relationships? I'm interested in - theory and algorithms - real projects where it was done - how to measure redundance in such a system - (fun) sites with examples of something comparable
language-agnostic
nlp
algorithm
methodology
null
02/22/2010 17:15:12
not a real question
How to create endless stories for telenovela or tv-series programmatically? === Do you know any (web) sources that describe ways to continually produce stories from an initial base of parameters/objects and some given relationships? I'm interested in - theory and algorithms - real projects where it was done - how to measure redundance in such a system - (fun) sites with examples of something comparable
1
10,632,000
05/17/2012 08:08:57
1,387,194
05/10/2012 13:17:55
3
0
"application_restricted" when calling v1 API public_share
We are integrating Box API into our web application. I am able to call most of the V1 and V2 APIs such as file upload and download. When calling "public_share" API, I received this response **<?xml version='1.0' encoding='UTF-8' ?> &lt;response&gt;&lt;status&gt;application_restricted&lt;/status&gt;&lt;/response&gt;** We intend to use this API for users to link their Box files into our web site. It was working previously.
box-api
null
null
null
null
05/20/2012 14:22:11
not a real question
"application_restricted" when calling v1 API public_share === We are integrating Box API into our web application. I am able to call most of the V1 and V2 APIs such as file upload and download. When calling "public_share" API, I received this response **<?xml version='1.0' encoding='UTF-8' ?> &lt;response&gt;&lt;status&gt;application_restricted&lt;/status&gt;&lt;/response&gt;** We intend to use this API for users to link their Box files into our web site. It was working previously.
1
9,879,176
03/26/2012 20:19:30
624,525
02/19/2011 16:38:06
56
0
Open Source statistical Library
I need C# open source statistical library which provide one-way-anova and two-way-anova analysis.
c#
open-source
statistical-analysis
null
null
03/26/2012 20:21:05
not a real question
Open Source statistical Library === I need C# open source statistical library which provide one-way-anova and two-way-anova analysis.
1
9,880,143
03/26/2012 21:28:29
442,695
09/08/2010 17:46:31
2,312
106
Dictionary object won't predicate
I have a json object coming in as { "c_id": "261", "customer_id": "178729", "name": "Three, Test" }, { "c_id": "261", "customer_id": "178727", "name": "Two, Test" }, { "c_id": "261", "customer_id": "178728", "name": "Two, Test" }, { "c_id": "261", "customer_id": "185186", "name": "Valid, Another" }, { "c_id": "261", "customer_id": "183889", "name": "White, Betty" } However when this code processes NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; NSMutableArray *tempCustomers = [[NSMutableArray alloc] init]; for (NSDictionary *dict in [json objectForKey:@"data"]) { NSLog(@"dict: %@", dict); NSLog(@"name: %@", [dict objectForKey:@"name"]); [tempCustomers addObject:dict]; } self.customers = tempCustomers; NSLog(@"Customers: %@",customers); self.customerData = [self partitionObjects:[self customers] collationStringSelector:@selector(self)]; NSLog(@"CustomerData: %@",customerData); -(NSArray *)partitionObjects:(NSArray *)array collationStringSelector:(SEL)selector { UILocalizedIndexedCollation *collation = [UILocalizedIndexedCollation currentCollation]; NSInteger sectionCount = [[collation sectionTitles] count]; NSMutableArray *unsortedSections = [NSMutableArray arrayWithCapacity:sectionCount]; for (int i = 0; i < sectionCount; i++) { [unsortedSections addObject:[NSMutableArray array]]; } for (id object in array) { NSInteger index = [collation sectionForObject:[object objectForKey:@"name"] collationStringSelector:selector]; [[unsortedSections objectAtIndex:index] addObject:object]; } NSMutableArray *sections = [NSMutableArray arrayWithCapacity:sectionCount]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; for (NSMutableArray *section in unsortedSections) { NSArray *sortedArray = [section sortedArrayUsingDescriptors:sortDescriptors]; //NSLog(@"Sort: %@",sortedArray); //[sections addObject:[collation sortedArrayFromArray:section collationStringSelector:selector]]; [sections addObject:sortedArray]; } return sections; } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { NSLog(@"Search Display Controller: %@", self.customerData); //NSString *predicateString = [NSString stringWithFormat:@"name CONTAINS[cd] '%@'",searchString]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name CONTAINS[cd] '%@'",searchString]; self.filteredCustomers = [[self.customerData filteredArrayUsingPredicate:predicate] mutableCopy]; NSLog(@"Filtered Customers %@", self.filteredCustomers); return YES; } It shows 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Two, Test 2012-03-26 14:15:21.885 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 178728; name = "Two, Test"; } 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Two, Test 2012-03-26 14:15:21.885 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 185186; name = "Valid, Another"; } 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Valid, Another 2012-03-26 14:15:21.886 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 183889; name = "White, Betty"; } 2012-03-26 14:15:21.886 MyApp[65799:15003] name: White, Betty Notice the " " around the name key are missing. I believe this is why my `NSPredicate` in my `searchDisplayController` isn't working. Why are the quotes being removed and how would I fix my `searchDisplayController` to work?
objective-c
json
ios5
uisearchdisplaycontroller
null
null
open
Dictionary object won't predicate === I have a json object coming in as { "c_id": "261", "customer_id": "178729", "name": "Three, Test" }, { "c_id": "261", "customer_id": "178727", "name": "Two, Test" }, { "c_id": "261", "customer_id": "178728", "name": "Two, Test" }, { "c_id": "261", "customer_id": "185186", "name": "Valid, Another" }, { "c_id": "261", "customer_id": "183889", "name": "White, Betty" } However when this code processes NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error]; NSMutableArray *tempCustomers = [[NSMutableArray alloc] init]; for (NSDictionary *dict in [json objectForKey:@"data"]) { NSLog(@"dict: %@", dict); NSLog(@"name: %@", [dict objectForKey:@"name"]); [tempCustomers addObject:dict]; } self.customers = tempCustomers; NSLog(@"Customers: %@",customers); self.customerData = [self partitionObjects:[self customers] collationStringSelector:@selector(self)]; NSLog(@"CustomerData: %@",customerData); -(NSArray *)partitionObjects:(NSArray *)array collationStringSelector:(SEL)selector { UILocalizedIndexedCollation *collation = [UILocalizedIndexedCollation currentCollation]; NSInteger sectionCount = [[collation sectionTitles] count]; NSMutableArray *unsortedSections = [NSMutableArray arrayWithCapacity:sectionCount]; for (int i = 0; i < sectionCount; i++) { [unsortedSections addObject:[NSMutableArray array]]; } for (id object in array) { NSInteger index = [collation sectionForObject:[object objectForKey:@"name"] collationStringSelector:selector]; [[unsortedSections objectAtIndex:index] addObject:object]; } NSMutableArray *sections = [NSMutableArray arrayWithCapacity:sectionCount]; NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; for (NSMutableArray *section in unsortedSections) { NSArray *sortedArray = [section sortedArrayUsingDescriptors:sortDescriptors]; //NSLog(@"Sort: %@",sortedArray); //[sections addObject:[collation sortedArrayFromArray:section collationStringSelector:selector]]; [sections addObject:sortedArray]; } return sections; } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { NSLog(@"Search Display Controller: %@", self.customerData); //NSString *predicateString = [NSString stringWithFormat:@"name CONTAINS[cd] '%@'",searchString]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"name CONTAINS[cd] '%@'",searchString]; self.filteredCustomers = [[self.customerData filteredArrayUsingPredicate:predicate] mutableCopy]; NSLog(@"Filtered Customers %@", self.filteredCustomers); return YES; } It shows 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Two, Test 2012-03-26 14:15:21.885 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 178728; name = "Two, Test"; } 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Two, Test 2012-03-26 14:15:21.885 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 185186; name = "Valid, Another"; } 2012-03-26 14:15:21.885 MyApp[65799:15003] name: Valid, Another 2012-03-26 14:15:21.886 MyApp[65799:15003] dict: { "c_id" = 261; "customer_id" = 183889; name = "White, Betty"; } 2012-03-26 14:15:21.886 MyApp[65799:15003] name: White, Betty Notice the " " around the name key are missing. I believe this is why my `NSPredicate` in my `searchDisplayController` isn't working. Why are the quotes being removed and how would I fix my `searchDisplayController` to work?
0
9,668,140
03/12/2012 13:42:16
248,925
01/12/2010 13:59:44
334
16
Add View Model class dropdown not showing my class
I’ve created a new C# asp.net mvc 4.0 (beta) Internet Application and I’m having a somewhat odd behavior in the Add View dialog in Visual Studio 2010 (sp1). When I decide to create a strongly-typed View, inside the Add View dialog, the Model class dropdown does not show my ViewModel class. *For the record, yes I did compile the application before triggering the Add View dialog.* I believe I have pinpointed the issue but do not know how to fix it. Below are the repro-steps if anyone cares to reproduce the behavior: 1. In Visual Studio 2010 (sp1), create a new C# asp.net MVC 4.0 (beta) Internet Application. 2. Inside the Models folder, create a new simple class called “GazouViewModel.cs” 3. Build the application, open the HomeController, right-click the Index() ActionResult and select Add View… 4. In the Add View dialog, check the “strongly-typed view” checkbox and in the Model class: dropdown, you’ll notice your “GazouViewModel” ---------------- 1. In Solution Explorer, right-click your project and select “Manage NuGet Packages” 2. Search, find and install the “Bootstrapper.Autofac” package. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” should still be displaying in the dropdown. ---------------- 1. In Solution Explorer, right-click your project and select “Manage NuGet Packages” 2. Search, find and install the “Autofac ASP.NET MVC4 (Beta) Integration” package. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” should still be displaying in the dropdown. ---------------- 1. In Solution Explorer, right-click your project and ADD a new class (Class1.cs) anywhere it doesn’t matter. 2. Make that Class1 implement IAutofacRegistration and implement the interface. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” is no longer showing inside the Model class dropdown. It appears that as soon as I create a class that implements the `IAutofacRegistration` interface and build the application, I’m no longer capable of viewing my ViewModels in that dropdown. Can anyone confirm if they are getting the same results as me? And more importantly, how can one fix this? **IMPORTANT**: I have tried the exact same steps with an mvc 3.0 application and the exact same behavior occurs…so this is not relevant to the BETA version. Sincerely Vince
asp.net-mvc
visual-studio-2010
null
null
null
null
open
Add View Model class dropdown not showing my class === I’ve created a new C# asp.net mvc 4.0 (beta) Internet Application and I’m having a somewhat odd behavior in the Add View dialog in Visual Studio 2010 (sp1). When I decide to create a strongly-typed View, inside the Add View dialog, the Model class dropdown does not show my ViewModel class. *For the record, yes I did compile the application before triggering the Add View dialog.* I believe I have pinpointed the issue but do not know how to fix it. Below are the repro-steps if anyone cares to reproduce the behavior: 1. In Visual Studio 2010 (sp1), create a new C# asp.net MVC 4.0 (beta) Internet Application. 2. Inside the Models folder, create a new simple class called “GazouViewModel.cs” 3. Build the application, open the HomeController, right-click the Index() ActionResult and select Add View… 4. In the Add View dialog, check the “strongly-typed view” checkbox and in the Model class: dropdown, you’ll notice your “GazouViewModel” ---------------- 1. In Solution Explorer, right-click your project and select “Manage NuGet Packages” 2. Search, find and install the “Bootstrapper.Autofac” package. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” should still be displaying in the dropdown. ---------------- 1. In Solution Explorer, right-click your project and select “Manage NuGet Packages” 2. Search, find and install the “Autofac ASP.NET MVC4 (Beta) Integration” package. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” should still be displaying in the dropdown. ---------------- 1. In Solution Explorer, right-click your project and ADD a new class (Class1.cs) anywhere it doesn’t matter. 2. Make that Class1 implement IAutofacRegistration and implement the interface. 3. Rebuild the application and verify if your “GazouViewModel” still displays inside the Add View dropdown’s dialog. 4. The “GazouViewModel” is no longer showing inside the Model class dropdown. It appears that as soon as I create a class that implements the `IAutofacRegistration` interface and build the application, I’m no longer capable of viewing my ViewModels in that dropdown. Can anyone confirm if they are getting the same results as me? And more importantly, how can one fix this? **IMPORTANT**: I have tried the exact same steps with an mvc 3.0 application and the exact same behavior occurs…so this is not relevant to the BETA version. Sincerely Vince
0
656,335
03/17/2009 22:51:16
71,990
02/27/2009 18:20:46
412
38
VMWare Server 2.0.0 and vista 64bit DNS dosnt resolve
I have the following VM with CentOS 5 running on vista 64. I have my DNS set in my resolve.conf (servers resolve on my windows machine and I have tried various servers). I can ping the DNS but it wont resolve any names for me. I have put some names in my vhost and those domain work fine. Is anyone else having this issue? Is DNS busted on this configuration?
development-environment
setup
dns
linux
null
null
open
VMWare Server 2.0.0 and vista 64bit DNS dosnt resolve === I have the following VM with CentOS 5 running on vista 64. I have my DNS set in my resolve.conf (servers resolve on my windows machine and I have tried various servers). I can ping the DNS but it wont resolve any names for me. I have put some names in my vhost and those domain work fine. Is anyone else having this issue? Is DNS busted on this configuration?
0
1,142,296
07/17/2009 09:36:28
75,500
03/09/2009 06:16:32
581
52
Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table.
## Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table. ## Hi. I need to log information about about every step that goes on in the application in an SQL DB. There are certain tables, I want the log should be related to: Product - should log when a product has been created changed etc. Order - same as above Shipping - same etc. etc. etc. The data will be need to be retrieved often. I have few ideas on how to do it: 1. Have a log table that will contain columns for all these tables, then when I wanna represent data in the UI for a certain Product will do select * from Log where LogId = Product.ProductId. I know that this might be funny to have many cols, but I have this feeling that performance will be better. In the other hand there will be a huge amount of rows in this table. 2. Have many log tables for each log type (ProductLogs, OrderLogs etc.) I really don't like this idea since it's not consistent and have many tables with same structure doesn't make sense, but (?) it might be quicker when searching in a table that has a lower amount of rows (m i wrong?). 3. According to statement no. 1, I could do a second many-2-many table that will have LogId, TableNameId and RowId cols, and will reference a log row to many table rows in the DB, than will have a UDF to retrieve data (e.g. log id 234 belongs to table Customer at CustomerId 345 and to Product table where productId = RowId); I think this is the nicest way to do it, but again, there might be a huge amount of rows, will it slow down the search? or this is how it should be done, whatcha say?...
sql-server
sql
performance
datastorage
null
null
open
Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table. === ## Performance consideration: Spread rows in multiple tables vs concentrate all rows in one table. ## Hi. I need to log information about about every step that goes on in the application in an SQL DB. There are certain tables, I want the log should be related to: Product - should log when a product has been created changed etc. Order - same as above Shipping - same etc. etc. etc. The data will be need to be retrieved often. I have few ideas on how to do it: 1. Have a log table that will contain columns for all these tables, then when I wanna represent data in the UI for a certain Product will do select * from Log where LogId = Product.ProductId. I know that this might be funny to have many cols, but I have this feeling that performance will be better. In the other hand there will be a huge amount of rows in this table. 2. Have many log tables for each log type (ProductLogs, OrderLogs etc.) I really don't like this idea since it's not consistent and have many tables with same structure doesn't make sense, but (?) it might be quicker when searching in a table that has a lower amount of rows (m i wrong?). 3. According to statement no. 1, I could do a second many-2-many table that will have LogId, TableNameId and RowId cols, and will reference a log row to many table rows in the DB, than will have a UDF to retrieve data (e.g. log id 234 belongs to table Customer at CustomerId 345 and to Product table where productId = RowId); I think this is the nicest way to do it, but again, there might be a huge amount of rows, will it slow down the search? or this is how it should be done, whatcha say?...
0
4,677,476
01/13/2011 06:41:04
494,343
11/02/2010 05:27:29
406
51
WCF: service hosting outside of IIS makes IIS an atrophy
It appears MS is shooting itself in the leg allowing hosting of WCF services outside of IIS. IIS is relatively simple but yet redundant layer for services from my perspective. Introduction of WCF tremendously simplifies service hosting making IIS an atrophy. So what do you think? I am missing something? Why would I use IIS for WCF services? Because I don't see a reason.
c#
.net
wcf
web-services
iis
01/13/2011 14:39:58
not constructive
WCF: service hosting outside of IIS makes IIS an atrophy === It appears MS is shooting itself in the leg allowing hosting of WCF services outside of IIS. IIS is relatively simple but yet redundant layer for services from my perspective. Introduction of WCF tremendously simplifies service hosting making IIS an atrophy. So what do you think? I am missing something? Why would I use IIS for WCF services? Because I don't see a reason.
4
10,004,880
04/04/2012 04:21:41
933,979
09/08/2011 03:41:39
59
0
Ruby on Rails - Retrieve array of elements from DB with expansion
I have a table called routes within my database where each route has an origin and destination. Given any origin, I want to be able to return a list of destinations that can be reached directly from this origin OR from any destination that links with this origin. How can I do this in Ruby? def find_available_routes(origin) routes = Array.new #each row in routes has 'origin' and 'destination' end
sql
ruby-on-rails
ruby
null
null
null
open
Ruby on Rails - Retrieve array of elements from DB with expansion === I have a table called routes within my database where each route has an origin and destination. Given any origin, I want to be able to return a list of destinations that can be reached directly from this origin OR from any destination that links with this origin. How can I do this in Ruby? def find_available_routes(origin) routes = Array.new #each row in routes has 'origin' and 'destination' end
0
7,394,037
09/12/2011 21:05:36
184,046
10/04/2009 20:35:01
6,759
44
Any reddit alternatives?
So I asked [this][1] question recently on the existence of link submission + reputation systems. The response I got excited me to the core. I mean, reddit had it open sourced so why re-invent the wheel. But after reading [this][2] article, I was completely disheartened. My worries are coherent with the ones in the article: - So many dependencies that I am afraid I will be using a sword without knowing swordsmanshipL Cassandra, Memcached, Pylons, and worst-of-all PostgreSQL (which I am an alien to. I wish they had MySQL) - Not sure about how actively reddit wes being developed back when the article was being written but the git site shows that it is very active currently. If I were to adopt this clone I am not sure how difficult it would be to keep merging with the changes that reddit does to its sources. Especially, after I rebrand the application. Would anyone have any practical experiences with this? In addition, are there any other simpler (optionally scalable) systems that I can explore? [1]: http://stackoverflow.com/questions/7356182/any-suggestions-for-a-link-submission-reputation-system [2]: http://www.deserettechnology.com/journal/reddit-the-open-source-software
python
suggestions
content-management
reddit
null
null
open
Any reddit alternatives? === So I asked [this][1] question recently on the existence of link submission + reputation systems. The response I got excited me to the core. I mean, reddit had it open sourced so why re-invent the wheel. But after reading [this][2] article, I was completely disheartened. My worries are coherent with the ones in the article: - So many dependencies that I am afraid I will be using a sword without knowing swordsmanshipL Cassandra, Memcached, Pylons, and worst-of-all PostgreSQL (which I am an alien to. I wish they had MySQL) - Not sure about how actively reddit wes being developed back when the article was being written but the git site shows that it is very active currently. If I were to adopt this clone I am not sure how difficult it would be to keep merging with the changes that reddit does to its sources. Especially, after I rebrand the application. Would anyone have any practical experiences with this? In addition, are there any other simpler (optionally scalable) systems that I can explore? [1]: http://stackoverflow.com/questions/7356182/any-suggestions-for-a-link-submission-reputation-system [2]: http://www.deserettechnology.com/journal/reddit-the-open-source-software
0
3,708,086
09/14/2010 10:38:10
368,975
06/17/2010 05:41:47
58
1
Jquery toggle not working
i am trying to get jquery to hide this div and for some reason it is not working what am i doing wrong <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> #one{ border:3px solid #00F; width:50%; } #hideme{ border:3px solid #00F; width:50%; display:none; } </style> <script type="text/javascript" src="../_root/js/jquery/jquery-1.4.2.js"></script> <script language="javascript" type="text/javascript"> $("#one").click(function () { $("#hideme").toggle(); }); </script> </head> <body> <div id="one"> <a href="#">hello</a> </div> <div id="hideme"> hi </div> </body> </html>
jquery
html
css
hide
toggle
null
open
Jquery toggle not working === i am trying to get jquery to hide this div and for some reason it is not working what am i doing wrong <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <style type="text/css"> #one{ border:3px solid #00F; width:50%; } #hideme{ border:3px solid #00F; width:50%; display:none; } </style> <script type="text/javascript" src="../_root/js/jquery/jquery-1.4.2.js"></script> <script language="javascript" type="text/javascript"> $("#one").click(function () { $("#hideme").toggle(); }); </script> </head> <body> <div id="one"> <a href="#">hello</a> </div> <div id="hideme"> hi </div> </body> </html>
0
8,667,175
12/29/2011 11:14:07
247,902
01/11/2010 09:06:07
256
2
BeginExecuteReader Error in WCF service
I'm trying to connect to database asynchronously in WCF service. But despite of setting "Asynchronous Processing=true" in connection string I'm getting `System.InvalidOperationException` with message `BeginExecuteReader: Connection property has not been initialized.` The code I'm using to connect to database is: public void Connect() { using (SqlConnection conn = new SqlConnection("Data Source=User12-PC; Initial Catalog = BMS; User Id=sa; Password = pass; Asynchronous Processing=true")) { SqlCommand command = new SqlCommand(); command.CommandText = "Select l.currvalue from" + " advt_ctrl_pts as p inner join advt_log_in_ctrl_pts l" + " on p.registerid = l.regid and p.ddcid = l.ddcid" + " where p.pointid = 5156102" + " order by datetime"; command.CommandType = CommandType.Text; conn.Open(); IAsyncResult result = command.BeginExecuteReader(); //This part is returning exception if (result.IsCompleted) { timer = new Timer(new TimerCallback(onTimerTick), command.EndExecuteReader(result), 5000, 5000); } } } Could anyone please tell me what's wrong I'm doing?
c#
.net
wcf
ado.net
null
null
open
BeginExecuteReader Error in WCF service === I'm trying to connect to database asynchronously in WCF service. But despite of setting "Asynchronous Processing=true" in connection string I'm getting `System.InvalidOperationException` with message `BeginExecuteReader: Connection property has not been initialized.` The code I'm using to connect to database is: public void Connect() { using (SqlConnection conn = new SqlConnection("Data Source=User12-PC; Initial Catalog = BMS; User Id=sa; Password = pass; Asynchronous Processing=true")) { SqlCommand command = new SqlCommand(); command.CommandText = "Select l.currvalue from" + " advt_ctrl_pts as p inner join advt_log_in_ctrl_pts l" + " on p.registerid = l.regid and p.ddcid = l.ddcid" + " where p.pointid = 5156102" + " order by datetime"; command.CommandType = CommandType.Text; conn.Open(); IAsyncResult result = command.BeginExecuteReader(); //This part is returning exception if (result.IsCompleted) { timer = new Timer(new TimerCallback(onTimerTick), command.EndExecuteReader(result), 5000, 5000); } } } Could anyone please tell me what's wrong I'm doing?
0
7,793,970
10/17/2011 12:49:07
939,937
09/12/2011 05:51:25
61
20
Is there any memory leak or any memory issues in android?
I want to know is there any memory leak issue in android, that has to be taken care of at the time of creating the applications, if so what all are the issues and how they are generated . I have read the topic http://developer.android.com/resources/articles/avoiding-memory-leaks.html Thank you
android
null
null
null
null
10/17/2011 13:22:20
not a real question
Is there any memory leak or any memory issues in android? === I want to know is there any memory leak issue in android, that has to be taken care of at the time of creating the applications, if so what all are the issues and how they are generated . I have read the topic http://developer.android.com/resources/articles/avoiding-memory-leaks.html Thank you
1
11,063,125
06/16/2012 11:44:41
1,450,412
06/12/2012 05:39:54
1
0
Sending Mail, Mail got expired or timed out.
SmtpClient ss = new SmtpClient("smtp.gmail.com", 465); ss.EnableSsl = true; //ss.Timeout = 10000; ss.DeliveryMethod = SmtpDeliveryMethod.Network; ss.UseDefaultCredentials = false; ss.Credentials = new NetworkCredential(userBox.Text, passBox.Text); MailMessage mm = new MailMessage(sendFrom.Text, sendTo.Text, subjectBox.Text, contentBox.Text); mm.BodyEncoding = UTF8Encoding.UTF8; mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; ss.Send(mm);
c#
.net
null
null
null
06/17/2012 13:40:26
too localized
Sending Mail, Mail got expired or timed out. === SmtpClient ss = new SmtpClient("smtp.gmail.com", 465); ss.EnableSsl = true; //ss.Timeout = 10000; ss.DeliveryMethod = SmtpDeliveryMethod.Network; ss.UseDefaultCredentials = false; ss.Credentials = new NetworkCredential(userBox.Text, passBox.Text); MailMessage mm = new MailMessage(sendFrom.Text, sendTo.Text, subjectBox.Text, contentBox.Text); mm.BodyEncoding = UTF8Encoding.UTF8; mm.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure; ss.Send(mm);
3
4,708,761
01/16/2011 23:17:21
496,223
11/03/2010 16:56:47
147
2
Improving Full Text mysql searches?
I am having some problems with full text searches quality. In my language the english article THE is often contracted using apostrophe and one L. Example: English: the water my lang: l'acqua where [acqua=water] and [l'=the] Problem is mysql sees "l'acqua" and "acqua" as 2 differentes words when they are not. So if a user searches for "acqua" mysql doens't show up text with "l'acqua" Do i got any way to change this behaviour? Thanks
mysql
search
full-text-search
null
null
null
open
Improving Full Text mysql searches? === I am having some problems with full text searches quality. In my language the english article THE is often contracted using apostrophe and one L. Example: English: the water my lang: l'acqua where [acqua=water] and [l'=the] Problem is mysql sees "l'acqua" and "acqua" as 2 differentes words when they are not. So if a user searches for "acqua" mysql doens't show up text with "l'acqua" Do i got any way to change this behaviour? Thanks
0
8,323,928
11/30/2011 09:48:14
352,627
05/28/2010 06:47:05
615
0
code sample to create own keyboard
I have searched around for making a sample on creating a new keyboard but nothing seemed to help. So Please provide me a code sample to create own keyboard with few keys ... I want to create my own keyboard, so i would like to go with that. please help me out
iphone
ios
iphone-sdk-4.0
null
null
12/07/2011 04:20:01
not a real question
code sample to create own keyboard === I have searched around for making a sample on creating a new keyboard but nothing seemed to help. So Please provide me a code sample to create own keyboard with few keys ... I want to create my own keyboard, so i would like to go with that. please help me out
1
1,910,302
12/15/2009 20:48:27
129,089
06/25/2009 21:09:12
133
3
In PHP: How to store the current time/date in UTC format in a string?
example: $date = 'Wed, 18 Feb 2009 16:03:52 GMT'; //How can I get $date to equal the current time in the same format?
php
datetime
utc
null
null
null
open
In PHP: How to store the current time/date in UTC format in a string? === example: $date = 'Wed, 18 Feb 2009 16:03:52 GMT'; //How can I get $date to equal the current time in the same format?
0
10,998,963
06/12/2012 14:39:33
1,413,554
05/23/2012 20:29:34
118
12
PHP, Printf,Sprintf Function
I am studying about printf,sprintf and i didnt understand few points, if can some one please help me understand thos points, At This Link at [PHP Manual][1]: There are explanations are numbered from one to six: What i didnt understand is: The Third and The Fourth(3(alignment specifier), 4(width specifier)), if can some one please help me with example for thos i will be very thankful. [1]: http://php.net/manual/en/function.sprintf.php
php
function
printf
sprintf
null
null
open
PHP, Printf,Sprintf Function === I am studying about printf,sprintf and i didnt understand few points, if can some one please help me understand thos points, At This Link at [PHP Manual][1]: There are explanations are numbered from one to six: What i didnt understand is: The Third and The Fourth(3(alignment specifier), 4(width specifier)), if can some one please help me with example for thos i will be very thankful. [1]: http://php.net/manual/en/function.sprintf.php
0
7,211,329
08/26/2011 22:59:11
406,278
07/29/2010 22:53:08
458
3
Creating Large Data Frames
Let's say that I want to generate a large data frame from scratch. Using the data.frame function is how I would generally create data frames. However, df's like the following are extremely error prone and inefficient. So is there a more efficient way of creating the following data frame. df <- data.frame(GOOGLE_CAMPAIGN=c(rep("Google - Medicare - US", 928), rep("MedicareBranded", 2983), rep("Medigap", 805), rep("Medigap Branded", 1914), rep("Medicare Typos", 1353), rep("Medigap Typos", 635), rep("Phone - MedicareGeneral", 585), rep("Phone - MedicareBranded", 2967), rep("Phone-Medigap", 812), rep("Auto Broad Match", 27), rep("Auto Exact Match", 80), rep("Auto Exact Match", 875)), GOOGLE_AD_GROUP=c(rep("Medicare", 928), rep("MedicareBranded", 2983), rep("Medigap", 805), rep("Medigap Branded", 1914), rep("Medicare Typos", 1353), rep("Medigap Typos", 635), rep("Phone ads 1-Medicare Terms",585), rep("Ad Group #1", 2967), rep("Medigap-phone", 812), rep("Auto Insurance", 27), rep("Auto General", 80), rep("Auto Brand", 875))) Yikes, that is some 'bad' code. How can I generate this 'large' data frame in a more efficient manner?
r
data.frame
null
null
null
null
open
Creating Large Data Frames === Let's say that I want to generate a large data frame from scratch. Using the data.frame function is how I would generally create data frames. However, df's like the following are extremely error prone and inefficient. So is there a more efficient way of creating the following data frame. df <- data.frame(GOOGLE_CAMPAIGN=c(rep("Google - Medicare - US", 928), rep("MedicareBranded", 2983), rep("Medigap", 805), rep("Medigap Branded", 1914), rep("Medicare Typos", 1353), rep("Medigap Typos", 635), rep("Phone - MedicareGeneral", 585), rep("Phone - MedicareBranded", 2967), rep("Phone-Medigap", 812), rep("Auto Broad Match", 27), rep("Auto Exact Match", 80), rep("Auto Exact Match", 875)), GOOGLE_AD_GROUP=c(rep("Medicare", 928), rep("MedicareBranded", 2983), rep("Medigap", 805), rep("Medigap Branded", 1914), rep("Medicare Typos", 1353), rep("Medigap Typos", 635), rep("Phone ads 1-Medicare Terms",585), rep("Ad Group #1", 2967), rep("Medigap-phone", 812), rep("Auto Insurance", 27), rep("Auto General", 80), rep("Auto Brand", 875))) Yikes, that is some 'bad' code. How can I generate this 'large' data frame in a more efficient manner?
0
10,764,118
05/26/2012 06:25:13
1,378,952
05/07/2012 04:33:46
20
0
how to wake up remote pc using android phone?
We all know that within a LAN, we can make use of magic packet to turn on any number of systems. But how to wake up a remote pc which is in some remote LAN?In my previous question on WOL, some one said that we cannot turn on the remote pc, because anybody's pc can be easily turned on. Thats true. But we can use a unique password to wake on the system. when i referred wikipedia i got this "**Certain NICs support a security feature called "SecureOn". It allows users to store within the NIC a hexadecimal password of 6 bytes. Clients have to append this password to the magic packet. The NIC wakes the system only if the MAC address and password are correct. This security measure significantly decreases the risk of successful brute force attacks, by increasing the search space by 48 bits (6 bytes), up to 296 combinations if the MAC address is entirely unknown. However any network eavesdropping will expose the cleartext password.Still, only a few NIC and router manufacturers support such security features".** From this it is clear that WOL implementation with password protection is possible. So why is it not possible to wake on remote pc with secure password?(i need to give an analogy here:assume that u send a msg using ur cell phone to ur friend who is in remote place. the conversation is secure. similarly is there any way to turn my system into a reception point, so that when i send a wake on message, the system gets turned on.?)
java
android
networking
mobile
wol
05/29/2012 06:43:23
not a real question
how to wake up remote pc using android phone? === We all know that within a LAN, we can make use of magic packet to turn on any number of systems. But how to wake up a remote pc which is in some remote LAN?In my previous question on WOL, some one said that we cannot turn on the remote pc, because anybody's pc can be easily turned on. Thats true. But we can use a unique password to wake on the system. when i referred wikipedia i got this "**Certain NICs support a security feature called "SecureOn". It allows users to store within the NIC a hexadecimal password of 6 bytes. Clients have to append this password to the magic packet. The NIC wakes the system only if the MAC address and password are correct. This security measure significantly decreases the risk of successful brute force attacks, by increasing the search space by 48 bits (6 bytes), up to 296 combinations if the MAC address is entirely unknown. However any network eavesdropping will expose the cleartext password.Still, only a few NIC and router manufacturers support such security features".** From this it is clear that WOL implementation with password protection is possible. So why is it not possible to wake on remote pc with secure password?(i need to give an analogy here:assume that u send a msg using ur cell phone to ur friend who is in remote place. the conversation is secure. similarly is there any way to turn my system into a reception point, so that when i send a wake on message, the system gets turned on.?)
1
10,241,907
04/20/2012 07:21:20
1,345,661
04/20/2012 05:15:27
1
0
streamcorruptedexception
04-20 12:59:59.678: WARN/System.err(469): java.io.StreamCorruptedException 04-20 12:59:59.700: WARN/System.err(469): at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:2392) 04-20 12:59:59.700: WARN/System.err(469): at java.io.ObjectInputStream.<init>(ObjectInputStream.java:445) 04-20 12:59:59.708: WARN/System.err(469): at com.iGrandee.Android.Patient.CustomHttpClient.executeHttpArrayPost(CustomHttpClient.java:323) 04-20 12:59:59.718: WARN/System.err(469): at com.iGrandee.Android.drLogin.Subjectivehistory.getVisitId(Subjectivehistory.java:174) 04-20 12:59:59.718: WARN/System.err(469): at com.iGrandee.Android.drLogin.Subjectivehistory.onCreate(Subjectivehistory.java:156) 04-20 12:59:59.727: WARN/System.err(469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-20 12:59:59.727: WARN/System.err(469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 04-20 12:59:59.737: WARN/System.err(469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 04-20 12:59:59.747: WARN/System.err(469): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-20 12:59:59.747: WARN/System.err(469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 04-20 12:59:59.759: WARN/System.err(469): at android.os.Handler.dispatchMessage(Handler.java:99) 04-20 12:59:59.759: WARN/System.err(469): at android.os.Looper.loop(Looper.java:123) 04-20 12:59:59.768: WARN/System.err(469): at android.app.ActivityThread.main(ActivityThread.java:4627) 04-20 12:59:59.778: WARN/System.err(469): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 12:59:59.778: WARN/System.err(469): at java.lang.reflect.Method.invoke(Method.java:521) 04-20 12:59:59.778: WARN/System.err(469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 04-20 12:59:59.788: WARN/System.err(469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-20 12:59:59.788: WARN/System.err(469): at dalvik.system.NativeStart.main(Native Method) anybody resolve this problem?
java
null
null
null
null
04/22/2012 18:24:38
too localized
streamcorruptedexception === 04-20 12:59:59.678: WARN/System.err(469): java.io.StreamCorruptedException 04-20 12:59:59.700: WARN/System.err(469): at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:2392) 04-20 12:59:59.700: WARN/System.err(469): at java.io.ObjectInputStream.<init>(ObjectInputStream.java:445) 04-20 12:59:59.708: WARN/System.err(469): at com.iGrandee.Android.Patient.CustomHttpClient.executeHttpArrayPost(CustomHttpClient.java:323) 04-20 12:59:59.718: WARN/System.err(469): at com.iGrandee.Android.drLogin.Subjectivehistory.getVisitId(Subjectivehistory.java:174) 04-20 12:59:59.718: WARN/System.err(469): at com.iGrandee.Android.drLogin.Subjectivehistory.onCreate(Subjectivehistory.java:156) 04-20 12:59:59.727: WARN/System.err(469): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 04-20 12:59:59.727: WARN/System.err(469): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627) 04-20 12:59:59.737: WARN/System.err(469): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679) 04-20 12:59:59.747: WARN/System.err(469): at android.app.ActivityThread.access$2300(ActivityThread.java:125) 04-20 12:59:59.747: WARN/System.err(469): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033) 04-20 12:59:59.759: WARN/System.err(469): at android.os.Handler.dispatchMessage(Handler.java:99) 04-20 12:59:59.759: WARN/System.err(469): at android.os.Looper.loop(Looper.java:123) 04-20 12:59:59.768: WARN/System.err(469): at android.app.ActivityThread.main(ActivityThread.java:4627) 04-20 12:59:59.778: WARN/System.err(469): at java.lang.reflect.Method.invokeNative(Native Method) 04-20 12:59:59.778: WARN/System.err(469): at java.lang.reflect.Method.invoke(Method.java:521) 04-20 12:59:59.778: WARN/System.err(469): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868) 04-20 12:59:59.788: WARN/System.err(469): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 04-20 12:59:59.788: WARN/System.err(469): at dalvik.system.NativeStart.main(Native Method) anybody resolve this problem?
3
6,352,769
06/15/2011 03:40:16
798,874
06/15/2011 03:40:16
1
0
Java Class Loader
i am working on Java programming and i am trying to call another class for calculating something and it will not load. package peterbeckstrommortgagecalculatorapp; /** * * @author Peter Beckstrom * University of Phoenix * 6-13-2011 */ import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import java.text.NumberFormat; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; public class Main extends JFrame{ public static void main(String[] args) { //*Frame setup Main myFrame = new Main(); String myTitle = "PeterBeckstromMortgageCalculatorApp"; myFrame.setTitle(myTitle); myFrame.setSize(400,400); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.getContainerPane(myFrame.getContentPane()); myFrame.pack(); myFrame.setVisible(true); } private JTextField P_txt; private JTextField i_txt; private JTextField N_txt; private JTextField payment_txt; public void getContainerPane(final Container container) { GridLayout containerGrid = new GridLayout(2,1); this.setLayout(containerGrid); Border bdr = new EmptyBorder( 2, 5, 2, 5 ); JButton rstButton = new JButton( "Reset" ); JButton extButton = new JButton( "Exit" ); JButton calcButton = new JButton( "Calculate" ); JPanel row1 = new JPanel( new GridLayout( 1, 3 ) ); JLabel P_label1 = new JLabel( "Loan Amount $ :", JLabel.LEFT );// Sets label text and alignment P_txt = new JTextField( 10 ); JPanel row3 = new JPanel( new GridLayout( 1, 3 ) ); JLabel i_label2 = new JLabel( "Loan Interest %:", JLabel.LEFT ); i_txt = new JTextField( 10 ); JPanel row2 = new JPanel( new GridLayout( 1, 3 ) ); JLabel N_label3 = new JLabel( "Loan Term :", JLabel.LEFT ); N_txt = new JTextField( 10 ); JPanel row4 = new JPanel( new GridLayout( 1, 3 ) ); JLabel payment_label4 = new JLabel( "Monthly Payment $:", JLabel.LEFT ); payment_txt = new JTextField( 10 ); JPanel button = new JPanel( new FlowLayout( FlowLayout.CENTER ) ); this.add( row1 ); row1.add( P_label1 ); row1.add( P_txt ); row1.setMaximumSize( new Dimension( 300, 25 ) ); row1.setBorder( bdr ); this.add( row3 ); row3.add( i_label2 ); row3.add( i_txt ); row3.setMaximumSize( new Dimension( 300, row3.getMinimumSize().height ) ); row3.setBorder( bdr ); this.add( row2 ); row2.add( N_label3 ); row2.add( N_txt ); row2.setMaximumSize( new Dimension( 300, row2.getMinimumSize().height ) ); row2.setBorder( bdr ); this.add( row4 ); row4.add( payment_label4 ); row4.add( payment_txt ); row4.setMaximumSize( new Dimension( 300, row4.getMinimumSize().height ) ); row4.setBorder( bdr ); button.add( calcButton ); button.add( rstButton ); button.add( extButton ); this.add( button ); button.setMaximumSize( new Dimension( 10000, button.getMinimumSize().height ) ); ActionListener reset = null; rstButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ resetForm(); } }); ActionListener exit = null; extButton.addActionListener(new ActionListener(){ public void actionPerformed (ActionEvent e){ exitForm(); } }); ActionListener calculate = null; calcButton.addActionListener(new ActionListener(){ public void actionPerformed (ActionEvent e){ calculateForm(); } public void calculateForm() { MortgageCalculator method = new MortgageCalculator(); } } ); } public void resetForm() { P_txt.setText(""); payment_txt.setText(""); i_txt.setText(""); N_txt.setText(""); } public void exitForm() { System.exit(0); } //This class encapsulates the input data and performs the mortgage //calculation necessary on them. * @author daniel// private class MortgageCalculator { private double P = 0; private double i = 0; private int N = 0; /** * This is the constructor and it collects the data for * calculation later. * * @param P - principal * @param i - annual interest rate in fractional form * @param N - number of periods (so 10 years monthly is 10 x 12 = 120 */ public MortgageCalculator( double P, double i, int N ) { this.P = P; this.i = i / 12.0; this.N = N; } /** * This is the formula for calculating amortized payments. * * @return payment */ public double calculate() { return P * ( i / (1 - Math.pow( (1 + i), -N ) ) ); } /** * Returns the amortization table in an array. * The return values are Strings in currency format. * @return */ public String[][] amortize() { String table[][] = new String[N][4]; double payment = calculate(); // Ensures its a number with 2 decimal digits. Don't use // comma grouping separator. NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits( 2 ); format.setMinimumFractionDigits( 2 ); if (format instanceof DecimalFormat) ((DecimalFormat) format).setGroupingUsed(false); // Calculates the principal balance, principal payment and // interest payment at each period. double balance = P; for( int j=0; j < N; j++ ) { table[j][0] = new Integer(j+1).toString(); double interestPaid = balance * i; table[j][2] = format.format(interestPaid); double principalPaid = payment - interestPaid; table[j][1] = format.format(principalPaid); balance = balance - principalPaid; table[j][3] = format.format(balance); } return table; } } }
java
classloader
null
null
null
06/15/2011 03:59:56
not a real question
Java Class Loader === i am working on Java programming and i am trying to call another class for calculating something and it will not load. package peterbeckstrommortgagecalculatorapp; /** * * @author Peter Beckstrom * University of Phoenix * 6-13-2011 */ import java.awt.*; import java.awt.event.*; import java.text.DecimalFormat; import java.text.NumberFormat; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; public class Main extends JFrame{ public static void main(String[] args) { //*Frame setup Main myFrame = new Main(); String myTitle = "PeterBeckstromMortgageCalculatorApp"; myFrame.setTitle(myTitle); myFrame.setSize(400,400); myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); myFrame.getContainerPane(myFrame.getContentPane()); myFrame.pack(); myFrame.setVisible(true); } private JTextField P_txt; private JTextField i_txt; private JTextField N_txt; private JTextField payment_txt; public void getContainerPane(final Container container) { GridLayout containerGrid = new GridLayout(2,1); this.setLayout(containerGrid); Border bdr = new EmptyBorder( 2, 5, 2, 5 ); JButton rstButton = new JButton( "Reset" ); JButton extButton = new JButton( "Exit" ); JButton calcButton = new JButton( "Calculate" ); JPanel row1 = new JPanel( new GridLayout( 1, 3 ) ); JLabel P_label1 = new JLabel( "Loan Amount $ :", JLabel.LEFT );// Sets label text and alignment P_txt = new JTextField( 10 ); JPanel row3 = new JPanel( new GridLayout( 1, 3 ) ); JLabel i_label2 = new JLabel( "Loan Interest %:", JLabel.LEFT ); i_txt = new JTextField( 10 ); JPanel row2 = new JPanel( new GridLayout( 1, 3 ) ); JLabel N_label3 = new JLabel( "Loan Term :", JLabel.LEFT ); N_txt = new JTextField( 10 ); JPanel row4 = new JPanel( new GridLayout( 1, 3 ) ); JLabel payment_label4 = new JLabel( "Monthly Payment $:", JLabel.LEFT ); payment_txt = new JTextField( 10 ); JPanel button = new JPanel( new FlowLayout( FlowLayout.CENTER ) ); this.add( row1 ); row1.add( P_label1 ); row1.add( P_txt ); row1.setMaximumSize( new Dimension( 300, 25 ) ); row1.setBorder( bdr ); this.add( row3 ); row3.add( i_label2 ); row3.add( i_txt ); row3.setMaximumSize( new Dimension( 300, row3.getMinimumSize().height ) ); row3.setBorder( bdr ); this.add( row2 ); row2.add( N_label3 ); row2.add( N_txt ); row2.setMaximumSize( new Dimension( 300, row2.getMinimumSize().height ) ); row2.setBorder( bdr ); this.add( row4 ); row4.add( payment_label4 ); row4.add( payment_txt ); row4.setMaximumSize( new Dimension( 300, row4.getMinimumSize().height ) ); row4.setBorder( bdr ); button.add( calcButton ); button.add( rstButton ); button.add( extButton ); this.add( button ); button.setMaximumSize( new Dimension( 10000, button.getMinimumSize().height ) ); ActionListener reset = null; rstButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ resetForm(); } }); ActionListener exit = null; extButton.addActionListener(new ActionListener(){ public void actionPerformed (ActionEvent e){ exitForm(); } }); ActionListener calculate = null; calcButton.addActionListener(new ActionListener(){ public void actionPerformed (ActionEvent e){ calculateForm(); } public void calculateForm() { MortgageCalculator method = new MortgageCalculator(); } } ); } public void resetForm() { P_txt.setText(""); payment_txt.setText(""); i_txt.setText(""); N_txt.setText(""); } public void exitForm() { System.exit(0); } //This class encapsulates the input data and performs the mortgage //calculation necessary on them. * @author daniel// private class MortgageCalculator { private double P = 0; private double i = 0; private int N = 0; /** * This is the constructor and it collects the data for * calculation later. * * @param P - principal * @param i - annual interest rate in fractional form * @param N - number of periods (so 10 years monthly is 10 x 12 = 120 */ public MortgageCalculator( double P, double i, int N ) { this.P = P; this.i = i / 12.0; this.N = N; } /** * This is the formula for calculating amortized payments. * * @return payment */ public double calculate() { return P * ( i / (1 - Math.pow( (1 + i), -N ) ) ); } /** * Returns the amortization table in an array. * The return values are Strings in currency format. * @return */ public String[][] amortize() { String table[][] = new String[N][4]; double payment = calculate(); // Ensures its a number with 2 decimal digits. Don't use // comma grouping separator. NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits( 2 ); format.setMinimumFractionDigits( 2 ); if (format instanceof DecimalFormat) ((DecimalFormat) format).setGroupingUsed(false); // Calculates the principal balance, principal payment and // interest payment at each period. double balance = P; for( int j=0; j < N; j++ ) { table[j][0] = new Integer(j+1).toString(); double interestPaid = balance * i; table[j][2] = format.format(interestPaid); double principalPaid = payment - interestPaid; table[j][1] = format.format(principalPaid); balance = balance - principalPaid; table[j][3] = format.format(balance); } return table; } } }
1
8,218,252
11/21/2011 20:39:56
116
08/02/2008 05:51:57
27,348
376
What CPU's are supported with Aduino?
Is there a table summarizing their differences? What's the lowest power Atmel processor that can be used with Arduino?
arduino
atmel
null
null
null
11/21/2011 23:34:49
off topic
What CPU's are supported with Aduino? === Is there a table summarizing their differences? What's the lowest power Atmel processor that can be used with Arduino?
2
6,191,784
05/31/2011 18:21:29
551,841
12/22/2010 23:43:15
401
42
Store datalist eval into a variable
is there a way to store field from a DataList? Such as string year = Eval("date"); I want to do manipulation on the string year, and need to store it in the variable if possible!
c#
.net
asp.net
null
null
null
open
Store datalist eval into a variable === is there a way to store field from a DataList? Such as string year = Eval("date"); I want to do manipulation on the string year, and need to store it in the variable if possible!
0
11,601,002
07/22/2012 14:14:58
1,527,335
07/15/2012 19:07:20
6
0
vertical accordion overflow and scroll issue
I am using a vertical accordion from CoDrops. The problem I am having is that whenever I add more image slices than the number of visibleSlices I have listed in the javascript, then they are not on overflow:hidden (as listed in my css.) The extra images slices are placed below the last image slice and the page simply gets longer (because the overflow hidden is not working, i assume.) Additionally, there are supposed to be arrows that appear that the user can click on to scroll to the next (hidden) image slice. While these do appear on the screen, they do not scroll if clicked on or if you are looking at the last image in the set of image slices and click on the next arrow (not knowing it is the last image) then all the images and text go away leaving a blank white page that does not correct itself unless you refresh the page. Any help would be greatly appreciated! Thanks! My javascript for the accordion looks like this: <script type="text/javascript"> $(function() { $('#va-accordion').vaccordion({ accordianW: $(window).width(1000), accordianH: $(window).height(450), expandedHeight: 450, visibleSlices: 8, animOpacity: .2, }); }); </script> My css for the vertical accordion looks like this: (only showing 1 image slice out of many) .va-container{ position:relative; top:50px; margin:0px auto 0 auto; } .va-wrapper{ width:100%; height:100%; position:relative; overflow:hidden; background:#FFF; } .va-slice{ cursor:pointer; position:absolute; width:100%; left:100px; overflow:hidden; } .va-slice-1{ background:#FFF url(../images/testa.jpg) no-repeat center center; } (here's my scroll button css:) .va-nav span{ width:40px; height:25px; background:transparent url(../images/prev.png) no-repeat center center; position:absolute; top:-35px; left:50%; margin-left:-20px; text-indent:-9000px; opacity:0.5; cursor:pointer; display:none; z-index:100; } .va-nav span.va-nav-next{ background-image:url(../images/next.png); top:auto; bottom:-35px; } .va-nav span:hover{ opacity:1.0; } CoDrop's javascript looks like this: (they don't use the options listed on their demo page, but their accordion does what it is supposed to do.) <script type="text/javascript"> $(function() { $('#va-accordion').vaccordion(); }); </script> CoDrop's css looks like this: .va-container{ position:relative; margin:40px auto 0 auto; } .va-wrapper{ width:100%; height:100%; position:relative; overflow:hidden; background:#000; } .va-slice{ cursor:pointer; position:absolute; width:100%; left:0px; overflow:hidden; } .va-slice-1{ background:#000 url(../images/1.jpg) no-repeat center center; } CoDrop's scroll button css: .va-nav span{ width:40px; height:25px; background:transparent url(../images/prev.png) no-repeat center center; position:absolute; top:-35px; left:50%; margin-left:-20px; text-indent:-9000px; opacity:0.7; cursor:pointer; display:none; z-index:100; } .va-nav span.va-nav-next{ background-image:url(../images/next.png); top:auto; bottom:-35px; } .va-nav span:hover{ opacity:1.0; }
css
image
scroll
overflow
hidden
null
open
vertical accordion overflow and scroll issue === I am using a vertical accordion from CoDrops. The problem I am having is that whenever I add more image slices than the number of visibleSlices I have listed in the javascript, then they are not on overflow:hidden (as listed in my css.) The extra images slices are placed below the last image slice and the page simply gets longer (because the overflow hidden is not working, i assume.) Additionally, there are supposed to be arrows that appear that the user can click on to scroll to the next (hidden) image slice. While these do appear on the screen, they do not scroll if clicked on or if you are looking at the last image in the set of image slices and click on the next arrow (not knowing it is the last image) then all the images and text go away leaving a blank white page that does not correct itself unless you refresh the page. Any help would be greatly appreciated! Thanks! My javascript for the accordion looks like this: <script type="text/javascript"> $(function() { $('#va-accordion').vaccordion({ accordianW: $(window).width(1000), accordianH: $(window).height(450), expandedHeight: 450, visibleSlices: 8, animOpacity: .2, }); }); </script> My css for the vertical accordion looks like this: (only showing 1 image slice out of many) .va-container{ position:relative; top:50px; margin:0px auto 0 auto; } .va-wrapper{ width:100%; height:100%; position:relative; overflow:hidden; background:#FFF; } .va-slice{ cursor:pointer; position:absolute; width:100%; left:100px; overflow:hidden; } .va-slice-1{ background:#FFF url(../images/testa.jpg) no-repeat center center; } (here's my scroll button css:) .va-nav span{ width:40px; height:25px; background:transparent url(../images/prev.png) no-repeat center center; position:absolute; top:-35px; left:50%; margin-left:-20px; text-indent:-9000px; opacity:0.5; cursor:pointer; display:none; z-index:100; } .va-nav span.va-nav-next{ background-image:url(../images/next.png); top:auto; bottom:-35px; } .va-nav span:hover{ opacity:1.0; } CoDrop's javascript looks like this: (they don't use the options listed on their demo page, but their accordion does what it is supposed to do.) <script type="text/javascript"> $(function() { $('#va-accordion').vaccordion(); }); </script> CoDrop's css looks like this: .va-container{ position:relative; margin:40px auto 0 auto; } .va-wrapper{ width:100%; height:100%; position:relative; overflow:hidden; background:#000; } .va-slice{ cursor:pointer; position:absolute; width:100%; left:0px; overflow:hidden; } .va-slice-1{ background:#000 url(../images/1.jpg) no-repeat center center; } CoDrop's scroll button css: .va-nav span{ width:40px; height:25px; background:transparent url(../images/prev.png) no-repeat center center; position:absolute; top:-35px; left:50%; margin-left:-20px; text-indent:-9000px; opacity:0.7; cursor:pointer; display:none; z-index:100; } .va-nav span.va-nav-next{ background-image:url(../images/next.png); top:auto; bottom:-35px; } .va-nav span:hover{ opacity:1.0; }
0
10,844,481
06/01/2012 04:39:18
1,429,863
06/01/2012 04:27:41
1
0
Entity framework Data saving issue
I am running into very strange issue with entity framework. I am saving data to the database using entity framework. When I call SaveChanges() method, then data is saving to the database, I can even see my updates in database in SQL. But when I close my application and reopen data will be loss in the database and it is showing previous data which was before my first save. This is happening even when I select different record in the application and save, then the previous record data will be loss. I have tried all possible options, nothing helped me. **Below is the code snippet.** AxRetailPosDb context = new AxRetailPosDb(DbContextHelper.DbContextConnectionString(this.Application.Settings.Database.Connection.ConnectionString)); bool flag = false; try { CUSTTABLE cust = context.CUSTTABLEs.Where(c => c.ACCOUNTNUM == customer.CustomerId).FirstOrDefault(); DIRPARTYTABLE dirpartytbl = context.DIRPARTYTABLEs.Where(p => p.RECID == cust.PARTY).FirstOrDefault(); if (cust != null) { cust.IGNDELIVERYCODE = cusEextView.DeliveryCode; if (cusEextView.Birthday != null && cusEextView.Birthday != Convert.ToDateTime("01-01-0001")) { cust.IGNBIRTHDATE = Convert.ToDateTime(cusEextView.Birthday.ToShortDateString()); } cust.IGNMODELSCORE = cusEextView.Modelscore; cust.CREDITMAX = cusEextView.ChargeLimit; if (cusEextView.Gender != null) { cust.IGNGENDER = (int)Enum.Parse(typeof(Microsoft.Dynamics.Retail.Pos.Customer.WinFormsTouch.frmNewCustomer.Gender), cusEextView.Gender); } } if (dirpartytbl != null) { dirpartytbl.LANGUAGEID = customer.Language; } context.SaveChanges(); } catch { } finally { if (context != null) { context.Dispose(); } } Any suggestions would be greatly appreciated.
entity-framework-4
null
null
null
null
null
open
Entity framework Data saving issue === I am running into very strange issue with entity framework. I am saving data to the database using entity framework. When I call SaveChanges() method, then data is saving to the database, I can even see my updates in database in SQL. But when I close my application and reopen data will be loss in the database and it is showing previous data which was before my first save. This is happening even when I select different record in the application and save, then the previous record data will be loss. I have tried all possible options, nothing helped me. **Below is the code snippet.** AxRetailPosDb context = new AxRetailPosDb(DbContextHelper.DbContextConnectionString(this.Application.Settings.Database.Connection.ConnectionString)); bool flag = false; try { CUSTTABLE cust = context.CUSTTABLEs.Where(c => c.ACCOUNTNUM == customer.CustomerId).FirstOrDefault(); DIRPARTYTABLE dirpartytbl = context.DIRPARTYTABLEs.Where(p => p.RECID == cust.PARTY).FirstOrDefault(); if (cust != null) { cust.IGNDELIVERYCODE = cusEextView.DeliveryCode; if (cusEextView.Birthday != null && cusEextView.Birthday != Convert.ToDateTime("01-01-0001")) { cust.IGNBIRTHDATE = Convert.ToDateTime(cusEextView.Birthday.ToShortDateString()); } cust.IGNMODELSCORE = cusEextView.Modelscore; cust.CREDITMAX = cusEextView.ChargeLimit; if (cusEextView.Gender != null) { cust.IGNGENDER = (int)Enum.Parse(typeof(Microsoft.Dynamics.Retail.Pos.Customer.WinFormsTouch.frmNewCustomer.Gender), cusEextView.Gender); } } if (dirpartytbl != null) { dirpartytbl.LANGUAGEID = customer.Language; } context.SaveChanges(); } catch { } finally { if (context != null) { context.Dispose(); } } Any suggestions would be greatly appreciated.
0
4,112,090
11/06/2010 05:37:26
420,840
01/24/2010 02:48:27
257
7
which is the best site about html5 and css3 .
i think i have many work to do about html5 and css3 , but which is the best ? ajaxian ? thanks
javascript
html5
css3
null
null
01/16/2012 15:30:08
not constructive
which is the best site about html5 and css3 . === i think i have many work to do about html5 and css3 , but which is the best ? ajaxian ? thanks
4
8,166,063
11/17/2011 11:05:58
715,769
04/19/2011 18:20:54
57
0
Checking IPC Shareable lock
How can I check if a lock is held by someone else while using IPC::Shareable in perl. I have the below code: my $resource = 0; my $resource_handle = tie $resource, 'IPC::Shareable', undef , { destroy => 1 }; my $child = fork; unless ($child) { $resource_handle -> shlock(); sleep 10; $resource_handle -> shunlock(); exit(0); } if ($resource_handle -> shlock(LOCK_EX)) { print "Got lock in parent\n"; $resource_handle -> shunlock(); } else { print "The shared resource is locked\n"; } This prints "Got lock in parent" after 10 seconds while I want it to print "The shared resource is locked".
perl
ipc
null
null
null
null
open
Checking IPC Shareable lock === How can I check if a lock is held by someone else while using IPC::Shareable in perl. I have the below code: my $resource = 0; my $resource_handle = tie $resource, 'IPC::Shareable', undef , { destroy => 1 }; my $child = fork; unless ($child) { $resource_handle -> shlock(); sleep 10; $resource_handle -> shunlock(); exit(0); } if ($resource_handle -> shlock(LOCK_EX)) { print "Got lock in parent\n"; $resource_handle -> shunlock(); } else { print "The shared resource is locked\n"; } This prints "Got lock in parent" after 10 seconds while I want it to print "The shared resource is locked".
0
11,745,805
07/31/2012 17:31:16
840,250
07/12/2011 07:34:00
20
0
Mountain Lion and AuthorizationExecuteWithPrivileges warning
I have updated my OSX and xCode now when I call AuthorizationExecuteWithPrivileges I getting log message: dyld: DYLD_ environment variables being ignored because main executable (/usr/libexec/security_authtrampoline) is setuid or setgid what is that, can I fix it?
xcode
cocoa
dyld
null
null
null
open
Mountain Lion and AuthorizationExecuteWithPrivileges warning === I have updated my OSX and xCode now when I call AuthorizationExecuteWithPrivileges I getting log message: dyld: DYLD_ environment variables being ignored because main executable (/usr/libexec/security_authtrampoline) is setuid or setgid what is that, can I fix it?
0
1,799,335
11/25/2009 19:18:28
159,995
08/20/2009 12:10:03
41
0
How could I pass a database run-time parameter in ruby on rails?
I need to set a run-time parameter in postgresql. It is "SET DATESTYLE TO PostgreSQL,European;". Where can I pass that in a Rails Application?
ruby-on-rails
ruby
null
null
null
null
open
How could I pass a database run-time parameter in ruby on rails? === I need to set a run-time parameter in postgresql. It is "SET DATESTYLE TO PostgreSQL,European;". Where can I pass that in a Rails Application?
0
6,626,980
07/08/2011 15:48:06
562,542
05/19/2010 05:46:56
7
6
SQL Date between and another condition statement not working.
Here is two SQL Query when executing this SQL its work fine. select * from xyz where file_play_start_date between '2011-07-01 06:15:00' and '2011-07-08 06:30:00' but when adding another condition then its not working. e.i:returning no result tho there is result to show in this condition. select * from xyz where calender_id=3 and file_play_start_date between '2011-07-01 06:15:00' and '2011-07-08 06:30:00' Can any one tell me why its happening?
mysql
sql
null
null
null
null
open
SQL Date between and another condition statement not working. === Here is two SQL Query when executing this SQL its work fine. select * from xyz where file_play_start_date between '2011-07-01 06:15:00' and '2011-07-08 06:30:00' but when adding another condition then its not working. e.i:returning no result tho there is result to show in this condition. select * from xyz where calender_id=3 and file_play_start_date between '2011-07-01 06:15:00' and '2011-07-08 06:30:00' Can any one tell me why its happening?
0
2,958,212
06/02/2010 13:38:51
247,243
01/09/2010 21:16:54
583
0
Why the home page is called index.html ?
I understand that calling the home page `index.html` is a convention. Is that right ? Does this name has any special meaning (maybe for search engines) ?
website
null
null
null
null
10/20/2011 14:09:56
not constructive
Why the home page is called index.html ? === I understand that calling the home page `index.html` is a convention. Is that right ? Does this name has any special meaning (maybe for search engines) ?
4
10,257,277
04/21/2012 07:54:49
785,522
06/06/2011 07:34:54
6
0
How to change datagrid cell fore colors as dynamically using c#
I know this is a stupid question but i can't get my desired out put.Actually i want change the datagridview cell fore colors as dynamically for this i have logic like this this.dataGridView1.Rows[0].Cells[1].Style.ForeColor = System.Drawing.Color.Red; but this is not apply to the cell(even cell background also not applied), But i get the fore color name what i assigned to the cell string colorname = objPreview.dataGridView1.Rows[0].Cells[1].Style.ForeColor.Name; .Is there any mistake in my query please help me.
c#-4.0
datagridview
windows-applications
null
null
null
open
How to change datagrid cell fore colors as dynamically using c# === I know this is a stupid question but i can't get my desired out put.Actually i want change the datagridview cell fore colors as dynamically for this i have logic like this this.dataGridView1.Rows[0].Cells[1].Style.ForeColor = System.Drawing.Color.Red; but this is not apply to the cell(even cell background also not applied), But i get the fore color name what i assigned to the cell string colorname = objPreview.dataGridView1.Rows[0].Cells[1].Style.ForeColor.Name; .Is there any mistake in my query please help me.
0
1,935,153
12/20/2009 07:42:46
235,399
12/20/2009 07:28:44
1
0
__del__ method being called in python when it is not expected
I am new to python and have been working thru the examples in Swaroop CH's "A Byte of Python". I am seeing some behavior with the __del__ method that is puzzling me. Basically, if I run the following script (in Python 2.6.2) class Person4: '''Represents a person''' population = 0 def __init__(self, name): '''Initialize the person's data''' self.name = name print 'Initializing %s'% self.name #When the person is created they increase the population Person4.population += 1 def __del__(self): '''I am dying''' print '%s says bye' % self.name Person4.population -= 1 if Person4.population == 0: print 'I am the last one' else: print 'There are still %d left' % Person4.population swaroop = Person4('Swaroop') kaleem = Person4('Kalem') using the Python console (or the Spyder interactive console) I see the following: >>> execfile(u'C:\\1_eric\\Python\\test1.py') Initializing Swaroop Initializing Kalem >>> execfile(u'C:\\1_eric\\Python\\test1.py') Initializing Swaroop Swaroop says bye I am the last one Initializing Kalem Kalem says bye I am the last one Why is the __del__ method being called immediately after the __init__ on the second run? I am guessing that since the same instance names ('swaroop' and 'kaleem') are being used that it is releasing the original instance and garbage collecting it. But, this seems to be playing havoc with the current population count. What is going on here? What is a good way to avoid this sort of confusion? Avoid the use of __del__? Check for existing instance names before reusing them? ... Thanks, Eric
python
del-
null
null
null
null
open
__del__ method being called in python when it is not expected === I am new to python and have been working thru the examples in Swaroop CH's "A Byte of Python". I am seeing some behavior with the __del__ method that is puzzling me. Basically, if I run the following script (in Python 2.6.2) class Person4: '''Represents a person''' population = 0 def __init__(self, name): '''Initialize the person's data''' self.name = name print 'Initializing %s'% self.name #When the person is created they increase the population Person4.population += 1 def __del__(self): '''I am dying''' print '%s says bye' % self.name Person4.population -= 1 if Person4.population == 0: print 'I am the last one' else: print 'There are still %d left' % Person4.population swaroop = Person4('Swaroop') kaleem = Person4('Kalem') using the Python console (or the Spyder interactive console) I see the following: >>> execfile(u'C:\\1_eric\\Python\\test1.py') Initializing Swaroop Initializing Kalem >>> execfile(u'C:\\1_eric\\Python\\test1.py') Initializing Swaroop Swaroop says bye I am the last one Initializing Kalem Kalem says bye I am the last one Why is the __del__ method being called immediately after the __init__ on the second run? I am guessing that since the same instance names ('swaroop' and 'kaleem') are being used that it is releasing the original instance and garbage collecting it. But, this seems to be playing havoc with the current population count. What is going on here? What is a good way to avoid this sort of confusion? Avoid the use of __del__? Check for existing instance names before reusing them? ... Thanks, Eric
0
3,018,563
06/10/2010 21:12:55
363,981
06/10/2010 21:12:55
1
0
Obj-C: calling release/dealloc causes EXC_BAD_ACCESS
Here is my custom class: PolygonShape : NSObject { int numberOfSides; int minimumNumberOfSides; int maximumNumberOfSides; } My custom init method: - (id)initWithNumberOfSides:(int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max { if (self = [super init]) { [self setMinimumNumberOfSides:min]; [self setMaximumNumberOfSides:max]; [self setNumberOfSides:sides]; } return self; } My dealloc method: - (void) dealloc { NSLog("Calling dealloc"); [super dealloc]; } My sample code that crashes: PolygonShape *shape1 = [[PolygonShape alloc] initWithNumberOfSides:6 minimumNumberOfSides:5 maximumNumberOfSides:9]; [shape1 release]; I've alloc-ed a PolygonShape increasing the retain count by 1 and then release-ing should decrement it to 0 and call dealloc, printing that message to NSLog but I just get EXC_BAD_ACESS. Many thanks for the help!
objective-c
memory-management
null
null
null
null
open
Obj-C: calling release/dealloc causes EXC_BAD_ACCESS === Here is my custom class: PolygonShape : NSObject { int numberOfSides; int minimumNumberOfSides; int maximumNumberOfSides; } My custom init method: - (id)initWithNumberOfSides:(int)sides minimumNumberOfSides:(int)min maximumNumberOfSides:(int)max { if (self = [super init]) { [self setMinimumNumberOfSides:min]; [self setMaximumNumberOfSides:max]; [self setNumberOfSides:sides]; } return self; } My dealloc method: - (void) dealloc { NSLog("Calling dealloc"); [super dealloc]; } My sample code that crashes: PolygonShape *shape1 = [[PolygonShape alloc] initWithNumberOfSides:6 minimumNumberOfSides:5 maximumNumberOfSides:9]; [shape1 release]; I've alloc-ed a PolygonShape increasing the retain count by 1 and then release-ing should decrement it to 0 and call dealloc, printing that message to NSLog but I just get EXC_BAD_ACESS. Many thanks for the help!
0