Using C# and WPF under .net (rather than WindowsForms or console), what is the correct way to create an application that can only be run as a single instance? I know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop and explain what one of these are.
The code needs to also inform the already running instance that the user tried to start a second one, and maybe also pass any command line arguments if any existed.
I'm working on the networking part of a 2 player game (similar to tetris), and I'm trying to pass the game grid from client to server and vice versa. However, when I tried using send(grid) I get a TypeError: send() argument 1 must be string or read-only buffer, not instance.
Is there anyway to circumvent this, or do I have to convert my grid instance into a string and then interpret it from the other side? Thanks in advance!
Hello Guys,
I want to make a slick java commandline app which doesnt include all the nasty "java -jar some.jar arguments"
instead, I would have it work just like
program -option argument
like any other commandline app. I use ubuntu linux, and it would be fine if it included a bit of .sh script or anything. I know I can just create a file with java -jar program.jar and do chmod +x file, afterwards I could run i with ./file, but then how can I pass the arguments to the program ?
hi,
I need to pass a callback function that is CFuncType (ctypes.CFUNCTYPE or ctypes.PYFUNCTYPE...).
How can I cast a python function to CFuncType or how can I create a CFuncType function in python.
i am trying to login and want to validate username and password against the records in the database. I am not sure how to pass two Where clause
public Boolean login(String username, String password) throws SQLException {
Cursor mCursor = db.query(TABLE_USERS, new String[] { ID,
KEY_NAME, KEY_USERNAME}, KEY_USERNAME + "="
+ "'"+username+"'", KEY_PASSWORD + "="
+ "'"+password+"'", null, null, null, null, null);
if (mCursor.moveToFirst()) {
return true;
}
return false;
}
Am getting a Syntax Error.
I'm working with Ruby on rails 2.3.4 and I'd like to pass some parameters from one page to another ones the first one is submitted.
For example:
On the first page, I have a form that when it's filled a Preview button can be clicked to check all the info entered before submitting the form. That button redirects to another page with the info entered before, but I don't know how to get it in the second page.
Hi
I have two user controls on one aspx page. UC1 has a grid which contains a link button column which user clicks. Based on the value of clicked cell, I need to show some data into UC2.
How do I pass data from UC1 to UC2?
How do I invoke a function of UC2 from UC1?
Please advise. Thanks
AJ
in the textbox when we pass the text within "< " bracket then it shows the error like
A potentially dangerous Request.Form value was detected from the client (grouplink$txtAddPerson="
I have a SSIS package that I plan to deploy on my SQL Server 2008 machine.
I need to call this SSIS package remotely and synchronously from .NET. Obviously I need to pass parameters to this package as well.
How could I do that?
Thanks,
Alex
In C# VS2008 how to replace
new SqlParameter("@Description", SqlDbType.NChar, 1500)
or
new SqlParameter("@IsRequired", SqlDbType.Bit)
to
"@Description", SqlDbType.NChar, 1500
or
"@IsRequired", SqlDbType.B
the idea is to remove new SqlParameter() and leave the parameters inside it.
I have thounds of lines code have this pattern. I just want to pass compile by using some regular expression.
I'm having a hard time figuring out the best way to pass simple values from onPause and onResume in the Android activity lifecycle. I understand how to use get and put extra bundles for activity to activity data, but does that work for passing data between the same activity? Should i used SharedPreferences?
I dont understand this. I ran this code below and the result json string was the link is expired (meaning invalid).
However the curl code does the exact same thing and works. I either get the expected string with the url or it says i need to wait (for a few seconds to 1 minute).
Why? whats the difference between the two? It looks very F%^&*ed up that it is behaving differently (its been causing me HOURS of problems).
NOTE: the only cookie required by the site is SID (tested). It holds your session id. The first post activates it and the 2nd command checks the status with the returning json string. Feel free to set the CookieContainer to only use SID if you like.
WARNING: you may want to change SID to a different value so other people arent activating it. Your may want to run the 2nd url to ensure the session id is not used and says expired/invalid before you start.
additional note: with curl or in your browser if you do the POST command you can stick the sid in .NET cookie container and the 2nd command will work. But doing the first command (the POST data) will not work. This post function i have used for many other sites that require post and so far it has worked. Obviously checking the Method is a big deal and i see it is indeed POST when doing the first command.
static void Main(string[] args)
{
var cookie = new CookieContainer();
PostData("http://uploading.com/files/get/37e36ed8/", "action=second_page&file_id=9134949&code=37e36ed8", cookie);
Thread.Sleep(4000);
var res = PostData("http://uploading.com/files/get/?JsHttpRequest=12719362769080-xml&action=get_link&file_id=9134949&code=37e36ed8&pass=undefined",
null/*this makes it GET*/, cookie);
Console.WriteLine(res);
/*
curl -b "SID=37468830" -A "DUMMY_User_Aggent" -d "action=second_page&file_id=9134949&code=37e36ed8" "http://uploading.com/files/get/37e36ed8/"
curl -b "SID=37468830" -A "DUMMY_User_Aggent" "http://uploading.com/files/get/?JsHttpRequest=12719362769080-xml&action=get_link&file_id=9134949&code=37e36ed8&pass=undefined"
*/
}
If I am on a website#1, and I enter my username/pwd for website#2 on a login page that is on website#1, and website#1, behind the scenes, makes a httpwebrequest to website#2 and posts to the login page. If I then navigate to website#2, should I be logged in?
website#2 uses formsauthentication and I call a httpHandler that is on website#2 and pass it the username/password via the querystring.
Should this work?
I have the following javascript:
$.post("/Authenticated/DeletePage/" + PageId);
showStatus("Page deleted...", 10000);
I would like to instead pass showStatus() text that is returned by the $.post() call, rather than hardcoded text. How do I do this?
I am using JavaScript to display a swf video, and I want to override the Full Screen button if possible, so that it redirects to another url instead of making the video full screen. Is there a parameter that I can pass to the SWFObject that will allow me to do this? I would appreciate any help. Thanks.
I current have the following regular expression to accept any numeric value that is seven digits
^\d{7}
How do I improve it so it will accept numeric value that is seven or ten digits?
Pass: 0123456, 1234567, 0123456789, 123467890
Fail: 123456, 12345678, 123456789
Hello,
I used use Google’s slick interface to get my mail and It’s always going to be here:
https://mail.google.com/a/yourdomainhere.com
I want to write python script that send mail so i failed to configure server settings
smtp = smtplib.SMTP('what is mail server will be?', what is the port)
smtp.login('[email protected]', 'pass')
Please could any one help me ??
Thanks
Pretty often I need to access config variables in views.
I know I can pass them from controller to load-view().
But it seems excessive to do it explicitly.
Is there some way or trick to access $config variable from CI views without
disturbing controllers with spare code?
I have an ActionResult returning from a strongly typed view where I manually validate some conditions, pass in an error message, but would like to preserve the users responses.
Since my View is strongly typed, I am calling it like this:
return View("PrincipalInvestigatorForm", new SmartFormViewModel(sections, questions));
My problem though, is that the error message is displayed but all the users data is wiped. How do I preserve the "ViewState" in MVC? Is there an easy way?
I was trying pick a name for an interface through which I can pass something into an object like:
If the object is INeedX then SetX(some x) method will be called;
If the object is INeedY then SetY(some y) method will be called;
and so on. (funny as hell, I know :) )
I try to find a different name for this kind of interfaces but I can't figure this out.
Does anybody have an idea how to name the INeedSomething interface ?
I am processing a form and in turn, receiving a response code based on the information submitted. I have a list of approximately 40 response codes (and their meaning) in my hands and am trying to build an 'if' statement that checks against a predefined array and returns a specific value.
Just not sure how to do this
First pass conceptually:
$bads = array (1,2,3,4,5,6)
if ($output['responsecode'] == (any value in $bads) {
echo "you suck";
}
Currently I use this to pass GET parameters on an "elegant" way:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]*)/$ index.php?module=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ index.php?module=$1&object=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/$ index.php?module=$1&object=$2&submodule=$3 [L]
This works great for 3 parameters max., (and I'm sure it's seriously ugly).
Any way to do the same thing, for n-paremeters?
Hello people,
I am developing an application where i have to display the tweets in the iPhone So i want to know whether it is possible or not? I have tried searching several posts but am unable to find one for iPhone.
Kindly pass on the link if you get any..
Thanks in advance