PostId
int64
13
11.8M
PostCreationDate
stringlengths
19
19
OwnerUserId
int64
3
1.57M
OwnerCreationDate
stringlengths
10
19
ReputationAtPostCreation
int64
-33
210k
OwnerUndeletedAnswerCountAtPostTime
int64
0
5.77k
Title
stringlengths
10
250
BodyMarkdown
stringlengths
12
30k
Tag1
stringlengths
1
25
Tag2
stringlengths
1
25
Tag3
stringlengths
1
25
Tag4
stringlengths
1
25
Tag5
stringlengths
1
25
PostClosedDate
stringlengths
19
19
OpenStatus
stringclasses
5 values
unified_texts
stringlengths
47
30.1k
OpenStatus_id
int64
0
4
11,314,148
07/03/2012 15:23:42
1,492,991
06/30/2012 12:32:46
1
0
it is giving segmentation fault . ami trying to implement ford fulkerson algorithm ,here i am reading from file
int main() { int i,j,k,l,m; int maxflow=0; int first,second,capac; int residual[100][100]; //reading from file FILE*fp; fp=fopen("ford.txt","r"); fscanf(fp,"%d %d",&node,&edge); cout<<"nodes are"<<node<<"\n"<<"edges are"<<edge<<"\n"; for(j=1;j<=node;j++) { for(k=1;k<=node;k++) { capacity[j][k]=0; } } for(i=0;i<edge;i++) { fscanf(fp,"%d %d %d",&first,&second,&capac); cout<<first<<"->"<<second<<"="<<capac<<"\n";//it is printing this capacity[first][second]=capac; } cout<<"abc"; for(l=1;l<=node;l++) { for(m=1;m<=node;m++) { flow[l][m]=capacity[l][m]; flow[m][l]=0; } } return 0; } it is not even printing "abc",after above cout statement .i am trying to implement ford fulkerson algorithm ,here i am reading from file and initializing capacity flow matrices after that i am calling maxflow function which i have omitted here
c++
null
null
null
null
07/04/2012 12:59:32
too localized
it is giving segmentation fault . ami trying to implement ford fulkerson algorithm ,here i am reading from file === int main() { int i,j,k,l,m; int maxflow=0; int first,second,capac; int residual[100][100]; //reading from file FILE*fp; fp=fopen("ford.txt","r"); fscanf(fp,"%d %d",&node,&edge); cout<<"nodes are"<<node<<"\n"<<"edges are"<<edge<<"\n"; for(j=1;j<=node;j++) { for(k=1;k<=node;k++) { capacity[j][k]=0; } } for(i=0;i<edge;i++) { fscanf(fp,"%d %d %d",&first,&second,&capac); cout<<first<<"->"<<second<<"="<<capac<<"\n";//it is printing this capacity[first][second]=capac; } cout<<"abc"; for(l=1;l<=node;l++) { for(m=1;m<=node;m++) { flow[l][m]=capacity[l][m]; flow[m][l]=0; } } return 0; } it is not even printing "abc",after above cout statement .i am trying to implement ford fulkerson algorithm ,here i am reading from file and initializing capacity flow matrices after that i am calling maxflow function which i have omitted here
3
5,931,179
05/08/2011 23:48:36
716,092
04/19/2011 22:16:29
1
0
Algorithm problem
I'm having some trouble with the following problem: Let N and K be 2 positive integers. Find out the sum of all X numbers with the following properties: 1) X has maximum N digits. 2) X is divided by K and XR is divided by K, where XR is "X Revered"(Eg.X=12345654, XR =45654321). Restrictions : N<500 2<K<65535 I'm sure the problem is of mathematical issue because it would be just stupid to literally operate with such huge numbers. Any ideas please? Thank you
algorithm
numbers
division
null
null
05/09/2011 00:06:23
not a real question
Algorithm problem === I'm having some trouble with the following problem: Let N and K be 2 positive integers. Find out the sum of all X numbers with the following properties: 1) X has maximum N digits. 2) X is divided by K and XR is divided by K, where XR is "X Revered"(Eg.X=12345654, XR =45654321). Restrictions : N<500 2<K<65535 I'm sure the problem is of mathematical issue because it would be just stupid to literally operate with such huge numbers. Any ideas please? Thank you
1
9,165,625
02/06/2012 18:58:53
1,171,350
01/26/2012 13:35:39
16
0
Winform Design Architecture
I making a winform game which contain PictureBoxes as views. When i started to get confused about "where to put things around" (especially in the case that i needed to make some objects make the picturebox222 refresh and activate by that its painting event) Then i heard of architecture patterns... the MVC, MVP, MVVM which of those patterns can help me in my task? and why? I'll also be glad to get advise of a good place to learn about the pattern i need. Thanks, Gal
c#
null
null
null
null
02/06/2012 19:16:23
not a real question
Winform Design Architecture === I making a winform game which contain PictureBoxes as views. When i started to get confused about "where to put things around" (especially in the case that i needed to make some objects make the picturebox222 refresh and activate by that its painting event) Then i heard of architecture patterns... the MVC, MVP, MVVM which of those patterns can help me in my task? and why? I'll also be glad to get advise of a good place to learn about the pattern i need. Thanks, Gal
1
7,602,289
09/29/2011 19:16:27
565,879
01/06/2011 18:21:21
299
4
How can I set the classpath in an Eclipse application?
I am trying to use Class.getResource("rsc/my_resource_file.txt") to load a file in an Eclipse application. However, no matter what I do in Eclipse the classpath always contains just one entry to the Eclipse Launcher: >.../eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.pkc How can I configure the classpath? Note: At runtime I am determining the classpath with the following code: URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader(); for (URL classpathURL : cl.getURLs()) { System.out.println(classpathURL); }
java
eclipse
classpath
null
null
null
open
How can I set the classpath in an Eclipse application? === I am trying to use Class.getResource("rsc/my_resource_file.txt") to load a file in an Eclipse application. However, no matter what I do in Eclipse the classpath always contains just one entry to the Eclipse Launcher: >.../eclipse/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.pkc How can I configure the classpath? Note: At runtime I am determining the classpath with the following code: URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader(); for (URL classpathURL : cl.getURLs()) { System.out.println(classpathURL); }
0
4,455,607
12/15/2010 22:27:41
526,186
12/01/2010 07:07:32
1
0
WatiN and .net winforms WebBrowser control - is DialogWatcher possible?
Our target is: Watin-enabled browser testing embedded in a .net winform. Currently, we are using a .net WebBrowser control to embed browser behavior in a winform. We are attaching WatiN to the WebBroswer control on the form with code like this ( thanks prostynick ): var thread = new Thread(() => { Settings.AutoStartDialogWatcher = false; var ie = new IE(webBrowser1.ActiveXInstance); ie.GoTo("http://www.google.com"); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); The problem is this - the "winform browser" needs to handle popups during testing/automation. Question: How can popups be handled when Watin is attached to a winforms webBrowser control ( and not using its own WatiN-generated IE window )? a) Can Watin's DialogWatcher still be used? If so ...how? b) If not, then perhaps we can write our own DialogWatcher -- but we would need an hWnd or processID to add it. Where would we get correct hWnd or processId in this scenario where Waitin does not have its own window or process? Thanks in advance for any ideas ...alternate approaches that reach the same target are welcome!
webbrowser-control
watin
browser-automation
null
null
null
open
WatiN and .net winforms WebBrowser control - is DialogWatcher possible? === Our target is: Watin-enabled browser testing embedded in a .net winform. Currently, we are using a .net WebBrowser control to embed browser behavior in a winform. We are attaching WatiN to the WebBroswer control on the form with code like this ( thanks prostynick ): var thread = new Thread(() => { Settings.AutoStartDialogWatcher = false; var ie = new IE(webBrowser1.ActiveXInstance); ie.GoTo("http://www.google.com"); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); The problem is this - the "winform browser" needs to handle popups during testing/automation. Question: How can popups be handled when Watin is attached to a winforms webBrowser control ( and not using its own WatiN-generated IE window )? a) Can Watin's DialogWatcher still be used? If so ...how? b) If not, then perhaps we can write our own DialogWatcher -- but we would need an hWnd or processID to add it. Where would we get correct hWnd or processId in this scenario where Waitin does not have its own window or process? Thanks in advance for any ideas ...alternate approaches that reach the same target are welcome!
0
11,516,409
07/17/2012 05:18:43
1,409,089
05/22/2012 01:16:48
1
0
How to add sms notification feature in my website
Hi guys I got a classified website and now I want to add sms notification like other classified network.. Its like you can contact the advertiser and a email will be send to the advertiser with an sms in his own phn. I can do the email but no idea for the sms. I m from India is there any free service or APIs that will help me create a sms notification feature. I used php in my classified website. Thanks in advance.
php
notifications
sms
null
null
07/18/2012 12:45:34
not a real question
How to add sms notification feature in my website === Hi guys I got a classified website and now I want to add sms notification like other classified network.. Its like you can contact the advertiser and a email will be send to the advertiser with an sms in his own phn. I can do the email but no idea for the sms. I m from India is there any free service or APIs that will help me create a sms notification feature. I used php in my classified website. Thanks in advance.
1
7,744,969
10/12/2011 18:48:18
793,216
06/10/2011 18:31:15
1
0
NServiceBus as code trace mechanism: Sending messages from Class Library and displaying on Web app using SignalR
I am struggling to use NServiceBus for the first time, with no ESB background. After reading blog posts, the samples, the docs, etc. I cannot figure out why my C# class library will not send messages. on Bus.Send(msg) I get "No destination specified for message Messages.TraceStatement. Message cannot be sent. Check the UnicastBusConfig section in your config file and ensure that a MessageEndpointMapping exists for the message type." But first, a little about my architecture and what I'm trying to do, as it differs from any of the samples I've seen out there. My intent is to use SignalR and NServiceBus [like Ben did][1], but with two main changes: 1. No use of NServiceBus.Host.exe. I want a Web-only, no console implementation. 2. Messages are sent from a middle tier class library for the purpose of real-time code tracing. In other words, I want to sprinkle Bus.Send statements around my code and thereby be able to view code execution trace statements (which are just ad hoc strings set by the developer) on a Web page. Assuming I haven't misunderstood NServiceBus to such a degree that what I envision is not even possible (or a misuse of the technology), I would like to figure out how to send messages from a class library. Currently I have a "Managers" dll that has an app.config file as follows: <configuration> <configSections> <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" /> <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" /> </configSections> <MsmqTransportConfig InputQueue="TerminalQueue" ErrorQueue="TerminalErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5"/> <UnicastBusConfig> <MessageEndpointMappings> <add Messages="Messages" Endpoint="WorkerQueue" /> </MessageEndpointMappings> </UnicastBusConfig> </configuration> Note: In Ben's project I renamed "Commands" to "Messages". Thus (referring to the error message at the top of my post), as far as I can tell I have properly defined a MessageEndpointMapping. (I verified that the queue exists in MSMQ.) Can anyone tell me what I'm doing wrong? Also, I would greatly appreciate input on how to remove the NServiceBus.Host.exe dependency (refer to the Worker project in Ben's sample). Ideally the class library would send the message (like the Terminal did in Ben's project) and the Web app would, as a subscriber, be able to handle the event and use SignalR to display the message. [1]: http://ben.onfabrik.com/posts/push-notifications-with-nservicebus-and-signalr "like Ben did"
nservicebus
signalr
null
null
null
null
open
NServiceBus as code trace mechanism: Sending messages from Class Library and displaying on Web app using SignalR === I am struggling to use NServiceBus for the first time, with no ESB background. After reading blog posts, the samples, the docs, etc. I cannot figure out why my C# class library will not send messages. on Bus.Send(msg) I get "No destination specified for message Messages.TraceStatement. Message cannot be sent. Check the UnicastBusConfig section in your config file and ensure that a MessageEndpointMapping exists for the message type." But first, a little about my architecture and what I'm trying to do, as it differs from any of the samples I've seen out there. My intent is to use SignalR and NServiceBus [like Ben did][1], but with two main changes: 1. No use of NServiceBus.Host.exe. I want a Web-only, no console implementation. 2. Messages are sent from a middle tier class library for the purpose of real-time code tracing. In other words, I want to sprinkle Bus.Send statements around my code and thereby be able to view code execution trace statements (which are just ad hoc strings set by the developer) on a Web page. Assuming I haven't misunderstood NServiceBus to such a degree that what I envision is not even possible (or a misuse of the technology), I would like to figure out how to send messages from a class library. Currently I have a "Managers" dll that has an app.config file as follows: <configuration> <configSections> <section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" /> <section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core" /> </configSections> <MsmqTransportConfig InputQueue="TerminalQueue" ErrorQueue="TerminalErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5"/> <UnicastBusConfig> <MessageEndpointMappings> <add Messages="Messages" Endpoint="WorkerQueue" /> </MessageEndpointMappings> </UnicastBusConfig> </configuration> Note: In Ben's project I renamed "Commands" to "Messages". Thus (referring to the error message at the top of my post), as far as I can tell I have properly defined a MessageEndpointMapping. (I verified that the queue exists in MSMQ.) Can anyone tell me what I'm doing wrong? Also, I would greatly appreciate input on how to remove the NServiceBus.Host.exe dependency (refer to the Worker project in Ben's sample). Ideally the class library would send the message (like the Terminal did in Ben's project) and the Web app would, as a subscriber, be able to handle the event and use SignalR to display the message. [1]: http://ben.onfabrik.com/posts/push-notifications-with-nservicebus-and-signalr "like Ben did"
0
2,726,977
04/28/2010 05:14:00
327,495
04/28/2010 05:14:00
1
0
Need design ideas generators.
I am a web developer and sometimes I have to do some design myself for my customers but design actually is not my best thing to do. I am looking for a program that can help me getting fast and reliable design ideas but I am not looking for code generator like Artisteer.<br /> Actually design is a hard task and my designs always look ugly and messy.
design
null
null
null
null
10/04/2011 03:53:57
off topic
Need design ideas generators. === I am a web developer and sometimes I have to do some design myself for my customers but design actually is not my best thing to do. I am looking for a program that can help me getting fast and reliable design ideas but I am not looking for code generator like Artisteer.<br /> Actually design is a hard task and my designs always look ugly and messy.
2
10,834,799
05/31/2012 13:39:31
1,228,479
02/23/2012 13:42:01
24
3
Windows Azure VM Role Deployment Issue & 'Beta Programs' missing from portal
I am trying to follow the tutorial [here][1]. Scroll down to, Task 5 – Creating the Service Model On Step 4 i.e. "4.Once the solution is created, right-click the Roles folder inside the MyVMRole project, point to Add, and then select New Virtual Machine Role." The 'New Virtual Machine Role' option doesn't appear on my VS. This of course is because, I haven't got an invite into the beta program of MS Azure VM Role and haven't installed the VS tool. My question is how do I join the beta program or apply for this tool? I saw some online posts to go to Azure Management Portal -> Home -> Beta Programs. But for me, the 'Beta Programs' folder doesn't appear in the portal. Please help. [1]: http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_vmrolelab_topic2
visual-studio-2010
azure
null
null
null
06/07/2012 23:11:44
off topic
Windows Azure VM Role Deployment Issue & 'Beta Programs' missing from portal === I am trying to follow the tutorial [here][1]. Scroll down to, Task 5 – Creating the Service Model On Step 4 i.e. "4.Once the solution is created, right-click the Roles folder inside the MyVMRole project, point to Add, and then select New Virtual Machine Role." The 'New Virtual Machine Role' option doesn't appear on my VS. This of course is because, I haven't got an invite into the beta program of MS Azure VM Role and haven't installed the VS tool. My question is how do I join the beta program or apply for this tool? I saw some online posts to go to Azure Management Portal -> Home -> Beta Programs. But for me, the 'Beta Programs' folder doesn't appear in the portal. Please help. [1]: http://msdn.microsoft.com/en-us/wazplatformtrainingcourse_vmrolelab_topic2
2
5,084,239
02/22/2011 21:32:36
198,262
10/28/2009 16:26:29
21
3
WCF RESTful JSON web service post Nested List of object
I'm developing a WCF service that accepts parameters in JSON. I cant' figure out where I'm going wrong. Please help. When I test the service using fiddler, I post the following: "locations": { "Departments": [{ "Name": "Amazonas", "alias": "", "Municipalities": [{ "Name": "El Encanto", "Corregimientos": [] }, { "Name": "La Chorrera", "Corregimientos": [] }] }] } I get a 400 error with: "The server encountered an error processing the request. The exception message is 'OperationFormatter encountered an invalid Message body. Expected to find an attribute with name 'type' and value 'object'. Found value 'string'.'. See server logs for more details." The stacktrace is: at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) Here is the contract: [OperationContract(Name = "setFacilities")] [WebInvoke( Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "/setFacilities")] string SetFacilities(LocationData locations); What I'm I missing?
asp.net
json
wcf
null
null
null
open
WCF RESTful JSON web service post Nested List of object === I'm developing a WCF service that accepts parameters in JSON. I cant' figure out where I'm going wrong. Please help. When I test the service using fiddler, I post the following: "locations": { "Departments": [{ "Name": "Amazonas", "alias": "", "Municipalities": [{ "Name": "El Encanto", "Corregimientos": [] }, { "Name": "La Chorrera", "Corregimientos": [] }] }] } I get a 400 error with: "The server encountered an error processing the request. The exception message is 'OperationFormatter encountered an invalid Message body. Expected to find an attribute with name 'type' and value 'object'. Found value 'string'.'. See server logs for more details." The stacktrace is: at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest) at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.CompositeDispatchFormatter.DeserializeRequest(Message message, Object[] parameters) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc& rpc) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage3(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage2(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage1(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet) Here is the contract: [OperationContract(Name = "setFacilities")] [WebInvoke( Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "/setFacilities")] string SetFacilities(LocationData locations); What I'm I missing?
0
10,111,583
04/11/2012 18:12:38
175,611
09/18/2009 15:30:46
2,071
66
Is Using Gmail to Store Application Data a Violation of their Terms of Service?
Gmail has the potential to serve as a powerful store for some forms of app data. At $50/year for 200GB, I'm tempted to increase my reliance on it but I want to make sure it is sustainable under their current policies. I've used it in the past for storing log data sent out from log4net SMTP appenders but am now interested in leveraging it for incoming email processing - you can do neat things with their addressing format like encoding processing rules as follows: **user+various-command-arguments@gmail.com**. I've looked briefly at their documents and don't see anything that indicates that this is a violation of their terms of service: http://www.google.com/mail/help/program_policies.html https://support.google.com/mail/bin/answer.py?hl=en&answer=39567 Again, the question is: can a gmail account be leveraged as an application-store, used only by your applications API and not to read/write traditional email content? If so, are there any other pitfalls to this approach, aside from the fact that policies can change at any time? Sure beats having to manage SMTP services in the cloud.
c#
oauth
smtp
gmail
log4net
04/11/2012 18:15:58
off topic
Is Using Gmail to Store Application Data a Violation of their Terms of Service? === Gmail has the potential to serve as a powerful store for some forms of app data. At $50/year for 200GB, I'm tempted to increase my reliance on it but I want to make sure it is sustainable under their current policies. I've used it in the past for storing log data sent out from log4net SMTP appenders but am now interested in leveraging it for incoming email processing - you can do neat things with their addressing format like encoding processing rules as follows: **user+various-command-arguments@gmail.com**. I've looked briefly at their documents and don't see anything that indicates that this is a violation of their terms of service: http://www.google.com/mail/help/program_policies.html https://support.google.com/mail/bin/answer.py?hl=en&answer=39567 Again, the question is: can a gmail account be leveraged as an application-store, used only by your applications API and not to read/write traditional email content? If so, are there any other pitfalls to this approach, aside from the fact that policies can change at any time? Sure beats having to manage SMTP services in the cloud.
2
5,966,055
05/11/2011 14:38:17
574,190
01/13/2011 12:14:56
152
4
Controlling the order of rails validations
I have a rails model which has 7 numeric attributes filled in by the user via a form. I need to validate the presence of each of these attributes which is obviously easy using validates :attribute1, :presence => true However I also need to run a custom validator which takes a number of the attributes and does some calculations with them. If the result of these calculations is not within a certain range then the model should be declared invalid. On it's own, this too is easy validate :calculations_ok? def calculations_ok? errors[:base] << "Not within required range" unless within_required_range? end def within_required_range? # check the calculations and return true or false here end However the problem is that the method "validate" always gets run before the method "validates". This means that if the user leaves one of the required fields blank, rails throws an error when it tries to do a calculation with a blank attribute. So how can I check the presence of all the required attributes first?
ruby-on-rails
ruby-on-rails-3
validation
activemodel
null
null
open
Controlling the order of rails validations === I have a rails model which has 7 numeric attributes filled in by the user via a form. I need to validate the presence of each of these attributes which is obviously easy using validates :attribute1, :presence => true However I also need to run a custom validator which takes a number of the attributes and does some calculations with them. If the result of these calculations is not within a certain range then the model should be declared invalid. On it's own, this too is easy validate :calculations_ok? def calculations_ok? errors[:base] << "Not within required range" unless within_required_range? end def within_required_range? # check the calculations and return true or false here end However the problem is that the method "validate" always gets run before the method "validates". This means that if the user leaves one of the required fields blank, rails throws an error when it tries to do a calculation with a blank attribute. So how can I check the presence of all the required attributes first?
0
7,802,309
10/18/2011 04:07:44
625,052
02/16/2011 15:46:56
1
0
Regex Pattern for 0 ,1 and an empty string
Please help me with a pattern that matches exactly one occurences of 0,1 or an empty string. Thanks in advance
java
null
null
null
null
10/19/2011 02:44:49
too localized
Regex Pattern for 0 ,1 and an empty string === Please help me with a pattern that matches exactly one occurences of 0,1 or an empty string. Thanks in advance
3
6,059,598
05/19/2011 13:40:20
687,581
04/01/2011 12:39:09
52
1
What programming language should I use for a scalable social network website?
I'm a pretty confident PHP web developer. I can write decent, efficient scripts and queries and have never really had any efficiency issues with the code. I'm now however beginning a much *much* larger, social network style web service. There will be a vast amount of twitter length updates (this isn't in any way similar to twitter, just similar content sized updates) which will be very very regular. I know this question is reasonably subjective, and there probably isn't a right answer, but what languages are best for this sort of work? I can program using PHP and Java at this stage, have looked into Scala a little bit. Thanks in advance! :)
java
language
social-networking
scalable
null
05/19/2011 13:47:53
not constructive
What programming language should I use for a scalable social network website? === I'm a pretty confident PHP web developer. I can write decent, efficient scripts and queries and have never really had any efficiency issues with the code. I'm now however beginning a much *much* larger, social network style web service. There will be a vast amount of twitter length updates (this isn't in any way similar to twitter, just similar content sized updates) which will be very very regular. I know this question is reasonably subjective, and there probably isn't a right answer, but what languages are best for this sort of work? I can program using PHP and Java at this stage, have looked into Scala a little bit. Thanks in advance! :)
4
3,053,363
06/16/2010 12:49:38
368,247
06/16/2010 12:49:38
1
0
partial views in asp.net
i want to implement partial views in asp.net please help me. thnak you.
asp.net
null
null
null
null
06/16/2010 20:49:24
not a real question
partial views in asp.net === i want to implement partial views in asp.net please help me. thnak you.
1
1,373,381
09/03/2009 13:21:24
31,766
10/27/2008 11:31:41
239
10
jquery reduce the adoption of Silverlight?
Currently looking into learn new technology and silverlight is on the potential list. However, I was wondering, will the popularity of jquery and it's awesomeness reduce the adoption of silverlight and therefore the need and reward from learning it? Cheers
jquery
silverlight
career-development
asp.net
null
02/08/2012 02:22:11
off topic
jquery reduce the adoption of Silverlight? === Currently looking into learn new technology and silverlight is on the potential list. However, I was wondering, will the popularity of jquery and it's awesomeness reduce the adoption of silverlight and therefore the need and reward from learning it? Cheers
2
3,478,078
08/13/2010 14:57:25
419,673
08/13/2010 14:48:54
1
0
Setting Bonjour Display Name on Mac
I'm looking to setup some Macs on my company's network to change their Bonjour broadcast name based upon who is logged in to the computer. Currently, they broadcast with the computer's name. This will hopefully make it easier for them to share files, as they wont have to remember that computernameXYZ is Jane Smith's computer. Thanks in advance.
osx
bonjour
null
null
null
03/01/2012 22:08:39
not constructive
Setting Bonjour Display Name on Mac === I'm looking to setup some Macs on my company's network to change their Bonjour broadcast name based upon who is logged in to the computer. Currently, they broadcast with the computer's name. This will hopefully make it easier for them to share files, as they wont have to remember that computernameXYZ is Jane Smith's computer. Thanks in advance.
4
2,658,044
04/17/2010 10:31:28
241,800
01/01/2010 03:25:21
6
2
iPhone - how to track touches and allow button taps at the same time?
I'm wondering how to track touches anywhere on the iPhone screen and still have UIButtons respond to taps. I subclassed a UIView, made it full screen and the highest view in the hierarchy, and overrode its pointInside:withEvent method. If I return YES, I'm able to track touches anywhere on the screen but the buttons don't respond (likely because the view is instructed to handle and terminate the touch). If I return NO, the touch passes through the view and the buttons respond, but I'm not able to track touches. Do I need to subclass UIButton or is this possible through the responder chain? What am I doing wrong? - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ return NO; } //only works if pointInside:withEvent: returns YES. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"began"); [self.nextResponder touchesBegan:touches withEvent:event]; } //only works if pointInside:withEvent: returns YES. -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"end"); [self.nextResponder touchesEnded:touches withEvent:event]; }
iphone
uibutton
uitouch
null
null
null
open
iPhone - how to track touches and allow button taps at the same time? === I'm wondering how to track touches anywhere on the iPhone screen and still have UIButtons respond to taps. I subclassed a UIView, made it full screen and the highest view in the hierarchy, and overrode its pointInside:withEvent method. If I return YES, I'm able to track touches anywhere on the screen but the buttons don't respond (likely because the view is instructed to handle and terminate the touch). If I return NO, the touch passes through the view and the buttons respond, but I'm not able to track touches. Do I need to subclass UIButton or is this possible through the responder chain? What am I doing wrong? - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ return NO; } //only works if pointInside:withEvent: returns YES. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"began"); [self.nextResponder touchesBegan:touches withEvent:event]; } //only works if pointInside:withEvent: returns YES. -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"end"); [self.nextResponder touchesEnded:touches withEvent:event]; }
0
9,690,414
03/13/2012 19:06:17
1,000,427
10/18/2011 05:19:20
8
0
iOS credit card processing
I am looking to develop an app that accepts credit card information for non-digital products. In other words, In-App purchase does not apply in this case. What I'm looking to do is VERY much like the [Chipotle app][1] with which you can purchase food. What is the best way to facilitate this type of transaction? [1]: http://itunes.apple.com/us/app/chipotle-ordering/id327228455?mt=8
ios5
credit-card
payment-processing
null
null
04/04/2012 16:41:44
off topic
iOS credit card processing === I am looking to develop an app that accepts credit card information for non-digital products. In other words, In-App purchase does not apply in this case. What I'm looking to do is VERY much like the [Chipotle app][1] with which you can purchase food. What is the best way to facilitate this type of transaction? [1]: http://itunes.apple.com/us/app/chipotle-ordering/id327228455?mt=8
2
9,805,250
03/21/2012 13:07:30
1,166,763
01/24/2012 10:37:36
22
1
Send Email in Android using the default android app(Builtin Email application)
I want to send email from my application using the default android email app. I have written a code for that as Intent mailIntent = new Intent(android.content.Intent.ACTION_SEND); mailIntent.setType("plain/text"); mailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { EMAIL }); mailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Invitation"); mailIntent.putExtra(android.content.Intent.EXTRA_TEXT,MAIL_MESSAGE); startActivity(mailIntent); But here it is opening the email application. I want to send the mail instead of starting any activity. Is there any ways to replace the startActivity and initiate the intent action? Please help me. Thanks in advance.
android
android-intent
null
null
null
null
open
Send Email in Android using the default android app(Builtin Email application) === I want to send email from my application using the default android email app. I have written a code for that as Intent mailIntent = new Intent(android.content.Intent.ACTION_SEND); mailIntent.setType("plain/text"); mailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { EMAIL }); mailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Invitation"); mailIntent.putExtra(android.content.Intent.EXTRA_TEXT,MAIL_MESSAGE); startActivity(mailIntent); But here it is opening the email application. I want to send the mail instead of starting any activity. Is there any ways to replace the startActivity and initiate the intent action? Please help me. Thanks in advance.
0
2,082,145
01/17/2010 18:47:01
139,117
07/16/2009 01:12:31
1,406
40
Strange bug while combining images in Python
I have a hundred 10x10 px images, and I want to combine them into a big 100x100 image. I'm using the Image library to first create a blank image and then paste in the smaller images: blank = Image.new('P',(100,100)) blank.paste(im,box) The smaller images are in color, but the resulting image turns out in all grayscale. Is there a fix or workaround for this?
python
image
pil
image-processing
null
null
open
Strange bug while combining images in Python === I have a hundred 10x10 px images, and I want to combine them into a big 100x100 image. I'm using the Image library to first create a blank image and then paste in the smaller images: blank = Image.new('P',(100,100)) blank.paste(im,box) The smaller images are in color, but the resulting image turns out in all grayscale. Is there a fix or workaround for this?
0
133,988
09/25/2008 15:27:07
4,249
09/02/2008 14:13:06
815
48
Problem with synchronizing on String objects?
I have a webapp that I am in the middle of doing some load/performance testing on, particularily on a feature where we expect a few hundred users to be accessing the same page and hitting refresh about every 10 seconds on this page. One area of improvement that we found we could make with this function was to cache the responses from the web service for some period of time, since the data is not changing. After implementing this basic caching, in some further testing I found out that I didn't consider how concurrent threads could access the Cache at the same time. I found that within the matter of ~100ms, about 50 threads were trying to fetch the object from the Cache, finding that it had expired, hitting the web service to fetch the data, and then putting the object back in the cache. The original code looked something like this: private SomeData[] getSomeDataByEmail(WebServiceInterface service, String email) { final String key = "Data-" + email; SomeData[] data = (SomeData[]) StaticCache.get(key); if (data == null) { data = service.getSomeDataForEmail(email); StaticCache.set(key, data, CACHE_TIME); } else { logger.debug("getSomeDataForEmail: using cached object"); } return data; } So, to make sure that only one thread was calling the web service when the object at `key` expired, I thought I needed to synchronize the Cache get/set operation, and it seemed like using the cache key would be a good candidate for an object to synchronize on (this way, calls to this method for email b@b.com would not be blocked by method calls to a@a.com). I updated the method to look like this: private SomeData[] getSomeDataByEmail(WebServiceInterface service, String email) { SomeData[] data = null; final String key = "Data-" + email; synchronized(key) { data =(SomeData[]) StaticCache.get(key); if (data == null) { data = service.getSomeDataForEmail(email); StaticCache.set(key, data, CACHE_TIME); } else { logger.debug("getSomeDataForEmail: using cached object"); } } return data; } I also added logging lines for things like "before synchronization block", "inside synchronization block", "about to leave synchronization block", and "after synchronization block", so I could determine if I was effectively synchronizing the get/set operation. However it doesn't seem like this has worked. My test logs have output like: >(log output is 'threadname' 'logger name' 'message') http-80-Processor253 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor253 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor253 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor253 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor263 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor263 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor263 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor263 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor131 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor131 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor131 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor131 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor104 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor104 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor104 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor252 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor283 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor2 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor2 jsp.view-page - getSomeDataForEmail: inside synchronization block I wanted to see only one thread at a time entering/exiting the synchronization block around the get/set operations. Is there an issue in synchronizing on String objects? I thought the cache-key would be a good choice as it is unique to the operation, and even though the `final String key` is declared within the method, I was thinking that each thread would be getting a reference to *the same object* and therefore would synchronization on this single object. What am I doing wrong here?
java
multithreading
synchronization
null
null
null
open
Problem with synchronizing on String objects? === I have a webapp that I am in the middle of doing some load/performance testing on, particularily on a feature where we expect a few hundred users to be accessing the same page and hitting refresh about every 10 seconds on this page. One area of improvement that we found we could make with this function was to cache the responses from the web service for some period of time, since the data is not changing. After implementing this basic caching, in some further testing I found out that I didn't consider how concurrent threads could access the Cache at the same time. I found that within the matter of ~100ms, about 50 threads were trying to fetch the object from the Cache, finding that it had expired, hitting the web service to fetch the data, and then putting the object back in the cache. The original code looked something like this: private SomeData[] getSomeDataByEmail(WebServiceInterface service, String email) { final String key = "Data-" + email; SomeData[] data = (SomeData[]) StaticCache.get(key); if (data == null) { data = service.getSomeDataForEmail(email); StaticCache.set(key, data, CACHE_TIME); } else { logger.debug("getSomeDataForEmail: using cached object"); } return data; } So, to make sure that only one thread was calling the web service when the object at `key` expired, I thought I needed to synchronize the Cache get/set operation, and it seemed like using the cache key would be a good candidate for an object to synchronize on (this way, calls to this method for email b@b.com would not be blocked by method calls to a@a.com). I updated the method to look like this: private SomeData[] getSomeDataByEmail(WebServiceInterface service, String email) { SomeData[] data = null; final String key = "Data-" + email; synchronized(key) { data =(SomeData[]) StaticCache.get(key); if (data == null) { data = service.getSomeDataForEmail(email); StaticCache.set(key, data, CACHE_TIME); } else { logger.debug("getSomeDataForEmail: using cached object"); } } return data; } I also added logging lines for things like "before synchronization block", "inside synchronization block", "about to leave synchronization block", and "after synchronization block", so I could determine if I was effectively synchronizing the get/set operation. However it doesn't seem like this has worked. My test logs have output like: >(log output is 'threadname' 'logger name' 'message') http-80-Processor253 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor253 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor253 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor253 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor263 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor263 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor263 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor263 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor131 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor131 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor131 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor131 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor104 jsp.view-page - getSomeDataForEmail: inside synchronization block http-80-Processor104 cache.StaticCache - get: object at key [SomeData-test@test.com] has expired http-80-Processor104 cache.StaticCache - get: key [SomeData-test@test.com] returning value [null] http-80-Processor252 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor283 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor2 jsp.view-page - getSomeDataForEmail: about to enter synchronization block http-80-Processor2 jsp.view-page - getSomeDataForEmail: inside synchronization block I wanted to see only one thread at a time entering/exiting the synchronization block around the get/set operations. Is there an issue in synchronizing on String objects? I thought the cache-key would be a good choice as it is unique to the operation, and even though the `final String key` is declared within the method, I was thinking that each thread would be getting a reference to *the same object* and therefore would synchronization on this single object. What am I doing wrong here?
0
8,221,359
11/22/2011 02:48:13
1,058,646
11/21/2011 21:34:49
8
0
Error - App failed to installed
My friend sent me one.app and prologs_adhoc.mobileprovision files. I have been trying for hours to upload this app to my ipod touch with version 5.0.1 4th generation. It shows up on itunes but when i try to sync with ipod, it just keep giving error mentioned above. Can anyone please guide me in right direction?
iphone
null
null
null
null
11/23/2011 03:19:00
off topic
Error - App failed to installed === My friend sent me one.app and prologs_adhoc.mobileprovision files. I have been trying for hours to upload this app to my ipod touch with version 5.0.1 4th generation. It shows up on itunes but when i try to sync with ipod, it just keep giving error mentioned above. Can anyone please guide me in right direction?
2
9,263,061
02/13/2012 15:24:42
340,947
05/14/2010 05:16:31
1,392
26
Can I bind a vertex attribute index from the vertex shader?
On the OpenGL FBO wiki page there is this snippet: > You can also use layout syntax to define this directly in the shader, > as you would for attribute indices: >> <pre>layout(location = 0) out vec4 mainColor; >> layout(location = 1) out vec2 subsideraryInfo; </pre> This seems to indicate that attribute indices can be specified within a shader, which would simplify things a bit my removing the need for my code to specify attribute locations and such using `glBindAttribLocation`. I can't seem to find more information on this though.
opengl
null
null
null
null
null
open
Can I bind a vertex attribute index from the vertex shader? === On the OpenGL FBO wiki page there is this snippet: > You can also use layout syntax to define this directly in the shader, > as you would for attribute indices: >> <pre>layout(location = 0) out vec4 mainColor; >> layout(location = 1) out vec2 subsideraryInfo; </pre> This seems to indicate that attribute indices can be specified within a shader, which would simplify things a bit my removing the need for my code to specify attribute locations and such using `glBindAttribLocation`. I can't seem to find more information on this though.
0
11,256,547
06/29/2012 05:35:25
1,482,491
06/26/2012 10:57:57
1
1
What are the Basics concepts in table structure design?
to design the table structure what are the basics rules need to follow ? Thanks.
database
null
null
null
null
06/29/2012 17:55:35
not a real question
What are the Basics concepts in table structure design? === to design the table structure what are the basics rules need to follow ? Thanks.
1
7,863,932
10/23/2011 02:17:34
1,009,134
10/23/2011 02:07:04
1
0
Horizontal flip of Image on Python with pypng
I am trying to horizontally flip an image (from left to right) on Python using pypng, I have written the following codes but it does not seem to work, anybody have any idea what I'm doing wrong here? def horizontal_flip(image): rows = len(image) cols = len(image[0]) new_image = [] for r in range(rows): new_row = [] for c in range(0,cols,3): if c != cols/2: image[c:c+3], image[-c-3: -c] = image[-c-3: -c], image[c:c+3] new_row.append(image[r][c]) new_image.append(new_row) return new_image
python
image
manipulation
pypng
null
null
open
Horizontal flip of Image on Python with pypng === I am trying to horizontally flip an image (from left to right) on Python using pypng, I have written the following codes but it does not seem to work, anybody have any idea what I'm doing wrong here? def horizontal_flip(image): rows = len(image) cols = len(image[0]) new_image = [] for r in range(rows): new_row = [] for c in range(0,cols,3): if c != cols/2: image[c:c+3], image[-c-3: -c] = image[-c-3: -c], image[c:c+3] new_row.append(image[r][c]) new_image.append(new_row) return new_image
0
6,461,395
06/23/2011 22:31:42
810,787
06/22/2011 16:48:48
8
0
Mark Down format online editor
On my website I want to provide a text editor like the one i'm typing in now that uses the mark down format in PHP and JavaScript. Something like TinyMCE but just accepts the text and saves it in a text file on the server. I have you the php text to mark down scripts working, its just the editor i need. Any suggestions?
php
tinymce
text-editor
markdown
null
06/27/2011 14:39:21
not a real question
Mark Down format online editor === On my website I want to provide a text editor like the one i'm typing in now that uses the mark down format in PHP and JavaScript. Something like TinyMCE but just accepts the text and saves it in a text file on the server. I have you the php text to mark down scripts working, its just the editor i need. Any suggestions?
1
10,963,511
06/09/2012 18:27:08
784,597
06/05/2011 09:07:37
820
3
Load Balancer : Is Load Balancer possible in this case?
Our Web Application will be in production soon . We are going to use Load Balancing for this war for more redundancy . I am a java develoer ,so please excuse if my question with respect to load balancing is basic . Right now the war is deployed on these two Linux servers ( Server A and Server B ).These two servers(Server A and Server B) has tomcat installed with the similar directory structure on them . The war will be using some property file defined under tomcat/bin directory and this property value is different for these two servers . These two servers (Server A and Server B ) have different IP's . Please let me know if Load Balancing will be any issue in this case ??
networking
tomcat
load-balancing
null
null
06/09/2012 23:30:15
not a real question
Load Balancer : Is Load Balancer possible in this case? === Our Web Application will be in production soon . We are going to use Load Balancing for this war for more redundancy . I am a java develoer ,so please excuse if my question with respect to load balancing is basic . Right now the war is deployed on these two Linux servers ( Server A and Server B ).These two servers(Server A and Server B) has tomcat installed with the similar directory structure on them . The war will be using some property file defined under tomcat/bin directory and this property value is different for these two servers . These two servers (Server A and Server B ) have different IP's . Please let me know if Load Balancing will be any issue in this case ??
1
6,559,278
07/02/2011 19:54:26
629,593
02/23/2011 05:34:22
37
1
How to Implement update query on javacript $ajax
I must to update the query and print all list. First, I press a button, and it added a new value to Array, and now, I need update the list of carritolista. this is my .php <div id="carrito"> <div id="carritolista" style="display: none"> <?php /*conecction db ....*/ /*query on foreach array $idvar....*/ $result=mysql_query("Select*FROM Products Where ID=$idvar"); $row=mysql_fetch_array($result); ?> <input class="listaname" type="text" name="prod" size="25" value="<?php echo $row['nombre']; ?>"> /* php end foreach*/ </div></div> here my javascript. <script type="text/javascript" > $("button").click(function () { /*add new value to $idvar Array /*HERE UPDATE #carrito }); </script> I was searching for Ajax solution, but i dont know how. Searching find something about .load, althougth doesnt work. $('#carrito').load('ajax/perfil?name=<?php echo $vartipo;?> #carrito', "",function(responseText, textStatus, XMLHttpRequest) please, someone give me a hand.
php
javascript
ajax
null
null
07/03/2011 09:08:04
too localized
How to Implement update query on javacript $ajax === I must to update the query and print all list. First, I press a button, and it added a new value to Array, and now, I need update the list of carritolista. this is my .php <div id="carrito"> <div id="carritolista" style="display: none"> <?php /*conecction db ....*/ /*query on foreach array $idvar....*/ $result=mysql_query("Select*FROM Products Where ID=$idvar"); $row=mysql_fetch_array($result); ?> <input class="listaname" type="text" name="prod" size="25" value="<?php echo $row['nombre']; ?>"> /* php end foreach*/ </div></div> here my javascript. <script type="text/javascript" > $("button").click(function () { /*add new value to $idvar Array /*HERE UPDATE #carrito }); </script> I was searching for Ajax solution, but i dont know how. Searching find something about .load, althougth doesnt work. $('#carrito').load('ajax/perfil?name=<?php echo $vartipo;?> #carrito', "",function(responseText, textStatus, XMLHttpRequest) please, someone give me a hand.
3
8,613,225
12/23/2011 07:08:17
824,210
07/01/2011 04:34:54
160
1
Standalone Java to dequeue JMS messages
Can any one provide sample program to dequeue messages in Java? I want standalone java program which will do this task. Lets say Oracle ha enqueued messages using JMS_TEXT_MESSAGE a payload type in queue "myqueue" whose owner is "myowner" & now I want to dequeue these messages using Java. Can any one provide sample program in stand alone Java? Thanks!
java
java-ee
jms
null
null
12/23/2011 20:32:53
not a real question
Standalone Java to dequeue JMS messages === Can any one provide sample program to dequeue messages in Java? I want standalone java program which will do this task. Lets say Oracle ha enqueued messages using JMS_TEXT_MESSAGE a payload type in queue "myqueue" whose owner is "myowner" & now I want to dequeue these messages using Java. Can any one provide sample program in stand alone Java? Thanks!
1
10,058,359
04/07/2012 21:03:19
308,079
04/03/2010 01:37:12
2,660
77
osx terminal image resize
Is it possible to resize an image in the terminal of OSX without installing any 3rd party applications? I would like to build a script to resize all the images in a directory but can't install any other applications other than whats included in a base install of OSX (Lion).
osx
image
bash
image-resizing
null
04/09/2012 14:07:42
off topic
osx terminal image resize === Is it possible to resize an image in the terminal of OSX without installing any 3rd party applications? I would like to build a script to resize all the images in a directory but can't install any other applications other than whats included in a base install of OSX (Lion).
2
7,296,495
09/03/2011 23:38:16
607,846
02/08/2011 09:16:51
132
3
Help with logic within generator function
I'm trying to create a generator function: <pre> def combinations(iterable, r, maxGapSize): maxGapSizePlusOne = maxGapSize+1 pool = tuple(iterable) n = len(pool) if r > n: return indices = list(range(r)) while True: for i in reversed(range(r)): if indices[i] != i + n - r: break else: return indices[i] += 1 for j in range(i+1, r): indices[j] = indices[j-1] + 1 previous = indices[0] for k in indices[1:]: if k-previous>maxGapSizePlusOne: isGapTooBig = True break previous = k else: isGapTooBig = False if not isGapTooBig: print(indices) combinations(("Aa","Bbb","Ccccc","Dd","E","Ffff",),2,1) </pre> I'm printing out the indices that I wish to use to select the elements from the argument called 'iterable' for debugging purposes. This gives me: <pre> [0, 2] [1, 2] [1, 3] [2, 3] [2, 4] [3, 4] [3, 5] [4, 5] </pre> Ignoring [0,1] as this is produced elsewhere... This is exactly what I want but I'm guessing my code it over complicated and inefficient. The size of 'iterable' is likely to be in the thousands and the value of maxGapSize somewhere under 5. Any tips to help me do this better? Thanks, Barry.
python-3.x
null
null
null
null
02/13/2012 02:19:47
too localized
Help with logic within generator function === I'm trying to create a generator function: <pre> def combinations(iterable, r, maxGapSize): maxGapSizePlusOne = maxGapSize+1 pool = tuple(iterable) n = len(pool) if r > n: return indices = list(range(r)) while True: for i in reversed(range(r)): if indices[i] != i + n - r: break else: return indices[i] += 1 for j in range(i+1, r): indices[j] = indices[j-1] + 1 previous = indices[0] for k in indices[1:]: if k-previous>maxGapSizePlusOne: isGapTooBig = True break previous = k else: isGapTooBig = False if not isGapTooBig: print(indices) combinations(("Aa","Bbb","Ccccc","Dd","E","Ffff",),2,1) </pre> I'm printing out the indices that I wish to use to select the elements from the argument called 'iterable' for debugging purposes. This gives me: <pre> [0, 2] [1, 2] [1, 3] [2, 3] [2, 4] [3, 4] [3, 5] [4, 5] </pre> Ignoring [0,1] as this is produced elsewhere... This is exactly what I want but I'm guessing my code it over complicated and inefficient. The size of 'iterable' is likely to be in the thousands and the value of maxGapSize somewhere under 5. Any tips to help me do this better? Thanks, Barry.
3
4,127,158
11/08/2010 19:16:58
501,057
11/08/2010 19:16:58
1
0
Request for the permission of type 'System.Web.AspNetHostingPermission failed.
Full error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. I'm doing maintenance on an old ASP.NET 2.0 "Web Site" project and am having issues with the error message posted in the topic. The reason for the error is that I recently enabled folder redirection on my account, and that all my files are now located on a network share. I am aware of the trust issues with .NET applications, and as such used the .NET 2.0 Configuration Tool in Administrative Tools to set my Intranet trust level to Full. This had no effect. The problem seems to lie in the applications reference to ELMAH. When I compile the application and get the mentioned error, the source of the error is: <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> If I remove all references to ELMAH, the application behaves as expected, with no errors about trust levels. Can anyone enlighten me as to what's going on, and if there is a way to fix it? I assume this problem would be with any referenced DLL, not just ELMAH.
asp.net
visual-studio-2008
null
null
null
null
open
Request for the permission of type 'System.Web.AspNetHostingPermission failed. === Full error: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. I'm doing maintenance on an old ASP.NET 2.0 "Web Site" project and am having issues with the error message posted in the topic. The reason for the error is that I recently enabled folder redirection on my account, and that all my files are now located on a network share. I am aware of the trust issues with .NET applications, and as such used the .NET 2.0 Configuration Tool in Administrative Tools to set my Intranet trust level to Full. This had no effect. The problem seems to lie in the applications reference to ELMAH. When I compile the application and get the mentioned error, the source of the error is: <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> If I remove all references to ELMAH, the application behaves as expected, with no errors about trust levels. Can anyone enlighten me as to what's going on, and if there is a way to fix it? I assume this problem would be with any referenced DLL, not just ELMAH.
0
7,324,145
09/06/2011 18:01:59
348,434
05/16/2010 06:45:57
76
0
Creating a vew for summary
I have a table of questions. The questions can be high priority, low priority, open/answered. What is the best way to create a summary. Should I use a view or several stored procedures? Table example: CREATE TABLE [dbo].[question] ( [Id] INT NOT NULL, [Priority] INT NOT NULL, [State] INT NOT NULL) I think creating a view with 4 columns is the best: OpenQuestionHighPriority, OpenQuestionLowPriority, ClosedQuestionHighPriority,ClosedQuestionLowPriority. Like to know how to do this or other suggestions. Thanks,
sql
database
script
null
null
null
open
Creating a vew for summary === I have a table of questions. The questions can be high priority, low priority, open/answered. What is the best way to create a summary. Should I use a view or several stored procedures? Table example: CREATE TABLE [dbo].[question] ( [Id] INT NOT NULL, [Priority] INT NOT NULL, [State] INT NOT NULL) I think creating a view with 4 columns is the best: OpenQuestionHighPriority, OpenQuestionLowPriority, ClosedQuestionHighPriority,ClosedQuestionLowPriority. Like to know how to do this or other suggestions. Thanks,
0
11,020,488
06/13/2012 17:47:48
1,454,369
06/13/2012 17:38:21
1
0
g++ corrupting file and causing it to grow massively
On a whim I decided to make a War (card game) simulator in c++. I was starting off the program and I wrote a header file with all my #includes and had the source code in another file. I accidentally had the #includes in both the header file and the source code and when I tried to compile, it started giving me all these errors saying (for example): > war.cpp:3815: error: stray '\20' in program war.cpp:3815:12: warning: > null character(s) ignored war.cpp:3815: error: stray '\21' in program > war.cpp:3815: error: stray '\231' in program war.cpp:3815:18: warning: > null character(s) ignored war.cpp:3815: error: stray '\20' in program > war.cpp:3815:20: warning: null character(s) ignored war.cpp:3815: > error: stray '\20' in program war.cpp:3815: error: stray '\212' in > program war.cpp:3815: error: stray '\217' in program Keep in mind, this program was <200 characters at this point, so something was causing the compiler to write all these characters to the file. I quickly figured out what the problem was and corrected it, but my question is, how did this happen? What caused the compiler to write to the program so massively? By the time I canceled the compiler (it looked like it was going to just keep going), the file had grown from a couple of hundred bytes to nearly 13 MB in just a few seconds. I'm no expert but it seems like this kind of thing could have security implications, especially since I was running this program over ssh on my university's CS department server. For what it's worth, here's the code I had when I compiled: war.cpp: #include <iostream> #include <cstdlib> #include <vector> using namespace std; int main() { vector< pair<int, suit> > deck1; vector< pair<int, suit> >::iterator it1; } war.h: #ifndef WAR_H #define WAR_H #include <iostream> #include <cstdlib> #include <vector> using namespace std; enum suit { HEARTS, SPADES, CLUBS, DIAMONDS }; #endif
c++
g++
null
null
null
null
open
g++ corrupting file and causing it to grow massively === On a whim I decided to make a War (card game) simulator in c++. I was starting off the program and I wrote a header file with all my #includes and had the source code in another file. I accidentally had the #includes in both the header file and the source code and when I tried to compile, it started giving me all these errors saying (for example): > war.cpp:3815: error: stray '\20' in program war.cpp:3815:12: warning: > null character(s) ignored war.cpp:3815: error: stray '\21' in program > war.cpp:3815: error: stray '\231' in program war.cpp:3815:18: warning: > null character(s) ignored war.cpp:3815: error: stray '\20' in program > war.cpp:3815:20: warning: null character(s) ignored war.cpp:3815: > error: stray '\20' in program war.cpp:3815: error: stray '\212' in > program war.cpp:3815: error: stray '\217' in program Keep in mind, this program was <200 characters at this point, so something was causing the compiler to write all these characters to the file. I quickly figured out what the problem was and corrected it, but my question is, how did this happen? What caused the compiler to write to the program so massively? By the time I canceled the compiler (it looked like it was going to just keep going), the file had grown from a couple of hundred bytes to nearly 13 MB in just a few seconds. I'm no expert but it seems like this kind of thing could have security implications, especially since I was running this program over ssh on my university's CS department server. For what it's worth, here's the code I had when I compiled: war.cpp: #include <iostream> #include <cstdlib> #include <vector> using namespace std; int main() { vector< pair<int, suit> > deck1; vector< pair<int, suit> >::iterator it1; } war.h: #ifndef WAR_H #define WAR_H #include <iostream> #include <cstdlib> #include <vector> using namespace std; enum suit { HEARTS, SPADES, CLUBS, DIAMONDS }; #endif
0
6,526,515
06/29/2011 20:00:42
821,843
06/29/2011 19:58:26
1
0
HTML For Loop based on user selected number
I am making a quick site that allows users to register for an event. It consists of two pages, each with a form. The first form/page gets their information, along with the number of people they will bring (1-20). This form passes it's data to the next page. The second page is a for loop that prints out x number of forms, based on the users selection from a dropdown menu. How do I do this? Thanks, Sean
php
javascript
html
forms
null
06/30/2011 06:40:17
not a real question
HTML For Loop based on user selected number === I am making a quick site that allows users to register for an event. It consists of two pages, each with a form. The first form/page gets their information, along with the number of people they will bring (1-20). This form passes it's data to the next page. The second page is a for loop that prints out x number of forms, based on the users selection from a dropdown menu. How do I do this? Thanks, Sean
1
6,116,042
05/24/2011 19:52:19
176,615
09/21/2009 15:00:17
225
7
Django/python: loop through a dictionary and add an item to it
Apologies for probably simple question, I've read the docs and still can't get this working. I'm making a raw SQL query in Django which is long so I won't post it here - suffice it to say that it works and returns results. I want to loop through my query results and check to see if the bandname is of the format "The [band]" and rewrite it to "[band], The". I'm aware I could do this via SQL but the performance isn't great for a large amount of rows, and I have a function on the band model to sort in this way, but can't use it alongside a raw SQL query. Here is my code: m = Media.objects.raw('SELECT blah FROM foo') for index, item in enumerate(m): if item.bandname_alt: if item.bandname_alt[:4] == 'The ': m[index].bandname_sortable = item.bandname_alt[4:] + ', The' I know the logic works and finds the right bands, but can't figure out how to add the `bandname_sortable` field to the dictionary so I can access it inside my views. Can anyone help me out here?
python
django
dictionary
null
null
null
open
Django/python: loop through a dictionary and add an item to it === Apologies for probably simple question, I've read the docs and still can't get this working. I'm making a raw SQL query in Django which is long so I won't post it here - suffice it to say that it works and returns results. I want to loop through my query results and check to see if the bandname is of the format "The [band]" and rewrite it to "[band], The". I'm aware I could do this via SQL but the performance isn't great for a large amount of rows, and I have a function on the band model to sort in this way, but can't use it alongside a raw SQL query. Here is my code: m = Media.objects.raw('SELECT blah FROM foo') for index, item in enumerate(m): if item.bandname_alt: if item.bandname_alt[:4] == 'The ': m[index].bandname_sortable = item.bandname_alt[4:] + ', The' I know the logic works and finds the right bands, but can't figure out how to add the `bandname_sortable` field to the dictionary so I can access it inside my views. Can anyone help me out here?
0
8,146,082
11/16/2011 02:52:34
850,694
07/18/2011 19:24:00
3
0
How to disable toggling of landscape/portrait on a mobile web app (Android Browser/iOS-Mobile Safari)
I am trying to disable phone rotation affecting the web page of one of my HTML5 mobile apps. No reorganizing of the layout, resizing, orientationchange behavior. I want it so that you rotate the phone and the initial layout loaded will stay the same, forcing the user into using the app in the original orientation. There are many subtleties to user logic and I truly feel this is needed in my app, so please no comments on that choice, rather help for my question in the first sentence. 1. I tried listening for BOTH 'orientationchange' and 'resize' events and calling preventDefault and stopPropagation on them, to prevent any browser behavior of reorganizing the page to fit a landscape view when turned. Well, obviously preventing ANYTHING (ideally). Made absolutely no difference. Browser still reorganized the page on Android (both pre2.1 and after) and iPhone 4-5. 2. tried meta tags <meta name="viewport" content="initial-scale=1.0, user-scalable=no /> then got pissed, tried <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" /> neither made a difference. 3. looked furiously on StackOverflow, saw what I did in step 1. put out there several times...tried again to make sure I wasn't messing something up. Didn't work. 4. sucked in my pride, then decided to keep running into a brick wall due to pride, then really sucked in my pride and posted here. HALP.
javascript
android
iphone
html5
mobile
null
open
How to disable toggling of landscape/portrait on a mobile web app (Android Browser/iOS-Mobile Safari) === I am trying to disable phone rotation affecting the web page of one of my HTML5 mobile apps. No reorganizing of the layout, resizing, orientationchange behavior. I want it so that you rotate the phone and the initial layout loaded will stay the same, forcing the user into using the app in the original orientation. There are many subtleties to user logic and I truly feel this is needed in my app, so please no comments on that choice, rather help for my question in the first sentence. 1. I tried listening for BOTH 'orientationchange' and 'resize' events and calling preventDefault and stopPropagation on them, to prevent any browser behavior of reorganizing the page to fit a landscape view when turned. Well, obviously preventing ANYTHING (ideally). Made absolutely no difference. Browser still reorganized the page on Android (both pre2.1 and after) and iPhone 4-5. 2. tried meta tags <meta name="viewport" content="initial-scale=1.0, user-scalable=no /> then got pissed, tried <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width" /> neither made a difference. 3. looked furiously on StackOverflow, saw what I did in step 1. put out there several times...tried again to make sure I wasn't messing something up. Didn't work. 4. sucked in my pride, then decided to keep running into a brick wall due to pride, then really sucked in my pride and posted here. HALP.
0
10,974,978
06/11/2012 05:47:32
748,164
05/11/2011 07:12:53
44
1
How to Create personal online radio station?
I want to create my own radio station, that is I will host my application , e-g: http://myradiostation.com on a server from godaddy or any other hosting company. that application will have a music player , user can come to that website and listen to music and they can also talk with the RJ. Now, how to input above website with music and talk streams? I want to do it in Asp.NET . I do not want to use any third party because I do not have money to buy these.
asp.net
null
null
null
null
06/11/2012 07:35:28
off topic
How to Create personal online radio station? === I want to create my own radio station, that is I will host my application , e-g: http://myradiostation.com on a server from godaddy or any other hosting company. that application will have a music player , user can come to that website and listen to music and they can also talk with the RJ. Now, how to input above website with music and talk streams? I want to do it in Asp.NET . I do not want to use any third party because I do not have money to buy these.
2
11,307,138
07/03/2012 08:27:12
477,671
10/16/2010 03:14:32
41
1
How can I recreate an Instagram like scroll where the post information remains at the top until the next post reaches the top on Android?
I want to recreate the Instagram scroll on Android. How can I do that? If you've never tried out Instagram, basically think of the "Alphabetical ordering" when you scroll through music on iPhones. You're scrolling through a bunch of songs which start with the letter "A". The letter A stays at the top of the screen until all songs that start with A are not on the display. The letter "B" pushes it away. How can I create something like this on Android?
android
eclipse
adt
ipod
instagram
null
open
How can I recreate an Instagram like scroll where the post information remains at the top until the next post reaches the top on Android? === I want to recreate the Instagram scroll on Android. How can I do that? If you've never tried out Instagram, basically think of the "Alphabetical ordering" when you scroll through music on iPhones. You're scrolling through a bunch of songs which start with the letter "A". The letter A stays at the top of the screen until all songs that start with A are not on the display. The letter "B" pushes it away. How can I create something like this on Android?
0
9,128,233
02/03/2012 11:51:39
721,588
04/23/2011 08:56:48
59
0
hibernate - cannot connect to the db
I am just started learning Hibernate and trying to create a first hibernate project. I am using postgreSQL and doing everything as it is said in the first 3 tutorials (http://javabrains.koushik.org/p/hibernate.html) But I have a very strange error. Can anybody explain how it is possible to solve this problem? 2 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA 15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA 17 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 20 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 24 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 103 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA 105 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml 105 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml 1184 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null 1186 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 1239 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: ee.ut.math.dto.UserDetails 1287 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity ee.ut.math.dto.UserDetails on table UserDetails 1322 [main] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!) 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 1 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false 1387 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/hibernatedb 1388 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=postgres, password=****} 1593 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: PostgreSQL, version: 9.1.2 1593 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 9.1 JDBC4 (build 901) 1612 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect 1639 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions) 1641 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 1643 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {} 1643 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled 1647 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge 1647 [main] INFO org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge - Cache provider: org.hibernate.cache.internal.NoCacheProvider Exception in thread "main" org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge] at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:389) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:262) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at ee.ut.math.HibernateTest.main(HibernateTest.java:20) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:384) ... 6 more Caused by: org.hibernate.cache.CacheException: could not instantiate CacheProvider [org.hibernate.cache.internal.NoCacheProvider] at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:66) ... 11 more Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.internal.NoCacheProvider at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192) at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:63) ... 11 more
java
hibernate
null
null
null
null
open
hibernate - cannot connect to the db === I am just started learning Hibernate and trying to create a first hibernate project. I am using postgreSQL and doing everything as it is said in the first 3 tutorials (http://javabrains.koushik.org/p/hibernate.html) But I have a very strange error. Can anybody explain how it is possible to solve this problem? 2 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA 15 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA 17 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 20 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 24 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 103 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA 105 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: /hibernate.cfg.xml 105 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: /hibernate.cfg.xml 1184 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null 1186 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled. 1239 [main] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: ee.ut.math.dto.UserDetails 1287 [main] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity ee.ut.math.dto.UserDetails on table UserDetails 1322 [main] INFO org.hibernate.cfg.AnnotationConfiguration - Hibernate Validator not found: ignoring 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!) 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 1 1369 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false 1387 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: org.postgresql.Driver at URL: jdbc:postgresql://localhost:5432/hibernatedb 1388 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=postgres, password=****} 1593 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: PostgreSQL, version: 9.1.2 1593 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: PostgreSQL Native Driver, version: PostgreSQL 9.1 JDBC4 (build 901) 1612 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.PostgreSQLDialect 1639 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions) 1641 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled 1641 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled 1642 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 1643 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {} 1643 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled 1643 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled 1647 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge 1647 [main] INFO org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge - Cache provider: org.hibernate.cache.internal.NoCacheProvider Exception in thread "main" org.hibernate.HibernateException: could not instantiate RegionFactory [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge] at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:389) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:262) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2115) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1339) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867) at ee.ut.math.HibernateTest.main(HibernateTest.java:20) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.hibernate.cfg.SettingsFactory.createRegionFactory(SettingsFactory.java:384) ... 6 more Caused by: org.hibernate.cache.CacheException: could not instantiate CacheProvider [org.hibernate.cache.internal.NoCacheProvider] at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:66) ... 11 more Caused by: java.lang.ClassNotFoundException: org.hibernate.cache.internal.NoCacheProvider at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:192) at org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge.<init>(RegionFactoryCacheProviderBridge.java:63) ... 11 more
0
8,232,694
11/22/2011 19:36:16
1,060,500
11/22/2011 19:32:10
1
0
Best Practice for Inline binding with XAML and text Text="Some text {Some binding} some more text}"
I'm wondering if there is special syntax to bind text concatenated with existing text. Something like this. <TextBlock Grid.Row="0" Name="tbGroupMembershipCaption" Text="The following users have access to export to '{Binding TargetName}'." ></TextBlock> Clearly, this doesn't work. What is the best practice? Using SL4.
wpf
silverlight
xaml
null
null
null
open
Best Practice for Inline binding with XAML and text Text="Some text {Some binding} some more text}" === I'm wondering if there is special syntax to bind text concatenated with existing text. Something like this. <TextBlock Grid.Row="0" Name="tbGroupMembershipCaption" Text="The following users have access to export to '{Binding TargetName}'." ></TextBlock> Clearly, this doesn't work. What is the best practice? Using SL4.
0
1,549,379
10/10/2009 23:33:15
187,823
10/10/2009 23:13:56
1
0
Fresh out of University: Am I selling myself short?
I'm graduating in December with an undergrad degree in Applied Mathematics. I'll be venturing out and finding my first programming job soon, but I'm a bit intimidated by the job ads I read. I regularly browse the ads on Dice, Craigslist and Monster, and from what I can tell, I don't have the necessary skills. Most jobs tend to be looking for senior developers with a very precise skill set. Ie, distributed systems, compilers, kernels, build and release management, etc. While I have a very superficial understanding of some of these areas (I've written a toy compiler and kernel), I'm not exactly an an expert or even proficient. I've been programming for about 10 years, and almost all of my experience is in C, C++ and python (in that order). Should I apply to these jobs anyways? Should I lower the bar and take whatever I can get? I would love to work for a company where I can put my math and algorithm knowledge to work. But with zero industry experience, I'm not really sure what type of jobs I should be applying to. Any advice would be much appreciated. Thanks, Nick
entry-level
industry
undergraduate
null
null
02/06/2012 01:13:42
off topic
Fresh out of University: Am I selling myself short? === I'm graduating in December with an undergrad degree in Applied Mathematics. I'll be venturing out and finding my first programming job soon, but I'm a bit intimidated by the job ads I read. I regularly browse the ads on Dice, Craigslist and Monster, and from what I can tell, I don't have the necessary skills. Most jobs tend to be looking for senior developers with a very precise skill set. Ie, distributed systems, compilers, kernels, build and release management, etc. While I have a very superficial understanding of some of these areas (I've written a toy compiler and kernel), I'm not exactly an an expert or even proficient. I've been programming for about 10 years, and almost all of my experience is in C, C++ and python (in that order). Should I apply to these jobs anyways? Should I lower the bar and take whatever I can get? I would love to work for a company where I can put my math and algorithm knowledge to work. But with zero industry experience, I'm not really sure what type of jobs I should be applying to. Any advice would be much appreciated. Thanks, Nick
2
9,294,774
02/15/2012 14:00:46
1,211,315
02/15/2012 12:27:38
1
0
No endpoint mapping found when setting up Spring Web Service
I'm a beginner at setting up spring web-applications. I got this far but now I find myself stuck. I get the following error: WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities] The main problem is that I have run out of ideas where to look for debug information. I fixed as many errors that I've seen, but now I can't even find something wrong in the logs. So I'm getting bit desperate. This my web.xml <web-app> <display-name>Weather report webservice</display-name> <servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-ws-servlet.xml</param-value> </init-param> <init-param> <param-name>transformWsdlLocations</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>spring-ws</servlet-name> <url-pattern>/weatherws</url-pattern> </servlet-mapping> </web-app> This is what my spring-ws-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="path.to.weather"/> <sws:annotation-driven/> </beans> This is what my endpoint looks like: @Endpoint public class WeatherEndpoint { private static final String NAMESPACE_URI = "http://mycompany.com/weather/schema"; private WeatherReportManager manager; @Autowired public WeatherEndpoint(WeatherReportManager manager) throws JDOMException { this.manager = manager; } @PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetCities") @ResponsePayload public Element getCities() { Element toReturn = null; for(City city : manager.getCities()) { //To some stuff } return toReturn; } } This is the catalina.log as I see it right now. I tried to get Tomcat to output DEBUG messages by editing the logging.properties. This did not give any additional effect. INFO: Deploying web application archive weather.war Feb 15, 2012 3:28:51 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'spring-ws': initialization started Feb 15, 2012 3:28:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing WebApplicationContext for namespace 'spring-ws-servlet': startup date [Wed Feb 15 15:28:51 EET 2012]; root of context hierarchy Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml] Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping afterPropertiesSet INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0] Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@36496381: defining beans [weatherEndpoint,weatherReportManagerWWW,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol Feb 15, 2012 3:28:52 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'spring-ws': initialization completed in 714 ms Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory docs Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory examples Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory host-manager Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory lib Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory manager Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ROOT Feb 15, 2012 3:28:53 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Feb 15, 2012 3:28:53 PM org.apache.coyote.ajp.AjpProtocol start INFO: Starting Coyote AJP/1.3 on ajp-8009 Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 8777 ms Feb 15, 2012 3:29:07 PM org.springframework.ws.server.MessageDispatcher dispatch WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities] I would be very grateful for any assistance. If you need to see anything additional, just let me know.
web-services
spring
spring-ws
endpoint
null
null
open
No endpoint mapping found when setting up Spring Web Service === I'm a beginner at setting up spring web-applications. I got this far but now I find myself stuck. I get the following error: WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities] The main problem is that I have run out of ideas where to look for debug information. I fixed as many errors that I've seen, but now I can't even find something wrong in the logs. So I'm getting bit desperate. This my web.xml <web-app> <display-name>Weather report webservice</display-name> <servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/spring-ws-servlet.xml</param-value> </init-param> <init-param> <param-name>transformWsdlLocations</param-name> <param-value>true</param-value> </init-param> </servlet> <servlet-mapping> <servlet-name>spring-ws</servlet-name> <url-pattern>/weatherws</url-pattern> </servlet-mapping> </web-app> This is what my spring-ws-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:sws="http://www.springframework.org/schema/web-services" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="path.to.weather"/> <sws:annotation-driven/> </beans> This is what my endpoint looks like: @Endpoint public class WeatherEndpoint { private static final String NAMESPACE_URI = "http://mycompany.com/weather/schema"; private WeatherReportManager manager; @Autowired public WeatherEndpoint(WeatherReportManager manager) throws JDOMException { this.manager = manager; } @PayloadRoot(namespace = NAMESPACE_URI, localPart = "GetCities") @ResponsePayload public Element getCities() { Element toReturn = null; for(City city : manager.getCities()) { //To some stuff } return toReturn; } } This is the catalina.log as I see it right now. I tried to get Tomcat to output DEBUG messages by editing the logging.properties. This did not give any additional effect. INFO: Deploying web application archive weather.war Feb 15, 2012 3:28:51 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'spring-ws': initialization started Feb 15, 2012 3:28:51 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh INFO: Refreshing WebApplicationContext for namespace 'spring-ws-servlet': startup date [Wed Feb 15 15:28:51 EET 2012]; root of context hierarchy Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/spring-ws-servlet.xml] Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping afterPropertiesSet INFO: Supporting [WS-Addressing August 2004, WS-Addressing 1.0] Feb 15, 2012 3:28:52 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@36496381: defining beans [weatherEndpoint,weatherReportManagerWWW,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.server.endpoint.mapping.SoapActionAnnotationMethodEndpointMapping#0,org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0,org.springframework.ws.server.endpoint.adapter.method.dom.DomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.SourcePayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.XmlRootElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.method.dom.JDomPayloadMethodProcessor#0,org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter#0,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy Feb 15, 2012 3:28:52 PM org.springframework.ws.soap.saaj.SaajSoapMessageFactory afterPropertiesSet INFO: Creating SAAJ 1.3 MessageFactory with SOAP 1.1 Protocol Feb 15, 2012 3:28:52 PM org.springframework.web.servlet.FrameworkServlet initServletBean INFO: FrameworkServlet 'spring-ws': initialization completed in 714 ms Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory docs Feb 15, 2012 3:28:52 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory examples Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory host-manager Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory lib Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory manager Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.HostConfig deployDirectory INFO: Deploying web application directory ROOT Feb 15, 2012 3:28:53 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Feb 15, 2012 3:28:53 PM org.apache.coyote.ajp.AjpProtocol start INFO: Starting Coyote AJP/1.3 on ajp-8009 Feb 15, 2012 3:28:53 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 8777 ms Feb 15, 2012 3:29:07 PM org.springframework.ws.server.MessageDispatcher dispatch WARNING: No endpoint mapping found for [SaajSoapMessage {http://mycompany.com/weather/schemas}GetCities] I would be very grateful for any assistance. If you need to see anything additional, just let me know.
0
3,063,554
06/17/2010 16:25:43
392,309
05/26/2010 13:35:38
5
0
How can i add view to a UITextView Object
i have a UITextView object and i want to load a label object or a set of label object over it but i dont have a view property for UITextView.The only thing i have is subViews property in UIView class which is parent class of UITextView.How should i really go about it...
iphone
null
null
null
null
null
open
How can i add view to a UITextView Object === i have a UITextView object and i want to load a label object or a set of label object over it but i dont have a view property for UITextView.The only thing i have is subViews property in UIView class which is parent class of UITextView.How should i really go about it...
0
2,818,361
05/12/2010 11:35:02
339,236
05/12/2010 11:35:02
1
0
iPhone - Is it possible to write an application over Bluetooth to connect with non-iPhone device ?
I developed a headset device that can connect to iPhone (HFP + A2DP + AVRCP). I want to write an application that will also send and receive data (a few bytes) to/from the headset over Bluetooth. Actually I want to open a Bluetooth connection between iPhone and my device to transfer data. Is it possible ?
iphone
bluetooth
null
null
null
null
open
iPhone - Is it possible to write an application over Bluetooth to connect with non-iPhone device ? === I developed a headset device that can connect to iPhone (HFP + A2DP + AVRCP). I want to write an application that will also send and receive data (a few bytes) to/from the headset over Bluetooth. Actually I want to open a Bluetooth connection between iPhone and my device to transfer data. Is it possible ?
0
9,258,161
02/13/2012 09:29:11
828,867
07/05/2011 01:16:47
1,114
53
How to create a simple Paragraph class
I've been trying to create a class which can do the following:<br><br> • Set: Font, Foreground, Alignment (left, center, right, justified)<br> • An efficient way to `append` text to the document.<br> The text does not need to be selectable or editable. I find that the JDK `JTextComponent` classes are difficult to use efficiently, as this is what I have so far but it is far from what I'm trying to achieve: public class Paragraph extends JTextPane{ public Paragraph(){ this.setFont(Fonts.PARAGRAPH); this.setOpaque(false); } // ridiculously slow public void append(String s) { SimpleAttributeSet def = new SimpleAttributeSet(); StyleConstants.setForeground(def, Colors.PARAGRAPH); Document d = getDocument(); try { d.insertString(d.getLength(), s, def); } catch (BadLocationException ble) { } } } <br><br> **Question:** Are there any libraries which could save me time re-inventing the wheel?<br> If not, how can I go about extending the JDK implementations? Thanks
java
swing
text
null
null
null
open
How to create a simple Paragraph class === I've been trying to create a class which can do the following:<br><br> • Set: Font, Foreground, Alignment (left, center, right, justified)<br> • An efficient way to `append` text to the document.<br> The text does not need to be selectable or editable. I find that the JDK `JTextComponent` classes are difficult to use efficiently, as this is what I have so far but it is far from what I'm trying to achieve: public class Paragraph extends JTextPane{ public Paragraph(){ this.setFont(Fonts.PARAGRAPH); this.setOpaque(false); } // ridiculously slow public void append(String s) { SimpleAttributeSet def = new SimpleAttributeSet(); StyleConstants.setForeground(def, Colors.PARAGRAPH); Document d = getDocument(); try { d.insertString(d.getLength(), s, def); } catch (BadLocationException ble) { } } } <br><br> **Question:** Are there any libraries which could save me time re-inventing the wheel?<br> If not, how can I go about extending the JDK implementations? Thanks
0
10,890,826
06/05/2012 02:29:33
96,180
04/26/2009 11:17:55
340
1
Httprest performance improvement
I am doing a HTTPRest post call to send the data to a third party, my data is in the order of 3 to 10 million and i can send only one record per request along with username and password for authentication as specified by third party sample code that i am using is public static void main(String[] args) { try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost( "http://localhost:8080/RESTfulExample/json/product/post"); StringEntity input = new StringEntity("{\"qty\":100,\"name\":\"iPad 4\"}"); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response = httpClient.execute(postRequest); if (response.getStatusLine().getStatusCode() != 201) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader( new InputStreamReader((response.getEntity().getContent()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } for each request it is taking around 6 sec and if i calculate for 10 million records it will take hours , can some one please suggest me are the any ways to improve the performance ?? thanks in advance Sunny
java
rest
null
null
null
null
open
Httprest performance improvement === I am doing a HTTPRest post call to send the data to a third party, my data is in the order of 3 to 10 million and i can send only one record per request along with username and password for authentication as specified by third party sample code that i am using is public static void main(String[] args) { try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost postRequest = new HttpPost( "http://localhost:8080/RESTfulExample/json/product/post"); StringEntity input = new StringEntity("{\"qty\":100,\"name\":\"iPad 4\"}"); input.setContentType("application/json"); postRequest.setEntity(input); HttpResponse response = httpClient.execute(postRequest); if (response.getStatusLine().getStatusCode() != 201) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new BufferedReader( new InputStreamReader((response.getEntity().getContent()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } for each request it is taking around 6 sec and if i calculate for 10 million records it will take hours , can some one please suggest me are the any ways to improve the performance ?? thanks in advance Sunny
0
7,266,003
09/01/2011 04:02:44
882,773
08/07/2011 13:07:53
1
0
Deleting of Data on the fly not working
I am trying to use jquery ajax to delete some data specifically ingredients of a recipe and I am using the CodeIgniter framework but it fails. Here is the parts of my code: $(".delete").live('click',function() { var ri_id = $(this).attr('id'); if(confirm("Are you sure you want to delete this ingredient? Action cannot be undone.")) { var r_id = "<?php echo $this->uri->segment(3); ?>"; alert(ri_id +" " +r_id); $.ajax({ type: "POST", url: "/ingredient/delete", data: "ri_id="+ri_id +"&r_id=" +r_id, success: function(){ $(this).parent().parent().parent().remove(); }, failure : alert('fail') }); Then here is my ingredient.php: class Ingredient extends CI_Controller { function delete() { $data['ri_id']= $this->input->post('ri_id'); $data['r_id']= $this->input->post('r_id'); if (!empty($data['id'])) { $this->load->model('ingredient_model', '', TRUE); $this->ingredient_model->delete_recipe_ingr($data); $this->output->set_output('works'); } else { $this->output->set_output('dontwork'); } } } and my model: class Recipe_model extends CI_Model { public function delete_recipe_ingr($data) { $this->db->where($data); $this->db->delete('st_recipe_ingredients'); } } Did I miss something or is it my code that is wrong? I would really appreciate your help. Thanks in advance.
jquery
ajax
codeigniter
null
null
null
open
Deleting of Data on the fly not working === I am trying to use jquery ajax to delete some data specifically ingredients of a recipe and I am using the CodeIgniter framework but it fails. Here is the parts of my code: $(".delete").live('click',function() { var ri_id = $(this).attr('id'); if(confirm("Are you sure you want to delete this ingredient? Action cannot be undone.")) { var r_id = "<?php echo $this->uri->segment(3); ?>"; alert(ri_id +" " +r_id); $.ajax({ type: "POST", url: "/ingredient/delete", data: "ri_id="+ri_id +"&r_id=" +r_id, success: function(){ $(this).parent().parent().parent().remove(); }, failure : alert('fail') }); Then here is my ingredient.php: class Ingredient extends CI_Controller { function delete() { $data['ri_id']= $this->input->post('ri_id'); $data['r_id']= $this->input->post('r_id'); if (!empty($data['id'])) { $this->load->model('ingredient_model', '', TRUE); $this->ingredient_model->delete_recipe_ingr($data); $this->output->set_output('works'); } else { $this->output->set_output('dontwork'); } } } and my model: class Recipe_model extends CI_Model { public function delete_recipe_ingr($data) { $this->db->where($data); $this->db->delete('st_recipe_ingredients'); } } Did I miss something or is it my code that is wrong? I would really appreciate your help. Thanks in advance.
0
7,456,146
09/17/2011 16:17:39
950,430
09/17/2011 16:17:39
1
0
Is there a better way to benchmark a C program than timing?
I'm coding a little program that has to sort a large array (up to 4 million text strings). Seems like I'm doing a good job, since a combination of radixsort and mergesort already cut the original q(uick)sort execution time in less than half. **Execution time** being the main point, since this is what I'm using to *benchmark* my piece of code. <br> My question is: Is there a better (i. e. more reliable) way of benchmarking a program than just time the execution? It kinda works, but the same program (with the same background processes running) usually has slightly different execution times if run twice. This kinda defeats the purpose of detecting small improvements. And several small improvements could add up to a big one... Thanks in advance for any input! <br> Regards Dennis
c
sorting
benchmarking
null
null
null
open
Is there a better way to benchmark a C program than timing? === I'm coding a little program that has to sort a large array (up to 4 million text strings). Seems like I'm doing a good job, since a combination of radixsort and mergesort already cut the original q(uick)sort execution time in less than half. **Execution time** being the main point, since this is what I'm using to *benchmark* my piece of code. <br> My question is: Is there a better (i. e. more reliable) way of benchmarking a program than just time the execution? It kinda works, but the same program (with the same background processes running) usually has slightly different execution times if run twice. This kinda defeats the purpose of detecting small improvements. And several small improvements could add up to a big one... Thanks in advance for any input! <br> Regards Dennis
0
4,535,784
12/26/2010 23:07:18
542,308
12/14/2010 17:36:50
482
7
Why isn't this javascript code working?
var arrayi = new Array(); for (var i=0; i<=9; i++) { for (var o=0; o<=9; o++) { arrayi[i][o]=i + o; } } for (var i = 0, j = 9; i <= 9; i++, j--) document.write("arrayi[" + i + "][" + j + "]= " + arrayi[i][j]); I'm trying to assign 00 to arrayi[0][0], 62 to arrayi[6][2] etc.. and then display [0][9], [1][8]...
javascript
arrays
multidimensional-array
multidimensional
null
null
open
Why isn't this javascript code working? === var arrayi = new Array(); for (var i=0; i<=9; i++) { for (var o=0; o<=9; o++) { arrayi[i][o]=i + o; } } for (var i = 0, j = 9; i <= 9; i++, j--) document.write("arrayi[" + i + "][" + j + "]= " + arrayi[i][j]); I'm trying to assign 00 to arrayi[0][0], 62 to arrayi[6][2] etc.. and then display [0][9], [1][8]...
0
11,525,464
07/17/2012 15:07:52
1,445,873
06/09/2012 06:49:49
1
0
Rails 2 with mysql on heroku
want to upload the application with mysql on heroku is it is possible i dont want to use pg because in my application lots of place mysql query are using and using rails 2.3.8
mysql
ruby-on-rails
heroku
null
null
07/17/2012 15:22:46
off topic
Rails 2 with mysql on heroku === want to upload the application with mysql on heroku is it is possible i dont want to use pg because in my application lots of place mysql query are using and using rails 2.3.8
2
8,978,969
01/23/2012 21:38:21
269,751
02/09/2010 18:58:59
11
1
mod_rewrite Redirecting to last part of the URL
I want to redirect http://127.0.0.1/upload/load/1/www.google.com to www.google.com Where http://127.0.0.1/upload/load/ remains same for every url and last part /1/www.google.com changes to /2/www.amazon.com/ , /3/www.aol.com and so on. I tried doing this but its giving me redirect loop error. My htaccess file looks like this. Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule ^admin$ Admin/index.php?qstr=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
.htaccess
mod-rewrite
null
null
null
01/24/2012 13:48:24
off topic
mod_rewrite Redirecting to last part of the URL === I want to redirect http://127.0.0.1/upload/load/1/www.google.com to www.google.com Where http://127.0.0.1/upload/load/ remains same for every url and last part /1/www.google.com changes to /2/www.amazon.com/ , /3/www.aol.com and so on. I tried doing this but its giving me redirect loop error. My htaccess file looks like this. Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule ^admin$ Admin/index.php?qstr=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/?$ index.php?qstr=$1 [L]
2
10,112,470
04/11/2012 19:18:44
1,269,828
03/14/2012 18:35:19
1
0
How to use LoadImage and DeleteObject properly?
I am working on a windows application with C++. I load a bmp file to a DC using LoadImage, and it shows up properly. However, when I call DeleteObject, the memory doesn't seem to be freed. (I use windows task manager to track the memory usage) In the WM_INITDIALOG part I do this: static HBITMAP hBitmap = 0; char* tempPath = "tabView.bmp"; hBitmap = (HBITMAP)LoadImage(NULL, tempPath, // file containing bitmap IMAGE_BITMAP, // type = bitmap 0, 0, // original size LR_LOADFROMFILE); // get image from a file if(hBitmap) { SendMessage(GetDlgItem(hwndDlg, IDC_PICTURE), STM_SETIMAGE, // message to send (WPARAM)IMAGE_BITMAP, // bitmap type (LPARAM)hBitmap); // bitmap handle } So the picture shows up in the DC, and memory increases. And in a button I do: int result = DeleteObject(hBitmap); When I press the button, I checked the result and it's a non-zero value, which is success. But IDC_PICTURE will still show the picture, and memory stays the same. I am wondering if the SendMessage() may increase the ref count on the hBitmap... So my question is: What is the proper way to clean up? I had check [msdn](http://msdn.microsoft.com/en-us/library/windows/desktop/ms648045(v=vs.85).aspx)... They don't have good exmaple.
c++
winapi
null
null
null
null
open
How to use LoadImage and DeleteObject properly? === I am working on a windows application with C++. I load a bmp file to a DC using LoadImage, and it shows up properly. However, when I call DeleteObject, the memory doesn't seem to be freed. (I use windows task manager to track the memory usage) In the WM_INITDIALOG part I do this: static HBITMAP hBitmap = 0; char* tempPath = "tabView.bmp"; hBitmap = (HBITMAP)LoadImage(NULL, tempPath, // file containing bitmap IMAGE_BITMAP, // type = bitmap 0, 0, // original size LR_LOADFROMFILE); // get image from a file if(hBitmap) { SendMessage(GetDlgItem(hwndDlg, IDC_PICTURE), STM_SETIMAGE, // message to send (WPARAM)IMAGE_BITMAP, // bitmap type (LPARAM)hBitmap); // bitmap handle } So the picture shows up in the DC, and memory increases. And in a button I do: int result = DeleteObject(hBitmap); When I press the button, I checked the result and it's a non-zero value, which is success. But IDC_PICTURE will still show the picture, and memory stays the same. I am wondering if the SendMessage() may increase the ref count on the hBitmap... So my question is: What is the proper way to clean up? I had check [msdn](http://msdn.microsoft.com/en-us/library/windows/desktop/ms648045(v=vs.85).aspx)... They don't have good exmaple.
0
2,964,638
06/03/2010 09:25:53
357,288
06/03/2010 09:25:53
1
0
Crash after pop'ing stack while a threaded NSURLConnection is open
Error Log says: bool _WebTryThreadLock(bool), 0x3c689f0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now... App structure: worker threads are detached from the MainThread as new data is needed via user interaction, each worker thread feeds data into its own slot in an array. The problem arises only when I use the NavigationController to go "back" to the previous view WHILE a thread is still gathering data. I've tried to send a [NSThread exit] to each thread upon viewWillDisappear thats not going to work... Any suggestions on thread clean-up upon poppin' the view controller?
multithreading
uinavigationcontroller
nsurlconnection
null
null
null
open
Crash after pop'ing stack while a threaded NSURLConnection is open === Error Log says: bool _WebTryThreadLock(bool), 0x3c689f0: Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be a result of calling to UIKit from a secondary thread. Crashing now... App structure: worker threads are detached from the MainThread as new data is needed via user interaction, each worker thread feeds data into its own slot in an array. The problem arises only when I use the NavigationController to go "back" to the previous view WHILE a thread is still gathering data. I've tried to send a [NSThread exit] to each thread upon viewWillDisappear thats not going to work... Any suggestions on thread clean-up upon poppin' the view controller?
0
6,361,051
06/15/2011 16:29:34
799,946
06/15/2011 15:52:36
1
0
PHP Curl script generating duplicate requests.
I have a PHP Curl based function that is used for various requests in an application. The function is normally used to communicate/trigger requests on other servers on same machine (localhost). The function is below: - /** * @desc If a curl_multi handle is passed, a new curl instance is added to the handle and the curl id is returned as string. * @param string $theServer * @param string $thePath * @param number $thePort * @param curl_multi $mcHandle * @return string|curl_handle */ function sendPOSTtoURL($theServer, $thePath, $theData, $thePort = 80, $mcHandle = null) { global $bDebug; $theResult = ""; //$bDebug = true; $cPost = curl_init(); if ($cPost !== false) { curl_setopt($cPost, CURLOPT_URL, "http://".$theServer.$thePath); if ($thePort != 80) curl_setopt($cPost, CURLOPT_PORT, $thePort); // Set port if different from 80 curl_setopt($cPost, CURLOPT_HEADER, false); curl_setopt($cPost, CURLOPT_FORBID_REUSE, true); curl_setopt($cPost, CURLOPT_FRESH_CONNECT, true); curl_setopt ($cPost, CURLOPT_POST, true); curl_setopt ($cPost, CURLOPT_POSTFIELDS, $theData); curl_setopt ($cPost, CURLOPT_RETURNTRANSFER, true); $returndata = curl_exec ($cPost); if ($mcHandle == null) { if (! $theResult = curl_exec($cPost)) { if (curl_errno($cPost) > 0) { $theResult = CURL_ERROR; if ($bDebug) $theResult .= fcURLError($cPost); } else { $theResult = CURL_NOERR_NOINFO; if ($bDebug) $theResult .= fcURLError($cPost); } } curl_close($cPost); return $theResult; } else { curl_multi_add_handle($mcHandle, $cPost); return $cPost; } } else return CURL_INIT_FAIL; } I wont go into complexities, but it is designed to return text if it is a single request or a curl handle is appended if a multi_curl handle is passed. The issue is, when I request it to do a task on a remote server, it does a double request. We have a setup where the requesting server is connected to remote server via VPN and can do a requests to external Internet through it. I thought the target server was running it twice so I made a call (for doing an email) from the calling server as follows: - $aEmail = array("email_address" => $sEmailAddress, "email_subject" => $sEmailSubject, "email_body" => $sEmailBody); echo sendPOSTtoURL("<REMOTE IP HERE", "/emailService/doMail.php?rand=".mt_rand(), $aEmail); the call to mt_rand generates a random number so I can identify each request. This is what I got at the remote server: - <CALLING IP> - - [15/Jun/2011:20:39:57 +0500] "POST /emailService/doMail.php?rand=1551627310 HTTP/1.1" 200 1060 "-" "-" <CALLING IP> - - [15/Jun/2011:20:40:01 +0500] "POST /emailService/doMail.php?rand=1551627310 HTTP/1.1" 200 1060 "-" "-" As you can see, the same request came in twice. and what do you think happens? right, 2 emails to the target! I cant (due to managerial [S@#$] reasons) develop logic to handle this on the Remote server. Can ANYONE HELP? Pretty please with sugar lumps and cherries and strawberries on top...!
php
http
php5
curl
http-post
06/16/2011 13:45:22
not a real question
PHP Curl script generating duplicate requests. === I have a PHP Curl based function that is used for various requests in an application. The function is normally used to communicate/trigger requests on other servers on same machine (localhost). The function is below: - /** * @desc If a curl_multi handle is passed, a new curl instance is added to the handle and the curl id is returned as string. * @param string $theServer * @param string $thePath * @param number $thePort * @param curl_multi $mcHandle * @return string|curl_handle */ function sendPOSTtoURL($theServer, $thePath, $theData, $thePort = 80, $mcHandle = null) { global $bDebug; $theResult = ""; //$bDebug = true; $cPost = curl_init(); if ($cPost !== false) { curl_setopt($cPost, CURLOPT_URL, "http://".$theServer.$thePath); if ($thePort != 80) curl_setopt($cPost, CURLOPT_PORT, $thePort); // Set port if different from 80 curl_setopt($cPost, CURLOPT_HEADER, false); curl_setopt($cPost, CURLOPT_FORBID_REUSE, true); curl_setopt($cPost, CURLOPT_FRESH_CONNECT, true); curl_setopt ($cPost, CURLOPT_POST, true); curl_setopt ($cPost, CURLOPT_POSTFIELDS, $theData); curl_setopt ($cPost, CURLOPT_RETURNTRANSFER, true); $returndata = curl_exec ($cPost); if ($mcHandle == null) { if (! $theResult = curl_exec($cPost)) { if (curl_errno($cPost) > 0) { $theResult = CURL_ERROR; if ($bDebug) $theResult .= fcURLError($cPost); } else { $theResult = CURL_NOERR_NOINFO; if ($bDebug) $theResult .= fcURLError($cPost); } } curl_close($cPost); return $theResult; } else { curl_multi_add_handle($mcHandle, $cPost); return $cPost; } } else return CURL_INIT_FAIL; } I wont go into complexities, but it is designed to return text if it is a single request or a curl handle is appended if a multi_curl handle is passed. The issue is, when I request it to do a task on a remote server, it does a double request. We have a setup where the requesting server is connected to remote server via VPN and can do a requests to external Internet through it. I thought the target server was running it twice so I made a call (for doing an email) from the calling server as follows: - $aEmail = array("email_address" => $sEmailAddress, "email_subject" => $sEmailSubject, "email_body" => $sEmailBody); echo sendPOSTtoURL("<REMOTE IP HERE", "/emailService/doMail.php?rand=".mt_rand(), $aEmail); the call to mt_rand generates a random number so I can identify each request. This is what I got at the remote server: - <CALLING IP> - - [15/Jun/2011:20:39:57 +0500] "POST /emailService/doMail.php?rand=1551627310 HTTP/1.1" 200 1060 "-" "-" <CALLING IP> - - [15/Jun/2011:20:40:01 +0500] "POST /emailService/doMail.php?rand=1551627310 HTTP/1.1" 200 1060 "-" "-" As you can see, the same request came in twice. and what do you think happens? right, 2 emails to the target! I cant (due to managerial [S@#$] reasons) develop logic to handle this on the Remote server. Can ANYONE HELP? Pretty please with sugar lumps and cherries and strawberries on top...!
1
10,246,476
04/20/2012 12:42:58
1,034,723
11/08/2011 00:22:22
26
1
How to delete all encrypted cookies javascript?
There are some other answers for this problem but i want to know that if it is possible to delete the cookie of encrypted site ?!! If yes how ? thanks
javascript
session
cookies
delete
null
04/22/2012 14:38:11
off topic
How to delete all encrypted cookies javascript? === There are some other answers for this problem but i want to know that if it is possible to delete the cookie of encrypted site ?!! If yes how ? thanks
2
7,277,547
09/01/2011 22:57:28
924,378
09/01/2011 22:57:28
1
0
How to get multiple pages in Eclipse???? [PLEASE HELP]
This is so confusing. I going to need *alot* more pages in my Android app. But I don't see where I'd do that.... This is what my Eclipse looks like: http://img202.imageshack.us/img202/4227/unled2qir.png
android
eclipse
game-development
app
page
09/02/2011 00:54:53
not a real question
How to get multiple pages in Eclipse???? [PLEASE HELP] === This is so confusing. I going to need *alot* more pages in my Android app. But I don't see where I'd do that.... This is what my Eclipse looks like: http://img202.imageshack.us/img202/4227/unled2qir.png
1
7,387,595
09/12/2011 12:09:26
940,499
09/12/2011 12:09:26
1
0
admin credentials not working at localhost but working on live server
I am getting scrolled in finding the problem with my project, kindly help me out, one of my project developed in codeigniter is working fine on live server its admin credentials allow me to login into admin panel, everything goes fine on live server. I transferred this project along with database from live server to WAMP , configured it properly but on my localhost when i try to give admin login credentials and hit submit it redirects me to the login page again, this never happens on live server. mod_rewrite and CURL are working fine on my Wamp server, i don't know whats going wrong. Kindly help me out. Regards Yousuf
codeigniter
project
null
null
null
09/12/2011 12:39:30
not a real question
admin credentials not working at localhost but working on live server === I am getting scrolled in finding the problem with my project, kindly help me out, one of my project developed in codeigniter is working fine on live server its admin credentials allow me to login into admin panel, everything goes fine on live server. I transferred this project along with database from live server to WAMP , configured it properly but on my localhost when i try to give admin login credentials and hit submit it redirects me to the login page again, this never happens on live server. mod_rewrite and CURL are working fine on my Wamp server, i don't know whats going wrong. Kindly help me out. Regards Yousuf
1
9,256,382
02/13/2012 06:27:24
671,045
03/22/2011 10:54:30
772
10
C#.Net SMTP Email Send Failure
If I've list of emailTo address and one of them is invalid. Does `client.Send(email);` returns failure/Exception?
c#
null
null
null
null
02/13/2012 13:43:35
not a real question
C#.Net SMTP Email Send Failure === If I've list of emailTo address and one of them is invalid. Does `client.Send(email);` returns failure/Exception?
1
9,551,504
03/04/2012 01:26:40
1,163,963
01/22/2012 21:36:11
20
0
gzopen function does no exists with PHP 5.4
With the new PHP 5.4 gzopen function does not exist. All other functions except gzopen Zlib exist. I did a test and it shows me this > Zlip exists > > gzopen does no exists <?php echo (extension_loaded('zlib')) ? 'Zlip exists' : 'Zlip does no exists'; echo '<br />'; echo (function_exists('gzopen')) ? 'gziopen exists' : 'gzopen does no exists'; ?> Do you have a reason for that?
php
gzip
php-5.4
null
null
03/06/2012 22:35:20
not a real question
gzopen function does no exists with PHP 5.4 === With the new PHP 5.4 gzopen function does not exist. All other functions except gzopen Zlib exist. I did a test and it shows me this > Zlip exists > > gzopen does no exists <?php echo (extension_loaded('zlib')) ? 'Zlip exists' : 'Zlip does no exists'; echo '<br />'; echo (function_exists('gzopen')) ? 'gziopen exists' : 'gzopen does no exists'; ?> Do you have a reason for that?
1
5,346,406
03/17/2011 23:11:27
112,670
05/26/2009 16:58:58
155
7
Android: How to make AlertDialog with 2 Text Lines and RadioButton (Single Choice) ?
How to make a List Dialog with rows like this: |-----------------------------| | FIRST LINE OF TEXT (o) | <- this is a "RadioButton" | second line of text | |-----------------------------| I know I should use a custom adapter, passing a row layout with those views (actually, I've made this). But the RadioButton does not get selected when I click on the row. Is it possible that the dialog manage the radiobuttons it self?
android
android-layout
alertdialog
null
null
null
open
Android: How to make AlertDialog with 2 Text Lines and RadioButton (Single Choice) ? === How to make a List Dialog with rows like this: |-----------------------------| | FIRST LINE OF TEXT (o) | <- this is a "RadioButton" | second line of text | |-----------------------------| I know I should use a custom adapter, passing a row layout with those views (actually, I've made this). But the RadioButton does not get selected when I click on the row. Is it possible that the dialog manage the radiobuttons it self?
0
6,995,112
08/09/2011 10:58:43
448,559
09/15/2010 15:06:54
865
48
Framekiller killer get site to which tried to redirect
I built a HTML+JS app which I use for my own mystical reasons. This thing uses IFrame to display webpages in the middle of the application. I implemented a simple framekiller killer: window.onbeforeunload = function(e){ e.preventDefault(); e.stopPropagation(); return false; } Which, generally, works fine. The problem is that some sites, upon form submission, desperately try to break out of the frame's constraint which is blocked by frame killer. As a side effect, I am unable to submit such forms without killing the app. Is it somehow possible, to force the sites I display, to aim their form submission at the iframe, not the very top of the display tree?
javascript
iframe
null
null
null
null
open
Framekiller killer get site to which tried to redirect === I built a HTML+JS app which I use for my own mystical reasons. This thing uses IFrame to display webpages in the middle of the application. I implemented a simple framekiller killer: window.onbeforeunload = function(e){ e.preventDefault(); e.stopPropagation(); return false; } Which, generally, works fine. The problem is that some sites, upon form submission, desperately try to break out of the frame's constraint which is blocked by frame killer. As a side effect, I am unable to submit such forms without killing the app. Is it somehow possible, to force the sites I display, to aim their form submission at the iframe, not the very top of the display tree?
0
11,338,164
07/05/2012 05:18:46
1,135,201
01/06/2012 21:17:15
28
0
remove the holes in an image by average values of surrounding pixels
![Gray Scale Image with Holes][1] [1]: http://i.stack.imgur.com/v8ujV.jpg can any one please help me in filling these black holes by values taken from neighboring non-zero pixels. thanks
matlab
image-processing
interpolation
null
null
null
open
remove the holes in an image by average values of surrounding pixels === ![Gray Scale Image with Holes][1] [1]: http://i.stack.imgur.com/v8ujV.jpg can any one please help me in filling these black holes by values taken from neighboring non-zero pixels. thanks
0
8,487,893
12/13/2011 10:49:36
1,095,548
12/13/2011 10:41:35
1
0
Generate all the points on the circumference of a circle
Could someone help me with a code that could generate all the points on the circumference of a circle, Given the radius and center of the circle. I need the code in Python. Also could someone explain what would happen if K-Means is applied to two sets of points (i mean the points on the circumference) for 2 circle with same center but different radius. How would the clustering happen.
python
null
null
null
null
12/14/2011 11:59:49
not a real question
Generate all the points on the circumference of a circle === Could someone help me with a code that could generate all the points on the circumference of a circle, Given the radius and center of the circle. I need the code in Python. Also could someone explain what would happen if K-Means is applied to two sets of points (i mean the points on the circumference) for 2 circle with same center but different radius. How would the clustering happen.
1
6,376,228
06/16/2011 17:42:03
586,307
01/23/2011 11:35:27
19
1
Android Listview animations that don't suck
I was looking here. http://android-er.blogspot.com/2009/10/listview-and-listactivity-layout.html It... sucks. One at at time? Also where can I find some cooler effects? Google is giving me that page like 6 times on 6 sites. Hurray for SEO .
android
android-listview
android-animation
null
null
07/23/2011 23:33:59
not constructive
Android Listview animations that don't suck === I was looking here. http://android-er.blogspot.com/2009/10/listview-and-listactivity-layout.html It... sucks. One at at time? Also where can I find some cooler effects? Google is giving me that page like 6 times on 6 sites. Hurray for SEO .
4
5,723,869
04/19/2011 23:18:20
464,988
10/03/2010 04:28:19
3,974
239
NSInvalidArgumentException when calling selector with arguments
I'm trying to execute a method using selector with one NSString as parameter and fails. I have seen many questions (and answers) like this and tried most solutions but had no success. Please see code and errors below: My `MainView.m` is my view controller and it has a method: -(void)displayMessageOnTextView:(NSString *)message { [tv1 setText:message]; } And in `MainView.h`: @interface MainView : UIViewController { UITextView *tv1; } -(void)displayMessageOnTextView:(NSString *)message; .... I have another thread which is fired by MainView (this is from `MainView.m`): - (void) runTest { MyThread *t = [[MyThread alloc] initWithInt:13253]; [t setMainView:self]; [t run]; [t release]; } and `MyThread.m`: #import "MyThread.h" #import "MainView.h" @implementation MyThread MainView *_view; -(id)initWithInt:(int)someInt{ _view = NULL; return self; } -(void)setMainView:(MainView*)view { _view = view; } -(int)run{ NSString *s = [NSString stringWithFormat:@"Display on Gui:%d", 1]; [_view performSelectorOnMainThread:@selector(displayMessageOnTextView:message:) withObject:s waitUntilDone:YES]; } @end Error: 2011-04-20 02:08:11.553 myApp[22627:207] -[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0 2011-04-20 02:08:11.555 myApp[22627:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0' *** Call stack at first throw: ( 0 CoreFoundation 0x00dc55a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x00f19313 objc_exception_throw + 44 2 CoreFoundation 0x00dc70bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x00d36966 ___forwarding___ + 966 4 CoreFoundation 0x00d36522 _CF_forwarding_prep_0 + 50 5 Foundation 0x0079e94e __NSThreadPerformPerform + 251 6 CoreFoundation 0x00da68ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 7 CoreFoundation 0x00d0488b __CFRunLoopDoSources0 + 571 8 CoreFoundation 0x00d03d86 __CFRunLoopRun + 470 9 CoreFoundation 0x00d03840 CFRunLoopRunSpecific + 208 10 CoreFoundation 0x00d03761 CFRunLoopRunInMode + 97 11 GraphicsServices 0x00ffd1c4 GSEventRunModal + 217 12 GraphicsServices 0x00ffd289 GSEventRun + 115 13 UIKit 0x00025c93 UIApplicationMain + 1160 14 myApp 0x000024c9 main + 121 15 myApp 0x00002445 start + 53 ) terminate called after throwing an instance of 'NSException' NOTE:<br/> I'm new to Objective-C (and generally iOS) programming, so any comment regarding coding conventions and best practice will be appreciated (even if not related to my question, but related to my code)
objective-c
selector
invalidargumentexception
null
null
null
open
NSInvalidArgumentException when calling selector with arguments === I'm trying to execute a method using selector with one NSString as parameter and fails. I have seen many questions (and answers) like this and tried most solutions but had no success. Please see code and errors below: My `MainView.m` is my view controller and it has a method: -(void)displayMessageOnTextView:(NSString *)message { [tv1 setText:message]; } And in `MainView.h`: @interface MainView : UIViewController { UITextView *tv1; } -(void)displayMessageOnTextView:(NSString *)message; .... I have another thread which is fired by MainView (this is from `MainView.m`): - (void) runTest { MyThread *t = [[MyThread alloc] initWithInt:13253]; [t setMainView:self]; [t run]; [t release]; } and `MyThread.m`: #import "MyThread.h" #import "MainView.h" @implementation MyThread MainView *_view; -(id)initWithInt:(int)someInt{ _view = NULL; return self; } -(void)setMainView:(MainView*)view { _view = view; } -(int)run{ NSString *s = [NSString stringWithFormat:@"Display on Gui:%d", 1]; [_view performSelectorOnMainThread:@selector(displayMessageOnTextView:message:) withObject:s waitUntilDone:YES]; } @end Error: 2011-04-20 02:08:11.553 myApp[22627:207] -[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0 2011-04-20 02:08:11.555 myApp[22627:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MainView displayMessageOnTextView:message:]: unrecognized selector sent to instance 0x4e383a0' *** Call stack at first throw: ( 0 CoreFoundation 0x00dc55a9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x00f19313 objc_exception_throw + 44 2 CoreFoundation 0x00dc70bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x00d36966 ___forwarding___ + 966 4 CoreFoundation 0x00d36522 _CF_forwarding_prep_0 + 50 5 Foundation 0x0079e94e __NSThreadPerformPerform + 251 6 CoreFoundation 0x00da68ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 7 CoreFoundation 0x00d0488b __CFRunLoopDoSources0 + 571 8 CoreFoundation 0x00d03d86 __CFRunLoopRun + 470 9 CoreFoundation 0x00d03840 CFRunLoopRunSpecific + 208 10 CoreFoundation 0x00d03761 CFRunLoopRunInMode + 97 11 GraphicsServices 0x00ffd1c4 GSEventRunModal + 217 12 GraphicsServices 0x00ffd289 GSEventRun + 115 13 UIKit 0x00025c93 UIApplicationMain + 1160 14 myApp 0x000024c9 main + 121 15 myApp 0x00002445 start + 53 ) terminate called after throwing an instance of 'NSException' NOTE:<br/> I'm new to Objective-C (and generally iOS) programming, so any comment regarding coding conventions and best practice will be appreciated (even if not related to my question, but related to my code)
0
8,979,163
01/23/2012 21:54:56
655,187
03/11/2011 10:35:50
467
37
checkbox not working for device and jquerymobile
just working on a simple signup form with devise and i use jquerymobile for my mobile layout but whenever i try to sign up and i check the checkbox it does no send the value to the database. how can i fix this. My sign up form is as follows <div data-role="page" class="home" class="ui-seablue" data-theme="b" data-backbtn="true" > <header data-role="header" data-theme="a" class="heading"> <h1 >SignIn</h1> <nav data-role="navbar" align="CENTER" id="navbar" data-iconpos="bottom"> <ul> <li> <%= link_to "Home", root_url, :class => "nav-link", "data-icon"=>"home", "data-theme"=>"a"%> </li> <li> <%= link_to "SignIn/SignUp", new_user_session_path, :class => "nav-link", "data-icon"=>"gear", "data-theme"=>"a" %> </li> </ul> </nav> </header><!-- /header --> <div data-role="content" data-tab="tab-content" class="ui-seablue"> <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> <div data-role="fieldcontain"> <%= f.label :name, "Art name/username" %> <%= f.text_field :name %> </div> <div data-role="fieldcontain"> <%= f.label :artist, "Check the box below to register as an artist" %> <%= f.check_box :artist %> </div> <div data-role="fieldcontain"> <%= f.label :real_name, "Real name" %> <%= f.text_field :real_name %> </div> <div data-role="fieldcontain"> <%= f.label :email %> <%= f.email_field :email %> </div> <div data-role="fieldcontain"> <%= f.label :password %> <%= f.password_field :password %> </div> <div data-role="fieldcontain"> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation %> </div> <div class="ui-body ui-body-a double-margin-top"> <%= f.submit "Sign Up", :class => "button" %> <%= link_to "Sign In", new_user_session_path, "data-role" => "button" %> </div> <% end %> </div><!-- /content --> <div data-role="footer" class="maroon-deep" align="CENTER" id="footer"> <a>Powered by Rzaartz </a> </div><!-- /footer --> </div><!-- /page --> When i check the box and i check my server log to see the problem it shows that the value is 0 and my server log says Started POST "/users" for 127.0.0.1 at 2012-01-23 22:52:54 +0100 Processing by Devise::RegistrationsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"RhK5gALMrn5I+C8EYIBnoRED6A8ZyqDk+wPwYBNDtao=", "user"=>{"name"=>"abiodun", "artist"=>"0", "real_name"=>"rzaartz", "email"=>"a@y.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"} (0.2ms) BEGIN (0.7ms) SELECT 1 FROM `users` WHERE `users`.`email` = BINARY 'a@y.com' LIMIT 1 (0.7ms) SELECT 1 FROM `users` WHERE `users`.`name` = BINARY 'abiodun' LIMIT 1 SQL (0.6ms) INSERT INTO `users` (`about`, `admin`, `artist`, `confirmation_sent_at`, `confirmation_token`, `confirmed_at`, `created_at`, `current_sign_in_at`, `current_sign_in_ip`, `email`, `encrypted_password`, `facebook_username`, `icon_content_type`, `icon_file_name`, `icon_file_size`, `icon_updated_at`, `last_sign_in_at`, `last_sign_in_ip`, `name`, `notes_count`, `permalink`, `pictures_count`, `real_name`, `remember_created_at`, `reset_password_sent_at`, `reset_password_token`, `rpx_identifier`, `sign_in_count`, `songs_count`, `twitter_username`, `updated_at`, `username`, `videos_count`) VALUES (NULL, 0, 0, NULL, NULL, NULL, '2012-01-23 21:52:55', NULL, NULL, 'a@y.com', '$2a$10$YLXChJBa/7HAobRvCFwGUO2j5/TMezdPxKVs5WofJJwx1l/K5xqta', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'abiodun', 0, 'abiodun', 0, 'rzaartz', NULL, NULL, NULL, NULL, 0, 0, NULL, '2012-01-23 21:52:55', NULL, 0) [paperclip] Saving attachments. (1.4ms) COMMIT (0.2ms) BEGIN (0.6ms) UPDATE `users` SET `last_sign_in_at` = '2012-01-23 21:52:55', `current_sign_in_at` = '2012-01-23 21:52:55', `last_sign_in_ip` = '127.0.0.1', `current_sign_in_ip` = '127.0.0.1', `sign_in_count` = 1, `updated_at` = '2012-01-23 21:52:55' WHERE `users`.`id` = 2 [paperclip] Saving attachments.
ruby-on-rails
ruby-on-rails-3
ruby-on-rails-3.1
jquery-mobile
devise
null
open
checkbox not working for device and jquerymobile === just working on a simple signup form with devise and i use jquerymobile for my mobile layout but whenever i try to sign up and i check the checkbox it does no send the value to the database. how can i fix this. My sign up form is as follows <div data-role="page" class="home" class="ui-seablue" data-theme="b" data-backbtn="true" > <header data-role="header" data-theme="a" class="heading"> <h1 >SignIn</h1> <nav data-role="navbar" align="CENTER" id="navbar" data-iconpos="bottom"> <ul> <li> <%= link_to "Home", root_url, :class => "nav-link", "data-icon"=>"home", "data-theme"=>"a"%> </li> <li> <%= link_to "SignIn/SignUp", new_user_session_path, :class => "nav-link", "data-icon"=>"gear", "data-theme"=>"a" %> </li> </ul> </nav> </header><!-- /header --> <div data-role="content" data-tab="tab-content" class="ui-seablue"> <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %> <div data-role="fieldcontain"> <%= f.label :name, "Art name/username" %> <%= f.text_field :name %> </div> <div data-role="fieldcontain"> <%= f.label :artist, "Check the box below to register as an artist" %> <%= f.check_box :artist %> </div> <div data-role="fieldcontain"> <%= f.label :real_name, "Real name" %> <%= f.text_field :real_name %> </div> <div data-role="fieldcontain"> <%= f.label :email %> <%= f.email_field :email %> </div> <div data-role="fieldcontain"> <%= f.label :password %> <%= f.password_field :password %> </div> <div data-role="fieldcontain"> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation %> </div> <div class="ui-body ui-body-a double-margin-top"> <%= f.submit "Sign Up", :class => "button" %> <%= link_to "Sign In", new_user_session_path, "data-role" => "button" %> </div> <% end %> </div><!-- /content --> <div data-role="footer" class="maroon-deep" align="CENTER" id="footer"> <a>Powered by Rzaartz </a> </div><!-- /footer --> </div><!-- /page --> When i check the box and i check my server log to see the problem it shows that the value is 0 and my server log says Started POST "/users" for 127.0.0.1 at 2012-01-23 22:52:54 +0100 Processing by Devise::RegistrationsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"RhK5gALMrn5I+C8EYIBnoRED6A8ZyqDk+wPwYBNDtao=", "user"=>{"name"=>"abiodun", "artist"=>"0", "real_name"=>"rzaartz", "email"=>"a@y.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Sign Up"} (0.2ms) BEGIN (0.7ms) SELECT 1 FROM `users` WHERE `users`.`email` = BINARY 'a@y.com' LIMIT 1 (0.7ms) SELECT 1 FROM `users` WHERE `users`.`name` = BINARY 'abiodun' LIMIT 1 SQL (0.6ms) INSERT INTO `users` (`about`, `admin`, `artist`, `confirmation_sent_at`, `confirmation_token`, `confirmed_at`, `created_at`, `current_sign_in_at`, `current_sign_in_ip`, `email`, `encrypted_password`, `facebook_username`, `icon_content_type`, `icon_file_name`, `icon_file_size`, `icon_updated_at`, `last_sign_in_at`, `last_sign_in_ip`, `name`, `notes_count`, `permalink`, `pictures_count`, `real_name`, `remember_created_at`, `reset_password_sent_at`, `reset_password_token`, `rpx_identifier`, `sign_in_count`, `songs_count`, `twitter_username`, `updated_at`, `username`, `videos_count`) VALUES (NULL, 0, 0, NULL, NULL, NULL, '2012-01-23 21:52:55', NULL, NULL, 'a@y.com', '$2a$10$YLXChJBa/7HAobRvCFwGUO2j5/TMezdPxKVs5WofJJwx1l/K5xqta', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'abiodun', 0, 'abiodun', 0, 'rzaartz', NULL, NULL, NULL, NULL, 0, 0, NULL, '2012-01-23 21:52:55', NULL, 0) [paperclip] Saving attachments. (1.4ms) COMMIT (0.2ms) BEGIN (0.6ms) UPDATE `users` SET `last_sign_in_at` = '2012-01-23 21:52:55', `current_sign_in_at` = '2012-01-23 21:52:55', `last_sign_in_ip` = '127.0.0.1', `current_sign_in_ip` = '127.0.0.1', `sign_in_count` = 1, `updated_at` = '2012-01-23 21:52:55' WHERE `users`.`id` = 2 [paperclip] Saving attachments.
0
8,237,920
11/23/2011 06:00:39
944,844
09/14/2011 14:24:00
8
0
How to introduce a small delay while in UIView?
How can one introduce a small delay between the time when view loads till the time something shows up. A half a second would be fine. Is there a more graceful way to handle this other then `sleep (1)`
uiview
delay
null
null
null
null
open
How to introduce a small delay while in UIView? === How can one introduce a small delay between the time when view loads till the time something shows up. A half a second would be fine. Is there a more graceful way to handle this other then `sleep (1)`
0
6,328,950
06/13/2011 09:57:24
795,723
06/13/2011 09:57:24
1
0
Raw, unprocessed URL with APS.NET Routing
I'm using ASP.NET UrlRoutingModule directly (_not through MVC_) to map certain routes to their handlers: RouteTable.Routes.Add(new Route("products/{name}", handler)); Then, at request time, I'm getting the values from each route: RouteData routeData = HttpContext.Current.Request.RequestContext.RouteData; routeData.Values.TryGetValue("name", out value); Everything fine so far, I'm getting the proper values for each route. My problem is encoding: I want to get the **raw** value of a route data. Example: for the route above, if the requested URL is http://example.com/products/word%2Dword the resulted "name" is "**word-word**". What I want though is the exact value "**word%2Dword**". I know that with ASP.NET I can get the row unprocessed URL using Request.ServerVariables["HTTP_URL"] but unfortunately I cannot use this here. Any help would be appreciated. Thanks
asp.net
url-routing
null
null
null
null
open
Raw, unprocessed URL with APS.NET Routing === I'm using ASP.NET UrlRoutingModule directly (_not through MVC_) to map certain routes to their handlers: RouteTable.Routes.Add(new Route("products/{name}", handler)); Then, at request time, I'm getting the values from each route: RouteData routeData = HttpContext.Current.Request.RequestContext.RouteData; routeData.Values.TryGetValue("name", out value); Everything fine so far, I'm getting the proper values for each route. My problem is encoding: I want to get the **raw** value of a route data. Example: for the route above, if the requested URL is http://example.com/products/word%2Dword the resulted "name" is "**word-word**". What I want though is the exact value "**word%2Dword**". I know that with ASP.NET I can get the row unprocessed URL using Request.ServerVariables["HTTP_URL"] but unfortunately I cannot use this here. Any help would be appreciated. Thanks
0
9,944,732
03/30/2012 14:18:09
512,602
11/18/2010 18:59:09
338
20
windows.find safari behavior
I managed to get a cross-browser window.find javascript function. There is an inpout field for the search text and a find button With IE, Firefox and Chrome I'm happy: search can find the next occurence repeatedly and, **most importantly**, when the user changes the search string, **the search is performed from the top of the page**, which is fine. But NOT with Safari: When the search string is changed, the user MUST click at the top of the page for the search to be performed again. Have a go? Here is the page in question (get rid of the "_"): minisims.v_u_b_ridge.com/default.aspx Anybody aware and have a fix?
safari
behavior
window.open
null
null
null
open
windows.find safari behavior === I managed to get a cross-browser window.find javascript function. There is an inpout field for the search text and a find button With IE, Firefox and Chrome I'm happy: search can find the next occurence repeatedly and, **most importantly**, when the user changes the search string, **the search is performed from the top of the page**, which is fine. But NOT with Safari: When the search string is changed, the user MUST click at the top of the page for the search to be performed again. Have a go? Here is the page in question (get rid of the "_"): minisims.v_u_b_ridge.com/default.aspx Anybody aware and have a fix?
0
787,525
04/24/2009 20:48:04
9,752
09/15/2008 19:52:57
11
2
C# and Interfaces - Explicit vs. Implicit
In C#, if a class has all the correct methods/signatures for an Interface, but doesn't explicitly implement it like: class foo : IDoo {} Can the class still be cast as that interface?
c#
null
null
null
null
null
open
C# and Interfaces - Explicit vs. Implicit === In C#, if a class has all the correct methods/signatures for an Interface, but doesn't explicitly implement it like: class foo : IDoo {} Can the class still be cast as that interface?
0
7,531,827
09/23/2011 16:05:27
917,649
08/29/2011 10:44:26
16
1
Android WIFI data to controller - best way?
Is possible to receive data from android device to my controller through WIFI? which one is the best way to receive and transmit data through wifi ? how can i design my hardware? Any WIFI direct is need to communicate? kindly give some ideas to do. Thanks in advance.
android
wifi
android-wifi
android-hardware
null
09/23/2011 22:12:03
not a real question
Android WIFI data to controller - best way? === Is possible to receive data from android device to my controller through WIFI? which one is the best way to receive and transmit data through wifi ? how can i design my hardware? Any WIFI direct is need to communicate? kindly give some ideas to do. Thanks in advance.
1
3,747,347
09/19/2010 20:30:05
445,762
09/12/2010 20:23:35
1
0
how to narrow Google query to educational institution only(but not just to American ones)
I often search educational institutions websites with the following Google query my_query site:.edu or my_query site:edu.pl or my_query site:edu.au but it only crawls through American, Polish and Australian ones respectively. In most countries top level domain for universities is the country domain and edu is only a sub-domain, like amu.edu.pl for a uni in Poland. How can I query all edu subdomains in one query, independently of the tld they are in? for example how to search: myquery site:edu.au site:edu.pl site:edu domains with one google query Have tried some regular expressions and wildcard characters but without spectacular success. Anybody came across the same problem?
regex
google
education
wildcard
university
09/20/2010 10:24:23
off topic
how to narrow Google query to educational institution only(but not just to American ones) === I often search educational institutions websites with the following Google query my_query site:.edu or my_query site:edu.pl or my_query site:edu.au but it only crawls through American, Polish and Australian ones respectively. In most countries top level domain for universities is the country domain and edu is only a sub-domain, like amu.edu.pl for a uni in Poland. How can I query all edu subdomains in one query, independently of the tld they are in? for example how to search: myquery site:edu.au site:edu.pl site:edu domains with one google query Have tried some regular expressions and wildcard characters but without spectacular success. Anybody came across the same problem?
2
8,046,788
11/08/2011 06:39:22
1,035,059
11/08/2011 06:20:52
1
0
C# - How to monitor a process' file read/write operations?
I thought this could've been a common question, but it has been very difficult to find an answer. I've tried searching here and other forums with no luck. I'm writing a C# (.net version 4) program to monitor a process. It already raises an event when the process starts and when it stops, but I also need to check where is this process reading from and writing to; specially writing to since I know this process writes a large amount of data every time it runs. We process batches of data, and the path where the process writes to contains the Batch ID, which is an important piece of information to log the results of the process. I've looked into the System.Diagnostics.Process.BeginOutputReadLine method, but since the documentation says that StandardOutput must be redirected, I'm not sure if this can be done on a process that is currently running, or if it affects the write operation originally intended by the process. It is a console application in C#. If anyone have any idea on how to do this, it would be much appreciated. Thanks in advance!
c#
output
monitoring
null
null
null
open
C# - How to monitor a process' file read/write operations? === I thought this could've been a common question, but it has been very difficult to find an answer. I've tried searching here and other forums with no luck. I'm writing a C# (.net version 4) program to monitor a process. It already raises an event when the process starts and when it stops, but I also need to check where is this process reading from and writing to; specially writing to since I know this process writes a large amount of data every time it runs. We process batches of data, and the path where the process writes to contains the Batch ID, which is an important piece of information to log the results of the process. I've looked into the System.Diagnostics.Process.BeginOutputReadLine method, but since the documentation says that StandardOutput must be redirected, I'm not sure if this can be done on a process that is currently running, or if it affects the write operation originally intended by the process. It is a console application in C#. If anyone have any idea on how to do this, it would be much appreciated. Thanks in advance!
0
1,614,143
10/23/2009 15:14:42
195,386
10/23/2009 15:14:42
1
0
Visual Studio 2010 Beta 2 and PHP
Seems like Visual Studio 2010 Beta 2 has PHP syntax highlighting. But is there any way to create PHP files or projects from VS itself? If yes, how can I create one? P.S. Don't suggest vs.php (jcx.software) please, as I'm looking for it's alternative.
php
visual
visual-studio-2010
null
null
null
open
Visual Studio 2010 Beta 2 and PHP === Seems like Visual Studio 2010 Beta 2 has PHP syntax highlighting. But is there any way to create PHP files or projects from VS itself? If yes, how can I create one? P.S. Don't suggest vs.php (jcx.software) please, as I'm looking for it's alternative.
0
11,483,935
07/14/2012 12:56:01
1,345,195
04/19/2012 22:04:14
1
0
About codecave funcations
I have a source for loader + dll, to load the score from the pinball game to console .. Now, to the loader have a Inject func. that inject the dll .. And if we look into the source code, we find this lines: // Write out the address for the user32 dll address user32Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the MessageBoxA address msgboxAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the injected DLL's module dllAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // User32 Dll Name user32NameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(user32Name) + 1; memcpy(workspace + workspaceIndex, user32Name, dwTmpSize); workspaceIndex += dwTmpSize; // MessageBoxA name msgboxNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(msgboxName) + 1; memcpy(workspace + workspaceIndex, msgboxName, dwTmpSize); workspaceIndex += dwTmpSize; // Dll Name dllNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectDllName) + 1; memcpy(workspace + workspaceIndex, injectDllName, dwTmpSize); workspaceIndex += dwTmpSize; // Function Name funcNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectFuncName) + 1; memcpy(workspace + workspaceIndex, injectFuncName, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 1 error0Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError0) + 1; memcpy(workspace + workspaceIndex, injectError0, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 2 error1Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError1) + 1; memcpy(workspace + workspaceIndex, injectError1, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 3 error2Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError2) + 1; memcpy(workspace + workspaceIndex, injectError2, dwTmpSize); workspaceIndex += dwTmpSize; // Pad a few INT3s after string data is written for seperation workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; // Store where the codecave execution should begin codecaveExecAddr = workspaceIndex + dwCodecaveAddress; // For debugging - infinite loop, attach onto process and step over //workspace[workspaceIndex++] = 0xEB; //workspace[workspaceIndex++] = 0xFE; //------------------------------------------// // User32.dll loading. // //------------------------------------------// // User32 DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &user32NameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MessageBoxA Loading // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &msgboxNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; //------------------------------------------// // Injected dll loading. // //------------------------------------------// // DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &dllNameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1E to skip over eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1E; // Error Code 1 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error1Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, [ADDRESS] - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; ... The question is what its realy does ? I know there is a comments, but you can explain or give me a tutorial for more of this ? And we can switch it with ASM code ? How .. ? Tnx guys .. Btw, Here the full Source: #include <windows.h> #include <stdio.h> // Inject a DLL into a process void Inject(HANDLE hProcess, const char* dllname, const char* funcname); // Program entry point int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // Structures for creating the process STARTUPINFO si = {0}; PROCESS_INFORMATION pi = {0}; BOOL result = FALSE; // Strings for creating the program char exeString[MAX_PATH + 1] = {0}; char workingDir[MAX_PATH + 1] = {0}; // Holds where the DLL should be char dllPath[MAX_PATH + 1] = {0}; // Get the current directory GetCurrentDirectory(MAX_PATH, workingDir); // Build the full path to the exe _snprintf(exeString, MAX_PATH, "\"%s\\PINBALL.EXE\" -quick", workingDir); // Set the static path of where the Inject DLL is, hardcoded for a demo _snprintf(dllPath, MAX_PATH, "PinballCodecave.dll"); // Need to set this for the structure si.cb = sizeof(STARTUPINFO); // Try to load our process result = CreateProcess(NULL, exeString, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, workingDir, &si, &pi); if(!result) { MessageBox(0, "Process could not be loaded!", "Error", MB_ICONERROR); return -1; } // Inject the DLL, the export function is named 'Initialize' Inject(pi.hProcess, dllPath, "Initialize"); // Resume process execution ResumeThread(pi.hThread); // Standard return return 0; } /***************************************************************************************************/ // Function: // Inject // // Parameters: // HANDLE hProcess - The handle to the process to inject the DLL into. // // const char* dllname - The name of the DLL to inject into the process. // // const char* funcname - The name of the function to call once the DLL has been injected. // // Description: // This function will inject a DLL into a process and execute an exported function // from the DLL to "initialize" it. The function should be in the format shown below, // not parameters and no return type. Do not forget to prefix extern "C" if you are in C++ // // __declspec(dllexport) void FunctionName(void) // // The function that is called in the injected DLL // -MUST- return, the loader waits for the thread to terminate before removing the // allocated space and returning control to the Loader. This method of DLL injection // also adds error handling, so the end user knows if something went wrong. /***************************************************************************************************/ void Inject(HANDLE hProcess, const char* dllname, const char* funcname) { //------------------------------------------// // Function variables. // //------------------------------------------// // Main DLL we will need to load HMODULE kernel32 = NULL; // Main functions we will need to import FARPROC loadlibrary = NULL; FARPROC getprocaddress = NULL; FARPROC exitprocess = NULL; FARPROC exitthread = NULL; FARPROC freelibraryandexitthread = NULL; // The workspace we will build the codecave on locally LPBYTE workspace = NULL; DWORD workspaceIndex = 0; // The memory in the process we write to LPVOID codecaveAddress = NULL; DWORD dwCodecaveAddress = 0; // Strings we have to write into the process char injectDllName[MAX_PATH + 1] = {0}; char injectFuncName[MAX_PATH + 1] = {0}; char injectError0[MAX_PATH + 1] = {0}; char injectError1[MAX_PATH + 1] = {0}; char injectError2[MAX_PATH + 1] = {0}; char user32Name[MAX_PATH + 1] = {0}; char msgboxName[MAX_PATH + 1] = {0}; // Placeholder addresses to use the strings DWORD user32NameAddr = 0; DWORD user32Addr = 0; DWORD msgboxNameAddr = 0; DWORD msgboxAddr = 0; DWORD dllAddr = 0; DWORD dllNameAddr = 0; DWORD funcNameAddr = 0; DWORD error0Addr = 0; DWORD error1Addr = 0; DWORD error2Addr = 0; // Where the codecave execution should begin at DWORD codecaveExecAddr = 0; // Handle to the thread we create in the process HANDLE hThread = NULL; // Temp variables DWORD dwTmpSize = 0; // Old protection on page we are writing to in the process and the bytes written DWORD oldProtect = 0; DWORD bytesRet = 0; //------------------------------------------// // Variable initialization. // //------------------------------------------// // Get the address of the main DLL kernel32 = LoadLibrary("kernel32.dll"); // Get our functions loadlibrary = GetProcAddress(kernel32, "LoadLibraryA"); getprocaddress = GetProcAddress(kernel32, "GetProcAddress"); exitprocess = GetProcAddress(kernel32, "ExitProcess"); exitthread = GetProcAddress(kernel32, "ExitThread"); freelibraryandexitthread = GetProcAddress(kernel32, "FreeLibraryAndExitThread"); // This section will cause compiler warnings on VS8, // you can upgrade the functions or ignore them // Build names _snprintf(injectDllName, MAX_PATH, "%s", dllname); _snprintf(injectFuncName, MAX_PATH, "%s", funcname); _snprintf(user32Name, MAX_PATH, "user32.dll"); _snprintf(msgboxName, MAX_PATH, "MessageBoxA"); // Build error messages _snprintf(injectError0, MAX_PATH, "Error"); _snprintf(injectError1, MAX_PATH, "Could not load the dll: %s", injectDllName); _snprintf(injectError2, MAX_PATH, "Could not load the function: %s", injectFuncName); // Create the workspace workspace = (LPBYTE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1024); // Allocate space for the codecave in the process codecaveAddress = VirtualAllocEx(hProcess, 0, 1024, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); dwCodecaveAddress = PtrToUlong(codecaveAddress); // Note there is no error checking done above for any functions that return a pointer/handle. // I could have added them, but it'd just add more messiness to the code and not provide any real // benefit. It's up to you though in your final code if you want it there or not. //------------------------------------------// // Data and string writing. // //------------------------------------------// // Write out the address for the user32 dll address user32Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the MessageBoxA address msgboxAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the injected DLL's module dllAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // User32 Dll Name user32NameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(user32Name) + 1; memcpy(workspace + workspaceIndex, user32Name, dwTmpSize); workspaceIndex += dwTmpSize; // MessageBoxA name msgboxNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(msgboxName) + 1; memcpy(workspace + workspaceIndex, msgboxName, dwTmpSize); workspaceIndex += dwTmpSize; // Dll Name dllNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectDllName) + 1; memcpy(workspace + workspaceIndex, injectDllName, dwTmpSize); workspaceIndex += dwTmpSize; // Function Name funcNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectFuncName) + 1; memcpy(workspace + workspaceIndex, injectFuncName, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 1 error0Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError0) + 1; memcpy(workspace + workspaceIndex, injectError0, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 2 error1Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError1) + 1; memcpy(workspace + workspaceIndex, injectError1, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 3 error2Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError2) + 1; memcpy(workspace + workspaceIndex, injectError2, dwTmpSize); workspaceIndex += dwTmpSize; // Pad a few INT3s after string data is written for seperation workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; // Store where the codecave execution should begin codecaveExecAddr = workspaceIndex + dwCodecaveAddress; // For debugging - infinite loop, attach onto process and step over //workspace[workspaceIndex++] = 0xEB; //workspace[workspaceIndex++] = 0xFE; //------------------------------------------// // User32.dll loading. // //------------------------------------------// // User32 DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &user32NameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MessageBoxA Loading // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &msgboxNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; //------------------------------------------// // Injected dll loading. // //------------------------------------------// // DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &dllNameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1E to skip over eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1E; // Error Code 1 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error1Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, [ADDRESS] - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Now we have the address of the injected DLL, so save the handle // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &dllAddr, 4); workspaceIndex += 4; // Load the initilize function from it // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &funcNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1C to skip eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1C; // Error Code 2 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error2Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // Now that we have the address of the function, we cam call it, // if there was an error, the messagebox would be called as well. // CALL EAX - Call ExitProcess -or- the Initialize function workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // If we get here, the Initialize function has been called, // so it's time to close this thread and optionally unload the DLL. //------------------------------------------// // Exiting from the injected dll. // //------------------------------------------// // Call ExitThread to leave the DLL loaded #if 1 // Push 0 (exit code) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitThread into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitthread, 4); workspaceIndex += 4; // CALL EAX - Call ExitThread workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; #endif // Call FreeLibraryAndExitThread to unload DLL #if 0 // Push 0 (exit code) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // PUSH [0x000000] - Push the address of the DLL module to unload workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0x35; memcpy(workspace + workspaceIndex, &dllAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of FreeLibraryAndExitThread into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &freelibraryandexitthread, 4); workspaceIndex += 4; // CALL EAX - Call FreeLibraryAndExitThread workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; #endif //------------------------------------------// // Code injection and cleanup. // //------------------------------------------// // Change page protection so we can write executable code VirtualProtectEx(hProcess, codecaveAddress, workspaceIndex, PAGE_EXECUTE_READWRITE, &oldProtect); // Write out the patch WriteProcessMemory(hProcess, codecaveAddress, workspace, workspaceIndex, &bytesRet); // Restore page protection VirtualProtectEx(hProcess, codecaveAddress, workspaceIndex, oldProtect, &oldProtect); // Make sure our changes are written right away FlushInstructionCache(hProcess, codecaveAddress, workspaceIndex); // Free the workspace memory HeapFree(GetProcessHeap(), 0, workspace); // Execute the thread now and wait for it to exit, note we execute where the code starts, and not the codecave start // (since we wrote strings at the start of the codecave) -- NOTE: void* used for VC6 compatibility instead of UlongToPtr hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)((void*)codecaveExecAddr), 0, 0, NULL); WaitForSingleObject(hThread, INFINITE); // Free the memory in the process that we allocated VirtualFreeEx(hProcess, codecaveAddress, 0, MEM_RELEASE); }
c++
visual-c++
assembly
dll-injection
null
07/14/2012 14:33:05
not a real question
About codecave funcations === I have a source for loader + dll, to load the score from the pinball game to console .. Now, to the loader have a Inject func. that inject the dll .. And if we look into the source code, we find this lines: // Write out the address for the user32 dll address user32Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the MessageBoxA address msgboxAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the injected DLL's module dllAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // User32 Dll Name user32NameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(user32Name) + 1; memcpy(workspace + workspaceIndex, user32Name, dwTmpSize); workspaceIndex += dwTmpSize; // MessageBoxA name msgboxNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(msgboxName) + 1; memcpy(workspace + workspaceIndex, msgboxName, dwTmpSize); workspaceIndex += dwTmpSize; // Dll Name dllNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectDllName) + 1; memcpy(workspace + workspaceIndex, injectDllName, dwTmpSize); workspaceIndex += dwTmpSize; // Function Name funcNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectFuncName) + 1; memcpy(workspace + workspaceIndex, injectFuncName, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 1 error0Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError0) + 1; memcpy(workspace + workspaceIndex, injectError0, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 2 error1Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError1) + 1; memcpy(workspace + workspaceIndex, injectError1, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 3 error2Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError2) + 1; memcpy(workspace + workspaceIndex, injectError2, dwTmpSize); workspaceIndex += dwTmpSize; // Pad a few INT3s after string data is written for seperation workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; // Store where the codecave execution should begin codecaveExecAddr = workspaceIndex + dwCodecaveAddress; // For debugging - infinite loop, attach onto process and step over //workspace[workspaceIndex++] = 0xEB; //workspace[workspaceIndex++] = 0xFE; //------------------------------------------// // User32.dll loading. // //------------------------------------------// // User32 DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &user32NameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MessageBoxA Loading // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &msgboxNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; //------------------------------------------// // Injected dll loading. // //------------------------------------------// // DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &dllNameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1E to skip over eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1E; // Error Code 1 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error1Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, [ADDRESS] - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; ... The question is what its realy does ? I know there is a comments, but you can explain or give me a tutorial for more of this ? And we can switch it with ASM code ? How .. ? Tnx guys .. Btw, Here the full Source: #include <windows.h> #include <stdio.h> // Inject a DLL into a process void Inject(HANDLE hProcess, const char* dllname, const char* funcname); // Program entry point int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { // Structures for creating the process STARTUPINFO si = {0}; PROCESS_INFORMATION pi = {0}; BOOL result = FALSE; // Strings for creating the program char exeString[MAX_PATH + 1] = {0}; char workingDir[MAX_PATH + 1] = {0}; // Holds where the DLL should be char dllPath[MAX_PATH + 1] = {0}; // Get the current directory GetCurrentDirectory(MAX_PATH, workingDir); // Build the full path to the exe _snprintf(exeString, MAX_PATH, "\"%s\\PINBALL.EXE\" -quick", workingDir); // Set the static path of where the Inject DLL is, hardcoded for a demo _snprintf(dllPath, MAX_PATH, "PinballCodecave.dll"); // Need to set this for the structure si.cb = sizeof(STARTUPINFO); // Try to load our process result = CreateProcess(NULL, exeString, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, workingDir, &si, &pi); if(!result) { MessageBox(0, "Process could not be loaded!", "Error", MB_ICONERROR); return -1; } // Inject the DLL, the export function is named 'Initialize' Inject(pi.hProcess, dllPath, "Initialize"); // Resume process execution ResumeThread(pi.hThread); // Standard return return 0; } /***************************************************************************************************/ // Function: // Inject // // Parameters: // HANDLE hProcess - The handle to the process to inject the DLL into. // // const char* dllname - The name of the DLL to inject into the process. // // const char* funcname - The name of the function to call once the DLL has been injected. // // Description: // This function will inject a DLL into a process and execute an exported function // from the DLL to "initialize" it. The function should be in the format shown below, // not parameters and no return type. Do not forget to prefix extern "C" if you are in C++ // // __declspec(dllexport) void FunctionName(void) // // The function that is called in the injected DLL // -MUST- return, the loader waits for the thread to terminate before removing the // allocated space and returning control to the Loader. This method of DLL injection // also adds error handling, so the end user knows if something went wrong. /***************************************************************************************************/ void Inject(HANDLE hProcess, const char* dllname, const char* funcname) { //------------------------------------------// // Function variables. // //------------------------------------------// // Main DLL we will need to load HMODULE kernel32 = NULL; // Main functions we will need to import FARPROC loadlibrary = NULL; FARPROC getprocaddress = NULL; FARPROC exitprocess = NULL; FARPROC exitthread = NULL; FARPROC freelibraryandexitthread = NULL; // The workspace we will build the codecave on locally LPBYTE workspace = NULL; DWORD workspaceIndex = 0; // The memory in the process we write to LPVOID codecaveAddress = NULL; DWORD dwCodecaveAddress = 0; // Strings we have to write into the process char injectDllName[MAX_PATH + 1] = {0}; char injectFuncName[MAX_PATH + 1] = {0}; char injectError0[MAX_PATH + 1] = {0}; char injectError1[MAX_PATH + 1] = {0}; char injectError2[MAX_PATH + 1] = {0}; char user32Name[MAX_PATH + 1] = {0}; char msgboxName[MAX_PATH + 1] = {0}; // Placeholder addresses to use the strings DWORD user32NameAddr = 0; DWORD user32Addr = 0; DWORD msgboxNameAddr = 0; DWORD msgboxAddr = 0; DWORD dllAddr = 0; DWORD dllNameAddr = 0; DWORD funcNameAddr = 0; DWORD error0Addr = 0; DWORD error1Addr = 0; DWORD error2Addr = 0; // Where the codecave execution should begin at DWORD codecaveExecAddr = 0; // Handle to the thread we create in the process HANDLE hThread = NULL; // Temp variables DWORD dwTmpSize = 0; // Old protection on page we are writing to in the process and the bytes written DWORD oldProtect = 0; DWORD bytesRet = 0; //------------------------------------------// // Variable initialization. // //------------------------------------------// // Get the address of the main DLL kernel32 = LoadLibrary("kernel32.dll"); // Get our functions loadlibrary = GetProcAddress(kernel32, "LoadLibraryA"); getprocaddress = GetProcAddress(kernel32, "GetProcAddress"); exitprocess = GetProcAddress(kernel32, "ExitProcess"); exitthread = GetProcAddress(kernel32, "ExitThread"); freelibraryandexitthread = GetProcAddress(kernel32, "FreeLibraryAndExitThread"); // This section will cause compiler warnings on VS8, // you can upgrade the functions or ignore them // Build names _snprintf(injectDllName, MAX_PATH, "%s", dllname); _snprintf(injectFuncName, MAX_PATH, "%s", funcname); _snprintf(user32Name, MAX_PATH, "user32.dll"); _snprintf(msgboxName, MAX_PATH, "MessageBoxA"); // Build error messages _snprintf(injectError0, MAX_PATH, "Error"); _snprintf(injectError1, MAX_PATH, "Could not load the dll: %s", injectDllName); _snprintf(injectError2, MAX_PATH, "Could not load the function: %s", injectFuncName); // Create the workspace workspace = (LPBYTE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 1024); // Allocate space for the codecave in the process codecaveAddress = VirtualAllocEx(hProcess, 0, 1024, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE); dwCodecaveAddress = PtrToUlong(codecaveAddress); // Note there is no error checking done above for any functions that return a pointer/handle. // I could have added them, but it'd just add more messiness to the code and not provide any real // benefit. It's up to you though in your final code if you want it there or not. //------------------------------------------// // Data and string writing. // //------------------------------------------// // Write out the address for the user32 dll address user32Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the MessageBoxA address msgboxAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // Write out the address for the injected DLL's module dllAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = 0; memcpy(workspace + workspaceIndex, &dwTmpSize, 4); workspaceIndex += 4; // User32 Dll Name user32NameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(user32Name) + 1; memcpy(workspace + workspaceIndex, user32Name, dwTmpSize); workspaceIndex += dwTmpSize; // MessageBoxA name msgboxNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(msgboxName) + 1; memcpy(workspace + workspaceIndex, msgboxName, dwTmpSize); workspaceIndex += dwTmpSize; // Dll Name dllNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectDllName) + 1; memcpy(workspace + workspaceIndex, injectDllName, dwTmpSize); workspaceIndex += dwTmpSize; // Function Name funcNameAddr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectFuncName) + 1; memcpy(workspace + workspaceIndex, injectFuncName, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 1 error0Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError0) + 1; memcpy(workspace + workspaceIndex, injectError0, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 2 error1Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError1) + 1; memcpy(workspace + workspaceIndex, injectError1, dwTmpSize); workspaceIndex += dwTmpSize; // Error Message 3 error2Addr = workspaceIndex + dwCodecaveAddress; dwTmpSize = (DWORD)strlen(injectError2) + 1; memcpy(workspace + workspaceIndex, injectError2, dwTmpSize); workspaceIndex += dwTmpSize; // Pad a few INT3s after string data is written for seperation workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; workspace[workspaceIndex++] = 0xCC; // Store where the codecave execution should begin codecaveExecAddr = workspaceIndex + dwCodecaveAddress; // For debugging - infinite loop, attach onto process and step over //workspace[workspaceIndex++] = 0xEB; //workspace[workspaceIndex++] = 0xFE; //------------------------------------------// // User32.dll loading. // //------------------------------------------// // User32 DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &user32NameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MessageBoxA Loading // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &msgboxNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; //------------------------------------------// // Injected dll loading. // //------------------------------------------// // DLL Loading // PUSH 0x00000000 - Push the address of the DLL name to use in LoadLibraryA workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &dllNameAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of LoadLibraryA into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &loadlibrary, 4); workspaceIndex += 4; // CALL EAX - Call LoadLibraryA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1E to skip over eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1E; // Error Code 1 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error1Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, [ADDRESS] - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Now we have the address of the injected DLL, so save the handle // MOV [ADDRESS], EAX - Save the address to our variable workspace[workspaceIndex++] = 0xA3; memcpy(workspace + workspaceIndex, &dllAddr, 4); workspaceIndex += 4; // Load the initilize function from it // PUSH 0x000000 - Push the address of the function name to load workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &funcNameAddr, 4); workspaceIndex += 4; // Push EAX, module to use in GetProcAddress workspace[workspaceIndex++] = 0x50; // MOV EAX, ADDRESS - Move the address of GetProcAddress into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &getprocaddress, 4); workspaceIndex += 4; // CALL EAX - Call GetProcAddress workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // Error Checking // CMP EAX, 0 workspace[workspaceIndex++] = 0x83; workspace[workspaceIndex++] = 0xF8; workspace[workspaceIndex++] = 0x00; // JNZ EIP + 0x1C to skip eror code workspace[workspaceIndex++] = 0x75; workspace[workspaceIndex++] = 0x1C; // Error Code 2 // MessageBox // PUSH 0x10 (MB_ICONHAND) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x10; // PUSH 0x000000 - Push the address of the MessageBox title workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error0Addr, 4); workspaceIndex += 4; // PUSH 0x000000 - Push the address of the MessageBox message workspace[workspaceIndex++] = 0x68; memcpy(workspace + workspaceIndex, &error2Addr, 4); workspaceIndex += 4; // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of MessageBoxA into EAX workspace[workspaceIndex++] = 0xA1; memcpy(workspace + workspaceIndex, &msgboxAddr, 4); workspaceIndex += 4; // CALL EAX - Call MessageBoxA workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // ExitProcess // Push 0 workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitProcess into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitprocess, 4); workspaceIndex += 4; // Now that we have the address of the function, we cam call it, // if there was an error, the messagebox would be called as well. // CALL EAX - Call ExitProcess -or- the Initialize function workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; // If we get here, the Initialize function has been called, // so it's time to close this thread and optionally unload the DLL. //------------------------------------------// // Exiting from the injected dll. // //------------------------------------------// // Call ExitThread to leave the DLL loaded #if 1 // Push 0 (exit code) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // MOV EAX, ADDRESS - Move the address of ExitThread into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &exitthread, 4); workspaceIndex += 4; // CALL EAX - Call ExitThread workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; #endif // Call FreeLibraryAndExitThread to unload DLL #if 0 // Push 0 (exit code) workspace[workspaceIndex++] = 0x6A; workspace[workspaceIndex++] = 0x00; // PUSH [0x000000] - Push the address of the DLL module to unload workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0x35; memcpy(workspace + workspaceIndex, &dllAddr, 4); workspaceIndex += 4; // MOV EAX, ADDRESS - Move the address of FreeLibraryAndExitThread into EAX workspace[workspaceIndex++] = 0xB8; memcpy(workspace + workspaceIndex, &freelibraryandexitthread, 4); workspaceIndex += 4; // CALL EAX - Call FreeLibraryAndExitThread workspace[workspaceIndex++] = 0xFF; workspace[workspaceIndex++] = 0xD0; #endif //------------------------------------------// // Code injection and cleanup. // //------------------------------------------// // Change page protection so we can write executable code VirtualProtectEx(hProcess, codecaveAddress, workspaceIndex, PAGE_EXECUTE_READWRITE, &oldProtect); // Write out the patch WriteProcessMemory(hProcess, codecaveAddress, workspace, workspaceIndex, &bytesRet); // Restore page protection VirtualProtectEx(hProcess, codecaveAddress, workspaceIndex, oldProtect, &oldProtect); // Make sure our changes are written right away FlushInstructionCache(hProcess, codecaveAddress, workspaceIndex); // Free the workspace memory HeapFree(GetProcessHeap(), 0, workspace); // Execute the thread now and wait for it to exit, note we execute where the code starts, and not the codecave start // (since we wrote strings at the start of the codecave) -- NOTE: void* used for VC6 compatibility instead of UlongToPtr hThread = CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)((void*)codecaveExecAddr), 0, 0, NULL); WaitForSingleObject(hThread, INFINITE); // Free the memory in the process that we allocated VirtualFreeEx(hProcess, codecaveAddress, 0, MEM_RELEASE); }
1
3,270,249
07/17/2010 04:26:19
394,474
07/17/2010 04:26:19
1
0
Email has been compromised!
I have a cart script on my website that will collect information, and then send an email to the admin and the user. The email will auto send from info@website.com info@website does not actually exist, but on the server i have set the options to fwd any mails addressed to info@website.com to my main email. as of recently i am receiving DELIVERY FAILURE emails to info@website.com that fwd to me. something is sending emails from info@website.com randomly with spam links to emails of what seems to be legitimate email addresses. Any way to fix this, or have i just been F*ed? thanks!
email
hacked
null
null
null
07/17/2010 05:05:30
off topic
Email has been compromised! === I have a cart script on my website that will collect information, and then send an email to the admin and the user. The email will auto send from info@website.com info@website does not actually exist, but on the server i have set the options to fwd any mails addressed to info@website.com to my main email. as of recently i am receiving DELIVERY FAILURE emails to info@website.com that fwd to me. something is sending emails from info@website.com randomly with spam links to emails of what seems to be legitimate email addresses. Any way to fix this, or have i just been F*ed? thanks!
2
9,143,519
02/04/2012 18:54:32
691,569
04/04/2011 17:54:04
83
8
Coming back from Camera Intent crashes Activity
I have an Activity that launches a Camera Intent like this (nothing special): Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File photo = new File(Environment.getExternalStorageDirectory(), filename); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); Uri imageUri = Uri.fromFile(photo); startActivityForResult(intent, CAMERA_REQUEST); Than I get the result in `onActivityResult()` and set the bitmap to an ImageView. Again, nothing special. The problem is that the Camera app is always in landscape. So if the user keeps the device in the horizontal orientation when they hit OK to send it back to my Activity, and my Activity was previously in portrait, then it crashes my activity because it has to rebuild it. If you tilt the device to portrait orientation before you tap OK in the camera, then it does not crash. How do I get around this?
android
android-intent
android-camera
null
null
null
open
Coming back from Camera Intent crashes Activity === I have an Activity that launches a Camera Intent like this (nothing special): Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); File photo = new File(Environment.getExternalStorageDirectory(), filename); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photo)); Uri imageUri = Uri.fromFile(photo); startActivityForResult(intent, CAMERA_REQUEST); Than I get the result in `onActivityResult()` and set the bitmap to an ImageView. Again, nothing special. The problem is that the Camera app is always in landscape. So if the user keeps the device in the horizontal orientation when they hit OK to send it back to my Activity, and my Activity was previously in portrait, then it crashes my activity because it has to rebuild it. If you tilt the device to portrait orientation before you tap OK in the camera, then it does not crash. How do I get around this?
0
8,326,750
11/30/2011 13:32:29
1,072,850
11/30/2011 07:37:47
18
0
Is there any quicker way of inserting 10 million records in a table from a select query in SQL
I wish to insert 10 million records into a table using a select query. This process is taking a very long time.. Are there any alternatives?
sql
database
oracle
query
pl
11/30/2011 16:11:37
not a real question
Is there any quicker way of inserting 10 million records in a table from a select query in SQL === I wish to insert 10 million records into a table using a select query. This process is taking a very long time.. Are there any alternatives?
1
10,427,323
05/03/2012 07:57:30
831,614
07/06/2011 13:01:42
165
6
Imperative vs Functional by example
I have a method implemented in imperative and functional (I did my best here) ways. The method iterates over ArrayBuffer[Creature], calculates distance to each creature and return the closest or None (if no creatures in the world except 'this'). Imperative: private def closestEnemy: Option[Creature] = { var closest: Option[Creature] = None var distanceToClosest = Int.MaxValue for(creature <- game.creatures if creature != this) { val distance = distanceTo(creature) if(distance < distanceToClosest) { closest = Some(creature) distanceToClosest = distance } } closest } Functional: private def closestEnemy: Option[Creature] = game.creatures filter { _ != this } map { creature => (creature, distanceTo(creature)) } match { case creaturesWithDistance if creaturesWithDistance.isEmpty => None case creaturesWithDistance => Some(creaturesWithDistance minBy { _._2 } _1) } The functional code looks less obvious (probably it can be simplified but I don't see how) and I'm not sure if I am able to read it on fly in a month. My question is it a matter of habit or functional isn't good for this particular case? Did you have such doubts when started Scala? Did your functional skills greatly improved after some time and totaly beat the imperative approach? Please post your experience. Thanks!
scala
functional-programming
imperative-programming
null
null
05/03/2012 14:49:35
not constructive
Imperative vs Functional by example === I have a method implemented in imperative and functional (I did my best here) ways. The method iterates over ArrayBuffer[Creature], calculates distance to each creature and return the closest or None (if no creatures in the world except 'this'). Imperative: private def closestEnemy: Option[Creature] = { var closest: Option[Creature] = None var distanceToClosest = Int.MaxValue for(creature <- game.creatures if creature != this) { val distance = distanceTo(creature) if(distance < distanceToClosest) { closest = Some(creature) distanceToClosest = distance } } closest } Functional: private def closestEnemy: Option[Creature] = game.creatures filter { _ != this } map { creature => (creature, distanceTo(creature)) } match { case creaturesWithDistance if creaturesWithDistance.isEmpty => None case creaturesWithDistance => Some(creaturesWithDistance minBy { _._2 } _1) } The functional code looks less obvious (probably it can be simplified but I don't see how) and I'm not sure if I am able to read it on fly in a month. My question is it a matter of habit or functional isn't good for this particular case? Did you have such doubts when started Scala? Did your functional skills greatly improved after some time and totaly beat the imperative approach? Please post your experience. Thanks!
4
7,294,661
09/03/2011 17:23:15
146,864
07/29/2009 06:30:41
342
9
Sessions Problem on iis7
i"m using sessions on the App_Code like this Session["SomeSession"] but i notic that the sessions only works for me local ( cassini ) on all the browsers but when i upload the website to the server IIS 7 windows 2008 r2 . i have problems with the sessions... please help!
.net
c#-4.0
iis7
null
null
09/05/2011 00:07:42
not a real question
Sessions Problem on iis7 === i"m using sessions on the App_Code like this Session["SomeSession"] but i notic that the sessions only works for me local ( cassini ) on all the browsers but when i upload the website to the server IIS 7 windows 2008 r2 . i have problems with the sessions... please help!
1
3,718,112
09/15/2010 13:34:39
448,457
09/15/2010 13:34:39
1
0
is there any way to ignore reading in certain lines in a text file?
I'm trying to read in a text file in a c# application, but I don't want to read the first two lines, or the last line. There's 8 lines in the file, so effectivly I just want to read in lines, 3, 4, 5, 6 and 7. Is there any way to do this?
c#
ignore
lines
null
null
null
open
is there any way to ignore reading in certain lines in a text file? === I'm trying to read in a text file in a c# application, but I don't want to read the first two lines, or the last line. There's 8 lines in the file, so effectivly I just want to read in lines, 3, 4, 5, 6 and 7. Is there any way to do this?
0
8,485,176
12/13/2011 06:22:18
1,075,118
12/01/2011 09:40:49
1
0
How to draw a railway route map between two particular points
in my application i want to display the railway route Map for Particular two points , i think it's possible when ever we get the railway stations in between the two points Any one knows reply me Thanks in Advance The map should appears like the below link http://www.holidayiq.com/Tpty-Puri-Exp-17480-Train.html
android-maps
null
null
null
null
12/13/2011 13:42:01
not a real question
How to draw a railway route map between two particular points === in my application i want to display the railway route Map for Particular two points , i think it's possible when ever we get the railway stations in between the two points Any one knows reply me Thanks in Advance The map should appears like the below link http://www.holidayiq.com/Tpty-Puri-Exp-17480-Train.html
1
4,946,385
02/09/2011 14:44:13
485,498
10/24/2010 08:50:27
317
6
What is the point of developing Visual C++ and C#?
I've been tinkering with Visual C++. But I have heard it isn't used much in industry. C# seems to be much more popular. This makes me wonder why MS bothered to keep both platforms in development? Is there something special that Visual C++ is used for that C# can't handle?
c#
c++
visual
studio
null
02/09/2011 14:52:51
not constructive
What is the point of developing Visual C++ and C#? === I've been tinkering with Visual C++. But I have heard it isn't used much in industry. C# seems to be much more popular. This makes me wonder why MS bothered to keep both platforms in development? Is there something special that Visual C++ is used for that C# can't handle?
4
6,995,135
08/09/2011 11:02:01
365,236
06/12/2010 12:57:31
8
0
How to notify a client from server using WCF
I am new in WCF. I want to notify a client from a server when some thing change in server. For example: suppose server has connected a database when database has changed then server notify client "Hey Client Database Has been Change Please Take some action" Please provide a full code example because i am new in wcf
wpf
wcf
c#-4.0
soap
soa
08/09/2011 11:08:14
not a real question
How to notify a client from server using WCF === I am new in WCF. I want to notify a client from a server when some thing change in server. For example: suppose server has connected a database when database has changed then server notify client "Hey Client Database Has been Change Please Take some action" Please provide a full code example because i am new in wcf
1
6,620,393
07/08/2011 05:45:29
815,370
06/25/2011 13:55:32
86
2
is it possible to alter css styles using javascript (NOT the style of an object, but the stylesheet itself)
is it possible to alter css stylesheet using javascript? i am NOT talking about: document.getElementById('id').style._____='.....'; i AM talking about altering: #id{ param='value'; } besides doing something dirty, which we havent tried yet btw, like creating a new object in the head, innerHTML a style tag in there, etc... although this, even if it did work, would pose a few issues as the styleblock is already defined elsewhere... and im not sure when / if the browser would even parse a dynamically created style block? once again, thanks, long live SO!
javascript
html
css
stylesheet
alter
null
open
is it possible to alter css styles using javascript (NOT the style of an object, but the stylesheet itself) === is it possible to alter css stylesheet using javascript? i am NOT talking about: document.getElementById('id').style._____='.....'; i AM talking about altering: #id{ param='value'; } besides doing something dirty, which we havent tried yet btw, like creating a new object in the head, innerHTML a style tag in there, etc... although this, even if it did work, would pose a few issues as the styleblock is already defined elsewhere... and im not sure when / if the browser would even parse a dynamically created style block? once again, thanks, long live SO!
0
1,250,600
08/09/2009 04:18:57
138,427
07/15/2009 01:37:35
8
0
Visual Studio ASP .Net MVC Intellisense
the vs 2008 intellisense doesn't work if i use it inside html attribute. example <form method="post" action="<%= Url.Action %>" while i'm typing Url.Action the code hint doesn't work, instead it gave me options of files that can be used for the "action" value. Is it normal that the intellisense doesn't work inside html attribute? or am'i missing something to fix this bug.
visual-studio-2008
intellisense
null
null
null
null
open
Visual Studio ASP .Net MVC Intellisense === the vs 2008 intellisense doesn't work if i use it inside html attribute. example <form method="post" action="<%= Url.Action %>" while i'm typing Url.Action the code hint doesn't work, instead it gave me options of files that can be used for the "action" value. Is it normal that the intellisense doesn't work inside html attribute? or am'i missing something to fix this bug.
0
7,460,089
09/18/2011 07:21:21
950,989
09/18/2011 07:09:01
1
0
How do you describe RESTful applications?
I am trying to build a pretty large web app. The server side of it will be built in a RESTful style architecture. Before I start coding at it I would like to model it first, and I was wondering if there are any tools for this, or if there is a standard way for doing this. Thanks
rest
null
null
null
null
09/18/2011 23:58:42
not constructive
How do you describe RESTful applications? === I am trying to build a pretty large web app. The server side of it will be built in a RESTful style architecture. Before I start coding at it I would like to model it first, and I was wondering if there are any tools for this, or if there is a standard way for doing this. Thanks
4
8,259,369
11/24/2011 15:27:42
899,064
08/17/2011 16:39:54
11
0
Race to decide the rank
N people participate in a race consist of many rounds. In a round, M people could race. We only record their rank and do not record their score. What is the minimum number of rounds we need to determine the K fastest people? It seems a classic problem. If you know, please tell me. Thank you!
algorithm
math
comparision
null
null
null
open
Race to decide the rank === N people participate in a race consist of many rounds. In a round, M people could race. We only record their rank and do not record their score. What is the minimum number of rounds we need to determine the K fastest people? It seems a classic problem. If you know, please tell me. Thank you!
0
8,575,859
12/20/2011 13:02:27
985,664
10/08/2011 18:26:12
37
2
PHP: pregmatch input field
I have a html form with text input field. I'm wondering how to recognize specific input from the form. Example input commands: <input type="text" name="action" value="bookmark http://google.com" /> <?php if ($command == "goto"): // go to website X elseif ($command == "bookmark"): // bookmark website X else: // something else endif; ?>
php
php5
html-form
null
null
null
open
PHP: pregmatch input field === I have a html form with text input field. I'm wondering how to recognize specific input from the form. Example input commands: <input type="text" name="action" value="bookmark http://google.com" /> <?php if ($command == "goto"): // go to website X elseif ($command == "bookmark"): // bookmark website X else: // something else endif; ?>
0
2,006,315
01/05/2010 13:37:45
227,103
12/08/2009 12:12:50
1
0
Create and fill an xml document with xmlbeans
Some time ago, I was using XmlBeans at work and had to create programmatically an xml from a schema. Back then, I compiled the schema using XmlBeans and then used some XmlBeans functionality (I cannot recall its name right now) to create a valid xml which had all the optional and required tags and attributes. I am leaving this question here so maybe someone could help me recall how to do this... (I also remember using Axis 2 so I am beginning to think that it was probably an Axis2 functionality?) Thanks a lot, if I remember it I will post it...
java
xmlbeans
null
null
null
null
open
Create and fill an xml document with xmlbeans === Some time ago, I was using XmlBeans at work and had to create programmatically an xml from a schema. Back then, I compiled the schema using XmlBeans and then used some XmlBeans functionality (I cannot recall its name right now) to create a valid xml which had all the optional and required tags and attributes. I am leaving this question here so maybe someone could help me recall how to do this... (I also remember using Axis 2 so I am beginning to think that it was probably an Axis2 functionality?) Thanks a lot, if I remember it I will post it...
0
9,420,700
02/23/2012 20:26:40
193,872
10/21/2009 14:41:24
143
9
FYI: ASP.NET MVC 4 beta and TypeMock Isolator 6.0.3 don't play nicely
After installing the beta, I created a unit test project to exercise a WebAPI app. This is the first line of my TestMethod, and it blew up: HttpClient client = new HttpClient(); Boom! *System.Security.VerificationException: Operation could destabilize the runtime.* I verified this on 2 machines, and then asked a friend to try it on his. He could not reproduce the error. After disabling all my VS2010 extensions, I realized TypeMock Isolator was still running. Disabling it fixed this issue. Unfortunately, I don't have access to a newer version of Isolator, but I do know this happens on v6.0.3. I'll also add that I did not test this prior to installing MVC 4 beta, so it's possible the issue existed prior to this. Hope this saves someone else some time.
asp.net-mvc-4
typemock-isolator
verificationexception
null
null
02/23/2012 20:42:40
not a real question
FYI: ASP.NET MVC 4 beta and TypeMock Isolator 6.0.3 don't play nicely === After installing the beta, I created a unit test project to exercise a WebAPI app. This is the first line of my TestMethod, and it blew up: HttpClient client = new HttpClient(); Boom! *System.Security.VerificationException: Operation could destabilize the runtime.* I verified this on 2 machines, and then asked a friend to try it on his. He could not reproduce the error. After disabling all my VS2010 extensions, I realized TypeMock Isolator was still running. Disabling it fixed this issue. Unfortunately, I don't have access to a newer version of Isolator, but I do know this happens on v6.0.3. I'll also add that I did not test this prior to installing MVC 4 beta, so it's possible the issue existed prior to this. Hope this saves someone else some time.
1
10,715,893
05/23/2012 08:08:31
1,017,824
10/28/2011 06:19:47
20
0
How to convert this PHP regex into JS
I have the following RegEx that works in PHP, but I can't figure out how to convert it so that it works in JS. $string='test/again/' preg_replace('/[^\/]+\/$/', '', $string) this takes this: test/again/ and makes it into: test/ Thanks for your help.
php
javascript
regex
null
null
05/24/2012 08:29:30
too localized
How to convert this PHP regex into JS === I have the following RegEx that works in PHP, but I can't figure out how to convert it so that it works in JS. $string='test/again/' preg_replace('/[^\/]+\/$/', '', $string) this takes this: test/again/ and makes it into: test/ Thanks for your help.
3
10,863,538
06/02/2012 15:23:58
1,283,776
03/21/2012 15:20:44
63
0
Terminology: buttons and things I see on the screen?
Is there any good name for things in the user interface that I use to manipulate what I see? E.g. button, scroll bar, radio button, button, drow down, etc... Is there any good name for all the graphical elements that an application consists of? E.g. graph, table, text field, button area, side pane, etc...
terminology
null
null
null
null
06/06/2012 12:32:27
not constructive
Terminology: buttons and things I see on the screen? === Is there any good name for things in the user interface that I use to manipulate what I see? E.g. button, scroll bar, radio button, button, drow down, etc... Is there any good name for all the graphical elements that an application consists of? E.g. graph, table, text field, button area, side pane, etc...
4
7,853,990
10/21/2011 18:56:21
455,318
09/22/2010 16:44:21
320
7
equivalent code in php
there is possible make something like this in php ? <script type="text/javascript"> for(i=0; i<5; i++){ $("#one"+i).html("PHP"); }; </script> basically, append html content to a div. tnaks
php
javascript
loops
null
null
10/22/2011 17:39:16
not a real question
equivalent code in php === there is possible make something like this in php ? <script type="text/javascript"> for(i=0; i<5; i++){ $("#one"+i).html("PHP"); }; </script> basically, append html content to a div. tnaks
1
674,363
03/23/2009 17:22:21
19,977
09/21/2008 15:22:26
357
10
How do I change a Crystal Report's ODBC database connection at runtime?
I have a report made with Crystal Reports 2008 that I need to deploy a production system which means that I need to be able to change the database connection at runtime. The database is PostgreSQL 8.3.0 and the connection I use for creating the initial report is an ODBC connection. I have found various ways to change the database connection including the following: reportDoc.Load(report); reportDoc.DataSourceConnections[0].SetConnection("server", "database", "user", "pwd"); reportDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path); However, this always fails with the following error message. > Failed to open the connection. I have validated the connection parameters by successfully connecting to the database with pgAdmin III so I know the connection parameters are correct. In addition, if I remove the SetConnection(...) line so the code looks like this: reportDoc.Load(report); reportDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path); then the report runs fine using the connection parameters that are stored in the report. Is it possible that this method does not work for ODBC connections? How do I change a Crystal Report's ODBC database connection at runtime?
crystal-reports
postgresql
odbc
database-connection
null
null
open
How do I change a Crystal Report's ODBC database connection at runtime? === I have a report made with Crystal Reports 2008 that I need to deploy a production system which means that I need to be able to change the database connection at runtime. The database is PostgreSQL 8.3.0 and the connection I use for creating the initial report is an ODBC connection. I have found various ways to change the database connection including the following: reportDoc.Load(report); reportDoc.DataSourceConnections[0].SetConnection("server", "database", "user", "pwd"); reportDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path); However, this always fails with the following error message. > Failed to open the connection. I have validated the connection parameters by successfully connecting to the database with pgAdmin III so I know the connection parameters are correct. In addition, if I remove the SetConnection(...) line so the code looks like this: reportDoc.Load(report); reportDoc.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path); then the report runs fine using the connection parameters that are stored in the report. Is it possible that this method does not work for ODBC connections? How do I change a Crystal Report's ODBC database connection at runtime?
0
10,325,363
04/25/2012 23:44:28
1,357,447
04/25/2012 23:34:03
1
0
redirect by clicking submit button
I am writing a code in which I need to redirect to the another page to another link by clicking the submit button But there is something wrong Because I am not redirecting to that page. <input id="submit1" type="submit" value="submit" onclick="location.href='hi.php'">
php
javascript
null
null
null
04/26/2012 07:57:22
not a real question
redirect by clicking submit button === I am writing a code in which I need to redirect to the another page to another link by clicking the submit button But there is something wrong Because I am not redirecting to that page. <input id="submit1" type="submit" value="submit" onclick="location.href='hi.php'">
1
6,248,172
06/06/2011 05:44:39
751,796
05/13/2011 05:21:27
141
7
How to figure out a qury with too many subqueries
I've been given a big query to figure out. But there are so many subqueries that it's nearly impossible.The number of subqueries is about 15-20.What do you suggest I do?
oracle
query
subquery
null
null
06/07/2011 21:22:01
not a real question
How to figure out a qury with too many subqueries === I've been given a big query to figure out. But there are so many subqueries that it's nearly impossible.The number of subqueries is about 15-20.What do you suggest I do?
1
4,561,910
12/30/2010 10:39:46
180,275
09/28/2009 11:12:14
1,588
71
What's the problem with 'execute "w! " + a:name' in a vim script/function?
I have the following Vim-function: fu! Create_file_and_write_to_it(name, text) new execute "normal i" . a:text execute "w! " + a:name endfu I call this function like so: :call Create_file_and_write_to_it('c:\temp\foo.txt', "here is some text") While it creates a new buffer and writes the desired text (ie: *here is some text*) into the buffer, it doesn't write the buffer to a file named *c:\temp\foo.txt* or any other name I could see. Neither do I get an error message. Is there a reason for this behaviour, or am I doing something wrong, and how would I go about getting the desired functionality?
vim
null
null
null
null
null
open
What's the problem with 'execute "w! " + a:name' in a vim script/function? === I have the following Vim-function: fu! Create_file_and_write_to_it(name, text) new execute "normal i" . a:text execute "w! " + a:name endfu I call this function like so: :call Create_file_and_write_to_it('c:\temp\foo.txt', "here is some text") While it creates a new buffer and writes the desired text (ie: *here is some text*) into the buffer, it doesn't write the buffer to a file named *c:\temp\foo.txt* or any other name I could see. Neither do I get an error message. Is there a reason for this behaviour, or am I doing something wrong, and how would I go about getting the desired functionality?
0