PostId
int64
4
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
1
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-55
461k
OwnerUndeletedAnswerCountAtPostTime
int64
0
21.5k
Title
stringlengths
3
250
BodyMarkdown
stringlengths
5
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
32
30.1k
OpenStatus_id
int64
0
4
11,542,214
07/18/2012 13:11:26
93,647
04/21/2009 08:11:02
1,287
15
should I use Microsoft chart controls?
I've googled something called `Microsoft chart controls` that seems a little bit old project (~2008) but it seems still alive and pretty much supported. I just want to draw regular graphs in my standalone application (WinForms, WPF or anything else - i don't care). More information in my previous, closed, question http://stackoverflow.com/questions/11539775/c-sharp-opensource-project-to-draw-graphs-or-should-i-write-that-myself 1. Could you recommend `Microsoft Chart Controls`? Or you probably can suggest something better? 2. Must I install this? http://www.microsoft.com/en-us/download/details.aspx?id=14422 3. Am I correct that this is http://msdn.microsoft.com/en-us/library/dd456632.aspx a good page to get started? (if this page about `Microsoft Chart Controls` or it about other `Chart Controls`)?
c#
null
null
null
null
07/18/2012 14:03:34
not constructive
should I use Microsoft chart controls? === I've googled something called `Microsoft chart controls` that seems a little bit old project (~2008) but it seems still alive and pretty much supported. I just want to draw regular graphs in my standalone application (WinForms, WPF or anything else - i don't care). More information in my previous, closed, question http://stackoverflow.com/questions/11539775/c-sharp-opensource-project-to-draw-graphs-or-should-i-write-that-myself 1. Could you recommend `Microsoft Chart Controls`? Or you probably can suggest something better? 2. Must I install this? http://www.microsoft.com/en-us/download/details.aspx?id=14422 3. Am I correct that this is http://msdn.microsoft.com/en-us/library/dd456632.aspx a good page to get started? (if this page about `Microsoft Chart Controls` or it about other `Chart Controls`)?
4
11,542,215
07/18/2012 13:11:27
1,451,415
06/12/2012 13:56:19
23
0
String to Enumeration
i have got code like this: BufferedReader in = new BufferedReader(new FileReader("C:\file.txt")); String text = in.readLine();//lets say text is now "asd" now after that i have got a method private static void doSomething(Enum word) { } is it possible to somehow convert this text into an Enum?
java
enums
enumeration
bufferedreader
null
null
open
String to Enumeration === i have got code like this: BufferedReader in = new BufferedReader(new FileReader("C:\file.txt")); String text = in.readLine();//lets say text is now "asd" now after that i have got a method private static void doSomething(Enum word) { } is it possible to somehow convert this text into an Enum?
0
11,542,216
07/18/2012 13:11:26
865,982
07/27/2011 17:34:22
631
25
How to create a Comparer from a lambda function easily?
I am wondering if there was a class provided in the .Net framework that implements IComparer<T> and that can be constructed from a lambda function. That would be useful to be able to do: void SortByLength(List<string> t) { t = t.OrderBy( s => s, Comparer<string>.FromLambda((s1,s2) => s1.Length.CompareTo(s2.Length)) ).ToList(); } It would be much easier than having to define a Comparer class each time. I know it is not complicated to create such a FromLambda method, but I was wondering if there was an existing way in the framework as I see this as being a pretty common feature.
c#
null
null
null
null
null
open
How to create a Comparer from a lambda function easily? === I am wondering if there was a class provided in the .Net framework that implements IComparer<T> and that can be constructed from a lambda function. That would be useful to be able to do: void SortByLength(List<string> t) { t = t.OrderBy( s => s, Comparer<string>.FromLambda((s1,s2) => s1.Length.CompareTo(s2.Length)) ).ToList(); } It would be much easier than having to define a Comparer class each time. I know it is not complicated to create such a FromLambda method, but I was wondering if there was an existing way in the framework as I see this as being a pretty common feature.
0
11,541,327
07/18/2012 12:26:47
1,227,632
02/23/2012 06:31:02
50
2
Storing the results of Html.Action call in a dictionary? (ASP.NET MVC 3)
I'm working on an ASP.NET MVC3 app, and I'd like to make a call from the view to the controller and store that information as a Dictionary. **Controller code:** public Dictionary<string,int> foo() { Dictionary<string,int> bar = new Dictionary<string,int>(); bar.Add("test",100); return bar; } **View code:** @{ Dictionary<string,int> foobar = Html.Action("foo"); } I can get the view to work if I use `var foobar = Html.Action("foo");`, but then it just says that foobar is of type `System.Web.Mvc.MvcHtmlString`, so I can't do much with it. Is there any built-in functionality that I'm missing, or should I just use something like a JSON result for this?
asp.net-mvc-3
null
null
null
null
null
open
Storing the results of Html.Action call in a dictionary? (ASP.NET MVC 3) === I'm working on an ASP.NET MVC3 app, and I'd like to make a call from the view to the controller and store that information as a Dictionary. **Controller code:** public Dictionary<string,int> foo() { Dictionary<string,int> bar = new Dictionary<string,int>(); bar.Add("test",100); return bar; } **View code:** @{ Dictionary<string,int> foobar = Html.Action("foo"); } I can get the view to work if I use `var foobar = Html.Action("foo");`, but then it just says that foobar is of type `System.Web.Mvc.MvcHtmlString`, so I can't do much with it. Is there any built-in functionality that I'm missing, or should I just use something like a JSON result for this?
0
11,541,329
07/18/2012 12:26:47
973,477
09/30/2011 16:44:26
245
7
How to check downloading data percentage from internet in iOS?
I am trying to download data from internet to NSData in iOS. When i download data from internet , i can't see how many percentage downloaded from server. I'm not using UIWebView. download sound (.mp3) from internet with NSData. Is there anyways can i know how much data downloaded from internet? Thanks in advance.
ios
nsdata
null
null
null
null
open
How to check downloading data percentage from internet in iOS? === I am trying to download data from internet to NSData in iOS. When i download data from internet , i can't see how many percentage downloaded from server. I'm not using UIWebView. download sound (.mp3) from internet with NSData. Is there anyways can i know how much data downloaded from internet? Thanks in advance.
0
11,542,218
07/18/2012 13:11:45
1,384,916
05/09/2012 14:50:03
18
2
Get parent directory of parent directory
I have a string relating to a location on a network and I need to get the directory that is 2 up from this location. The string could be in the format: string networkDir = "\\\\networkLocation\\staff\\users\\username"; In which case I would need the `staff` folder and could use the following logic: string parentDir1 = Path.GetDirectoryName(networkDir); string parentDir2 = Path.GetPathRoot(Path.GetDirectoryName(networkDir)); However, if the string is in the format: string networkDir = "\\\\networkLocation\\users\\username"; I would need the `networkLocation` folder and `parentDir2` returns null. How can I do this?
c#
null
null
null
null
null
open
Get parent directory of parent directory === I have a string relating to a location on a network and I need to get the directory that is 2 up from this location. The string could be in the format: string networkDir = "\\\\networkLocation\\staff\\users\\username"; In which case I would need the `staff` folder and could use the following logic: string parentDir1 = Path.GetDirectoryName(networkDir); string parentDir2 = Path.GetPathRoot(Path.GetDirectoryName(networkDir)); However, if the string is in the format: string networkDir = "\\\\networkLocation\\users\\username"; I would need the `networkLocation` folder and `parentDir2` returns null. How can I do this?
0
11,542,220
07/18/2012 13:11:50
1,137,082
01/08/2012 13:07:07
38
0
910428 - a field in DataGridView control auto-decrements
i've a data grid view control bound to an mdb file. the first field is id. i've not made the mdb file. when in program i see that whenever i come to create a new row the id gets -1. if i leave it and go to another row indicating i'm not going to add a new row and return to it (last row) the field gets -2. when i repeatedly do this i see that the value gets decremented each time. at first the mdb file has two rows with ids 1 and 2. if it's defined as an auto-increment field, it must be initialized with 3 each time, not to decrement each time. since this is my first try with data grid view, please inform me about this behavior and how can i fix this? thx
c#
datagridview
null
null
null
null
open
910428 - a field in DataGridView control auto-decrements === i've a data grid view control bound to an mdb file. the first field is id. i've not made the mdb file. when in program i see that whenever i come to create a new row the id gets -1. if i leave it and go to another row indicating i'm not going to add a new row and return to it (last row) the field gets -2. when i repeatedly do this i see that the value gets decremented each time. at first the mdb file has two rows with ids 1 and 2. if it's defined as an auto-increment field, it must be initialized with 3 each time, not to decrement each time. since this is my first try with data grid view, please inform me about this behavior and how can i fix this? thx
0
11,542,222
07/18/2012 13:11:55
1,461,713
06/17/2012 10:46:09
114
10
JSF + JAAS + EJB - Change own Principal name while logged-in?
I want to know if there is a clean way to let a JAAS Principal change its **own** name. I am using a FORM-based login and the Principals and Roles are saved in a database. My current approach is to simply merge an user-entity with the new user-name into the database. So the next statement in my application will be denied and the application "crashes" with a > javax.ejb.EJBAccessException: JBAS013323: Invalid User. I can't redirect to the login-page or anything else, because that would require rights. Is there any solution or is there no clean way to change the user name at "runtime"? I am using JBoss 7.1.
java
jsf-2.0
jaas
null
null
null
open
JSF + JAAS + EJB - Change own Principal name while logged-in? === I want to know if there is a clean way to let a JAAS Principal change its **own** name. I am using a FORM-based login and the Principals and Roles are saved in a database. My current approach is to simply merge an user-entity with the new user-name into the database. So the next statement in my application will be denied and the application "crashes" with a > javax.ejb.EJBAccessException: JBAS013323: Invalid User. I can't redirect to the login-page or anything else, because that would require rights. Is there any solution or is there no clean way to change the user name at "runtime"? I am using JBoss 7.1.
0
11,479,535
07/13/2012 23:16:52
654,928
03/11/2011 07:12:42
1,188
16
Strange servlet error
[#|2012-07-13T19:12:21.949-0400|SEVERE|glassfish3.1.2|global|_ThreadID=402;_ThreadName=Thread-2;|The Class web.servlet.annotation_war.TestGenericServletDemoServlet having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet. symbol: TYPE location: class web.servlet.annotation_war.TestGenericServletDemoServlet There are many examples online including a book that I purchased that don't extend httpservlet and still work with this annotation. I'm using glass fish server. Is there another reason this is happening?
servlets
glassfish
null
null
null
null
open
Strange servlet error === [#|2012-07-13T19:12:21.949-0400|SEVERE|glassfish3.1.2|global|_ThreadID=402;_ThreadName=Thread-2;|The Class web.servlet.annotation_war.TestGenericServletDemoServlet having annotation javax.servlet.annotation.WebServlet need to be a derived class of javax.servlet.http.HttpServlet. symbol: TYPE location: class web.servlet.annotation_war.TestGenericServletDemoServlet There are many examples online including a book that I purchased that don't extend httpservlet and still work with this annotation. I'm using glass fish server. Is there another reason this is happening?
0
11,479,496
07/13/2012 23:11:15
715,593
04/19/2011 16:18:35
46
2
Android Compatibility Issue
I am working on an android application that uses Google Maps (Google API). At this moment it's just a simple map with a compass, and it gets the address of a location the user clicks. The problem is as follows: The min SDK version : API level **8** Target SDK: API level **14** As I think, this should work properly on the range from **8** to **14** inclusive. But it only works properly on API level **14**. I tested the app on **Android 2.3.3 (API 10)** the compass is missing, and the address functionality is not working either. Thanks in advance **Note:** I am using an emulator (on Eclipse) and not a real device.
android
google-maps
compatability
null
null
null
open
Android Compatibility Issue === I am working on an android application that uses Google Maps (Google API). At this moment it's just a simple map with a compass, and it gets the address of a location the user clicks. The problem is as follows: The min SDK version : API level **8** Target SDK: API level **14** As I think, this should work properly on the range from **8** to **14** inclusive. But it only works properly on API level **14**. I tested the app on **Android 2.3.3 (API 10)** the compass is missing, and the address functionality is not working either. Thanks in advance **Note:** I am using an emulator (on Eclipse) and not a real device.
0
11,479,497
07/13/2012 23:11:19
1,524,787
07/13/2012 23:02:27
1
0
Chromium Embedded: Get the binary data from an image
How to get the binary data from an image by visiting the dom? for example: CefRefPtr<CefDOMNode> imageId = document->GetElementById("myImage"); imageId->getAsBinary() I know the function getAsBinary does not exist, just to have an idea! Thanks
c++
null
null
null
null
null
open
Chromium Embedded: Get the binary data from an image === How to get the binary data from an image by visiting the dom? for example: CefRefPtr<CefDOMNode> imageId = document->GetElementById("myImage"); imageId->getAsBinary() I know the function getAsBinary does not exist, just to have an idea! Thanks
0
11,479,498
07/13/2012 23:11:19
266,012
02/04/2010 08:42:17
576
0
why is mysql adding an apostrophe?
here is the where clause im building: > $where = "requesterid='".$memberid."' AND recieverid='".$tomemberid."' > OR requesterid='".$tomemberid."' AND recieverid='".$memberid."'"; now $memberid and $tomemberid are both integers. and here is the error when i execute it: > > Unknown column 'requesterid='6'' in 'where clause' > > SELECT * FROM (`friendships`) WHERE `requesterid='6'` AND > recieverid='5' OR requesterid='5' AND recieverid='6' why is mysql adding an apostrophe after the digit 6? i printed out $memberid and it doesn't show any apostrophe or anything else after/before it. What am I doing wrong?
php
mysql
codeigniter
activerecord
where
null
open
why is mysql adding an apostrophe? === here is the where clause im building: > $where = "requesterid='".$memberid."' AND recieverid='".$tomemberid."' > OR requesterid='".$tomemberid."' AND recieverid='".$memberid."'"; now $memberid and $tomemberid are both integers. and here is the error when i execute it: > > Unknown column 'requesterid='6'' in 'where clause' > > SELECT * FROM (`friendships`) WHERE `requesterid='6'` AND > recieverid='5' OR requesterid='5' AND recieverid='6' why is mysql adding an apostrophe after the digit 6? i printed out $memberid and it doesn't show any apostrophe or anything else after/before it. What am I doing wrong?
0
11,479,499
07/13/2012 23:11:36
1,379,268
05/07/2012 08:28:39
70
0
"iframes" within Windows Forms' form
I want to prepare single window with static parts and variable content just like iframes at HTML (with menu and the page itself). How to do so via the Windows Forms Designer? I could use tabs and maybe somehow disable the possibility to manually switch between them... but I guess there is some more elegant way to do so, right?
c#
winforms
null
null
null
null
open
"iframes" within Windows Forms' form === I want to prepare single window with static parts and variable content just like iframes at HTML (with menu and the page itself). How to do so via the Windows Forms Designer? I could use tabs and maybe somehow disable the possibility to manually switch between them... but I guess there is some more elegant way to do so, right?
0
11,479,541
07/13/2012 23:18:40
37,742
11/14/2008 17:50:04
398
9
Ruby Grit: find commits between 2 branches
I would like to compare 2 branches and show the commits that exist in one but not the other. This works from command line `git log --pretty=oneline branch_b ^branch_a --no-merges` and gives me what I want but I would like to simulate the same thing in Grit to gain working with the object instead of strings. Is this possible in Grit?
ruby
git
grit
null
null
null
open
Ruby Grit: find commits between 2 branches === I would like to compare 2 branches and show the commits that exist in one but not the other. This works from command line `git log --pretty=oneline branch_b ^branch_a --no-merges` and gives me what I want but I would like to simulate the same thing in Grit to gain working with the object instead of strings. Is this possible in Grit?
0
11,479,542
07/13/2012 23:18:40
267,631
02/06/2010 07:31:50
3,447
233
MySQL get where there are a lot of many to many matches?
Well this one is a headscratcher for me. I've got a system of posts with tags. Tags are a many->many relationship with the posts. The issue is that I'd like to select other posts based on how many tags they have matching with the current one. A quick visual example: PostA: TagA, TagB PostB: TagC PostC: TagA PostD: TagA, TagB So if I inputted PostA, it'd give me PostD, PostC. I really don't even know where to start with this one, and I'm hoping somebody smarter than I ran into this issue already, any help with it would be fantastic. Thanks, Max
php
mysql
sql
query
many-to-many
null
open
MySQL get where there are a lot of many to many matches? === Well this one is a headscratcher for me. I've got a system of posts with tags. Tags are a many->many relationship with the posts. The issue is that I'd like to select other posts based on how many tags they have matching with the current one. A quick visual example: PostA: TagA, TagB PostB: TagC PostC: TagA PostD: TagA, TagB So if I inputted PostA, it'd give me PostD, PostC. I really don't even know where to start with this one, and I'm hoping somebody smarter than I ran into this issue already, any help with it would be fantastic. Thanks, Max
0
11,479,543
07/13/2012 23:18:41
1,493,383
06/30/2012 18:04:28
9
0
different types of initWithNibName
Can somebody make me understand the difference between the below code snippets. `- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil` `{` `self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];` `if (self) {` // Custom initialization `}` `return self;` `}` And `-(id)initWithCoder:(NSCoder *)decoder ` The apple documentation says when instantiating a view controller from a storyboard use initWithCoder. Please can someone write a sample code using initWithCoder method to initiate a view controller. I am actually new to ios programming so just wannna know the difference. Thanks!!
iphone
ios
xcode
interface-builder
null
null
open
different types of initWithNibName === Can somebody make me understand the difference between the below code snippets. `- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil` `{` `self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];` `if (self) {` // Custom initialization `}` `return self;` `}` And `-(id)initWithCoder:(NSCoder *)decoder ` The apple documentation says when instantiating a view controller from a storyboard use initWithCoder. Please can someone write a sample code using initWithCoder method to initiate a view controller. I am actually new to ios programming so just wannna know the difference. Thanks!!
0
11,479,545
07/13/2012 23:19:27
1,522,429
07/13/2012 02:22:31
20
0
Hadoop Configuration.addDefaultResource() not working
My following code does not produce expected output: public static void main(String[] args) throws MalformedURLException { Configuration.addDefaultResource("/home/some_user/conf.xml"); Configuration conf = new Configuration(); System.out.println(conf); System.out.println(conf.get("color")); assertThat(conf.get("color"), is("yellow")); } The property `color` is set in conf.xml file as follows: <property> <name>color</name> <value>yellow</value> <description>Color</description> </property> Looks like file `conf.xml` isn't getting incorporated in default configuration. The documentation for `Configuration.addDefaultResource(String param)` says the param should be in classpath. I don't understand how to add file to the classpath when I am already giving the program full absolute path.
configuration
hadoop
configuration-files
null
null
null
open
Hadoop Configuration.addDefaultResource() not working === My following code does not produce expected output: public static void main(String[] args) throws MalformedURLException { Configuration.addDefaultResource("/home/some_user/conf.xml"); Configuration conf = new Configuration(); System.out.println(conf); System.out.println(conf.get("color")); assertThat(conf.get("color"), is("yellow")); } The property `color` is set in conf.xml file as follows: <property> <name>color</name> <value>yellow</value> <description>Color</description> </property> Looks like file `conf.xml` isn't getting incorporated in default configuration. The documentation for `Configuration.addDefaultResource(String param)` says the param should be in classpath. I don't understand how to add file to the classpath when I am already giving the program full absolute path.
0
11,479,548
07/13/2012 23:20:02
1,500,234
07/04/2012 00:22:25
3
0
Android Camera setJpegQuality ignored
It seems that the setJpegQuality method of Camera.Parameters is ignored, at least on the devices I've tried it with (Nexus S, Galaxy S2). Does it work for anyone else, or is this a known issue, or am I doing something wrong, or... ? Code for setting parameters below. jpeg quality 1 is very distinctive, so it's very easy to determine visually whether it's working... and it isn't! Other parameters set here (e.g. sepia) work. camera = Camera.open(); final Camera.Parameters parameters = camera.getParameters(); parameters.setJpegQuality(1); parameters.setPictureFormat(ImageFormat.JPEG); // Let's set a SEPIA effect, just to verify these parameters are working at all! parameters.setColorEffect(Camera.Parameters.EFFECT_SEPIA); // I've seen this syntax too on the internet, presumably it's legacy. parameters.set("jpeg-quality", 1); camera.setParameters(parameters);
java
android
camera
null
null
null
open
Android Camera setJpegQuality ignored === It seems that the setJpegQuality method of Camera.Parameters is ignored, at least on the devices I've tried it with (Nexus S, Galaxy S2). Does it work for anyone else, or is this a known issue, or am I doing something wrong, or... ? Code for setting parameters below. jpeg quality 1 is very distinctive, so it's very easy to determine visually whether it's working... and it isn't! Other parameters set here (e.g. sepia) work. camera = Camera.open(); final Camera.Parameters parameters = camera.getParameters(); parameters.setJpegQuality(1); parameters.setPictureFormat(ImageFormat.JPEG); // Let's set a SEPIA effect, just to verify these parameters are working at all! parameters.setColorEffect(Camera.Parameters.EFFECT_SEPIA); // I've seen this syntax too on the internet, presumably it's legacy. parameters.set("jpeg-quality", 1); camera.setParameters(parameters);
0
11,479,549
07/13/2012 23:20:17
1,435,858
06/04/2012 19:13:09
1
0
Changing slides at specified hours/minutes
I'm working on a project where the target is to present information at a big screen on a festival. The main concern is to get the proper content showing at the proper time, i.e. the next band playing and so on. There's also going to be different information depending on the time of day. I'm eager to create something I can alter remotely, i.e. if there's any changes to the program. When the concerts are going on, video from live cameras will be projected on the screen, so I have a lot of opportunities to alter the content and refreshing the page without anyone noticing. jQuery Cycle and other slideshow scripts is doing a lot of the job, but I haven't mananged to find any solutions that offer other settings then certain intervals. Which would not work in this case, since a simple refresh then would break the whole thing... To sum it up, what I'm looking for is a solution that can make this happen: - Aug 2nd 6:03:30: Show slide 1 - Aug 2nd 6:05:00: Show slide 2 - Aug 2nd 6:10:00: Show slide 3 ...and so on I'm very greatful for any kind of ideas on this!
javascript
jquery
slideshow
jquery-cycle
null
null
open
Changing slides at specified hours/minutes === I'm working on a project where the target is to present information at a big screen on a festival. The main concern is to get the proper content showing at the proper time, i.e. the next band playing and so on. There's also going to be different information depending on the time of day. I'm eager to create something I can alter remotely, i.e. if there's any changes to the program. When the concerts are going on, video from live cameras will be projected on the screen, so I have a lot of opportunities to alter the content and refreshing the page without anyone noticing. jQuery Cycle and other slideshow scripts is doing a lot of the job, but I haven't mananged to find any solutions that offer other settings then certain intervals. Which would not work in this case, since a simple refresh then would break the whole thing... To sum it up, what I'm looking for is a solution that can make this happen: - Aug 2nd 6:03:30: Show slide 1 - Aug 2nd 6:05:00: Show slide 2 - Aug 2nd 6:10:00: Show slide 3 ...and so on I'm very greatful for any kind of ideas on this!
0
11,479,551
07/13/2012 23:20:49
770,834
05/26/2011 07:07:52
129
2
Is it possible to expose an EJB project as a RESTful WS?
I have implemented a RESTful web service using jersey and deployed it on Tomcat, I have used DAO classes to manipulate database operations, entities to wrap database records. and did the processing in separate package. I want to make this system distributed using EJB. First of all would it be easy to do this change. or i need to rewrite things from scratch. Second, I still need to have the REST WS, so would it be possible to expose the EJB as a REST WS and how? would the REST WS be in the same EJB project or in a different one?
rest
ejb-3.0
jax-rs
distributed-computing
null
null
open
Is it possible to expose an EJB project as a RESTful WS? === I have implemented a RESTful web service using jersey and deployed it on Tomcat, I have used DAO classes to manipulate database operations, entities to wrap database records. and did the processing in separate package. I want to make this system distributed using EJB. First of all would it be easy to do this change. or i need to rewrite things from scratch. Second, I still need to have the REST WS, so would it be possible to expose the EJB as a REST WS and how? would the REST WS be in the same EJB project or in a different one?
0
11,479,552
07/13/2012 23:20:53
492,460
10/30/2010 23:04:53
1,526
26
Can I change the name of App_Start folder to AppStart?
I don't like the underscore convention in .Net folders and I want to rename the App_Start folder of new WebApi project to AppStart. Doing this can disrupt something?
.net
asp.net-web-api
null
null
null
null
open
Can I change the name of App_Start folder to AppStart? === I don't like the underscore convention in .Net folders and I want to rename the App_Start folder of new WebApi project to AppStart. Doing this can disrupt something?
0
11,472,340
07/13/2012 14:18:46
1,523,785
07/13/2012 14:10:10
1
0
Save user generated form content as a PDF on server
I have some report that is generated from a form. I need this form to be saved automatically on the server, on submitting. Is there any way to do it? I tried researching on the subject, but Google just throws up links where the user gotta input the URL and press submit or such method. As this pdf should be generated and saved automatically after every form submission, I guess the preferable method would be to call a service or such to generate the PDF and then save it on the server. Can you plz give me a walk-through.Thanks in Advance. I'm working in PHP.
php
html
pdf
pdf-generation
null
null
open
Save user generated form content as a PDF on server === I have some report that is generated from a form. I need this form to be saved automatically on the server, on submitting. Is there any way to do it? I tried researching on the subject, but Google just throws up links where the user gotta input the URL and press submit or such method. As this pdf should be generated and saved automatically after every form submission, I guess the preferable method would be to call a service or such to generate the PDF and then save it on the server. Can you plz give me a walk-through.Thanks in Advance. I'm working in PHP.
0
11,472,342
07/13/2012 14:18:46
616,324
02/14/2011 14:05:51
5
0
How to send form data to a spreadsheet. Xls
Good morning people, I have a form that did a site, but the form only sends the information filled in form for a site: http://submit.jotformz.com/submit/21933800226649/, I wanted the data filled in form should be saved in a spreadsheet . xls, every time someone fill out and send the new information be added automatically as of the line 10. The code of my form is this: <script src="http://max.jotfor.ms/min/g=jotform?3.0.3715" type="text/javascript"></script> <script type="text/javascript"> JotForm.init(); </script> <link href="http://max.jotfor.ms/min/g=formCss?3.0.3715" rel="stylesheet" type="text/css" /> <link type="text/css" rel="stylesheet" href="http://jotformz.com/css/styles/nova.css?3.0.3715" /> <style type="text/css"> .form-label{ width:150px !important; } .form-label-left{ width:150px !important; } .form-line{ padding-top:12px; padding-bottom:12px; } .form-label-right{ width:150px !important; } .form-all{ width:690px; color:#555 !important; font-family:'Lucida Grande'; font-size:14px; } </style> <form class="jotform-form" action="http://submit.jotformz.com/submit/21933800226649/" method="post" name="form_21933800226649" id="21933800226649" accept-charset="utf-8"> <input type="hidden" name="formID" value="21933800226649" /> <div class="form-all"> <ul class="form-section"> <li class="form-line" id="id_1"> <label class="form-label-left" id="label_1" for="input_1"> Nome: </label> <div id="cid_1" class="form-input"> <input type="text" class="form-textbox" id="input_1" name="q1_nome" size="20" /> </div> </li> <li class="form-line" id="id_3"> <label class="form-label-left" id="label_3" for="input_3"> Opções </label> <div id="cid_3" class="form-input"> <div class="form-single-column"><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_0" name="q3_opcoes" value="Opção 1" /> <label for="input_3_0"> Opção 1 </label></span><span class="clearfix"></span><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_1" name="q3_opcoes" value="Opção 2" /> <label for="input_3_1"> Opção 2 </label></span><span class="clearfix"></span><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_2" name="q3_opcoes" value="Opção 3" /> <label for="input_3_2"> Opção 3 </label></span><span class="clearfix"></span> </div> </div> </li> <li class="form-line" id="id_5"> <label class="form-label-left" id="label_5" for="input_5"> Comentarios </label> <div id="cid_5" class="form-input"> <textarea id="input_5" class="form-textarea" name="q5_comentarios" cols="40" rows="6"></textarea> </div> </li> <li class="form-line" id="id_4"> <label class="form-label-left" id="label_4" for="input_4"> Idioma </label> <div id="cid_4" class="form-input"> <select class="form-dropdown" style="width:150px" id="input_4" name="q4_idioma"> <option> </option> <option value="Portugues"> Portugues </option> <option value="Ingles"> Ingles </option> </select> </div> </li> <li class="form-line" id="id_2"> <div id="cid_2" class="form-input-wide"> <div style="margin-left:156px" class="form-buttons-wrapper"> <button id="input_2" type="submit" class="form-submit-button"> Enviar </button> </div> </div> </li> <li style="display:none"> Should be Empty: <input type="text" name="website" value="" /> </li> </ul> </div> <input type="hidden" id="simple_spc" name="simple_spc" value="21933800226649" /> <script type="text/javascript"> document.getElementById("si" + "mple" + "_spc").value = "21933800226649-21933800226649"; </script> </form> I just need something simple .. Could someone give a help?
javascript
jquery
null
null
null
null
open
How to send form data to a spreadsheet. Xls === Good morning people, I have a form that did a site, but the form only sends the information filled in form for a site: http://submit.jotformz.com/submit/21933800226649/, I wanted the data filled in form should be saved in a spreadsheet . xls, every time someone fill out and send the new information be added automatically as of the line 10. The code of my form is this: <script src="http://max.jotfor.ms/min/g=jotform?3.0.3715" type="text/javascript"></script> <script type="text/javascript"> JotForm.init(); </script> <link href="http://max.jotfor.ms/min/g=formCss?3.0.3715" rel="stylesheet" type="text/css" /> <link type="text/css" rel="stylesheet" href="http://jotformz.com/css/styles/nova.css?3.0.3715" /> <style type="text/css"> .form-label{ width:150px !important; } .form-label-left{ width:150px !important; } .form-line{ padding-top:12px; padding-bottom:12px; } .form-label-right{ width:150px !important; } .form-all{ width:690px; color:#555 !important; font-family:'Lucida Grande'; font-size:14px; } </style> <form class="jotform-form" action="http://submit.jotformz.com/submit/21933800226649/" method="post" name="form_21933800226649" id="21933800226649" accept-charset="utf-8"> <input type="hidden" name="formID" value="21933800226649" /> <div class="form-all"> <ul class="form-section"> <li class="form-line" id="id_1"> <label class="form-label-left" id="label_1" for="input_1"> Nome: </label> <div id="cid_1" class="form-input"> <input type="text" class="form-textbox" id="input_1" name="q1_nome" size="20" /> </div> </li> <li class="form-line" id="id_3"> <label class="form-label-left" id="label_3" for="input_3"> Opções </label> <div id="cid_3" class="form-input"> <div class="form-single-column"><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_0" name="q3_opcoes" value="Opção 1" /> <label for="input_3_0"> Opção 1 </label></span><span class="clearfix"></span><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_1" name="q3_opcoes" value="Opção 2" /> <label for="input_3_1"> Opção 2 </label></span><span class="clearfix"></span><span class="form-radio-item" style="clear:left;"><input type="radio" class="form-radio" id="input_3_2" name="q3_opcoes" value="Opção 3" /> <label for="input_3_2"> Opção 3 </label></span><span class="clearfix"></span> </div> </div> </li> <li class="form-line" id="id_5"> <label class="form-label-left" id="label_5" for="input_5"> Comentarios </label> <div id="cid_5" class="form-input"> <textarea id="input_5" class="form-textarea" name="q5_comentarios" cols="40" rows="6"></textarea> </div> </li> <li class="form-line" id="id_4"> <label class="form-label-left" id="label_4" for="input_4"> Idioma </label> <div id="cid_4" class="form-input"> <select class="form-dropdown" style="width:150px" id="input_4" name="q4_idioma"> <option> </option> <option value="Portugues"> Portugues </option> <option value="Ingles"> Ingles </option> </select> </div> </li> <li class="form-line" id="id_2"> <div id="cid_2" class="form-input-wide"> <div style="margin-left:156px" class="form-buttons-wrapper"> <button id="input_2" type="submit" class="form-submit-button"> Enviar </button> </div> </div> </li> <li style="display:none"> Should be Empty: <input type="text" name="website" value="" /> </li> </ul> </div> <input type="hidden" id="simple_spc" name="simple_spc" value="21933800226649" /> <script type="text/javascript"> document.getElementById("si" + "mple" + "_spc").value = "21933800226649-21933800226649"; </script> </form> I just need something simple .. Could someone give a help?
0
11,472,343
07/13/2012 14:18:47
813,728
06/24/2011 08:30:25
33
0
Regex to exclude all chars except letters
I'm a real regex n00b so I ask your help: I need a regex witch match only letters and numbers and exclude punctations, non ascii characters and spaces. "ilikestackoverflow2012" would be a valid string. "***f### you °§è***" not valid. "***hello world***" not valid "***hello-world***" and "***hello_world***" not valid and so on. I need it to make a possibly complex business name url friendly. Thanks in advance!
c#
regex
null
null
null
null
open
Regex to exclude all chars except letters === I'm a real regex n00b so I ask your help: I need a regex witch match only letters and numbers and exclude punctations, non ascii characters and spaces. "ilikestackoverflow2012" would be a valid string. "***f### you °§è***" not valid. "***hello world***" not valid "***hello-world***" and "***hello_world***" not valid and so on. I need it to make a possibly complex business name url friendly. Thanks in advance!
0
11,472,346
07/13/2012 14:18:57
1,523,797
07/13/2012 14:13:00
1
0
Unable to login to SQL Server 2008 through command line utility
I have installed SQL Server 2008 Management Studio and am able to login to the database through this. I have also installed the SQL command utility. But, am unable to login through the command utility. I get the following error: C:\Users\Administrator>sqlcmd HResult 0x274D, Level 16, State 1 TCP Provider: No connection could be made because the target machine actively re fused it. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in stance-specific error has occurred while establishing a connection to SQL Server . Server is not found or not accessible. Check if instance name is correct and i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired. I tried giving the server name, username and password explicitly using: sqlcmd -S <hostname\databse instance> -U <user> -P <pwd> this too doesn't help. I need this command utility for my automation stuff. Please help me!
sql-server-2008
null
null
null
null
07/17/2012 04:37:16
off topic
Unable to login to SQL Server 2008 through command line utility === I have installed SQL Server 2008 Management Studio and am able to login to the database through this. I have also installed the SQL command utility. But, am unable to login through the command utility. I get the following error: C:\Users\Administrator>sqlcmd HResult 0x274D, Level 16, State 1 TCP Provider: No connection could be made because the target machine actively re fused it. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or in stance-specific error has occurred while establishing a connection to SQL Server . Server is not found or not accessible. Check if instance name is correct and i f SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired. I tried giving the server name, username and password explicitly using: sqlcmd -S <hostname\databse instance> -U <user> -P <pwd> this too doesn't help. I need this command utility for my automation stuff. Please help me!
2
11,472,347
07/13/2012 14:18:58
1,523,769
07/13/2012 14:04:16
1
0
Using Pearl or Grep to parse IP addresses from xml or txt file, how do I get account name too?
I'm using this command to get the following output from a 35MB text file: perl -lne 'print $& if /(\d+\.){3}\d+/' hack.txt | sort | uniq -c 2 0.0.0.0 102 114.113.155.83 22 116.255.232.4 3413 157.56.28.136 420 188.48.63.159 417 190.121.27.226 666 193.197.34.12 4 207.38.205.53 2730 213.120.116.136 4 218.149.84.57 420 218.16.224.35 46 221.180.17.227 419 222.240.208.131 26 59.108.56.194 9 61.235.163.4 4 65.15.189.64 7503 66.240.194.96 8 74.111.35.90 45 76.19.123.171 9 87.85.151.34 3 91.75.72.237 6 96.39.79.170 19 96.56.188.115 I need to parse the account name also under "Account For Which Logon Failed" so it looks something like Localhost 2 0.0.0.0 Admin 102 114.113.155.83 User 22 116.255.232.4 Here is the contents of the file: Keywords Date and Time Source Event ID Task Category Audit Failure 7/12/2012 8:59:53 AM Microsoft-Windows-Security-Auditing 4625 Logon "An account failed to log on. Subject: Security ID: SYSTEM Account Name: REMOTE02$ Account Domain: DOMAIN Logon ID: 0x3e7 Logon Type: 10 Account For Which Logon Failed: Security ID: NULL SID Account Name: administrator Account Domain: REMOTE02 Failure Information: Failure Reason: Unknown user name or bad password. Status: 0xc000006d Sub Status: 0xc000006a Process Information: Caller Process ID: 0x1148 Caller Process Name: C:\Windows\System32\winlogon.exe Network Information: Workstation Name: REMOTE02 Source Network Address: 213.120.116.136 Source Port: 29107 Detailed Authentication Information: Logon Process: User32 Authentication Package: Negotiate Transited Services: - Package Name (NTLM only): - Key Length: 0 This event is generated when a logon request fails. It is generated on the computer where access was attempted. The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe. The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network). The Process Information fields indicate which account and process on the system requested the logon. The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases. The authentication information fields provide detailed information about this specific logon request. - Transited services indicate which intermediate services have participated in this logon request. - Package name indicates which sub-protocol was used among the NTLM protocols. - Key length indicates the length of the generated session key. This will be 0 if no session key was requested."
sorting
grep
ip
address
addresses
null
open
Using Pearl or Grep to parse IP addresses from xml or txt file, how do I get account name too? === I'm using this command to get the following output from a 35MB text file: perl -lne 'print $& if /(\d+\.){3}\d+/' hack.txt | sort | uniq -c 2 0.0.0.0 102 114.113.155.83 22 116.255.232.4 3413 157.56.28.136 420 188.48.63.159 417 190.121.27.226 666 193.197.34.12 4 207.38.205.53 2730 213.120.116.136 4 218.149.84.57 420 218.16.224.35 46 221.180.17.227 419 222.240.208.131 26 59.108.56.194 9 61.235.163.4 4 65.15.189.64 7503 66.240.194.96 8 74.111.35.90 45 76.19.123.171 9 87.85.151.34 3 91.75.72.237 6 96.39.79.170 19 96.56.188.115 I need to parse the account name also under "Account For Which Logon Failed" so it looks something like Localhost 2 0.0.0.0 Admin 102 114.113.155.83 User 22 116.255.232.4 Here is the contents of the file: Keywords Date and Time Source Event ID Task Category Audit Failure 7/12/2012 8:59:53 AM Microsoft-Windows-Security-Auditing 4625 Logon "An account failed to log on. Subject: Security ID: SYSTEM Account Name: REMOTE02$ Account Domain: DOMAIN Logon ID: 0x3e7 Logon Type: 10 Account For Which Logon Failed: Security ID: NULL SID Account Name: administrator Account Domain: REMOTE02 Failure Information: Failure Reason: Unknown user name or bad password. Status: 0xc000006d Sub Status: 0xc000006a Process Information: Caller Process ID: 0x1148 Caller Process Name: C:\Windows\System32\winlogon.exe Network Information: Workstation Name: REMOTE02 Source Network Address: 213.120.116.136 Source Port: 29107 Detailed Authentication Information: Logon Process: User32 Authentication Package: Negotiate Transited Services: - Package Name (NTLM only): - Key Length: 0 This event is generated when a logon request fails. It is generated on the computer where access was attempted. The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe. The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network). The Process Information fields indicate which account and process on the system requested the logon. The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases. The authentication information fields provide detailed information about this specific logon request. - Transited services indicate which intermediate services have participated in this logon request. - Package name indicates which sub-protocol was used among the NTLM protocols. - Key length indicates the length of the generated session key. This will be 0 if no session key was requested."
0
11,472,348
07/13/2012 14:19:06
1,523,804
07/13/2012 14:15:36
1
0
exception while saving data by entity frame work 4.0
Exception : Unable to update the EntitySet 'Audit_Log' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation. i am using like that Audit_LogEntity ale = new Audit_LogEntity(); MemoryStream ms = new MemoryStream(); NetDataContractSerializer serialize = new NetDataContractSerializer(); serialize.Serialize(ms, obj); Audit_Log al = new Audit_Log(); al.Object = ms.ToArray(); al.DateTime = DateTime.Now; al.Page_Name = pagename; al.Pageid = uniqueid; al.UserId = userid; ale.AddToAudit_Log(al); ale.SaveChanges();
asp.net
entity-framework
c#-4.0
null
null
null
open
exception while saving data by entity frame work 4.0 === Exception : Unable to update the EntitySet 'Audit_Log' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation. i am using like that Audit_LogEntity ale = new Audit_LogEntity(); MemoryStream ms = new MemoryStream(); NetDataContractSerializer serialize = new NetDataContractSerializer(); serialize.Serialize(ms, obj); Audit_Log al = new Audit_Log(); al.Object = ms.ToArray(); al.DateTime = DateTime.Now; al.Page_Name = pagename; al.Pageid = uniqueid; al.UserId = userid; ale.AddToAudit_Log(al); ale.SaveChanges();
0
11,472,360
07/13/2012 14:19:58
898,478
08/17/2011 11:00:12
2,800
250
Best approach to switch debug on/off
My scenario is the following: I have a remote service with which any application can communicate through Messenger. Applications send custom events I defined. Each event define an "action" to be performed (similar to Android's `Intent`). To test the event sending and processing by the service, I want to set up a new event action (e.g. `EventAction.DEBUG`), but I don't want this action and the code that processes it to be present in the release, . This is what I thought: - Use a `final static boolean` variable to conditionally execute code. I don't like this because of hardcoded variable. - Read the debug state from a configuration file. This is slow and also compiler will generate the code to process the debugs, so useless comparing will ensue. - Pass the debug flag to the application at startup. I ignore how to do this in Android, or even if this is possible. Also I think this will also make the compiler generate the debug code. What do you think is the best approach to implement this behavior?
android
debugging
null
null
null
null
open
Best approach to switch debug on/off === My scenario is the following: I have a remote service with which any application can communicate through Messenger. Applications send custom events I defined. Each event define an "action" to be performed (similar to Android's `Intent`). To test the event sending and processing by the service, I want to set up a new event action (e.g. `EventAction.DEBUG`), but I don't want this action and the code that processes it to be present in the release, . This is what I thought: - Use a `final static boolean` variable to conditionally execute code. I don't like this because of hardcoded variable. - Read the debug state from a configuration file. This is slow and also compiler will generate the code to process the debugs, so useless comparing will ensue. - Pass the debug flag to the application at startup. I ignore how to do this in Android, or even if this is possible. Also I think this will also make the compiler generate the debug code. What do you think is the best approach to implement this behavior?
0
11,472,366
07/13/2012 14:20:20
1,485,636
06/27/2012 12:30:21
1
1
SQL Server Backup (not restore!) error: The media set has 2 media families but only 1 are provided. All members must be provided
I am running into this error when trying to Backup a database: > "The media set has 2 media families but only 1 are provided. All > members must be provided." Please not this is on BACKUP not on restore. There are a lot of topics on this error for RESTORE, but I didn't find any for BACKUP. I am using this T.SQL on Sql Server 2005: backup database dtplog TO DISK='e:\dtplog.bak' So it looks like SQL Server has some kind of setting specified there are multiple backup devices for this database. For some database I don't get this error. Any idea what's happening?
sql
sql-server-2005
backup
database-backups
null
null
open
SQL Server Backup (not restore!) error: The media set has 2 media families but only 1 are provided. All members must be provided === I am running into this error when trying to Backup a database: > "The media set has 2 media families but only 1 are provided. All > members must be provided." Please not this is on BACKUP not on restore. There are a lot of topics on this error for RESTORE, but I didn't find any for BACKUP. I am using this T.SQL on Sql Server 2005: backup database dtplog TO DISK='e:\dtplog.bak' So it looks like SQL Server has some kind of setting specified there are multiple backup devices for this database. For some database I don't get this error. Any idea what's happening?
0
11,628,328
07/24/2012 09:51:57
1,141,493
01/10/2012 18:02:55
742
0
2D Correlation Optimized Warping COW algorithm implementation
do you have a reference to some existing implementation of 1D and 2D COW algorithm preferred C++ > Python > Matlab > C or others? Or do you have reference to very detailled algorithm? I have read through this http://courseware.eduwest.com/courseware/0067/content/ziyuan/qianyan/002/06/0002/10.pdf already, but implementation of optimization for 1D COW is not very precise, and 2D COW is based on 1D COW. Thanks and regards.
c++
python
algorithm
alignment
signal-processing
null
open
2D Correlation Optimized Warping COW algorithm implementation === do you have a reference to some existing implementation of 1D and 2D COW algorithm preferred C++ > Python > Matlab > C or others? Or do you have reference to very detailled algorithm? I have read through this http://courseware.eduwest.com/courseware/0067/content/ziyuan/qianyan/002/06/0002/10.pdf already, but implementation of optimization for 1D COW is not very precise, and 2D COW is based on 1D COW. Thanks and regards.
0
11,628,332
07/24/2012 09:52:13
1,298,587
03/28/2012 15:24:34
4
0
First response time of ticket from OTRS?
How to write a MYSQL query to retrieve first response time of ticket from OTRS ?
php
otrs
null
null
null
07/24/2012 09:59:56
not a real question
First response time of ticket from OTRS? === How to write a MYSQL query to retrieve first response time of ticket from OTRS ?
1
11,628,333
07/24/2012 09:52:21
1,494,196
07/01/2012 11:30:56
12
0
php random image where width equals
I currently have this snippet which spits out a random image $imgDir = 'images/'; $images = glob($imagesDir . '*.{jpg}', GLOB_BRACE); $randimg = $images[array_rand($images)]; but I want the image to be a certain width (600px), rather then warping images by using CSS is there a way the image width can be checked using PHP incorporating the code snippet above?
php
arrays
image
width
null
null
open
php random image where width equals === I currently have this snippet which spits out a random image $imgDir = 'images/'; $images = glob($imagesDir . '*.{jpg}', GLOB_BRACE); $randimg = $images[array_rand($images)]; but I want the image to be a certain width (600px), rather then warping images by using CSS is there a way the image width can be checked using PHP incorporating the code snippet above?
0
11,628,334
07/24/2012 09:52:35
1,290,966
03/25/2012 07:14:36
1
0
Android : Image cropping taking in uer touch input
How can take touch input while there surface view over camera preview? I want to achieve something like this : Applications opens camera, there is custom surface view over camera (it will be ab image that will be like a guide to the user). Now suppose the user is clicking a pic of a credit card and wants only the rectangle contents to be clicked. Now he will touch the screen, place dots over the corners of credit card and capture the image. The image will cropped according the co-ordinates of dots. Now to do this, I tried to draw over surface view that is displayed as camera preview, but android doesn't allow this. (After setting SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS, one cannot lock canvas to draw over it) I also tried to overlap frame over surface view. Frame layout view handled the logic of putting the dots over the screen. But the problem is that camera preview too gets overlapped, I cannot see it on the screen. Making the frame layout transparent also makes dots invisble. What I can do to solve this problem? Is there any way to draw over camera preview?
android
camera
crop
null
null
null
open
Android : Image cropping taking in uer touch input === How can take touch input while there surface view over camera preview? I want to achieve something like this : Applications opens camera, there is custom surface view over camera (it will be ab image that will be like a guide to the user). Now suppose the user is clicking a pic of a credit card and wants only the rectangle contents to be clicked. Now he will touch the screen, place dots over the corners of credit card and capture the image. The image will cropped according the co-ordinates of dots. Now to do this, I tried to draw over surface view that is displayed as camera preview, but android doesn't allow this. (After setting SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS, one cannot lock canvas to draw over it) I also tried to overlap frame over surface view. Frame layout view handled the logic of putting the dots over the screen. But the problem is that camera preview too gets overlapped, I cannot see it on the screen. Making the frame layout transparent also makes dots invisble. What I can do to solve this problem? Is there any way to draw over camera preview?
0
11,628,335
07/24/2012 09:52:36
1,166,503
01/24/2012 07:34:38
11
1
Capacity planning for an enterprise software application
If you had to do capacity planning and hardware sizing "BEFORE" you had a chance to actually code and test the application (typically while you are defining solution architecture), how would you do it? I know this can not be known accurately beforehand but the point is to present the approach at an early stage (including questions you need to ask, assumptions you need to make). All you konw, it will be an enterprise java application with App server, Web Server, Database. Business has given some number of concurrent "USERES" say 1000. Also assume that you will get a chance to fine tune your numbers after load testing the application but you can't be far off from the original estimates.
performance
sizing
capacity
null
null
07/24/2012 15:17:03
off topic
Capacity planning for an enterprise software application === If you had to do capacity planning and hardware sizing "BEFORE" you had a chance to actually code and test the application (typically while you are defining solution architecture), how would you do it? I know this can not be known accurately beforehand but the point is to present the approach at an early stage (including questions you need to ask, assumptions you need to make). All you konw, it will be an enterprise java application with App server, Web Server, Database. Business has given some number of concurrent "USERES" say 1000. Also assume that you will get a chance to fine tune your numbers after load testing the application but you can't be far off from the original estimates.
2
11,628,337
07/24/2012 09:52:37
1,281,548
03/20/2012 17:12:38
6
0
Columns dont inherit width when contained in div
Lets say we have a table with many rows. When transforming my XML to a PFD via XSLT I want certain rows to not split across a page break. At the moment I have <table> <tr>...</tr> <tr>...</tr> <div style="page-break-inside:avoid"> <tr>...</tr> <tr>...</tr> </div> <tr>...</tr> </table> That works well to a point. Porblem is that the columns within the div nolonger inherit their widths from the first row in the table as normal. Is there anything I can do with the div to maintian the inheritance? Or should I try a different approach?
html
xml
xslt
pdf
xslt-1.0
null
open
Columns dont inherit width when contained in div === Lets say we have a table with many rows. When transforming my XML to a PFD via XSLT I want certain rows to not split across a page break. At the moment I have <table> <tr>...</tr> <tr>...</tr> <div style="page-break-inside:avoid"> <tr>...</tr> <tr>...</tr> </div> <tr>...</tr> </table> That works well to a point. Porblem is that the columns within the div nolonger inherit their widths from the first row in the table as normal. Is there anything I can do with the div to maintian the inheritance? Or should I try a different approach?
0
11,628,338
07/24/2012 09:52:38
980,094
10/05/2011 09:40:17
149
0
Automatic python code formatting in sublime
I am trying to find some package that would auto format python code when using sublime. There is PythonTidy, but when I use PackageController it says install completed but the package is not installed (does not appear in preferences). I did try following the instructions in: https://github.com/witsch/SublimePythonTidy and while i "pip installed" the package in python, sublime would not load, throwing: terminate called after throwing an instance of 'boost::python::error_already_set' /usr/bin/subl: line 3: 12415 Aborted /usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@" How would I go about installing this without PackageController, or alternatively, can anyone recommend another package?
python
sublimetext
null
null
null
null
open
Automatic python code formatting in sublime === I am trying to find some package that would auto format python code when using sublime. There is PythonTidy, but when I use PackageController it says install completed but the package is not installed (does not appear in preferences). I did try following the instructions in: https://github.com/witsch/SublimePythonTidy and while i "pip installed" the package in python, sublime would not load, throwing: terminate called after throwing an instance of 'boost::python::error_already_set' /usr/bin/subl: line 3: 12415 Aborted /usr/lib/sublime-text-2/sublime_text --class=sublime-text-2 "$@" How would I go about installing this without PackageController, or alternatively, can anyone recommend another package?
0
11,628,339
07/24/2012 09:52:44
1,545,373
07/23/2012 08:56:46
9
0
How can i use "uri" (android)
i have an image and i want to use it on another class. so i create a uri like that final Uri selectedImage = data.getData(); String path = selectedImage.getPath(); Intent sintent = new Intent(FromFile.this, OurView.class); sintent.putExtra("image", path); startActivity(sintent); i called uri like that in the class of OurView String ur = getIntent().getStringExtra("image"); try { URI uri = new URI(ur); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } i want to use this picture as a background in this class. How can i do?
uri
null
null
null
null
null
open
How can i use "uri" (android) === i have an image and i want to use it on another class. so i create a uri like that final Uri selectedImage = data.getData(); String path = selectedImage.getPath(); Intent sintent = new Intent(FromFile.this, OurView.class); sintent.putExtra("image", path); startActivity(sintent); i called uri like that in the class of OurView String ur = getIntent().getStringExtra("image"); try { URI uri = new URI(ur); } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } i want to use this picture as a background in this class. How can i do?
0
11,628,340
07/24/2012 09:52:46
1,388,958
05/11/2012 08:20:13
40
0
How to rotate a panned object about the center using three.js?
Using three.js is it possible to rotate a panned object about its center. I have created a jsfiddle, http://jsfiddle.net/georgeneil/yKt6h/2/. When I checked the Auto rotate mode in the control panel, i am able to rotate the panned cube about its center. Is it possible to have a similar effect when i try to rotate the cube with mouse movement. If it is possible please provide me sample code
three.js
null
null
null
null
null
open
How to rotate a panned object about the center using three.js? === Using three.js is it possible to rotate a panned object about its center. I have created a jsfiddle, http://jsfiddle.net/georgeneil/yKt6h/2/. When I checked the Auto rotate mode in the control panel, i am able to rotate the panned cube about its center. Is it possible to have a similar effect when i try to rotate the cube with mouse movement. If it is possible please provide me sample code
0
11,628,341
07/24/2012 09:52:50
1,205,299
02/12/2012 16:19:45
828
52
How to create an ActiveRecord model with some attributes that are stored in the database and some that are read from Facebook
In my application I have a user object model. I'm using koala and OmniAuth to access Facebook. I'm trying to figure out how to add the data from Facebook to my model in such a way that my controller serializes it properly. I already managed to get the data from Facebook in my controller like that: token = request.env["omniauth.auth"]["credentials"]["token"] api = Koala::Facebook::API.new(token) api.get_object("me") And I think I figured up how to add an attribute to my Model without a DB column, but in a way that will keep it in the serialized response: def fb_info {"fb_info" =>"should be here"} end def attributes super.merge('fb_info' => fb_info) end So what is the preferred way to put it all together? I need to somehow populate attributes in my model. In order to do that I need the access token in there. It seems messy to make calls from the controller to populate them, or to pass the token to the model. Is there a clean way to handle this?
ruby-on-rails
facebook
ruby-on-rails-3
activerecord
activemodel
null
open
How to create an ActiveRecord model with some attributes that are stored in the database and some that are read from Facebook === In my application I have a user object model. I'm using koala and OmniAuth to access Facebook. I'm trying to figure out how to add the data from Facebook to my model in such a way that my controller serializes it properly. I already managed to get the data from Facebook in my controller like that: token = request.env["omniauth.auth"]["credentials"]["token"] api = Koala::Facebook::API.new(token) api.get_object("me") And I think I figured up how to add an attribute to my Model without a DB column, but in a way that will keep it in the serialized response: def fb_info {"fb_info" =>"should be here"} end def attributes super.merge('fb_info' => fb_info) end So what is the preferred way to put it all together? I need to somehow populate attributes in my model. In order to do that I need the access token in there. It seems messy to make calls from the controller to populate them, or to pass the token to the model. Is there a clean way to handle this?
0
11,628,342
07/24/2012 09:52:52
1,324,533
04/10/2012 16:09:43
123
2
Drop down menu, CSS, HTML and JavaScript: JavaScript making menu jump and not function correctly
I have a simple drop down menu, but when used it does not work correctly, I think there is a problem with the JavaScript as it just keeps bouncing up and down! <div class="container"> <ul id="coolMenu"> <li><a href="#">Lorem</a></li> <li><a href="#">Mauricii</a></li> <li> <a href="#">Periher</a> <ul> <li><a href="#">Hellenico</a></li> <li><a href="#">Genere</a></li> <li><a href="#">Indulgentia</a></li> </ul> </li> <li><a href="#">Tyrio</a></li> <li><a href="#">Quicumque</a></li> </ul> CSS #coolMenu, #coolMenu ul { list-style: none; } #coolMenu { float: left; } #coolMenu > li { float: left; } #coolMenu li a { display: block; height: 2em; line-height: 2em; padding: 0 1.5em; text-decoration: none; } #coolMenu ul { position: absolute; display: none; z-index: 999; } #coolMenu ul li a { width: 80px; } #coolMenu li:hover ul { display: block; } /* Main menu ------------------------------------------*/ #coolMenu { font-family: Arial; font-size: 12px; background: #2f8be8; } #coolMenu > li > a { color: #fff; font-weight: bold; } #coolMenu > li:hover > a { background: #f09d28; color: #000; } /* Submenu ------------------------------------------*/ #coolMenu ul { background: #f09d28; } #coolMenu ul li a { color: #000; } #coolMenu ul li:hover a { background: #ffc97c; } #coolMenu li:hover ul.noJS { display: block; } JavaScript <script type="text/javascript"> $(function(){ $('#coolMenu').find('> li').hover(function(){ $(this).find('ul') .removeClass('noJS') .stop(true, true).slideToggle('fast'); }); }); </script>
javascript
html
css
null
null
null
open
Drop down menu, CSS, HTML and JavaScript: JavaScript making menu jump and not function correctly === I have a simple drop down menu, but when used it does not work correctly, I think there is a problem with the JavaScript as it just keeps bouncing up and down! <div class="container"> <ul id="coolMenu"> <li><a href="#">Lorem</a></li> <li><a href="#">Mauricii</a></li> <li> <a href="#">Periher</a> <ul> <li><a href="#">Hellenico</a></li> <li><a href="#">Genere</a></li> <li><a href="#">Indulgentia</a></li> </ul> </li> <li><a href="#">Tyrio</a></li> <li><a href="#">Quicumque</a></li> </ul> CSS #coolMenu, #coolMenu ul { list-style: none; } #coolMenu { float: left; } #coolMenu > li { float: left; } #coolMenu li a { display: block; height: 2em; line-height: 2em; padding: 0 1.5em; text-decoration: none; } #coolMenu ul { position: absolute; display: none; z-index: 999; } #coolMenu ul li a { width: 80px; } #coolMenu li:hover ul { display: block; } /* Main menu ------------------------------------------*/ #coolMenu { font-family: Arial; font-size: 12px; background: #2f8be8; } #coolMenu > li > a { color: #fff; font-weight: bold; } #coolMenu > li:hover > a { background: #f09d28; color: #000; } /* Submenu ------------------------------------------*/ #coolMenu ul { background: #f09d28; } #coolMenu ul li a { color: #000; } #coolMenu ul li:hover a { background: #ffc97c; } #coolMenu li:hover ul.noJS { display: block; } JavaScript <script type="text/javascript"> $(function(){ $('#coolMenu').find('> li').hover(function(){ $(this).find('ul') .removeClass('noJS') .stop(true, true).slideToggle('fast'); }); }); </script>
0
11,628,346
07/24/2012 09:53:02
1,502,136
07/04/2012 17:00:52
39
0
C++ usage of strtok() on string
I tried the following code from one of the guys who answer my previous question.. My case is i am string to get the value 1.2597 in this string, and my non functional requirement is to use strtok instead of boost which is recommend by many fellow coders here. However i got a issue casting result into a cstr* that can use the strtok. I want to know do i get 1.2597 , and echo it out in my scenario with strtok string result= "CCY 1.2597 Down 0.0021(0.16%) 14:32 SGT [44]"; char *first = strtok(result, ' '); char *second = strtok(0, ' '); Thanks in advance.
c++
null
null
null
null
null
open
C++ usage of strtok() on string === I tried the following code from one of the guys who answer my previous question.. My case is i am string to get the value 1.2597 in this string, and my non functional requirement is to use strtok instead of boost which is recommend by many fellow coders here. However i got a issue casting result into a cstr* that can use the strtok. I want to know do i get 1.2597 , and echo it out in my scenario with strtok string result= "CCY 1.2597 Down 0.0021(0.16%) 14:32 SGT [44]"; char *first = strtok(result, ' '); char *second = strtok(0, ' '); Thanks in advance.
0
11,628,348
07/24/2012 09:53:09
231,248
12/14/2009 12:49:41
316
1
How does ElasticBeanStalk deploy your application version to instances?
I am currently using AWS ElasticBeanStalk and I was curious as to how (as in internally) it knows that when you fire up an instance (or it automatically does with scaling), to unpack the zip I uploaded as a version? Is there some enviroment setting that looks up my zip in my S3 bucket and then unpacks automatically for every instance running in that environment? If so, could this be used to automate a task such as run an SQL query on boot-up (instance deployment) too? Are these automated tasks changeable or viewable at all? Thanks
amazon-web-services
elastic-beanstalk
amazon-elasticbeanstalk
null
null
null
open
How does ElasticBeanStalk deploy your application version to instances? === I am currently using AWS ElasticBeanStalk and I was curious as to how (as in internally) it knows that when you fire up an instance (or it automatically does with scaling), to unpack the zip I uploaded as a version? Is there some enviroment setting that looks up my zip in my S3 bucket and then unpacks automatically for every instance running in that environment? If so, could this be used to automate a task such as run an SQL query on boot-up (instance deployment) too? Are these automated tasks changeable or viewable at all? Thanks
0
11,628,349
07/24/2012 09:53:12
1,485,971
06/27/2012 14:27:48
3
5
Get the All Infromation of SharePoint Server using Client Object Model
I want to Create a Windows Application that Display all Web Application, Sites Collection of Each web Applications, Sites of Each Site Collection, Sub-Sites of Each Sites, All lists-Libraries of Each Site and Sub-Sites in Tree-view here i don't want to Give any Static URL, on Application Start up That All Information Filled Automatically in Tree-view if SharePoint is Installed on that Computer. Is this Possible ? if yes then how ?
sharepoint
sharepoint2010
null
null
null
null
open
Get the All Infromation of SharePoint Server using Client Object Model === I want to Create a Windows Application that Display all Web Application, Sites Collection of Each web Applications, Sites of Each Site Collection, Sub-Sites of Each Sites, All lists-Libraries of Each Site and Sub-Sites in Tree-view here i don't want to Give any Static URL, on Application Start up That All Information Filled Automatically in Tree-view if SharePoint is Installed on that Computer. Is this Possible ? if yes then how ?
0
11,619,254
07/23/2012 19:33:59
1,324,595
04/10/2012 16:38:58
28
1
InvalidObjectException when reading Siena object from ObjectInputStream
I am sending a Siena object encased in a SignedObject over a TCP connection using an ObjectInputStream. When I call SignedObject.getObject(), I get an InvalidObjectException. The stack trace is below. java.io.InvalidObjectException: siena.SENPInvalidFormat at siena.Filter.readObject(Filter.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.security.SignedObject.getObject(Unknown Source) I can see that the readObject() method of the class being sent (Filter or Notification) is being called, but I don't know if this is supposed to be happening or not. I know that an exception is being thrown within that method, which I presume is causing the InvalidObjectException. (For those who know Siena, this is only happening in the confidential/encrypted version of the objects, not the plaintext.) Is this method supposed to be called? If so, then it would seem the problem is within the Siena class, and I'll need to dig into the code to find it. If not, then how do I stop it from being called? Thanks, David
java
deserialization
objectinputstream
siena
null
null
open
InvalidObjectException when reading Siena object from ObjectInputStream === I am sending a Siena object encased in a SignedObject over a TCP connection using an ObjectInputStream. When I call SignedObject.getObject(), I get an InvalidObjectException. The stack trace is below. java.io.InvalidObjectException: siena.SENPInvalidFormat at siena.Filter.readObject(Filter.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at java.io.ObjectStreamClass.invokeReadObject(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at java.security.SignedObject.getObject(Unknown Source) I can see that the readObject() method of the class being sent (Filter or Notification) is being called, but I don't know if this is supposed to be happening or not. I know that an exception is being thrown within that method, which I presume is causing the InvalidObjectException. (For those who know Siena, this is only happening in the confidential/encrypted version of the objects, not the plaintext.) Is this method supposed to be called? If so, then it would seem the problem is within the Siena class, and I'll need to dig into the code to find it. If not, then how do I stop it from being called? Thanks, David
0
11,619,255
07/23/2012 19:34:05
1,404,175
05/18/2012 19:38:05
8
1
PHP Filesize direct path
I had created a dynamic site and our head IT person moved the directory of it messing up my coding. I have fixed everything minus the filesize. I have tried multiple tips that I have researched and it still displays nothing. Originally it was $download = $row['PDF'] Then later I would call it like <?php <span class = \"filesize\">(".filesize($download)." bytes)</span>"; ?> I have tried the following <?php <span class = \"filesize\">(".filesize("/folder/".$download)." bytes)</span>"; ?> Still nothing!
php
filesize
null
null
null
null
open
PHP Filesize direct path === I had created a dynamic site and our head IT person moved the directory of it messing up my coding. I have fixed everything minus the filesize. I have tried multiple tips that I have researched and it still displays nothing. Originally it was $download = $row['PDF'] Then later I would call it like <?php <span class = \"filesize\">(".filesize($download)." bytes)</span>"; ?> I have tried the following <?php <span class = \"filesize\">(".filesize("/folder/".$download)." bytes)</span>"; ?> Still nothing!
0
11,350,517
07/05/2012 18:40:24
1,180,926
12/29/2009 23:32:43
192
6
EF One-to-many Foreign Keys without child navigation properties
<!-- language-all: c# --> Using code-first Entity Framework and .NET 4, I'm trying to create a one-to-many relationship between parents to children: public class Parent { [Key] public int ParentId { get; set; } [Required] public string ParentName { get; set; } public IEnumerable<Child> Children { get; set; } } public class AddressMatch { [Key] public int ChildId { get; set; } [ForeignKey] public int ParentId { get; set; } [Required] public string ChildName { get; set; } } As pointed out [here][1], in order for foreign key relationship to carry into the database, the actual objects must be linked, not just their IDs. The normal way to do this if for a child to contain a reference to its parent ([example][2]). But how do I enforce foreign keys in *my* implementation, which is the other way around (parent referencing children)? [1]: http://stackoverflow.com/questions/8452725/entity-framework-map-foreign-key-without-navigation-property/8455916#8455916 [2]: http://stackoverflow.com/a/5543702/1180926
c#
entity-framework
foreign-keys
code-first
null
null
open
EF One-to-many Foreign Keys without child navigation properties === <!-- language-all: c# --> Using code-first Entity Framework and .NET 4, I'm trying to create a one-to-many relationship between parents to children: public class Parent { [Key] public int ParentId { get; set; } [Required] public string ParentName { get; set; } public IEnumerable<Child> Children { get; set; } } public class AddressMatch { [Key] public int ChildId { get; set; } [ForeignKey] public int ParentId { get; set; } [Required] public string ChildName { get; set; } } As pointed out [here][1], in order for foreign key relationship to carry into the database, the actual objects must be linked, not just their IDs. The normal way to do this if for a child to contain a reference to its parent ([example][2]). But how do I enforce foreign keys in *my* implementation, which is the other way around (parent referencing children)? [1]: http://stackoverflow.com/questions/8452725/entity-framework-map-foreign-key-without-navigation-property/8455916#8455916 [2]: http://stackoverflow.com/a/5543702/1180926
0
11,350,522
07/05/2012 18:40:34
1,198,166
02/08/2012 20:15:31
201
12
acquiring session information from server-side code, to client-side code
On a website I'm developing, using Node, Express, and Backbone, I have the user login using a regular HTML form that, when successfully logged in, creates a user session. Accessing this session info is easy on the server-side, giving me access to the User ID, Username, etc., but I'm not sure on how to access this information in Backbone. I want to acquire the UserID such that I can create a URL for a Collection like this: url: '/api/users/'+ this.userID +'/movies'; But I'm not sure how to best go about acquiring the userID based upon the Session data that's on the server-side. Would this require creating another model -- say, a 'User' model that fetches the session data from the server, through a particular url/get request? Thanks!
javascript
node.js
cookies
backbone.js
express
null
open
acquiring session information from server-side code, to client-side code === On a website I'm developing, using Node, Express, and Backbone, I have the user login using a regular HTML form that, when successfully logged in, creates a user session. Accessing this session info is easy on the server-side, giving me access to the User ID, Username, etc., but I'm not sure on how to access this information in Backbone. I want to acquire the UserID such that I can create a URL for a Collection like this: url: '/api/users/'+ this.userID +'/movies'; But I'm not sure how to best go about acquiring the userID based upon the Session data that's on the server-side. Would this require creating another model -- say, a 'User' model that fetches the session data from the server, through a particular url/get request? Thanks!
0
11,350,524
07/05/2012 18:40:39
1,494,683
07/01/2012 19:31:43
64
1
django + confusion with the ORM
I am getting a strange error despite following the documentation. I have the following model: class UserToken(models.Model): token = models.CharField(max_length=100) user = models.ForeignKey(User) Whenever I do `UserToken.objects.get(token=tokenValue)` (tokenValue is the value I am looking for) locally for MySQL, everything works. I get the value as expected. But when I do the same on my MySQL instance in Amazon RDS, I keep getting the following error: `ERROR Unknown exception: UserToken matching query does not exist.` Is there anything I am missing here? Why would a statement like this not work in RDS? **[EDIT]** Just to clarify, the token values do indeed exist. I checked the database just to make sure.
django
amazon-rds
null
null
null
null
open
django + confusion with the ORM === I am getting a strange error despite following the documentation. I have the following model: class UserToken(models.Model): token = models.CharField(max_length=100) user = models.ForeignKey(User) Whenever I do `UserToken.objects.get(token=tokenValue)` (tokenValue is the value I am looking for) locally for MySQL, everything works. I get the value as expected. But when I do the same on my MySQL instance in Amazon RDS, I keep getting the following error: `ERROR Unknown exception: UserToken matching query does not exist.` Is there anything I am missing here? Why would a statement like this not work in RDS? **[EDIT]** Just to clarify, the token values do indeed exist. I checked the database just to make sure.
0
11,350,518
07/05/2012 18:40:25
296,542
03/18/2010 13:29:01
292
28
Get detailed field information for a pgsql resultset in php
I have been trying to get the complete meta information for the fields in a result set from Postgresql in php (something like mysql_fetch_field(), which gives a lots of info about the field definition). While I am able to use the following functions to find some information: $name = pg_field_name($result, 1); $table = pg_field_table($result, 1); $type = pg_field_type($result, 1); I could not find a way to get more details about whether the field allow null values, contains blob data (by field definition), is a primary,unique key by definition etc. The mysql_fetch_field() gives all of this information somehow, which is very useful. I would really like some way to get that information from php directly, but if that is not possible, then maybe someone has created a routine that might be able to extract that info from a pgsql resultset somehow. PS: This looks promising, but the warning on the page is not a good sign: http://php.net/manual/en/pdostatement.getcolumnmeta.php Also, I am not using PDO at the moment, but if there is no solution, then a PDo specific answer will suffice too.
php
postgresql
null
null
null
null
open
Get detailed field information for a pgsql resultset in php === I have been trying to get the complete meta information for the fields in a result set from Postgresql in php (something like mysql_fetch_field(), which gives a lots of info about the field definition). While I am able to use the following functions to find some information: $name = pg_field_name($result, 1); $table = pg_field_table($result, 1); $type = pg_field_type($result, 1); I could not find a way to get more details about whether the field allow null values, contains blob data (by field definition), is a primary,unique key by definition etc. The mysql_fetch_field() gives all of this information somehow, which is very useful. I would really like some way to get that information from php directly, but if that is not possible, then maybe someone has created a routine that might be able to extract that info from a pgsql resultset somehow. PS: This looks promising, but the warning on the page is not a good sign: http://php.net/manual/en/pdostatement.getcolumnmeta.php Also, I am not using PDO at the moment, but if there is no solution, then a PDo specific answer will suffice too.
0
11,350,520
07/05/2012 18:40:27
1,504,880
07/05/2012 18:27:28
1
0
AndroidViewClient on Non-Developer Phones
Does AndroidViewClient work on non-developer phones and if not are there plans to make it work on them?
android
python
monkeyrunner
null
null
07/05/2012 18:46:23
not a real question
AndroidViewClient on Non-Developer Phones === Does AndroidViewClient work on non-developer phones and if not are there plans to make it work on them?
1
11,350,527
07/05/2012 18:40:51
1,071,423
11/29/2011 13:55:27
91
5
Rails 3.2 basic relationship has_many
I've reread the rails guide to associations but still am hitting my head up against the wall. I've seen some advanced questions on Stack Overflow and am not able to determine if they shed light on my problem. Perhaps I've haven't gotten my mind wrapped around this. Please show me what I'm not seeing. I have a School.rb which has_many Events, has_many Venues. Each of the Events and Venues belongs_to School. I'm trying to link up the Venue to an Event. They are tied to the school because they have a matching school_id. The name of the school is easily applied in Event#show and Venue#show as expected. The trick is how do I craft the Event controller to use the school_id to pull the Venue's addy in the Event#show page? My attempts keep missing so I got to thinking maybe I have to make the Event belongs_to Venue and Venue has_many Events. Is that the right thing to do? I attempt <%= @event.venue.address %> but that fails with 'undefined method `address' for nil:NilClass' Maybe I'm overthinking it but as I mention above, I don't know enough to ask the right question. If I was to put my query in English terms it would be "Grab the instance of Venue whose school_id matches the school_id of the current/active Event." Does that make sense? I've attempted to find something close to that in the rails guides and attempted this: @venues = Venue.where(:school_id => @school_id) undefined method `address' for []:ActiveRecord::Relation. The venue address is in the venue model. Please help me get over this baby step, sam
ruby-on-rails-3
activerecord
null
null
null
null
open
Rails 3.2 basic relationship has_many === I've reread the rails guide to associations but still am hitting my head up against the wall. I've seen some advanced questions on Stack Overflow and am not able to determine if they shed light on my problem. Perhaps I've haven't gotten my mind wrapped around this. Please show me what I'm not seeing. I have a School.rb which has_many Events, has_many Venues. Each of the Events and Venues belongs_to School. I'm trying to link up the Venue to an Event. They are tied to the school because they have a matching school_id. The name of the school is easily applied in Event#show and Venue#show as expected. The trick is how do I craft the Event controller to use the school_id to pull the Venue's addy in the Event#show page? My attempts keep missing so I got to thinking maybe I have to make the Event belongs_to Venue and Venue has_many Events. Is that the right thing to do? I attempt <%= @event.venue.address %> but that fails with 'undefined method `address' for nil:NilClass' Maybe I'm overthinking it but as I mention above, I don't know enough to ask the right question. If I was to put my query in English terms it would be "Grab the instance of Venue whose school_id matches the school_id of the current/active Event." Does that make sense? I've attempted to find something close to that in the rails guides and attempted this: @venues = Venue.where(:school_id => @school_id) undefined method `address' for []:ActiveRecord::Relation. The venue address is in the venue model. Please help me get over this baby step, sam
0
11,350,534
07/05/2012 18:41:22
953,227
09/19/2011 17:38:14
29
0
how to create multiple excel sheets
well i have to creat just one excel file and 2 sheets both are fill using a 2 diferent DataTable it gaves the name the user only has to click save, the next code allows me to seend one datatable to one sheet (i am using C#, asp.net, and NOT using Visual Studio, i am writing in the Notepad my code): string name2="Centroids"; HttpContext context = HttpContext.Current; context.Response.Clear(); foreach (System.Data.DataRow row in _myDataTable2.Rows) { for (int i = 0; i < _myDataTable2.Columns.Count; i++) { context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ","); } context.Response.Write(Environment.NewLine); } context.Response.ContentType = "text2/csv"; context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name2 + ".csv"); but i have no idea how to creat the second sheet and use the second DataTable, any ideas of how to find a solution, this way the user has only to save and donwload only one document and not save as many DataTable are in the programa
c#
asp.net
null
null
null
null
open
how to create multiple excel sheets === well i have to creat just one excel file and 2 sheets both are fill using a 2 diferent DataTable it gaves the name the user only has to click save, the next code allows me to seend one datatable to one sheet (i am using C#, asp.net, and NOT using Visual Studio, i am writing in the Notepad my code): string name2="Centroids"; HttpContext context = HttpContext.Current; context.Response.Clear(); foreach (System.Data.DataRow row in _myDataTable2.Rows) { for (int i = 0; i < _myDataTable2.Columns.Count; i++) { context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ","); } context.Response.Write(Environment.NewLine); } context.Response.ContentType = "text2/csv"; context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name2 + ".csv"); but i have no idea how to creat the second sheet and use the second DataTable, any ideas of how to find a solution, this way the user has only to save and donwload only one document and not save as many DataTable are in the programa
0
11,660,360
07/25/2012 23:46:37
1,294,247
03/03/2010 01:48:55
1
0
Selecting a value from a list of values in a report on access 2007
I have a table that has a field named "number" which is populated by a list of values, between 0 to 6. I then have a query where I search the number of records on each "number". On the query it works, and I get the number of records for each "number", for example: - 10 cases for 0 - 5 cases for 1 - .... But then when I create a report based on that query, it displays the list of values from the "number" field, with the value in question highlighted... I want to show only the highlighted number on each row, and not the whole list of values... How can I do this?
list
ms-access-2007
null
null
null
null
open
Selecting a value from a list of values in a report on access 2007 === I have a table that has a field named "number" which is populated by a list of values, between 0 to 6. I then have a query where I search the number of records on each "number". On the query it works, and I get the number of records for each "number", for example: - 10 cases for 0 - 5 cases for 1 - .... But then when I create a report based on that query, it displays the list of values from the "number" field, with the value in question highlighted... I want to show only the highlighted number on each row, and not the whole list of values... How can I do this?
0
11,660,556
07/26/2012 00:11:41
1,535,971
07/18/2012 19:56:46
5
0
Jquery selecting hierarchies
I'm trying to create a hierarchy that will be implemented through backbone.js and I was wondering how to structure the hierarchy and access the elements. I need to be able to add and remove Lists/Sets/Items and hopefully keep a consistent numbering policy. (List1 would have a displayed name of list1. If I deleted Set1 I would want Set2 to become Set1 while retaining its corresponding items) List1 ^--->Set1 ^--->Item1 ^--->Item2 ^--->Set2 ^--->Item1 List2 ^--->Set1 ^--->Item1 ^--->Set2 ^--->Item1 ^--->Item2 etc. My question is this: How do you structure this in a way such that a set of functions following the same hierarchy can access them in the most compact and logical manner? One idea I had:use div and just have your div id be something like id="List"+currentlistnum()+"Set"+currentsetnum()+"Item"+currentitemnum() Is there a better way to do it than this?
javascript
jquery
backbone.js
hierarchy
null
null
open
Jquery selecting hierarchies === I'm trying to create a hierarchy that will be implemented through backbone.js and I was wondering how to structure the hierarchy and access the elements. I need to be able to add and remove Lists/Sets/Items and hopefully keep a consistent numbering policy. (List1 would have a displayed name of list1. If I deleted Set1 I would want Set2 to become Set1 while retaining its corresponding items) List1 ^--->Set1 ^--->Item1 ^--->Item2 ^--->Set2 ^--->Item1 List2 ^--->Set1 ^--->Item1 ^--->Set2 ^--->Item1 ^--->Item2 etc. My question is this: How do you structure this in a way such that a set of functions following the same hierarchy can access them in the most compact and logical manner? One idea I had:use div and just have your div id be something like id="List"+currentlistnum()+"Set"+currentsetnum()+"Item"+currentitemnum() Is there a better way to do it than this?
0
11,660,564
07/26/2012 00:12:37
1,193,487
02/06/2012 23:05:23
3
0
Re-using bind variables in Oracle PL/SQL
I have a hefty SQL statement with unions where code keeps getting re-used. I was hoping to find out if there is a way to re-use a single bind variable without repeating the variable to for "USING" multiple times. The code below returns "not all variables bound" until I change the "USING" line to "USING VAR1,VAR2,VAR1;" I was hoping to avoid that as I'm referring to :1 in both instances - any ideas? declare var1 number :=1; var2 number :=2; begin execute immediate ' select * from user_objects where rownum = :1 OR rownum = :2 OR rownum = :1 ' using var1,var2; end; /
oracle
plsql
oracle10g
null
null
null
open
Re-using bind variables in Oracle PL/SQL === I have a hefty SQL statement with unions where code keeps getting re-used. I was hoping to find out if there is a way to re-use a single bind variable without repeating the variable to for "USING" multiple times. The code below returns "not all variables bound" until I change the "USING" line to "USING VAR1,VAR2,VAR1;" I was hoping to avoid that as I'm referring to :1 in both instances - any ideas? declare var1 number :=1; var2 number :=2; begin execute immediate ' select * from user_objects where rownum = :1 OR rownum = :2 OR rownum = :1 ' using var1,var2; end; /
0
11,660,565
07/26/2012 00:12:50
1,255,372
03/07/2012 17:56:52
70
2
Carrierwave: Duplicating File In a Second Model
I have two models, each with their own Carrierwave uploaders: class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader end and: class Bookshelf < ActiveRecord::Base mount_uploader :image, ImageUploader end I want the user's avatar to be the latest bookshelf image he's uploaded. I try to achieve this like so: class BookcasesController < ApplicationController def create @bookcase = current_user.bookcases.build(params[:bookcase]) if @bookcase.save current_user.avatar = @bookcase.image current_user.avatar.recreate_versions! end end end Unfortunately, this has no effect on the avatar at all. How else might I achieve this?
ruby-on-rails
carrierwave
null
null
null
null
open
Carrierwave: Duplicating File In a Second Model === I have two models, each with their own Carrierwave uploaders: class User < ActiveRecord::Base mount_uploader :avatar, AvatarUploader end and: class Bookshelf < ActiveRecord::Base mount_uploader :image, ImageUploader end I want the user's avatar to be the latest bookshelf image he's uploaded. I try to achieve this like so: class BookcasesController < ApplicationController def create @bookcase = current_user.bookcases.build(params[:bookcase]) if @bookcase.save current_user.avatar = @bookcase.image current_user.avatar.recreate_versions! end end end Unfortunately, this has no effect on the avatar at all. How else might I achieve this?
0
11,660,568
07/26/2012 00:13:42
391,080
07/14/2010 00:42:29
146
6
Regex Match That doesn't contain some text
I am tring to create a regex that finds a Start Prefix and an End Prefix that have paragraph tags between them. But the one i have cteated is not working to my expectations. ```%%%HL_START%%%(.*?)</p><p>(.*?)%%%HL_END%%%``` Correctly Matches ```<p>This Should %%%HL_START%%%Work</p><p>This%%%HL_END%%% SHould Match</p>``` This also matches but i dont want it to match becasue the ```</p><p>``` is not in bettween the Start and End Prefix ```<p>%%%HL_START%%%One%%%HL_END%%% Some More Text %%%HL_START%%%Here%%%HL_END%%%</p><p>Some more text %%%HL_START%%%Here%%%HL_END%%%</p>```
regex
null
null
null
null
null
open
Regex Match That doesn't contain some text === I am tring to create a regex that finds a Start Prefix and an End Prefix that have paragraph tags between them. But the one i have cteated is not working to my expectations. ```%%%HL_START%%%(.*?)</p><p>(.*?)%%%HL_END%%%``` Correctly Matches ```<p>This Should %%%HL_START%%%Work</p><p>This%%%HL_END%%% SHould Match</p>``` This also matches but i dont want it to match becasue the ```</p><p>``` is not in bettween the Start and End Prefix ```<p>%%%HL_START%%%One%%%HL_END%%% Some More Text %%%HL_START%%%Here%%%HL_END%%%</p><p>Some more text %%%HL_START%%%Here%%%HL_END%%%</p>```
0
11,660,569
07/26/2012 00:13:46
804,707
06/18/2011 16:53:24
45
0
After upgrading to OS X Mountain Lion, memcached stopped working in MAMP (other terminal commands stopped working as well). Need help getting it back
Upgrading to Mountain Lion has been a terrible experience so far. After upgrading, bash commands didn't even work in the terminal so I had them back into my path variable. Memcached also stopped working. Anyways, when I try to use my cakephp application on my local environment with MAMP, I get a cakephp error saying my caching isn't configured correctly. Not surprisingly, class_exists('Memcached') returns false on my computer and true on my friend's (who has the same setup without mountain lion). How can I get this to start working again?? I'm under a lot of time pressure! Thank you so much, W
cakephp
memcached
mamp
osx-mountain-lion
null
null
open
After upgrading to OS X Mountain Lion, memcached stopped working in MAMP (other terminal commands stopped working as well). Need help getting it back === Upgrading to Mountain Lion has been a terrible experience so far. After upgrading, bash commands didn't even work in the terminal so I had them back into my path variable. Memcached also stopped working. Anyways, when I try to use my cakephp application on my local environment with MAMP, I get a cakephp error saying my caching isn't configured correctly. Not surprisingly, class_exists('Memcached') returns false on my computer and true on my friend's (who has the same setup without mountain lion). How can I get this to start working again?? I'm under a lot of time pressure! Thank you so much, W
0
11,660,573
07/26/2012 00:14:10
966,021
09/27/2011 00:01:29
11
0
how to install cc on mac os 10.8 without paying for developer program?
Several python libraries stopped working after upgrade to Mac OS 10.8. Attempt to re-install them through easy_install or pip brings error message "-bash: cc: command not found". XCode is installed. Attempt to install Command line tools for XCode insist on enrolling into developer program. I don't want to pay $99 for what used to work. I don't need to distribute anything — I'm not developing anything Apple has to do with. Is there a way to obtain c compiler, make, and all this stuff without declaring myself a Mac developer/paying $99 a year?
python
osx
osx-mountain-lion
cc
null
07/26/2012 05:36:59
off topic
how to install cc on mac os 10.8 without paying for developer program? === Several python libraries stopped working after upgrade to Mac OS 10.8. Attempt to re-install them through easy_install or pip brings error message "-bash: cc: command not found". XCode is installed. Attempt to install Command line tools for XCode insist on enrolling into developer program. I don't want to pay $99 for what used to work. I don't need to distribute anything — I'm not developing anything Apple has to do with. Is there a way to obtain c compiler, make, and all this stuff without declaring myself a Mac developer/paying $99 a year?
2
11,660,585
07/26/2012 00:15:37
1,546,133
07/23/2012 14:38:11
1
0
multiple forms on a page with Ajax MVC
I'm using a page to provide me a way to record the "events" from every player in a game on a single page. As this is a ChildAction I cannot use return Action. I'm trying Ajax.BeginForm and it works to some extent. My problem is that when I click "save" the events for the same player are save as many times as there are players on the page. My form id's and Submit button Id's are unique to each player. Is the problem with my controller? @using (Ajax.BeginForm("CreateEven", "match", new {id =TempData["leMatch"] }, new AjaxOptions { UpdateTargetId = "result" }, new { id = ViewBag.idJoueur })) { **** //Create Evenement [ChildActionOnly] [HttpPost] public ActionResult LaCreation(evenement LaCreation) { if (ModelState.IsValid) { db.evenements.Add(LaCreation); db.SaveChanges(); return Content("<td>Ok</td>", "text/html"); } return View("CreateEven");
ajax
asp.net-mvc
null
null
null
null
open
multiple forms on a page with Ajax MVC === I'm using a page to provide me a way to record the "events" from every player in a game on a single page. As this is a ChildAction I cannot use return Action. I'm trying Ajax.BeginForm and it works to some extent. My problem is that when I click "save" the events for the same player are save as many times as there are players on the page. My form id's and Submit button Id's are unique to each player. Is the problem with my controller? @using (Ajax.BeginForm("CreateEven", "match", new {id =TempData["leMatch"] }, new AjaxOptions { UpdateTargetId = "result" }, new { id = ViewBag.idJoueur })) { **** //Create Evenement [ChildActionOnly] [HttpPost] public ActionResult LaCreation(evenement LaCreation) { if (ModelState.IsValid) { db.evenements.Add(LaCreation); db.SaveChanges(); return Content("<td>Ok</td>", "text/html"); } return View("CreateEven");
0
11,734,536
07/31/2012 06:44:32
1,434,861
06/04/2012 09:53:06
1
0
C#. split identificator on the words
I have some identificator. For example: 'basisHtmlConverter.' <br/> I need split his on the some words: 'basic Html Converter'. <br/> I think to using Regex.Split with some pattern.
c#
regex
null
null
null
07/31/2012 13:02:30
not a real question
C#. split identificator on the words === I have some identificator. For example: 'basisHtmlConverter.' <br/> I need split his on the some words: 'basic Html Converter'. <br/> I think to using Regex.Split with some pattern.
1
11,734,537
07/31/2012 06:44:33
311,653
04/08/2010 06:42:56
407
18
App crashes - App receives low memory warning
In my app, I am getting low memory warning and app crashes after taking photos more than 100 from iPad camera. I used some memory management tools like instruments leaks- allocations, instrument doesn't show me any leak. But when I used allocation it shows me malloc 16bytes uses more allocation each time I opened camera view and takes photo, open my custom view. I done google and I found code snippet to find out how much memory app uses -(void) report_memory { struct task_basic_info info; mach_msg_type_number_t size = sizeof(info); kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); if( kerr == KERN_SUCCESS ) { NSLog(@"Memory in use (in bytes): %u", info.resident_size); } else { NSLog(@"Error with task_info(): %s", mach_error_string(kerr)); } } Above code snippet also gives me same result as of instrument that app uses more allocation when i open camera and custom VC. In my code I have used one category for creating thumbnail image using functions CGContextRef, CGColorSpaceRef, CGImageRef, imageWithCGImage etc. Is it making issue for crash? Is there any other ways to find out or trace out reason for app crashing/ received memory warning? Or is there any other better ways in instruments to find out this? Thanks..
objective-c
ios
uiimage
null
null
null
open
App crashes - App receives low memory warning === In my app, I am getting low memory warning and app crashes after taking photos more than 100 from iPad camera. I used some memory management tools like instruments leaks- allocations, instrument doesn't show me any leak. But when I used allocation it shows me malloc 16bytes uses more allocation each time I opened camera view and takes photo, open my custom view. I done google and I found code snippet to find out how much memory app uses -(void) report_memory { struct task_basic_info info; mach_msg_type_number_t size = sizeof(info); kern_return_t kerr = task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&info, &size); if( kerr == KERN_SUCCESS ) { NSLog(@"Memory in use (in bytes): %u", info.resident_size); } else { NSLog(@"Error with task_info(): %s", mach_error_string(kerr)); } } Above code snippet also gives me same result as of instrument that app uses more allocation when i open camera and custom VC. In my code I have used one category for creating thumbnail image using functions CGContextRef, CGColorSpaceRef, CGImageRef, imageWithCGImage etc. Is it making issue for crash? Is there any other ways to find out or trace out reason for app crashing/ received memory warning? Or is there any other better ways in instruments to find out this? Thanks..
0
11,733,255
07/31/2012 04:46:01
1,319,802
04/08/2012 02:06:51
41
1
How to solve this "non-static variable" issue in Java?
public class InterfaceTest { interface InterfaceA { int len = 1 ; void output(); } interface InterfaceB { int len = 2 ; void output(); } interface InterfaceSub extends InterfaceA, InterfaceB { } public class Xyz implements InterfaceSub { public void output() { System.out.println( "output in class Xyz." ); } public void outputLen(int type) { switch (type) { case InterfaceA.len: System.out.println( "len of InterfaceA=." +type); break ; case InterfaceB.len: System.out.println( "len of InterfaceB=." +type); break ; } } } public static void main(String[] args) { Xyz xyz = new Xyz(); xyz.output(); xyz.outputLen(1); } } Hi, I want to leanr Java's interface and multiple inheritance. I found above code and try to compile it, but below error occurs. I don't know how to make the code work, who could help? Thanks! test$ javac InterfaceTest.java InterfaceTest.java:33: error: non-static variable this cannot be referenced from a static context Xyz xyz = new Xyz(); ^ 1 error
java
null
null
null
null
null
open
How to solve this "non-static variable" issue in Java? === public class InterfaceTest { interface InterfaceA { int len = 1 ; void output(); } interface InterfaceB { int len = 2 ; void output(); } interface InterfaceSub extends InterfaceA, InterfaceB { } public class Xyz implements InterfaceSub { public void output() { System.out.println( "output in class Xyz." ); } public void outputLen(int type) { switch (type) { case InterfaceA.len: System.out.println( "len of InterfaceA=." +type); break ; case InterfaceB.len: System.out.println( "len of InterfaceB=." +type); break ; } } } public static void main(String[] args) { Xyz xyz = new Xyz(); xyz.output(); xyz.outputLen(1); } } Hi, I want to leanr Java's interface and multiple inheritance. I found above code and try to compile it, but below error occurs. I don't know how to make the code work, who could help? Thanks! test$ javac InterfaceTest.java InterfaceTest.java:33: error: non-static variable this cannot be referenced from a static context Xyz xyz = new Xyz(); ^ 1 error
0
11,734,539
07/31/2012 06:44:49
500,201
11/08/2010 00:22:56
28
0
Atomic operations with Doctrine MongoDB ODM
I can't seem to get the following query to work. Basically, I am trying to add a message document to a conversation document as illustrated below: public function reply($conversationId, Message $message, $flush = true) { $this->dm->createQueryBuilder($this->class) ->field('archivers')->unsetField() ->field('repliedBy')->set($message->getUserId()) ->field('repliedBody')->set($message->getBody()) ->field('repliedAt')->set(new \DateTime()) ->field('modifiedAt')->set(new \DateTime()) ->field('messages')->push($message) ->field('id')->equals(new \MongoId($conversationId)) ->getQuery() ->execute(); if ($flush) { $this->dm->flush(); } } This reply method gets called in two ways. First by a user posting a message via a html form, and second by a REST call made by an Android application. The form works but the REST call fails (the rest implementation uses the JMSSerializerBundle with FOSRestBundle btw)... I have verified that the code gets called and the parameters passed to the method are valid in both cases, but for some reason the commit() call inside UnitOfWork.php ignores the changes to the document. See line 413 at https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/UnitOfWork.php to see what I mean. Does anybody have an idea why this might be happening?
mongodb
symfony-2.0
doctrine
null
null
null
open
Atomic operations with Doctrine MongoDB ODM === I can't seem to get the following query to work. Basically, I am trying to add a message document to a conversation document as illustrated below: public function reply($conversationId, Message $message, $flush = true) { $this->dm->createQueryBuilder($this->class) ->field('archivers')->unsetField() ->field('repliedBy')->set($message->getUserId()) ->field('repliedBody')->set($message->getBody()) ->field('repliedAt')->set(new \DateTime()) ->field('modifiedAt')->set(new \DateTime()) ->field('messages')->push($message) ->field('id')->equals(new \MongoId($conversationId)) ->getQuery() ->execute(); if ($flush) { $this->dm->flush(); } } This reply method gets called in two ways. First by a user posting a message via a html form, and second by a REST call made by an Android application. The form works but the REST call fails (the rest implementation uses the JMSSerializerBundle with FOSRestBundle btw)... I have verified that the code gets called and the parameters passed to the method are valid in both cases, but for some reason the commit() call inside UnitOfWork.php ignores the changes to the document. See line 413 at https://github.com/doctrine/mongodb-odm/blob/master/lib/Doctrine/ODM/MongoDB/UnitOfWork.php to see what I mean. Does anybody have an idea why this might be happening?
0
11,734,540
07/31/2012 06:45:00
1,481,793
06/26/2012 06:05:10
25
2
Customizing Django Registration and django profile
I am struggling with django-user registration from 1 day i am hereby attaching my accounts module please consider it Here is my model from django.db import models from django.contrib.auth.models import User from django.contrib import admin from demo.models import Organization def_max_length = 255 class Profile(models.Model): user_name = models.ForeignKey(User, unique=True,related_name = 'ussr') first_name = models.CharField(max_length=100) middle_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) user_name = models.ForeignKey(User, unique=True, related_name='profile') password = models.CharField(max_length=80) role = models.CharField(max_length = 20) org_name = models.ForeignKey('demo.Organization',related_name = 'user_org_nm',null= False) city = models.CharField(max_length=50,null = True,blank = True) state = models.CharField(max_length=50,null = True,blank = True) country = models.CharField(max_length=50,null = True,blank = True) street = models.TextField(null=True,blank = True) pin = models.CharField(max_length=30,null = True,blank = True) user_type = models.CharField(max_length = 30) status =models.IntegerField(null=True, blank=True) primary_mobile =models.CharField(max_length = 50,null = True,blank = True) secondary_mobile =models.CharField(max_length = 50,null = True,blank = True) primary_landline =models.CharField(max_length = 50,null = True,blank = True) secondary_landline =models.CharField(max_length = 12,null = True,blank = True) primary_email = models.CharField(max_length = 30,null = True,blank = True) secondary_email = models.CharField(max_length = 30,null = True,blank = True) notes = models.TextField() date_created = models.DateTimeField(auto_now = True,blank=True, null=True) date_modified =models.DateTimeField(auto_now = False,null = True) class Meta: abstract=True """ class UserProfile(Profile, User): def user_created(sender, user, request, **kwargs): form = ExtendedRegistrationForm(request.POST) extended_user = UserProfile(user=user) extended_user.is_active = False extended_user.first_name = form.extended_user['first_name'] extended_user.last_name = form.extended_user['last_name'] extended_user.pid = form.extended_user['pin'] extended_user.street = form.extended_user['street'] extended_user.number = form.extended_user['state'] extended_user.number = form.extended_user['country'] extended_user.number = form.extended_user['primary_mobile'] extended_user.number = form.extended_user['secondary_mobile'] extended_user.number = form.extended_user['primary_landline'] extended_user.number = form.extended_user['secondary_landline'] extended_user.number = form.extended_user['primary_email'] extended_user.number = form.extended_user['secondary_email'] extended_user.city = form.extended_user['city'] extended_user.save() user_registered.connect(user_created) """ def disable_from_user(self): try: get_mtng = Meeting.objects.filter(created_by = self.id) for get_p in get_mtng: get_p.status = 0 get_p.save() if get_p: try: get_participant = Participant.objects.filter(meeting_id =get_p) for get_pp in get_participant: get_pp.status = 0 get_pp.save() except: LOG_INFO('Organization %s has no PARTICIPANT IN '% get_p) pass except: pass class Meta: app_label = 'accounts' def Validate(self): errors = {} errors.update(verifyStringEmpty('first_name', self.first_name, True)) errors.update(verifyStringEmpty('last_name', self.last_name, True)) errors.update(verifyStringEmpty('passwd', self.passwd, True)) errors.update(verifyStringEmpty('city', self.city, True)) errors.update(verifyStringEmpty('state', self.state, True)) errors.update(verifyStringEmpty('country', self.country, True)) errors.update(verifyStringEmpty('street', self.street, True)) errors.update(verifyStringEmpty('pin', self.pin, True)) errors.update(verifyStringEmpty('primary_mobile', self.primary_mobile, True)) errors.update(verifyStringEmpty('primary_landline', self.primary_landline, True)) errors.update(get_email('primary_email', self.primary_email, True)) errors.update(verifyStringEmpty('status', self.status, False)) errors.update(verifyStringEmpty('middle_name', self.middle_name, False)) errors.update(verifyStringEmpty('notes', self.notes, False)) errors.update(verifyStringEmpty('secondary_mobile', self.secondary_mobile, False)) errors.update(verifyStringEmpty('secondary_landline', self.secondary_landline, False)) errors.update(get_email('secondary_email', self.secondary_email, False)) return errors def ValidateAdmin(self): errors = {} errors.update(verifyStringEmpty('last_name', self.last_name, True)) errors.update(verifyStringEmpty('passwd', self.passwd, True)) #print self.get_org(self.org_name) errors.update(verifyStringEmpty('role', self.role, True)) errors.update(verifyStringEmpty('address', self.address, True)) errors.update(verifyStringEmpty('primary_mobile', self.primary_mobile, True)) errors.update(verifyStringEmpty('primary_landline', self.primary_landline, True)) errors.update(get_email('primary_email', self.primary_email, True)) errors.update(verifyStringEmpty('status', self.status, False)) # errors.update(utils.verifyStringEmpty('org_type', self.org_type, False)) errors.update(verifyStringEmpty('middle_name', self.middle_name, False)) errors.update(verifyStringEmpty('notes', self.notes, False)) errors.update(verifyStringEmpty('secondary_mobile', self.secondary_mobile, False)) errors.update(verifyStringEmpty('secondary_landline', self.secondary_landline, False)) errors.update(get_email('secondary_email', self.secondary_email, False)) return errors class Meta: verbose_name = "User profile" verbose_name_plural = "User profiles" This is my profile.py file from django import forms from models import Profile from demo.models import Organization #import strings from registration.forms import RegistrationForm class UserRegistrationForm(RegistrationForm): first_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the First name"},required = True) middle_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the middle name"},required = True) last_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the last name"},required = True) password1 = forms.CharField(label="Password", widget=forms.PasswordInput) password2 = forms.CharField(label="Password confirmation", widget=forms.PasswordInput, help_text = "Enter the same password as above, for verification.") # primary_email = forms.EmailField(label="Email", max_length=75) secondary_email = forms.EmailField(label="secondary email", max_length=75) city = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the city name"},required = True) state = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclassst'}),error_messages={'required':"please enter a state name"},required = True) country = forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasscountry'}),error_messages={'required':"please enter a country name"},required = True) street = forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclassstreet'}),error_messages={'required':"please enter a street name"},required = True) pin = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasspin'}),error_messages={'required':"please enter a pin name"},required = True) primary_mobile =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasspm'}),error_messages={'required':"work phone is required"},required = True) secondary_mobile =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasssm'}),error_messages={'required':"home phone is required"},required = False) primary_landline =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasspl'}),error_messages={'required':"work phone number is required"},required = True) secondary_landline =forms.CharField(max_length=100,error_messages={'required':"home phone is required"},required = False) org_name = forms.ModelChoiceField(queryset=Organization.objects, label='Organization') Here is regbackend.py file where i am saving all customized fields import profile from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.contrib import messages from demo.models import Organization def user_created(sender, user, request, **kwargs): form = profile.UserRegistrationForm(request.POST) data = profile.Profile(user_name=user) try:get_id = form.data['org_name'] except:get_id = False get_org = Organization.objects.get(id = get_id) data.org_name = get_org data.primary_email = user.email data.first_name = form.data['first_name'] try:data.middle_name = form.data['middle_name'] except:data.middle_name = '' data.last_name = form.data['last_name'] data.city = form.data['city'] data.street = form.data['street'] data.state = form.data['state'] data.country = form.data['country'] data.primary_mobile = form.data['primary_mobile'] try:data.secondary_mobile = form.data['secondary_mobile'] except:data.secondary_mobile = '' data.primary_landline = form.data['primary_landline'] try:data.secondary_landline = form.data['secondary_landline'] except:data.secondary_landline = '' try:data.secondary_email = form.data['secondary_email'] except:data.secondary_email = '' data.passworwd = user.password data.save() print "---------------------" print request messages.success(request, 'Thank you!') from registration.signals import user_registered user_registered.connect(user_created) I have very few things in my views from django.contrib.auth.decorators import login_required from django.template import RequestContext from django.shortcuts import render_to_response from django.contrib.auth.views import logout_then_login from django.contrib.auth.models import User from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect, HttpResponse, Http404 from accounts.forms import UserCreationForm from django.contrib.auth.tokens import default_token_generator from django.core.urlresolvers import reverse from django.template import RequestContext from django.conf import settings from django.utils.http import urlquote, base36_to_int from django.contrib.sites.models import Site from accounts.forms import UserCreationForm from django.core.urlresolvers import reverse def logout_page(request): logout_then_login(request) def index(request): return HttpResponseRedirect(reverse("registration_register")) and last but not least urls.py from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() from django.contrib import admin admin.autodiscover() from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template import registration.backends.default.urls as regUrls from profile import UserRegistrationForm from registration.views import register import regbackend, views from accounts import profile urlpatterns = patterns('', # (r'^conf/admin/(.*)', admin.site.root), url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend','form_class': UserRegistrationForm}, name='registration_register'), (r'^accounts/', include(regUrls)), url('^profile/$', direct_to_template, {'template': 'profile.html'}, name="profile"), (r'^$', views.index), ) I am able to save the custom fields as well as django defaults field but problem start when i am trying to redirect the url @ /accounts/profile/ after saving the custom fields (registration).I used HttpresponseRedirect() method after data.save() in regbackend.py but it is not working please help me out how can i redirect the url to user profile . I have not much idea about Signal .
python
django
django-forms
django-registration
null
null
open
Customizing Django Registration and django profile === I am struggling with django-user registration from 1 day i am hereby attaching my accounts module please consider it Here is my model from django.db import models from django.contrib.auth.models import User from django.contrib import admin from demo.models import Organization def_max_length = 255 class Profile(models.Model): user_name = models.ForeignKey(User, unique=True,related_name = 'ussr') first_name = models.CharField(max_length=100) middle_name = models.CharField(max_length=100) last_name = models.CharField(max_length=100) user_name = models.ForeignKey(User, unique=True, related_name='profile') password = models.CharField(max_length=80) role = models.CharField(max_length = 20) org_name = models.ForeignKey('demo.Organization',related_name = 'user_org_nm',null= False) city = models.CharField(max_length=50,null = True,blank = True) state = models.CharField(max_length=50,null = True,blank = True) country = models.CharField(max_length=50,null = True,blank = True) street = models.TextField(null=True,blank = True) pin = models.CharField(max_length=30,null = True,blank = True) user_type = models.CharField(max_length = 30) status =models.IntegerField(null=True, blank=True) primary_mobile =models.CharField(max_length = 50,null = True,blank = True) secondary_mobile =models.CharField(max_length = 50,null = True,blank = True) primary_landline =models.CharField(max_length = 50,null = True,blank = True) secondary_landline =models.CharField(max_length = 12,null = True,blank = True) primary_email = models.CharField(max_length = 30,null = True,blank = True) secondary_email = models.CharField(max_length = 30,null = True,blank = True) notes = models.TextField() date_created = models.DateTimeField(auto_now = True,blank=True, null=True) date_modified =models.DateTimeField(auto_now = False,null = True) class Meta: abstract=True """ class UserProfile(Profile, User): def user_created(sender, user, request, **kwargs): form = ExtendedRegistrationForm(request.POST) extended_user = UserProfile(user=user) extended_user.is_active = False extended_user.first_name = form.extended_user['first_name'] extended_user.last_name = form.extended_user['last_name'] extended_user.pid = form.extended_user['pin'] extended_user.street = form.extended_user['street'] extended_user.number = form.extended_user['state'] extended_user.number = form.extended_user['country'] extended_user.number = form.extended_user['primary_mobile'] extended_user.number = form.extended_user['secondary_mobile'] extended_user.number = form.extended_user['primary_landline'] extended_user.number = form.extended_user['secondary_landline'] extended_user.number = form.extended_user['primary_email'] extended_user.number = form.extended_user['secondary_email'] extended_user.city = form.extended_user['city'] extended_user.save() user_registered.connect(user_created) """ def disable_from_user(self): try: get_mtng = Meeting.objects.filter(created_by = self.id) for get_p in get_mtng: get_p.status = 0 get_p.save() if get_p: try: get_participant = Participant.objects.filter(meeting_id =get_p) for get_pp in get_participant: get_pp.status = 0 get_pp.save() except: LOG_INFO('Organization %s has no PARTICIPANT IN '% get_p) pass except: pass class Meta: app_label = 'accounts' def Validate(self): errors = {} errors.update(verifyStringEmpty('first_name', self.first_name, True)) errors.update(verifyStringEmpty('last_name', self.last_name, True)) errors.update(verifyStringEmpty('passwd', self.passwd, True)) errors.update(verifyStringEmpty('city', self.city, True)) errors.update(verifyStringEmpty('state', self.state, True)) errors.update(verifyStringEmpty('country', self.country, True)) errors.update(verifyStringEmpty('street', self.street, True)) errors.update(verifyStringEmpty('pin', self.pin, True)) errors.update(verifyStringEmpty('primary_mobile', self.primary_mobile, True)) errors.update(verifyStringEmpty('primary_landline', self.primary_landline, True)) errors.update(get_email('primary_email', self.primary_email, True)) errors.update(verifyStringEmpty('status', self.status, False)) errors.update(verifyStringEmpty('middle_name', self.middle_name, False)) errors.update(verifyStringEmpty('notes', self.notes, False)) errors.update(verifyStringEmpty('secondary_mobile', self.secondary_mobile, False)) errors.update(verifyStringEmpty('secondary_landline', self.secondary_landline, False)) errors.update(get_email('secondary_email', self.secondary_email, False)) return errors def ValidateAdmin(self): errors = {} errors.update(verifyStringEmpty('last_name', self.last_name, True)) errors.update(verifyStringEmpty('passwd', self.passwd, True)) #print self.get_org(self.org_name) errors.update(verifyStringEmpty('role', self.role, True)) errors.update(verifyStringEmpty('address', self.address, True)) errors.update(verifyStringEmpty('primary_mobile', self.primary_mobile, True)) errors.update(verifyStringEmpty('primary_landline', self.primary_landline, True)) errors.update(get_email('primary_email', self.primary_email, True)) errors.update(verifyStringEmpty('status', self.status, False)) # errors.update(utils.verifyStringEmpty('org_type', self.org_type, False)) errors.update(verifyStringEmpty('middle_name', self.middle_name, False)) errors.update(verifyStringEmpty('notes', self.notes, False)) errors.update(verifyStringEmpty('secondary_mobile', self.secondary_mobile, False)) errors.update(verifyStringEmpty('secondary_landline', self.secondary_landline, False)) errors.update(get_email('secondary_email', self.secondary_email, False)) return errors class Meta: verbose_name = "User profile" verbose_name_plural = "User profiles" This is my profile.py file from django import forms from models import Profile from demo.models import Organization #import strings from registration.forms import RegistrationForm class UserRegistrationForm(RegistrationForm): first_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the First name"},required = True) middle_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the middle name"},required = True) last_name = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the last name"},required = True) password1 = forms.CharField(label="Password", widget=forms.PasswordInput) password2 = forms.CharField(label="Password confirmation", widget=forms.PasswordInput, help_text = "Enter the same password as above, for verification.") # primary_email = forms.EmailField(label="Email", max_length=75) secondary_email = forms.EmailField(label="secondary email", max_length=75) city = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasscity'}),error_messages={'required':"please enter the city name"},required = True) state = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclassst'}),error_messages={'required':"please enter a state name"},required = True) country = forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasscountry'}),error_messages={'required':"please enter a country name"},required = True) street = forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclassstreet'}),error_messages={'required':"please enter a street name"},required = True) pin = forms.CharField(max_length=30,widget=forms.TextInput(attrs={'class' : 'myfieldclasspin'}),error_messages={'required':"please enter a pin name"},required = True) primary_mobile =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasspm'}),error_messages={'required':"work phone is required"},required = True) secondary_mobile =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasssm'}),error_messages={'required':"home phone is required"},required = False) primary_landline =forms.CharField(max_length=100,widget=forms.TextInput(attrs={'class' : 'myfieldclasspl'}),error_messages={'required':"work phone number is required"},required = True) secondary_landline =forms.CharField(max_length=100,error_messages={'required':"home phone is required"},required = False) org_name = forms.ModelChoiceField(queryset=Organization.objects, label='Organization') Here is regbackend.py file where i am saving all customized fields import profile from django.http import HttpResponseRedirect, HttpResponse, Http404 from django.contrib import messages from demo.models import Organization def user_created(sender, user, request, **kwargs): form = profile.UserRegistrationForm(request.POST) data = profile.Profile(user_name=user) try:get_id = form.data['org_name'] except:get_id = False get_org = Organization.objects.get(id = get_id) data.org_name = get_org data.primary_email = user.email data.first_name = form.data['first_name'] try:data.middle_name = form.data['middle_name'] except:data.middle_name = '' data.last_name = form.data['last_name'] data.city = form.data['city'] data.street = form.data['street'] data.state = form.data['state'] data.country = form.data['country'] data.primary_mobile = form.data['primary_mobile'] try:data.secondary_mobile = form.data['secondary_mobile'] except:data.secondary_mobile = '' data.primary_landline = form.data['primary_landline'] try:data.secondary_landline = form.data['secondary_landline'] except:data.secondary_landline = '' try:data.secondary_email = form.data['secondary_email'] except:data.secondary_email = '' data.passworwd = user.password data.save() print "---------------------" print request messages.success(request, 'Thank you!') from registration.signals import user_registered user_registered.connect(user_created) I have very few things in my views from django.contrib.auth.decorators import login_required from django.template import RequestContext from django.shortcuts import render_to_response from django.contrib.auth.views import logout_then_login from django.contrib.auth.models import User from django.shortcuts import render_to_response, get_object_or_404 from django.http import HttpResponseRedirect, HttpResponse, Http404 from accounts.forms import UserCreationForm from django.contrib.auth.tokens import default_token_generator from django.core.urlresolvers import reverse from django.template import RequestContext from django.conf import settings from django.utils.http import urlquote, base36_to_int from django.contrib.sites.models import Site from accounts.forms import UserCreationForm from django.core.urlresolvers import reverse def logout_page(request): logout_then_login(request) def index(request): return HttpResponseRedirect(reverse("registration_register")) and last but not least urls.py from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: # from django.contrib import admin # admin.autodiscover() from django.contrib import admin admin.autodiscover() from django.conf.urls.defaults import * from django.views.generic.simple import direct_to_template import registration.backends.default.urls as regUrls from profile import UserRegistrationForm from registration.views import register import regbackend, views from accounts import profile urlpatterns = patterns('', # (r'^conf/admin/(.*)', admin.site.root), url(r'^register/$', register, {'backend': 'registration.backends.default.DefaultBackend','form_class': UserRegistrationForm}, name='registration_register'), (r'^accounts/', include(regUrls)), url('^profile/$', direct_to_template, {'template': 'profile.html'}, name="profile"), (r'^$', views.index), ) I am able to save the custom fields as well as django defaults field but problem start when i am trying to redirect the url @ /accounts/profile/ after saving the custom fields (registration).I used HttpresponseRedirect() method after data.save() in regbackend.py but it is not working please help me out how can i redirect the url to user profile . I have not much idea about Signal .
0
11,734,542
07/31/2012 06:45:08
753,341
05/14/2011 05:48:17
3,824
112
Font rendering Bug in SDL .NET? Or just my damn code?
/// <summary> /// Simple UI TextBox Class. For displaying messages in 2D Games /// </summary> class TextBox { /// <summary> /// Constructor. /// </summary> /// <param name="Text"> The text of the TextBox</param> public TextBox(string Text = "", int w = 400, int h = 200) { this.Text = Text; textNext = string.Empty; try { Surface = new Surface(w, h); } catch (NullReferenceException e) { MessageBox.Show(e.Message); Events.QuitApplication(); } Offset = new System.Drawing.Point(30, 30); FontColor = System.Drawing.Color.White; BackColor = System.Drawing.Color.Black; Surface.Fill(BackColor); try { Font = new Font(@"data\font\AllerDisplay.ttf", 16); } catch (NullReferenceException e) { MessageBox.Show(e.Message); Events.QuitApplication(); } Visible = true; MaxLines = 6; AcceptKey = Key.Return; } /// <summary> /// Locks and wraps up the text box. /// Text, Size and Font changes take effect /// </summary> public void Lock() { Surface.Fill(BackColor); // clear the surface DrawText(); // draw the text } public void Update() { if (Keyboard.IsKeyPressed(AcceptKey)) { if (!String.IsNullOrEmpty(textNext)) { Text = textNext; textNext = string.Empty; Lock(); } else { Visible = false; } } } /// <summary> /// Wraps up and renders the text /// </summary> private void DrawText() { var x = 0; var y = 0; Console.WriteLine(Text.Length); // increment the size of each character for (var i = 0; i < Text.Length; i++) { x += Font.SizeText(Text[i].ToString()).Width; // if it exceeds the width of the box if (x > Surface.Width - Offset.X * 2) { Text = Text.Insert(i, "-\n"); x = 0; y++; } // if the lines exceed the limit if (y > MaxLines) { // save the remaining lines for the next run var index = Text.LastIndexOf("-\n"); textNext = Text.Substring(index); Text = Text.Substring(0, index); break; } } Console.WriteLine(Text); // render the string and blit it onto Surface var surf = Font.Render(Text, FontColor); Surface.Blit(surf, Offset); } /// <summary> /// The remaining text which is to be displayed /// on the next run of the text box /// </summary> string textNext; /// <summary> /// The text of the text box /// </summary> public string Text { get; set; } /// <summary> /// The background surface of the text box /// </summary> public Surface Surface { get; set; } /// <summary> /// Maximum number of lines per text piece /// </summary> public int MaxLines { get; set; } // More irrelevant code... } Now the `DrawText()` method basically does a word wrap on the text. If the text is too big to be displayed in a single box part of it is stored and displayed in a re-run. Now the problem is, the second time I call Font.Render, I get vertically displayed text for some reason. For example: textBox = new TextBox( @"Please note that this Tutorial is not for the absolute beginner. I assume that you already can code fluent in C# and that you are able to understand code when reading them. I will not explain every single line of code when it should be clear what it's doing. Also please note that i am not a native speaker, so there are for sure many grammatical errors in this text (which are maybe corrected in the future when i find them ;-)"); textBox.Lock(); Now the output I get is: ![Output 1][1] ![Output 2][2] So why exactly is the second part of the text displayed vertically? I tried checking if my word wrap function worked properly, perhaps the vertical orientation was caused by '\n' inserts. However, it was working perfectly. It only added an '\n' at the right place. So there's probably some problem with the font rendering. [1]: http://i.stack.imgur.com/2tDRW.png [2]: http://i.stack.imgur.com/lrKNx.png
c#
sdl
game-engine
system.drawing
game-physics
null
open
Font rendering Bug in SDL .NET? Or just my damn code? === /// <summary> /// Simple UI TextBox Class. For displaying messages in 2D Games /// </summary> class TextBox { /// <summary> /// Constructor. /// </summary> /// <param name="Text"> The text of the TextBox</param> public TextBox(string Text = "", int w = 400, int h = 200) { this.Text = Text; textNext = string.Empty; try { Surface = new Surface(w, h); } catch (NullReferenceException e) { MessageBox.Show(e.Message); Events.QuitApplication(); } Offset = new System.Drawing.Point(30, 30); FontColor = System.Drawing.Color.White; BackColor = System.Drawing.Color.Black; Surface.Fill(BackColor); try { Font = new Font(@"data\font\AllerDisplay.ttf", 16); } catch (NullReferenceException e) { MessageBox.Show(e.Message); Events.QuitApplication(); } Visible = true; MaxLines = 6; AcceptKey = Key.Return; } /// <summary> /// Locks and wraps up the text box. /// Text, Size and Font changes take effect /// </summary> public void Lock() { Surface.Fill(BackColor); // clear the surface DrawText(); // draw the text } public void Update() { if (Keyboard.IsKeyPressed(AcceptKey)) { if (!String.IsNullOrEmpty(textNext)) { Text = textNext; textNext = string.Empty; Lock(); } else { Visible = false; } } } /// <summary> /// Wraps up and renders the text /// </summary> private void DrawText() { var x = 0; var y = 0; Console.WriteLine(Text.Length); // increment the size of each character for (var i = 0; i < Text.Length; i++) { x += Font.SizeText(Text[i].ToString()).Width; // if it exceeds the width of the box if (x > Surface.Width - Offset.X * 2) { Text = Text.Insert(i, "-\n"); x = 0; y++; } // if the lines exceed the limit if (y > MaxLines) { // save the remaining lines for the next run var index = Text.LastIndexOf("-\n"); textNext = Text.Substring(index); Text = Text.Substring(0, index); break; } } Console.WriteLine(Text); // render the string and blit it onto Surface var surf = Font.Render(Text, FontColor); Surface.Blit(surf, Offset); } /// <summary> /// The remaining text which is to be displayed /// on the next run of the text box /// </summary> string textNext; /// <summary> /// The text of the text box /// </summary> public string Text { get; set; } /// <summary> /// The background surface of the text box /// </summary> public Surface Surface { get; set; } /// <summary> /// Maximum number of lines per text piece /// </summary> public int MaxLines { get; set; } // More irrelevant code... } Now the `DrawText()` method basically does a word wrap on the text. If the text is too big to be displayed in a single box part of it is stored and displayed in a re-run. Now the problem is, the second time I call Font.Render, I get vertically displayed text for some reason. For example: textBox = new TextBox( @"Please note that this Tutorial is not for the absolute beginner. I assume that you already can code fluent in C# and that you are able to understand code when reading them. I will not explain every single line of code when it should be clear what it's doing. Also please note that i am not a native speaker, so there are for sure many grammatical errors in this text (which are maybe corrected in the future when i find them ;-)"); textBox.Lock(); Now the output I get is: ![Output 1][1] ![Output 2][2] So why exactly is the second part of the text displayed vertically? I tried checking if my word wrap function worked properly, perhaps the vertical orientation was caused by '\n' inserts. However, it was working perfectly. It only added an '\n' at the right place. So there's probably some problem with the font rendering. [1]: http://i.stack.imgur.com/2tDRW.png [2]: http://i.stack.imgur.com/lrKNx.png
0
11,734,543
07/31/2012 06:45:07
399,107
07/22/2010 13:20:00
126
0
How to list children of a project in a pom.xml?
I know it is possible to define a parent for a project in the pom.xml but can I explicitly define the children of a project in maven 2?
xml
maven-2
build
parent-child
pom.xml
null
open
How to list children of a project in a pom.xml? === I know it is possible to define a parent for a project in the pom.xml but can I explicitly define the children of a project in maven 2?
0
11,734,545
07/31/2012 06:45:11
786,691
06/07/2011 00:13:10
13
2
Get Document from Node or Element objects with minidom
Is there a way I can get the document root from a child Element or Node. I am migrating from a library that works with any of Document, Element or Node to one that works only with Document. eg. From :- element.xpath('/a/b/c') # 4Suite to :- xpath.find('/a/b/c', doc) # pydomxpath Thanks, Himanshu
python
xml
minidom
null
null
null
open
Get Document from Node or Element objects with minidom === Is there a way I can get the document root from a child Element or Node. I am migrating from a library that works with any of Document, Element or Node to one that works only with Document. eg. From :- element.xpath('/a/b/c') # 4Suite to :- xpath.find('/a/b/c', doc) # pydomxpath Thanks, Himanshu
0
11,734,549
07/31/2012 06:45:17
253,617
01/19/2010 00:24:20
621
30
jquery ensuring that mouseup is fired
I have an app that uses mouseup and down to draw elements. The problem is that if for any reason the mouseup event is not fired after mousedown ( let's say I introduce an escape key that cancels drawing the new element), the element would be "incomplete", and hence it would cause problem. So I want to know if there is any mechanism that I can use inside mousedown to ensure that mouseup is fired after it, and if not, destroy the new element ?
javascript
jquery
mouseup
null
null
null
open
jquery ensuring that mouseup is fired === I have an app that uses mouseup and down to draw elements. The problem is that if for any reason the mouseup event is not fired after mousedown ( let's say I introduce an escape key that cancels drawing the new element), the element would be "incomplete", and hence it would cause problem. So I want to know if there is any mechanism that I can use inside mousedown to ensure that mouseup is fired after it, and if not, destroy the new element ?
0
11,734,551
07/31/2012 06:45:29
438,180
09/02/2010 16:33:48
2,026
73
Wix: show custom dialog if previous version found
I want to customize my installer to show custom dialog when previous version is already installed: after Welcome dialog user should see a custom dialog `OldVersionDlg` with information that previous version was found and will be uninstalled automatically. But for some reason property set by `UpgradeVersion` element always `null` when I check it in condition in `UI/Publish Dialog`. Here are essential code snippets. **Product.wxs**: <Product Id="*" Version="$(var.Version)" UpgradeCode="$(var.ProductId)" Language="1033" Name="$(var.ProductFullName)" Manufacturer="$(var.Manufacturer)"> <Package Description="$(var.ProductDescription)" InstallerVersion="200" Compressed="yes" Manufacturer="$(var.Manufacturer)" /> <UIRef Id="WixUI_M" /> <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" /> <Upgrade Id="$(var.ProductId)"> <UpgradeVersion Minimum="1.0.0.0" Maximum="$(var.Version)" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" /> </Upgrade> <InstallExecuteSequence> <RemoveExistingProducts Before="InstallInitialize" /> </InstallExecuteSequence> </Product> **WixUI_Wizard.wxs**: <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish> The button Next doesn't work. I've checked in logs that `PREVIOUSVERSIONSINSTALLED` is set after `FindRelatedProducts`. If I use it in conditions in **Product.wxs** then everything is OK. But in UI configuration it is always `null`. Thanks for any help.
wix
wix3.5
null
null
null
null
open
Wix: show custom dialog if previous version found === I want to customize my installer to show custom dialog when previous version is already installed: after Welcome dialog user should see a custom dialog `OldVersionDlg` with information that previous version was found and will be uninstalled automatically. But for some reason property set by `UpgradeVersion` element always `null` when I check it in condition in `UI/Publish Dialog`. Here are essential code snippets. **Product.wxs**: <Product Id="*" Version="$(var.Version)" UpgradeCode="$(var.ProductId)" Language="1033" Name="$(var.ProductFullName)" Manufacturer="$(var.Manufacturer)"> <Package Description="$(var.ProductDescription)" InstallerVersion="200" Compressed="yes" Manufacturer="$(var.Manufacturer)" /> <UIRef Id="WixUI_M" /> <Property Id="PREVIOUSVERSIONSINSTALLED" Secure="yes" /> <Upgrade Id="$(var.ProductId)"> <UpgradeVersion Minimum="1.0.0.0" Maximum="$(var.Version)" Property="PREVIOUSVERSIONSINSTALLED" IncludeMinimum="yes" IncludeMaximum="no" /> </Upgrade> <InstallExecuteSequence> <RemoveExistingProducts Before="InstallInitialize" /> </InstallExecuteSequence> </Product> **WixUI_Wizard.wxs**: <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="OldVersionDlg">PREVIOUSVERSIONSINSTALLED</Publish> The button Next doesn't work. I've checked in logs that `PREVIOUSVERSIONSINSTALLED` is set after `FindRelatedProducts`. If I use it in conditions in **Product.wxs** then everything is OK. But in UI configuration it is always `null`. Thanks for any help.
0
11,734,553
07/31/2012 06:45:31
1,336,291
04/16/2012 12:27:49
59
0
How are GDI objects selected and destroyed by SelectObject function
As I am new to Visual C++, this might be a very basic question related to selecting a GDI object. The following code snippet draws a light grey circle with no border. cPen pen(PS_NULL, 0, (RGB(0,0,0))); dc.SelectObject(& pen); CBrush brush (RGB (192,192,192)); dc.SelectObject (&brush); dc.Ellipse(0,0, 100,100); All I understand from the code snippet is first an Object of Pen is created, and its a NULL Pen which would make the border disappear, the brush then creates a Circle of grey color, but how does `dc` use pen if it is already using brush? this is a bit confusing. How does using `dc.SelectObject()` twice help? If the solid brush object is used to create a circle with grey color, how does creating pen object help, if it is anyway destroyed as brush object is created? how exactly does this thing work?
winapi
visual-c++
mfc
gdi
null
null
open
How are GDI objects selected and destroyed by SelectObject function === As I am new to Visual C++, this might be a very basic question related to selecting a GDI object. The following code snippet draws a light grey circle with no border. cPen pen(PS_NULL, 0, (RGB(0,0,0))); dc.SelectObject(& pen); CBrush brush (RGB (192,192,192)); dc.SelectObject (&brush); dc.Ellipse(0,0, 100,100); All I understand from the code snippet is first an Object of Pen is created, and its a NULL Pen which would make the border disappear, the brush then creates a Circle of grey color, but how does `dc` use pen if it is already using brush? this is a bit confusing. How does using `dc.SelectObject()` twice help? If the solid brush object is used to create a circle with grey color, how does creating pen object help, if it is anyway destroyed as brush object is created? how exactly does this thing work?
0
11,734,554
07/31/2012 06:45:43
498,727
11/05/2010 19:41:55
232
0
Getting doc tag names while iterating the elements
i have this XML document: <?xml version="1.0" encoding="UTF-16"?> <root> <items> <item1> <tag1>1</tag1> <tag2>2</tag2> <tag3>3</tag3> </item1> <item2> <tag1>4</tag1> <tag2>5</tag2> <tag3>6</tag3> </item2> </items> </root> I want to iterate the item elements (item1, item2...), and for each tag get the **tag name** and after that the **value of the tag**. I am using DOM parser. Any ideas?
java
dom
null
null
null
null
open
Getting doc tag names while iterating the elements === i have this XML document: <?xml version="1.0" encoding="UTF-16"?> <root> <items> <item1> <tag1>1</tag1> <tag2>2</tag2> <tag3>3</tag3> </item1> <item2> <tag1>4</tag1> <tag2>5</tag2> <tag3>6</tag3> </item2> </items> </root> I want to iterate the item elements (item1, item2...), and for each tag get the **tag name** and after that the **value of the tag**. I am using DOM parser. Any ideas?
0
11,734,555
07/31/2012 06:45:44
123,072
06/15/2009 12:05:34
319
10
Processing effective way of converting arrays from type T1 to type T2
I had a real scenario 5 minutes ago where I needed to turn a Guid[] into an object[]. The dead simple and quick way out of this is to type: var dataset = inputArray.Select(item => (object)item).ToArray(); Readable and everything, but I'm not sure it is very effective (could of course be the case that the compiler optimizes it a bit). What would you suggest is best to go from type to type (assuming it is castable between, skipping integer parsing and the like).
c#
.net
null
null
null
null
open
Processing effective way of converting arrays from type T1 to type T2 === I had a real scenario 5 minutes ago where I needed to turn a Guid[] into an object[]. The dead simple and quick way out of this is to type: var dataset = inputArray.Select(item => (object)item).ToArray(); Readable and everything, but I'm not sure it is very effective (could of course be the case that the compiler optimizes it a bit). What would you suggest is best to go from type to type (assuming it is castable between, skipping integer parsing and the like).
0
11,734,561
07/31/2012 06:45:55
1,502,955
07/05/2012 04:59:02
1
0
Hi, How to view database resultset in java swing.
How to view database resultset in java swing. my options are 1.jeditorpane 2.jtable. After view that file i want to save the file either in .rtf or .pdf. how is this possible in java desktop apps. **Note:**Do not use third party API or libraries
java
mysql
swing
application
desktop
null
open
Hi, How to view database resultset in java swing. === How to view database resultset in java swing. my options are 1.jeditorpane 2.jtable. After view that file i want to save the file either in .rtf or .pdf. how is this possible in java desktop apps. **Note:**Do not use third party API or libraries
0
11,734,562
07/31/2012 06:45:57
1,534,027
07/18/2012 07:56:08
13
0
how to save image and text on canvas
i have made a canvas and draw an image on canvas i can easily move the image from the mouse pointer. i have also draw some text on canvas. but i want that my text should be printed on image so when i move the image from one point to another point text should also be moved. so i can save the image with text. here is my code: @Override protected Void onDraw(Canvas canvas) { Bitmap b = BitmapFactory.decodeResource(getResources(),R.drawable.ic); canvas.drawBitmap(b,10,10,null); canvas,drawText("hello this is my image",10,10,null); }
android
null
null
null
null
null
open
how to save image and text on canvas === i have made a canvas and draw an image on canvas i can easily move the image from the mouse pointer. i have also draw some text on canvas. but i want that my text should be printed on image so when i move the image from one point to another point text should also be moved. so i can save the image with text. here is my code: @Override protected Void onDraw(Canvas canvas) { Bitmap b = BitmapFactory.decodeResource(getResources(),R.drawable.ic); canvas.drawBitmap(b,10,10,null); canvas,drawText("hello this is my image",10,10,null); }
0
11,650,892
07/25/2012 13:31:19
1,419,064
05/26/2012 13:35:34
57
1
array_unique for multidimentional arrays
In case of one-dim array I can use `array_unique` to get unique entries. But which function should be used to work with two-dim arrays? For instance: Array[0][0] = '123'; Array[0][1] = 'aaa'; Array[1][0] = '124'; Array[1][1] = 'aaa'; Array[2][0] = '124'; Array[2][1] = 'aaa'; In the above example I need to delete non-unique rows based on column 0. As a result I should get first two entries, while the third entry should be deleted. How to do this?
php
arrays
null
null
null
null
open
array_unique for multidimentional arrays === In case of one-dim array I can use `array_unique` to get unique entries. But which function should be used to work with two-dim arrays? For instance: Array[0][0] = '123'; Array[0][1] = 'aaa'; Array[1][0] = '124'; Array[1][1] = 'aaa'; Array[2][0] = '124'; Array[2][1] = 'aaa'; In the above example I need to delete non-unique rows based on column 0. As a result I should get first two entries, while the third entry should be deleted. How to do this?
0
11,650,894
07/25/2012 13:31:26
1,551,715
07/25/2012 13:08:35
1
0
successful compile but not getting NoClassDefFound error
I am a pharmaceutical sciences student who is picking up coding as I go, so I apologize if the answer to this question has escaped me. I wrote some java source code in NetBeans AND Eclipse. The code runs fine in both IDEs, however when I moved all the .java files to a UNIX environment I was successful at compiling the code, but the command line tells me it can't find a class that is located in the same jar that I compiled with. I got warnings on compilations but I thought this would not affect the running of the code. I have searched and searched and can't seem to find an answer. Here is my command line code (there are names of my programs, etc.): [jknights@u2:~]$ cd chorus_jk [jknights@u2:~/chorus_jk]$ ls Chorus_JK.java EntropyNormal_JK.java Main_JK.java colt.jar EstimateParzen_JK.java RA_reformatted_forCHORUS_JK.txt Combination_JK.java LIST_JK.java [jknights@u2:~/chorus_jk]$ javac -cp colt.jar ./*.java -Xlint:unchecked . . (I edited out the 100 warnings as they refer to unchecked items) . 100 warnings [jknights@u2:~/chorus_jk]$ jar cfe ChorusJK_RA.jar Main_JK ./*.class [jknights@u2:~/chorus_jk]$ java -jar ChorusJK_RA.jar 89 317504 Exception in thread "main" java.lang.NoClassDefFoundError: cern/colt/matrix/DoubleMatrix2D at Chorus_JK.init(Chorus_JK.java:24) at Main_JK.main(Main_JK.java:23) Caused by: java.lang.ClassNotFoundException: cern.colt.matrix.DoubleMatrix2D at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) ... 2 more the "89" and "317504" are summary outputs for the file that is read in so it appears that the compile was successful; however, when the program gets to the calculation part, it gives me the Exception in thread "main" java.lang.NoClassDefFoundError: cern/colt/matrix/DoubleMatrix2D error. Thanks so much for any help!
java
null
null
null
null
null
open
successful compile but not getting NoClassDefFound error === I am a pharmaceutical sciences student who is picking up coding as I go, so I apologize if the answer to this question has escaped me. I wrote some java source code in NetBeans AND Eclipse. The code runs fine in both IDEs, however when I moved all the .java files to a UNIX environment I was successful at compiling the code, but the command line tells me it can't find a class that is located in the same jar that I compiled with. I got warnings on compilations but I thought this would not affect the running of the code. I have searched and searched and can't seem to find an answer. Here is my command line code (there are names of my programs, etc.): [jknights@u2:~]$ cd chorus_jk [jknights@u2:~/chorus_jk]$ ls Chorus_JK.java EntropyNormal_JK.java Main_JK.java colt.jar EstimateParzen_JK.java RA_reformatted_forCHORUS_JK.txt Combination_JK.java LIST_JK.java [jknights@u2:~/chorus_jk]$ javac -cp colt.jar ./*.java -Xlint:unchecked . . (I edited out the 100 warnings as they refer to unchecked items) . 100 warnings [jknights@u2:~/chorus_jk]$ jar cfe ChorusJK_RA.jar Main_JK ./*.class [jknights@u2:~/chorus_jk]$ java -jar ChorusJK_RA.jar 89 317504 Exception in thread "main" java.lang.NoClassDefFoundError: cern/colt/matrix/DoubleMatrix2D at Chorus_JK.init(Chorus_JK.java:24) at Main_JK.main(Main_JK.java:23) Caused by: java.lang.ClassNotFoundException: cern.colt.matrix.DoubleMatrix2D at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) ... 2 more the "89" and "317504" are summary outputs for the file that is read in so it appears that the compile was successful; however, when the program gets to the calculation part, it gives me the Exception in thread "main" java.lang.NoClassDefFoundError: cern/colt/matrix/DoubleMatrix2D error. Thanks so much for any help!
0
11,650,895
07/25/2012 13:31:27
1,548,258
07/24/2012 09:48:05
1
0
C# Web Browser with click and highlight of Frame/iFrame elements
Iam looking for a browser control where users can preview frame/iframe in web page and then highlight elements of it and once highlighted, I can get the div or id of the element selected. Is there any way we can do it ?
c#
web-scraping
null
null
null
null
open
C# Web Browser with click and highlight of Frame/iFrame elements === Iam looking for a browser control where users can preview frame/iframe in web page and then highlight elements of it and once highlighted, I can get the div or id of the element selected. Is there any way we can do it ?
0
11,650,896
07/25/2012 13:31:35
935,071
09/08/2011 14:47:12
119
8
Parsing data into database from XML document
I currently have this method in a standard web service: [WebMethod] public void addGame(int GamePlayID, int @ParticipantID, int @GameVersionID, string Start, string End,string success) { SqlConnection oConn = new SqlConnection(); oConn.ConnectionString = @"Data Source=SNICKERS\SQLEXPRESS;Initial Catalog=VerveDatabase;Integrated Security=True"; oConn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = oConn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "addGamePlay"; cmd.Parameters.Add(new SqlParameter("@GamePlayID", SqlDbType.Int)); cmd.Parameters["@GamePlayID"].Value = GamePlayID; cmd.Parameters.Add(new SqlParameter("@ParticipantID", SqlDbType.Int)); cmd.Parameters["@ParticipantID"].Value = @ParticipantID; cmd.Parameters.Add(new SqlParameter("@GameVersionID", SqlDbType.Int)); cmd.Parameters["@GameVersionID"].Value = @GameVersionID; cmd.Parameters.Add(new SqlParameter("@Start", SqlDbType.Time)); cmd.Parameters["@Start"].Value = Start; cmd.Parameters.Add(new SqlParameter("@End", SqlDbType.Time)); cmd.Parameters["@End"].Value = End; cmd.Parameters.Add(new SqlParameter("@success", SqlDbType.VarChar, 10)); cmd.Parameters["@success"].Value = success; cmd.ExecuteNonQuery(); } This allows me to pass values accross to the database which are entered manually.However I want to be able to load the data from an XML document. How do I get data from this XML document to fill the variables in this method. Here is the XML document: <?xml version="1.0" encoding="UTF-8"?> <anyType xmlns="http://tempuri.org/" xmlns:d1p1="http://www.w3.org/2001/XMLSchema-instance" d1p1:type="q1:string" xmlns:q1="http://www.w3.org/2001/XMLSchema"> <NewDataSet> <Game> <GamePlayID>1</GamePlayID> <ParticipantID>1</ParticipantID> <GameVersionID>1</GameVersionID> <Start-Time>PT0S</Start-Time> <End-Time>PT5H</End-Time> <Success>true </Success> </Game> </NewDataSet> </anyType>
c#
asp.net
sql
xml
parsing
07/26/2012 08:46:43
not a real question
Parsing data into database from XML document === I currently have this method in a standard web service: [WebMethod] public void addGame(int GamePlayID, int @ParticipantID, int @GameVersionID, string Start, string End,string success) { SqlConnection oConn = new SqlConnection(); oConn.ConnectionString = @"Data Source=SNICKERS\SQLEXPRESS;Initial Catalog=VerveDatabase;Integrated Security=True"; oConn.Open(); SqlCommand cmd = new SqlCommand(); cmd.Connection = oConn; cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "addGamePlay"; cmd.Parameters.Add(new SqlParameter("@GamePlayID", SqlDbType.Int)); cmd.Parameters["@GamePlayID"].Value = GamePlayID; cmd.Parameters.Add(new SqlParameter("@ParticipantID", SqlDbType.Int)); cmd.Parameters["@ParticipantID"].Value = @ParticipantID; cmd.Parameters.Add(new SqlParameter("@GameVersionID", SqlDbType.Int)); cmd.Parameters["@GameVersionID"].Value = @GameVersionID; cmd.Parameters.Add(new SqlParameter("@Start", SqlDbType.Time)); cmd.Parameters["@Start"].Value = Start; cmd.Parameters.Add(new SqlParameter("@End", SqlDbType.Time)); cmd.Parameters["@End"].Value = End; cmd.Parameters.Add(new SqlParameter("@success", SqlDbType.VarChar, 10)); cmd.Parameters["@success"].Value = success; cmd.ExecuteNonQuery(); } This allows me to pass values accross to the database which are entered manually.However I want to be able to load the data from an XML document. How do I get data from this XML document to fill the variables in this method. Here is the XML document: <?xml version="1.0" encoding="UTF-8"?> <anyType xmlns="http://tempuri.org/" xmlns:d1p1="http://www.w3.org/2001/XMLSchema-instance" d1p1:type="q1:string" xmlns:q1="http://www.w3.org/2001/XMLSchema"> <NewDataSet> <Game> <GamePlayID>1</GamePlayID> <ParticipantID>1</ParticipantID> <GameVersionID>1</GameVersionID> <Start-Time>PT0S</Start-Time> <End-Time>PT5H</End-Time> <Success>true </Success> </Game> </NewDataSet> </anyType>
1
11,650,897
07/25/2012 13:31:42
835,585
07/08/2011 14:51:33
353
6
Set background color of an element when touch - android
Inside my `CustomAdapter` for a list, I want to change the background color of a row in my list when the user presses one of the rows. I have a static class which contains the object in each row of the list: static class ViewHolder { ImageView image; TextView text; } The holder contains the elements inside my list: holder = new ViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.imageView1); holder.text = (TextView) convertView.findViewById(R.id.textView1); convertView.setTag(holder); holder.image.setImageResource(items.get(position).getImage()); holder.text.setText(items.get(position).getTextToView()); To this convertView I added a `setOnTouchListener` this way: convertView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: //Toast.makeText(c, "DOWN", Toast.LENGTH_SHORT).show(); break; case MotionEvent.ACTION_UP: //Toast.makeText(c, "UP", Toast.LENGTH_SHORT).show(); break; } return false; } }); I tried this: convertView.setBackgroundColor(Color.RED); but my complier complaints, saying that the `convertView` should be `final` and that interfers with some other code. This works perfectly to raise a `Toast` when the user presses a row in my list. But how can I change the background color of the row that is pressed? Thanks in advance.
android
null
null
null
null
null
open
Set background color of an element when touch - android === Inside my `CustomAdapter` for a list, I want to change the background color of a row in my list when the user presses one of the rows. I have a static class which contains the object in each row of the list: static class ViewHolder { ImageView image; TextView text; } The holder contains the elements inside my list: holder = new ViewHolder(); holder.image = (ImageView) convertView.findViewById(R.id.imageView1); holder.text = (TextView) convertView.findViewById(R.id.textView1); convertView.setTag(holder); holder.image.setImageResource(items.get(position).getImage()); holder.text.setText(items.get(position).getTextToView()); To this convertView I added a `setOnTouchListener` this way: convertView.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { switch(event.getAction()) { case MotionEvent.ACTION_DOWN: //Toast.makeText(c, "DOWN", Toast.LENGTH_SHORT).show(); break; case MotionEvent.ACTION_UP: //Toast.makeText(c, "UP", Toast.LENGTH_SHORT).show(); break; } return false; } }); I tried this: convertView.setBackgroundColor(Color.RED); but my complier complaints, saying that the `convertView` should be `final` and that interfers with some other code. This works perfectly to raise a `Toast` when the user presses a row in my list. But how can I change the background color of the row that is pressed? Thanks in advance.
0
11,650,900
07/25/2012 13:31:56
1,356,645
04/25/2012 15:36:03
1
0
Which approach is better in using buttons in a program?
#**Task:** make buttons in a program that respond with mouse events(motion,press,release) ###***Approach [1] :*** Button class have a method that handle events. So it check if the the event is press or release or motion and call the right method, then i take every handle for each button created and loop it as long as the programe is running. ###***Approach [2] :*** I already have a Mouse class handling all mouse inputs. So the second approach would work on mouse motion. I mean I wont be looping a handler all the time, but when a mouse motion is detected I check if the motion was on a button (this check will be performed in the Mouse class that handle mouse inputs). If it was on a button then execute that button method that correspond to the event type. So was wandering which approach would be better?!
sdl
null
null
null
null
null
open
Which approach is better in using buttons in a program? === #**Task:** make buttons in a program that respond with mouse events(motion,press,release) ###***Approach [1] :*** Button class have a method that handle events. So it check if the the event is press or release or motion and call the right method, then i take every handle for each button created and loop it as long as the programe is running. ###***Approach [2] :*** I already have a Mouse class handling all mouse inputs. So the second approach would work on mouse motion. I mean I wont be looping a handler all the time, but when a mouse motion is detected I check if the motion was on a button (this check will be performed in the Mouse class that handle mouse inputs). If it was on a button then execute that button method that correspond to the event type. So was wandering which approach would be better?!
0
11,650,690
07/25/2012 13:21:24
286,579
03/04/2010 20:02:57
733
1
Checking if particular node exists in Xml file using Xpath
I would like to check is <code>code = "ABC" </code> exists in my xml file using xPath.Can you please suggest me some methods for it? <metadata> <codes class = "class1"> <code code = "ABC"> <detail "blah blah"/> </code> </codes> <codes class = "class2"> <code code = "123"> <detail "blah blah"/> </code> </codes> </metadata>
java
xml
xpath
null
null
null
open
Checking if particular node exists in Xml file using Xpath === I would like to check is <code>code = "ABC" </code> exists in my xml file using xPath.Can you please suggest me some methods for it? <metadata> <codes class = "class1"> <code code = "ABC"> <detail "blah blah"/> </code> </codes> <codes class = "class2"> <code code = "123"> <detail "blah blah"/> </code> </codes> </metadata>
0
11,650,901
07/25/2012 13:31:56
809,901
06/22/2011 07:44:01
197
0
Setup NetBeans for Zend Framework2
I have been trying to find of how to setup my NetBeans for Zend Framework 2. I found loads of materials for previous versions of Zend Framework i.e Zend Framework 1... and so but not for Zend Framework 2. In case if somebody has a solution would be great if it can be shared. P.S There is no zf.bat file which is what normally the tutorials say to include path for zf.bat in netbeans. Any help would be appreciated! Thanks
netbeans
zend-framework2
null
null
null
null
open
Setup NetBeans for Zend Framework2 === I have been trying to find of how to setup my NetBeans for Zend Framework 2. I found loads of materials for previous versions of Zend Framework i.e Zend Framework 1... and so but not for Zend Framework 2. In case if somebody has a solution would be great if it can be shared. P.S There is no zf.bat file which is what normally the tutorials say to include path for zf.bat in netbeans. Any help would be appreciated! Thanks
0
11,650,902
07/25/2012 13:31:56
382,827
07/03/2010 19:42:24
546
21
Transfer helpers and utilities from one app to another
Recently I have been wandering in the Rails world (and enjoyed it so much). I have finished my first project in Rails, and I have created a bunch of helpers to work with dates, menus and etc. My question is, what is the best way to transfer these helpers (and some other files) from one project to another? Please, be patient if this sounds too simple, I am a beginner in this world!
ruby-on-rails
null
null
null
null
null
open
Transfer helpers and utilities from one app to another === Recently I have been wandering in the Rails world (and enjoyed it so much). I have finished my first project in Rails, and I have created a bunch of helpers to work with dates, menus and etc. My question is, what is the best way to transfer these helpers (and some other files) from one project to another? Please, be patient if this sounds too simple, I am a beginner in this world!
0
11,650,904
07/25/2012 13:32:03
1,114,316
12/24/2011 06:04:15
31
1
How to handle CFForm with multiple loop on submit
I have some questions regarding design. I have a form with a table in it. That table is driven with an outter cfoutput, which gives me the name of all the users as the first TD in the table. Then i have an inner loop with cfloop which gives me a list of all the projects for each user along with a on/off button. What i am trying to figure out is, how do i gather all the on and off buttons and update a database correctly for each user? here is the code: $ <cfform action="manage.cfm" method="post"> <table> <cfoutput query="get_user"> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;"><hr><h3>#get_user.user_firstname#&nbsp;#get_user.user_lastname#</h3><hr></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><cfinput type="hidden" name="#get_user.user_id#" value="#get_user.user_id#"></td> </tr> <cfloop query="get_project"> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;">#get_project.project_name#</td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><cfinput type="hidden" name="#get_project.project_id#" value="#get_project.project_id#"></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><img src="images/Button-Gray.png" id="#get_user.user_id#_#get_project.project_id#" alt="disabled" height="18" width="18" onClick="return toggle(this);"/></td> </tr> </cfloop> </cfoutput> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;"></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><hr><cfinput type="submit" name="submit" value="Update Access"></td> </tr> </table> </cfform> I thought i should use strictKeys and pass ?Action=Update&uid=user_id$pid=project_id, but i wasn't sure how i could gather the user and the associated on/off actions for each user. I also considered using field[], and creating an array for the users and projects for each user... i'm feeling stuck, and looking for help! Any guidance, direction would be most appreciated. Thanks!
cfform
cfoutput
null
null
null
null
open
How to handle CFForm with multiple loop on submit === I have some questions regarding design. I have a form with a table in it. That table is driven with an outter cfoutput, which gives me the name of all the users as the first TD in the table. Then i have an inner loop with cfloop which gives me a list of all the projects for each user along with a on/off button. What i am trying to figure out is, how do i gather all the on and off buttons and update a database correctly for each user? here is the code: $ <cfform action="manage.cfm" method="post"> <table> <cfoutput query="get_user"> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;"><hr><h3>#get_user.user_firstname#&nbsp;#get_user.user_lastname#</h3><hr></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><cfinput type="hidden" name="#get_user.user_id#" value="#get_user.user_id#"></td> </tr> <cfloop query="get_project"> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;">#get_project.project_name#</td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><cfinput type="hidden" name="#get_project.project_id#" value="#get_project.project_id#"></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><img src="images/Button-Gray.png" id="#get_user.user_id#_#get_project.project_id#" alt="disabled" height="18" width="18" onClick="return toggle(this);"/></td> </tr> </cfloop> </cfoutput> <tr> <td style="padding-right:10px; padding-left:10px; text-align:left;"></td> <td style="padding-right:10px; padding-left:10px; text-align:left;"><hr><cfinput type="submit" name="submit" value="Update Access"></td> </tr> </table> </cfform> I thought i should use strictKeys and pass ?Action=Update&uid=user_id$pid=project_id, but i wasn't sure how i could gather the user and the associated on/off actions for each user. I also considered using field[], and creating an array for the users and projects for each user... i'm feeling stuck, and looking for help! Any guidance, direction would be most appreciated. Thanks!
0
11,650,905
07/25/2012 13:32:04
427,545
08/22/2010 09:04:58
13,299
517
Is a variable declared in a loop body preserved during iterations?
Consider a for-loop in C which declares a character array in the loop's body. At each iteration, a character of array is modified until the end is reached. At the end, the variable is printed. The description would expand to the next code: #include <stdio.h> int main(void) { int i = 0; for (;;) {/* same as: while(1) { */ char x[5]; x[i] = '0' + i; if (++i == 4) { x[i] = '\0'; /* terminate string with null byte */ printf("%s\n", x); break; } } return 0; Many may expect `0123` as output. But for some reason GCC 4.7 does not do that when compiling with optimization enabled (`-O1` and higher). It instead puts random data in the first bytes of the character array, which becomes `{.., '3', '\0'}`. I think that this is logical behaviour from the language point of view: automatic variables are gone after a block is terminated, so the above "random" behaviour should be expected. What should be the correct behaviour? The real-world problem is a [bug in Netfilter][1]. [1]: http://bugzilla.netfilter.org/show_bug.cgi?id=774
c
loops
variable-scope
variable-declaration
null
null
open
Is a variable declared in a loop body preserved during iterations? === Consider a for-loop in C which declares a character array in the loop's body. At each iteration, a character of array is modified until the end is reached. At the end, the variable is printed. The description would expand to the next code: #include <stdio.h> int main(void) { int i = 0; for (;;) {/* same as: while(1) { */ char x[5]; x[i] = '0' + i; if (++i == 4) { x[i] = '\0'; /* terminate string with null byte */ printf("%s\n", x); break; } } return 0; Many may expect `0123` as output. But for some reason GCC 4.7 does not do that when compiling with optimization enabled (`-O1` and higher). It instead puts random data in the first bytes of the character array, which becomes `{.., '3', '\0'}`. I think that this is logical behaviour from the language point of view: automatic variables are gone after a block is terminated, so the above "random" behaviour should be expected. What should be the correct behaviour? The real-world problem is a [bug in Netfilter][1]. [1]: http://bugzilla.netfilter.org/show_bug.cgi?id=774
0
11,650,911
07/25/2012 13:32:18
1,551,746
07/25/2012 13:20:52
1
0
Multiple floating menus, limited range
I have worked on this problem for quite some time now, unfortunately without any success. I am trying to create a 3 column layout (25%/50%/25%) where both sidebars are functioning as menu holders. In the left side bar i've put a fixed menu in combination with some scrolling scripts, works fine. the content in the middle is decided in sections, in the right sidebar I'm trying to create a content specific submenu that scrolls along. The problem is that the submenu should scroll only to the bottom the content block. after the first content block there is a space of about 500px and the second content block starts with its own submenu also scrolling along. http://jsbin.com/ivuxuy/ Please find an example above. the perfect solution would be, submenu 1 stops scrolling at the bottom of content section 1, submenu 2 will start scrolling as soon as the user arrives at content section 2 etc. etc. Thank you, Laurens
jquery
html
css
floating
null
null
open
Multiple floating menus, limited range === I have worked on this problem for quite some time now, unfortunately without any success. I am trying to create a 3 column layout (25%/50%/25%) where both sidebars are functioning as menu holders. In the left side bar i've put a fixed menu in combination with some scrolling scripts, works fine. the content in the middle is decided in sections, in the right sidebar I'm trying to create a content specific submenu that scrolls along. The problem is that the submenu should scroll only to the bottom the content block. after the first content block there is a space of about 500px and the second content block starts with its own submenu also scrolling along. http://jsbin.com/ivuxuy/ Please find an example above. the perfect solution would be, submenu 1 stops scrolling at the bottom of content section 1, submenu 2 will start scrolling as soon as the user arrives at content section 2 etc. etc. Thank you, Laurens
0
11,410,771
07/10/2012 09:54:31
1,514,385
07/10/2012 09:52:23
1
0
CSS menu on two lines - Bug-Z index on IE7
On my menu, the first level menu is on two lines due to the large number of links present. My bug is that the submenu drops below the second line of the first level. On IE8, Firefox, Chrome I do not have this problem but on IE7 yes. Here is my code: http://jsfiddle.net/Fp2VV/ Thank you in advance for your help.
css
menu
internet-explorer-7
z-index
null
null
open
CSS menu on two lines - Bug-Z index on IE7 === On my menu, the first level menu is on two lines due to the large number of links present. My bug is that the submenu drops below the second line of the first level. On IE8, Firefox, Chrome I do not have this problem but on IE7 yes. Here is my code: http://jsfiddle.net/Fp2VV/ Thank you in advance for your help.
0
11,410,836
07/10/2012 09:58:38
1,514,354
07/10/2012 09:40:08
1
0
jQuery - Iterate through data stored object
I encounter something quite strange while trying to iterate properties of an object stored using jQuery data function. Here is the thing (as an example) : wrapper.data( 'infos', { label: $('input[name*="label"]').val(), amount: $('input[name*="amount"]').val(), etc.. }); Then i try to read values using : $.each( wrapper.data('infos'), function(k,v) { console.log(k + ' > ' + v); }); And i get a beautiful output like : 0 > undefined 1 > undefined ... 239 > undefined If i output this object as if, i can read properties without any difficulties. Is it somehow related to jquery caching or something ?
jquery
null
null
null
null
null
open
jQuery - Iterate through data stored object === I encounter something quite strange while trying to iterate properties of an object stored using jQuery data function. Here is the thing (as an example) : wrapper.data( 'infos', { label: $('input[name*="label"]').val(), amount: $('input[name*="amount"]').val(), etc.. }); Then i try to read values using : $.each( wrapper.data('infos'), function(k,v) { console.log(k + ' > ' + v); }); And i get a beautiful output like : 0 > undefined 1 > undefined ... 239 > undefined If i output this object as if, i can read properties without any difficulties. Is it somehow related to jquery caching or something ?
0
11,410,837
07/10/2012 09:58:44
1,514,359
07/10/2012 09:43:02
1
0
SOAP Client with drupal7 , dashed wsdl classes and attributes
I'm trying to create a SOAP Client able to make requests to a ws which definition contains dashed names. My steps so far: 1) Convert wsdl to php with wsdl2php tool 2) Create a client using SoapClient class 3) Make the request using the methods and attributes obtained from the wsdl2php result file I've tried this with various free ws in the net, everything worked fine, now i need to do it with a ws generated by Castor java tool, the problem is that some classes and their attributes auto-generated by Castor don't follow the Camel Case notation or the underscore notation. They have instead dashes between words, the question is, how can i get my SoapClient work if the dashes aren't allowed in php Classes? Is there any adaptation that can make it work? Example: class sport-list { public $sport-name; } Thank you so much
php
wsdl
drupal-7
soap-client
castor
null
open
SOAP Client with drupal7 , dashed wsdl classes and attributes === I'm trying to create a SOAP Client able to make requests to a ws which definition contains dashed names. My steps so far: 1) Convert wsdl to php with wsdl2php tool 2) Create a client using SoapClient class 3) Make the request using the methods and attributes obtained from the wsdl2php result file I've tried this with various free ws in the net, everything worked fine, now i need to do it with a ws generated by Castor java tool, the problem is that some classes and their attributes auto-generated by Castor don't follow the Camel Case notation or the underscore notation. They have instead dashes between words, the question is, how can i get my SoapClient work if the dashes aren't allowed in php Classes? Is there any adaptation that can make it work? Example: class sport-list { public $sport-name; } Thank you so much
0
11,410,839
07/10/2012 09:58:49
1,477,886
06/24/2012 09:44:48
41
0
How to make pagination with Javascript?
I'm developing a pagination for some site and I need to use Ajax for page changing, therefore I need to print links to "1", "2", "3" pages, with "`<a>`" tag. I understand that I need to add Javascript event handler for click by this link, but I needn't that user goes by link, I only need that "1","2","3" look like link. What should I do? Is there any way to make digits look like links? And how can I add Javascript event handler for click by link? Thank you in advance.
javascript
html
null
null
null
null
open
How to make pagination with Javascript? === I'm developing a pagination for some site and I need to use Ajax for page changing, therefore I need to print links to "1", "2", "3" pages, with "`<a>`" tag. I understand that I need to add Javascript event handler for click by this link, but I needn't that user goes by link, I only need that "1","2","3" look like link. What should I do? Is there any way to make digits look like links? And how can I add Javascript event handler for click by link? Thank you in advance.
0
11,410,849
07/10/2012 09:59:20
646,080
03/05/2011 14:39:59
43
0
Jquery setTimeout not working with jquery 1.7
Hi am using this script below which works when using with Jquery 1.4 but i need it to work with version 1.7.2 <script> setTimeout(function(){ if ($('#hpnews').length > 0) { $('#hpnews').fadeIn('slow'); } }, 3000); </script> dose any one now why its not ? and how to make it work thanks
jquery
settimeout
null
null
null
null
open
Jquery setTimeout not working with jquery 1.7 === Hi am using this script below which works when using with Jquery 1.4 but i need it to work with version 1.7.2 <script> setTimeout(function(){ if ($('#hpnews').length > 0) { $('#hpnews').fadeIn('slow'); } }, 3000); </script> dose any one now why its not ? and how to make it work thanks
0
11,410,850
07/10/2012 09:59:22
733,087
05/01/2011 07:13:18
1,001
85
Cakephp how to remove trailing '/' from url for SEO purpose
How can I remove trailing '/' from url? For example I've a url `http://www.example.com/our_story` it delivers our story page. But `http://www.entrustenergy.com/our_story/` also delivers the same page. But our seo experts says that this is creating duplicate pages in google listing. My Site is already developed, they are telling me to redirect this URL `http://www.entrustenergy.com/our_story/` to `http://www.entrustenergy.com/our_story`. How can achieve this? I think .htaccess should help.
.htaccess
cakephp
cakephp-1.3
null
null
null
open
Cakephp how to remove trailing '/' from url for SEO purpose === How can I remove trailing '/' from url? For example I've a url `http://www.example.com/our_story` it delivers our story page. But `http://www.entrustenergy.com/our_story/` also delivers the same page. But our seo experts says that this is creating duplicate pages in google listing. My Site is already developed, they are telling me to redirect this URL `http://www.entrustenergy.com/our_story/` to `http://www.entrustenergy.com/our_story`. How can achieve this? I think .htaccess should help.
0
11,410,851
07/10/2012 09:59:25
17,676
09/18/2008 13:28:38
61
4
Are there best practices Oracle BPEL 10g migration to Oracle BPEL 11g?
Currently we want to stop development on our Oracle BPEL 10g enviroment and after that we have to migrate a handfull BPEL Domains to Partitions. Oracle has some documentation, but I wonder if this is the least painfull way. Some people tend to say that you are better of building from scratch. Any thoughts on this?
migration
bpel
null
null
null
null
open
Are there best practices Oracle BPEL 10g migration to Oracle BPEL 11g? === Currently we want to stop development on our Oracle BPEL 10g enviroment and after that we have to migrate a handfull BPEL Domains to Partitions. Oracle has some documentation, but I wonder if this is the least painfull way. Some people tend to say that you are better of building from scratch. Any thoughts on this?
0
11,410,853
07/10/2012 09:59:28
1,481,850
06/26/2012 06:33:13
67
4
strip <script> tags from a text using php + security problems?
I want to use php in order to strip only the <script> tags. I have other tags like images and links. After some search I did I found strip tags function in php but it seems to strip all tags and that is not going to work in my case. By striping <script> tags from text is that enough to prevent any security problems ?
php
null
null
null
null
null
open
strip <script> tags from a text using php + security problems? === I want to use php in order to strip only the <script> tags. I have other tags like images and links. After some search I did I found strip tags function in php but it seems to strip all tags and that is not going to work in my case. By striping <script> tags from text is that enough to prevent any security problems ?
0
11,410,844
07/10/2012 09:58:56
1,405,983
05/20/2012 07:49:40
51
11
convert string to date and format the date
I have String variable which contains date. Now how to display July 15 from that string variable?(for example 2012-07-15) `String strdate="2012-07-15";` `SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd");` `try {` `d1 = formatter.parse(strdate);` `System.out.println(d1+"---date first---");` `} catch (ParseException e) {` `// TODO Auto-generated catch block` ` e.printStackTrace();` `}`
android
date
null
null
null
null
open
convert string to date and format the date === I have String variable which contains date. Now how to display July 15 from that string variable?(for example 2012-07-15) `String strdate="2012-07-15";` `SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MMM-dd");` `try {` `d1 = formatter.parse(strdate);` `System.out.println(d1+"---date first---");` `} catch (ParseException e) {` `// TODO Auto-generated catch block` ` e.printStackTrace();` `}`
0
11,410,846
07/10/2012 09:59:01
885,566
08/09/2011 08:53:07
180
16
TWAIN scanning via AIR?
I develop an AIR application. I'd like to know how is it possible to access TWAIN scanning devices and view scan picture inside my AIR application. Thanks,
actionscript-3
flex
twain
null
null
null
open
TWAIN scanning via AIR? === I develop an AIR application. I'd like to know how is it possible to access TWAIN scanning devices and view scan picture inside my AIR application. Thanks,
0
11,410,848
07/10/2012 09:59:08
962,724
09/24/2011 15:05:37
189
1
How to pause UIView Animations
in iOS5.0 using blocks, say if we have an UIViewAnimationOptionAutoreverse animation, and need to put in a delay before the reverse animation starts.. how can we do this? Thanks for your help on this
ios
null
null
null
null
null
open
How to pause UIView Animations === in iOS5.0 using blocks, say if we have an UIViewAnimationOptionAutoreverse animation, and need to put in a delay before the reverse animation starts.. how can we do this? Thanks for your help on this
0
11,410,750
07/10/2012 09:53:36
1,367,623
05/01/2012 11:08:49
21
2
How to force camera by intent to take picture automatically in Android
i am creating an application. and use device default camera to take picture. using this Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, CAMERA_PICTURE); in `onActivityResult()` method i call again above code and take [picture again][1]. [1]: http://stackoverflow.com/questions/9347594/how-to-take-multiple-pictures-using-android-android-provider-mediastore-action-i but i want to take multiple pictures at a time. is there any way to take picture automatically when camera is called by intent (not by creating custom camera activity).
android
android-camera
android-camera-intent
null
null
null
open
How to force camera by intent to take picture automatically in Android === i am creating an application. and use device default camera to take picture. using this Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(intent, CAMERA_PICTURE); in `onActivityResult()` method i call again above code and take [picture again][1]. [1]: http://stackoverflow.com/questions/9347594/how-to-take-multiple-pictures-using-android-android-provider-mediastore-action-i but i want to take multiple pictures at a time. is there any way to take picture automatically when camera is called by intent (not by creating custom camera activity).
0
11,410,751
07/10/2012 09:53:39
1,514,366
07/10/2012 09:45:41
1
0
creating atable per user in php?
Actually i'm very new to all this...and for a project work in my college i have decided to make an online shopping website. And i am stuck at the sign up part..:( i wanted the users to have a separated table for themselves that allow them to store the products that they have added in their cart so that they can keep adding more products later as well. But as i read in other questions in all your links.creating a table per user seems to be a very bad idea. but otherwise how can i do it?please HELP!!!!!
php
mysql
html
table
user
null
open
creating atable per user in php? === Actually i'm very new to all this...and for a project work in my college i have decided to make an online shopping website. And i am stuck at the sign up part..:( i wanted the users to have a separated table for themselves that allow them to store the products that they have added in their cart so that they can keep adding more products later as well. But as i read in other questions in all your links.creating a table per user seems to be a very bad idea. but otherwise how can i do it?please HELP!!!!!
0