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,452,100
05/04/2012 15:49:53
1,374,422
05/04/2012 08:05:03
1
0
Java event is killed when a function for audio playing is called
I am facing a strange programming problem. It has exhausted me but with no solution found! My program is mainly dependent on an event (Java Listener) that is fired from an external hardware for receiving an audio message from that hardware.Inside the eventHandler i do the following 1- pass the received message to a static method "decode" from another class which returns data 2- then i open FileOutputStream, write these data "audio" to a file,and close the FileOutputStream. 3- i call a static method "play" from another class to play the audio file. The problem is: whenever the method "Play" is called for the first message, it causes the event to stop raising and the program to terminate but without exceptions .when i comment out the play method, everything becomes okay ! Do you have some idea about a method causing program termination ? public void messageReceived(int to,Message message) { speexAudioMsg msg = (speexAudioMsg)message; try{ byte[] output = jspeexDecoder.decode(msg.get_frame()); os = new FileOutputStream(file); os.write(output); os.close(); Player.play(); } }
java
events
process
program-termination
audio-playing
null
open
Java event is killed when a function for audio playing is called === I am facing a strange programming problem. It has exhausted me but with no solution found! My program is mainly dependent on an event (Java Listener) that is fired from an external hardware for receiving an audio message from that hardware.Inside the eventHandler i do the following 1- pass the received message to a static method "decode" from another class which returns data 2- then i open FileOutputStream, write these data "audio" to a file,and close the FileOutputStream. 3- i call a static method "play" from another class to play the audio file. The problem is: whenever the method "Play" is called for the first message, it causes the event to stop raising and the program to terminate but without exceptions .when i comment out the play method, everything becomes okay ! Do you have some idea about a method causing program termination ? public void messageReceived(int to,Message message) { speexAudioMsg msg = (speexAudioMsg)message; try{ byte[] output = jspeexDecoder.decode(msg.get_frame()); os = new FileOutputStream(file); os.write(output); os.close(); Player.play(); } }
0
7,211,785
08/27/2011 00:39:29
478,144
10/16/2010 20:24:18
4,559
265
Create a stream of new JSON data from PHP to jQuery
I have this code in PHP: <?php $data = file_get_contents('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'); $xml = simplexml_load_string($data); echo json_encode($xml); ?> And this jQuery: setInterval(function() { $.getJSON('bbc.php', function(data) { console.log(data); $.each(data.channel.item, function(index, item){ $('.container').append("<p data-date='" + item.pubDate + "'>" + item.title + "</p>"); }); }); }, 5000); So, as you can see, its going to append the same dataset below the previous one creating many duplicated entries. What would be the best approach here, using client or server side, to only send back/display new data, rather than outputting the same data again?
php
jquery
getjson
null
null
null
open
Create a stream of new JSON data from PHP to jQuery === I have this code in PHP: <?php $data = file_get_contents('http://newsrss.bbc.co.uk/rss/sportonline_uk_edition/football/rss.xml'); $xml = simplexml_load_string($data); echo json_encode($xml); ?> And this jQuery: setInterval(function() { $.getJSON('bbc.php', function(data) { console.log(data); $.each(data.channel.item, function(index, item){ $('.container').append("<p data-date='" + item.pubDate + "'>" + item.title + "</p>"); }); }); }, 5000); So, as you can see, its going to append the same dataset below the previous one creating many duplicated entries. What would be the best approach here, using client or server side, to only send back/display new data, rather than outputting the same data again?
0
11,600,832
07/22/2012 13:52:09
915,843
08/27/2011 20:20:45
1
0
Possible Combination of String Excluding the Palindromes
I want some Logical algorithm to get all possible combination of given string except the palinadromes. Like Input is: ABC OutPut: A,B,C,AB,AC,BC,ABC,ACB,BCA,BAC It can't contain CBA,CAB as it already has ABC,BAC i.e reverse of those. Please help me with C or C++ code. Recursive functions will be also okay. I am stuck with it for 5 to 5 hours now.
c++
c
string
permutation
combinations
07/23/2012 00:02:20
not a real question
Possible Combination of String Excluding the Palindromes === I want some Logical algorithm to get all possible combination of given string except the palinadromes. Like Input is: ABC OutPut: A,B,C,AB,AC,BC,ABC,ACB,BCA,BAC It can't contain CBA,CAB as it already has ABC,BAC i.e reverse of those. Please help me with C or C++ code. Recursive functions will be also okay. I am stuck with it for 5 to 5 hours now.
1
6,045,456
05/18/2011 13:25:46
758,111
05/17/2011 20:14:15
5
1
C#, does it have a prompt box?
Does C# have a code that makes a prompt box appear so that you can insert a value on it? Like a messageBox but with a text field, like the one that javaScript has. Or do I have to create a form for it?
c#
visual-studio-2008
box
prompt
null
05/18/2011 13:30:07
not a real question
C#, does it have a prompt box? === Does C# have a code that makes a prompt box appear so that you can insert a value on it? Like a messageBox but with a text field, like the one that javaScript has. Or do I have to create a form for it?
1
2,977,196
06/04/2010 19:33:55
358,791
06/04/2010 19:24:53
1
0
4 Colors gradient logic needed
I need to create 4 color gradient logic. One of the posts gave me the pattern to calculate 4 color gradient. However I am having difficutlties to implement it. I am able to calculate color of point E ( middle one) however I do not know how to develop the gradient from it MY code COLORREF NewColor = RGB(255,0,0); COLORREF NewColor2 = RGB(0,255,0); COLORREF NewColor3 = RGB(0,0,255); COLORREF NewColor4 = RGB(255,255,0); red_low = GetRValue(NewColor); blue_low = GetBValue(NewColor); green_low = GetGValue(NewColor); red_high = GetRValue(NewColor2); green_high= GetGValue(NewColor2); blue_high = GetBValue(NewColor2); red_low2 = GetRValue(NewColor3); blue_low2 = GetBValue(NewColor3); // divide the difference in colours by the number of steps green_low2 = GetGValue(NewColor3); red_high2 = GetRValue(NewColor4); green_high2 = GetGValue(NewColor4); // divide the difference in colours by the number of steps blue_high2 = GetBValue(NewColor4); double distance_a = sqrt((double)((0-W)^2+(0-H/2)^2)); double distance_b = sqrt((double)((350-W/2)^2+(0-H/2)^2)); double distance_c = sqrt((double)((350-W/2)^2+(100-H/2)^2)); double distance_d = sqrt((double)((0-W/2)^2+(100-H/2)^2)); double sum_distances = distance_a + distance_b + distance_c + distance_d; double red = (red_low*distance_a + red_high*distance_b + red_low2*distance_c+ red_high2*distance_d) / sum_distances; double green = (green_low*distance_a + green_high*distance_b + green_low2*distance_c+ green_high2*distance_d) / sum_distances; double blue = (blue_low*distance_a + blue_high*distance_b + blue_low2*distance_c+ blue_high2*distance_d) / sum_distances; COLORREF Color_E= RGB(red,green,blue); Ane help how to futher code it is appreciated.
c++
visual-c++
graphics
gradient
null
null
open
4 Colors gradient logic needed === I need to create 4 color gradient logic. One of the posts gave me the pattern to calculate 4 color gradient. However I am having difficutlties to implement it. I am able to calculate color of point E ( middle one) however I do not know how to develop the gradient from it MY code COLORREF NewColor = RGB(255,0,0); COLORREF NewColor2 = RGB(0,255,0); COLORREF NewColor3 = RGB(0,0,255); COLORREF NewColor4 = RGB(255,255,0); red_low = GetRValue(NewColor); blue_low = GetBValue(NewColor); green_low = GetGValue(NewColor); red_high = GetRValue(NewColor2); green_high= GetGValue(NewColor2); blue_high = GetBValue(NewColor2); red_low2 = GetRValue(NewColor3); blue_low2 = GetBValue(NewColor3); // divide the difference in colours by the number of steps green_low2 = GetGValue(NewColor3); red_high2 = GetRValue(NewColor4); green_high2 = GetGValue(NewColor4); // divide the difference in colours by the number of steps blue_high2 = GetBValue(NewColor4); double distance_a = sqrt((double)((0-W)^2+(0-H/2)^2)); double distance_b = sqrt((double)((350-W/2)^2+(0-H/2)^2)); double distance_c = sqrt((double)((350-W/2)^2+(100-H/2)^2)); double distance_d = sqrt((double)((0-W/2)^2+(100-H/2)^2)); double sum_distances = distance_a + distance_b + distance_c + distance_d; double red = (red_low*distance_a + red_high*distance_b + red_low2*distance_c+ red_high2*distance_d) / sum_distances; double green = (green_low*distance_a + green_high*distance_b + green_low2*distance_c+ green_high2*distance_d) / sum_distances; double blue = (blue_low*distance_a + blue_high*distance_b + blue_low2*distance_c+ blue_high2*distance_d) / sum_distances; COLORREF Color_E= RGB(red,green,blue); Ane help how to futher code it is appreciated.
0
6,375,132
06/16/2011 16:15:24
801,888
06/16/2011 16:15:24
1
0
NHibernate with Firebird... are these features enabled?
We're using NHibernate to great success with a Firebird backend. My question relates to the features available in NHibernate being supported by Firebird. If you have any expertise with Firebird and NHibernate your comments are welcome. 1. Does Firebird support "Future" queries? From my reading it would appear that Firebird is one of a few databases that doesn't support this feature. Does anyone have a workaround as "Future" would be a good feature to utilise. 2. Does Firebird support the NHibernate feature "prepare_sql". For some reason I cannot get this to work in Firebird and continually receive the warning (in Nhibernate Profiler) about parameter sizes not being equal. 3. Does Firebird support batching? In NHibernate mappings we specify batching however cannot see any evidence of this in the profiler. For those interested we are using Fluent NHibernate to configure NHibernate. Everything works well and we have a great deal of control over the ORM however just need clarification on the above items. Your thoughts?
c#
nhibernate
fluent-nhibernate
firebird
null
null
open
NHibernate with Firebird... are these features enabled? === We're using NHibernate to great success with a Firebird backend. My question relates to the features available in NHibernate being supported by Firebird. If you have any expertise with Firebird and NHibernate your comments are welcome. 1. Does Firebird support "Future" queries? From my reading it would appear that Firebird is one of a few databases that doesn't support this feature. Does anyone have a workaround as "Future" would be a good feature to utilise. 2. Does Firebird support the NHibernate feature "prepare_sql". For some reason I cannot get this to work in Firebird and continually receive the warning (in Nhibernate Profiler) about parameter sizes not being equal. 3. Does Firebird support batching? In NHibernate mappings we specify batching however cannot see any evidence of this in the profiler. For those interested we are using Fluent NHibernate to configure NHibernate. Everything works well and we have a great deal of control over the ORM however just need clarification on the above items. Your thoughts?
0
11,310,579
07/03/2012 12:08:16
846,180
07/15/2011 09:38:43
844
17
Zend cannot connect to Oracle
In my project, I'm trying to get Zend framework work with Oracle. Apache started under Windows. Here is error message I've got: An error occurred Application error Exception information: Message: SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or user representation not exists (ext\pdci\oci_statement.c:14 Stack trace: #0 C:\Apache\htdocs\library\Zend\Db\Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\Apache\htdocs\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array) #2 C:\Apache\htdocs\library\Zend\Db\Adapter\Pdo\Abstract.php(23: Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array) #3 C:\Apache\htdocs\library\Zend\Db\Table\Abstract.php(1529): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select)) #4 C:\Apache\htdocs\library\Zend\Db\Table\Abstract.php(1344): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #5 C:\Apache\htdocs\application\controllers\CompaniesController.php(12): Zend_Db_Table_Abstract->fetchAll() #6 C:\Apache\htdocs\library\Zend\Controller\Action.php(516): CompaniesController->indexAction() #7 C:\Apache\htdocs\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('indexAction') #8 C:\Apache\htdocs\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #9 C:\Apache\htdocs\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #10 C:\Apache\htdocs\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #11 C:\Apache\htdocs\public\index.php(56): Zend_Application->run() #12 {main} Request Parameters: array ( 'controller' => 'companies', 'action' => 'index', 'module' => 'default', ) Here is my config: resources.db.adapter = PDCI resources.db.params.username = username resources.db.params.password = paswd resources.db.params.dbname = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = alps)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = my.SERVICE.NAME) ) )" TNS is correct
php
oracle
zend-framework
null
null
null
open
Zend cannot connect to Oracle === In my project, I'm trying to get Zend framework work with Oracle. Apache started under Windows. Here is error message I've got: An error occurred Application error Exception information: Message: SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or user representation not exists (ext\pdci\oci_statement.c:14 Stack trace: #0 C:\Apache\htdocs\library\Zend\Db\Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #1 C:\Apache\htdocs\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array) #2 C:\Apache\htdocs\library\Zend\Db\Adapter\Pdo\Abstract.php(23: Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array) #3 C:\Apache\htdocs\library\Zend\Db\Table\Abstract.php(1529): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select)) #4 C:\Apache\htdocs\library\Zend\Db\Table\Abstract.php(1344): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select)) #5 C:\Apache\htdocs\application\controllers\CompaniesController.php(12): Zend_Db_Table_Abstract->fetchAll() #6 C:\Apache\htdocs\library\Zend\Controller\Action.php(516): CompaniesController->indexAction() #7 C:\Apache\htdocs\library\Zend\Controller\Dispatcher\Standard.php(295): Zend_Controller_Action->dispatch('indexAction') #8 C:\Apache\htdocs\library\Zend\Controller\Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #9 C:\Apache\htdocs\library\Zend\Application\Bootstrap\Bootstrap.php(97): Zend_Controller_Front->dispatch() #10 C:\Apache\htdocs\library\Zend\Application.php(366): Zend_Application_Bootstrap_Bootstrap->run() #11 C:\Apache\htdocs\public\index.php(56): Zend_Application->run() #12 {main} Request Parameters: array ( 'controller' => 'companies', 'action' => 'index', 'module' => 'default', ) Here is my config: resources.db.adapter = PDCI resources.db.params.username = username resources.db.params.password = paswd resources.db.params.dbname = "(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = alps)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = my.SERVICE.NAME) ) )" TNS is correct
0
7,448,064
09/16/2011 16:59:26
191,372
10/16/2009 18:30:30
96
0
Please Recommend Objective-C book
I'm looking for good Objective-C books for a beginner like me. My requirements are as follow: - Less word more meat - Geared toward iOS development - Teach XCode as well - Teach patterns of a good iOS development - Coverage unit-testing (important) My background is Java development. Thanks!
objective-c
ios
xcode
null
null
09/16/2011 21:04:18
not constructive
Please Recommend Objective-C book === I'm looking for good Objective-C books for a beginner like me. My requirements are as follow: - Less word more meat - Geared toward iOS development - Teach XCode as well - Teach patterns of a good iOS development - Coverage unit-testing (important) My background is Java development. Thanks!
4
2,785,211
05/06/2010 23:31:02
334,934
05/06/2010 23:30:30
1
0
SQLite3 database doesn't actually insert data - iPhone
I'm trying to add a new entry into my database, but it's not working. There are no errors thrown, and the code that is supposed to be executed after the insertion runs, meaning there are no errors with the query. But still, nothing is added to the database. I've tried both prepared statements and the simpler sqlite3_exec and it's the same result. I know my database is being loaded because the info for the tableview (and subsequent tableviews) are loaded from the database. The connection isn't the problem. Also, the log of the sqlite3_last_insert_rowid(db) returns the correct number for the next row. But still, the information is not saved. Here's my code: <pre><code>db = [Database openDatabase]; NSString *query = [NSString stringWithFormat:@"INSERT INTO lists (name) VALUES('%@')", newField.text]; NSLog(@"Query: %@",query); sqlite3_stmt *statement; if (sqlite3_prepare_v2(db, [query UTF8String], -1, &statement, nil) == SQLITE_OK) { if(sqlite3_step(statement) == SQLITE_DONE){ NSLog(@"You created a new list!"); int newListId = sqlite3_last_insert_rowid(db); MyList *newList = [[MyList alloc] initWithName:newField.text idNumber:[NSNumber numberWithInt:newListId]]; [self.listArray addObject:newList]; [newList release]; [self.tableView reloadData]; sqlite3_finalize(statement); } else { NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(db)); } } [Database closeDatabase:db]; </code></pre> Again, no errors have been thrown. The prepare and step statements return SQLITE_OK and SQLITE_DONE respectively, yet nothing happens. Any help is appreciated!
iphone
objective-c
sqlite3
null
null
null
open
SQLite3 database doesn't actually insert data - iPhone === I'm trying to add a new entry into my database, but it's not working. There are no errors thrown, and the code that is supposed to be executed after the insertion runs, meaning there are no errors with the query. But still, nothing is added to the database. I've tried both prepared statements and the simpler sqlite3_exec and it's the same result. I know my database is being loaded because the info for the tableview (and subsequent tableviews) are loaded from the database. The connection isn't the problem. Also, the log of the sqlite3_last_insert_rowid(db) returns the correct number for the next row. But still, the information is not saved. Here's my code: <pre><code>db = [Database openDatabase]; NSString *query = [NSString stringWithFormat:@"INSERT INTO lists (name) VALUES('%@')", newField.text]; NSLog(@"Query: %@",query); sqlite3_stmt *statement; if (sqlite3_prepare_v2(db, [query UTF8String], -1, &statement, nil) == SQLITE_OK) { if(sqlite3_step(statement) == SQLITE_DONE){ NSLog(@"You created a new list!"); int newListId = sqlite3_last_insert_rowid(db); MyList *newList = [[MyList alloc] initWithName:newField.text idNumber:[NSNumber numberWithInt:newListId]]; [self.listArray addObject:newList]; [newList release]; [self.tableView reloadData]; sqlite3_finalize(statement); } else { NSAssert1(0, @"Error while inserting data. '%s'", sqlite3_errmsg(db)); } } [Database closeDatabase:db]; </code></pre> Again, no errors have been thrown. The prepare and step statements return SQLITE_OK and SQLITE_DONE respectively, yet nothing happens. Any help is appreciated!
0
11,106,629
06/19/2012 17:59:37
1,115,778
12/26/2011 02:25:43
3
0
Send request to server when app in background
I have an application that shows live gold price. It is necessary to notify user when gold price is greater than a specific price even if app is in background. When app is in background, I have to request to server periodically (5 minutes) to get data and notify user if gold price is greater than a specific price. I don't know if iOS support to do that. Please give me advices. P/S: I don't use push notification because of some reasons. Please tell me if background task or something support application to do that.
ios
localnotification
null
null
null
06/21/2012 12:33:45
not a real question
Send request to server when app in background === I have an application that shows live gold price. It is necessary to notify user when gold price is greater than a specific price even if app is in background. When app is in background, I have to request to server periodically (5 minutes) to get data and notify user if gold price is greater than a specific price. I don't know if iOS support to do that. Please give me advices. P/S: I don't use push notification because of some reasons. Please tell me if background task or something support application to do that.
1
8,708,644
01/03/2012 06:21:38
1,114,387
12/24/2011 08:12:18
1
0
Changing the icon of particular node in jtree dynamically based on its index
My problem is like this:<br> I have a tree with root and 4 leafnodes.<br> I need to change icon of a particular node (say 2nd leaf node).<br><br> My algorithm is like this:<br> **step 1: Find index of the required node**<br> **Step2:Change its icon<br>** I am done with step 1,but strucked at step 2. <br>Please help me out....<br><br> Thank you all in advance....
java
swing
jtree
cellrenderer
null
null
open
Changing the icon of particular node in jtree dynamically based on its index === My problem is like this:<br> I have a tree with root and 4 leafnodes.<br> I need to change icon of a particular node (say 2nd leaf node).<br><br> My algorithm is like this:<br> **step 1: Find index of the required node**<br> **Step2:Change its icon<br>** I am done with step 1,but strucked at step 2. <br>Please help me out....<br><br> Thank you all in advance....
0
10,356,999
04/27/2012 19:53:04
1,361,909
04/27/2012 19:45:40
1
0
How can i develope a website with huge database such as monster.com and dice.com
1) How can i develop a website such as monster.com OR dice.com holds Huge Database. 2) what are the software & programs i have to use any suggestion for a specific site with tutorial would be greatly appreciated.
sql
database
development
null
null
04/27/2012 19:57:01
not constructive
How can i develope a website with huge database such as monster.com and dice.com === 1) How can i develop a website such as monster.com OR dice.com holds Huge Database. 2) what are the software & programs i have to use any suggestion for a specific site with tutorial would be greatly appreciated.
4
11,552,646
07/19/2012 01:11:49
600,894
02/03/2011 01:15:58
26
0
Programmatically Insert a checkbox into a repeating table
i have a repeating table which contains a checkbox. The structure is activitylogs(group)-> activityLog(repeating table)-> ongoing (checkbox) I want to dynamically insert new row and assign the checkbox a value according to another filed value. I managed to insert the checkbox, but every time I assigned a value to the check box, I got an error. The error message says System.InvalidOperationException Schema validation found non-data type errors. I googled around and applied the DeleteNil function but still no luck. In the infopath designer, the datatype of the check box is True/False (boolean), value is FALSE when cleared and TRUE when checked The above is my code XmlDocument doc = new XmlDocument(); XmlNode group = doc.CreateElement("my:activityLog", NamespaceManager.LookupNamespace("my")); XmlNode field = doc.CreateElement("my:ongoing", NamespaceManager.LookupNamespace("my")); XmlNode node = group.AppendChild(field); node.InnerText = "TRUE"; doc.AppendChild(group); XPathNavigator node2 = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:activityLogs", NamespaceManager); DeleteNil(node2); node2.AppendChild(doc.DocumentElement.CreateNavigator()); Please help me out, many thanks!
infopath
infopath2010
null
null
null
null
open
Programmatically Insert a checkbox into a repeating table === i have a repeating table which contains a checkbox. The structure is activitylogs(group)-> activityLog(repeating table)-> ongoing (checkbox) I want to dynamically insert new row and assign the checkbox a value according to another filed value. I managed to insert the checkbox, but every time I assigned a value to the check box, I got an error. The error message says System.InvalidOperationException Schema validation found non-data type errors. I googled around and applied the DeleteNil function but still no luck. In the infopath designer, the datatype of the check box is True/False (boolean), value is FALSE when cleared and TRUE when checked The above is my code XmlDocument doc = new XmlDocument(); XmlNode group = doc.CreateElement("my:activityLog", NamespaceManager.LookupNamespace("my")); XmlNode field = doc.CreateElement("my:ongoing", NamespaceManager.LookupNamespace("my")); XmlNode node = group.AppendChild(field); node.InnerText = "TRUE"; doc.AppendChild(group); XPathNavigator node2 = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:activityLogs", NamespaceManager); DeleteNil(node2); node2.AppendChild(doc.DocumentElement.CreateNavigator()); Please help me out, many thanks!
0
8,020,376
11/05/2011 13:11:09
1,027,046
11/03/2011 05:58:59
31
0
how to separate a number from a string
Actually I need to handle situation like I should be giving input as "rows <n>" There should be space between 'rows' and number <n> or any single non numeric character. I should be able to separate that string part and assign it to a char variable and number part to a int... The string part should be then verified whether its a correct command or not.. If a wrong command is entered like "ada aad 99" or "adaha 9" or "adfad9".. It should say "its wrong command". I tried to use strtok(), but it can't handle strings where there isn't NULL in between strings.. I tried to use $ sscanf(string,"%s %*c %d",str, &num); but its even not working for all possibilities. How can I do it..
c
string
null
null
null
11/05/2011 19:37:06
too localized
how to separate a number from a string === Actually I need to handle situation like I should be giving input as "rows <n>" There should be space between 'rows' and number <n> or any single non numeric character. I should be able to separate that string part and assign it to a char variable and number part to a int... The string part should be then verified whether its a correct command or not.. If a wrong command is entered like "ada aad 99" or "adaha 9" or "adfad9".. It should say "its wrong command". I tried to use strtok(), but it can't handle strings where there isn't NULL in between strings.. I tried to use $ sscanf(string,"%s %*c %d",str, &num); but its even not working for all possibilities. How can I do it..
3
7,818,158
10/19/2011 07:53:05
1,002,609
10/19/2011 07:08:31
1
0
Simple SQLite Database and Objective C example for ios
Can you give me a source code about sql lite usage in objective c, ios ?
objective-c
ios
sqlite
null
null
10/19/2011 11:20:17
not a real question
Simple SQLite Database and Objective C example for ios === Can you give me a source code about sql lite usage in objective c, ios ?
1
9,670,573
03/12/2012 16:06:04
826,532
07/03/2011 02:11:31
686
44
Hibernate, fetch, HQL and HashCodes
I have a HQL query something ala' SELECT myclass FROM MyClass myclass JOIN FETCH myclass.anotherset sub JOIN FETCH sub.yetanotherset ... I have a few issues with the hashCode of the class in "anotherset" fails with a lazy initalization error if I do the second fetch, on the line which uses the "yetanotherset" property. What can i do to circumvent this? I would like to keep it in the hashCode and equals methods. Additional question, does HQL ignore fetch=FetchType.EAGER etc? It seems to, but I cant find any verification on this.
java
hibernate
null
null
null
null
open
Hibernate, fetch, HQL and HashCodes === I have a HQL query something ala' SELECT myclass FROM MyClass myclass JOIN FETCH myclass.anotherset sub JOIN FETCH sub.yetanotherset ... I have a few issues with the hashCode of the class in "anotherset" fails with a lazy initalization error if I do the second fetch, on the line which uses the "yetanotherset" property. What can i do to circumvent this? I would like to keep it in the hashCode and equals methods. Additional question, does HQL ignore fetch=FetchType.EAGER etc? It seems to, but I cant find any verification on this.
0
7,685,640
10/07/2011 09:54:22
934,347
09/08/2011 08:13:24
1
0
XML parsing document.CreateElement exception Blackberry
I'm trying to do an xml parser in Blackberry. But i get a strange problem. import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.xml.parsers.DocumentBuilder; import net.rim.device.api.xml.parsers.DocumentBuilderFactory; import net.rim.device.api.xml.parsers.ParserConfigurationException; public class HelloWorld extends UiApplication { public static void main(String[] args) { HelloWorld theApp = new HelloWorld(); theApp.enterEventDispatcher(); } public HelloWorld() { pushScreen(new HelloWorldScreen()); } } final class HelloWorldScreen extends MainScreen { public HelloWorldScreen() { super(); LabelField title = new LabelField("XML TEST", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); setTitle(title); RichTextField rcfield = new RichTextField("XML TEST!"); add(rcfield); this.doPaint(); this.invalidate(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db=null; Document doc = null; try { db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } doc = db.newDocument(); try{ Element e = doc.createElement("s:Envelop"); }catch(DOMException ex){ System.out.println(ex.getMessage()); } } public boolean onClose() { Dialog.alert("Goodbye!"); System.exit(0); return true; } } The error message: [0.0] DOMException [0.0] No detail message [0.0] net_rim_xml(4C48DD8C) [0.0] DOMInternalRepresentation [0.0] isNCName [0.0] 0x3930 [0.0] net_rim_xml(4C48DD8C) [0.0] DOMDocumentImpl [0.0] createElement [0.0] 0x4CC [0.0] VM:+CR [0.0] VM:-CR=7 Error code5 : INVALID CHARACTER ERROR Maybe the ":" is invalid character? But it works fine on android :/ I dont have any idea how to solve it :(
xml
blackberry
null
null
null
null
open
XML parsing document.CreateElement exception Blackberry === I'm trying to do an xml parser in Blackberry. But i get a strange problem. import org.w3c.dom.DOMException; import org.w3c.dom.Document; import org.w3c.dom.Element; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.xml.parsers.DocumentBuilder; import net.rim.device.api.xml.parsers.DocumentBuilderFactory; import net.rim.device.api.xml.parsers.ParserConfigurationException; public class HelloWorld extends UiApplication { public static void main(String[] args) { HelloWorld theApp = new HelloWorld(); theApp.enterEventDispatcher(); } public HelloWorld() { pushScreen(new HelloWorldScreen()); } } final class HelloWorldScreen extends MainScreen { public HelloWorldScreen() { super(); LabelField title = new LabelField("XML TEST", LabelField.ELLIPSIS | LabelField.USE_ALL_WIDTH); setTitle(title); RichTextField rcfield = new RichTextField("XML TEST!"); add(rcfield); this.doPaint(); this.invalidate(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db=null; Document doc = null; try { db = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } doc = db.newDocument(); try{ Element e = doc.createElement("s:Envelop"); }catch(DOMException ex){ System.out.println(ex.getMessage()); } } public boolean onClose() { Dialog.alert("Goodbye!"); System.exit(0); return true; } } The error message: [0.0] DOMException [0.0] No detail message [0.0] net_rim_xml(4C48DD8C) [0.0] DOMInternalRepresentation [0.0] isNCName [0.0] 0x3930 [0.0] net_rim_xml(4C48DD8C) [0.0] DOMDocumentImpl [0.0] createElement [0.0] 0x4CC [0.0] VM:+CR [0.0] VM:-CR=7 Error code5 : INVALID CHARACTER ERROR Maybe the ":" is invalid character? But it works fine on android :/ I dont have any idea how to solve it :(
0
9,399,785
02/22/2012 17:21:22
1,226,468
02/22/2012 17:15:46
1
0
How can I stop an app that I admin from sending email spam?
An app I created several years ago has recently started sending users email spam (emails, not FB messages, that promote similar apps) and I'd like that to stop. Is Facebook doing this or hackers? And how can I stop it?
email
facebook-apps
null
null
null
02/24/2012 03:11:42
off topic
How can I stop an app that I admin from sending email spam? === An app I created several years ago has recently started sending users email spam (emails, not FB messages, that promote similar apps) and I'd like that to stop. Is Facebook doing this or hackers? And how can I stop it?
2
106,794
09/20/2008 02:15:07
9,825
09/15/2008 20:04:37
71
10
What do you use to protect your .NET code from reverse engineering?
For a while we were using a tool called CodeVeil. I'm just wondering if there are better alternatives out there.
.net
obfuscation
reflector
null
null
01/27/2012 18:05:37
not constructive
What do you use to protect your .NET code from reverse engineering? === For a while we were using a tool called CodeVeil. I'm just wondering if there are better alternatives out there.
4
4,135,841
11/09/2010 16:11:08
141,080
07/19/2009 22:01:24
38
1
Validation of ViewState MAC Failed.
Sorry if this is duplicate but I've been going crazy for the past two hours over this. After changing the Master Page in ASP.NET MVC 1.0 application, I keep getting this familiar error when I try a postback without filling in the mandatory form elements which are validated by the server: "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster." The new page refers to a lot of jQuery code with lightboxes, superfish etc. Could that be a problem while doing a postback? If I revert back to the original master, the error disappears and I'm able to validate form fields. Both masters are located in the same path. I know a lot of other guys have faced this issue but I was unable to find anything which could help me. Thanks.
c#
.net
asp.net
jquery
asp.net-mvc
null
open
Validation of ViewState MAC Failed. === Sorry if this is duplicate but I've been going crazy for the past two hours over this. After changing the Master Page in ASP.NET MVC 1.0 application, I keep getting this familiar error when I try a postback without filling in the mandatory form elements which are validated by the server: "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster." The new page refers to a lot of jQuery code with lightboxes, superfish etc. Could that be a problem while doing a postback? If I revert back to the original master, the error disappears and I'm able to validate form fields. Both masters are located in the same path. I know a lot of other guys have faced this issue but I was unable to find anything which could help me. Thanks.
0
8,991,201
01/24/2012 17:21:35
1,161,340
01/20/2012 19:32:35
6
0
Why does my java servlet containing embedded HTML and Javascript show just a blank white page?
I have used this html/javascript which runs perfectly from a client browser. But when embedded in a Java Servlet it seems to process the code but just returns an empty blank page. None of the system.out messages appear in the server output. I am wondering if this may be due to something to with the PrintWriter and ServletOuputStream not being flushed properly? Any ideas? The Javascript: http://www.javascriptkit.com/script/script2/jsslide.shtml Here is the main part of my embedded html/javascript: StringBuilder clientHeadDeclaration = new StringBuilder(); clientHeadDeclaration.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); clientHeadDeclaration.append("<html>"); clientHeadDeclaration.append("<head>"); clientHeadDeclaration.append("<script language=\"JavaScript1.1\">"); clientHeadDeclaration.append("<!--"); clientHeadDeclaration.append("var slideimages=new Array()"); clientHeadDeclaration.append("var slidelinks=new Array()"); clientHeadDeclaration.append("function slideshowimages(){"); clientHeadDeclaration.append("for (i=0;i<slideshowimages.arguments.length;i++){"); clientHeadDeclaration.append("slideimages[i]=new Image()"); clientHeadDeclaration.append("slideimages[i].src=slideshowimages.arguments[i]"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("function slideshowlinks(){"); clientHeadDeclaration.append("for (i=0;i<slideshowlinks.arguments.length;i++)"); clientHeadDeclaration.append("slidelinks[i]=slideshowlinks.arguments[i]"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("function gotoshow(){"); clientHeadDeclaration.append("if (!window.winslide||winslide.closed)"); clientHeadDeclaration.append("winslide=window.open(slidelinks[whichlink])"); clientHeadDeclaration.append("else"); clientHeadDeclaration.append("winslide.location=slidelinks[whichlink]"); clientHeadDeclaration.append("winslide.focus()"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("//-->"); clientHeadDeclaration.append("</script>"); clientHeadDeclaration.append("</head>"); StringBuilder clientBodyDeclaration = new StringBuilder(); clientBodyDeclaration.append("<body>"); clientBodyDeclaration.append("<a href=\"javascript:gotoshow()\"><img src=\"Http://localhost:8080/imageUploader/imageGeneratorTest.jpg\" name=\"slide\" border=0 width=300 height=375></a>"); clientBodyDeclaration.append("<script>"); clientBodyDeclaration.append("<!--"); out.println(clientHeadDeclaration); out.flush(); System.out.println(clientHeadDeclaration); StringBuilder imageArrayDeclaration = new StringBuilder(); StringBuilder urlArrayDeclaration = new StringBuilder(); imageArrayDeclaration.append("slideshowimages("); urlArrayDeclaration.append("slideshowlinks("); boolean first = true; while ( rs.next()) { if (!first) { imageArrayDeclaration.append(", "); urlArrayDeclaration.append(", "); } first = false; imageArrayDeclaration.append("\""); imageArrayDeclaration.append(rs.getString("id")); imageArrayDeclaration.append("\""); urlArrayDeclaration.append("\""); urlArrayDeclaration.append(getURLofImageFromDatabase(rs.getString("id"),response,outStream)); urlArrayDeclaration.append("\""); } con.close(); imageArrayDeclaration.append(");"); urlArrayDeclaration.append(");"); out.println(imageArrayDeclaration); out.println(urlArrayDeclaration); out.flush(); System.out.println(imageArrayDeclaration); System.out.println(urlArrayDeclaration); clientBodyDeclaration.append("var slideshowspeed=2000"); clientBodyDeclaration.append("var whichlink=0"); clientBodyDeclaration.append("var whichimage=0"); clientBodyDeclaration.append("function slideit(){"); clientBodyDeclaration.append("if (!document.images)"); clientBodyDeclaration.append("return"); clientBodyDeclaration.append("document.images.slide.src=slideimages[whichimage].src"); clientBodyDeclaration.append("whichlink=whichimage"); clientBodyDeclaration.append("if (whichimage<slideimages.length-1)"); clientBodyDeclaration.append("whichimage++"); clientBodyDeclaration.append("else"); clientBodyDeclaration.append("whichimage=0"); clientBodyDeclaration.append("setTimeout(\"slideit()\",slideshowspeed)"); clientBodyDeclaration.append("}"); clientBodyDeclaration.append(" slideit()"); clientBodyDeclaration.append("//-->"); clientBodyDeclaration.append("</script>"); clientBodyDeclaration.append("<p align=\"center\"><font face=\"arial\" size=\"-2\">This free script provided by</font><br>"); clientBodyDeclaration.append("<font face=\"arial, helvetica\" size=\"-2\"><a href=\"http://javascriptkit.com\">JavaScriptKit</a></font></p>"); out.println(clientBodyDeclaration); out.flush(); outStream.close(); Here is the helper function which gets the image from the database, makes a copy on the server and returns a URL to the image for the servlet: private String getURLofImageFromDatabase(String id, HttpServletResponse response, ServletOutputStream os) { String url = "jdbc:mysql://localhost:3306/"; String dbName = "imagedatabase"; String driver = "com.mysql.jdbc.Driver"; String userName = "root"; String password = "aphextwin"; String imagePath = getServletContext().getRealPath("/"); String imageURL = "http://localhost:8080/imageUploader"; try { Class.forName(driver); Connection con = DriverManager.getConnection(url+dbName, userName, password); PreparedStatement ps = con.prepareStatement("select photo from photos where id = ?"); ps.setString(1,id); ResultSet rs = ps.executeQuery(); rs.next(); Blob b = rs.getBlob("photo"); response.setContentType("image/jpeg"); response.setContentLength( (int) b.length()); File image = new File(imagePath, id + ".jpg"); imageURL += id + ".jpg"; DataOutputStream out = new DataOutputStream(new FileOutputStream(image)); InputStream is = b.getBinaryStream(); byte buf[] = new byte[(int) b.length()]; is.read(buf); os.write(buf); out.write(buf); os.close(); //out.close(); } catch(Exception ex) { System.out.println(ex.getMessage()); } return imageURL; } }
java
javascript
html
null
null
01/25/2012 13:03:48
not a real question
Why does my java servlet containing embedded HTML and Javascript show just a blank white page? === I have used this html/javascript which runs perfectly from a client browser. But when embedded in a Java Servlet it seems to process the code but just returns an empty blank page. None of the system.out messages appear in the server output. I am wondering if this may be due to something to with the PrintWriter and ServletOuputStream not being flushed properly? Any ideas? The Javascript: http://www.javascriptkit.com/script/script2/jsslide.shtml Here is the main part of my embedded html/javascript: StringBuilder clientHeadDeclaration = new StringBuilder(); clientHeadDeclaration.append("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); clientHeadDeclaration.append("<html>"); clientHeadDeclaration.append("<head>"); clientHeadDeclaration.append("<script language=\"JavaScript1.1\">"); clientHeadDeclaration.append("<!--"); clientHeadDeclaration.append("var slideimages=new Array()"); clientHeadDeclaration.append("var slidelinks=new Array()"); clientHeadDeclaration.append("function slideshowimages(){"); clientHeadDeclaration.append("for (i=0;i<slideshowimages.arguments.length;i++){"); clientHeadDeclaration.append("slideimages[i]=new Image()"); clientHeadDeclaration.append("slideimages[i].src=slideshowimages.arguments[i]"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("function slideshowlinks(){"); clientHeadDeclaration.append("for (i=0;i<slideshowlinks.arguments.length;i++)"); clientHeadDeclaration.append("slidelinks[i]=slideshowlinks.arguments[i]"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("function gotoshow(){"); clientHeadDeclaration.append("if (!window.winslide||winslide.closed)"); clientHeadDeclaration.append("winslide=window.open(slidelinks[whichlink])"); clientHeadDeclaration.append("else"); clientHeadDeclaration.append("winslide.location=slidelinks[whichlink]"); clientHeadDeclaration.append("winslide.focus()"); clientHeadDeclaration.append("}"); clientHeadDeclaration.append("//-->"); clientHeadDeclaration.append("</script>"); clientHeadDeclaration.append("</head>"); StringBuilder clientBodyDeclaration = new StringBuilder(); clientBodyDeclaration.append("<body>"); clientBodyDeclaration.append("<a href=\"javascript:gotoshow()\"><img src=\"Http://localhost:8080/imageUploader/imageGeneratorTest.jpg\" name=\"slide\" border=0 width=300 height=375></a>"); clientBodyDeclaration.append("<script>"); clientBodyDeclaration.append("<!--"); out.println(clientHeadDeclaration); out.flush(); System.out.println(clientHeadDeclaration); StringBuilder imageArrayDeclaration = new StringBuilder(); StringBuilder urlArrayDeclaration = new StringBuilder(); imageArrayDeclaration.append("slideshowimages("); urlArrayDeclaration.append("slideshowlinks("); boolean first = true; while ( rs.next()) { if (!first) { imageArrayDeclaration.append(", "); urlArrayDeclaration.append(", "); } first = false; imageArrayDeclaration.append("\""); imageArrayDeclaration.append(rs.getString("id")); imageArrayDeclaration.append("\""); urlArrayDeclaration.append("\""); urlArrayDeclaration.append(getURLofImageFromDatabase(rs.getString("id"),response,outStream)); urlArrayDeclaration.append("\""); } con.close(); imageArrayDeclaration.append(");"); urlArrayDeclaration.append(");"); out.println(imageArrayDeclaration); out.println(urlArrayDeclaration); out.flush(); System.out.println(imageArrayDeclaration); System.out.println(urlArrayDeclaration); clientBodyDeclaration.append("var slideshowspeed=2000"); clientBodyDeclaration.append("var whichlink=0"); clientBodyDeclaration.append("var whichimage=0"); clientBodyDeclaration.append("function slideit(){"); clientBodyDeclaration.append("if (!document.images)"); clientBodyDeclaration.append("return"); clientBodyDeclaration.append("document.images.slide.src=slideimages[whichimage].src"); clientBodyDeclaration.append("whichlink=whichimage"); clientBodyDeclaration.append("if (whichimage<slideimages.length-1)"); clientBodyDeclaration.append("whichimage++"); clientBodyDeclaration.append("else"); clientBodyDeclaration.append("whichimage=0"); clientBodyDeclaration.append("setTimeout(\"slideit()\",slideshowspeed)"); clientBodyDeclaration.append("}"); clientBodyDeclaration.append(" slideit()"); clientBodyDeclaration.append("//-->"); clientBodyDeclaration.append("</script>"); clientBodyDeclaration.append("<p align=\"center\"><font face=\"arial\" size=\"-2\">This free script provided by</font><br>"); clientBodyDeclaration.append("<font face=\"arial, helvetica\" size=\"-2\"><a href=\"http://javascriptkit.com\">JavaScriptKit</a></font></p>"); out.println(clientBodyDeclaration); out.flush(); outStream.close(); Here is the helper function which gets the image from the database, makes a copy on the server and returns a URL to the image for the servlet: private String getURLofImageFromDatabase(String id, HttpServletResponse response, ServletOutputStream os) { String url = "jdbc:mysql://localhost:3306/"; String dbName = "imagedatabase"; String driver = "com.mysql.jdbc.Driver"; String userName = "root"; String password = "aphextwin"; String imagePath = getServletContext().getRealPath("/"); String imageURL = "http://localhost:8080/imageUploader"; try { Class.forName(driver); Connection con = DriverManager.getConnection(url+dbName, userName, password); PreparedStatement ps = con.prepareStatement("select photo from photos where id = ?"); ps.setString(1,id); ResultSet rs = ps.executeQuery(); rs.next(); Blob b = rs.getBlob("photo"); response.setContentType("image/jpeg"); response.setContentLength( (int) b.length()); File image = new File(imagePath, id + ".jpg"); imageURL += id + ".jpg"; DataOutputStream out = new DataOutputStream(new FileOutputStream(image)); InputStream is = b.getBinaryStream(); byte buf[] = new byte[(int) b.length()]; is.read(buf); os.write(buf); out.write(buf); os.close(); //out.close(); } catch(Exception ex) { System.out.println(ex.getMessage()); } return imageURL; } }
1
9,187,360
02/08/2012 03:12:13
468,251
10/06/2010 17:09:04
28
0
Open all ports like daemons
how can I open all ports like http://pastebin.com/raw.php?i=Pj3jyJS or http://pastebin.com/raw.php?i=6BQjuRXm ? So for make noise in scans.
linux
debian
iptables
null
null
02/08/2012 08:22:46
not a real question
Open all ports like daemons === how can I open all ports like http://pastebin.com/raw.php?i=Pj3jyJS or http://pastebin.com/raw.php?i=6BQjuRXm ? So for make noise in scans.
1
4,985,493
02/13/2011 16:56:23
293,595
03/14/2010 22:13:59
11
0
.htaccess file for maintenance
I'm making significant changes to my website today and want to display a maintenance page for everyone except for me. However, it also keeps redirecting me to the maintenance page even though I whitelisted my IP address (which I triple-checked by doing an ipconfig). I'm guessing something is wrong with my code. Here's my .htaccess file in case anyone can help! ----- RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.playbank\.com$ [NC] RewriteRule ^(.*)$ http://www.playbank.com/$1 [L,R=301] RewriteEngine On RewriteBase / RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.* RewriteCond %{REQUEST_URI} !^/maintenance\.html$ RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
.htaccess
null
null
null
null
null
open
.htaccess file for maintenance === I'm making significant changes to my website today and want to display a maintenance page for everyone except for me. However, it also keeps redirecting me to the maintenance page even though I whitelisted my IP address (which I triple-checked by doing an ipconfig). I'm guessing something is wrong with my code. Here's my .htaccess file in case anyone can help! ----- RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www\.playbank\.com$ [NC] RewriteRule ^(.*)$ http://www.playbank.com/$1 [L,R=301] RewriteEngine On RewriteBase / RewriteCond %{REMOTE_ADDR} !^192\.168\.1\.* RewriteCond %{REQUEST_URI} !^/maintenance\.html$ RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
0
4,932,859
02/08/2011 12:16:52
602,629
12/27/2010 05:54:44
1
0
android google map
can anybody help me that how to load kml file in google map?
android
file
kml
null
null
07/17/2012 19:10:38
not a real question
android google map === can anybody help me that how to load kml file in google map?
1
11,727,667
07/30/2012 18:46:03
523,256
11/28/2010 22:26:42
70
0
WordPress - wp-admin subdomain
I'm new with WordPress, trying to map the wp-admin to a subdomain: instead of: www.mydomain.net/wp-admin I would like: admin.mydomain.net I have already created a sub-domain (I use GoDaddy) that maps admin.mydomain.net to www.mydomain.net/wp-admin I'm posting this question after searching the whole wide web, but all I found is moving the entire site to a subdomain, which I am not interested in. Thanks in advance to all the helpers!
wordpress
admin
null
null
null
07/31/2012 00:16:00
off topic
WordPress - wp-admin subdomain === I'm new with WordPress, trying to map the wp-admin to a subdomain: instead of: www.mydomain.net/wp-admin I would like: admin.mydomain.net I have already created a sub-domain (I use GoDaddy) that maps admin.mydomain.net to www.mydomain.net/wp-admin I'm posting this question after searching the whole wide web, but all I found is moving the entire site to a subdomain, which I am not interested in. Thanks in advance to all the helpers!
2
9,730,030
03/16/2012 00:07:06
990,275
10/11/2011 20:24:40
21
0
Sensors and smartphones
can any body tell me how pressure sensors and infrared sensors work in sensor in smartphone . And is it possible to build a device like this one : http://www.engadget.com/2011/10/13/mobius-smartphone-ultrasound-hits-the-market-two-years-too-late/ without resorting to the scanner . And by the way what smartphones are there in the market that is best suited to this sort of medical experiment . The smartphone must have very good infrared and pressure sensors and by my novice guess have to have great image processing capability . Thanks
android
nokia
sensor
smartphone
medical
03/19/2012 12:22:53
off topic
Sensors and smartphones === can any body tell me how pressure sensors and infrared sensors work in sensor in smartphone . And is it possible to build a device like this one : http://www.engadget.com/2011/10/13/mobius-smartphone-ultrasound-hits-the-market-two-years-too-late/ without resorting to the scanner . And by the way what smartphones are there in the market that is best suited to this sort of medical experiment . The smartphone must have very good infrared and pressure sensors and by my novice guess have to have great image processing capability . Thanks
2
4,704,535
01/16/2011 08:53:46
242,814
01/03/2010 20:12:56
565
18
Code golf: CVS to HTML Table.
An example is worth a thousand words, so I'll give you three. Write a function, in your language of choice, that will: 1. When given the empty string, output `<table></table>` 2. When given the string: `"Country","Population","Language"` output `<table><tr><th>Country</th><th>Population</th><th>Language</th></tr></table>` 3. When given the following string: <pre><code>"Country","Population","Language" "France",62\,000\,000,"French" "World",6\,000\,000\,000,,</code></pre> Output the following string: <table><tr><th>Country</th><th>Population</th><th>Language</th></tr><tr><td>France</td><td>62,000,000</td><td>French</td></tr><tr><td>World</td><td>6,000,000,000</td><td></td></tr></table> Note that in each case, quotes around a string must be stripped if present, and escaped commas must be handled properly.
code-golf
null
null
null
null
05/27/2011 08:38:51
off topic
Code golf: CVS to HTML Table. === An example is worth a thousand words, so I'll give you three. Write a function, in your language of choice, that will: 1. When given the empty string, output `<table></table>` 2. When given the string: `"Country","Population","Language"` output `<table><tr><th>Country</th><th>Population</th><th>Language</th></tr></table>` 3. When given the following string: <pre><code>"Country","Population","Language" "France",62\,000\,000,"French" "World",6\,000\,000\,000,,</code></pre> Output the following string: <table><tr><th>Country</th><th>Population</th><th>Language</th></tr><tr><td>France</td><td>62,000,000</td><td>French</td></tr><tr><td>World</td><td>6,000,000,000</td><td></td></tr></table> Note that in each case, quotes around a string must be stripped if present, and escaped commas must be handled properly.
2
6,543,406
07/01/2011 03:49:15
653,724
03/10/2011 14:33:10
23
0
Embedded Linux Training
I have been working with an old OS9(not mac) operating system and I have been trying to get my organization to transition to an embedded linux platform. We have money in the budget for training and I figure I would take advantage of it. A secondary impetus would be a good resume addition. What are some good vendors/bootcamps for Embedded Linux Training? Thanks, Seth
linux
training
null
null
null
07/01/2011 04:00:07
off topic
Embedded Linux Training === I have been working with an old OS9(not mac) operating system and I have been trying to get my organization to transition to an embedded linux platform. We have money in the budget for training and I figure I would take advantage of it. A secondary impetus would be a good resume addition. What are some good vendors/bootcamps for Embedded Linux Training? Thanks, Seth
2
6,337,672
06/13/2011 23:46:40
480,033
10/19/2010 04:26:37
666
25
WP Plugin - Creating a New "Section"
Does Wordpress have the ability to use the currently defined template to serve up content in the database? For example, I have a database of a bunch of custom content-- the name of an item, the price, etc. I want all requests for http://myshop.com/buy/* to be redirected to the plugin (so that the plugin handles the content generation), where the * is an item number or some other parameter. Can I use the Wordpress template and display my custom content? I would be handling all of the HTML generation for inserting into the template...
php
wordpress
null
null
null
06/14/2011 02:06:34
off topic
WP Plugin - Creating a New "Section" === Does Wordpress have the ability to use the currently defined template to serve up content in the database? For example, I have a database of a bunch of custom content-- the name of an item, the price, etc. I want all requests for http://myshop.com/buy/* to be redirected to the plugin (so that the plugin handles the content generation), where the * is an item number or some other parameter. Can I use the Wordpress template and display my custom content? I would be handling all of the HTML generation for inserting into the template...
2
7,367,636
09/09/2011 21:27:56
929,587
09/05/2011 21:21:24
28
2
Mirror a line segment
I have a line segment (x1, y1), (x2, y2) that i need "mirrored" so the new line becomes perpendicular to the first one and passes through its middle. The line segment (0,0),(2,2) should return a new line segment (0,2),(2,0) Can anyone help me with a function/formula to handle this?
geometry
line
mirroring
null
null
null
open
Mirror a line segment === I have a line segment (x1, y1), (x2, y2) that i need "mirrored" so the new line becomes perpendicular to the first one and passes through its middle. The line segment (0,0),(2,2) should return a new line segment (0,2),(2,0) Can anyone help me with a function/formula to handle this?
0
7,432,072
09/15/2011 13:58:00
602,257
02/03/2011 21:21:02
482
8
My application tested on iPod Touch 4G doesn't run on iPhone3
What should i do to make my application ,which was tested on iPod Touch 4G, working on iPhone3.
ios
ipod-touch
null
null
null
09/16/2011 04:07:17
not a real question
My application tested on iPod Touch 4G doesn't run on iPhone3 === What should i do to make my application ,which was tested on iPod Touch 4G, working on iPhone3.
1
89,444
09/18/2008 02:20:55
5,061
09/07/2008 16:28:40
1
2
Free or open source IBM 3151 or aixterm emulators?
Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring licenses of Hummingbird HostExplorer to India. For that matter, if we could save on US Hummingbird licenses it would be beneficial as well. Thanks!
aix
3151
terminalemulator
null
null
08/26/2011 20:45:41
off topic
Free or open source IBM 3151 or aixterm emulators? === Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring licenses of Hummingbird HostExplorer to India. For that matter, if we could save on US Hummingbird licenses it would be beneficial as well. Thanks!
2
4,756,369
01/21/2011 07:22:54
435,674
08/31/2010 07:39:56
1
2
I've to design a web application with 1000 of forms.
I've to design a web application with 1000 of forms. The application needs to store all forms and forms data in database and all forms should be manageable from admin panel. Admin should be able to manage all forms and also manage how preview or form with some content display after form submit. what the right approach for this. Any suggestions would be highly appreciated. Thanks
php
mysql
ajax
null
null
01/22/2011 10:04:34
not a real question
I've to design a web application with 1000 of forms. === I've to design a web application with 1000 of forms. The application needs to store all forms and forms data in database and all forms should be manageable from admin panel. Admin should be able to manage all forms and also manage how preview or form with some content display after form submit. what the right approach for this. Any suggestions would be highly appreciated. Thanks
1
9,020,925
01/26/2012 15:54:11
336,040
05/08/2010 07:10:19
477
67
How to implement XLIFF file format in to PHP?
Can any one please let me know how to implement `XLIFF` file format in to PHP? as of my knowledge it is for `multilingual web development concept for CMS based projects`. But not sure how it is to be implement on PHP i.e the methodology of reading/writing content into this XML file. Please let me know if any other reference, URLs, books will be appreciable. Thanks.
php
xml
open-source
null
null
null
open
How to implement XLIFF file format in to PHP? === Can any one please let me know how to implement `XLIFF` file format in to PHP? as of my knowledge it is for `multilingual web development concept for CMS based projects`. But not sure how it is to be implement on PHP i.e the methodology of reading/writing content into this XML file. Please let me know if any other reference, URLs, books will be appreciable. Thanks.
0
6,448,632
06/23/2011 02:14:35
522,065
11/27/2010 06:27:18
21
2
'read' not timing out when reading from pipe in bash
I create a pipe using mkfifo /tmp/foo.pipe Now, I want to try reading from the pipe for a maximum of 2 seconds, so I execute read -t 2 line < /tmp/foo.pipe The timeout does not occur. Read just sits there waiting for input from the pipe. The manuals say that 'read' is supposed to work with named pipes. Does anyone have an idea why this is happening? ls -al /tmp/foo.pipe gives prw-r----- 1 foo bar 0 Jun 22 19:06 /tmp/foo.pipe
bash
timeout
null
null
null
null
open
'read' not timing out when reading from pipe in bash === I create a pipe using mkfifo /tmp/foo.pipe Now, I want to try reading from the pipe for a maximum of 2 seconds, so I execute read -t 2 line < /tmp/foo.pipe The timeout does not occur. Read just sits there waiting for input from the pipe. The manuals say that 'read' is supposed to work with named pipes. Does anyone have an idea why this is happening? ls -al /tmp/foo.pipe gives prw-r----- 1 foo bar 0 Jun 22 19:06 /tmp/foo.pipe
0
7,122,659
08/19/2011 13:56:18
902,564
08/19/2011 13:56:18
1
0
Content provider and sqlite database, uri syntax
I have been unsuccessfully trying to access database trough content provider for couple of days now. I think that I don't understand the syntax of the Uri that is used to point to the database. Maybe I don't understand correctly the Android developer's documentation about the format of Uri. I have a database which name is "testdatabase.db", table which name is "table1" and a class named "DbProvider" that subclasses ContentProvider class. The database is created successfully and I can make queries to it using adb shell, but when I try to make queries from client, I got IllegalArgumentException "Unknown uri: content://com.test.dbprovider/testdatabase.db" Could somebody please explain what is the correct format of Uri in my case? And what is the syntax of authority part of provider? Can an authority be named for example com.test.foo and it should still work or should the last part after dot be a class name or something like that? I have also made the necessary provider tags to AndroidManifest.xml file. Br Ile
uri
android-contentprovider
authority
null
null
null
open
Content provider and sqlite database, uri syntax === I have been unsuccessfully trying to access database trough content provider for couple of days now. I think that I don't understand the syntax of the Uri that is used to point to the database. Maybe I don't understand correctly the Android developer's documentation about the format of Uri. I have a database which name is "testdatabase.db", table which name is "table1" and a class named "DbProvider" that subclasses ContentProvider class. The database is created successfully and I can make queries to it using adb shell, but when I try to make queries from client, I got IllegalArgumentException "Unknown uri: content://com.test.dbprovider/testdatabase.db" Could somebody please explain what is the correct format of Uri in my case? And what is the syntax of authority part of provider? Can an authority be named for example com.test.foo and it should still work or should the last part after dot be a class name or something like that? I have also made the necessary provider tags to AndroidManifest.xml file. Br Ile
0
6,877,659
07/29/2011 18:52:08
221,023
11/29/2009 23:35:32
2,902
10
How to get an array of sentences using CFStringTokenizer?
I've created an string tokenizer like this: stringTokenizer = CFStringTokenizerCreate(NULL, (CFStringRef)str, CFRangeMake(0, [str length]), kCFStringTokenizerUnitSentence, userLocale); But how do I obtain those sentences now from the tokenizer? The CF String Programming Guide doesn't mention CFStringTokenizer or tokens (did a full-text search in the PDF).
cocoa
nsstring
cfstring
null
null
null
open
How to get an array of sentences using CFStringTokenizer? === I've created an string tokenizer like this: stringTokenizer = CFStringTokenizerCreate(NULL, (CFStringRef)str, CFRangeMake(0, [str length]), kCFStringTokenizerUnitSentence, userLocale); But how do I obtain those sentences now from the tokenizer? The CF String Programming Guide doesn't mention CFStringTokenizer or tokens (did a full-text search in the PDF).
0
8,357,203
12/02/2011 13:40:52
297,776
03/19/2010 23:09:51
7,065
103
Is it possible to display text in a console with a strike-through effect?
I have already looked into ANSI escape codes, but it looks like only underlining is supported. Do I miss something or is there another option?
text
console
terminal
ansi
strikethrough
null
open
Is it possible to display text in a console with a strike-through effect? === I have already looked into ANSI escape codes, but it looks like only underlining is supported. Do I miss something or is there another option?
0
476,822
01/24/2009 22:48:27
40,847
11/25/2008 23:00:26
1
1
jQuery time picker
I know there are a few plugins out there but I was wondering if anybody here had a preference for any particular one. I'm looking to fill a text input with a time that the user can choose in 15 minute intervals.
jquery
time
javascript
null
null
05/25/2012 03:21:12
not constructive
jQuery time picker === I know there are a few plugins out there but I was wondering if anybody here had a preference for any particular one. I'm looking to fill a text input with a time that the user can choose in 15 minute intervals.
4
9,283,195
02/14/2012 19:44:10
1,209,860
02/14/2012 19:41:44
1
0
Creating a Word Combinator Tool in Ruby
would appreciate anyone who can help with this... I know it should be simple, but I'm just starting out and none of my ideas are working! (This is an exercise from a class on CodeLesson.com.) "Write a program that will accept a list of words from a user. These can either be one per line or all on a single line and delimited in some way (with commas perhaps). Then print out every combination of two words. So, for example, if a user were to type in book,bus,car,plane then the output would be something like: bookbook bookbus bookcar bookplane busbook busbus buscar busplane carbook carbus carcar carplane planebook planebus planecar planeplane"
ruby
null
null
null
null
null
open
Creating a Word Combinator Tool in Ruby === would appreciate anyone who can help with this... I know it should be simple, but I'm just starting out and none of my ideas are working! (This is an exercise from a class on CodeLesson.com.) "Write a program that will accept a list of words from a user. These can either be one per line or all on a single line and delimited in some way (with commas perhaps). Then print out every combination of two words. So, for example, if a user were to type in book,bus,car,plane then the output would be something like: bookbook bookbus bookcar bookplane busbook busbus buscar busplane carbook carbus carcar carplane planebook planebus planecar planeplane"
0
8,903,842
01/18/2012 00:56:12
980,622
10/05/2011 14:57:09
1
0
Gtalk XMPP connect with oauth
I wonder how I can connect to Gtalk using XMPP via oauth (no password) thanks
oauth
xmpp
gtalk
null
null
01/18/2012 15:50:29
not a real question
Gtalk XMPP connect with oauth === I wonder how I can connect to Gtalk using XMPP via oauth (no password) thanks
1
5,743,920
04/21/2011 12:13:55
153,506
08/10/2009 03:46:42
81
1
facebook post friends wall
i have two accounts for example,a@yahoo.com and b@yahoo.com and sign up to facebook but two accounts are not friends themselves. i logged in as a@yahoo.com in facebook and like to wall/newsfeed post to b`s account only. [we are not friends] is it possible? by PHP SDK give me api example and extended permission if needed
facebook
post
wall
friends
null
04/21/2011 13:39:24
off topic
facebook post friends wall === i have two accounts for example,a@yahoo.com and b@yahoo.com and sign up to facebook but two accounts are not friends themselves. i logged in as a@yahoo.com in facebook and like to wall/newsfeed post to b`s account only. [we are not friends] is it possible? by PHP SDK give me api example and extended permission if needed
2
8,732,087
01/04/2012 18:38:52
1,028,777
11/03/2011 23:27:08
1
0
Enterprise Library Books/Resources
I am trying to dig into Enterprise Library,what are the best books/resoruces for Microsoft EnterPrise Library?
enterprise-library
null
null
null
null
01/05/2012 03:27:16
not constructive
Enterprise Library Books/Resources === I am trying to dig into Enterprise Library,what are the best books/resoruces for Microsoft EnterPrise Library?
4
11,068,901
06/17/2012 04:23:04
1,272,323
03/15/2012 18:22:40
3
0
Resque vs. Sidekiq
I'm working on a project with a friend where we've been using Resque for processing various commands from data input inside our rails application on a minute to minute basis. We've been messing around with the idea of using Sidekiq because it is multi-threaded and won't be a memory hog and won't need to boot a ruby env for each worker. I'm hoping to gather some thoughts and opinions from people that use Resque and Sidekiq in real time and explain the differences. Thanks.
ruby-on-rails
ruby
resque
null
null
06/18/2012 03:47:56
not constructive
Resque vs. Sidekiq === I'm working on a project with a friend where we've been using Resque for processing various commands from data input inside our rails application on a minute to minute basis. We've been messing around with the idea of using Sidekiq because it is multi-threaded and won't be a memory hog and won't need to boot a ruby env for each worker. I'm hoping to gather some thoughts and opinions from people that use Resque and Sidekiq in real time and explain the differences. Thanks.
4
4,067,665
11/01/2010 09:09:54
493,371
11/01/2010 09:09:54
1
0
Keep the command's position
I have an app in C# Form Application. It keeps the command's position in 64bit OS and 32bit OS, but when I replace it to server 2008 64bit all the commands move. Do you have idea? Thanks, Rache
c#
null
null
null
null
11/01/2010 09:17:56
not a real question
Keep the command's position === I have an app in C# Form Application. It keeps the command's position in 64bit OS and 32bit OS, but when I replace it to server 2008 64bit all the commands move. Do you have idea? Thanks, Rache
1
1,664,799
11/03/2009 02:05:45
88,847
04/08/2009 22:32:05
1,084
43
Calculating distance between two points using pythagorean theorem
I'd like to create a function that calculates the distance between two pairs of lat/longs using the pythag theorem instead of the haversine great-circle formula. Since this will be over relative short distances (3km), I think this version that assumes a flat earth should be OK. How can I do this? I asked the internet and didn't come up with anything useful. :) Thanks. Tom
math
algorithm
null
null
null
11/03/2009 03:39:16
off topic
Calculating distance between two points using pythagorean theorem === I'd like to create a function that calculates the distance between two pairs of lat/longs using the pythag theorem instead of the haversine great-circle formula. Since this will be over relative short distances (3km), I think this version that assumes a flat earth should be OK. How can I do this? I asked the internet and didn't come up with anything useful. :) Thanks. Tom
2
842
08/03/2008 21:37:13
40
08/01/2008 12:48:12
139
22
Best way to implement unit testing in PHP
I'd really like to start implementing Unit Testing in my projects. I don't know how viable this is to do in PHP. If anyone has done this, how was it implemented? Did it increase productivity?
php
unit-testing
null
null
null
06/19/2012 17:52:00
not constructive
Best way to implement unit testing in PHP === I'd really like to start implementing Unit Testing in my projects. I don't know how viable this is to do in PHP. If anyone has done this, how was it implemented? Did it increase productivity?
4
2,272,764
02/16/2010 12:18:23
274,343
02/16/2010 12:18:23
1
0
Android Applications
I am a student and would like to develop softwares for Android Phones. Please suggest me where to start. I have alwayzs programmed in C++, Matlab, Javascript. I do not have so much experience in programming Java. Appreciate your support and help. Thanks Kiran
android
mobile
books
null
null
12/13/2011 12:10:12
not constructive
Android Applications === I am a student and would like to develop softwares for Android Phones. Please suggest me where to start. I have alwayzs programmed in C++, Matlab, Javascript. I do not have so much experience in programming Java. Appreciate your support and help. Thanks Kiran
4
11,101,864
06/19/2012 13:21:45
594,781
01/29/2011 07:26:23
113
8
How can I add a TextView into an ImageView in GridView Layout?
I need a GridView, but in each grid, there will be an ImageView and TextView over/inside it. It will be like an item image in each grid, and name of the item on the image. I am tring: public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some // attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(300, 300)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setPadding(0, 0, 0, 0); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); TextView nameView = new TextView(mContext); nameView.setText("Name"); nameView.setTextSize(20); parent.addView(nameView); return imageView; } in my grid view adapter. But I cannot add it here. Also I tried to add it in ImageView but since it is not a ViewGroup, I couldn't achieve.
android
android-gridview
null
null
null
null
open
How can I add a TextView into an ImageView in GridView Layout? === I need a GridView, but in each grid, there will be an ImageView and TextView over/inside it. It will be like an item image in each grid, and name of the item on the image. I am tring: public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some // attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(300, 300)); imageView.setScaleType(ImageView.ScaleType.FIT_XY); imageView.setPadding(0, 0, 0, 0); } else { imageView = (ImageView) convertView; } imageView.setImageResource(mThumbIds[position]); TextView nameView = new TextView(mContext); nameView.setText("Name"); nameView.setTextSize(20); parent.addView(nameView); return imageView; } in my grid view adapter. But I cannot add it here. Also I tried to add it in ImageView but since it is not a ViewGroup, I couldn't achieve.
0
11,548,999
07/18/2012 19:38:15
1,433,709
06/03/2012 15:43:31
5
0
Can ultrabook with intel i processors run OS X Mountain Lion in Virtual Machine
I like to know if I can do that with an ultrabook to run a virtual machine of OS X Mountain Lion. Please let me know which models are proven it can do that so I can develop some iOS apps. Thanks.
windows
osx
virtualization
laptop
null
07/19/2012 01:48:02
off topic
Can ultrabook with intel i processors run OS X Mountain Lion in Virtual Machine === I like to know if I can do that with an ultrabook to run a virtual machine of OS X Mountain Lion. Please let me know which models are proven it can do that so I can develop some iOS apps. Thanks.
2
4,956,608
02/10/2011 11:39:09
577,304
01/16/2011 06:03:01
63
0
Basic Java Fileserver
I am trying to create a very barebones fileserver that does nothing more than download a zip file and exit, but I am running into problems. I have two main problems. The first is that when I test on localhost, it sort of works, in that it transfers the zip file, but when I try to open it, I get an error about it being corrupt. It may be something to do with the zip file format, or how I am transferring it. The second problem is that it fails whenever I use anything but localhost. I have tried a website redirect to my IP, and just putting in my ip address, and both fail, even when I turn off all firewalls and antivirus. Server code: import java.io.*; import java.net.*; public class FileServer { public static void main(String[] args) throws IOException { final int PORT_NUMBER = 44444; ServerSocket serverSock = null; PrintWriter out = null; BufferedInputStream bin = null; OutputStream os = null; Socket clientSock = null; File file; byte[] fileData; String filename = "file.zip"; while(true) { try { //Listen on port serverSock = new ServerSocket(PORT_NUMBER); //Get connection clientSock = serverSock.accept(); System.out.println("Connected client"); //Get output stream out = new PrintWriter(clientSock.getOutputStream(), true); out.println(filename); //Print filename file = new File(filename); //Get file fileData = new byte[(int)file.length()]; //Stores the file data bin = new BufferedInputStream(new FileInputStream(file)); out.println((int)file.length()); //Print filesize bin.read(fileData); //Read contents of file os = clientSock.getOutputStream(); os.write(fileData); //Write the file data os.flush(); } catch(SocketException e) { System.out.println("Client disconnected"); } catch(Exception e) { System.out.println(e.getMessage()); System.exit(1); } finally { //Close all connections System.out.println("Shutting down"); if(os != null) { os.close(); } if(bin != null) { bin.close(); } if(out != null) { out.close(); } if(clientSock != null) { clientSock.close(); } if(serverSock != null) { serverSock.close(); } } } } } Client code snippet, assume that all syntax is correct and everything else exists and works, because I probably mismatched some braces or something when I cut the snippet out. import java.io.*; import java.net.*; import javax.swing.JOptionPane; public static void main(String[] args) { final int PORT_NUMBER = 44444; final String HOSTNAME = "127.0.0.1"; String filename = "default.txt"; Socket sock = null; BufferedReader in = null; BufferedOutputStream bos = null; InputStream is = null; byte[] fileData; //Attempt to connect try { sock = new Socket(HOSTNAME, PORT_NUMBER); in = new BufferedReader(new InputStreamReader(sock.getInputStream())); is = sock.getInputStream(); } catch(UnknownHostException e) { JOptionPane.showMessageDialog(this, "Error: could not connect to host " + HOSTNAME + " on port number " + PORT_NUMBER); System.exit(1); } catch(ConnectException e) { JOptionPane.showMessageDialog(this, "Error: connection refused"); System.exit(1); } catch(Exception e) { JOptionPane.showMessageDialog(this, e); System.exit(1); } try { filename = in.readLine(); bos = new BufferedOutputStream(new FileOutputStream(filename)); fileData = new byte[Integer.decode(in.readLine())]; //Gets file size is.read(fileData); bos.write(fileData); bos.flush(); bos.close(); if(is != null) { is.close(); } if(in != null) { in.close(); } if(bos != null) { bos.close(); } if(sock != null) { sock.close(); } } catch(Exception e) { JOptionPane.showMessageDialog(this, e); System.exit(1); } JOptionPane.showMessageDialog(this, "Download complete"); } } } }
java
sockets
networking
fileserver
null
null
open
Basic Java Fileserver === I am trying to create a very barebones fileserver that does nothing more than download a zip file and exit, but I am running into problems. I have two main problems. The first is that when I test on localhost, it sort of works, in that it transfers the zip file, but when I try to open it, I get an error about it being corrupt. It may be something to do with the zip file format, or how I am transferring it. The second problem is that it fails whenever I use anything but localhost. I have tried a website redirect to my IP, and just putting in my ip address, and both fail, even when I turn off all firewalls and antivirus. Server code: import java.io.*; import java.net.*; public class FileServer { public static void main(String[] args) throws IOException { final int PORT_NUMBER = 44444; ServerSocket serverSock = null; PrintWriter out = null; BufferedInputStream bin = null; OutputStream os = null; Socket clientSock = null; File file; byte[] fileData; String filename = "file.zip"; while(true) { try { //Listen on port serverSock = new ServerSocket(PORT_NUMBER); //Get connection clientSock = serverSock.accept(); System.out.println("Connected client"); //Get output stream out = new PrintWriter(clientSock.getOutputStream(), true); out.println(filename); //Print filename file = new File(filename); //Get file fileData = new byte[(int)file.length()]; //Stores the file data bin = new BufferedInputStream(new FileInputStream(file)); out.println((int)file.length()); //Print filesize bin.read(fileData); //Read contents of file os = clientSock.getOutputStream(); os.write(fileData); //Write the file data os.flush(); } catch(SocketException e) { System.out.println("Client disconnected"); } catch(Exception e) { System.out.println(e.getMessage()); System.exit(1); } finally { //Close all connections System.out.println("Shutting down"); if(os != null) { os.close(); } if(bin != null) { bin.close(); } if(out != null) { out.close(); } if(clientSock != null) { clientSock.close(); } if(serverSock != null) { serverSock.close(); } } } } } Client code snippet, assume that all syntax is correct and everything else exists and works, because I probably mismatched some braces or something when I cut the snippet out. import java.io.*; import java.net.*; import javax.swing.JOptionPane; public static void main(String[] args) { final int PORT_NUMBER = 44444; final String HOSTNAME = "127.0.0.1"; String filename = "default.txt"; Socket sock = null; BufferedReader in = null; BufferedOutputStream bos = null; InputStream is = null; byte[] fileData; //Attempt to connect try { sock = new Socket(HOSTNAME, PORT_NUMBER); in = new BufferedReader(new InputStreamReader(sock.getInputStream())); is = sock.getInputStream(); } catch(UnknownHostException e) { JOptionPane.showMessageDialog(this, "Error: could not connect to host " + HOSTNAME + " on port number " + PORT_NUMBER); System.exit(1); } catch(ConnectException e) { JOptionPane.showMessageDialog(this, "Error: connection refused"); System.exit(1); } catch(Exception e) { JOptionPane.showMessageDialog(this, e); System.exit(1); } try { filename = in.readLine(); bos = new BufferedOutputStream(new FileOutputStream(filename)); fileData = new byte[Integer.decode(in.readLine())]; //Gets file size is.read(fileData); bos.write(fileData); bos.flush(); bos.close(); if(is != null) { is.close(); } if(in != null) { in.close(); } if(bos != null) { bos.close(); } if(sock != null) { sock.close(); } } catch(Exception e) { JOptionPane.showMessageDialog(this, e); System.exit(1); } JOptionPane.showMessageDialog(this, "Download complete"); } } } }
0
5,836,058
04/29/2011 18:45:50
217,649
11/24/2009 08:35:33
1,205
11
Using guards after assigning some variables first
I know I can do this... isZero :: Int -> Bool isZero x | x == 0 = True | otherwise = False But can I do something like this? isPalindrome :: Int -> Bool isPalindrome x let digitList = intToDigits x -- Decomposes the integer into -- digits, i.e. 37 -> [3, 7] | digitList == reverse digitList = True | otherwise = False This will result in compilation errors, but I'm sure that you know what I'm trying to do.
haskell
null
null
null
null
null
open
Using guards after assigning some variables first === I know I can do this... isZero :: Int -> Bool isZero x | x == 0 = True | otherwise = False But can I do something like this? isPalindrome :: Int -> Bool isPalindrome x let digitList = intToDigits x -- Decomposes the integer into -- digits, i.e. 37 -> [3, 7] | digitList == reverse digitList = True | otherwise = False This will result in compilation errors, but I'm sure that you know what I'm trying to do.
0
48,570
09/07/2008 16:42:07
5,056
09/07/2008 15:43:17
1
0
Something like a callback delegate function in php
I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically some resource-intensive calls that get queued, cached, and dispatched when the underlying system gets around to it. When the asynchronous call finally receives a response I would like a callback event to be raised. I am having some problems coming up with a mechanism to do callbacks in PHP. I have come up with a method that works for now but I am unhappy with it. Basically it involves passing a reference to the object and the name of the method on it that will serve as the callback (taking the response as an argument) and then use eval to call the method when need be. This is sub-optimal for a variety of reasons, is there a better way of doing this that anyone knows of?
php
oop
null
null
null
null
open
Something like a callback delegate function in php === I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically some resource-intensive calls that get queued, cached, and dispatched when the underlying system gets around to it. When the asynchronous call finally receives a response I would like a callback event to be raised. I am having some problems coming up with a mechanism to do callbacks in PHP. I have come up with a method that works for now but I am unhappy with it. Basically it involves passing a reference to the object and the name of the method on it that will serve as the callback (taking the response as an argument) and then use eval to call the method when need be. This is sub-optimal for a variety of reasons, is there a better way of doing this that anyone knows of?
0
4,737,089
01/19/2011 15:28:02
571,391
01/11/2011 14:36:52
6
0
Spreadsheet modelling
Offers you choice of 10-year, 20-year, and 30-year home mortgages all at the same interest rate. A spreadsheet model that will allow you to enter the amount of the mortgage and the annual interest rate. For each type of loan, the model should calculate: monthly payment, total amount paid back to the mortgage company, and total amount of interest paid. Any suggestions how to go about creating this spreadsheet? Mathematically am quite weak, am unsure of the formulas to use in excel.
spreadsheet
modeling
null
null
null
null
open
Spreadsheet modelling === Offers you choice of 10-year, 20-year, and 30-year home mortgages all at the same interest rate. A spreadsheet model that will allow you to enter the amount of the mortgage and the annual interest rate. For each type of loan, the model should calculate: monthly payment, total amount paid back to the mortgage company, and total amount of interest paid. Any suggestions how to go about creating this spreadsheet? Mathematically am quite weak, am unsure of the formulas to use in excel.
0
7,292,224
09/03/2011 09:14:11
463,898
10/01/2010 13:25:11
6
1
Name the header file of “malloc”?
Name the header file of “malloc”? Can anybody tell me the name of the Header fine used for Malloc(); in C or C++ ? Waiting for a positive feedback.!!!1 thanks in advance
c++
c
malloc
null
null
09/03/2011 15:04:06
not a real question
Name the header file of “malloc”? === Name the header file of “malloc”? Can anybody tell me the name of the Header fine used for Malloc(); in C or C++ ? Waiting for a positive feedback.!!!1 thanks in advance
1
6,648,873
07/11/2011 10:38:49
268,025
02/07/2010 05:31:25
166
16
Confused over memory mapping
I've recently started getting into low level stuff and looking into bootloaders and operating systems etc... As I understand it, for ARM processors at least, peripherals are initialized by the bootloader and then they are mapped into the physical memory space. From here, code can access the peripherals by simply writing values to the memory space mapped to the peripherals registers. Later if the chip has a MMU, it can be used to further remap into virtual memory spaces. Am I right? What I don't understand are (assuming what I have said above is correct): - How does the bootloader initialize the peripherals if they haven't been mapped to an address space yet? - With virtual memory mapping, there are tables that tell the MMU where to map what. But what determines where peripherals are mapped in physical memory?
memory
arm
low-level
null
null
null
open
Confused over memory mapping === I've recently started getting into low level stuff and looking into bootloaders and operating systems etc... As I understand it, for ARM processors at least, peripherals are initialized by the bootloader and then they are mapped into the physical memory space. From here, code can access the peripherals by simply writing values to the memory space mapped to the peripherals registers. Later if the chip has a MMU, it can be used to further remap into virtual memory spaces. Am I right? What I don't understand are (assuming what I have said above is correct): - How does the bootloader initialize the peripherals if they haven't been mapped to an address space yet? - With virtual memory mapping, there are tables that tell the MMU where to map what. But what determines where peripherals are mapped in physical memory?
0
9,060,268
01/30/2012 06:41:59
995,052
05/16/2010 15:34:17
716
87
Convert a large image to multipage pdf
I have a large image (~ 3600x900). I want to conver it to a pdf, multi-page pdf of A4 size. What can i use for this.? I want some opensource tools for this. I tried using Imagemagick, but it produces a single page pdf with a large page size. What else is an option? Thanks
pdf
ubuntu
jpeg
null
null
01/30/2012 21:44:24
off topic
Convert a large image to multipage pdf === I have a large image (~ 3600x900). I want to conver it to a pdf, multi-page pdf of A4 size. What can i use for this.? I want some opensource tools for this. I tried using Imagemagick, but it produces a single page pdf with a large page size. What else is an option? Thanks
2
781,179
04/23/2009 10:44:16
74,302
03/05/2009 16:01:49
470
25
SharePoint 2007 Log Viewer
SharePoint 2007 (WSS or MOSS) logs are not easy to read on a large screen, has anyone come across a log viewer that is able to: * Display SharePoint logs live and historical * Filter the events by various parameters * Cope with SharePoint's log rotation A subset of the above features would be acceptable, as would a range of tools either WinForms or WebParts.
sharepoint
sharepoint2007
logging
null
null
04/13/2012 15:10:16
not constructive
SharePoint 2007 Log Viewer === SharePoint 2007 (WSS or MOSS) logs are not easy to read on a large screen, has anyone come across a log viewer that is able to: * Display SharePoint logs live and historical * Filter the events by various parameters * Cope with SharePoint's log rotation A subset of the above features would be acceptable, as would a range of tools either WinForms or WebParts.
4
9,147,163
02/05/2012 05:32:51
1,176,321
01/29/2012 10:19:09
1
0
Java Swing Game TT
I am trying to have this quiz like game where user have 3 buttons to choose from. If they chose the wrong answer, an image bomb wil appear and immediately it wil automatically change to the next question and if they chose the corect one, it will also change to the next question. However, my problem here is that i do not know if i wrote my if...else statements correctly. When i run my program, it doesn't change to the next question and there is no bomb image appearing too. I tried many methods to solve this but i stil could'nt. I really need help. Here is my code and the if... else statements is from line 244 to 388. public class GamesQuestionPanel extends JPanel{ private static final long serialVersionUID = 1L; private JLabel jLabelQuestion = null; private JLabel jLabelScore = null; private JLabel jLabelHeart1 = null; private JLabel jLabelHeart2 = null; private JLabel jLabelHeart3 = null; private JButton jButtonAnswer1; private JButton jButtonAnswer2; private JButton jButtonAnswer3; private JLabel jLabelDescription1; private JLabel jLabelDescription2; private JLabel jLabelDescription3; private JButton jButtonAdd = null; private JFrame myFrame = null; private JLabel jLabelTimer = null; private Timer t; private TimerModel tm; private int qn_num = 0; private JLabel jLabelScore1 = null; private JLabel jLabelQn; private JButton jButtonEdit = null; private static int answer1; private int answer2; private int answer3; private int count=0; int Score = 0; public void Randomise() { ArrayList<Integer> random = new ArrayList<Integer>(); try{ DBController db = new DBController(); //passing data source name db.setUp("CFDatabase"); String g_question =" "; String dbQuery = "SELECT * FROM GameQuestion WHERE g_question ='" + g_question + "'"; //for retrieve SQL use readRequest method ResultSet rs = db.readRequest(dbQuery); if (rs.next()){ int g_questionNo =rs.getInt("g_questionNo"); random.add(g_questionNo); System.out.println(random.get(g_questionNo)); } } catch (Exception e) { e.printStackTrace(); } } /** * This is the default constructor */ public GamesQuestionPanel() { super(); initialize(); } public GamesQuestionPanel(JFrame f) { this(); myFrame = f; } public GamesQuestionPanel(JFrame f, String s ){ this(); myFrame = f; jLabelTimer.setText(s); } /** * This method initialises this * * @return void */ private void initialize() { jLabelQn = new JLabel(); jLabelQn.setBounds(new Rectangle(13, 96, 55, 50)); jLabelQn.setFont(new Font("Dialog", Font.BOLD, 18)); jLabelQn.setHorizontalAlignment(SwingConstants.CENTER); jLabelQn.setHorizontalTextPosition(SwingConstants.CENTER); jLabelQn.setText(""); jLabelScore1 = new JLabel(); jLabelScore1.setText(""); jLabelScore1.setSize(new Dimension(83, 29)); jLabelScore1.setLocation(new Point(119, 438)); jLabelTimer = new JLabel(); jLabelTimer.setBounds(new Rectangle(17, 23, 199, 53)); jLabelTimer.setText("00:01:00"); jLabelTimer.setHorizontalTextPosition(SwingConstants.CENTER); jLabelTimer.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/timerbg.png"))); jLabelTimer.setFont(new Font("Dialog", Font.BOLD, 18)); jLabelTimer.setHorizontalAlignment(SwingConstants.CENTER); t = new Timer(1000, new java.awt.event.ActionListener(){ public void actionPerformed(java.awt.event.ActionEvent e) { tm.timeTick(); jLabelTimer.setText(tm.getTime()); if(tm.isTimeUp()){ t.stop(); JOptionPane.showMessageDialog(null, "HighScore: " + Score, "GameOver", JOptionPane.INFORMATION_MESSAGE); int finalScore = Score ; String display = Integer.toString(finalScore); jLabelScore.setText(display); tm.setTime("00:10:00"); JPanel panel = new ProgrammesEventsPanelEnq(myFrame); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } } }); tm = new TimerModel(); tm.setTime("00:01:00"); t.start(); jLabelDescription3 = new JLabel(); jLabelDescription3.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription3.setLocation(new Point(483, 385)); jLabelDescription3.setSize(new Dimension(218, 33)); jLabelDescription3.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription3.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription3.setForeground(Color.black); jLabelDescription2 = new JLabel(); jLabelDescription2.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription2.setLocation(new Point(244, 386)); jLabelDescription2.setSize(new Dimension(226, 33)); jLabelDescription2.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription2.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription2.setForeground(Color.black); jLabelDescription1 = new JLabel(); jLabelDescription1.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription1.setBackground(new Color(238, 238, 238)); jLabelDescription1.setLocation(new Point(9, 386)); jLabelDescription1.setSize(new Dimension(225, 33)); jLabelDescription1.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription1.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription1.setForeground(Color.black); jLabelHeart3 = new JLabel(); jLabelHeart3.setBounds(new Rectangle(611, 61, 45, 39)); jLabelHeart3.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart3.setText(""); jLabelHeart2 = new JLabel(); jLabelHeart2.setBounds(new Rectangle(546, 61, 43, 40)); jLabelHeart2.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart2.setText(""); jLabelHeart1 = new JLabel(); jLabelHeart1.setBounds(new Rectangle(482, 60, 44, 41)); jLabelHeart1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart1.setText(""); jLabelScore = new JLabel(); jLabelScore.setBounds(new Rectangle(25, 438, 83, 29)); jLabelScore.setFont(new Font("Comic Sans MS", Font.BOLD, 20)); jLabelScore.setForeground(Color.black); jLabelScore.setText(" Score:"); jLabelQuestion = new JLabel(); jLabelQuestion.setBounds(new Rectangle(71, 95, 618, 52)); jLabelQuestion.setFont(new Font("Comic Sans MS", Font.BOLD, 20)); jLabelQuestion.setForeground(Color.black); this.setSize(712, 500); this.setLayout(null); this.setBackground(Color.white); this.add(jLabelQuestion, null); this.add(jLabelScore, null); this.add(jLabelHeart1, null); this.add(jLabelHeart2, null); this.add(jLabelHeart3, null); this.add(getJButtonAnswer1(), null); this.add(getJButtonAnswer2(), null); this.add(getJButtonAnswer3(), null); this.add(jLabelDescription1, null); this.add(jLabelDescription2, null); this.add(jLabelDescription3, null); this.add(getJButtonAdd(), null); this.add(jLabelTimer, null); this.add(jLabelScore1, null); this.add(jLabelQn, null); this.add(getJButtonEdit(), null); qn_num = 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); jLabelQn.setText("Q1."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } /** * This method initialises jButtonAnswer1 * * @return javax.swing.JButton */ private JButton getJButtonAnswer1() { if (jButtonAnswer1 == null) { jButtonAnswer1 = new JButton(); jButtonAnswer1.setBackground(Color.white); jButtonAnswer1.setSize(new Dimension(228, 214)); jButtonAnswer1.setLocation(new Point(5, 164)); jButtonAnswer1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer1.equals("answer1"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer1.isSelected()) && (g1.getG_correctAnswer() == answer1)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); //jButtonAnswer1.removeAll(); } else if((jButtonAnswer1.isSelected()) && (g1.getG_correctAnswer() != answer1)) { jButtonAnswer1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer1; } /** * This method initialises jButtonAnswer2 * * @return javax.swing.JButton */ private JButton getJButtonAnswer2() { if (jButtonAnswer2 == null) { jButtonAnswer2 = new JButton(); jButtonAnswer2.setBackground(Color.white); jButtonAnswer2.setSize(new Dimension(228, 214)); jButtonAnswer2.setLocation(new Point(240, 164)); jButtonAnswer2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer2.equals("answer2"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer2.isSelected()) && (g1.getG_correctAnswer() == answer2)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } else if((jButtonAnswer2.isSelected()) && (g1.getG_correctAnswer() != answer2)) { jButtonAnswer2.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer2; } /** * This method initialises jButtonAnswer3 * * @return javax.swing.JButton */ private JButton getJButtonAnswer3() { if (jButtonAnswer3 == null) { jButtonAnswer3 = new JButton(); jButtonAnswer3.setBackground(Color.white); jButtonAnswer3.setSize(new Dimension(228, 214)); jButtonAnswer3.setLocation(new Point(474, 163)); jButtonAnswer3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer3.equals("answer3"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer3.isSelected()) && (g1.getG_correctAnswer() == answer3)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } else if((jButtonAnswer3.isSelected()) && (g1.getG_correctAnswer() != answer3)) { jButtonAnswer1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer3; } /** * This method initializes jButtonEdit * * @return javax.swing.JButton */ private JButton getJButtonAdd() { if (jButtonAdd == null) { jButtonAdd = new JButton(); jButtonAdd.setBounds(new Rectangle(591, 9, 90, 39)); jButtonAdd.setFont(new Font("Dialog", Font.BOLD, 16)); jButtonAdd.setText("Add"); jButtonAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { t.stop(); JPanel panel = new GamesCreatePanel(myFrame); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); Object admin = null; if(getName() == admin) { jButtonAdd.setVisible(true); } else { jButtonAdd.setVisible(false); } } }); } return jButtonAdd; } /** * This method initializes jButtonEdit * * @return javax.swing.JButton */ private JButton getJButtonEdit() { if (jButtonEdit == null) { jButtonEdit = new JButton(); jButtonEdit.setPreferredSize(new Dimension(65, 31)); jButtonEdit.setSize(new Dimension(90, 39)); jButtonEdit.setText("Edit"); jButtonEdit.setFont(new Font("Dialog", Font.BOLD, 16)); jButtonEdit.setLocation(new Point(492, 9)); jButtonEdit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { t.stop(); String a = jLabelQuestion.getText(); String b = jButtonAnswer1.getText(); String c = jButtonAnswer2.getText(); String d = jButtonAnswer3.getText(); String f = jLabelDescription1.getText(); String g = jLabelDescription2.getText(); String h = jLabelDescription3.getText(); GameQuestion game = new GameQuestion(); game.setG_question(a); game.setG_image1(b); game.setG_image2(c); game.setG_image3(d); game.setG_imageDescription1(f); game.setG_imageDescription2(g); game.setG_imageDescription3(h); JPanel panel = new GamesEditPanel(myFrame, a, game); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } }); } return jButtonEdit; } }
swing
null
null
null
null
02/06/2012 02:05:19
too localized
Java Swing Game TT === I am trying to have this quiz like game where user have 3 buttons to choose from. If they chose the wrong answer, an image bomb wil appear and immediately it wil automatically change to the next question and if they chose the corect one, it will also change to the next question. However, my problem here is that i do not know if i wrote my if...else statements correctly. When i run my program, it doesn't change to the next question and there is no bomb image appearing too. I tried many methods to solve this but i stil could'nt. I really need help. Here is my code and the if... else statements is from line 244 to 388. public class GamesQuestionPanel extends JPanel{ private static final long serialVersionUID = 1L; private JLabel jLabelQuestion = null; private JLabel jLabelScore = null; private JLabel jLabelHeart1 = null; private JLabel jLabelHeart2 = null; private JLabel jLabelHeart3 = null; private JButton jButtonAnswer1; private JButton jButtonAnswer2; private JButton jButtonAnswer3; private JLabel jLabelDescription1; private JLabel jLabelDescription2; private JLabel jLabelDescription3; private JButton jButtonAdd = null; private JFrame myFrame = null; private JLabel jLabelTimer = null; private Timer t; private TimerModel tm; private int qn_num = 0; private JLabel jLabelScore1 = null; private JLabel jLabelQn; private JButton jButtonEdit = null; private static int answer1; private int answer2; private int answer3; private int count=0; int Score = 0; public void Randomise() { ArrayList<Integer> random = new ArrayList<Integer>(); try{ DBController db = new DBController(); //passing data source name db.setUp("CFDatabase"); String g_question =" "; String dbQuery = "SELECT * FROM GameQuestion WHERE g_question ='" + g_question + "'"; //for retrieve SQL use readRequest method ResultSet rs = db.readRequest(dbQuery); if (rs.next()){ int g_questionNo =rs.getInt("g_questionNo"); random.add(g_questionNo); System.out.println(random.get(g_questionNo)); } } catch (Exception e) { e.printStackTrace(); } } /** * This is the default constructor */ public GamesQuestionPanel() { super(); initialize(); } public GamesQuestionPanel(JFrame f) { this(); myFrame = f; } public GamesQuestionPanel(JFrame f, String s ){ this(); myFrame = f; jLabelTimer.setText(s); } /** * This method initialises this * * @return void */ private void initialize() { jLabelQn = new JLabel(); jLabelQn.setBounds(new Rectangle(13, 96, 55, 50)); jLabelQn.setFont(new Font("Dialog", Font.BOLD, 18)); jLabelQn.setHorizontalAlignment(SwingConstants.CENTER); jLabelQn.setHorizontalTextPosition(SwingConstants.CENTER); jLabelQn.setText(""); jLabelScore1 = new JLabel(); jLabelScore1.setText(""); jLabelScore1.setSize(new Dimension(83, 29)); jLabelScore1.setLocation(new Point(119, 438)); jLabelTimer = new JLabel(); jLabelTimer.setBounds(new Rectangle(17, 23, 199, 53)); jLabelTimer.setText("00:01:00"); jLabelTimer.setHorizontalTextPosition(SwingConstants.CENTER); jLabelTimer.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/timerbg.png"))); jLabelTimer.setFont(new Font("Dialog", Font.BOLD, 18)); jLabelTimer.setHorizontalAlignment(SwingConstants.CENTER); t = new Timer(1000, new java.awt.event.ActionListener(){ public void actionPerformed(java.awt.event.ActionEvent e) { tm.timeTick(); jLabelTimer.setText(tm.getTime()); if(tm.isTimeUp()){ t.stop(); JOptionPane.showMessageDialog(null, "HighScore: " + Score, "GameOver", JOptionPane.INFORMATION_MESSAGE); int finalScore = Score ; String display = Integer.toString(finalScore); jLabelScore.setText(display); tm.setTime("00:10:00"); JPanel panel = new ProgrammesEventsPanelEnq(myFrame); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } } }); tm = new TimerModel(); tm.setTime("00:01:00"); t.start(); jLabelDescription3 = new JLabel(); jLabelDescription3.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription3.setLocation(new Point(483, 385)); jLabelDescription3.setSize(new Dimension(218, 33)); jLabelDescription3.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription3.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription3.setForeground(Color.black); jLabelDescription2 = new JLabel(); jLabelDescription2.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription2.setLocation(new Point(244, 386)); jLabelDescription2.setSize(new Dimension(226, 33)); jLabelDescription2.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription2.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription2.setForeground(Color.black); jLabelDescription1 = new JLabel(); jLabelDescription1.setFont(new Font("Dialog", Font.BOLD, 20)); jLabelDescription1.setBackground(new Color(238, 238, 238)); jLabelDescription1.setLocation(new Point(9, 386)); jLabelDescription1.setSize(new Dimension(225, 33)); jLabelDescription1.setHorizontalAlignment(SwingConstants.CENTER); jLabelDescription1.setHorizontalTextPosition(SwingConstants.CENTER); jLabelDescription1.setForeground(Color.black); jLabelHeart3 = new JLabel(); jLabelHeart3.setBounds(new Rectangle(611, 61, 45, 39)); jLabelHeart3.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart3.setText(""); jLabelHeart2 = new JLabel(); jLabelHeart2.setBounds(new Rectangle(546, 61, 43, 40)); jLabelHeart2.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart2.setText(""); jLabelHeart1 = new JLabel(); jLabelHeart1.setBounds(new Rectangle(482, 60, 44, 41)); jLabelHeart1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/heartshape.png"))); jLabelHeart1.setText(""); jLabelScore = new JLabel(); jLabelScore.setBounds(new Rectangle(25, 438, 83, 29)); jLabelScore.setFont(new Font("Comic Sans MS", Font.BOLD, 20)); jLabelScore.setForeground(Color.black); jLabelScore.setText(" Score:"); jLabelQuestion = new JLabel(); jLabelQuestion.setBounds(new Rectangle(71, 95, 618, 52)); jLabelQuestion.setFont(new Font("Comic Sans MS", Font.BOLD, 20)); jLabelQuestion.setForeground(Color.black); this.setSize(712, 500); this.setLayout(null); this.setBackground(Color.white); this.add(jLabelQuestion, null); this.add(jLabelScore, null); this.add(jLabelHeart1, null); this.add(jLabelHeart2, null); this.add(jLabelHeart3, null); this.add(getJButtonAnswer1(), null); this.add(getJButtonAnswer2(), null); this.add(getJButtonAnswer3(), null); this.add(jLabelDescription1, null); this.add(jLabelDescription2, null); this.add(jLabelDescription3, null); this.add(getJButtonAdd(), null); this.add(jLabelTimer, null); this.add(jLabelScore1, null); this.add(jLabelQn, null); this.add(getJButtonEdit(), null); qn_num = 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); jLabelQn.setText("Q1."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } /** * This method initialises jButtonAnswer1 * * @return javax.swing.JButton */ private JButton getJButtonAnswer1() { if (jButtonAnswer1 == null) { jButtonAnswer1 = new JButton(); jButtonAnswer1.setBackground(Color.white); jButtonAnswer1.setSize(new Dimension(228, 214)); jButtonAnswer1.setLocation(new Point(5, 164)); jButtonAnswer1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer1.equals("answer1"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer1.isSelected()) && (g1.getG_correctAnswer() == answer1)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); //jButtonAnswer1.removeAll(); } else if((jButtonAnswer1.isSelected()) && (g1.getG_correctAnswer() != answer1)) { jButtonAnswer1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer1; } /** * This method initialises jButtonAnswer2 * * @return javax.swing.JButton */ private JButton getJButtonAnswer2() { if (jButtonAnswer2 == null) { jButtonAnswer2 = new JButton(); jButtonAnswer2.setBackground(Color.white); jButtonAnswer2.setSize(new Dimension(228, 214)); jButtonAnswer2.setLocation(new Point(240, 164)); jButtonAnswer2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer2.equals("answer2"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer2.isSelected()) && (g1.getG_correctAnswer() == answer2)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } else if((jButtonAnswer2.isSelected()) && (g1.getG_correctAnswer() != answer2)) { jButtonAnswer2.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer2; } /** * This method initialises jButtonAnswer3 * * @return javax.swing.JButton */ private JButton getJButtonAnswer3() { if (jButtonAnswer3 == null) { jButtonAnswer3 = new JButton(); jButtonAnswer3.setBackground(Color.white); jButtonAnswer3.setSize(new Dimension(228, 214)); jButtonAnswer3.setLocation(new Point(474, 163)); jButtonAnswer3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { jButtonAnswer3.equals("answer3"); qn_num = qn_num + 1; GameQuestion g1 = new GameQuestion(qn_num); g1.retrieveGameQuestion(); if((jButtonAnswer3.isSelected()) && (g1.getG_correctAnswer() == answer3)) { jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } else if((jButtonAnswer3.isSelected()) && (g1.getG_correctAnswer() != answer3)) { jButtonAnswer1.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/explode.png"))); int delay = 100; try { Thread.sleep(delay); } catch (InterruptedException e1) { e1.printStackTrace(); } jLabelQn.setText("Q" + qn_num + "."); jLabelQuestion.setText(g1.getG_question()); jLabelDescription1.setText(g1.getG_imageDescription1()); jButtonAnswer1.setIcon(new ImageIcon(g1.getG_image1())); jButtonAnswer1.removeAll(); jLabelDescription2.setText(g1.getG_imageDescription2()); jLabelDescription3.setText(g1.getG_imageDescription3()); jButtonAnswer2.setIcon(new ImageIcon(g1.getG_image2())); jButtonAnswer3.setIcon(new ImageIcon(g1.getG_image3())); } } }); } return jButtonAnswer3; } /** * This method initializes jButtonEdit * * @return javax.swing.JButton */ private JButton getJButtonAdd() { if (jButtonAdd == null) { jButtonAdd = new JButton(); jButtonAdd.setBounds(new Rectangle(591, 9, 90, 39)); jButtonAdd.setFont(new Font("Dialog", Font.BOLD, 16)); jButtonAdd.setText("Add"); jButtonAdd.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { t.stop(); JPanel panel = new GamesCreatePanel(myFrame); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); Object admin = null; if(getName() == admin) { jButtonAdd.setVisible(true); } else { jButtonAdd.setVisible(false); } } }); } return jButtonAdd; } /** * This method initializes jButtonEdit * * @return javax.swing.JButton */ private JButton getJButtonEdit() { if (jButtonEdit == null) { jButtonEdit = new JButton(); jButtonEdit.setPreferredSize(new Dimension(65, 31)); jButtonEdit.setSize(new Dimension(90, 39)); jButtonEdit.setText("Edit"); jButtonEdit.setFont(new Font("Dialog", Font.BOLD, 16)); jButtonEdit.setLocation(new Point(492, 9)); jButtonEdit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { t.stop(); String a = jLabelQuestion.getText(); String b = jButtonAnswer1.getText(); String c = jButtonAnswer2.getText(); String d = jButtonAnswer3.getText(); String f = jLabelDescription1.getText(); String g = jLabelDescription2.getText(); String h = jLabelDescription3.getText(); GameQuestion game = new GameQuestion(); game.setG_question(a); game.setG_image1(b); game.setG_image2(c); game.setG_image3(d); game.setG_imageDescription1(f); game.setG_imageDescription2(g); game.setG_imageDescription3(h); JPanel panel = new GamesEditPanel(myFrame, a, game); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } }); } return jButtonEdit; } }
3
7,943,437
10/30/2011 05:17:32
577,061
01/15/2011 21:29:04
170
2
Guide book on game programming
Is there a such book on Game Programming that shows how to efficiently create code, how to organize, use threads properly, etc.? I won't mind of it uses *sighs* Windows and DirectX for examples (even though I am aiming for cross-platform capability). I can see how it works from their examples, and create my own way.
java
c++
cross-platform
null
null
10/30/2011 05:25:54
not constructive
Guide book on game programming === Is there a such book on Game Programming that shows how to efficiently create code, how to organize, use threads properly, etc.? I won't mind of it uses *sighs* Windows and DirectX for examples (even though I am aiming for cross-platform capability). I can see how it works from their examples, and create my own way.
4
3,902,253
10/10/2010 21:19:11
439,866
09/05/2010 02:22:58
41
3
What's the best abbreviation of this jQuery instruction?
$( "input[role=submit_action], button[role=submit_action], div[role=submit_action], span[role=submit_action], a[role=submit_action]").live( "click", function() { }); and this too: $( "input[role=submit_action], input[role=submit_require]").live( "click", function() { if ($(this).attr('role') == "submit_action") { // do this... } else { // do this... } }); For example an abbreviation could be: $("input[role=(submit_action|submit_require)]"
php
javascript
jquery
html
forms
null
open
What's the best abbreviation of this jQuery instruction? === $( "input[role=submit_action], button[role=submit_action], div[role=submit_action], span[role=submit_action], a[role=submit_action]").live( "click", function() { }); and this too: $( "input[role=submit_action], input[role=submit_require]").live( "click", function() { if ($(this).attr('role') == "submit_action") { // do this... } else { // do this... } }); For example an abbreviation could be: $("input[role=(submit_action|submit_require)]"
0
4,127,926
11/08/2010 20:47:53
233,286
12/16/2009 21:02:57
100
10
How to code a social network in shor period of time?
We need a social network with specific features (that most of the social network sites do not have; dormitory groups based on user's IP (no problems, they are known), gender specific groups (hidden), anonymous questions, department groups based student's department (there is acces for that information on the university's ssh)) within the campus. Thus, I'll start coding. I have that ability to make a social network but it will take me months. How I can finish the vital parts of that social network within few weeks? I mean, I'm not efficient, coz I'm not professional. What should I do? (I have no money, I'm Statistics student, I know PHP and database design). I think frameworks are for this purpose?
php
social-networking
null
null
null
11/08/2010 20:52:48
not a real question
How to code a social network in shor period of time? === We need a social network with specific features (that most of the social network sites do not have; dormitory groups based on user's IP (no problems, they are known), gender specific groups (hidden), anonymous questions, department groups based student's department (there is acces for that information on the university's ssh)) within the campus. Thus, I'll start coding. I have that ability to make a social network but it will take me months. How I can finish the vital parts of that social network within few weeks? I mean, I'm not efficient, coz I'm not professional. What should I do? (I have no money, I'm Statistics student, I know PHP and database design). I think frameworks are for this purpose?
1
7,488,070
09/20/2011 15:53:43
955,158
09/20/2011 15:53:43
1
0
Upload Picture to Facebook and make it to the Profile Picture
is there a was to upload a picture to facebook and make it to the profile pictures. i've been searching for hours now, but there is nothing i found on the internet thx&best
facebook
graph
upload
profile
picture
09/21/2011 01:53:40
not a real question
Upload Picture to Facebook and make it to the Profile Picture === is there a was to upload a picture to facebook and make it to the profile pictures. i've been searching for hours now, but there is nothing i found on the internet thx&best
1
11,217,169
06/26/2012 23:05:21
1,484,141
06/26/2012 22:47:02
1
0
Readig old V1.X MS Access file with MS Access 2010 installed
I'm new, so be gentle with me :) I've created some C# code to read the schema definition of an MS Access files. It works great on most versions of Access, but when I try to read an older version of Access (V1.X) I'm getting the following error:- This Property is not supported for external data sources or for databases created with a previous version of Microsoft Jet. Here's my code:- private DataTable ReadSchema(string strTable) { DataTable schemaTable = new DataTable(); try { OleDbConnection conn = new OleDbConnection("Provider= Microsoft.JET.OleDB.4.0;data source=R:\\CB Import\\CBS.MDB"); conn.Open(); OleDbCommand cmd = new OleDbCommand(strTable, conn); cmd.CommandType = CommandType.TableDirect; OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly); schemaTable = reader.GetSchemaTable(); reader.Close(); conn.Close(); DataColumn dcRec = new DataColumn("TableName", typeof(string)); dcRec.DefaultValue = strTable; schemaTable.Columns.Add(dcRec); schemaTable.Columns.Add("Type", typeof(string)); schemaTable.Columns.Add("Length", typeof(string)); foreach (DataRow r in schemaTable.Rows) { Console.WriteLine(r["ColumnName"].ToString() + " " + r["ColumnSize"].ToString() + " " + r["DataType"].ToString() + " " + r["NumericPrecision"].ToString() + " " + r["NumericScale"].ToString()); r["Type"] = r["DataType"]; r["Length"] = r["ColumnSize"]; } } catch (Exception e) { MessageBox.Show(e.Message); } return (schemaTable); } It bombs out on this line: OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly); I have Access 2010 installed on my machine and even if I try to open these old troublesome files in this version of Access I still get errors about opening old versions. This code all works fab apart from when I try to read an older version of Access. I can get around it by using Access 2007 (installed on another machine) and saving the database file as a 2007 version, but I'd like to be able to automate (code) this if possible? If there's another way of coding it, or something I'm messing up, please let me know. Any help will be greatfully received and recipricated with beer, chocolate, flowers or whatever floats your boat :) Thanks in advance.
ms-access
null
null
null
null
null
open
Readig old V1.X MS Access file with MS Access 2010 installed === I'm new, so be gentle with me :) I've created some C# code to read the schema definition of an MS Access files. It works great on most versions of Access, but when I try to read an older version of Access (V1.X) I'm getting the following error:- This Property is not supported for external data sources or for databases created with a previous version of Microsoft Jet. Here's my code:- private DataTable ReadSchema(string strTable) { DataTable schemaTable = new DataTable(); try { OleDbConnection conn = new OleDbConnection("Provider= Microsoft.JET.OleDB.4.0;data source=R:\\CB Import\\CBS.MDB"); conn.Open(); OleDbCommand cmd = new OleDbCommand(strTable, conn); cmd.CommandType = CommandType.TableDirect; OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly); schemaTable = reader.GetSchemaTable(); reader.Close(); conn.Close(); DataColumn dcRec = new DataColumn("TableName", typeof(string)); dcRec.DefaultValue = strTable; schemaTable.Columns.Add(dcRec); schemaTable.Columns.Add("Type", typeof(string)); schemaTable.Columns.Add("Length", typeof(string)); foreach (DataRow r in schemaTable.Rows) { Console.WriteLine(r["ColumnName"].ToString() + " " + r["ColumnSize"].ToString() + " " + r["DataType"].ToString() + " " + r["NumericPrecision"].ToString() + " " + r["NumericScale"].ToString()); r["Type"] = r["DataType"]; r["Length"] = r["ColumnSize"]; } } catch (Exception e) { MessageBox.Show(e.Message); } return (schemaTable); } It bombs out on this line: OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly); I have Access 2010 installed on my machine and even if I try to open these old troublesome files in this version of Access I still get errors about opening old versions. This code all works fab apart from when I try to read an older version of Access. I can get around it by using Access 2007 (installed on another machine) and saving the database file as a 2007 version, but I'd like to be able to automate (code) this if possible? If there's another way of coding it, or something I'm messing up, please let me know. Any help will be greatfully received and recipricated with beer, chocolate, flowers or whatever floats your boat :) Thanks in advance.
0
8,566,226
12/19/2011 19:13:31
1,043,828
11/13/2011 03:39:32
41
0
ASP.NET equivalent of the java code
Can anyone take time to convert this into ASP.NET?Please.. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String content = request.getParameter("content"); response.setHeader("Content-type", "text/calendar"); response.setHeader("Content-length", String.valueOf(content.length())); response.setHeader("Content-disposition", "attachment; filename=event.ics"); response.getOutputStream().write(content.getBytes()); }
java
null
null
null
null
01/20/2012 12:36:44
not a real question
ASP.NET equivalent of the java code === Can anyone take time to convert this into ASP.NET?Please.. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String content = request.getParameter("content"); response.setHeader("Content-type", "text/calendar"); response.setHeader("Content-length", String.valueOf(content.length())); response.setHeader("Content-disposition", "attachment; filename=event.ics"); response.getOutputStream().write(content.getBytes()); }
1
7,362,967
09/09/2011 14:11:31
936,927
09/09/2011 14:11:31
1
0
FB comments stopped working on my site
I noticed FB comments no longer appeared on my blog. I went to FB and saw they have new codes, so I replaced the old code.I tried both FBML and HTML5, but neither are working. Nothing shows up where the comments box was yesterday.
html5
comments
fbml
null
null
09/09/2011 15:07:53
not a real question
FB comments stopped working on my site === I noticed FB comments no longer appeared on my blog. I went to FB and saw they have new codes, so I replaced the old code.I tried both FBML and HTML5, but neither are working. Nothing shows up where the comments box was yesterday.
1
8,949,132
01/20/2012 23:23:43
984,867
10/08/2011 00:08:36
11
0
complex if statement
How would I write a complex if statement where the following criteria need to be met for a "true" alert. price < 25 and hardcover price < 15 and softcover pubYear is after 2000 the book is a NewYorkTImes Bestseller and the series title is "Packers Football"
javascript
if-statement
null
null
null
01/21/2012 14:19:07
not a real question
complex if statement === How would I write a complex if statement where the following criteria need to be met for a "true" alert. price < 25 and hardcover price < 15 and softcover pubYear is after 2000 the book is a NewYorkTImes Bestseller and the series title is "Packers Football"
1
7,156,309
08/23/2011 04:33:54
412,982
08/06/2010 11:41:00
517
17
How to Identify that Text is English in Text, Doc ,PDF Files?
Text is English language in doc, Text, PDF, xls files identify using C# please give me a sample code.
c#
null
null
null
null
08/23/2011 05:17:21
not a real question
How to Identify that Text is English in Text, Doc ,PDF Files? === Text is English language in doc, Text, PDF, xls files identify using C# please give me a sample code.
1
2,417,837
03/10/2010 14:57:32
281,118
01/22/2010 12:22:05
26
2
[Adaptive Interfaces] Why aren't they around that much?
I'm currently doing a research on *adaptive interfaces* and i'd like to hear some responses from fellow Web Developers on this subject. We used to have *static interfaces* back in the day, where you couldnt change a thing and you had to learn the system the way it was build. After that came *adaptable interfaces*, where you could change some preferences to the way you wanted. Think of font-size, colors and layout. These are the interfaces we see mostly today. The next step in this area of research and development on interfaces is supposed to be *adaptive interfaces*. **An adaptive interface is an interactive softare system that improves its ability to interact with a user based on partial experience with that user.** Example *adaptive interface* (linkedIn): ![alt text][1] [1]: http://paulhuisman-online.nl/images/linkedIn1.jpg You see that the interface is making suggestions about your user profile. It tells you to complete some forms of your profile page in order to be found easier by fellow users. An *adaptive interface* is the next logical step after *adaptable interfaces*, and research in this area has been going on for more then 20 years. However, these days i can't see alot of adaptive interfaces coming back in web applications. Which leads me to a few questions: - Why do you think that *adaptive interfaces* are still rare while the need for user personalisation in interfaces keeps growing? - Which problems do you see in the concept of *adaptive interfaces*? - Do you know any good examples of *adaptive interfaces* in webpages that i haven't seen yet? Thanks in advance.
adaptive
interface
interaction
usability
null
03/12/2010 08:04:33
not constructive
[Adaptive Interfaces] Why aren't they around that much? === I'm currently doing a research on *adaptive interfaces* and i'd like to hear some responses from fellow Web Developers on this subject. We used to have *static interfaces* back in the day, where you couldnt change a thing and you had to learn the system the way it was build. After that came *adaptable interfaces*, where you could change some preferences to the way you wanted. Think of font-size, colors and layout. These are the interfaces we see mostly today. The next step in this area of research and development on interfaces is supposed to be *adaptive interfaces*. **An adaptive interface is an interactive softare system that improves its ability to interact with a user based on partial experience with that user.** Example *adaptive interface* (linkedIn): ![alt text][1] [1]: http://paulhuisman-online.nl/images/linkedIn1.jpg You see that the interface is making suggestions about your user profile. It tells you to complete some forms of your profile page in order to be found easier by fellow users. An *adaptive interface* is the next logical step after *adaptable interfaces*, and research in this area has been going on for more then 20 years. However, these days i can't see alot of adaptive interfaces coming back in web applications. Which leads me to a few questions: - Why do you think that *adaptive interfaces* are still rare while the need for user personalisation in interfaces keeps growing? - Which problems do you see in the concept of *adaptive interfaces*? - Do you know any good examples of *adaptive interfaces* in webpages that i haven't seen yet? Thanks in advance.
4
9,488,435
02/28/2012 19:32:32
1,238,672
02/28/2012 19:24:51
1
0
Cloning a normal drive onto an encrypted drive
I have a Seagate hardware-encrypted drive for my laptop and would like to clone my current drive onto it. In doing so, will I disrupt or the damage the drive? I am not sure at what level the encryption magic occurs. If I overwrite every sector will that brick the drive?
hardware
null
null
null
null
02/28/2012 19:41:56
off topic
Cloning a normal drive onto an encrypted drive === I have a Seagate hardware-encrypted drive for my laptop and would like to clone my current drive onto it. In doing so, will I disrupt or the damage the drive? I am not sure at what level the encryption magic occurs. If I overwrite every sector will that brick the drive?
2
3,932,817
10/14/2010 11:56:24
443,966
09/10/2010 02:07:29
68
5
how to remote control windows from linux without close the session.
I am coding on my laptop, and watching online video on an windows pc. the suck video site can't turn to fullscreen mode back after goto next video, so I want to use laptop(linux) to remote control the windows. But... when I using rdesktop login to the windows, the current session was logout, ... So , what can I do, is there any client could do this, but I hate kde/gnome/xfce dependencies, I am use awesome wm, and without any above wm and library installed.
windows
linux
x11
rdp
null
12/23/2011 02:05:28
off topic
how to remote control windows from linux without close the session. === I am coding on my laptop, and watching online video on an windows pc. the suck video site can't turn to fullscreen mode back after goto next video, so I want to use laptop(linux) to remote control the windows. But... when I using rdesktop login to the windows, the current session was logout, ... So , what can I do, is there any client could do this, but I hate kde/gnome/xfce dependencies, I am use awesome wm, and without any above wm and library installed.
2
6,582,526
07/05/2011 12:19:22
245,886
01/07/2010 20:12:05
193
9
MySql connector with Entity Framework: Comparing Char(36) GUIDs in a LINQ Where clause
I think the title pretty much nails it. I am using a Char(36) in a MySql table which automatically gets recognized as a GUID when using the Entity Framework. Inserting the GUID is no problem, but trying to compare it in a WHERE clause is a nightmare. What I've tried: First of all I've tried a `WHERE element.GUID == GuidToCompare`. This resulted in `LINQ to Entities does not recognize the method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' method, and this method cannot be translated into a store expression.` Then I tried to just convert the value to String, like so: `WHERE element.GUID.ToString() == GuidtoCompare.ToString()` This resulted in this error: `LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.` So either way, I just can't compare them. I am ready to just not use GUIDs if they don't work out.
c#
mysql
entity-framework
linq-to-entities
mysql-connector
null
open
MySql connector with Entity Framework: Comparing Char(36) GUIDs in a LINQ Where clause === I think the title pretty much nails it. I am using a Char(36) in a MySql table which automatically gets recognized as a GUID when using the Entity Framework. Inserting the GUID is no problem, but trying to compare it in a WHERE clause is a nightmare. What I've tried: First of all I've tried a `WHERE element.GUID == GuidToCompare`. This resulted in `LINQ to Entities does not recognize the method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' method, and this method cannot be translated into a store expression.` Then I tried to just convert the value to String, like so: `WHERE element.GUID.ToString() == GuidtoCompare.ToString()` This resulted in this error: `LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.` So either way, I just can't compare them. I am ready to just not use GUIDs if they don't work out.
0
4,954,076
02/10/2011 06:32:21
399,268
02/20/2010 16:23:30
1,745
74
Differences between MySQL and Oracle DB
What are the differences - features and performance - between MySQL and Oracle DB? I would like to be able to make and educated choice between the two given a situation.
mysql
oracle
comparison
features
performance
02/10/2011 08:41:29
not constructive
Differences between MySQL and Oracle DB === What are the differences - features and performance - between MySQL and Oracle DB? I would like to be able to make and educated choice between the two given a situation.
4
11,108,804
06/19/2012 20:23:05
1,459,575
06/15/2012 19:02:46
1
0
How to run "hello" example in Asana API documenation
How to run "hello" example in Asana API documenation? C:\Users\Desktop\ruby helloTask.rb C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 e rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL ::SSL::SSLError) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start' from helloTask.rb:38:in `<main>' I tried to run the example mentioned in the Asana API documenation, errors are on the above. Would someone please tell me where I went wrong? Thanks a lot!!!
asana
null
null
null
null
null
open
How to run "hello" example in Asana API documenation === How to run "hello" example in Asana API documenation? C:\Users\Desktop\ruby helloTask.rb C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 e rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL ::SSL::SSLError) from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `block in connect' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout' from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:799:in `connect' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start' from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start' from helloTask.rb:38:in `<main>' I tried to run the example mentioned in the Asana API documenation, errors are on the above. Would someone please tell me where I went wrong? Thanks a lot!!!
0
7,860,511
10/22/2011 15:18:35
471,681
10/10/2010 18:48:06
748
65
emulator-arm.exe no longer working
This is the message I receive always (100%) if I try to start the emulator with an existing snapshot. The system is Windows 7 32bit, ADT14 and SDK14. I need to start every emulator session with "wiped user data". Whenever I try to reload the emulator with a snapshot Windows prints this message (in German: emulator-arm.exe funktioniert nicht mehr) and the only option available is to close the application (emulator-arm.exe). I can reproduce that at will. Even with fresh installs of Eclipse (Helios and Indigo), SDK, ADT. I could see that with all versions in the last year. I can reproduce that on three different machines in my house (all Windows 7 32bit) at will. There's not much software on my machines. On one machine is the Android Development environment only. All three computers are no gaming machines and don't have much power. I mean, just to use the Eclipse editor, it must be enough. All applications (Eclipse, etc.) are not configured to special needs. I always use the Android development as is out of the box. Any help is highly appreciated. It's not funny to always go for lunch or coffee just to switch from one emulator to the next one - lasts for approx. 10 minutes here.
android
emulator
snapshot
null
null
null
open
emulator-arm.exe no longer working === This is the message I receive always (100%) if I try to start the emulator with an existing snapshot. The system is Windows 7 32bit, ADT14 and SDK14. I need to start every emulator session with "wiped user data". Whenever I try to reload the emulator with a snapshot Windows prints this message (in German: emulator-arm.exe funktioniert nicht mehr) and the only option available is to close the application (emulator-arm.exe). I can reproduce that at will. Even with fresh installs of Eclipse (Helios and Indigo), SDK, ADT. I could see that with all versions in the last year. I can reproduce that on three different machines in my house (all Windows 7 32bit) at will. There's not much software on my machines. On one machine is the Android Development environment only. All three computers are no gaming machines and don't have much power. I mean, just to use the Eclipse editor, it must be enough. All applications (Eclipse, etc.) are not configured to special needs. I always use the Android development as is out of the box. Any help is highly appreciated. It's not funny to always go for lunch or coffee just to switch from one emulator to the next one - lasts for approx. 10 minutes here.
0
6,269,198
06/07/2011 17:27:25
694,080
04/06/2011 03:23:13
48
8
Core Data sort by Date ascending then by nil
I think I already know the answer, but I'm going to ask the question anyway... I have a table where I'm sorting rows by dueDate ascending. Some records have due dates, some don't (nil). I prefer to show all the rows with due dates before those that don't. Example: Jan 1, 2011; Feb 1, 2011; June 1, 2011; nil; nil; nil However, the default sorting puts the nil values first, as expected: nil; nil; nil; Jan 1, 2011; Feb 1, 2011; June 1, 2011 I tried using an NSComparisonResult block in a sort descriptor and besides having some difficulty actually getting it to fire (probably due to some logic elsewhere - I am toggling different sorts in the same view), I can't get it to actually compare the null key values to the ones with dates. I think this makes sense, as the managed objects whose @"dueDate" keys are null are more or less skipped over by the comparison for those where there are actually objects to compare. At this point, I believe my only option is to hack through this and make the "no due date" records set to have a date far into the future, eg Jan 1, 3000. Anywhere that 1/1/3000 date might be shown, hide the value as if it were actually null. Does this sound right and reasonable? Thanks!
ios
sorting
core-data
null
null
null
open
Core Data sort by Date ascending then by nil === I think I already know the answer, but I'm going to ask the question anyway... I have a table where I'm sorting rows by dueDate ascending. Some records have due dates, some don't (nil). I prefer to show all the rows with due dates before those that don't. Example: Jan 1, 2011; Feb 1, 2011; June 1, 2011; nil; nil; nil However, the default sorting puts the nil values first, as expected: nil; nil; nil; Jan 1, 2011; Feb 1, 2011; June 1, 2011 I tried using an NSComparisonResult block in a sort descriptor and besides having some difficulty actually getting it to fire (probably due to some logic elsewhere - I am toggling different sorts in the same view), I can't get it to actually compare the null key values to the ones with dates. I think this makes sense, as the managed objects whose @"dueDate" keys are null are more or less skipped over by the comparison for those where there are actually objects to compare. At this point, I believe my only option is to hack through this and make the "no due date" records set to have a date far into the future, eg Jan 1, 3000. Anywhere that 1/1/3000 date might be shown, hide the value as if it were actually null. Does this sound right and reasonable? Thanks!
0
2,077,539
01/16/2010 14:05:29
152,467
08/07/2009 13:01:28
46
3
How to align two form submits
I have a page with two submit buttons at the bottom of the page. One for the submit of the page that posts to an action and another to cancel that posts to a different action. For whatever reason IE has a problem with placing these two buttons side by side. Firefox has no issue. Here is my script: <div class="button_row"> using (Html.BeginForm("Edit", "Design")) { %> <div class="button_cell_left"> <input type="submit" value="Update"> </div> <% } %> <% Html.EndForm(); %> using (Html.BeginForm("Review", "Design")) { %> <div class="button_cell_right"> <input type="submit" value="Cancel"/> </div> <% } %> <% Html.EndForm(); %> </div> Here is the css for those classes: .button_row { float:left; width: 100%; } .button_cell_left {float:left; width: 20%; } .button_cell_right {float:left; width: 20%; } The 20% width is plenty room wise for those buttons. Like i said in ie they won't stay on the same line but in firefox they will. My question is why given my code? Thanks in advance, Billy
css
formatting
forms
null
null
null
open
How to align two form submits === I have a page with two submit buttons at the bottom of the page. One for the submit of the page that posts to an action and another to cancel that posts to a different action. For whatever reason IE has a problem with placing these two buttons side by side. Firefox has no issue. Here is my script: <div class="button_row"> using (Html.BeginForm("Edit", "Design")) { %> <div class="button_cell_left"> <input type="submit" value="Update"> </div> <% } %> <% Html.EndForm(); %> using (Html.BeginForm("Review", "Design")) { %> <div class="button_cell_right"> <input type="submit" value="Cancel"/> </div> <% } %> <% Html.EndForm(); %> </div> Here is the css for those classes: .button_row { float:left; width: 100%; } .button_cell_left {float:left; width: 20%; } .button_cell_right {float:left; width: 20%; } The 20% width is plenty room wise for those buttons. Like i said in ie they won't stay on the same line but in firefox they will. My question is why given my code? Thanks in advance, Billy
0
8,388,473
12/05/2011 16:29:36
1,081,904
12/05/2011 16:20:47
1
0
Can you use 2x SE to substitute for a t test
A colleague of mine suggested that instead of doing t tests you could simply look at the overlap between 2x SE around a mean.....It seemed to be logical, but only for normal data, but presumably it underestimates any significance at the sample level, as (1.96 SE) constitutes a 95% CI? Something is niggling at me that it can’t be a fool proof way of eyeballing means and SE's to get a significance........Am I missing something?
statistics
null
null
null
null
02/08/2012 14:35:46
off topic
Can you use 2x SE to substitute for a t test === A colleague of mine suggested that instead of doing t tests you could simply look at the overlap between 2x SE around a mean.....It seemed to be logical, but only for normal data, but presumably it underestimates any significance at the sample level, as (1.96 SE) constitutes a 95% CI? Something is niggling at me that it can’t be a fool proof way of eyeballing means and SE's to get a significance........Am I missing something?
2
11,403,382
07/09/2012 21:23:39
207,524
11/10/2009 05:05:37
2,631
13
Calling [super scrollViewDidScroll]; on subclass of UIWebView crashes
I'm not sure how this works. I was following this post: http://stackoverflow.com/questions/8857655/check-if-uiwebview-scrolls-to-the-bottom I want to know when the scrollViewScrolls to do some custom things. I subclasses UIWebView. All I did was this so far: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [super scrollViewDidScroll:scrollView]; NSLog(@"%s", __FUNCTION__); } It crashes on the `[super scrollViewDidScroll:scrollView]` method. When I delete that line, it works fine. I don't want to take away the superclass' implementation of this method. I just wanted to add some custom functionality to it (place a toolbar above the webview like the Facebook app). Is there a reason why this is crashing? Thanks.
iphone
null
null
null
null
null
open
Calling [super scrollViewDidScroll]; on subclass of UIWebView crashes === I'm not sure how this works. I was following this post: http://stackoverflow.com/questions/8857655/check-if-uiwebview-scrolls-to-the-bottom I want to know when the scrollViewScrolls to do some custom things. I subclasses UIWebView. All I did was this so far: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [super scrollViewDidScroll:scrollView]; NSLog(@"%s", __FUNCTION__); } It crashes on the `[super scrollViewDidScroll:scrollView]` method. When I delete that line, it works fine. I don't want to take away the superclass' implementation of this method. I just wanted to add some custom functionality to it (place a toolbar above the webview like the Facebook app). Is there a reason why this is crashing? Thanks.
0
1,785,488
11/23/2009 19:44:25
216,552
11/22/2009 17:45:14
1
0
Apache virtual host configuration on debian
Im new to apache configuration and would be really glad if someone helped me with the following.Im running apache on a virtual private server, running the debian operating system. In /etc/apache2/sites-available, i have two virtual hosts defined,site1.com.conf and site2.com.conf. In /etc/apache2/sites-enabled,i have a symlink to site1.com.conf . The virtual hosts are defined as follows: **site1.com.conf** <VirtualHost *:80> ServerAdmin admin@site1.com ServerName site1.com ServerAlias www.site1.com site1.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www/site1 <Directory /var/www/site1> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> LogLevel warn ErrorLog /var/log/apache2/site1_error.log CustomLog /var/log/apache2/site1_access.log combined ServerSignature Off </VirtualHost> **site2.com.conf** <VirtualHost *:80> ServerAdmin hostmaster@wharfage ServerName site2.com ServerAlias www.site2.com site2.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www LogLevel debug ErrorLog /var/log/apache2/site2_error.log CustomLog /var/log/apache2/site2_access.log combined ServerSignature Off <Location /> Options -Indexes </Location> Alias /favicon.ico /srv/site2/static/favicon.ico Alias /static /srv/site2/static # Alias /media /usr/local/lib/python2.5/site-packages/django/contrib/admin/media Alias /admin/media /var/lib/python-support/python2.5/django/contrib/admin/media WSGIScriptAlias / /srv/site2/wsgi/django.wsgi WSGIDaemonProcess site2 user=samj group=samj processes=1 threads=10 WSGIProcessGroup site2 </VirtualHost> However, a strange thing is happening. Im able to navigate to www.site1.com as expected. It loads the content in /var/www/site which i have defined as the DocumentRoot in site1.com.conf. But if i navigate to www.site2.com,instead of loading index.html which is present in /var/www, which is defined as the DocumentRoot for site2.com.conf, as shown above, it loads the content in /var/www/site1. The url in the address bar remains www.site2.com. So, i have the following two questions : **Q.1)** Why is www.site2.com showing the contents of /var/www/site1 when the DocumentRoot for it has been defined as /var/www ? **Q.2)** Since, site2.com.conf does not have a symlink in sites-enabled, how come im able to navigate to www.site2.com ? Sorry, if my questions sound noobish, but ill be really happy if someone could explain this. Thank You.
apache
debian
unix
virtualhost
null
11/23/2009 23:22:31
off topic
Apache virtual host configuration on debian === Im new to apache configuration and would be really glad if someone helped me with the following.Im running apache on a virtual private server, running the debian operating system. In /etc/apache2/sites-available, i have two virtual hosts defined,site1.com.conf and site2.com.conf. In /etc/apache2/sites-enabled,i have a symlink to site1.com.conf . The virtual hosts are defined as follows: **site1.com.conf** <VirtualHost *:80> ServerAdmin admin@site1.com ServerName site1.com ServerAlias www.site1.com site1.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www/site1 <Directory /var/www/site1> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> LogLevel warn ErrorLog /var/log/apache2/site1_error.log CustomLog /var/log/apache2/site1_access.log combined ServerSignature Off </VirtualHost> **site2.com.conf** <VirtualHost *:80> ServerAdmin hostmaster@wharfage ServerName site2.com ServerAlias www.site2.com site2.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www LogLevel debug ErrorLog /var/log/apache2/site2_error.log CustomLog /var/log/apache2/site2_access.log combined ServerSignature Off <Location /> Options -Indexes </Location> Alias /favicon.ico /srv/site2/static/favicon.ico Alias /static /srv/site2/static # Alias /media /usr/local/lib/python2.5/site-packages/django/contrib/admin/media Alias /admin/media /var/lib/python-support/python2.5/django/contrib/admin/media WSGIScriptAlias / /srv/site2/wsgi/django.wsgi WSGIDaemonProcess site2 user=samj group=samj processes=1 threads=10 WSGIProcessGroup site2 </VirtualHost> However, a strange thing is happening. Im able to navigate to www.site1.com as expected. It loads the content in /var/www/site which i have defined as the DocumentRoot in site1.com.conf. But if i navigate to www.site2.com,instead of loading index.html which is present in /var/www, which is defined as the DocumentRoot for site2.com.conf, as shown above, it loads the content in /var/www/site1. The url in the address bar remains www.site2.com. So, i have the following two questions : **Q.1)** Why is www.site2.com showing the contents of /var/www/site1 when the DocumentRoot for it has been defined as /var/www ? **Q.2)** Since, site2.com.conf does not have a symlink in sites-enabled, how come im able to navigate to www.site2.com ? Sorry, if my questions sound noobish, but ill be really happy if someone could explain this. Thank You.
2
3,063,147
06/17/2010 15:32:24
369,493
06/17/2010 15:32:24
1
0
Sharepoint Content Query Web Part: Show items from "events" list that are set to occur or reoccur within a month
I've been reading this msdn post: http://msdn.microsoft.com/en-us/library/aa981241.aspx trying to edit the content query web part to only show items from the event list which either occur within 30 days or reoccur within 30 days. It is straight forward to deal with events which do not reoccur because I can compare [Start Date] to [Today]+30 with the modify this shared web part configuration, but for reocurring events it seems that [Start Date] and [End Date] describe the period over which the reocurring event is to occur, and I don't know what to do to determine the soonest upcoming reoccurance of an event. The cqwp only takes three filter items, so I can't deal with both recurring and single occurance items without overriding the query. I think the field I need to use for reoccurrance is one of these: msdn-microsoft-com/en-us/library/microsoft.sharepoint.spfieldrecurrence_members.aspx but none of them seem appropriate. How do you deal with the "fourth day of the month" reocurrance msdn-microsoft-com/en-us/library/microsoft.sharepoint.weekofmonth.aspx Basically, how do you override the query to filter reocurring and single occurance events to show only those which occur within a week?
sharepoint
query
webparts
caml
recurring
null
open
Sharepoint Content Query Web Part: Show items from "events" list that are set to occur or reoccur within a month === I've been reading this msdn post: http://msdn.microsoft.com/en-us/library/aa981241.aspx trying to edit the content query web part to only show items from the event list which either occur within 30 days or reoccur within 30 days. It is straight forward to deal with events which do not reoccur because I can compare [Start Date] to [Today]+30 with the modify this shared web part configuration, but for reocurring events it seems that [Start Date] and [End Date] describe the period over which the reocurring event is to occur, and I don't know what to do to determine the soonest upcoming reoccurance of an event. The cqwp only takes three filter items, so I can't deal with both recurring and single occurance items without overriding the query. I think the field I need to use for reoccurrance is one of these: msdn-microsoft-com/en-us/library/microsoft.sharepoint.spfieldrecurrence_members.aspx but none of them seem appropriate. How do you deal with the "fourth day of the month" reocurrance msdn-microsoft-com/en-us/library/microsoft.sharepoint.weekofmonth.aspx Basically, how do you override the query to filter reocurring and single occurance events to show only those which occur within a week?
0
3,259,091
07/15/2010 19:12:52
264,478
02/02/2010 15:47:41
257
19
Scripting library for the Compact Framework
Does anyone know if there is a scripting library for the .Net Compact Framework 2.0 (WinCE 5) available? Something like Iron Phyton, or LUA?
c#
scripting
compact-framework
wince
null
null
open
Scripting library for the Compact Framework === Does anyone know if there is a scripting library for the .Net Compact Framework 2.0 (WinCE 5) available? Something like Iron Phyton, or LUA?
0
8,013,744
11/04/2011 17:55:59
877,620
08/03/2011 23:43:10
41
1
iOS / Mac Bonjour service not found on network
I have an iOS app that publishes a Bonjour service. On my network, the Mac app recognizes the service and everything runs smoothly. On some networks however, the Bonjour service is not "seen" by the Mac. I can't reproduce this on my own network. I have had users check for the service using Bonjour Browser and it's not found. Is there a way to diagnose this problem further? I thought it might be a firewall / router issue but some users have very simple Apple-based networks (Airport). Any ideas on what could be causing this?
iphone
ios
osx
ipad
bonjour
null
open
iOS / Mac Bonjour service not found on network === I have an iOS app that publishes a Bonjour service. On my network, the Mac app recognizes the service and everything runs smoothly. On some networks however, the Bonjour service is not "seen" by the Mac. I can't reproduce this on my own network. I have had users check for the service using Bonjour Browser and it's not found. Is there a way to diagnose this problem further? I thought it might be a firewall / router issue but some users have very simple Apple-based networks (Airport). Any ideas on what could be causing this?
0
10,685,918
05/21/2012 13:11:34
975,482
10/02/2011 14:53:10
138
8
Button Home in Launcher don't work
i have developed my own Android Launcher, it works very well, the problem is when i click the HOME button it doesn't redirect me to the HOME page, how could i fix this problem, THanks! Here is my Manifest file: <?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pl.polidea.coverflow" android:versionCode="8" android:versionName="TEST_RELEASE" > <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.INTERNET" /> <permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.READ_SETTINGS" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.WRITE_SETTINGS" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.SET_WALLPAPER" /> <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.BIND_APPWIDGET" /> <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" /> <uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" /> <application android:name="STB" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > <activity android:name=".testingactivity.CoverFlowTestingActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.MONKEY" /> </intent-filter> </activity> <activity android:name="pl.polidea.coverflow.testingactivity.PagerLauncherActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.GameActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.CinemaActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.Black" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.CommunicationActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.InternetActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.LiveActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.MusicActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.SettingsActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.SocialActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.TvShowActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.ApplicationActivity" android:label="@string/app_name" > </activity> <receiver android:name="pl.polidea.coverflow.testingactivity.ApplicationBroadcastService" > <intent-filter> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_ADDED" /> <data android:scheme="package" /> </intent-filter> </receiver> </application> </manifest>
android
launcher
homepage
null
null
null
open
Button Home in Launcher don't work === i have developed my own Android Launcher, it works very well, the problem is when i click the HOME button it doesn't redirect me to the HOME page, how could i fix this problem, THanks! Here is my Manifest file: <?xml version="1.0" encoding="UTF-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="pl.polidea.coverflow" android:versionCode="8" android:versionName="TEST_RELEASE" > <uses-sdk android:minSdkVersion="8" /> <uses-permission android:name="android.permission.INTERNET" /> <permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.READ_SETTINGS" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <permission android:name="com.android.launcher.permission.WRITE_SETTINGS" android:permissionGroup="android.permission-group.SYSTEM_TOOLS" android:protectionLevel="normal" /> <uses-permission android:name="android.permission.CALL_PHONE" /> <uses-permission android:name="android.permission.EXPAND_STATUS_BAR" /> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.SET_WALLPAPER" /> <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.BIND_APPWIDGET" /> <uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" /> <uses-permission android:name="com.android.launcher.permission.WRITE_SETTINGS" /> <application android:name="STB" android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > <activity android:name=".testingactivity.CoverFlowTestingActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.MONKEY" /> </intent-filter> </activity> <activity android:name="pl.polidea.coverflow.testingactivity.PagerLauncherActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.GameActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.CinemaActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.Black" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.CommunicationActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.InternetActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.LiveActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.MusicActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.SettingsActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.SocialActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.TvShowActivity" android:label="@string/app_name" > </activity> <activity android:name="pl.polidea.coverflow.testingactivity.ApplicationActivity" android:label="@string/app_name" > </activity> <receiver android:name="pl.polidea.coverflow.testingactivity.ApplicationBroadcastService" > <intent-filter> <action android:name="android.intent.action.PACKAGE_INSTALL" /> <action android:name="android.intent.action.PACKAGE_ADDED" /> <data android:scheme="package" /> </intent-filter> </receiver> </application> </manifest>
0
1,681,872
11/05/2009 16:40:00
77,538
03/13/2009 04:01:51
437
24
What in my CruiseControl.NET configuration is causing this exception?
In attempting to set up a build for a demo project I am working on, I received the following exception: **System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\Administrator\Local Settings\Temp\1bea7440-959c-4dd4-89ad-05dcd00e369c\ThoughtWorks.CruiseControl.MsBuild.dll'** **Question**: What don't I have configured correctly? Below is my task block from my ccnet.config file: <tasks> <msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable> <workingDirectory>C:\CCWorkingDirectory\DemoApplication</workingDirectory> <projectFile>DemoApplication.sln</projectFile > <!--<buildArgs>/noconsolelogger /v:quiet /p:Configuration=Debug /p:ReferencePath="C:\Program Files\NUnit 2.4.7\bin" </buildArgs>--> <targets>ReBuild</targets > <timeout>600</timeout > <!--<logger>c:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCNet.dll</logger >--> </msbuild> </tasks>
cruisecontrol.net
msbuild
null
null
null
null
open
What in my CruiseControl.NET configuration is causing this exception? === In attempting to set up a build for a demo project I am working on, I received the following exception: **System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Documents and Settings\Administrator\Local Settings\Temp\1bea7440-959c-4dd4-89ad-05dcd00e369c\ThoughtWorks.CruiseControl.MsBuild.dll'** **Question**: What don't I have configured correctly? Below is my task block from my ccnet.config file: <tasks> <msbuild> <executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe</executable> <workingDirectory>C:\CCWorkingDirectory\DemoApplication</workingDirectory> <projectFile>DemoApplication.sln</projectFile > <!--<buildArgs>/noconsolelogger /v:quiet /p:Configuration=Debug /p:ReferencePath="C:\Program Files\NUnit 2.4.7\bin" </buildArgs>--> <targets>ReBuild</targets > <timeout>600</timeout > <!--<logger>c:\Program Files\CruiseControl.NET\server\Rodemeyer.MsBuildToCCNet.dll</logger >--> </msbuild> </tasks>
0
3,649,521
09/06/2010 06:47:13
429,435
07/16/2010 18:52:20
62
11
About C++ pointers
I am curious to how data is handled in the situation: chapterlist.clear(); cScene newscene; newscene.name = "Laura does something."; newscene.words = 432; newscene.pov = "Laura"; cChapter newchapter; newchapter.scenelist.push_back(newscene); chapterlist.push_back(newchapter); chapterlist is a cChapter vector. I am creating a new cScene object, and pushing it onto the scenelist vector of a new cChapter object, which I then push onto chapterlist. My question is: when I am pushing objects onto a vector, is all the data being duplicated into the vector, while the old data is destroyed from the stack when the scope ends? Or is something else happening??? PS: I hate pointers, as do many.
c++
pointers
vector
null
null
null
open
About C++ pointers === I am curious to how data is handled in the situation: chapterlist.clear(); cScene newscene; newscene.name = "Laura does something."; newscene.words = 432; newscene.pov = "Laura"; cChapter newchapter; newchapter.scenelist.push_back(newscene); chapterlist.push_back(newchapter); chapterlist is a cChapter vector. I am creating a new cScene object, and pushing it onto the scenelist vector of a new cChapter object, which I then push onto chapterlist. My question is: when I am pushing objects onto a vector, is all the data being duplicated into the vector, while the old data is destroyed from the stack when the scope ends? Or is something else happening??? PS: I hate pointers, as do many.
0
7,875,205
10/24/2011 11:53:39
877,942
08/04/2011 06:12:09
53
0
empty $_POST and $_FILE variable when uploading large files
I was trying to upload a file which is 20MB in size. Now default form upload size is 8MB. When I upload such a file i get $_POST and $_FILE variables empty. Now I want to put a check on file size. If I get both these variables empty, how can I put such a check ?? Please give me suggestions
php
null
null
null
null
null
open
empty $_POST and $_FILE variable when uploading large files === I was trying to upload a file which is 20MB in size. Now default form upload size is 8MB. When I upload such a file i get $_POST and $_FILE variables empty. Now I want to put a check on file size. If I get both these variables empty, how can I put such a check ?? Please give me suggestions
0
515,429
02/05/2009 11:01:21
4,964
09/07/2008 03:07:41
94
2
How to round a Column defined as Float on INSERT and UPDATE in SQl Server 2005
I am working on a Database that uses the Float data type to store values that should only be 2 decimal positions (dollars and cents). Using Float appears to work OK, as long as the person updating the Float column does a ROUND. Of course, this does not always happen and then when a SUM is done it is always off a few pennies from what is displayed because the display is formatted to show only 2 decmial positions. This database has hundreds of tables using Float and it would be helpful to be able to automatically ROUND the float columns. Can this be done? Can a TRIGGER be used on INSERT and UPDATE to do a ROUND on the Column? If it can would you recommend it? Any other ideas? We are using SQL Server 2005. Here is a post that asks the question [Use Float or Decimal for Accounting Application Dollar Amount?][1] and I like the one responce that said "You should really consider using some type of fixed point / arbitrary-precision number package (e.g. java BigNum, python decimal module) otherwise you'll be in for a **world of hurt**". I feel the pain! [1]: http://stackoverflow.com/questions/61872/use-float-or-decimal-for-accounting-application-dollar-amount
sql
sql-server
triggers
insert-update
rounding
null
open
How to round a Column defined as Float on INSERT and UPDATE in SQl Server 2005 === I am working on a Database that uses the Float data type to store values that should only be 2 decimal positions (dollars and cents). Using Float appears to work OK, as long as the person updating the Float column does a ROUND. Of course, this does not always happen and then when a SUM is done it is always off a few pennies from what is displayed because the display is formatted to show only 2 decmial positions. This database has hundreds of tables using Float and it would be helpful to be able to automatically ROUND the float columns. Can this be done? Can a TRIGGER be used on INSERT and UPDATE to do a ROUND on the Column? If it can would you recommend it? Any other ideas? We are using SQL Server 2005. Here is a post that asks the question [Use Float or Decimal for Accounting Application Dollar Amount?][1] and I like the one responce that said "You should really consider using some type of fixed point / arbitrary-precision number package (e.g. java BigNum, python decimal module) otherwise you'll be in for a **world of hurt**". I feel the pain! [1]: http://stackoverflow.com/questions/61872/use-float-or-decimal-for-accounting-application-dollar-amount
0
9,623,638
03/08/2012 19:31:37
451,890
09/19/2010 11:51:07
80
1
Are deeply nested if statements considered good form?
In my adventures of writing Mac software with Objective-C and Cocoa, I've learned quite a lot. There is still much for me to learn, but I've greatly improved in the past few months and have advanced to the point of programming software with moderate-high complexity. Something that I've noticed is that throughout this time, the number of if statements (and to a lesser extent, for each statements) that show up in my code have increased dramatically. Sometimes, I find myself nesting if statements as far down as five statements deep. I've not noticed any downsides to this myself (other than decreased readability in some cases), but is this considered acceptable and good form when writing Objective-C? Is there a better/more efficient way to accomplish things than nested if statements?
objective-c
cocoa
coding-style
null
null
03/09/2012 01:41:31
not constructive
Are deeply nested if statements considered good form? === In my adventures of writing Mac software with Objective-C and Cocoa, I've learned quite a lot. There is still much for me to learn, but I've greatly improved in the past few months and have advanced to the point of programming software with moderate-high complexity. Something that I've noticed is that throughout this time, the number of if statements (and to a lesser extent, for each statements) that show up in my code have increased dramatically. Sometimes, I find myself nesting if statements as far down as five statements deep. I've not noticed any downsides to this myself (other than decreased readability in some cases), but is this considered acceptable and good form when writing Objective-C? Is there a better/more efficient way to accomplish things than nested if statements?
4
4,576,833
01/02/2011 02:39:52
445,820
09/12/2010 22:24:29
35
0
PHP Commenting - Forgot some stuff!
maybe this is a very simple question, but forgot the answer about it because I had it once XD So the question is about php comments, when commenting functions you use @param to explain what? Can you please clear me up?
php
null
null
null
null
01/03/2011 01:47:30
not a real question
PHP Commenting - Forgot some stuff! === maybe this is a very simple question, but forgot the answer about it because I had it once XD So the question is about php comments, when commenting functions you use @param to explain what? Can you please clear me up?
1
11,727,967
07/30/2012 19:06:19
1,563,862
07/30/2012 18:52:27
1
0
To invoke rest webservice from iphone app
I am a newbie in iPhone development , i am developing a app in which i have to call a web service which will check the validity of login details ,but i am not able to call it in a right manner. I checked on this link http://stackoverflow.com/questions/982622/consume-wcf-web-service-using-objective-c-on-iphone but it is not giving me result.I have the xml and the location at which it is hosted ,Can anyone provide me a sample of how to use the xml with the url to correctly call that web service. Thanks in advance.
objective-c
ios
web-services
null
null
07/31/2012 15:49:51
not a real question
To invoke rest webservice from iphone app === I am a newbie in iPhone development , i am developing a app in which i have to call a web service which will check the validity of login details ,but i am not able to call it in a right manner. I checked on this link http://stackoverflow.com/questions/982622/consume-wcf-web-service-using-objective-c-on-iphone but it is not giving me result.I have the xml and the location at which it is hosted ,Can anyone provide me a sample of how to use the xml with the url to correctly call that web service. Thanks in advance.
1
1,942,175
12/21/2009 19:42:41
236,302
12/21/2009 19:42:41
1
0
Update a single object across multiple process in java
A couple of Relational DB tables are managed by a single object cache that resides in a process. When the cache is committed the tables are updated. The DB relational tables are updated by regular SQL queries and not anything more fancier like hibernate. Eventually, other processes got into the business of modifying this object without communicating with one another i.e, Each process would initialize this object (read from DB) and update it( commit to DB), & other process would not know about it holding on to a stale cache. I have to fix this workflow. I have thought of couple of methods. One is to make this object an mBean. So, the object would reside on one process and every process would eventually modify the object in that process by mBean method invocations. However, this approach has a couple of problems. 1) Every object returned by this cache has be an mBean, which could make the method invocations quite chatty. 2) Also there is a requirement that every process should see a consistent data model(cache) of the DB, and it should merge its contents to the DB if possible. (like a transaction). If the DB was updated by some other process significantly, it is OK for the merge to fail. What technologies in Java will help to solve this problem?
java
database
mbeans
caching
concurrency
null
open
Update a single object across multiple process in java === A couple of Relational DB tables are managed by a single object cache that resides in a process. When the cache is committed the tables are updated. The DB relational tables are updated by regular SQL queries and not anything more fancier like hibernate. Eventually, other processes got into the business of modifying this object without communicating with one another i.e, Each process would initialize this object (read from DB) and update it( commit to DB), & other process would not know about it holding on to a stale cache. I have to fix this workflow. I have thought of couple of methods. One is to make this object an mBean. So, the object would reside on one process and every process would eventually modify the object in that process by mBean method invocations. However, this approach has a couple of problems. 1) Every object returned by this cache has be an mBean, which could make the method invocations quite chatty. 2) Also there is a requirement that every process should see a consistent data model(cache) of the DB, and it should merge its contents to the DB if possible. (like a transaction). If the DB was updated by some other process significantly, it is OK for the merge to fail. What technologies in Java will help to solve this problem?
0
6,319,834
06/12/2011 02:54:48
794,428
06/12/2011 02:16:09
1
0
Clone and equal method in Eiffel
Why define a `clone` or `equal` method in Eiffel gives greater protection with respect to types problems in comparison to something similar in C#?
c#
eiffel
null
null
null
06/14/2011 04:27:56
not constructive
Clone and equal method in Eiffel === Why define a `clone` or `equal` method in Eiffel gives greater protection with respect to types problems in comparison to something similar in C#?
4
3,763,283
09/21/2010 18:26:40
71,422
02/26/2009 15:18:52
637
4
vs2003: project not getting built
I have vs2003 c# solution with multiple projects. It seems like project1 in sln file is not getting built and is not producing the desired DLL. Project2 depends on project1.dll and is getting build errors. How do I insure that project1 gets built. Do I have to change some sort of build property like Debug vs Release. The DLLs are supposed to build in the obj/Debug folder.
visual-studio
null
null
null
null
null
open
vs2003: project not getting built === I have vs2003 c# solution with multiple projects. It seems like project1 in sln file is not getting built and is not producing the desired DLL. Project2 depends on project1.dll and is getting build errors. How do I insure that project1 gets built. Do I have to change some sort of build property like Debug vs Release. The DLLs are supposed to build in the obj/Debug folder.
0
9,532,892
03/02/2012 11:56:31
983,924
10/07/2011 11:53:21
63
1
datagridview column arrow
when I selected a cell in data grid view, an arrow displays on the selected row header. Now I want the same thing for column header. I mean, when I selected a cell, an arrow must be displayed on the selected row and the selected column. Is it possible?
c#
.net
datagridview
c++-cli
null
null
open
datagridview column arrow === when I selected a cell in data grid view, an arrow displays on the selected row header. Now I want the same thing for column header. I mean, when I selected a cell, an arrow must be displayed on the selected row and the selected column. Is it possible?
0
9,298,548
02/15/2012 17:50:57
633,513
02/25/2011 03:21:14
612
21
paypal token I'm given is invalid?
i'm using paypal's express checkout API in PHP, and the `SetExpressCheckout` operation works fine. But when paypal redirect's to my page that handles the `GetExpressCheckoutDetails` operation, it gives me a `10410: Invalid Token` error. I'm using the token they provide in the url, so what's the problem? Here's the code i'm using: $token = urldecode($this->params['url']['token']); $req_str = 'USER=%s&PWD=%s&SIGNATURE=%s&VERSION=%s&METHOD=%s&TOKEN=%'; $req_query = sprintf($req_str, Configure::read('Paypal.username'), Configure::read('Paypal.password'), Configure::read('Paypal.signature'), "65.1", 'GetExpressCheckoutDetails', $token);
php
paypal
null
null
null
null
open
paypal token I'm given is invalid? === i'm using paypal's express checkout API in PHP, and the `SetExpressCheckout` operation works fine. But when paypal redirect's to my page that handles the `GetExpressCheckoutDetails` operation, it gives me a `10410: Invalid Token` error. I'm using the token they provide in the url, so what's the problem? Here's the code i'm using: $token = urldecode($this->params['url']['token']); $req_str = 'USER=%s&PWD=%s&SIGNATURE=%s&VERSION=%s&METHOD=%s&TOKEN=%'; $req_query = sprintf($req_str, Configure::read('Paypal.username'), Configure::read('Paypal.password'), Configure::read('Paypal.signature'), "65.1", 'GetExpressCheckoutDetails', $token);
0
2,473,302
03/18/2010 20:58:00
241,811
01/01/2010 04:46:25
29
1
SVN server host os
Recently I was searching on how to secure svn repository, or otherwords how to enable ssl connection to svn repository for a windows server 2003. Does it make more sense to use Linux server instead?
svn
windows
linux
null
null
null
open
SVN server host os === Recently I was searching on how to secure svn repository, or otherwords how to enable ssl connection to svn repository for a windows server 2003. Does it make more sense to use Linux server instead?
0
8,131,886
11/15/2011 05:24:04
909,457
08/11/2010 18:18:14
76
8
how to find value of x , y coordinates when touch a pie chart , core-plot?
I have created a pie chart using core plot . i want to find x , y coordinates when i touch the pie chart . I have used following code. `[hostgraph setAllowPinchScaling : YES];` And below code for scaling purpose . ' -(BOOL)plotSpace:(CPTPlotSpace*)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint { return YES } ' I want to find x and y coordinates so that i can find radius of pie chart dynamically when touched so that i can zoom the pie chart . So please provide relevant link and code. Thank
iphone
core-plot
null
null
null
11/17/2011 13:51:35
not a real question
how to find value of x , y coordinates when touch a pie chart , core-plot? === I have created a pie chart using core plot . i want to find x , y coordinates when i touch the pie chart . I have used following code. `[hostgraph setAllowPinchScaling : YES];` And below code for scaling purpose . ' -(BOOL)plotSpace:(CPTPlotSpace*)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint { return YES } ' I want to find x and y coordinates so that i can find radius of pie chart dynamically when touched so that i can zoom the pie chart . So please provide relevant link and code. Thank
1
11,678,860
07/26/2012 22:17:28
1,556,155
07/26/2012 22:07:07
1
0
convert textmate bundle to aptana
I downloaded Aptana Studio 3 a few days ago and according to the documentation there is supposed to be a way to convert a textmate bundle to a ruble. The documentation indicates that there is supposed to be a a tool that does that under Window >> Bundle Development. To my surprise, the convert tool does not exist in specified location. I've been looking everywhere online to see if I could find the information, but to no avail. Can some one point me to where this tool is or tell me how to convert a textmate bundle to an aptana ruble. This is the build information: Aptana Studio 3, build: 3.2.0.201206251729 Thanks in advance.
aptana
bundle
textmate
convert
null
07/27/2012 18:59:32
off topic
convert textmate bundle to aptana === I downloaded Aptana Studio 3 a few days ago and according to the documentation there is supposed to be a way to convert a textmate bundle to a ruble. The documentation indicates that there is supposed to be a a tool that does that under Window >> Bundle Development. To my surprise, the convert tool does not exist in specified location. I've been looking everywhere online to see if I could find the information, but to no avail. Can some one point me to where this tool is or tell me how to convert a textmate bundle to an aptana ruble. This is the build information: Aptana Studio 3, build: 3.2.0.201206251729 Thanks in advance.
2
5,857,428
05/02/2011 12:59:50
729,347
04/28/2011 13:04:55
3
0
JSF Datatable can't get the value of OnetoMany relationship object?
I'm a JSF Newbie and having problem with displaying data using datatable. These is my scenario: I want to display the contract(s) assigned to the Customer JSF page's Datatable : customerdetail.jsp <h:dataTable id="dt_contract_list" value="#{customerBean.customer.contracts}" var="item"> <h:column> <f:facet name="header"> <h:outputText value="Contract Identifier"/> </f:facet> <h:outputText style="" value="#{item.contractIdentifier}"></h:outputText> </h:column> </h:dataTable> Entity Bean : Customer.java @Entity @NamedQueries({ @NamedQuery(name="getCustomerByName", query="SELECT customer FROM Customer customer WHERE customer.name = :name"), @NamedQuery(name="getAllCustomer", query="SELECT customer FROM Customer customer") }) public class Customer { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String name; @OneToMany(targetEntity = Contract.class, mappedBy = "customer", cascade = CascadeType.ALL, fetch=FetchType.EAGER) private List<Contract> contracts = new ArrayList<Contract>(); public Customer() { super(); } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public List<Contract> getContracts() { return this.contracts; } @Override public boolean equals(Object object) { if (this.getClass().isInstance(object)) { return this.getName().equals(((Customer) object).getName()); } else { return false; } } } BackingBean : CustomerBean.java public class CustomerBean implements Serializable { @EJB private CustomerControllerLocal customerController; private Customer customer; public CustomerBean() { customer = new Customer(); } public String createCustomer() { // create customer } public String updateCustomer() { // update customer } public String deleteCustomer() { // delete custoer } public String getCustomerByName() { try { customerController.getCustomerByName(customer.getName()); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return "customer_got"; } public String assignContractsToCustomer() { // assign contract to customer } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } } There's no errors and the whole business logic layer, data layer were tested and work fine but the result is null (and it shouldn't!) and no sign of any exception. Can anyone help me figure it out what's wrong with this? T___T
jsf
datatable
one-to-many
null
null
null
open
JSF Datatable can't get the value of OnetoMany relationship object? === I'm a JSF Newbie and having problem with displaying data using datatable. These is my scenario: I want to display the contract(s) assigned to the Customer JSF page's Datatable : customerdetail.jsp <h:dataTable id="dt_contract_list" value="#{customerBean.customer.contracts}" var="item"> <h:column> <f:facet name="header"> <h:outputText value="Contract Identifier"/> </f:facet> <h:outputText style="" value="#{item.contractIdentifier}"></h:outputText> </h:column> </h:dataTable> Entity Bean : Customer.java @Entity @NamedQueries({ @NamedQuery(name="getCustomerByName", query="SELECT customer FROM Customer customer WHERE customer.name = :name"), @NamedQuery(name="getAllCustomer", query="SELECT customer FROM Customer customer") }) public class Customer { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private int id; private String name; @OneToMany(targetEntity = Contract.class, mappedBy = "customer", cascade = CascadeType.ALL, fetch=FetchType.EAGER) private List<Contract> contracts = new ArrayList<Contract>(); public Customer() { super(); } public int getId() { return this.id; } public void setId(int id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public List<Contract> getContracts() { return this.contracts; } @Override public boolean equals(Object object) { if (this.getClass().isInstance(object)) { return this.getName().equals(((Customer) object).getName()); } else { return false; } } } BackingBean : CustomerBean.java public class CustomerBean implements Serializable { @EJB private CustomerControllerLocal customerController; private Customer customer; public CustomerBean() { customer = new Customer(); } public String createCustomer() { // create customer } public String updateCustomer() { // update customer } public String deleteCustomer() { // delete custoer } public String getCustomerByName() { try { customerController.getCustomerByName(customer.getName()); } catch (NotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return "customer_got"; } public String assignContractsToCustomer() { // assign contract to customer } public Customer getCustomer() { return customer; } public void setCustomer(Customer customer) { this.customer = customer; } } There's no errors and the whole business logic layer, data layer were tested and work fine but the result is null (and it shouldn't!) and no sign of any exception. Can anyone help me figure it out what's wrong with this? T___T
0