|
Just to add to what I said, go and get a copy of Expresso - it examines and generates Regular expressions.
Expresso[^] It's free, and really can help create and understand complicated expressions. You can also feed it a sample file that you want to examine and it will show you what the Regex will capture.
I wish I'd written it!
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
Thanks but I already have one ,
my query is solved now I got the solution by using
(?<=\\d+(\\.\\d*)?|\\b)html(?=\\d+(\\.\\d*)?|\\b)
but I am having a new query now?
(?:.....) is also a non capturing group so I can theoretically use it in place of look ahead and look behind but that does not work here?
any solutions?
Thanks
Shankbond
|
|
|
|
|
can someone really explain that; I am curious about it.
Thanks
Shankbond
|
|
|
|
|
First of all, I know this question is only partially relevant to C#, so sorry for posting it here.
I am trying to implement Facebook single sign on using a desktop application. The one thing I figured out so far is to retrieve an access token.
How I retrieve the access token:
browserFacebook.Navigate(@"https://graph.facebook.com/oauth/authorize?client_id="+ FacebookApplicationID + "&redirect_uri=http://www.facebook.com/connect/login_success.html&type=user_agent&display=popup");
This redirects the user to page where he/she must first authorize the application. Once authorized, I redirect the user to "http://www.facebook.com/connect/login_success.html" as specified in the above address. I then intercept this URL to retrieve the access token like so:
string someString = browserFacebook.Url.ToString();
This returns something like the following:
"http://www.facebook.com/connect/login_success.html#access_token=ACCESS TOKEN.expires_in=0"
I can then easily use this access token with the Graph API to access an users facebook details as in the following code:
Facebook.FacebookGraphAPI g = new FacebookGraphAPI("ACCESS_TOKEN");
var fbUser = g.GetObject("me", null);
Can I also use this token somehow to simply log a user in to the site? My goal is not really to develop a complete new facebook application as my application is simply a prototype.
|
|
|
|
|
Good Morning,
I feel like Dr Frankenstein; I created this monster and now I cannot shut it off! Case in point. My application begins with a Splash screen that retrieves information (Connections Strings, Permissions) and sets a switch in a remote database that defines the users status as active. I hide this page when I advance to the next page (The Main Page). Now, I try to shut it down. I call a method from the Form_Closing event so that I can reset the users status as inactive and I use Application.Exit() as the closing command. BUT....my back trace shows that the script re runs the Splash page and turns the switch in the remote database back to active again before it closes. NOW.... when the user goes to log back on again, the system denies him access with the response that he is already active. In essence, the function of the code is to discourage a hacked application from being able to open if the original application is already active. It's a just in case scenario. SO...what to do? Thanks, Pat
<br />
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)<br />
{<br />
if (alreadyClosing)<br />
{<br />
return;<br />
}<br />
<br />
if (richTextResult.Text != string.Empty)<br />
{<br />
DialogResult answer;<br />
string message1 = "Are you sure you want to exit the program? " +<br />
"\n\nThe information in your Result box will be lost!";<br />
answer = MessageBox.Show(message1, "Exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);<br />
if (answer == DialogResult.No)<br />
{<br />
e.Cancel = true; <br />
return;<br />
}<br />
else<br />
{<br />
ResetDatabaseActivity();<br />
alreadyClosing = true;<br />
Application.Exit();<br />
}<br />
}<br />
|
|
|
|
|
private void frmMain_FormClosing(object sender, FormClosingEventArgs e)
{
if (richTextResult.Text != string.Empty)
{
DialogResult answer;
string message1 = "Are you sure you want to exit the program? " +
"\n\nThe information in your Result box will be lost!";
answer = MessageBox.Show(message1, "Exit?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (answer == DialogResult.No)
{
e.Cancel = true;
}
else
{
ResetDatabaseActivity();
Application.Exit();
}
}
}
I know nothing , I know nothing ...
|
|
|
|
|
Hello Stark,
Thank you for your reply. No, unfortunately, the alreadyClosing bool is required. When the application closes, if it is not in place, it trys to run this code twice. This switch is just a stop measure. It's not a big issue, but it takes 2 clicks to close the question box. That is the only reason that it is there. However, I just realized that Application.Exit() call is not required at all, since it is already staring to close before the call. Sometimes (Pat) cannot see the forest through the trees. I removed it and the problem has been solved. Thank you for your thoughts and input. I appreciate it. Best Regards, Pat
|
|
|
|
|
Hi!!
i'm back to disturb u again...
This time i wanna know y cant i use System.windows in a console program..
wheneva i type this it shows error.. that it doesn't exists.. but when i choose window application. i uses it...
help me out..i need to use it...
|
|
|
|
|
You need to add it as a reference. By default, it doesn't get added to console applications. Why would it? They aren't responsible for drawing windows after all.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
how???
i m working on keyloggers... so need to write a console program for it...
thats y...
i'm using System.Windows.Forms.Keys... but cant use it...
as mentioned...
|
|
|
|
|
In your solution explorer, right-click References (looks like a folder), Add Reference. Then find the one you need.
I will advise you that using keyloggers maliciously (such as to spy on someone, steal passwords etc) is ill-advised, and probably illegal.
|
|
|
|
|
A console application does not include Windows by default. You need to add it to the References section of your project in order to use it. However, if you are developing an application that needs Windows why would you start with a console app?
It's time for a new signature.
|
|
|
|
|
sir, thats m asking.. how shud i... actually i'm new to VS2008 and C#.. thats y stuck here...
|
|
|
|
|
Well, I wonder how you expect to write a working application if you do not understand the basics.
However
- Use your mouse to right-click on the References item in Solution Explorer.
- Select the .NET tab in the popup dialog.
- Scroll down to System.Windows.Forms, and select it.
- Click on OK.
- Add the
using statement to your source module.
[edit]Did I say something wrong here? Got a 1 vote for it anyway[/edit]
It's time for a new signature.
modified on Thursday, July 1, 2010 1:57 PM
|
|
|
|
|
I have noticed that some people down-vote things they don't want to hear, regardless of veracity or technical merit.
I wouldn't let it get you down.
|
|
|
|
|
Timothy CIAN wrote: I wouldn't let it get you down.
Oh, it doesn't; I make too many mistakes to worry about criticism. I would just prefer to have an explanation of what I did wrong.
It's time for a new signature.
|
|
|
|
|
i found an answer...
right click on the solution and then add reference of System.Windows.Forms
this solves my problem..
|
|
|
|
|
How to extend fixed scope?
I've got array of byte* native pointers and I need to assign them managed byte[] arrays. But that can be done in a fixed {} block statement.
Чесноков
|
|
|
|
|
You can get a permanent fix through the GCHandle class. It is used in here[^] for passing arrays.
|
|
|
|
|
that is what I was looking for, thanks
Чесноков
|
|
|
|
|
you're welcome.
|
|
|
|
|
Hi Experts,
I am new to C#,I am trying to use
HashSet stringSet = new HashSet { "abc", "aa" };
Bu i am getting error as "A new expression requires () or [] after type"
Whethier i should include any header file.
Thanks
Raj
|
|
|
|
|
try this:
HashSet<string> stringSet = new HashSet<string> { "abc", "aa" } ;
|
|
|
|
|
HashSet<string> stringSet = new HashSet<string>() { "abc", "aa" };
foreach (string s in stringSet) log(s);
works well on .NET 3.5 or 4.0
FWIW: the constructor parentheses are optional here!
|
|
|
|
|
Hi sir,
I tried the above but i am getting error as "{ "abc", "aa" };"
For this line ,its getting error
Error 1 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 63 WindowsApplication1
Error 2 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 70 WindowsApplication1
Error 3 Invalid expression term ',' E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 70 WindowsApplication1
Error 4 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 72 WindowsApplication1
Error 5 ; expected E:\WindowsApplication1\WindowsApplication1\Form1.cs 66 77 WindowsApplication1
|
|
|
|