PostId
int64
13
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
3
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-33
210k
OwnerUndeletedAnswerCountAtPostTime
int64
0
5.77k
Title
stringlengths
10
250
BodyMarkdown
stringlengths
12
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
47
30.1k
OpenStatus_id
int64
0
4
7,178,880
08/24/2011 16:21:09
549,772
12/21/2010 10:14:11
89
2
Parsing XML or JSON with Jquery
I have a fairly large XML file (around 42MB) that I am parsing with jquery. I need to selectively show certain nodes based on an ID. By doing this the web browser becomes unresponsive, and the average time for parsing is greater than 15 seconds. My query is whether converting this large XML file to JSON, help improve the performance? Below is a sample of the XML. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE thesaurus SYSTEM "Thesaurus_1_4.dtd"> <thesaurus action="ExportLanguage" language="en" version="2.7" date="2011-08-15"> <options/> <wordblocks> <wordblock> <term type="forbidden" lang="en" termid="18297"> <value>1,1-DIETHOXYETHANE</value> </term> <terms> <term rel="USE" lang="en" termid="30" type="valid"> <value>ACETAL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18307"> <value>1,2,3-PROPANETRIOL</value> </term> <terms> <term rel="USE" lang="en" termid="4028" type="valid"> <value>GLYCEROL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18308"> <value>1,2,3-TRIHYDROXYBENZENE</value> </term> <terms> <term rel="USE" lang="en" termid="8094" type="valid"> <value>PYROGALLOL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18309"> <value>1,2,4,5-TETRAMETHYLBENZENE</value> </term> <terms> <term rel="USE" lang="en" termid="2814" type="valid"> <value>DURENE</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18298"> <value>1,2-DIHYDROXYANTHRAQUINONE</value> </term> <terms> <term rel="USE" lang="en" termid="229" type="valid"> <value>ALIZARIN</value> </term> </terms> </wordblock> </wordblocks> </thesaurus>
jquery
xml
json
parsing
null
null
open
Parsing XML or JSON with Jquery === I have a fairly large XML file (around 42MB) that I am parsing with jquery. I need to selectively show certain nodes based on an ID. By doing this the web browser becomes unresponsive, and the average time for parsing is greater than 15 seconds. My query is whether converting this large XML file to JSON, help improve the performance? Below is a sample of the XML. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE thesaurus SYSTEM "Thesaurus_1_4.dtd"> <thesaurus action="ExportLanguage" language="en" version="2.7" date="2011-08-15"> <options/> <wordblocks> <wordblock> <term type="forbidden" lang="en" termid="18297"> <value>1,1-DIETHOXYETHANE</value> </term> <terms> <term rel="USE" lang="en" termid="30" type="valid"> <value>ACETAL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18307"> <value>1,2,3-PROPANETRIOL</value> </term> <terms> <term rel="USE" lang="en" termid="4028" type="valid"> <value>GLYCEROL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18308"> <value>1,2,3-TRIHYDROXYBENZENE</value> </term> <terms> <term rel="USE" lang="en" termid="8094" type="valid"> <value>PYROGALLOL</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18309"> <value>1,2,4,5-TETRAMETHYLBENZENE</value> </term> <terms> <term rel="USE" lang="en" termid="2814" type="valid"> <value>DURENE</value> </term> </terms> </wordblock> <wordblock> <term type="forbidden" lang="en" termid="18298"> <value>1,2-DIHYDROXYANTHRAQUINONE</value> </term> <terms> <term rel="USE" lang="en" termid="229" type="valid"> <value>ALIZARIN</value> </term> </terms> </wordblock> </wordblocks> </thesaurus>
0
7,368,650
09/09/2011 23:59:36
746,741
05/10/2011 11:33:46
15
0
Amazon Product Advertisement API: Get results from UK site only
I'm a new user of "Amazon Product Advertisement API" with C#. My application should return results from UK website only. Any ideas?
c#
amazon-web-services
amazon
null
null
09/10/2011 18:33:54
not a real question
Amazon Product Advertisement API: Get results from UK site only === I'm a new user of "Amazon Product Advertisement API" with C#. My application should return results from UK website only. Any ideas?
1
9,649,102
03/10/2012 18:39:27
1,234,315
02/26/2012 20:08:45
24
0
What happened to my opera web document icon?
I saved a page from internet now and then (it becomes html file, and I use Opera as my default browser). The icon of html file that I save is usually the same with opera icon (that red O). Although just recently all my opera web document files' icon turned differently. The icon resemble a file's icon that has no extension - the icon is like a piece of paper, white, blank. I can still open it with opera, or any other browser. It's just unnerved me. Any suggestion?
html
opera
null
null
null
03/22/2012 23:07:21
off topic
What happened to my opera web document icon? === I saved a page from internet now and then (it becomes html file, and I use Opera as my default browser). The icon of html file that I save is usually the same with opera icon (that red O). Although just recently all my opera web document files' icon turned differently. The icon resemble a file's icon that has no extension - the icon is like a piece of paper, white, blank. I can still open it with opera, or any other browser. It's just unnerved me. Any suggestion?
2
3,444,886
08/09/2010 23:15:03
292,815
01/09/2010 03:57:51
5
0
iPhone force orientation
First - i read all similar topics and non of them works for me. I have few View Controllers. And i change them by that code: - (void)flipToAzbukaMenu { AzbukaMenuController *aAzbukaMenu = [[AzbukaMenuController alloc] initWithNibName:@"AzbukaMenu" bundle:nil]; [self setAzbukaMenuController:aAzbukaMenu]; [aAzbukaMenu release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO]; [viewController.view removeFromSuperview]; [azbukaArcadeController.view removeFromSuperview]; [self.window addSubview:[azbukaMenuController view]]; [UIView commitAnimations]; } Also i have proper key in plist that allow me to start application in landscape mode. When app starts it has proper orientation (landscape), but when i change my view it become portrait and become again landscape only after rotating device 270 degree (not 90 lol). How to force app show all view in landscape mode?
objective-c
iphone
null
null
null
null
open
iPhone force orientation === First - i read all similar topics and non of them works for me. I have few View Controllers. And i change them by that code: - (void)flipToAzbukaMenu { AzbukaMenuController *aAzbukaMenu = [[AzbukaMenuController alloc] initWithNibName:@"AzbukaMenu" bundle:nil]; [self setAzbukaMenuController:aAzbukaMenu]; [aAzbukaMenu release]; [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:window cache:NO]; [viewController.view removeFromSuperview]; [azbukaArcadeController.view removeFromSuperview]; [self.window addSubview:[azbukaMenuController view]]; [UIView commitAnimations]; } Also i have proper key in plist that allow me to start application in landscape mode. When app starts it has proper orientation (landscape), but when i change my view it become portrait and become again landscape only after rotating device 270 degree (not 90 lol). How to force app show all view in landscape mode?
0
11,346,409
07/05/2012 14:26:52
1,483,422
06/26/2012 16:36:32
1
0
Best way to login?
I'm new to php and would like some info please if its possible. I'm currently trying to build a website for an excersise in my colledge. My main question is which is the best or more professional way to create the login script (**note:** only one user, the admin will have access)??? - 1st by checking the data posted from the form if they match with those that are in a table 'admin' in database. so I have to create a table in my db and add one user only admin and then check with an sql query the match - or 2nd by making a script like this: if(($_post['username'] == 'admin') && ($_post['password'] == 'password')){ echo "Welcome admin"; }else{ echo "No access"; }
php
authentication
login
admin
null
07/06/2012 04:06:21
not constructive
Best way to login? === I'm new to php and would like some info please if its possible. I'm currently trying to build a website for an excersise in my colledge. My main question is which is the best or more professional way to create the login script (**note:** only one user, the admin will have access)??? - 1st by checking the data posted from the form if they match with those that are in a table 'admin' in database. so I have to create a table in my db and add one user only admin and then check with an sql query the match - or 2nd by making a script like this: if(($_post['username'] == 'admin') && ($_post['password'] == 'password')){ echo "Welcome admin"; }else{ echo "No access"; }
4
8,690,255
12/31/2011 19:56:29
979,830
10/05/2011 06:56:57
10
0
Youtube Adio only HTML5 player
is it possible to play the **audio only** from a YouTube video using html5 and javascript?
html5
audio
youtube
null
null
null
open
Youtube Adio only HTML5 player === is it possible to play the **audio only** from a YouTube video using html5 and javascript?
0
6,483,692
06/26/2011 11:46:13
125,633
06/19/2009 09:36:36
416
1
flashdevelop halted with no explicit compile error
We are developing flash based games using flashdevelop and flash CS 3. We are using flash CS3 to publish the swc and the swc will be used in flashdevlop as library. Everything seems well, until one day I made a change to the fla(the change is canceling the embed fonts or move a movieclip from one point to another, nothing unusual) and then publish as swc. But when i try to recompile with the latest swc, it fails with the following errors: > Error: null > Build halted with errors (fcsh). > (fcsh) > Done(1) Error is null and no other explicit compiling errors. When I try to use the old fla to publish the swc, the swc sometimes works well with flashdevelop but sometimes it fails with the above reason. I have no idea about this. Can anyone help me about this? Big thinks to you guys who can offer me some hints, since it annoys me so greatly.
flash
flash-cs3
flashdevelop
swc
null
null
open
flashdevelop halted with no explicit compile error === We are developing flash based games using flashdevelop and flash CS 3. We are using flash CS3 to publish the swc and the swc will be used in flashdevlop as library. Everything seems well, until one day I made a change to the fla(the change is canceling the embed fonts or move a movieclip from one point to another, nothing unusual) and then publish as swc. But when i try to recompile with the latest swc, it fails with the following errors: > Error: null > Build halted with errors (fcsh). > (fcsh) > Done(1) Error is null and no other explicit compiling errors. When I try to use the old fla to publish the swc, the swc sometimes works well with flashdevelop but sometimes it fails with the above reason. I have no idea about this. Can anyone help me about this? Big thinks to you guys who can offer me some hints, since it annoys me so greatly.
0
4,110,939
11/05/2010 23:24:42
183,717
10/03/2009 20:08:39
674
0
Alterate to C, C++ ?
All, There are so many programming languages/Operating systems/device drivers i.e. softwares that are built using [C][1] and [C++][2]. I was wondering if C and C++ were the only 2 low level programming languages that all companies ever had to build their own product(s)? If there are, why do C and C++ get so much preference over other options? [1]: http://en.wikipedia.org/wiki/C_(programming_language) [2]: http://en.wikipedia.org/wiki/C%2B%2B
c++
c
null
null
null
11/06/2010 09:37:17
not constructive
Alterate to C, C++ ? === All, There are so many programming languages/Operating systems/device drivers i.e. softwares that are built using [C][1] and [C++][2]. I was wondering if C and C++ were the only 2 low level programming languages that all companies ever had to build their own product(s)? If there are, why do C and C++ get so much preference over other options? [1]: http://en.wikipedia.org/wiki/C_(programming_language) [2]: http://en.wikipedia.org/wiki/C%2B%2B
4
10,978,211
06/11/2012 10:16:18
1,428,055
05/31/2012 09:44:58
6
0
Dose android phone's screen light off affect network status?
Dose android phone's screen light off affect network status(connectivity with GSM network),as when phone's lights off (means user not doing anything on it),no up link is needed until phone's light is on. I am unable to run some network related USSD when phone light off or phone is locked,while it works fine when lights are on ?? kindly help me on it!!
android
ussd
null
null
null
06/12/2012 11:03:17
off topic
Dose android phone's screen light off affect network status? === Dose android phone's screen light off affect network status(connectivity with GSM network),as when phone's lights off (means user not doing anything on it),no up link is needed until phone's light is on. I am unable to run some network related USSD when phone light off or phone is locked,while it works fine when lights are on ?? kindly help me on it!!
2
9,925,659
03/29/2012 12:47:58
666,160
03/18/2011 14:16:09
27
0
update table with self fired INSERT trigger using standard UPDATE statement, and not :NEW method
When i insert data into table, i want to update field trenutna_cena. I know this is possible to to with this code: CREATE OR REPLACE TRIGGER TRG_PROCED_SK_CENA BEFORE INSERT ON stavka_kataloga FOR EACH ROW DECLARE pragma autonomous_transaction; BEGIN :NEW.trenutna_cena := 'da'; COMMIT; END; / that was the way doing that without using packages, and stored procedures.And with using only **BEFORE TRIGGER**. But since this is a school project, i need to do that using Packages, Stored procedure, and Trigger. So code below is my try at it. But it doesn't seems to work. PROCEDURE IS THE PROBLEM just to short time on thiking. variables are passed correctly to procedure, but UPDATE just doesn't work in it. **CREATION OF THE PACKAGE** CREATE OR REPLACE PACKAGE paket_stavka_kataloga IS sifra_stavke_kat NUMBER; END paket_stavka_kataloga; / **CREATION OF THE PROCEDURE** CREATE OR REPLACE PROCEDURE pstavka_nar_trenutna_cena(v_sifra_stavke_kat IN NUMBER) IS BEGIN update stavka_kataloga set trenutna_cena = 'da' where sifra_stavke_kat = v_sifra_stavke_kat; END; / **CREATION OF TRIGGER** CREATE OR REPLACE TRIGGER TRG_PROCED_SK_CENA BEFORE INSERT ON stavka_kataloga FOR EACH ROW DECLARE pragma autonomous_transaction; BEGIN paket_stavka_kataloga.sifra_stavke_kat:= :NEW.sifra_stavke_kat; pstavka_nar_trenutna_cena(paket_stavka_kataloga.sifra_stavke_kat); COMMIT; END; / any suggestion and help is welcome. Thanks!
sql
database
oracle
triggers
oracle11g
03/29/2012 14:30:29
too localized
update table with self fired INSERT trigger using standard UPDATE statement, and not :NEW method === When i insert data into table, i want to update field trenutna_cena. I know this is possible to to with this code: CREATE OR REPLACE TRIGGER TRG_PROCED_SK_CENA BEFORE INSERT ON stavka_kataloga FOR EACH ROW DECLARE pragma autonomous_transaction; BEGIN :NEW.trenutna_cena := 'da'; COMMIT; END; / that was the way doing that without using packages, and stored procedures.And with using only **BEFORE TRIGGER**. But since this is a school project, i need to do that using Packages, Stored procedure, and Trigger. So code below is my try at it. But it doesn't seems to work. PROCEDURE IS THE PROBLEM just to short time on thiking. variables are passed correctly to procedure, but UPDATE just doesn't work in it. **CREATION OF THE PACKAGE** CREATE OR REPLACE PACKAGE paket_stavka_kataloga IS sifra_stavke_kat NUMBER; END paket_stavka_kataloga; / **CREATION OF THE PROCEDURE** CREATE OR REPLACE PROCEDURE pstavka_nar_trenutna_cena(v_sifra_stavke_kat IN NUMBER) IS BEGIN update stavka_kataloga set trenutna_cena = 'da' where sifra_stavke_kat = v_sifra_stavke_kat; END; / **CREATION OF TRIGGER** CREATE OR REPLACE TRIGGER TRG_PROCED_SK_CENA BEFORE INSERT ON stavka_kataloga FOR EACH ROW DECLARE pragma autonomous_transaction; BEGIN paket_stavka_kataloga.sifra_stavke_kat:= :NEW.sifra_stavke_kat; pstavka_nar_trenutna_cena(paket_stavka_kataloga.sifra_stavke_kat); COMMIT; END; / any suggestion and help is welcome. Thanks!
3
10,616,800
05/16/2012 10:36:53
900,350
08/18/2011 09:58:56
12
0
create a game like crosswords in Android
I would like to create a game like crosswords , which will have a drag and drop, zoom functionality . Can somebody direct me how can I proceed for this? Is there any 3rd party Jar needed to develop? Which view is perfect for this, I mean ,to create a chess board like UI and Letters on top of it. I need to drag one letter from 1 column to another. Thanks in advance for your help.
java
android
null
null
null
05/16/2012 18:51:25
not a real question
create a game like crosswords in Android === I would like to create a game like crosswords , which will have a drag and drop, zoom functionality . Can somebody direct me how can I proceed for this? Is there any 3rd party Jar needed to develop? Which view is perfect for this, I mean ,to create a chess board like UI and Letters on top of it. I need to drag one letter from 1 column to another. Thanks in advance for your help.
1
8,116,184
11/14/2011 01:01:03
986,258
10/09/2011 10:10:52
36
0
Changing find to echo
This is almost good find *.txt -print0 | xargs -0 rm -f And i want to have sth like that echo *.txt ./zad3.sh | xargs -l rm -f First version is good cuz I can delete file with white spaces but I cant use my script to select file to delete. Second version I can select files but I cant delete file with white spaces.
bash
null
null
null
null
11/14/2011 02:07:32
not a real question
Changing find to echo === This is almost good find *.txt -print0 | xargs -0 rm -f And i want to have sth like that echo *.txt ./zad3.sh | xargs -l rm -f First version is good cuz I can delete file with white spaces but I cant use my script to select file to delete. Second version I can select files but I cant delete file with white spaces.
1
4,022,136
10/26/2010 09:04:54
1,104,408
10/26/2010 08:55:12
1
0
Cannot Connect to the SQL Server , SQL 2005 and it doesnot want to connect to the server and there is no Server name ?
TITLE: Connect to Server ------------------------------ Cannot connect to .. ------------------------------ ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
sql
sql-server-2005-express
null
null
null
10/27/2010 10:14:15
off topic
Cannot Connect to the SQL Server , SQL 2005 and it doesnot want to connect to the server and there is no Server name ? === TITLE: Connect to Server ------------------------------ Cannot connect to .. ------------------------------ ADDITIONAL INFORMATION: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 2) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476 ------------------------------ BUTTONS: OK ------------------------------
2
9,905,955
03/28/2012 10:50:17
1,297,899
03/28/2012 10:27:43
1
0
appledoc Exception: at least one directory
After wasting some time to figure out what goes wrong, i finally have to ask for help. I want to use appledocs from Gentle Bytes. I followed every step of the quick install guide, but i´m not able to compile the project. Here is what i´ve done: 1. cloned it from git://github.com/tomaz/appledoc.git 2. installed the templates to ~/Library/Application Support/appledoc 3. tried to compile the project Everytime i try to compile, i get following error: **ERROR: AppledocException: At least one directory or file name path is required, use 'appledoc --help'** What do i have to do now? Thanks, Tomte
xcode
osx
appledoc
null
null
null
open
appledoc Exception: at least one directory === After wasting some time to figure out what goes wrong, i finally have to ask for help. I want to use appledocs from Gentle Bytes. I followed every step of the quick install guide, but i´m not able to compile the project. Here is what i´ve done: 1. cloned it from git://github.com/tomaz/appledoc.git 2. installed the templates to ~/Library/Application Support/appledoc 3. tried to compile the project Everytime i try to compile, i get following error: **ERROR: AppledocException: At least one directory or file name path is required, use 'appledoc --help'** What do i have to do now? Thanks, Tomte
0
7,054,052
08/13/2011 23:53:11
893,488
08/13/2011 23:53:11
1
0
Android: Setting user location on Google Map activity
i have just made an activity within my app that shows a map to the user. how can i put the location of the user onto this map? little bit confused about doing this so any help would be appreciated! ALSO: when i set up the map, I had to include: MapView mapView = (MapView) findViewById(R.id.mapview); Why do you have to include this because don't you already have: setContentView(R.layout.main);? -- sounds like an idiot question but its just something i wondered!
android
google-maps
application
null
null
null
open
Android: Setting user location on Google Map activity === i have just made an activity within my app that shows a map to the user. how can i put the location of the user onto this map? little bit confused about doing this so any help would be appreciated! ALSO: when i set up the map, I had to include: MapView mapView = (MapView) findViewById(R.id.mapview); Why do you have to include this because don't you already have: setContentView(R.layout.main);? -- sounds like an idiot question but its just something i wondered!
0
4,361,016
12/05/2010 20:37:43
418,055
08/12/2010 06:30:27
595
31
2-Microphone Android Phones?
Is the Nexus One the only Android phone having 2 microphones? I know that the 2nd microphone is intended for helping noise cancellation and this is a great feature. I am wondering whether the Nexus One is the only such Android phone.
nexus-one
adp
noise-reduction
android-phone
null
12/06/2010 11:10:12
off topic
2-Microphone Android Phones? === Is the Nexus One the only Android phone having 2 microphones? I know that the 2nd microphone is intended for helping noise cancellation and this is a great feature. I am wondering whether the Nexus One is the only such Android phone.
2
6,970,993
08/07/2011 05:48:25
701,510
04/11/2011 03:40:18
260
0
how to handle multiple domains on one server?
Let's say I started out with one domain on a server called "www.oldsite.com". Then I decided to register another domain,"www.newsite.com" and put the new domain's files into the directory, "www.oldsite.com/newsite/". How do I allow the user to visit "www.newsite.com" and access the pages of the new site.
url
redirect
directory
domain
null
08/07/2011 09:25:57
off topic
how to handle multiple domains on one server? === Let's say I started out with one domain on a server called "www.oldsite.com". Then I decided to register another domain,"www.newsite.com" and put the new domain's files into the directory, "www.oldsite.com/newsite/". How do I allow the user to visit "www.newsite.com" and access the pages of the new site.
2
7,663,055
10/05/2011 14:38:04
121,183
06/11/2009 09:06:27
89
2
delphi tserversocket ignores 1st message
pls advise why this happens. on a simple sample server app i have the following code: procedure TForm13.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket); var str : string; begin str := socket.ReceiveText; showmessage(str); end; and on the client side i have clientsocket1.Open; clientsocket1.Socket.SendText(txtMSG.Text); nothing fancy. the strange thing is that when i send a message to the server for 1st time it gets ignored. every time after that it works great. the ClientRead event doesn't fire off at all on the 1st message what can i change on the server to make it accept the 1st message. I have no control over the client side as a 3rd party sends me messages, ut i am always missing the 1st message. thanks!
delphi
sockets
tcp
null
null
null
open
delphi tserversocket ignores 1st message === pls advise why this happens. on a simple sample server app i have the following code: procedure TForm13.ServerSocket1ClientRead(Sender: TObject; Socket: TCustomWinSocket); var str : string; begin str := socket.ReceiveText; showmessage(str); end; and on the client side i have clientsocket1.Open; clientsocket1.Socket.SendText(txtMSG.Text); nothing fancy. the strange thing is that when i send a message to the server for 1st time it gets ignored. every time after that it works great. the ClientRead event doesn't fire off at all on the 1st message what can i change on the server to make it accept the 1st message. I have no control over the client side as a 3rd party sends me messages, ut i am always missing the 1st message. thanks!
0
2,227,928
02/09/2010 09:22:12
240,334
12/29/2009 17:13:30
260
13
Fundamental software design concepts / principles books
I need to introduce basic design principles in my team. I am looking for books which are not restricted to only object oriented design principles. And which can cover concepts such as Modularity, Information hiding etc. Just for information - The implementation language for all the project in our team is C.
software-design
design
c
null
null
09/28/2011 11:31:32
not constructive
Fundamental software design concepts / principles books === I need to introduce basic design principles in my team. I am looking for books which are not restricted to only object oriented design principles. And which can cover concepts such as Modularity, Information hiding etc. Just for information - The implementation language for all the project in our team is C.
4
3,118,197
06/25/2010 13:08:07
466,534
04/21/2010 12:03:08
401
4
question about almost integer
there is given real number how find by programming if it is Almost integer? http://mathworld.wolfram.com/AlmostInteger.html thanks
algorithm
null
null
null
null
06/27/2010 04:00:32
not a real question
question about almost integer === there is given real number how find by programming if it is Almost integer? http://mathworld.wolfram.com/AlmostInteger.html thanks
1
10,882,769
06/04/2012 14:11:38
980,101
10/05/2011 09:45:48
71
4
Do the browsers have a maximum height for the body/document?
My question is, if anyone come across limitation regarding the height of a html page. If it is browser-specific (especially IE7), or maybe client-specific (memory etc.) or anything else. Any links or experiences are welcomed.
html
css
browser
null
null
06/06/2012 12:29:27
not a real question
Do the browsers have a maximum height for the body/document? === My question is, if anyone come across limitation regarding the height of a html page. If it is browser-specific (especially IE7), or maybe client-specific (memory etc.) or anything else. Any links or experiences are welcomed.
1
10,719,992
05/23/2012 12:32:20
1,355,672
04/25/2012 08:44:30
1
0
Printing The JAsper Report
I am working with the web application and i am generating the reports using jasper reports.The version i am using is JasperReports-4.5.0,spring 3.0.5RELEASE,jsp,jquery.My problem is how can i print the report using print button.The flow of my code is exactly same as http://chathurangat.blogspot.in/2012/02/jasperreport-with-spring-mvc-fully.html this link but my project is a tomcat project.In my UI i have buttons to show html format,Download PDF,Download Csv.I want to place a print button over here and when i click on this print button the report has to print.I am not at all getting an idea to do this one.Can anyone help me...
jquery
spring
jsp
jasper-reports
null
05/24/2012 22:16:35
not a real question
Printing The JAsper Report === I am working with the web application and i am generating the reports using jasper reports.The version i am using is JasperReports-4.5.0,spring 3.0.5RELEASE,jsp,jquery.My problem is how can i print the report using print button.The flow of my code is exactly same as http://chathurangat.blogspot.in/2012/02/jasperreport-with-spring-mvc-fully.html this link but my project is a tomcat project.In my UI i have buttons to show html format,Download PDF,Download Csv.I want to place a print button over here and when i click on this print button the report has to print.I am not at all getting an idea to do this one.Can anyone help me...
1
8,892,700
01/17/2012 10:03:03
1,066,826
11/26/2011 11:38:58
20
0
layer index and the opacity issue
i set the opacity property of the outer div to the .5, and i set the inner div's opacity value to be 1 but it still to be transparent at all here is the sample code: **HTML:** <div id="div1"> <div id="div2"> <div id="div3"></div> </div> </div> **CSS:** #div1{ background: black; opacity:.5; width:300px; height:300px; } #div2{ background:white; width:150px; height:150px; opacity: 1; } #div3{ display: block; width: 50px; height: 50px; opacity: 1; background: black; } so where is the problem? or anything i have miss ? help me!
html
css
opacity
transparent
null
null
open
layer index and the opacity issue === i set the opacity property of the outer div to the .5, and i set the inner div's opacity value to be 1 but it still to be transparent at all here is the sample code: **HTML:** <div id="div1"> <div id="div2"> <div id="div3"></div> </div> </div> **CSS:** #div1{ background: black; opacity:.5; width:300px; height:300px; } #div2{ background:white; width:150px; height:150px; opacity: 1; } #div3{ display: block; width: 50px; height: 50px; opacity: 1; background: black; } so where is the problem? or anything i have miss ? help me!
0
3,548,788
08/23/2010 15:00:50
6,851
09/15/2008 12:43:17
254
13
Can't import Rails plugin from GitHub
I want to use the Typus plugin in my rails application, but i can't install it. $ script/plugin install git://github.com/fesplugas/typus.git Initialized empty Git repository in /...../vendor/plugins/typus/.git/ $ script/generate typus Couldn't find 'typus' generator $ ls -al vendor/plugins/ total 0 drwxr-xr-x 2 *** staff 68 Aug 23 16:57 . drwxr-xr-x 3 *** staff 102 Aug 23 16:37 .. $ rails -v Rails 2.3.8 Any ideas?
ruby-on-rails
git
plugins
github
null
null
open
Can't import Rails plugin from GitHub === I want to use the Typus plugin in my rails application, but i can't install it. $ script/plugin install git://github.com/fesplugas/typus.git Initialized empty Git repository in /...../vendor/plugins/typus/.git/ $ script/generate typus Couldn't find 'typus' generator $ ls -al vendor/plugins/ total 0 drwxr-xr-x 2 *** staff 68 Aug 23 16:57 . drwxr-xr-x 3 *** staff 102 Aug 23 16:37 .. $ rails -v Rails 2.3.8 Any ideas?
0
9,756,596
03/18/2012 06:53:24
1,251,019
03/05/2012 23:22:24
6
0
How to jump to next frame actionscript 3
I have a memory game here. And each time a card is removed from the gameboard I have "cardCount -2", when this cardCount gets to zero, I want the program to jump to the next frame which is like a "game over" page. I've tried using gotoAndStop(); as well as nextFrame(); but it doesn't seem to be working! On my frame 1 I have the game, and on frame 2 I have the gameover page. Any help would be GREATLY appreciated! Thank you! Here is my code! package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; import flash.display.MovieClip; public class MemoryGame extends Sprite{ private var firstTile:cards; private var secondTile:cards; private var pauseTimer:Timer; private var levelTimer:Timer; private var score:int; private var cardCount:int; var numberDeck:Array = new Array(1,1,2,2,3,3,4,4,5,5,6,6); public function MemoryGame(){ score = 0; txtScore.text=": "+score; for(x=1; x<=4; x++) { for (y=1; y<=3; y++){ var randomCard = Math.floor(Math.random()*numberDeck.length); var tile:cards = new cards(); tile.card = numberDeck[randomCard]; numberDeck.splice(randomCard,1); tile.gotoAndStop(9); tile.x = (x-1) * 150; tile.y = (y-1) * 200; tile.addEventListener(MouseEvent.CLICK,tileClicked); addChild(tile); cardCount = cardCount + 1 if (cardCount == 0){ trace("GAME OVER!") trace("SCORE:" +score); } } } trace("Cardcount: "+cardCount); } public function tileClicked(event:MouseEvent) { var clicked:cards = (event.currentTarget as cards); if (firstTile == null){ firstTile = clicked; firstTile.gotoAndStop(clicked.card); } else if (secondTile == null && firstTile != clicked){ secondTile = clicked; secondTile.gotoAndStop(clicked.card); if (firstTile.card == secondTile.card){ pauseTimer = new Timer(1000, 1); pauseTimer.addEventListener(TimerEvent.TIMER_COMPLETE,removeCards); pauseTimer.start(); } else { pauseTimer = new Timer(1000, 1); pauseTimer.addEventListener(TimerEvent.TIMER_COMPLETE,resetCards); pauseTimer.start(); } } } public function resetCards(event:TimerEvent) { firstTile.gotoAndStop(9); secondTile.gotoAndStop(9); firstTile = null; secondTile = null; pauseTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,resetCards); score = score - 2; txtScore.text=": "+score; } public function removeCards(event:TimerEvent){ removeChild(firstTile); removeChild(secondTile); firstTile = null; secondTile = null; pauseTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,removeCards); score = score + 10; txtScore.text=": "+score; cardCount = cardCount - 2; trace("Cardcount: " + cardCount); if (cardCount == 0){ //NEXT FRAME CODE HERE! trace("GAME OVER!") trace("SCORE:" +score); } } } }
actionscript-3
null
null
null
null
null
open
How to jump to next frame actionscript 3 === I have a memory game here. And each time a card is removed from the gameboard I have "cardCount -2", when this cardCount gets to zero, I want the program to jump to the next frame which is like a "game over" page. I've tried using gotoAndStop(); as well as nextFrame(); but it doesn't seem to be working! On my frame 1 I have the game, and on frame 2 I have the gameover page. Any help would be GREATLY appreciated! Thank you! Here is my code! package { import flash.display.Sprite; import flash.events.MouseEvent; import flash.events.TimerEvent; import flash.utils.Timer; import flash.display.MovieClip; public class MemoryGame extends Sprite{ private var firstTile:cards; private var secondTile:cards; private var pauseTimer:Timer; private var levelTimer:Timer; private var score:int; private var cardCount:int; var numberDeck:Array = new Array(1,1,2,2,3,3,4,4,5,5,6,6); public function MemoryGame(){ score = 0; txtScore.text=": "+score; for(x=1; x<=4; x++) { for (y=1; y<=3; y++){ var randomCard = Math.floor(Math.random()*numberDeck.length); var tile:cards = new cards(); tile.card = numberDeck[randomCard]; numberDeck.splice(randomCard,1); tile.gotoAndStop(9); tile.x = (x-1) * 150; tile.y = (y-1) * 200; tile.addEventListener(MouseEvent.CLICK,tileClicked); addChild(tile); cardCount = cardCount + 1 if (cardCount == 0){ trace("GAME OVER!") trace("SCORE:" +score); } } } trace("Cardcount: "+cardCount); } public function tileClicked(event:MouseEvent) { var clicked:cards = (event.currentTarget as cards); if (firstTile == null){ firstTile = clicked; firstTile.gotoAndStop(clicked.card); } else if (secondTile == null && firstTile != clicked){ secondTile = clicked; secondTile.gotoAndStop(clicked.card); if (firstTile.card == secondTile.card){ pauseTimer = new Timer(1000, 1); pauseTimer.addEventListener(TimerEvent.TIMER_COMPLETE,removeCards); pauseTimer.start(); } else { pauseTimer = new Timer(1000, 1); pauseTimer.addEventListener(TimerEvent.TIMER_COMPLETE,resetCards); pauseTimer.start(); } } } public function resetCards(event:TimerEvent) { firstTile.gotoAndStop(9); secondTile.gotoAndStop(9); firstTile = null; secondTile = null; pauseTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,resetCards); score = score - 2; txtScore.text=": "+score; } public function removeCards(event:TimerEvent){ removeChild(firstTile); removeChild(secondTile); firstTile = null; secondTile = null; pauseTimer.removeEventListener(TimerEvent.TIMER_COMPLETE,removeCards); score = score + 10; txtScore.text=": "+score; cardCount = cardCount - 2; trace("Cardcount: " + cardCount); if (cardCount == 0){ //NEXT FRAME CODE HERE! trace("GAME OVER!") trace("SCORE:" +score); } } } }
0
4,250,251
11/22/2010 21:08:56
492,203
10/30/2010 14:46:04
50
12
Console Counter
I've made a simple counter that runs in the console (i.e. Firebug), but I don't know how to set the thresolds (hours = 59, minutes = 59, seconds = 59, milliseconds = 999). Please help me! http://fiddle.jshell.net/Nyuszika7H/p4fdZ/
javascript
jquery
null
null
null
null
open
Console Counter === I've made a simple counter that runs in the console (i.e. Firebug), but I don't know how to set the thresolds (hours = 59, minutes = 59, seconds = 59, milliseconds = 999). Please help me! http://fiddle.jshell.net/Nyuszika7H/p4fdZ/
0
10,806,899
05/29/2012 21:22:10
1,003,583
10/19/2011 16:11:12
13
1
After playing a youtube-video in an UIWebView, the app starts from beginning
i'm using the following code, so load a Youtube video in my UIWebView (Outlet): NSString *videoUrl = [self getVideoURL]; NSString *htmlString = [NSString stringWithFormat:@"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 280\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"280\" height=\"156\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"280\" height=\"156\"></embed></object></div></body></html>",videoUrl,videoUrl] ; [videoView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]]; all this works fine. but after watching the video and tapping on "done", my app starts new from beginning... but i don't understand why. hope someone can give me a hint why this is happening?
ios
uiwebview
youtube
youtube-api
null
null
open
After playing a youtube-video in an UIWebView, the app starts from beginning === i'm using the following code, so load a Youtube video in my UIWebView (Outlet): NSString *videoUrl = [self getVideoURL]; NSString *htmlString = [NSString stringWithFormat:@"<html><head><meta name = \"viewport\" content = \"initial-scale = 1.0, user-scalable = no, width = 280\"/></head><body style=\"background:#F00;margin-top:0px;margin-left:0px\"><div><object width=\"280\" height=\"156\"><param name=\"movie\" value=\"%@\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"%@\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"280\" height=\"156\"></embed></object></div></body></html>",videoUrl,videoUrl] ; [videoView loadHTMLString:htmlString baseURL:[NSURL URLWithString:@"http://www.youtube.com"]]; all this works fine. but after watching the video and tapping on "done", my app starts new from beginning... but i don't understand why. hope someone can give me a hint why this is happening?
0
6,479,661
06/25/2011 18:15:22
774,469
05/28/2011 15:58:55
1
0
Running executable in C code
I am writing in C (not C++) on a Mac. I want to be able to run a UNIX executable from C, something like this: #include <some-wacky-header.h> int main (int argc, char * argv[]) { int r = some_wacky_executable_run(path_to_my_file_as_char_array); return 0; } NOTE: I don't want to use the `system()` command to run the executable.
c
osx
run
null
null
06/27/2011 17:57:30
not a real question
Running executable in C code === I am writing in C (not C++) on a Mac. I want to be able to run a UNIX executable from C, something like this: #include <some-wacky-header.h> int main (int argc, char * argv[]) { int r = some_wacky_executable_run(path_to_my_file_as_char_array); return 0; } NOTE: I don't want to use the `system()` command to run the executable.
1
9,239,479
02/11/2012 10:27:05
1,121,327
12/29/2011 14:11:37
1
0
Slowed my site after using mod_rewrite in php
How can i improve my site speed...Or i should use another method for changing .php extension. <a href="http://www.swapnice.tk/how">Check this url</a>.It contains only the following code. `<html><body>haiiii</body></html>`
php
performance
null
null
null
02/11/2012 10:52:17
not a real question
Slowed my site after using mod_rewrite in php === How can i improve my site speed...Or i should use another method for changing .php extension. <a href="http://www.swapnice.tk/how">Check this url</a>.It contains only the following code. `<html><body>haiiii</body></html>`
1
5,113,668
02/25/2011 04:37:48
633,563
02/25/2011 04:34:11
1
0
Ethical Hacking(Book to learn)
I want to work in the security field. What is a good book to learn ethical hacking skills. I was looking at this book: http://www.amazon.com/Gray-Hacking-Ethical-Hackers-Handbook/dp/0071742557/ref=sr_1_1?ie=UTF8&qid=1298608638&sr=8-1
hacking
null
null
null
null
02/25/2011 05:00:05
off topic
Ethical Hacking(Book to learn) === I want to work in the security field. What is a good book to learn ethical hacking skills. I was looking at this book: http://www.amazon.com/Gray-Hacking-Ethical-Hackers-Handbook/dp/0071742557/ref=sr_1_1?ie=UTF8&qid=1298608638&sr=8-1
2
9,435,198
02/24/2012 17:24:44
570,339
01/10/2011 19:55:34
116
4
Unwanted software installed accidentally
On ubuntu 10.10 I accidentally added to repository two programs that had the goal to reproduce a bug.I didn't want to install them, so I kept them in repository and (didn't know how to remove them) when I was upgrading the repository using update manager, I was taking out the mark, so that I was skipping the installation every time. But yesterday I upgraded the repository using the _upgrade_ command from terminal. So I accidentally (also) installed these two programs. I tried to use _dpkg_ command to try uninstalling them: dpkg -l dpkg -l | grep "manage the repository" The title of the software I was seeing in update manager was "manage the repository to install software from". However giving these two commands didn't help me seeing the real name of these two programs. So I don't know the name of the programs to remove. I would know if there is a command [b]to see which are the programs I installed in chronological order[/b].Is that possible?
repository
ubuntu-10.10
null
null
null
null
open
Unwanted software installed accidentally === On ubuntu 10.10 I accidentally added to repository two programs that had the goal to reproduce a bug.I didn't want to install them, so I kept them in repository and (didn't know how to remove them) when I was upgrading the repository using update manager, I was taking out the mark, so that I was skipping the installation every time. But yesterday I upgraded the repository using the _upgrade_ command from terminal. So I accidentally (also) installed these two programs. I tried to use _dpkg_ command to try uninstalling them: dpkg -l dpkg -l | grep "manage the repository" The title of the software I was seeing in update manager was "manage the repository to install software from". However giving these two commands didn't help me seeing the real name of these two programs. So I don't know the name of the programs to remove. I would know if there is a command [b]to see which are the programs I installed in chronological order[/b].Is that possible?
0
4,733,606
01/19/2011 09:30:23
296,346
03/18/2010 09:14:16
426
52
mysql and php suddenly case-sensetive?!
Basically, I've changed something in my php login code and now when I log in, the MySQL requires that the case matches?! $match = "select * from users where username = '".$username."' and password = '".$password."';"; echo $match; If my username's CaSe doesn't match the database then it doesn't return any rows. If a user registers as ADMIN then I want them to be able to log in as "admin" or "AdMiN" etc. any ideas? Many thanks :)
php
mysql
case-insensitive
null
null
null
open
mysql and php suddenly case-sensetive?! === Basically, I've changed something in my php login code and now when I log in, the MySQL requires that the case matches?! $match = "select * from users where username = '".$username."' and password = '".$password."';"; echo $match; If my username's CaSe doesn't match the database then it doesn't return any rows. If a user registers as ADMIN then I want them to be able to log in as "admin" or "AdMiN" etc. any ideas? Many thanks :)
0
8,775,868
01/08/2012 06:41:53
1,043,612
11/12/2011 21:47:16
61
2
Submit form, then send form data to ajax from a new page
I have a form on page1.php which redirects to page2.php, I want to pass the data from the form to page3.php immediately on load of page2.php. (the user doesn't need to see what's going on in page3, only page2) What should I use to pass the variables? Currently I'm using page1.php <html> <form action=page2.php method=post> <!-- form content here incl name attr for input elements --> </form> </html> page2.php <body> <?php $var1 = $_POST['name1']; // int $var2 = $_POST['name2']; // int $var3 = $_POST['name3']; // int $var4 = $_POST['name4']; // str ?> <!-- some code here --> <script> var var1 = <?php echo $var1; ?>; var var2 = <?php echo $var2; ?>; var var3 = <?php echo $var3; ?>; var var4 = "<?php echo $var4; ?>"; $.post('page3.php',{var1: var1, var2: var2, var3: var3, var4: var4}); </script> </body> page3.php <?php $var1 = $_POST['var1']; $var2 = $_POST['var2']; $var3 = $_POST['var3']; $var4 = $_POST['var4']; ?> a. This seems like way too much to me, are there any jquery shortcuts? How can I use serialize to help me? b. this isn't working entirely... I think there's some problem with the $.post, maybe I'm not triggering it well? I am not sure. Help would be appreciated.
php
jquery
ajax
forms
php5
null
open
Submit form, then send form data to ajax from a new page === I have a form on page1.php which redirects to page2.php, I want to pass the data from the form to page3.php immediately on load of page2.php. (the user doesn't need to see what's going on in page3, only page2) What should I use to pass the variables? Currently I'm using page1.php <html> <form action=page2.php method=post> <!-- form content here incl name attr for input elements --> </form> </html> page2.php <body> <?php $var1 = $_POST['name1']; // int $var2 = $_POST['name2']; // int $var3 = $_POST['name3']; // int $var4 = $_POST['name4']; // str ?> <!-- some code here --> <script> var var1 = <?php echo $var1; ?>; var var2 = <?php echo $var2; ?>; var var3 = <?php echo $var3; ?>; var var4 = "<?php echo $var4; ?>"; $.post('page3.php',{var1: var1, var2: var2, var3: var3, var4: var4}); </script> </body> page3.php <?php $var1 = $_POST['var1']; $var2 = $_POST['var2']; $var3 = $_POST['var3']; $var4 = $_POST['var4']; ?> a. This seems like way too much to me, are there any jquery shortcuts? How can I use serialize to help me? b. this isn't working entirely... I think there's some problem with the $.post, maybe I'm not triggering it well? I am not sure. Help would be appreciated.
0
4,954,848
02/10/2011 08:29:14
113,418
05/27/2009 21:44:59
15
4
Wordpress: Your favorite permalinks structure - efficient / seo friendly
I am using wordpress permalink format: */year/month/postname* in my [wordpress blog][1]. Most of the blog posts that I write are tutorials / how-tos. So it doesn't make sense to organize on based of date. I would like to know your comments / suggestions on how do you organize your urls in wordpress. I know wordpress does not recommended permalink based on category name: /category/postname, but I would like to organize urls based on categories without affecting blob performance. - /year/month/postname -> good - /postid/postname -> good - /category/postname -> bad - /author/postname -> bad Please give your feedback on your favorite permalink structure keeping both performance and seo in mind. Thanks [1]: http://viralpatel.net
wordpress
performance
seo-friendly
permalinks
null
04/27/2011 03:35:52
off topic
Wordpress: Your favorite permalinks structure - efficient / seo friendly === I am using wordpress permalink format: */year/month/postname* in my [wordpress blog][1]. Most of the blog posts that I write are tutorials / how-tos. So it doesn't make sense to organize on based of date. I would like to know your comments / suggestions on how do you organize your urls in wordpress. I know wordpress does not recommended permalink based on category name: /category/postname, but I would like to organize urls based on categories without affecting blob performance. - /year/month/postname -> good - /postid/postname -> good - /category/postname -> bad - /author/postname -> bad Please give your feedback on your favorite permalink structure keeping both performance and seo in mind. Thanks [1]: http://viralpatel.net
2
11,221,968
06/27/2012 08:13:00
1,231,822
02/24/2012 23:00:42
16
0
Learn Struts or EJB first?
I am an intermediate java programmer. Know how to use class, interface, enum. Know how to create GUI event-driven application. Right now I want to know about Struts, EJB, and java web programming. According to your experience, which skill should I focused first? And what requirement do I need to have to smooth my study on that skill? ps. I am undergraduate student.
java
null
null
null
null
06/27/2012 08:44:25
not constructive
Learn Struts or EJB first? === I am an intermediate java programmer. Know how to use class, interface, enum. Know how to create GUI event-driven application. Right now I want to know about Struts, EJB, and java web programming. According to your experience, which skill should I focused first? And what requirement do I need to have to smooth my study on that skill? ps. I am undergraduate student.
4
3,066,590
06/18/2010 00:55:04
369,898
06/18/2010 00:55:04
1
0
Gui problem after rewriting to MVC
I'm practicing MVC style programming. I have a Mastermind game in a single file, working with no problems (maybe apart of the fact that "Check" button is invisible at start). http://paste.pocoo.org/show/226726/ But when I've rewritten it to model, view, controller files - when I click on empty Pin (that should be updated, and repainted with new color) - noting happens. Can anybody see any problems here ? I've tried placing repaint() in different places, but it simply does not work at all :/ Main : public class Main { public static void main(String[] args){ Model model = new Model(); View view = new View("Mastermind", 400, 590, model); Controller controller = new Controller(model, view); view.setVisible(true); } } Model : import java.util.Random; public class Model{ static final int LINE = 5, SCORE = 10, OPTIONS = 20; Pin pins[][] = new Pin[21][LINE]; int combination[] = new int[LINE]; int curPin = 0; int turn = 1; Random generator = new Random(); int repaintPin; boolean pinsRepaint=false; int pinsToRepaint; boolean isUpdate = true, isPlaying = true, isRowFull = false; static final int HIT_X[] = {270,290,310,290,310}, HIT_Y[] = {506,496,496,516,516}; public Model(){ for ( int i=0; i < SCORE; i++ ){ for ( int j = 0; j < LINE; j++ ){ pins[i][j] = new Pin(20,0); pins[i][j].setPosition(j*50+30,510-i*50); pins[i+SCORE][j] = new Pin(8,0); pins[i+SCORE][j].setPosition(HIT_X[j],HIT_Y[j]-i*50); } } for ( int i=0; i < LINE; i++ ){ pins[OPTIONS][i] = new Pin( 20, i+2 ); pins[OPTIONS][i].setPosition( 370,i * 50 + 56); } } void fillHole(int color) { pins[turn-1][curPin].setColor(color+1); pinsRepaint = true; pinsToRepaint = turn; curPin = (curPin+1) % LINE; if (curPin == 0){ isRowFull = true; } pinsRepaint = false; pinsToRepaint = 0; } void check() { int junkPins[] = new int[LINE], junkCode[] = new int[LINE]; int pinCount = 0, pico = 0; for ( int i = 0; i < LINE; i++ ) { junkPins[i] = pins[turn-1][i].getColor(); junkCode[i] = combination[i]; } for ( int i = 0; i < LINE; i++ ){ if (junkPins[i]==junkCode[i]) { pins[turn+SCORE][pinCount].setColor(1); pinCount++; pico++; junkPins[i] = 98; junkCode[i] = 99; } } for ( int i = 0; i < LINE; i++ ){ for ( int j = 0; j < LINE; j++ ) if (junkPins[i]==junkCode[j]) { pins[turn+SCORE][pinCount].setColor(2); pinCount++; junkPins[i] = 98; junkCode[j] = 99; j = LINE; } } pinsRepaint = true; pinsToRepaint = turn + SCORE; pinsRepaint = false; pinsToRepaint=0; if ( pico == LINE ){ isPlaying = false; } else if ( turn >= 10 ){ isPlaying = false; } else{ curPin = 0; isRowFull = false; turn++; } } void combination() { for ( int i = 0; i < LINE; i++ ){ combination[i] = generator.nextInt(6) + 1; } } } class Pin{ private int color, X, Y, radius; public Pin(){ X = 0; Y = 0; radius = 0; color = 0; } public Pin( int r,int c ){ X = 0; Y = 0; radius = r; color = c; } public int getX(){ return X; } public int getY(){ return Y; } public int getRadius(){ return radius; } public void setRadius(int r){ radius = r; } public void setPosition( int x,int y ){ this.X = x ; this.Y = y ; } public void setColor( int c ){ color = c; } public int getColor() { return color; } } View: import java.awt.*; import javax.swing.*; public class View extends Frame{ Model model; JButton checkAnswer; private JPanel button; private static final Color COLORS[] = {Color.black, Color.white, Color.red, Color.yellow, Color.green, Color.blue, new Color(7, 254, 250)}; public View(String name, int w, int h, Model m){ model = m; setTitle( name ); setSize( w,h ); setResizable( false ); this.setLayout(new BorderLayout()); button = new JPanel(); button.setSize( new Dimension(400, 100)); button.setVisible(true); checkAnswer = new JButton("Check"); checkAnswer.setSize( new Dimension(200, 30)); button.add( checkAnswer ); this.add( button, BorderLayout.SOUTH); button.setVisible(true); } @Override public void paint( Graphics g ) { g.setColor( new Color(238, 238, 238)); g.fillRect( 0,0,400,590); for ( int i=0; i < model.pins.length; i++ ) { paintPins(model.pins[i][0],g); paintPins(model.pins[i][1],g); paintPins(model.pins[i][2],g); paintPins(model.pins[i][3],g); paintPins(model.pins[i][4],g); } } @Override public void update( Graphics g ) { if ( model.isUpdate ) { paint(g); } else { model.isUpdate = true; paintPins(model.pins[model.repaintPin-1][0],g); paintPins(model.pins[model.repaintPin-1][1],g); paintPins(model.pins[model.repaintPin-1][2],g); paintPins(model.pins[model.repaintPin-1][3],g); paintPins(model.pins[model.repaintPin-1][4],g); } } void repaintPins( int pin ) { model.repaintPin = pin; model.isUpdate = false; repaint(); } public void paintPins(Pin p, Graphics g ){ int X = p.getX(); int Y = p.getY(); int color = p.getColor(); int radius = p.getRadius(); int x = X-radius; int y = Y-radius; if (color > 0){ g.setColor( COLORS[color]); g.fillOval( x,y,2*radius,2*radius ); } else{ g.setColor( new Color(238, 238, 238) ); g.drawOval( x,y,2*radius-1,2*radius-1 ); } g.setColor( Color.black ); g.drawOval( x,y,2*radius,2*radius ); } } Controller: import java.awt.*; import java.awt.event.*; public class Controller implements MouseListener, ActionListener { private Model model; private View view; public Controller(Model m, View v){ model = m; view = v; view.addWindowListener( new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); view.addMouseListener(this); view.checkAnswer.addActionListener(this); model.combination(); } public void actionPerformed( ActionEvent e ) { if(e.getSource() == view.checkAnswer){ if(model.isRowFull){ model.check(); } } } public void mousePressed(MouseEvent e) { Point mouse = new Point(); mouse = e.getPoint(); if (model.isPlaying){ if (mouse.x > 350) { int button = 1 + (int)((mouse.y - 32) / 50); if ((button >= 1) && (button <= 5)){ model.fillHole(button); if(model.pinsRepaint){ view.repaintPins( model.pinsToRepaint ); } } } } } public void mouseClicked(MouseEvent e) {} public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }
java
mvc
gui
null
null
null
open
Gui problem after rewriting to MVC === I'm practicing MVC style programming. I have a Mastermind game in a single file, working with no problems (maybe apart of the fact that "Check" button is invisible at start). http://paste.pocoo.org/show/226726/ But when I've rewritten it to model, view, controller files - when I click on empty Pin (that should be updated, and repainted with new color) - noting happens. Can anybody see any problems here ? I've tried placing repaint() in different places, but it simply does not work at all :/ Main : public class Main { public static void main(String[] args){ Model model = new Model(); View view = new View("Mastermind", 400, 590, model); Controller controller = new Controller(model, view); view.setVisible(true); } } Model : import java.util.Random; public class Model{ static final int LINE = 5, SCORE = 10, OPTIONS = 20; Pin pins[][] = new Pin[21][LINE]; int combination[] = new int[LINE]; int curPin = 0; int turn = 1; Random generator = new Random(); int repaintPin; boolean pinsRepaint=false; int pinsToRepaint; boolean isUpdate = true, isPlaying = true, isRowFull = false; static final int HIT_X[] = {270,290,310,290,310}, HIT_Y[] = {506,496,496,516,516}; public Model(){ for ( int i=0; i < SCORE; i++ ){ for ( int j = 0; j < LINE; j++ ){ pins[i][j] = new Pin(20,0); pins[i][j].setPosition(j*50+30,510-i*50); pins[i+SCORE][j] = new Pin(8,0); pins[i+SCORE][j].setPosition(HIT_X[j],HIT_Y[j]-i*50); } } for ( int i=0; i < LINE; i++ ){ pins[OPTIONS][i] = new Pin( 20, i+2 ); pins[OPTIONS][i].setPosition( 370,i * 50 + 56); } } void fillHole(int color) { pins[turn-1][curPin].setColor(color+1); pinsRepaint = true; pinsToRepaint = turn; curPin = (curPin+1) % LINE; if (curPin == 0){ isRowFull = true; } pinsRepaint = false; pinsToRepaint = 0; } void check() { int junkPins[] = new int[LINE], junkCode[] = new int[LINE]; int pinCount = 0, pico = 0; for ( int i = 0; i < LINE; i++ ) { junkPins[i] = pins[turn-1][i].getColor(); junkCode[i] = combination[i]; } for ( int i = 0; i < LINE; i++ ){ if (junkPins[i]==junkCode[i]) { pins[turn+SCORE][pinCount].setColor(1); pinCount++; pico++; junkPins[i] = 98; junkCode[i] = 99; } } for ( int i = 0; i < LINE; i++ ){ for ( int j = 0; j < LINE; j++ ) if (junkPins[i]==junkCode[j]) { pins[turn+SCORE][pinCount].setColor(2); pinCount++; junkPins[i] = 98; junkCode[j] = 99; j = LINE; } } pinsRepaint = true; pinsToRepaint = turn + SCORE; pinsRepaint = false; pinsToRepaint=0; if ( pico == LINE ){ isPlaying = false; } else if ( turn >= 10 ){ isPlaying = false; } else{ curPin = 0; isRowFull = false; turn++; } } void combination() { for ( int i = 0; i < LINE; i++ ){ combination[i] = generator.nextInt(6) + 1; } } } class Pin{ private int color, X, Y, radius; public Pin(){ X = 0; Y = 0; radius = 0; color = 0; } public Pin( int r,int c ){ X = 0; Y = 0; radius = r; color = c; } public int getX(){ return X; } public int getY(){ return Y; } public int getRadius(){ return radius; } public void setRadius(int r){ radius = r; } public void setPosition( int x,int y ){ this.X = x ; this.Y = y ; } public void setColor( int c ){ color = c; } public int getColor() { return color; } } View: import java.awt.*; import javax.swing.*; public class View extends Frame{ Model model; JButton checkAnswer; private JPanel button; private static final Color COLORS[] = {Color.black, Color.white, Color.red, Color.yellow, Color.green, Color.blue, new Color(7, 254, 250)}; public View(String name, int w, int h, Model m){ model = m; setTitle( name ); setSize( w,h ); setResizable( false ); this.setLayout(new BorderLayout()); button = new JPanel(); button.setSize( new Dimension(400, 100)); button.setVisible(true); checkAnswer = new JButton("Check"); checkAnswer.setSize( new Dimension(200, 30)); button.add( checkAnswer ); this.add( button, BorderLayout.SOUTH); button.setVisible(true); } @Override public void paint( Graphics g ) { g.setColor( new Color(238, 238, 238)); g.fillRect( 0,0,400,590); for ( int i=0; i < model.pins.length; i++ ) { paintPins(model.pins[i][0],g); paintPins(model.pins[i][1],g); paintPins(model.pins[i][2],g); paintPins(model.pins[i][3],g); paintPins(model.pins[i][4],g); } } @Override public void update( Graphics g ) { if ( model.isUpdate ) { paint(g); } else { model.isUpdate = true; paintPins(model.pins[model.repaintPin-1][0],g); paintPins(model.pins[model.repaintPin-1][1],g); paintPins(model.pins[model.repaintPin-1][2],g); paintPins(model.pins[model.repaintPin-1][3],g); paintPins(model.pins[model.repaintPin-1][4],g); } } void repaintPins( int pin ) { model.repaintPin = pin; model.isUpdate = false; repaint(); } public void paintPins(Pin p, Graphics g ){ int X = p.getX(); int Y = p.getY(); int color = p.getColor(); int radius = p.getRadius(); int x = X-radius; int y = Y-radius; if (color > 0){ g.setColor( COLORS[color]); g.fillOval( x,y,2*radius,2*radius ); } else{ g.setColor( new Color(238, 238, 238) ); g.drawOval( x,y,2*radius-1,2*radius-1 ); } g.setColor( Color.black ); g.drawOval( x,y,2*radius,2*radius ); } } Controller: import java.awt.*; import java.awt.event.*; public class Controller implements MouseListener, ActionListener { private Model model; private View view; public Controller(Model m, View v){ model = m; view = v; view.addWindowListener( new WindowAdapter(){ public void windowClosing(WindowEvent e){ System.exit(0); } }); view.addMouseListener(this); view.checkAnswer.addActionListener(this); model.combination(); } public void actionPerformed( ActionEvent e ) { if(e.getSource() == view.checkAnswer){ if(model.isRowFull){ model.check(); } } } public void mousePressed(MouseEvent e) { Point mouse = new Point(); mouse = e.getPoint(); if (model.isPlaying){ if (mouse.x > 350) { int button = 1 + (int)((mouse.y - 32) / 50); if ((button >= 1) && (button <= 5)){ model.fillHole(button); if(model.pinsRepaint){ view.repaintPins( model.pinsToRepaint ); } } } } } public void mouseClicked(MouseEvent e) {} public void mouseReleased(MouseEvent e){} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} }
0
10,739,569
05/24/2012 14:31:10
876,716
08/03/2011 13:42:43
41
0
How save a variable from session and get when session is null?
I Write into a session user login. I need to get user login on server side page when a session is dropped. I try: private string currentUserLogin; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (HttpContext.Current.Session["curUserRole"] == null) { // try to get a "currentUserLogin" varialbe, but it null! } else { currentUserLogin = HttpContext.Current.Session["curUserLogin"].ToString(); } } }
c#
asp.net
.net
null
null
null
open
How save a variable from session and get when session is null? === I Write into a session user login. I need to get user login on server side page when a session is dropped. I try: private string currentUserLogin; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (HttpContext.Current.Session["curUserRole"] == null) { // try to get a "currentUserLogin" varialbe, but it null! } else { currentUserLogin = HttpContext.Current.Session["curUserLogin"].ToString(); } } }
0
3,857,440
10/04/2010 17:02:24
291,772
03/11/2010 18:38:45
1,462
30
Zebra widget doesn't work, if i have a child table?
I have a problems with the JQuery [tablesorter][1] plugin. I use "zebra" widget, but it doesn't work if i have another table in the main table. $("#selection_table").tablesorter( { widgets: ['zebra'] }) if i have another table somewhere in the `selection_table`, zebra widget stop working properly. Is there a way to fix such behavior? Thanks much [1]: http://tablesorter.com/docs/#Demo
jquery
plugins
tablesorter
null
null
null
open
Zebra widget doesn't work, if i have a child table? === I have a problems with the JQuery [tablesorter][1] plugin. I use "zebra" widget, but it doesn't work if i have another table in the main table. $("#selection_table").tablesorter( { widgets: ['zebra'] }) if i have another table somewhere in the `selection_table`, zebra widget stop working properly. Is there a way to fix such behavior? Thanks much [1]: http://tablesorter.com/docs/#Demo
0
9,533,024
03/02/2012 12:07:58
844,039
07/14/2011 07:24:36
73
4
how to create a good gui for welcome screen
I am trying to create a logo with white screen butI don't know if there is a simple wayto do it on android.And yes I know that I have --->http://www.droiddraw.org/ but still it dosent help me.and if I create it how it can work on some mobiles because of the screen size thanks
android
gui
null
null
null
03/05/2012 04:43:29
not a real question
how to create a good gui for welcome screen === I am trying to create a logo with white screen butI don't know if there is a simple wayto do it on android.And yes I know that I have --->http://www.droiddraw.org/ but still it dosent help me.and if I create it how it can work on some mobiles because of the screen size thanks
1
10,648,097
05/18/2012 07:00:28
523,507
11/29/2010 05:52:04
1,691
54
design UI for iPhone retina
what is a better approach when designing the artwork for my iPhone app, design in a 320 width screen and when exporting, export in normal and double the size [w: 640 px : @2x] or design in a 640 width, and export in that size and half the size for prior retina?? thanks!
iphone
retinadisplay
null
null
null
05/19/2012 01:39:01
not constructive
design UI for iPhone retina === what is a better approach when designing the artwork for my iPhone app, design in a 320 width screen and when exporting, export in normal and double the size [w: 640 px : @2x] or design in a 640 width, and export in that size and half the size for prior retina?? thanks!
4
6,836,146
07/26/2011 20:26:29
42,239
12/01/2008 20:24:10
53
1
Linq against Entity Framework 4.1 Code First producing LEFT OUTER JOIN
I don't know if this is the best way to form this linq query, but I'm just getting started so any advice is appreciated. The following query I think says "Reports that have any items where the items have any attibutes where the sizing attribute's waiste size property is 32." return the Report's Location Key, ID and Name. (Location is a foreign key from Report.) var rpts = from x in ctx.Reports where x.ReportItems.Any(y => y.ItemAttributes.Any(z => z.Sizing.WaistSize == 32)) select new { x.Key, x.Location.ID, x.Location.Name }; This produces the desired results but the SQL doesn't seem right to me. Notice the LEFT OUTER JOIN to get the Location Name, when it could have just gotten it from the first INNER JOIN to the same table... SELECT [Extent1].[ReportKey] AS [ReportKey], [Extent2].[LocationID] AS [LocationID], [Extent3].[LocationName] AS [LocationName] FROM [Info].[Report] AS [Extent1] INNER JOIN [Info].[Location] AS [Extent2] ON [Extent1].[LocationKey] = [Extent2].[LocationKey] LEFT OUTER JOIN [Info].[Location] AS [Extent3] ON [Extent1].[LocationKey] = [Extent3].[LocationKey] WHERE EXISTS (SELECT 1 AS [C1] FROM ( SELECT [Extent4].[ReportItemKey] AS [ReportItemKey] FROM [Info].[ReportItems] AS [Extent4] WHERE [Extent1].[ReportKey] = [Extent4].[ReportKey] ) AS [Project1] WHERE EXISTS (SELECT 1 AS [C1] FROM [Info].[ItemAttributes] AS [Extent5] INNER JOIN [Info].[Attributes] AS [Extent6] ON [Extent5].[AttributeKey] = [Extent6].[AttributeKey] WHERE ([Project1].[ReportItemKey] = [Extent5].[ReportItemKey]) AND ([Extent6].[WaistSize] = @p__linq__0) ) ) Thanks for the time.
linq-to-entities
entity-framework-4.1
null
null
null
null
open
Linq against Entity Framework 4.1 Code First producing LEFT OUTER JOIN === I don't know if this is the best way to form this linq query, but I'm just getting started so any advice is appreciated. The following query I think says "Reports that have any items where the items have any attibutes where the sizing attribute's waiste size property is 32." return the Report's Location Key, ID and Name. (Location is a foreign key from Report.) var rpts = from x in ctx.Reports where x.ReportItems.Any(y => y.ItemAttributes.Any(z => z.Sizing.WaistSize == 32)) select new { x.Key, x.Location.ID, x.Location.Name }; This produces the desired results but the SQL doesn't seem right to me. Notice the LEFT OUTER JOIN to get the Location Name, when it could have just gotten it from the first INNER JOIN to the same table... SELECT [Extent1].[ReportKey] AS [ReportKey], [Extent2].[LocationID] AS [LocationID], [Extent3].[LocationName] AS [LocationName] FROM [Info].[Report] AS [Extent1] INNER JOIN [Info].[Location] AS [Extent2] ON [Extent1].[LocationKey] = [Extent2].[LocationKey] LEFT OUTER JOIN [Info].[Location] AS [Extent3] ON [Extent1].[LocationKey] = [Extent3].[LocationKey] WHERE EXISTS (SELECT 1 AS [C1] FROM ( SELECT [Extent4].[ReportItemKey] AS [ReportItemKey] FROM [Info].[ReportItems] AS [Extent4] WHERE [Extent1].[ReportKey] = [Extent4].[ReportKey] ) AS [Project1] WHERE EXISTS (SELECT 1 AS [C1] FROM [Info].[ItemAttributes] AS [Extent5] INNER JOIN [Info].[Attributes] AS [Extent6] ON [Extent5].[AttributeKey] = [Extent6].[AttributeKey] WHERE ([Project1].[ReportItemKey] = [Extent5].[ReportItemKey]) AND ([Extent6].[WaistSize] = @p__linq__0) ) ) Thanks for the time.
0
6,745,608
07/19/2011 10:18:41
680,865
03/28/2011 19:39:15
22
0
verifying dates in T-SQL
My Enddate is 2009-05-31 (using sql server) @EndDate datetime select startdate = dateadd(mm,-12,@EndDate) If my EndDate = 2009-05-31 with code above will my StartDate = 31-05-2008 is my code correct? I want my senddate to be in the month of April so month(senddate) = month(dateadd(day,-1,dateadd(mm,-1,@EndDate)) is my code above correct?
sql
sql-server-2005
tsql
null
null
07/19/2011 11:58:45
not a real question
verifying dates in T-SQL === My Enddate is 2009-05-31 (using sql server) @EndDate datetime select startdate = dateadd(mm,-12,@EndDate) If my EndDate = 2009-05-31 with code above will my StartDate = 31-05-2008 is my code correct? I want my senddate to be in the month of April so month(senddate) = month(dateadd(day,-1,dateadd(mm,-1,@EndDate)) is my code above correct?
1
292,338
11/15/2008 09:24:17
11,602
09/16/2008 09:24:46
299
23
Which are the most important Math skills in order to better understand cryptography?
I need to have a better understanding of cryptography, specially the mathematics behind some of the core concepts. However, my High School Maths knowledge has gone a bit blunt, and so I was wondering which topics I should revisit for this purpose?
cryptography
math
career-development
null
null
05/19/2012 14:23:56
not constructive
Which are the most important Math skills in order to better understand cryptography? === I need to have a better understanding of cryptography, specially the mathematics behind some of the core concepts. However, my High School Maths knowledge has gone a bit blunt, and so I was wondering which topics I should revisit for this purpose?
4
11,634,525
07/24/2012 15:44:11
723,721
04/25/2011 12:37:06
837
27
Is there a timeout for a query over database link?
**Motivation:** I've had one query running "forever" (more than 2 days, until I killed the session), which was using a database link. Problem seemed to be that the remote database became unavailable and for some yet unkown reason no `ORA-02068` was raised (not to be discussed here) and the query just waited and waited. I've simulated this situation by putting one of my test DBs in quiesce mode and queried it over a database link. As anticipated, the query was waiting until either manually cancelled or the remote DB was unquiesced. **Question:** I have no control over the remote database's behaviour and uptime, so I am in search for some possibility to set a timeout on a query which is using a database link. I've already looked into profiles (`CPU_PER_CALL` etc) and `sqlnet.ora` parameters, but they either work for busy or idle sessions, but not for sessions in wait. So I am in search for some option on the "local" side of the database link, which kind of sets a timeout for queries over database links. Some solution like `alter session set xyz` or `select ... from a@b "wait 100" --(yes, I know this syntax doesn't exist)` would be appreciated, as I have no DBA rights on these particular DBs. I'm currently on 10gR2 but upgrading to 11gR2 in a few weeks, so ideas for any of these versions will be useful.
oracle
oracle10g
timeout
oracle11g
null
07/26/2012 12:40:44
off topic
Is there a timeout for a query over database link? === **Motivation:** I've had one query running "forever" (more than 2 days, until I killed the session), which was using a database link. Problem seemed to be that the remote database became unavailable and for some yet unkown reason no `ORA-02068` was raised (not to be discussed here) and the query just waited and waited. I've simulated this situation by putting one of my test DBs in quiesce mode and queried it over a database link. As anticipated, the query was waiting until either manually cancelled or the remote DB was unquiesced. **Question:** I have no control over the remote database's behaviour and uptime, so I am in search for some possibility to set a timeout on a query which is using a database link. I've already looked into profiles (`CPU_PER_CALL` etc) and `sqlnet.ora` parameters, but they either work for busy or idle sessions, but not for sessions in wait. So I am in search for some option on the "local" side of the database link, which kind of sets a timeout for queries over database links. Some solution like `alter session set xyz` or `select ... from a@b "wait 100" --(yes, I know this syntax doesn't exist)` would be appreciated, as I have no DBA rights on these particular DBs. I'm currently on 10gR2 but upgrading to 11gR2 in a few weeks, so ideas for any of these versions will be useful.
2
4,245,845
11/22/2010 13:27:04
509,551
11/16/2010 13:18:34
111
12
Why there are so many Java frameworks?
Apparently every Java programmers and his dog wrote a couple of open source framework. I can understand that sometimes framework are useful, but in the Java community it's the opposite: not using as many framework as you can it's considered as a "non professional attitude". Half of my team members are afraid to write any code to solve a technical issue, they just google for a framework anytime they have to add a functionality. Of course nobody can be expert of everything, but why do you need (for example) to choose among about 20 frameworks (last time I counted) to serve a simple rest api? Is it something related to Java and its lack of standard libraries (xml parsing for one)? or is it related to "CV oriented programming"?
java
frameworks
null
null
null
11/23/2010 06:19:12
not constructive
Why there are so many Java frameworks? === Apparently every Java programmers and his dog wrote a couple of open source framework. I can understand that sometimes framework are useful, but in the Java community it's the opposite: not using as many framework as you can it's considered as a "non professional attitude". Half of my team members are afraid to write any code to solve a technical issue, they just google for a framework anytime they have to add a functionality. Of course nobody can be expert of everything, but why do you need (for example) to choose among about 20 frameworks (last time I counted) to serve a simple rest api? Is it something related to Java and its lack of standard libraries (xml parsing for one)? or is it related to "CV oriented programming"?
4
8,388,894
12/05/2011 16:59:16
1,000,024
10/17/2011 21:36:51
51
0
How to save file in java?
I've developed an interface with a menubar and a text area. I've included open, new, save and save as options under 'File'. When i open a text file, the content of the file appears in the text area in this way Hello Good morning When i edit the content, click on save and if i open the text file(not in the interface), the content in the file looks something like this Hello good morning how are you...... All the text is saved in the above format instead of Hello good morning how are you ...... How can i avoid this?
java
null
null
null
null
12/05/2011 20:07:30
not a real question
How to save file in java? === I've developed an interface with a menubar and a text area. I've included open, new, save and save as options under 'File'. When i open a text file, the content of the file appears in the text area in this way Hello Good morning When i edit the content, click on save and if i open the text file(not in the interface), the content in the file looks something like this Hello good morning how are you...... All the text is saved in the above format instead of Hello good morning how are you ...... How can i avoid this?
1
3,156,484
07/01/2010 09:21:12
99,256
05/01/2009 09:42:01
727
42
How to let Visual Studio to add references according to USINGS?
I realized that when dividing a project into two in Visual Studio (2010) I'm still looking for references that are missing in the new project. Can Visual Studio do that for me? It can find all the namespaces I use so it should be easy for it. Thanks!
visual-studio
visual-studio-2010
reference
null
null
null
open
How to let Visual Studio to add references according to USINGS? === I realized that when dividing a project into two in Visual Studio (2010) I'm still looking for references that are missing in the new project. Can Visual Studio do that for me? It can find all the namespaces I use so it should be easy for it. Thanks!
0
904,249
05/24/2009 17:30:26
91,485
04/16/2009 06:42:02
197
8
Which class would load first when Web application starts?
I have a web application and two class files, First class is **MyClass.class** which is inside the abc.jar file (WEB-INF/lib/abc.jar) and Second class is **YourClass.class** which is inside classes folder (WEB-INF/classes/ YourClass.class). My question is which class would load first when the Application starts? And Why ?
servlets
null
null
null
null
null
open
Which class would load first when Web application starts? === I have a web application and two class files, First class is **MyClass.class** which is inside the abc.jar file (WEB-INF/lib/abc.jar) and Second class is **YourClass.class** which is inside classes folder (WEB-INF/classes/ YourClass.class). My question is which class would load first when the Application starts? And Why ?
0
10,561,497
05/12/2012 06:08:59
1,389,677
05/11/2012 14:28:15
11
4
Not well formed error in the browser console
**Error: not well-formed** in the browser console <br> More Info: this error will come when i send a request server and the response type is json <br> Source File: //localhost:8080/hplusv2/operation <br> Line: 1, Column: 1 <br> **Source Code:** <br> {"status":null,"data":[["4","ramesh","valasa","04\/19\/2012","789789"],["10","arjun","s","04\/23\/2012","9032305268"],["11","arjun","sadu","04\/23\/2012","9032305268"],["12","rahul","s","04\/23\/2012","6768979809"],["13","satheesh","sadu","04\/23\/2012","78909-09-="],["14","ranjith","dasari","04\/23\/2012","565879"],["15","rajesh","dasari","04\/23\/2012","8979089080"],["16","vishnu","p","04\/24\/2012","56876798798"],["17","rakesh","k","04\/24\/2012","576789709"],["18","raju","a","04\/24\/2012","567567687"],["19","rohith","d","04\/24\/2012","565687689"],["20","sravan","g","04\/24\/2012","789790"]],"statusDetails":null,"statusMessage":"no results found"}
jquery
jquery-ajax
null
null
null
05/14/2012 06:21:13
too localized
Not well formed error in the browser console === **Error: not well-formed** in the browser console <br> More Info: this error will come when i send a request server and the response type is json <br> Source File: //localhost:8080/hplusv2/operation <br> Line: 1, Column: 1 <br> **Source Code:** <br> {"status":null,"data":[["4","ramesh","valasa","04\/19\/2012","789789"],["10","arjun","s","04\/23\/2012","9032305268"],["11","arjun","sadu","04\/23\/2012","9032305268"],["12","rahul","s","04\/23\/2012","6768979809"],["13","satheesh","sadu","04\/23\/2012","78909-09-="],["14","ranjith","dasari","04\/23\/2012","565879"],["15","rajesh","dasari","04\/23\/2012","8979089080"],["16","vishnu","p","04\/24\/2012","56876798798"],["17","rakesh","k","04\/24\/2012","576789709"],["18","raju","a","04\/24\/2012","567567687"],["19","rohith","d","04\/24\/2012","565687689"],["20","sravan","g","04\/24\/2012","789790"]],"statusDetails":null,"statusMessage":"no results found"}
3
5,830,671
04/29/2011 10:04:41
703,406
04/12/2011 05:29:27
9
0
error reading xml from the plsql procedure.
I am trying to read a xml from plsql procedure using the xmlparser package, i am getting this error ORA-31020: The operation is not allowed, Reason: Not supported ORA-06512: at "XDB.DBMS_XMLPARSER", line 395 ORA-06512: at "SYS.DOMSAMPLE", line 75 ORA-06512: at line 2 DOMSAMPLE is my procedure name, and no statements are there at line number 75,and next line contains p := xmlparser.newParser. Can somebody please help me in resolving this problem. Or suggest a simple way to read xml in plsql.
xml
plsql
null
null
null
null
open
error reading xml from the plsql procedure. === I am trying to read a xml from plsql procedure using the xmlparser package, i am getting this error ORA-31020: The operation is not allowed, Reason: Not supported ORA-06512: at "XDB.DBMS_XMLPARSER", line 395 ORA-06512: at "SYS.DOMSAMPLE", line 75 ORA-06512: at line 2 DOMSAMPLE is my procedure name, and no statements are there at line number 75,and next line contains p := xmlparser.newParser. Can somebody please help me in resolving this problem. Or suggest a simple way to read xml in plsql.
0
6,054,898
05/19/2011 06:54:16
760,489
05/19/2011 06:48:54
1
0
which is best from this xml or json to use in web application all the devices
I want to know that which technology is best use in web application desktop, mobile etc from this xml or json
xml
json
null
null
null
05/19/2011 07:44:14
not a real question
which is best from this xml or json to use in web application all the devices === I want to know that which technology is best use in web application desktop, mobile etc from this xml or json
1
11,369,650
07/06/2012 21:06:04
683,553
03/30/2011 08:24:48
2,133
15
PHP Issue with syntax with html and php mix
I have a syntax problem with some code and I keep changing the syntax but it's getting no-where. Here is the code: echo '<img style="border:1px solid #f1f1f1;margin:12px 0 12px 0" src="https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://mysite.com/'.$current_user->user.'/'" />'; Seems to be around here: http://mysite.com/'.$current_user->user.'/'" />';
php
php5
null
null
null
07/07/2012 00:56:28
too localized
PHP Issue with syntax with html and php mix === I have a syntax problem with some code and I keep changing the syntax but it's getting no-where. Here is the code: echo '<img style="border:1px solid #f1f1f1;margin:12px 0 12px 0" src="https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=http://mysite.com/'.$current_user->user.'/'" />'; Seems to be around here: http://mysite.com/'.$current_user->user.'/'" />';
3
6,240,640
06/05/2011 02:23:39
516,833
11/23/2010 01:03:01
38
2
Why can't I click on this menu?
Clicking will not work. Checked source, list is populated with PHP. http://bit.ly/lEmHqY
php
html
input
null
null
06/06/2011 05:42:02
not a real question
Why can't I click on this menu? === Clicking will not work. Checked source, list is populated with PHP. http://bit.ly/lEmHqY
1
6,817,006
07/25/2011 13:40:51
421,020
08/15/2010 14:43:45
94
1
jQuery click not applied to repainted/injected items
I have a simple piece of jQuery which injects a new row (<tr>...</tr>) which contains a select, a text box and some radio buttons to an existing table using the following: $(':radio').click(function() { $('#bdTable tr:last').after(makeHTML()); }); now this is all well and good however the click event only applies to the original row that was rendered on the page and not the new rows that we generate using the above code. I want all radio buttons to fire this functionality when clicked. Does anyone know how I apply the click event to the new rows too? I can expand if necessary.
jquery
html
null
null
null
null
open
jQuery click not applied to repainted/injected items === I have a simple piece of jQuery which injects a new row (<tr>...</tr>) which contains a select, a text box and some radio buttons to an existing table using the following: $(':radio').click(function() { $('#bdTable tr:last').after(makeHTML()); }); now this is all well and good however the click event only applies to the original row that was rendered on the page and not the new rows that we generate using the above code. I want all radio buttons to fire this functionality when clicked. Does anyone know how I apply the click event to the new rows too? I can expand if necessary.
0
7,479,401
09/20/2011 02:25:51
953,841
09/20/2011 02:25:51
1
0
Is it possible to connect actions from one page of a tab bar to another?
I'm trying to get something that is inputed on one page of a tab bar to another... for example Page 1 of tab bar label- text field (insert something) generate...... page 2 of tab bar hey... <insert>....... page 3 of tab bar hey... what ever was inserted please just let me know if something like this is possible... thank you in advance!
ios
iphone-sdk-4.0
null
null
null
10/02/2011 10:37:24
not a real question
Is it possible to connect actions from one page of a tab bar to another? === I'm trying to get something that is inputed on one page of a tab bar to another... for example Page 1 of tab bar label- text field (insert something) generate...... page 2 of tab bar hey... <insert>....... page 3 of tab bar hey... what ever was inserted please just let me know if something like this is possible... thank you in advance!
1
9,351,272
02/19/2012 17:14:08
265,069
02/03/2010 07:37:48
1,617
51
Is generating lots of rendered HTML files the best practice for PHP/MYSQL caching if advanced methods are not available?
So I have a simple site which generates pages from a database. The data is mostly static only I update it, add to it as an admin from time to time. My site is on a cheap shared webhost which does not make any advanced caching method (e.g. memcached) available, so I'm thinking about caching all pages of the site and storing the generated HTML pages in files and serve those for the users. Is it the best I can do considering I have no more advanced options available? Is storing the rendered version of tens of thousands of generated pages a usual caching solution in PHP land?
php
database
caching
flat-file
null
null
open
Is generating lots of rendered HTML files the best practice for PHP/MYSQL caching if advanced methods are not available? === So I have a simple site which generates pages from a database. The data is mostly static only I update it, add to it as an admin from time to time. My site is on a cheap shared webhost which does not make any advanced caching method (e.g. memcached) available, so I'm thinking about caching all pages of the site and storing the generated HTML pages in files and serve those for the users. Is it the best I can do considering I have no more advanced options available? Is storing the rendered version of tens of thousands of generated pages a usual caching solution in PHP land?
0
3,453,274
08/10/2010 20:44:46
40,015
11/23/2008 03:15:17
5,540
268
Using Linq to get the last N elements of a collection?
Given a collection, is there a way to get the last N elements of that collection? If there isn't a method in the framework, what would be the best way to write an extension method to do this?
c#
linq
null
null
null
null
open
Using Linq to get the last N elements of a collection? === Given a collection, is there a way to get the last N elements of that collection? If there isn't a method in the framework, what would be the best way to write an extension method to do this?
0
2,476,482
03/19/2010 10:31:58
297,280
03/19/2010 10:31:58
1
0
i recieved warning when set cookie
i used mvc concept for my project... i can set cookies index page... but i can not set cookies in view page,,, i received the following warning... Warning: Cannot modify header information - headers already sent by... thanks advance
php
mvc
session-cookies
null
null
null
open
i recieved warning when set cookie === i used mvc concept for my project... i can set cookies index page... but i can not set cookies in view page,,, i received the following warning... Warning: Cannot modify header information - headers already sent by... thanks advance
0
10,023,034
04/05/2012 05:20:21
300,359
03/23/2010 22:17:28
83
4
Why Apache Wicket not so popular?
I am a Java Software Engineer, working mainly with Strut, Hibernate and Jquery every day. Now I think I should move on and learn something new during free time (playing with Liftweb and Scala right now and really love it). I have a real nightmare with the current project of my company, where every business logic is put in the view side (JSP and JavaScript code). This makes maintenance is like hell and we do have to write many stupid statements to patch the old code. This obsession makes me dig into Wicket since framework has the total separation between markup and business logic. I just wondering, why wicket is not so popular, comparing to Struts and JSF while it has many beautiful features like Ajax support, Java centric, fast development… Searching Wicket job also gives a bad result; not much job available, while relating job reflects the popular of the framework
java
wicket
null
null
null
04/05/2012 05:47:13
not constructive
Why Apache Wicket not so popular? === I am a Java Software Engineer, working mainly with Strut, Hibernate and Jquery every day. Now I think I should move on and learn something new during free time (playing with Liftweb and Scala right now and really love it). I have a real nightmare with the current project of my company, where every business logic is put in the view side (JSP and JavaScript code). This makes maintenance is like hell and we do have to write many stupid statements to patch the old code. This obsession makes me dig into Wicket since framework has the total separation between markup and business logic. I just wondering, why wicket is not so popular, comparing to Struts and JSF while it has many beautiful features like Ajax support, Java centric, fast development… Searching Wicket job also gives a bad result; not much job available, while relating job reflects the popular of the framework
4
7,132,192
08/20/2011 13:55:44
896,472
08/16/2011 10:32:59
6
1
Minimize test case churn on design change
How do we minimize test case churn if the design changes? How can we reduce our re-work and still provide confidence and quality? How do we limit the number of tests we must execute in regression while providing a high level of confidence and quality? How do we prove our regression is solid? How/what role should developers play with verification? How much testing should they do? What should they help with? What relationship should exist between developer and testers?
testing
regression
null
null
null
08/20/2011 14:04:56
not constructive
Minimize test case churn on design change === How do we minimize test case churn if the design changes? How can we reduce our re-work and still provide confidence and quality? How do we limit the number of tests we must execute in regression while providing a high level of confidence and quality? How do we prove our regression is solid? How/what role should developers play with verification? How much testing should they do? What should they help with? What relationship should exist between developer and testers?
4
9,343,283
02/18/2012 17:15:03
1,184,512
02/02/2012 07:24:52
43
2
How to add data to another class from WCF Domain Service Class methods in silverlight?
Hi i am using WCF RIA services class in Silverlight. I do have a line chart control named `mcChart` in which i have bound the item source to `Date` and `Amount` properties of class `customer`. public class Customer { public DateTime Date{ get; set; } public int Amount{ get; set; } } I do have this method through WCF ria domain service class to access the sql table `gardenwater{Id, Date, Amt}`: public IQueryable<gardenwater> GetGardenwaters() { return this.ObjectContext.gardenwaters; } Now i want to store the data in `List<Customer> cust = new List<Customer>();` so that it can be shown in the chart. I have tried like this : EntityQuery<gardenwater> inquery = from c in wdc.GetGardenwatersQuery() select new { Date =Convert.ToDateTime(c.Date), Amount =Convert.ToInt32(c.usedwater) }; and then foreach (var gardenWater in inquery ) { cust.Add(new Customer() { Date = Convert.ToDateTime(gardenWater.Date), Amount = Convert.ToInt32(gardenWater.usedwater) }); } mcChart.DataContext = cust; Doing all the above i am not able to get any good results. I want to display the data through storing SQL table data in Class properties. Please suggest me what can i do or what mistakes i am doing ?
c#
wcf
silverlight
linq
null
null
open
How to add data to another class from WCF Domain Service Class methods in silverlight? === Hi i am using WCF RIA services class in Silverlight. I do have a line chart control named `mcChart` in which i have bound the item source to `Date` and `Amount` properties of class `customer`. public class Customer { public DateTime Date{ get; set; } public int Amount{ get; set; } } I do have this method through WCF ria domain service class to access the sql table `gardenwater{Id, Date, Amt}`: public IQueryable<gardenwater> GetGardenwaters() { return this.ObjectContext.gardenwaters; } Now i want to store the data in `List<Customer> cust = new List<Customer>();` so that it can be shown in the chart. I have tried like this : EntityQuery<gardenwater> inquery = from c in wdc.GetGardenwatersQuery() select new { Date =Convert.ToDateTime(c.Date), Amount =Convert.ToInt32(c.usedwater) }; and then foreach (var gardenWater in inquery ) { cust.Add(new Customer() { Date = Convert.ToDateTime(gardenWater.Date), Amount = Convert.ToInt32(gardenWater.usedwater) }); } mcChart.DataContext = cust; Doing all the above i am not able to get any good results. I want to display the data through storing SQL table data in Class properties. Please suggest me what can i do or what mistakes i am doing ?
0
3,096,131
06/22/2010 18:42:36
82,189
03/24/2009 19:15:52
44
0
What is the best components stack for building distributed log aggregator (like Splunk)?
I'm trying to find the best components I could use to build something similar to Splunk in order to aggregate logs from a big number of servers in computing grid. Also it should be distributed because I have gigs of logs everyday and no single machine will be able to store logs. I'm particularly interested in something that will work with Ruby and will work on Windows and latest Solaris (yeah, I got a zoo). I see architecture as: - Log crawler (Ruby script). - Distributed log storage. - Distributed search engine. - Lightweight front end. Log crawler and distributed search engine are out of questions - logs will be parsed by Ruby script and ElasticSearch will be used to index log messages. Front end is also very easy to choose - Sinatra. My main problem is distributed log storage. I looked at MongoDB, CouchDB, HDFS, Cassandra and HBase. - MongoDB was rejected because it doesn't work on Solaris. - CouchDB doesn't support sharding (smartproxy is required to make it work but this is something I don't want to even try). - Cassandra works great but it's just a disk space hog and it requires running autobalance everyday to spread the load between Cassandra nodes. - HDFS looked promising but FileSystem API is Java only and JRuby was a pain. - HBase looked like a best solution around but deploying it and monitoring is just a disaster - in order to start HBase I need to start HDFS first, check that it started without problems, then start HBase and check it also, and then start REST service and also check it. So I'm stuck. Something tells me HDFS or HBase are the best thing to use as a log storage, but HDFS only works smoothly with Java and HBase is just a deploying/monitoring nightmare. Can anyone share its thoughts or experience building similar systems using components I described above or with something completely different?
logging
hbase
hdfs
splunk
null
null
open
What is the best components stack for building distributed log aggregator (like Splunk)? === I'm trying to find the best components I could use to build something similar to Splunk in order to aggregate logs from a big number of servers in computing grid. Also it should be distributed because I have gigs of logs everyday and no single machine will be able to store logs. I'm particularly interested in something that will work with Ruby and will work on Windows and latest Solaris (yeah, I got a zoo). I see architecture as: - Log crawler (Ruby script). - Distributed log storage. - Distributed search engine. - Lightweight front end. Log crawler and distributed search engine are out of questions - logs will be parsed by Ruby script and ElasticSearch will be used to index log messages. Front end is also very easy to choose - Sinatra. My main problem is distributed log storage. I looked at MongoDB, CouchDB, HDFS, Cassandra and HBase. - MongoDB was rejected because it doesn't work on Solaris. - CouchDB doesn't support sharding (smartproxy is required to make it work but this is something I don't want to even try). - Cassandra works great but it's just a disk space hog and it requires running autobalance everyday to spread the load between Cassandra nodes. - HDFS looked promising but FileSystem API is Java only and JRuby was a pain. - HBase looked like a best solution around but deploying it and monitoring is just a disaster - in order to start HBase I need to start HDFS first, check that it started without problems, then start HBase and check it also, and then start REST service and also check it. So I'm stuck. Something tells me HDFS or HBase are the best thing to use as a log storage, but HDFS only works smoothly with Java and HBase is just a deploying/monitoring nightmare. Can anyone share its thoughts or experience building similar systems using components I described above or with something completely different?
0
5,740,042
04/21/2011 05:43:53
718,306
04/21/2011 04:49:07
4
0
what is the output of the giving progrm..plz xpln dis..how does enum is used???
void main() { enum a{a,b ,MAX}; printf("%d",MAX); }
c
null
null
null
null
04/21/2011 05:57:16
not a real question
what is the output of the giving progrm..plz xpln dis..how does enum is used??? === void main() { enum a{a,b ,MAX}; printf("%d",MAX); }
1
2,192,201
02/03/2010 13:36:05
251,667
01/15/2010 16:00:06
10
1
SCons less verbose ?
I want to remove from the SCons log the long compiling/linking commands. I followed what is written on this page : http://stackoverflow.com/questions/890142/what-do-you-do-to-make-compiler-lines-shorter Here is exactly what I did : AddOption("--verbose", action="store_true", dest="verbose_flag", default=False, help="verbose output") if not GetOption("verbose_flag"): print 'test' env['CXXCOMSTR'] = "----- Compiling test ------" env['LINKCOMSTR'] = "Linking $TARGET" print env.Dump() env.SharedLibrary(.. SCons goes in the if ('test' is printed), and CXXCOMSTR and LINKCOMSTR are updated (checked with Dump()). But it seems that SCOns just doesn't care : it still prints the full g++ commands. Thanks for help.
scons
null
null
null
null
null
open
SCons less verbose ? === I want to remove from the SCons log the long compiling/linking commands. I followed what is written on this page : http://stackoverflow.com/questions/890142/what-do-you-do-to-make-compiler-lines-shorter Here is exactly what I did : AddOption("--verbose", action="store_true", dest="verbose_flag", default=False, help="verbose output") if not GetOption("verbose_flag"): print 'test' env['CXXCOMSTR'] = "----- Compiling test ------" env['LINKCOMSTR'] = "Linking $TARGET" print env.Dump() env.SharedLibrary(.. SCons goes in the if ('test' is printed), and CXXCOMSTR and LINKCOMSTR are updated (checked with Dump()). But it seems that SCOns just doesn't care : it still prints the full g++ commands. Thanks for help.
0
3,401,290
08/03/2010 22:41:22
325,418
05/09/2009 15:50:29
5,029
124
In Javascript, what is the motivation or advantage of using var foo = function foo(i) { ... } ?
I see that in the answer of > http://stackoverflow.com/questions/3233582/in-javascript-why-write-var-querystringtohash-function-querystringtohash-qu which is doing something like var foo = function foo(param) { ... } in that particular case, why do that instead of just using function foo(param) { ... } ? What is the advantage or motivation of doing that?
javascript
function-declaration
null
null
null
null
open
In Javascript, what is the motivation or advantage of using var foo = function foo(i) { ... } ? === I see that in the answer of > http://stackoverflow.com/questions/3233582/in-javascript-why-write-var-querystringtohash-function-querystringtohash-qu which is doing something like var foo = function foo(param) { ... } in that particular case, why do that instead of just using function foo(param) { ... } ? What is the advantage or motivation of doing that?
0
11,432,946
07/11/2012 12:44:06
1,492,648
06/30/2012 06:24:57
6
0
unable to create text area using javascript
I want to design a simple text area using javascript. I am using the following function function add2(type) { var element = document.createElement("input"); var label=prompt("Enter the name for lable","label"); document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+label; element.setAttribute("type", type); element.setAttribute("name", type); element.setAttribute("cols",20); element.setAttribute("rows",50); var rohit = document.getElementById("raj"); rohit.appendChild(element); document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+"<br/>"; } I am using this function in my HTML code as follow : <input type="button" value="Text Area" onclick="add2('textarea')"> But when I am executing this code, it is creating only a simple text box. what should I do ?? Thanks
javascript
null
null
null
null
null
open
unable to create text area using javascript === I want to design a simple text area using javascript. I am using the following function function add2(type) { var element = document.createElement("input"); var label=prompt("Enter the name for lable","label"); document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+label; element.setAttribute("type", type); element.setAttribute("name", type); element.setAttribute("cols",20); element.setAttribute("rows",50); var rohit = document.getElementById("raj"); rohit.appendChild(element); document.getElementById('raj').innerHTML=document.getElementById('raj').innerHTML+"<br/>"; } I am using this function in my HTML code as follow : <input type="button" value="Text Area" onclick="add2('textarea')"> But when I am executing this code, it is creating only a simple text box. what should I do ?? Thanks
0
7,228,442
08/29/2011 09:37:50
583,301
01/20/2011 16:54:09
923
63
C# comparing Date & Time in Linq
Using linq, i want to return only those records whose date & time is greater than the provided date. The record has date and time in different columns in string formats. For e.g., "290811" for (29/Aug/2011) and "1400" for (2 PM or 14 hours depending on the context it's being used). What i have done: var result = from s in source where GetDateTime(s.date, s.time) >= myDateTime select s; `GetDateTime` is a function i've created to return the date and time in DateTime format. `myDatetime` is the date i'm passing. The problem is that the above linq is not filtering the results as it should. Please tell me what i'm doing wrong. Thanks.
c#
linq
null
null
null
null
open
C# comparing Date & Time in Linq === Using linq, i want to return only those records whose date & time is greater than the provided date. The record has date and time in different columns in string formats. For e.g., "290811" for (29/Aug/2011) and "1400" for (2 PM or 14 hours depending on the context it's being used). What i have done: var result = from s in source where GetDateTime(s.date, s.time) >= myDateTime select s; `GetDateTime` is a function i've created to return the date and time in DateTime format. `myDatetime` is the date i'm passing. The problem is that the above linq is not filtering the results as it should. Please tell me what i'm doing wrong. Thanks.
0
11,650,310
07/25/2012 13:00:52
1,546,655
07/23/2012 18:32:59
1
0
TomCat Hardware minimum specs and suggested specs
Management has asked me to "google" and find the minimum/suggested hardware specs for a Tomcat server. I don't know what applications will be on the server, or how many applications. We have about 50 Lotus Notes applications, which are mostly just document repositories, that we will be re-writing. The applications could have anywhere from 5 users to 50 users. We also have about 20 VB6 apps that will be rewritten. Most of them only have 2-10 users each. I know it isn't much information, but there asking me to get some info. thanks
tomcat
null
null
null
null
07/28/2012 10:57:17
off topic
TomCat Hardware minimum specs and suggested specs === Management has asked me to "google" and find the minimum/suggested hardware specs for a Tomcat server. I don't know what applications will be on the server, or how many applications. We have about 50 Lotus Notes applications, which are mostly just document repositories, that we will be re-writing. The applications could have anywhere from 5 users to 50 users. We also have about 20 VB6 apps that will be rewritten. Most of them only have 2-10 users each. I know it isn't much information, but there asking me to get some info. thanks
2
11,654,143
07/25/2012 16:14:53
241,993
01/01/2010 17:31:43
196
6
Statically linking system libraries, libc, pthreads, to aid in debugging
I am trying to avoid the situation described in this Stackoverflow entry: http://stackoverflow.com/questions/10616417/debugging-core-files-generated-on-a-customers-box. If I compile all the libraries statically will I avoid having to always gather the core files when it core dumps? I essentially want to be in a situation where I can just load up the core file with gdb and examine the crashed application. What should I watch out for if I go down the route of statically linking all the libraries we need. I figure glib and pthreads might cause the biggest problems. Will Valgrind cease to be useful? If I load up Valgrind against the binary which has everything statically compiled will it find errors? Or shall we maintain a binary that isn't statically compiled so Valgrind continues to work. How about strace? We crashes quite often as we have a large install base and it is also a legacy application. Gathering up all the shared libraries is becoming intractable - I need another solution.
c++
linux
gdb
libc
postmortem-debugging
null
open
Statically linking system libraries, libc, pthreads, to aid in debugging === I am trying to avoid the situation described in this Stackoverflow entry: http://stackoverflow.com/questions/10616417/debugging-core-files-generated-on-a-customers-box. If I compile all the libraries statically will I avoid having to always gather the core files when it core dumps? I essentially want to be in a situation where I can just load up the core file with gdb and examine the crashed application. What should I watch out for if I go down the route of statically linking all the libraries we need. I figure glib and pthreads might cause the biggest problems. Will Valgrind cease to be useful? If I load up Valgrind against the binary which has everything statically compiled will it find errors? Or shall we maintain a binary that isn't statically compiled so Valgrind continues to work. How about strace? We crashes quite often as we have a large install base and it is also a legacy application. Gathering up all the shared libraries is becoming intractable - I need another solution.
0
7,505,135
09/21/2011 18:57:01
467,859
10/06/2010 11:01:07
1,364
27
Why does my very simple Chrome extension work on Mac but not PC?
I have written a *very* simple Chrome extension. It consists of this background page: <script type="text/javascript"> chrome.tabs.onDetached.addListener(function(tabId, info){ var id = tabId; chrome.tabs.get(id, function(tab) { chrome.tabs.create({ windowId : info.oldWindowId, index : info.oldPosition, url : tab.url }); }); }); </script> All it does is allows you to pull a tab from a window without losing that tab and web address from the window. It basically duplicates the tab when you detach it. The problem is that this works perfectly on a Mac but when I have tried it on two different Windows machines I get this error background.html:7Uncaught TypeError: Cannot read property 'url' of undefined It appears the tab object isn't being passed into the `get` callback. Does anyone know why this might be? It obviously is when I run the code on a Mac.
javascript
windows
osx
google-chrome-extension
null
null
open
Why does my very simple Chrome extension work on Mac but not PC? === I have written a *very* simple Chrome extension. It consists of this background page: <script type="text/javascript"> chrome.tabs.onDetached.addListener(function(tabId, info){ var id = tabId; chrome.tabs.get(id, function(tab) { chrome.tabs.create({ windowId : info.oldWindowId, index : info.oldPosition, url : tab.url }); }); }); </script> All it does is allows you to pull a tab from a window without losing that tab and web address from the window. It basically duplicates the tab when you detach it. The problem is that this works perfectly on a Mac but when I have tried it on two different Windows machines I get this error background.html:7Uncaught TypeError: Cannot read property 'url' of undefined It appears the tab object isn't being passed into the `get` callback. Does anyone know why this might be? It obviously is when I run the code on a Mac.
0
5,973,785
05/12/2011 05:45:22
733,928
05/02/2011 04:41:46
1
0
getting message just leaking memory
Hi friend i have message on console (it's not give error or warning )it only show message the message it's like that __NSAutoreleaseNoPool(): Object 0x6378190 of class HGMapPath autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379e00 of class HGMovingAnnotation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x578f2e0 of class __NSCFSet autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790a00 of class __NSDate autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ab0 of class __NSCFTimer autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6348c90 of class UIView autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x633fb60 of class UILayoutContainerView autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379c10 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790e20 of class MKDirectionsRouteInfo autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371a40 of class MKDirectionsRouteInfo autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x63799c0 of class NSCFString autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371e30 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x636d850 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790cf0 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d10 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790e90 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d30 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d40 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d50 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d60 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d70 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d80 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d90 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379b40 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6375300 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790b40 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ed0 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ee0 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x634d210 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379b60 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x637b870 of class __NSCFDictionary autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371960 of class NSThread autoreleased with no pool in place - just leaking I just want know why it is happening .Is that it create problem in future .And How can i solve I am using this code please check it out And suggest me best way to solve this. //start tracking vehicle locations. In DEMO mode just read locations from the path... - (void) start { [self performSelectorInBackground:@selector(startTracking) withObject:nil]; } - (void) stop { [NSObject cancelPreviousPerformRequestsWithTarget:self]; self.isMoving = NO; } - (void) startTracking { self.isMoving = YES; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; for(int i=_currentPathPointIndex+1; i<path.pointCount; i++) { currentLocation = self.path.points[i]; _distanceTravelled += MKMetersBetweenMapPoints(self.path.points[i], self.path.points[i-1]); //send notification [[NSNotificationCenter defaultCenter] postNotificationName:kObjectMovedNotification object:self]; [NSThread sleepForTimeInterval : DEMO_SPEED]; } //finished moving along the path - send notification [[NSNotificationCenter defaultCenter] postNotificationName:kObjectRechedEndOfPathNotification object:self]; [pool drain]; } Thanks in advance
iphone
objective-c
null
null
null
null
open
getting message just leaking memory === Hi friend i have message on console (it's not give error or warning )it only show message the message it's like that __NSAutoreleaseNoPool(): Object 0x6378190 of class HGMapPath autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379e00 of class HGMovingAnnotation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x578f2e0 of class __NSCFSet autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790a00 of class __NSDate autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ab0 of class __NSCFTimer autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6348c90 of class UIView autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x633fb60 of class UILayoutContainerView autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379c10 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790e20 of class MKDirectionsRouteInfo autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371a40 of class MKDirectionsRouteInfo autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x63799c0 of class NSCFString autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371e30 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x636d850 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790cf0 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d10 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790e90 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d30 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d40 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d50 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d60 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d70 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d80 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790d90 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379b40 of class __NSArrayI autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6375300 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790b40 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ed0 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x5790ee0 of class NSCFNumber autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x634d210 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6379b60 of class CABasicAnimation autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x637b870 of class __NSCFDictionary autoreleased with no pool in place - just leaking __NSAutoreleaseNoPool(): Object 0x6371960 of class NSThread autoreleased with no pool in place - just leaking I just want know why it is happening .Is that it create problem in future .And How can i solve I am using this code please check it out And suggest me best way to solve this. //start tracking vehicle locations. In DEMO mode just read locations from the path... - (void) start { [self performSelectorInBackground:@selector(startTracking) withObject:nil]; } - (void) stop { [NSObject cancelPreviousPerformRequestsWithTarget:self]; self.isMoving = NO; } - (void) startTracking { self.isMoving = YES; NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; for(int i=_currentPathPointIndex+1; i<path.pointCount; i++) { currentLocation = self.path.points[i]; _distanceTravelled += MKMetersBetweenMapPoints(self.path.points[i], self.path.points[i-1]); //send notification [[NSNotificationCenter defaultCenter] postNotificationName:kObjectMovedNotification object:self]; [NSThread sleepForTimeInterval : DEMO_SPEED]; } //finished moving along the path - send notification [[NSNotificationCenter defaultCenter] postNotificationName:kObjectRechedEndOfPathNotification object:self]; [pool drain]; } Thanks in advance
0
6,441,502
06/22/2011 14:23:14
386,779
07/08/2010 14:43:35
393
17
ExtJS - How to reference "self" in a custom function in a custom class?
*ExtJS n00b warning* Hi all, How do I reference an instance of a custom class inside a custom function defined within the class? I've extended a class through ExtJS4's class extension "mechanism", and I've a custom event handler that will be called when something is triggered, and I want to collapse the Panel when something is fired. However, in the event handler of the Reactor class below, "this" references EventTriggerer (The firer of the event) instead of the instance of the Reactor. How do I reference the instance of the EventReactor inside a custom function? Thanks! DashK Ext.define('EventReactor', { extend: 'Ext.panel.Panel', onSomething: function(data) { // ERROR // this.collapse is undefined. "this" actually references EventTriggerer this.collapse(); } }); Ext.define('EventTriggerer', { extend: 'Ext.util.Observable', singleton: true, constructor: function() { this.addEvents({ "changedView" : true }); }, doSomething: function() { // Do some stuff this.fireEvent("doneSomething", data); } }); ... // Here's how the listeners are added var er = Ext.create('EventReactor'); EventTriggerer.addListener("doneSomething", er.onSomething); // Here's how the event is triggered. ef.doSomething();
javascript
extjs4
null
null
null
null
open
ExtJS - How to reference "self" in a custom function in a custom class? === *ExtJS n00b warning* Hi all, How do I reference an instance of a custom class inside a custom function defined within the class? I've extended a class through ExtJS4's class extension "mechanism", and I've a custom event handler that will be called when something is triggered, and I want to collapse the Panel when something is fired. However, in the event handler of the Reactor class below, "this" references EventTriggerer (The firer of the event) instead of the instance of the Reactor. How do I reference the instance of the EventReactor inside a custom function? Thanks! DashK Ext.define('EventReactor', { extend: 'Ext.panel.Panel', onSomething: function(data) { // ERROR // this.collapse is undefined. "this" actually references EventTriggerer this.collapse(); } }); Ext.define('EventTriggerer', { extend: 'Ext.util.Observable', singleton: true, constructor: function() { this.addEvents({ "changedView" : true }); }, doSomething: function() { // Do some stuff this.fireEvent("doneSomething", data); } }); ... // Here's how the listeners are added var er = Ext.create('EventReactor'); EventTriggerer.addListener("doneSomething", er.onSomething); // Here's how the event is triggered. ef.doSomething();
0
7,184,471
08/25/2011 02:27:34
787,247
06/07/2011 10:11:30
110
2
PDO update stock level values on the fly?
I am new to pdo and updating a script from the legacy mysql calls, I have tried the following but cannot get it to work: $stmt = $db->prepare("update product set stock=stock-:basketid, sold=sold+:basketid where productid=:pid"); foreach($_SESSION['basket'] as $pid=>$val){ $stmt->bindParam(":basketid", $_SESSION['basket'][$pid], PDO::PARAM_INT); $stmt->bindParam(":pid", $pid, PDO::PARAM_INT); $stmt->execute(); } Any help would be much appreciated. Thanks
php
pdo
null
null
null
08/25/2011 03:07:05
too localized
PDO update stock level values on the fly? === I am new to pdo and updating a script from the legacy mysql calls, I have tried the following but cannot get it to work: $stmt = $db->prepare("update product set stock=stock-:basketid, sold=sold+:basketid where productid=:pid"); foreach($_SESSION['basket'] as $pid=>$val){ $stmt->bindParam(":basketid", $_SESSION['basket'][$pid], PDO::PARAM_INT); $stmt->bindParam(":pid", $pid, PDO::PARAM_INT); $stmt->execute(); } Any help would be much appreciated. Thanks
3
9,237,069
02/11/2012 01:35:10
1,149,547
01/14/2012 17:36:03
1
0
Do I really need an MVC framework like Backbone.js or Ember.js in Rails for a single page app?
Personally Coffeescript is ok, but I would rather it be a supporting player in my Rails app, not most of the logic. From what I can see, you still have to duplicate a lot of the logic when using Backbone.js or Spine.js in Rails. Can I not get the benefits of these frameworks or make what is essentially a single page app with js for real time updates using just rack-pjax?
ruby-on-rails
backbone.js
spine.js
pjax
ember.js
null
open
Do I really need an MVC framework like Backbone.js or Ember.js in Rails for a single page app? === Personally Coffeescript is ok, but I would rather it be a supporting player in my Rails app, not most of the logic. From what I can see, you still have to duplicate a lot of the logic when using Backbone.js or Spine.js in Rails. Can I not get the benefits of these frameworks or make what is essentially a single page app with js for real time updates using just rack-pjax?
0
10,039,690
04/06/2012 05:53:48
1,316,843
04/06/2012 05:51:25
1
0
i want final value of count in finally block, but as count = 0 globally..its returning 0.. how do i code it to get the final value of count variable
import web, sys def make_text(string): return string urls = ('/', 'tutorial') render = web.template.render('templates/') app = web.application(urls, globals()) my_form = web.form.Form( web.form.Textbox('', class_='textfield', id='textfield'), ) count=0 def c(): global x x=0 class tutorial: def GET(self): global count c() form = my_form() count+=1 global x x+=1 return render.tutorial(form, "Your text goes here.") def POST(self): form = my_form() form.validates() s = form.value['textfield'] return make_text(s) if __name__ == '__main__': try: print "LOCAL SERVER STARTED.." app.run() except KeyboardInterrupt: sys.exit(1) finally: c() print(x) print "app shutting down....."
ironpython
null
null
null
null
04/06/2012 05:55:28
not a real question
i want final value of count in finally block, but as count = 0 globally..its returning 0.. how do i code it to get the final value of count variable === import web, sys def make_text(string): return string urls = ('/', 'tutorial') render = web.template.render('templates/') app = web.application(urls, globals()) my_form = web.form.Form( web.form.Textbox('', class_='textfield', id='textfield'), ) count=0 def c(): global x x=0 class tutorial: def GET(self): global count c() form = my_form() count+=1 global x x+=1 return render.tutorial(form, "Your text goes here.") def POST(self): form = my_form() form.validates() s = form.value['textfield'] return make_text(s) if __name__ == '__main__': try: print "LOCAL SERVER STARTED.." app.run() except KeyboardInterrupt: sys.exit(1) finally: c() print(x) print "app shutting down....."
1
11,374,352
07/07/2012 10:52:06
1,472,665
06/21/2012 15:53:21
200
10
Compiling libpurple for Android
I want to implement libpurple in android to integrate all the IM chat support to android application, For that I'm using following links to work with, [Compiling libpurple on Android](http://developer.pidgin.im/wiki/GSoC2012/Android/compiling) Following is the repository for android [soc.2012.android repository for android] - (http://hg.pidgin.im/soc/2012/michael/android/) But problem is that, i have downloaded full repository but as suggested in Compilation steps, there is no "**android/workspace**" folder downloaded for server to my PC. Please help me to resolve this issue. Thanks
android
compilation
pidgin
libpurple
null
null
open
Compiling libpurple for Android === I want to implement libpurple in android to integrate all the IM chat support to android application, For that I'm using following links to work with, [Compiling libpurple on Android](http://developer.pidgin.im/wiki/GSoC2012/Android/compiling) Following is the repository for android [soc.2012.android repository for android] - (http://hg.pidgin.im/soc/2012/michael/android/) But problem is that, i have downloaded full repository but as suggested in Compilation steps, there is no "**android/workspace**" folder downloaded for server to my PC. Please help me to resolve this issue. Thanks
0
10,234,591
04/19/2012 18:36:17
964,515
09/26/2011 06:42:39
1
0
Remove html tags in json response in android
am getting json response like this {"html": "<h2 class=\"bigtitle\"><span class=\"esportes esportes-atletismo\"></span> Atletismo</h2>\r\n\r\n<div id=\"box-infoModalidade\">\r\n\r\n\t\t<div class=\"box-info\">\r\n\t\t\t<ul>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Quando Acontece</p>\r\n\t\t\t\t\t<div class=\"quandoacontece\"><div class=\"more\">\r\n\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t<div class=\"indefinido\">Atletismo</div>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t<span class=\"dia\">03</span>\r\n\t\t\t\t\t\t\t\t\t<span class=\"mes-ano\">AGO</br>2012</span>\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t<p class=\"barra\">/</p>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t<span class=\"dia\">12</span>\r\n\t\t\t\t\t\t\t\t\t<span class=\"mes-ano\">AGO</br>2012</span>\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</div></div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Ouros em disputa</p>\r\n\t\t\t\t\t<div class=\"ourosemdisputa\"><div class=\"more\">\r\n\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t<div class=\"indefinido\">Atletismo</div>\r\n\t\t\t\t\t\t\t\t<span class=\"ouro\"></span><p>47</p>\r\n\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</div></div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Brasil na disputa</p>\r\n\t\t\t\t\t<div class=\"brasilnadisputa\">\r\n\t\t\t\t\t\t<div class=\"indefinido\">Sim</div>\r\n\t\t\t\t\t\t<p><strong></strong> <span class=\"data\">Em 2012</span></p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li class=\"last\">\r\n\t\t\t\t\t<p class=\"label\">Ol\u00edmpico desde</p>\r\n\t\t\t\t\t<div class=\"olimpicodesde\">\r\n\t\t\t\t\t\t<p>Atenas - 1986</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t</ul>\r\n\t\t</div>\r\n\r\n\r\n</div>\r\n\r\n<div class=\"box-white\">\r\n\r\n\t\t\t<div class=\"title\">\r\n\t\t\t\t<h2>Regulamento</h2>\r\n\t\t\t</div>\r\n\t\t\t<div id=\"entry\">\r\n\t\t\t\t<p>Modalidade que distribui a maior quantidade de ouros, o atletismo engloba provas de corrida, arremesso e salto, al\u00e9m do decatlo e heptatlo \u2013 modalidades compostas por diversas provas. Todas as competi\u00e7\u00f5es s\u00e3o individuais, com exce\u00e7\u00e3o das corridas de revezamento, feitas por equipes de quatro atletas.</p>\r\n <p>Em Londres, haver\u00e1 provas de corrida de 100 a 10000 metros, incluindo provas com barreiras e obst\u00e1culos, al\u00e9m da maratona e das marchas atl\u00e9ticas. Haver\u00e1 provas de salto (triplo, em dist\u00e2ncia, em altura e com vara) e arremesso (de dardo, disco, peso e martelo). Os tr\u00eas primeiros colocados ficam com as medalhas.</p>\t\t\t\r\n\t\t\t</div>\r\n\t\t\t<div id=\"box-vocesabia\" style=\"border-bottom: 0;\">\r\n\t\t\t\t<div class=\"title\">\r\n\t\t\t\t\t<h2>Voc\u00ea Sabia?</h2>\r\n\t\t\t\t</div>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li>\r\n\t\t\t\t\t\t<h3>Atalho para o p\u00f3dio</h3>\r\n\t\t\t\t\t\t<p>O atletismo foi respons\u00e1vel pelo primeiro caso de fraude ol\u00edmpica. Em Atenas-1896, Spiridon Belokas, da Gr\u00e9cia, chegou em terceiro lugar na maratona. Por\u00e9m, ele confessou ter pegado carona em uma carro\u00e7a e foi desclassificado. Caso semelhante aconteceu em St. Louis-1904, quando Fred Lorz, dos Estados Unidos, fez parte do trajeto em um caminh\u00e3o para chegar em primeiro. Foi desclassificado.</p>\r\n\t\t\t\t\t</li><!--\r\n\t\t\t\t\t--><li>\r\n\t\t\t\t\t\t<h3>Maratona letal</h3>\r\n\t\t\t\t\t\t<p>Em Londres-1908, o italiano Dorando Pietri venceu a maratona, mas teve seu resultado anulado. Tudo porque teve que ser amparado pelos \u00e1rbitros para conseguir cruzar a linha de chegada, j\u00e1 que n\u00e3o conseguia mais parar em p\u00e9. Pior sorte teve o portugu\u00eas Francisco L\u00e1zaro em Estocolmo-1912: ele teve um ataque card\u00edaco no meio da prova e faleceu.</p>\r\n\t\t\t\t\t</li><!--\r\n\t\t\t\t\t--><l Thanks in advance.
android
null
null
null
null
04/25/2012 11:28:07
not a real question
Remove html tags in json response in android === am getting json response like this {"html": "<h2 class=\"bigtitle\"><span class=\"esportes esportes-atletismo\"></span> Atletismo</h2>\r\n\r\n<div id=\"box-infoModalidade\">\r\n\r\n\t\t<div class=\"box-info\">\r\n\t\t\t<ul>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Quando Acontece</p>\r\n\t\t\t\t\t<div class=\"quandoacontece\"><div class=\"more\">\r\n\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t<div class=\"indefinido\">Atletismo</div>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t<span class=\"dia\">03</span>\r\n\t\t\t\t\t\t\t\t\t<span class=\"mes-ano\">AGO</br>2012</span>\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t\t<p class=\"barra\">/</p>\r\n\t\t\t\t\t\t\t\t<p>\r\n\t\t\t\t\t\t\t\t\t<span class=\"dia\">12</span>\r\n\t\t\t\t\t\t\t\t\t<span class=\"mes-ano\">AGO</br>2012</span>\r\n\t\t\t\t\t\t\t\t</p>\r\n\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</div></div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Ouros em disputa</p>\r\n\t\t\t\t\t<div class=\"ourosemdisputa\"><div class=\"more\">\r\n\t\t\t\t\t\t<ul>\r\n\t\t\t\t\t\t\t<li>\r\n\t\t\t\t\t\t\t\t<div class=\"indefinido\">Atletismo</div>\r\n\t\t\t\t\t\t\t\t<span class=\"ouro\"></span><p>47</p>\r\n\t\t\t\t\t\t\t</li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</div></div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li>\r\n\t\t\t\t\t<p class=\"label\">Brasil na disputa</p>\r\n\t\t\t\t\t<div class=\"brasilnadisputa\">\r\n\t\t\t\t\t\t<div class=\"indefinido\">Sim</div>\r\n\t\t\t\t\t\t<p><strong></strong> <span class=\"data\">Em 2012</span></p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t\t<li class=\"last\">\r\n\t\t\t\t\t<p class=\"label\">Ol\u00edmpico desde</p>\r\n\t\t\t\t\t<div class=\"olimpicodesde\">\r\n\t\t\t\t\t\t<p>Atenas - 1986</p>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<div class=\"clear\"></div>\r\n\t\t\t\t</li>\r\n\t\t\t</ul>\r\n\t\t</div>\r\n\r\n\r\n</div>\r\n\r\n<div class=\"box-white\">\r\n\r\n\t\t\t<div class=\"title\">\r\n\t\t\t\t<h2>Regulamento</h2>\r\n\t\t\t</div>\r\n\t\t\t<div id=\"entry\">\r\n\t\t\t\t<p>Modalidade que distribui a maior quantidade de ouros, o atletismo engloba provas de corrida, arremesso e salto, al\u00e9m do decatlo e heptatlo \u2013 modalidades compostas por diversas provas. Todas as competi\u00e7\u00f5es s\u00e3o individuais, com exce\u00e7\u00e3o das corridas de revezamento, feitas por equipes de quatro atletas.</p>\r\n <p>Em Londres, haver\u00e1 provas de corrida de 100 a 10000 metros, incluindo provas com barreiras e obst\u00e1culos, al\u00e9m da maratona e das marchas atl\u00e9ticas. Haver\u00e1 provas de salto (triplo, em dist\u00e2ncia, em altura e com vara) e arremesso (de dardo, disco, peso e martelo). Os tr\u00eas primeiros colocados ficam com as medalhas.</p>\t\t\t\r\n\t\t\t</div>\r\n\t\t\t<div id=\"box-vocesabia\" style=\"border-bottom: 0;\">\r\n\t\t\t\t<div class=\"title\">\r\n\t\t\t\t\t<h2>Voc\u00ea Sabia?</h2>\r\n\t\t\t\t</div>\r\n\t\t\t\t<ul>\r\n\t\t\t\t\t<li>\r\n\t\t\t\t\t\t<h3>Atalho para o p\u00f3dio</h3>\r\n\t\t\t\t\t\t<p>O atletismo foi respons\u00e1vel pelo primeiro caso de fraude ol\u00edmpica. Em Atenas-1896, Spiridon Belokas, da Gr\u00e9cia, chegou em terceiro lugar na maratona. Por\u00e9m, ele confessou ter pegado carona em uma carro\u00e7a e foi desclassificado. Caso semelhante aconteceu em St. Louis-1904, quando Fred Lorz, dos Estados Unidos, fez parte do trajeto em um caminh\u00e3o para chegar em primeiro. Foi desclassificado.</p>\r\n\t\t\t\t\t</li><!--\r\n\t\t\t\t\t--><li>\r\n\t\t\t\t\t\t<h3>Maratona letal</h3>\r\n\t\t\t\t\t\t<p>Em Londres-1908, o italiano Dorando Pietri venceu a maratona, mas teve seu resultado anulado. Tudo porque teve que ser amparado pelos \u00e1rbitros para conseguir cruzar a linha de chegada, j\u00e1 que n\u00e3o conseguia mais parar em p\u00e9. Pior sorte teve o portugu\u00eas Francisco L\u00e1zaro em Estocolmo-1912: ele teve um ataque card\u00edaco no meio da prova e faleceu.</p>\r\n\t\t\t\t\t</li><!--\r\n\t\t\t\t\t--><l Thanks in advance.
1
7,919,561
10/27/2011 16:58:53
1,016,946
10/27/2011 16:43:22
1
0
Alternative WebBrowser .Net C#
I have some problem using default WebBroswer with C#. I'm making program in C# WindowsForm. I would have multiple "tabs" of "Broswer" and i need to change many things like UserAgent . I had problem to do this with default WebBrowser becouse the trick(found on stackoverflow) worked only for 1 page and dont for all session. Olso i need JavaScript support. My Question is : Is there another webBroswer that emulate multiple "tabs" of webBrowser , support javaScript (This is very important : i need disable Javascript for a website page that have Location Header ), and that it's possible change UserAgent and so emulate all existing Browsers ? If answer it's not What kind of "real" browser could i use with My c# WinForm Program? Regards Edit: I already used GeckoFX but without good result (with JavaScript)
c#
javascript
.net
browser
webbrowser
null
open
Alternative WebBrowser .Net C# === I have some problem using default WebBroswer with C#. I'm making program in C# WindowsForm. I would have multiple "tabs" of "Broswer" and i need to change many things like UserAgent . I had problem to do this with default WebBrowser becouse the trick(found on stackoverflow) worked only for 1 page and dont for all session. Olso i need JavaScript support. My Question is : Is there another webBroswer that emulate multiple "tabs" of webBrowser , support javaScript (This is very important : i need disable Javascript for a website page that have Location Header ), and that it's possible change UserAgent and so emulate all existing Browsers ? If answer it's not What kind of "real" browser could i use with My c# WinForm Program? Regards Edit: I already used GeckoFX but without good result (with JavaScript)
0
5,440,534
03/26/2011 05:35:12
608,227
02/05/2011 09:30:17
1
0
how to do json parsing in iphone
i am using json parsing in my application and this is my json data is as follow : {"response" : {"success":false,"error": {"code":7,"description":"You are not logged in"}}} and i want description means "You are not logged in" i my string so how can i do that please help me.....
iphone
null
null
null
null
null
open
how to do json parsing in iphone === i am using json parsing in my application and this is my json data is as follow : {"response" : {"success":false,"error": {"code":7,"description":"You are not logged in"}}} and i want description means "You are not logged in" i my string so how can i do that please help me.....
0
6,321,528
06/12/2011 10:50:57
591,951
01/27/2011 09:48:47
5
0
iphone sdk Submit Book app in Appstore
Please help me in this. I need to submit a app to appstore, it contains a pdf book and some other functionality. My first build was rejected by apple saying its simply a book app. Is there any tips to resubmit this application Thanks in advance
iphone
objective-c
ipad
app-store
null
06/12/2011 12:14:05
off topic
iphone sdk Submit Book app in Appstore === Please help me in this. I need to submit a app to appstore, it contains a pdf book and some other functionality. My first build was rejected by apple saying its simply a book app. Is there any tips to resubmit this application Thanks in advance
2
1,847,766
12/04/2009 15:36:57
170,986
09/09/2009 17:21:47
90
4
limitations on form element
I want to know if there is any limitations on the number of form elements in a html page. <form method="post" action="1.php"> <form> <input type="submit" action="2.php"> </form> </form> Is this valid?
html
null
null
null
null
null
open
limitations on form element === I want to know if there is any limitations on the number of form elements in a html page. <form method="post" action="1.php"> <form> <input type="submit" action="2.php"> </form> </form> Is this valid?
0
8,265,260
11/25/2011 05:55:42
766,141
05/23/2011 14:03:28
136
0
Confusion with `if` `else` and `while`
I have a code where it should check if the result equals to `8` it need to show something and if not it need to show something `else` and all of that happens inside of a `while` loop. while ($row_fpages2 = mysql_fetch_array($result_fanpage2)) { if ( $row_fpages2['client'] != NULL ) { //GRAPHS $sql = "SELECT likes, date FROM statistics_pages WHERE idnum = '".$idnum."' AND page_name = '".$row_fpages2['page_name']."' ORDER BY `statistics_pages`.`date` DESC LIMIT 8"; $result2 = mysql_query($sql) or die(mysql_error()); if ($result2) { $data = array(); while ($row = mysql_fetch_assoc($result2)) { $data[] = $row["likes"]; } if ($result2 == 8) { $c_data = count($data)-1; $final = array(); for ($i = 0; $i < $c_data; $i++) { $final[] = getZeroResult($data[$i], $data[$i+1]); } $data_string = join(",", $final); $stats = '<img src="http://chart.apis.google.com/chart?chs=240x140&cht=ls&chd=t:0,0|'.$data_string.'&chg=20,20&chls=0.75,-1,-1|6,4,1&chm=o,FF9900,1,-1,7,-1|b,3399CC44,0,1,0"></img>'; } else { $stats = '<img src="images/stats_un.jpg"></img>'; }; } else { print('MySQL query failed with error: ' . mysql_error()); } echo '...'; The problem is that the first output always showing the `( == 8)` (even if it is not equals to 8) instead of the `else` output. Then if i have 2 or more everything comes above the first one is correct but the first one is still showing the `( == 8)`. Any help?
php
mysql
if-statement
while-loops
else
null
open
Confusion with `if` `else` and `while` === I have a code where it should check if the result equals to `8` it need to show something and if not it need to show something `else` and all of that happens inside of a `while` loop. while ($row_fpages2 = mysql_fetch_array($result_fanpage2)) { if ( $row_fpages2['client'] != NULL ) { //GRAPHS $sql = "SELECT likes, date FROM statistics_pages WHERE idnum = '".$idnum."' AND page_name = '".$row_fpages2['page_name']."' ORDER BY `statistics_pages`.`date` DESC LIMIT 8"; $result2 = mysql_query($sql) or die(mysql_error()); if ($result2) { $data = array(); while ($row = mysql_fetch_assoc($result2)) { $data[] = $row["likes"]; } if ($result2 == 8) { $c_data = count($data)-1; $final = array(); for ($i = 0; $i < $c_data; $i++) { $final[] = getZeroResult($data[$i], $data[$i+1]); } $data_string = join(",", $final); $stats = '<img src="http://chart.apis.google.com/chart?chs=240x140&cht=ls&chd=t:0,0|'.$data_string.'&chg=20,20&chls=0.75,-1,-1|6,4,1&chm=o,FF9900,1,-1,7,-1|b,3399CC44,0,1,0"></img>'; } else { $stats = '<img src="images/stats_un.jpg"></img>'; }; } else { print('MySQL query failed with error: ' . mysql_error()); } echo '...'; The problem is that the first output always showing the `( == 8)` (even if it is not equals to 8) instead of the `else` output. Then if i have 2 or more everything comes above the first one is correct but the first one is still showing the `( == 8)`. Any help?
0
8,547,932
12/17/2011 21:08:41
951,057
09/18/2011 08:48:40
44
0
PHP: Remotely Manage a Media Playlist of Another Page?
With PHP, i want to manage (add/remove) the Media Playlist of another page under same domain. <br><br>With this case:<br> - 1st page is "Player" (playing the files)<br> - 2nd page have playlist (So i can manage the player remotely)<br> - Synchronization needs to be (almost) realtime How should i implement for the cases to be "Realtime" and "Fast"?
php
synchronization
remote
real-time
playlist
null
open
PHP: Remotely Manage a Media Playlist of Another Page? === With PHP, i want to manage (add/remove) the Media Playlist of another page under same domain. <br><br>With this case:<br> - 1st page is "Player" (playing the files)<br> - 2nd page have playlist (So i can manage the player remotely)<br> - Synchronization needs to be (almost) realtime How should i implement for the cases to be "Realtime" and "Fast"?
0
10,240,341
04/20/2012 04:38:23
1,276,897
03/18/2012 12:45:02
20
0
What do you need to learn OpenGL?
What do you need to learn OpenGL? Do you need to learn C/C++ first? I have experience with C but none with C++.
c++
c
opengl
graphics
null
04/20/2012 06:15:51
not constructive
What do you need to learn OpenGL? === What do you need to learn OpenGL? Do you need to learn C/C++ first? I have experience with C but none with C++.
4
8,947,507
01/20/2012 20:31:07
448,250
09/15/2010 09:57:21
57
1
How to integrate twitter in an Android Application?
I tried a lot to integrate Twitter in my android application but no luck. I tried using OAUTH. I imported 4 .jar files, eventhough it's not working. I created consumer key and consumer secret key in twitter developer site and i used in my app. every time its showing exception related to consumer key, means i am getting the exception related to keys. I hope i created keys properly only. Can anyone give website links to refer or suggestions to solve this issue.
android
null
null
null
null
null
open
How to integrate twitter in an Android Application? === I tried a lot to integrate Twitter in my android application but no luck. I tried using OAUTH. I imported 4 .jar files, eventhough it's not working. I created consumer key and consumer secret key in twitter developer site and i used in my app. every time its showing exception related to consumer key, means i am getting the exception related to keys. I hope i created keys properly only. Can anyone give website links to refer or suggestions to solve this issue.
0
8,943,170
01/20/2012 14:46:46
976,262
10/03/2011 07:40:28
27
0
Mysql. Query to insert data into a table related to another
I'm new in sql. I have doubt. Let's say that I have two tables. One is called user and the other order. User User_Id - name - email Order Order_id - product - User_id What query should I use to insert a new order in the order table with the User_id field related to the User_id from the user table(an existing user) Eg: Order_id - product - User_id 1a - plate - 1 2a - car - 3 3a - bike - 1 Thanks
java
mysql
sql
query
insert
null
open
Mysql. Query to insert data into a table related to another === I'm new in sql. I have doubt. Let's say that I have two tables. One is called user and the other order. User User_Id - name - email Order Order_id - product - User_id What query should I use to insert a new order in the order table with the User_id field related to the User_id from the user table(an existing user) Eg: Order_id - product - User_id 1a - plate - 1 2a - car - 3 3a - bike - 1 Thanks
0
1,860,796
12/07/2009 15:44:49
110,118
05/20/2009 18:45:59
58
4
Is "Large-Scale C++ Software Design" by John Lakos a mind-provoking (but usually overlooked) gem?
Reading the reviews at Amazon (<http://www.amazon.com/Large-Scale-Software-Design-John-Lakos/dp/0201633620>) and ACCU (<http://accu.informika.ru/accu/bookreviews/public/reviews/l/l000736.htm>) suggests it may be that ==sacred source of wisdom on modularization, etc==. At the same time, the book seems to be really rare: not many have ever read it, no pirate electronic copies floating around, except the fake ones:), (which actually must be a sign of some demand). So, what do you think?
c++
architecture
design
build
large
04/05/2012 14:48:06
not constructive
Is "Large-Scale C++ Software Design" by John Lakos a mind-provoking (but usually overlooked) gem? === Reading the reviews at Amazon (<http://www.amazon.com/Large-Scale-Software-Design-John-Lakos/dp/0201633620>) and ACCU (<http://accu.informika.ru/accu/bookreviews/public/reviews/l/l000736.htm>) suggests it may be that ==sacred source of wisdom on modularization, etc==. At the same time, the book seems to be really rare: not many have ever read it, no pirate electronic copies floating around, except the fake ones:), (which actually must be a sign of some demand). So, what do you think?
4
6,254,545
06/06/2011 15:45:15
31,298
10/24/2008 19:26:59
1,630
77
Where should AND and OR be placed in multi-line conditional statements?
A simple coding standard question: Where should AND and OR be placed in conditional statements? Option 1: if (x = 1 AND y = 2 AND z = 3) if (x = 1 && y = 2 && z = 3) if (x = 1 OR y = 2 OR z = 3) if (x = 1 || y = 2 || z = 3) Ooption 2: if (x = 1 AND y = 2 AND z = 3) if (x = 1 && y = 2 && z = 3) if (x = 1 OR y = 2 OR z = 3 if (x = 1 || y = 2 || z = 3) I personally prefer option 1, since it allows you quickly comment out certain conditions - i.e. with "//" in most scripting languages - but, I see option 2 more often, especially in code formatters. Is there a standard, or, what do you prefer?
coding-style
conditional-formatting
conditional-statements
null
null
06/06/2011 18:47:44
not constructive
Where should AND and OR be placed in multi-line conditional statements? === A simple coding standard question: Where should AND and OR be placed in conditional statements? Option 1: if (x = 1 AND y = 2 AND z = 3) if (x = 1 && y = 2 && z = 3) if (x = 1 OR y = 2 OR z = 3) if (x = 1 || y = 2 || z = 3) Ooption 2: if (x = 1 AND y = 2 AND z = 3) if (x = 1 && y = 2 && z = 3) if (x = 1 OR y = 2 OR z = 3 if (x = 1 || y = 2 || z = 3) I personally prefer option 1, since it allows you quickly comment out certain conditions - i.e. with "//" in most scripting languages - but, I see option 2 more often, especially in code formatters. Is there a standard, or, what do you prefer?
4
6,319,599
06/12/2011 01:38:03
349,528
05/25/2010 03:23:55
1,231
39
Learning XNA 3.1 Vs XNA 4.0
I am starting out learning XNA and its going smoothly. However I wonder if I am shooting myself in the foot by learning 3.1 not 4.0? I am aware of whats new: http://msdn.microsoft.com/en-us/library/bb417503.aspx, and that mostly seems to be phone, interfaces and video features - which I am not so interested in - I am more doing the core 3D stuff. The sticking point is: **I have Visual Studio 2008 professional already and do not want to get VS 2010 if there is little difference in the game programming in 4.0.** **Has the world moved on? Is what I am learning in 3.1 going to be come redundant?** There are also code differences in libraries, but they are not major, many of them can be seen here: http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/, for instance this one which I had to figure out compared to Riemers Tut: **XNA 4.0** protected override void Draw(GameTime gameTime) { device.Clear(Color.DarkSlateBlue); RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; device.RasterizerState = rs; effect.CurrentTechnique = effect.Techniques["ColoredNoShading"]; effect.Parameters["xView"].SetValue(viewMatrix); effect.Parameters["xProjection"].SetValue(projectionMatrix); effect.Parameters["xWorld"].SetValue(Matrix.Identity); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration); } base.Draw(gameTime); } **XNA 3.1** protected override void Draw(GameTime gameTime) { device.Clear(Color.DarkSlateBlue); device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements); device.RenderState.CullMode = CullMode.None; // TODO only for testing! device.RenderState.FillMode = FillMode.Solid; effect.CurrentTechnique = effect.Techniques["ColoredNoShading"]; effect.Parameters["xView"].SetValue(viewMatrix); effect.Parameters["xProjection"].SetValue(projectionMatrix); effect.Parameters["xWorld"].SetValue(Matrix.Identity); effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, 5, indices, 0, indices.Length / 3); pass.End(); } effect.End(); base.Draw(gameTime); }
xna
xna4.0
null
null
null
06/12/2011 13:08:48
off topic
Learning XNA 3.1 Vs XNA 4.0 === I am starting out learning XNA and its going smoothly. However I wonder if I am shooting myself in the foot by learning 3.1 not 4.0? I am aware of whats new: http://msdn.microsoft.com/en-us/library/bb417503.aspx, and that mostly seems to be phone, interfaces and video features - which I am not so interested in - I am more doing the core 3D stuff. The sticking point is: **I have Visual Studio 2008 professional already and do not want to get VS 2010 if there is little difference in the game programming in 4.0.** **Has the world moved on? Is what I am learning in 3.1 going to be come redundant?** There are also code differences in libraries, but they are not major, many of them can be seen here: http://www.nelxon.com/blog/xna-3-1-to-xna-4-0-cheatsheet/, for instance this one which I had to figure out compared to Riemers Tut: **XNA 4.0** protected override void Draw(GameTime gameTime) { device.Clear(Color.DarkSlateBlue); RasterizerState rs = new RasterizerState(); rs.CullMode = CullMode.None; device.RasterizerState = rs; effect.CurrentTechnique = effect.Techniques["ColoredNoShading"]; effect.Parameters["xView"].SetValue(viewMatrix); effect.Parameters["xProjection"].SetValue(projectionMatrix); effect.Parameters["xWorld"].SetValue(Matrix.Identity); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration); } base.Draw(gameTime); } **XNA 3.1** protected override void Draw(GameTime gameTime) { device.Clear(Color.DarkSlateBlue); device.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements); device.RenderState.CullMode = CullMode.None; // TODO only for testing! device.RenderState.FillMode = FillMode.Solid; effect.CurrentTechnique = effect.Techniques["ColoredNoShading"]; effect.Parameters["xView"].SetValue(viewMatrix); effect.Parameters["xProjection"].SetValue(projectionMatrix); effect.Parameters["xWorld"].SetValue(Matrix.Identity); effect.Begin(); foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Begin(); device.DrawUserIndexedPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, vertices, 0, 5, indices, 0, indices.Length / 3); pass.End(); } effect.End(); base.Draw(gameTime); }
2
788,361
04/25/2009 06:31:03
80,112
03/19/2009 16:27:34
1,757
74
Critique this late night, noob Haskell code
I'm working through [Real World Haskell][1], and at the moment doing the exercises at the end of Chapter 3. I'm taking an unusual approach: **even though I know there are some language features they haven't covered yet that would help me, I am trying to do these exercises using *only* things they have explicitly covered.** Why? Just kind of for fun really. It feels like it is forcing me to give my brain some extra practice with recursion. So I just completed the exercise posed as follows: **"Create a function that sorts a list of lists based on the length of each sublist. (You may want to look at the sortBy function from the Data.List module.)"** Now, they threw in the hint about the Data.List module. But they didn't say a word about where reference doc can be found, about how to import stuff, etc. So I decided to *roll my own sort* just to see if I could do it. I used Bubble Sort since it's the simplest algorithm. The result is below. I'd like to get you Haskell gurus to critique it please ... but **with the following caveat in mind:** *If you suggest improvements, please base them on language features covered through chapter 3 of Real World Haskell (or what you guess those features might be without going to the trouble of looking it up). I **know** there are tons of awesome language features waiting for me that will let me make this code better, but right now the specific challenge was to do it with the "primitive" features covered so far.* I'm sure there are cases where I'm reaching around my shoulder to scratch my elbow, cases where I'm using explicit control flow when recursion and pattern matching could do more for me, etc. I'm sure the code could be made much shorter and more readable too. I bet there are good idioms I don't know about that can be used with the primitive language features I'm limiting myself to. Those are the kinds of tips I'd love to receive. This is probably the ugliest code I'm proud of in any language (at least, that I can remember). My first stab, in a functional language, at something beyond "Hello, world" type stuff. And now you are going to beat the crap out of it :) . Be gentle, please, but I'm looking forward to some meaty insight. Thanks. areListsEqual :: (Eq a) => [a] -> [a] -> Bool areListsEqual [] [] = True areListsEqual [] _ = False areListsEqual _ [] = False areListsEqual xs ys = (head xs == head ys) && (areListsEqual (tail xs) (tail ys)) charlieSort :: (Eq a) => [[a]] -> [[a]] charlieSort [] = [] charlieSort (x:xs) | null xs = [x] charlieSort xs | (length xs) >= 2 = if(not (areListsEqual xs wip)) then charlieSort wip else wip where first = head xs second = head (tail xs) theRest = drop 2 xs swapPairIfNeeded a b = if(length a >= length b) then [second, first] else [first, second] modifiedPair = swapPairIfNeeded first second wip = (take 1 modifiedPair) ++ charlieSort ( (drop 1 modifiedPair) ++ theRest) [1]: http://book.realworldhaskell.org/
haskell
functional-programming
sorting
null
null
null
open
Critique this late night, noob Haskell code === I'm working through [Real World Haskell][1], and at the moment doing the exercises at the end of Chapter 3. I'm taking an unusual approach: **even though I know there are some language features they haven't covered yet that would help me, I am trying to do these exercises using *only* things they have explicitly covered.** Why? Just kind of for fun really. It feels like it is forcing me to give my brain some extra practice with recursion. So I just completed the exercise posed as follows: **"Create a function that sorts a list of lists based on the length of each sublist. (You may want to look at the sortBy function from the Data.List module.)"** Now, they threw in the hint about the Data.List module. But they didn't say a word about where reference doc can be found, about how to import stuff, etc. So I decided to *roll my own sort* just to see if I could do it. I used Bubble Sort since it's the simplest algorithm. The result is below. I'd like to get you Haskell gurus to critique it please ... but **with the following caveat in mind:** *If you suggest improvements, please base them on language features covered through chapter 3 of Real World Haskell (or what you guess those features might be without going to the trouble of looking it up). I **know** there are tons of awesome language features waiting for me that will let me make this code better, but right now the specific challenge was to do it with the "primitive" features covered so far.* I'm sure there are cases where I'm reaching around my shoulder to scratch my elbow, cases where I'm using explicit control flow when recursion and pattern matching could do more for me, etc. I'm sure the code could be made much shorter and more readable too. I bet there are good idioms I don't know about that can be used with the primitive language features I'm limiting myself to. Those are the kinds of tips I'd love to receive. This is probably the ugliest code I'm proud of in any language (at least, that I can remember). My first stab, in a functional language, at something beyond "Hello, world" type stuff. And now you are going to beat the crap out of it :) . Be gentle, please, but I'm looking forward to some meaty insight. Thanks. areListsEqual :: (Eq a) => [a] -> [a] -> Bool areListsEqual [] [] = True areListsEqual [] _ = False areListsEqual _ [] = False areListsEqual xs ys = (head xs == head ys) && (areListsEqual (tail xs) (tail ys)) charlieSort :: (Eq a) => [[a]] -> [[a]] charlieSort [] = [] charlieSort (x:xs) | null xs = [x] charlieSort xs | (length xs) >= 2 = if(not (areListsEqual xs wip)) then charlieSort wip else wip where first = head xs second = head (tail xs) theRest = drop 2 xs swapPairIfNeeded a b = if(length a >= length b) then [second, first] else [first, second] modifiedPair = swapPairIfNeeded first second wip = (take 1 modifiedPair) ++ charlieSort ( (drop 1 modifiedPair) ++ theRest) [1]: http://book.realworldhaskell.org/
0
8,251,906
11/24/2011 03:29:28
340,046
05/13/2010 08:02:38
410
19
Learning XNA for Game Development. Is it worth It?
It seems that most of the popular games in the world are developed using C++. But Microsoft's game platform, XNA Studio is based on programming in C# and I didn't find any popular game which was developed using XNA. Also there are fewer Ebooks you find on XNA and even the google search for a problem won't give you much help. Does people doesn't use XNA as a gaming platform? Is it worth learning XNA for game development or should I consider some other platform?
xna
xna4.0
language-learning
null
null
11/25/2011 05:20:58
not constructive
Learning XNA for Game Development. Is it worth It? === It seems that most of the popular games in the world are developed using C++. But Microsoft's game platform, XNA Studio is based on programming in C# and I didn't find any popular game which was developed using XNA. Also there are fewer Ebooks you find on XNA and even the google search for a problem won't give you much help. Does people doesn't use XNA as a gaming platform? Is it worth learning XNA for game development or should I consider some other platform?
4
6,916,517
08/02/2011 18:05:55
567,345
10/19/2009 23:50:21
1
2
How to configure hudson to run tests on cloud?
How to configure/run hudson jobs on the cloud ? Has anyone done it successfully ? Thanks.
hudson
cloud
null
null
null
08/02/2011 22:46:03
not a real question
How to configure hudson to run tests on cloud? === How to configure/run hudson jobs on the cloud ? Has anyone done it successfully ? Thanks.
1
7,797,198
10/17/2011 17:16:04
999,613
10/17/2011 16:51:45
1
0
Wizard navigation with IEnumerable / yield return
I'm newer to C# and have just discovered how to use yield return to create a custom IEnumerable enumeration. I'm trying to use MVVM to create a wizard, but I was having trouble figuring out how to control the flow from one page to the next. In some cases I might want a certain step to appear, in others, it doesn't apply. Anyway, my issue is that I'm using an IEnumerable to return each subsequent page, which works really great, but I know I'm probably doing something improper/unintended with the language. The child class only has to override the abstract Steps IEnumerable accessor: public class HPLDTWizardViewModel : WizardBase { protected override IEnumerable<WizardStep> Steps { get { WizardStep currentStep; // 1.a start with assay selection currentStep = new AssaySelectionViewModel(); yield return currentStep; // 1.b return the selected assay. SigaDataSet.Assay assay = ((AssaySelectionViewModel)currentStep).SelectedAssay; sigaDataSet = (SigaDataSet)assay.Table.DataSet; // 2.a get the number of plates currentStep = new NumPlatesViewModel(sigaDataSet); yield return currentStep; ... } } } The parent class contains the navigation logic using the Steps attributes' enumerator: public abstract class WizardBase : ViewModelBase { protected abstract IEnumerable<WizardStep> Steps { get;} public WizardStep CurrentStep { get { if (_currentStepEnumerator == null) { _currentStepEnumerator = Steps.GetEnumerator(); _currentStepEnumerator.MoveNext(); } return _currentStepEnumerator.Current; } } bool CanMoveToNextPage() { if (CurrentStep == null) return false; else return CurrentStep.IsValid(); } void MoveToNextPage () { _currentStepEnumerator.MoveNext(); if (_currentStepEnumerator.Current == null) OnRequestClose(); else OnPropertyChanged("CurrentStep"); } } As I said, this works wonderfully because I navigate the list with the Enumerator. Navigation logic is in an abstract parent class and all the child has to do is to override the Steps attribute. The WizardSteps themselves contain logic so that they know when they are valid and the user can continue. I'm using MVVM so the next button is bound to the CanMoveToNextPage() and MoveToNextPage() functions through a Command. I guess my question is: **how wrong is it to abuse the enumeration model in this case? Is there a better way?** I really need to define the control flow somehow, and it just fit really well with the yield return ability so that I can have flow logic return to the Steps accessor for then next page.
c#
.net
ienumerable
null
null
null
open
Wizard navigation with IEnumerable / yield return === I'm newer to C# and have just discovered how to use yield return to create a custom IEnumerable enumeration. I'm trying to use MVVM to create a wizard, but I was having trouble figuring out how to control the flow from one page to the next. In some cases I might want a certain step to appear, in others, it doesn't apply. Anyway, my issue is that I'm using an IEnumerable to return each subsequent page, which works really great, but I know I'm probably doing something improper/unintended with the language. The child class only has to override the abstract Steps IEnumerable accessor: public class HPLDTWizardViewModel : WizardBase { protected override IEnumerable<WizardStep> Steps { get { WizardStep currentStep; // 1.a start with assay selection currentStep = new AssaySelectionViewModel(); yield return currentStep; // 1.b return the selected assay. SigaDataSet.Assay assay = ((AssaySelectionViewModel)currentStep).SelectedAssay; sigaDataSet = (SigaDataSet)assay.Table.DataSet; // 2.a get the number of plates currentStep = new NumPlatesViewModel(sigaDataSet); yield return currentStep; ... } } } The parent class contains the navigation logic using the Steps attributes' enumerator: public abstract class WizardBase : ViewModelBase { protected abstract IEnumerable<WizardStep> Steps { get;} public WizardStep CurrentStep { get { if (_currentStepEnumerator == null) { _currentStepEnumerator = Steps.GetEnumerator(); _currentStepEnumerator.MoveNext(); } return _currentStepEnumerator.Current; } } bool CanMoveToNextPage() { if (CurrentStep == null) return false; else return CurrentStep.IsValid(); } void MoveToNextPage () { _currentStepEnumerator.MoveNext(); if (_currentStepEnumerator.Current == null) OnRequestClose(); else OnPropertyChanged("CurrentStep"); } } As I said, this works wonderfully because I navigate the list with the Enumerator. Navigation logic is in an abstract parent class and all the child has to do is to override the Steps attribute. The WizardSteps themselves contain logic so that they know when they are valid and the user can continue. I'm using MVVM so the next button is bound to the CanMoveToNextPage() and MoveToNextPage() functions through a Command. I guess my question is: **how wrong is it to abuse the enumeration model in this case? Is there a better way?** I really need to define the control flow somehow, and it just fit really well with the yield return ability so that I can have flow logic return to the Steps accessor for then next page.
0
10,840,098
05/31/2012 19:32:02
851,392
07/19/2011 06:38:14
21
0
How to code hash function for "void *" using C language in linux 32-bit machine
I want to code hash function using C language on Linux 32-bit machine (ubuntu 9.x). I am using the following signature int hash(void * ptr); The function should map a pointer (address on the heap), to an integer in the range [0,9999]. In order to register pointer in a static hash-table (10000*20 2D array). Thank you very much.
c
linux
algorithm
gcc
hash
05/31/2012 20:08:13
not a real question
How to code hash function for "void *" using C language in linux 32-bit machine === I want to code hash function using C language on Linux 32-bit machine (ubuntu 9.x). I am using the following signature int hash(void * ptr); The function should map a pointer (address on the heap), to an integer in the range [0,9999]. In order to register pointer in a static hash-table (10000*20 2D array). Thank you very much.
1
7,820,906
10/19/2011 11:56:31
440,694
09/06/2010 09:05:25
2,019
198
OpenCV Eye Tracking looses out for some frames
I am pasting code below to track both eyes and overlay an image when both eyes are tracked. I am using haar xml files to track both eyes of faces and overlaying an image over it. My problem is I get result like this. **Img 1** ![Img1][1] **Img 2** ![Img2][2] **Img 3** ![Img3][3] **Img 4** ![Img4][4] **Img 5** ![Img5][5] **Img 6** ![Img6][6] **Img 7** ![Img7][7] **Img 8** ![Img8][8] **Img 9** ![Img9][9] **Img 10** ![Img10][10] I am posting my code below #include "cv.h" #include "highgui.h" #include <iostream> #include <fstream> #include <vector> #include <stdio.h> #include <sys/stat.h> #include <ctype.h> #include <string> using namespace cv; using namespace std; void detectAndDisplay( Mat frame ); String face_cascade_name = "/root/opencv/newtutorial/haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "/root/opencv/newtutorial/haarcascade_eye_tree_eyeglasses.xml"; CascadeClassifier face_cascade; CascadeClassifier eyes_cascade; RNG rng(12345); IplImage *disp,*neg_img,*cpy_img,*imga; IplImage *pic; IplImage *image_n = 0; int make=0; CvMat* warp_matrix = cvCreateMat(3,3,CV_32FC1); //hide the local functions in an anon namespace namespace { void makevdo(){ bool flag = false; fstream fin; char filename_new[200],filename_new_after[200]; int n=0; Mat frame; double frameRate = 25.0; //VideoWriter* writer = NULL; CvVideoWriter *vdowriter = cvCreateVideoWriter( "/root/opencv/newtutorial/test_converted_next.mov", CV_FOURCC('j','p','e','g'), frameRate, Size(640,480) ); //string outputFile = "/root/opencv/newtutorial/test.mov"; //writer = new VideoWriter(outputFile,CV_FOURCC('j','p','e','g'),frameRate,Size(640,480)); while(flag==false){ sprintf(filename_new,"/root/opencv/newtutorial/mydirnext/filename%.3d.jpg",n); sprintf(filename_new_after,"/root/opencv/newtutorial/framesaftertrack/filename%.3d.jpg",n); fin.open(filename_new,ios::in); if( fin.is_open() ) { frame = imread(filename_new); pic = cvLoadImage("/root/opencv/newtutorial/pic.png"); image_n = cvLoadImage(filename_new,1); disp = cvCreateImage( cvGetSize(image_n), 8, 3 ); cpy_img = cvCreateImage( cvGetSize(image_n), 8, 3 ); neg_img = cvCreateImage( cvGetSize(image_n), 8, 3 ); std::vector<Rect> faces; Mat frame_gray; cvtColor( frame, frame_gray, CV_BGR2GRAY ); equalizeHist( frame_gray, frame_gray ); //-- Detect faces face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); CvPoint2D32f q[4]; q[0].x= (float) pic->width * 0; q[0].y= (float) pic->height * 0; q[1].x= (float) pic->width; q[1].y= (float) pic->height * 0; q[2].x= (float) pic->width; q[2].y= (float) pic->height; q[3].x= (float) pic->width * 0; q[3].y= (float) pic->height; for( int i = 0; i < (int)faces.size(); i++ ) { //Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); //ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 2, 8, 0 ); Mat faceROI = frame_gray( faces[i] ); std::vector<Rect> eyes; //-- In each face, detect eyes eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) ); if((int)eyes.size()==2 && (((eyes[0].x + eyes[0].width*0.5 ) < eyes[1].x) || ((eyes[1].x + eyes[1].width*0.5 ) < eyes[0].x))){ CvPoint2D32f p[4]; IplImage* blank = cvCreateImage( cvGetSize(pic), 8, 3); cvZero(blank); cvNot(blank,blank); if(eyes[0].x<eyes[1].x){ Point center0( faces[i].x + eyes[0].x + eyes[0].width*0.5, faces[i].y + eyes[0].y + eyes[0].height*0.5 ); float radius0 = (eyes[0].width + eyes[0].height)*0.25 ; Point center1( faces[i].x + eyes[1].x + eyes[1].width*0.5, faces[i].y + eyes[1].y + eyes[1].height*0.5 ); float radius1 = (eyes[1].width + eyes[1].height)*0.25 ; //cvCircle( image_n, center0, radius0, Scalar( 255, 0, 0 ), 3, 8, 0 ); //cvCircle( image_n, center1, radius1, Scalar( 255, 0, 0 ), 3, 8, 0 ); p[2].x= (float) center0.x - radius0; p[2].y= (float) center0.y + radius0; p[1].x= (float) center0.x - radius0; p[1].y= (float) center0.y - radius0; p[3].x= (float) center1.x + radius1; p[3].y= (float) center1.y + radius1; p[0].x= (float) center1.x + radius1; p[0].y= (float) center1.y - radius1; } else{ Point center0( faces[i].x + eyes[1].x + eyes[1].width*0.5, faces[i].y + eyes[1].y + eyes[1].height*0.5 ); float radius0 = (eyes[1].width + eyes[1].height)*0.25 ; Point center1( faces[i].x + eyes[0].x + eyes[0].width*0.5, faces[i].y + eyes[0].y + eyes[0].height*0.5 ); float radius1 = (eyes[0].width + eyes[0].height)*0.25 ; //cvCircle( image_n, center0, radius0, Scalar( 255, 0, 0 ), 3, 8, 0 ); //cvCircle( image_n, center1, radius1, Scalar( 255, 0, 0 ), 3, 8, 0 ); p[2].x= (float) center0.x - radius0; p[2].y= (float) center0.y + radius0; p[1].x= (float) center0.x - radius0; p[1].y= (float) center0.y - radius0; p[3].x= (float) center1.x + radius1; p[3].y= (float) center1.y + radius1; p[0].x= (float) center1.x + radius1; p[0].y= (float) center1.y - radius1; } cvGetPerspectiveTransform(q,p,warp_matrix); //Boolean juggle to obtain 2D-Augmentation cvZero(neg_img); cvZero(cpy_img); cvWarpPerspective( pic, neg_img, warp_matrix); cvWarpPerspective( blank, cpy_img, warp_matrix); cvNot(cpy_img,cpy_img); cvAnd(cpy_img,image_n,cpy_img); cvOr(cpy_img,neg_img,image_n); } } cvSaveImage(filename_new_after,image_n); cvWriteFrame(vdowriter,image_n); //writer->write(frame); cout<<"Read file filename"<< n <<endl; } else{ flag=true; //delete writer; } fin.close(); n++; } cvReleaseVideoWriter(&vdowriter); cvReleaseImage(&pic); cvReleaseImage(&imga); cvReleaseImage(&disp); cvReleaseImage(&neg_img); cvReleaseImage(&cpy_img); cvReleaseImage(&image_n); } int process(VideoCapture& capture) { char strFrame[]="/root/opencv/newtutorial/mydirnext"; if(mkdir(strFrame,0777)==-1)//creating a directory { cout<<"Error Trying to delete"<<endl; if(system("rm -r /root/opencv/newtutorial/mydirnext")){ cout << "Directory successfully deleted"<<endl; } if(mkdir(strFrame,0777)==-1){ cout << "Error Again creating directory" << endl; } } int n = 0; char filename[200]; string window_name = "video | q or esc to quit"; cout << "press space to save a picture. q or esc to quit" << endl; namedWindow(window_name, CV_WINDOW_KEEPRATIO); //resizable window; Mat frame; for (;;) { capture >> frame; if (frame.empty()) continue; imshow(window_name, frame); sprintf(filename,"/root/opencv/newtutorial/mydirnext/filename%.3d.jpg",n++); imwrite(filename,frame); char key = (char)waitKey(5); //delay N millis, usually long enough to display and capture input switch (key) { case 'q': if(make==0){ make=1; makevdo(); } case 'Q': case 27: //escape key if(make==0){ make=1; makevdo(); } /*if(writer != NULL) { delete writer; }*/ return 0; default: break; } } return 0; } } int main(int ac, char** av) { if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if (ac != 2) { return 1; } std::string arg = av[1]; VideoCapture capture(arg); //try to open string, this will attempt to open it as a video file if (!capture.isOpened()) //if this fails, try to open as a video camera, through the use of an integer param capture.open(atoi(arg.c_str())); if (!capture.isOpened()) { cerr << "Failed to open a video device or video file!\n" << endl; return 1; } return process(capture); } [1]: http://i.stack.imgur.com/zWMeg.jpg [2]: http://i.stack.imgur.com/Q8Vkv.jpg [3]: http://i.stack.imgur.com/cKg1c.jpg [4]: http://i.stack.imgur.com/AqD2I.jpg [5]: http://i.stack.imgur.com/CDwWP.jpg [6]: http://i.stack.imgur.com/fEqNz.jpg [7]: http://i.stack.imgur.com/5Wwik.jpg [8]: http://i.stack.imgur.com/qpUEx.jpg [9]: http://i.stack.imgur.com/aJXZY.jpg [10]: http://i.stack.imgur.com/y3BKf.jpg Sorry for posting so many Images SO, but No other way to explain my problem.
opencv
eye-detection
null
null
null
null
open
OpenCV Eye Tracking looses out for some frames === I am pasting code below to track both eyes and overlay an image when both eyes are tracked. I am using haar xml files to track both eyes of faces and overlaying an image over it. My problem is I get result like this. **Img 1** ![Img1][1] **Img 2** ![Img2][2] **Img 3** ![Img3][3] **Img 4** ![Img4][4] **Img 5** ![Img5][5] **Img 6** ![Img6][6] **Img 7** ![Img7][7] **Img 8** ![Img8][8] **Img 9** ![Img9][9] **Img 10** ![Img10][10] I am posting my code below #include "cv.h" #include "highgui.h" #include <iostream> #include <fstream> #include <vector> #include <stdio.h> #include <sys/stat.h> #include <ctype.h> #include <string> using namespace cv; using namespace std; void detectAndDisplay( Mat frame ); String face_cascade_name = "/root/opencv/newtutorial/haarcascade_frontalface_alt.xml"; String eyes_cascade_name = "/root/opencv/newtutorial/haarcascade_eye_tree_eyeglasses.xml"; CascadeClassifier face_cascade; CascadeClassifier eyes_cascade; RNG rng(12345); IplImage *disp,*neg_img,*cpy_img,*imga; IplImage *pic; IplImage *image_n = 0; int make=0; CvMat* warp_matrix = cvCreateMat(3,3,CV_32FC1); //hide the local functions in an anon namespace namespace { void makevdo(){ bool flag = false; fstream fin; char filename_new[200],filename_new_after[200]; int n=0; Mat frame; double frameRate = 25.0; //VideoWriter* writer = NULL; CvVideoWriter *vdowriter = cvCreateVideoWriter( "/root/opencv/newtutorial/test_converted_next.mov", CV_FOURCC('j','p','e','g'), frameRate, Size(640,480) ); //string outputFile = "/root/opencv/newtutorial/test.mov"; //writer = new VideoWriter(outputFile,CV_FOURCC('j','p','e','g'),frameRate,Size(640,480)); while(flag==false){ sprintf(filename_new,"/root/opencv/newtutorial/mydirnext/filename%.3d.jpg",n); sprintf(filename_new_after,"/root/opencv/newtutorial/framesaftertrack/filename%.3d.jpg",n); fin.open(filename_new,ios::in); if( fin.is_open() ) { frame = imread(filename_new); pic = cvLoadImage("/root/opencv/newtutorial/pic.png"); image_n = cvLoadImage(filename_new,1); disp = cvCreateImage( cvGetSize(image_n), 8, 3 ); cpy_img = cvCreateImage( cvGetSize(image_n), 8, 3 ); neg_img = cvCreateImage( cvGetSize(image_n), 8, 3 ); std::vector<Rect> faces; Mat frame_gray; cvtColor( frame, frame_gray, CV_BGR2GRAY ); equalizeHist( frame_gray, frame_gray ); //-- Detect faces face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ); CvPoint2D32f q[4]; q[0].x= (float) pic->width * 0; q[0].y= (float) pic->height * 0; q[1].x= (float) pic->width; q[1].y= (float) pic->height * 0; q[2].x= (float) pic->width; q[2].y= (float) pic->height; q[3].x= (float) pic->width * 0; q[3].y= (float) pic->height; for( int i = 0; i < (int)faces.size(); i++ ) { //Point center( faces[i].x + faces[i].width*0.5, faces[i].y + faces[i].height*0.5 ); //ellipse( frame, center, Size( faces[i].width*0.5, faces[i].height*0.5), 0, 0, 360, Scalar( 255, 0, 255 ), 2, 8, 0 ); Mat faceROI = frame_gray( faces[i] ); std::vector<Rect> eyes; //-- In each face, detect eyes eyes_cascade.detectMultiScale( faceROI, eyes, 1.1, 2, 0 |CV_HAAR_SCALE_IMAGE, Size(30, 30) ); if((int)eyes.size()==2 && (((eyes[0].x + eyes[0].width*0.5 ) < eyes[1].x) || ((eyes[1].x + eyes[1].width*0.5 ) < eyes[0].x))){ CvPoint2D32f p[4]; IplImage* blank = cvCreateImage( cvGetSize(pic), 8, 3); cvZero(blank); cvNot(blank,blank); if(eyes[0].x<eyes[1].x){ Point center0( faces[i].x + eyes[0].x + eyes[0].width*0.5, faces[i].y + eyes[0].y + eyes[0].height*0.5 ); float radius0 = (eyes[0].width + eyes[0].height)*0.25 ; Point center1( faces[i].x + eyes[1].x + eyes[1].width*0.5, faces[i].y + eyes[1].y + eyes[1].height*0.5 ); float radius1 = (eyes[1].width + eyes[1].height)*0.25 ; //cvCircle( image_n, center0, radius0, Scalar( 255, 0, 0 ), 3, 8, 0 ); //cvCircle( image_n, center1, radius1, Scalar( 255, 0, 0 ), 3, 8, 0 ); p[2].x= (float) center0.x - radius0; p[2].y= (float) center0.y + radius0; p[1].x= (float) center0.x - radius0; p[1].y= (float) center0.y - radius0; p[3].x= (float) center1.x + radius1; p[3].y= (float) center1.y + radius1; p[0].x= (float) center1.x + radius1; p[0].y= (float) center1.y - radius1; } else{ Point center0( faces[i].x + eyes[1].x + eyes[1].width*0.5, faces[i].y + eyes[1].y + eyes[1].height*0.5 ); float radius0 = (eyes[1].width + eyes[1].height)*0.25 ; Point center1( faces[i].x + eyes[0].x + eyes[0].width*0.5, faces[i].y + eyes[0].y + eyes[0].height*0.5 ); float radius1 = (eyes[0].width + eyes[0].height)*0.25 ; //cvCircle( image_n, center0, radius0, Scalar( 255, 0, 0 ), 3, 8, 0 ); //cvCircle( image_n, center1, radius1, Scalar( 255, 0, 0 ), 3, 8, 0 ); p[2].x= (float) center0.x - radius0; p[2].y= (float) center0.y + radius0; p[1].x= (float) center0.x - radius0; p[1].y= (float) center0.y - radius0; p[3].x= (float) center1.x + radius1; p[3].y= (float) center1.y + radius1; p[0].x= (float) center1.x + radius1; p[0].y= (float) center1.y - radius1; } cvGetPerspectiveTransform(q,p,warp_matrix); //Boolean juggle to obtain 2D-Augmentation cvZero(neg_img); cvZero(cpy_img); cvWarpPerspective( pic, neg_img, warp_matrix); cvWarpPerspective( blank, cpy_img, warp_matrix); cvNot(cpy_img,cpy_img); cvAnd(cpy_img,image_n,cpy_img); cvOr(cpy_img,neg_img,image_n); } } cvSaveImage(filename_new_after,image_n); cvWriteFrame(vdowriter,image_n); //writer->write(frame); cout<<"Read file filename"<< n <<endl; } else{ flag=true; //delete writer; } fin.close(); n++; } cvReleaseVideoWriter(&vdowriter); cvReleaseImage(&pic); cvReleaseImage(&imga); cvReleaseImage(&disp); cvReleaseImage(&neg_img); cvReleaseImage(&cpy_img); cvReleaseImage(&image_n); } int process(VideoCapture& capture) { char strFrame[]="/root/opencv/newtutorial/mydirnext"; if(mkdir(strFrame,0777)==-1)//creating a directory { cout<<"Error Trying to delete"<<endl; if(system("rm -r /root/opencv/newtutorial/mydirnext")){ cout << "Directory successfully deleted"<<endl; } if(mkdir(strFrame,0777)==-1){ cout << "Error Again creating directory" << endl; } } int n = 0; char filename[200]; string window_name = "video | q or esc to quit"; cout << "press space to save a picture. q or esc to quit" << endl; namedWindow(window_name, CV_WINDOW_KEEPRATIO); //resizable window; Mat frame; for (;;) { capture >> frame; if (frame.empty()) continue; imshow(window_name, frame); sprintf(filename,"/root/opencv/newtutorial/mydirnext/filename%.3d.jpg",n++); imwrite(filename,frame); char key = (char)waitKey(5); //delay N millis, usually long enough to display and capture input switch (key) { case 'q': if(make==0){ make=1; makevdo(); } case 'Q': case 27: //escape key if(make==0){ make=1; makevdo(); } /*if(writer != NULL) { delete writer; }*/ return 0; default: break; } } return 0; } } int main(int ac, char** av) { if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if (ac != 2) { return 1; } std::string arg = av[1]; VideoCapture capture(arg); //try to open string, this will attempt to open it as a video file if (!capture.isOpened()) //if this fails, try to open as a video camera, through the use of an integer param capture.open(atoi(arg.c_str())); if (!capture.isOpened()) { cerr << "Failed to open a video device or video file!\n" << endl; return 1; } return process(capture); } [1]: http://i.stack.imgur.com/zWMeg.jpg [2]: http://i.stack.imgur.com/Q8Vkv.jpg [3]: http://i.stack.imgur.com/cKg1c.jpg [4]: http://i.stack.imgur.com/AqD2I.jpg [5]: http://i.stack.imgur.com/CDwWP.jpg [6]: http://i.stack.imgur.com/fEqNz.jpg [7]: http://i.stack.imgur.com/5Wwik.jpg [8]: http://i.stack.imgur.com/qpUEx.jpg [9]: http://i.stack.imgur.com/aJXZY.jpg [10]: http://i.stack.imgur.com/y3BKf.jpg Sorry for posting so many Images SO, but No other way to explain my problem.
0
7,506,482
09/21/2011 20:52:38
847,061
07/15/2011 19:32:31
8
1
What is causing huge performance differences in these c write() calls?
Does anybody see the difference between these two lines? 1) ret = write( fd_out, local_bugger, bytes_to_move); 2) nwritten = write (fd, buf + total_written, size - total_written); Obviously, not the naming conventions. Specifically, one is writing over the network 4x faster than the other. Looking for logic , flags, etc THANKS
c
gcc
dd
null
null
09/22/2011 05:27:37
not a real question
What is causing huge performance differences in these c write() calls? === Does anybody see the difference between these two lines? 1) ret = write( fd_out, local_bugger, bytes_to_move); 2) nwritten = write (fd, buf + total_written, size - total_written); Obviously, not the naming conventions. Specifically, one is writing over the network 4x faster than the other. Looking for logic , flags, etc THANKS
1
7,296,268
09/03/2011 22:33:53
915,751
08/27/2011 18:14:48
3
0
Canvas zoom in and zoom out, is there a better way to implement it?
I have created a custom class derived from Canvas, which contain elements which will be derived from Visual. The canvas also contains a grid which i have created by creating lines. Now for zooming, i remove everything from the canvas, resize the canvas (which is placed inside ScrollViewer), and redraw everything that is on it. Is there a better way to implement zoom, something that is provided, which allows me to scroll and zoom, and somehow create a viewport, that i can move and resize (for scrolling and zooming)? Because my concern is that soon there will be complex shapes, curves and points placed on the canvas, and maybe by the thousands, and things will get pretty slow if i use the approach that i am using currently. Please tell if there is a better way.
c#
.net
wpf
null
null
null
open
Canvas zoom in and zoom out, is there a better way to implement it? === I have created a custom class derived from Canvas, which contain elements which will be derived from Visual. The canvas also contains a grid which i have created by creating lines. Now for zooming, i remove everything from the canvas, resize the canvas (which is placed inside ScrollViewer), and redraw everything that is on it. Is there a better way to implement zoom, something that is provided, which allows me to scroll and zoom, and somehow create a viewport, that i can move and resize (for scrolling and zooming)? Because my concern is that soon there will be complex shapes, curves and points placed on the canvas, and maybe by the thousands, and things will get pretty slow if i use the approach that i am using currently. Please tell if there is a better way.
0
3,455,488
08/11/2010 05:20:32
416,872
08/11/2010 05:20:32
1
0
"Code is read more than it is written"
I often hear the adage, "Code is read more than it is written." I happen to agree with this sentiment, but I can't find any studies or statistics to back it up. Has anyone come across a substantial finding on this topic (something more than an apocryphal tale) or, better yet, done this sort of research?
statistics
software-engineering
research
null
null
08/11/2010 06:37:37
off topic
"Code is read more than it is written" === I often hear the adage, "Code is read more than it is written." I happen to agree with this sentiment, but I can't find any studies or statistics to back it up. Has anyone come across a substantial finding on this topic (something more than an apocryphal tale) or, better yet, done this sort of research?
2
5,446,495
03/27/2011 01:03:59
642,178
03/03/2011 00:33:00
85
5
php user autologin
Can't find answer to my question. I'm creating registration and need autologin for user with cookie. What kind of information should be stored in cookie? Is it username + hash password or what
php
null
null
null
null
null
open
php user autologin === Can't find answer to my question. I'm creating registration and need autologin for user with cookie. What kind of information should be stored in cookie? Is it username + hash password or what
0
10,117,521
04/12/2012 04:50:02
697,795
04/08/2011 00:26:04
116
0
software design - tools and tips on how to develop api's and such
I have become a software programmer over the years. I have read books on programming, different types software development approaches like waterfall. UML concepts such as class diagrams. But, I'm always lacking in the design side. I'm looking for a tool or something that will easily aid me in designing software. For example, when I'm trying to build a game from scratch. I have a player class, that can shoot and interact. The player class has a super class which is a character. But two days later, I realize I need to add a subclass. I keep having to add functions, classes here and there. It's like i'm writing, rewriting class diagrams and sequence diagrams to the point where it's slowing me down a lot. And when I do start coding, I have to modify the class diagrams yet again. I don't think I'm using the right approach. Is pencil and paper method any better? Is there an easier way to approach classes, interaction, sequences?
java
javascript
oop
null
null
04/12/2012 05:10:09
not constructive
software design - tools and tips on how to develop api's and such === I have become a software programmer over the years. I have read books on programming, different types software development approaches like waterfall. UML concepts such as class diagrams. But, I'm always lacking in the design side. I'm looking for a tool or something that will easily aid me in designing software. For example, when I'm trying to build a game from scratch. I have a player class, that can shoot and interact. The player class has a super class which is a character. But two days later, I realize I need to add a subclass. I keep having to add functions, classes here and there. It's like i'm writing, rewriting class diagrams and sequence diagrams to the point where it's slowing me down a lot. And when I do start coding, I have to modify the class diagrams yet again. I don't think I'm using the right approach. Is pencil and paper method any better? Is there an easier way to approach classes, interaction, sequences?
4