|
Thanks, I'll download that and check it out.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
So Real programmers don't use RegEx.
|
|
|
|
|
It finds a colon, followed by two slashes, followed by 0 or more occurrences of any character, then replaces that with an empty string. In the example case, the preg_replace() function returns "php".
|
|
|
|
|
What part of the web development forum don't you understand? Not just a programming question but a PHP regular expression question. Sheesh.
This blanket smells like ham
|
|
|
|
|
"Web development" is too generic of a term, and since I wasn't really talking about *code*, where do ya go?
I was merely asking what the regular expression would do given the string it was being applied to. Regular expressions certainly aren't restricted to web development. CP doesn't have an appropriate forum selection for these kinds of questions. I really don't know why Chris moved this to the C# forum as it's not about C#, or even about PHP (no forum available).
I was surprised to find out there is a book about regular expressions, so maybe we should have a forum for that topic alone.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
It could fit in any number of programming forums, but it does go in a programming forum. Where does a question about converting between C# and C++ go? I'm not sure, but it's not the lounge. If the regulars can't get it right how can we expect the new users to get it right.
This blanket smells like ham
|
|
|
|
|
Don't you think I considered all this before posting in the lounge? I was careful not to talk about coding, so as far as I'm concerned, you're in error, and I "got it right".
For what it's worth, it took 15 minutes to get an answer. I posted a php-specific question in the "Web Development" forum several hours ago, and as of this writing, nobody has responded. A lot of good it did me to post it there, eh?
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: so as far as I'm concerned, you're in error, and I "got it right".
When is that ever not the case. You should have worked *gotten* in there though.
John Simmons / outlaw programmer wrote: For what it's worth, it took 15 minutes to get an answer. I posted a php-specific question in the "Web Development" forum several hours ago, and as of this writing, nobody has responded. A lot of good it did me to post it there, eh?
Well, I wouldn't expect much php help from CP anyway.
This is really pointless quibbling given that the post has already been moved, but I don't see how the question is any different then asking about some combination of ShowWindow flags. It's a parameter in an api method in both cases.
This blanket smells like ham
|
|
|
|
|
... are what your coworkers have when you spike the coffe machine with exlax.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
/\:\/\/.*/ becomes /://.* after you take out the escapes
.* = any character, any number of times
so it replaces the string /:// followed by any number of any characters by ""
Looks like the initial "/" is superfluous. Regular expressions can be specified by /expression/ - so be careful.
Assuming the "/" is a mistake, it would just chop off everything after "php".
Next time hit the right forum please. It lessons the impact of your vitriol on others who post programming questions in the lounge otherwise.
cheers,
Chris Maunder
CodeProject.com : C++ MVP
|
|
|
|
|
Chris Maunder wrote: Next time hit the right forum please. It lessons the impact of your vitriol on others who post programming questions in the lounge otherwise.
I think my original post straddled the line between a programming question and not a programming question, since it was merely asking what the results would be of a regular expression.
So what is the right forum for regular expressions? In my case, CP doesn't have a PHP forum, so I'm out of luck there. It certainly isn't necessarily C#, or C++.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
John, I feel your pain. There's an O'Reilly book called Mastering Regular Expressions, or something like that. It's a great book, especially as it covers most common flavours of regex, making it invaluable for situations like yours. I highly recommend it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
John Simmons / outlaw programmer wrote: this ungainly quagmire of coding fecal matter
Is that your way of saying that you don't understand it?
|
|
|
|
|
Can you hack numericupdown's to change the arrow button's width? or do you have to make one from scratch if you want bigger buttons?
|
|
|
|
|
You won't be able to hack the arrow button's width. The method PositionControls() in the UpDownBase class determines it's width. This class is private and would override any possible hacks.
Your best option would probably be to build a UserControl using a TextBox and two Buttons.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
Hi to all, I work on an application that takes measurements from a piece of hardware, and
then manipulates it.
my problem is that while collecting the measurement my program gets stuck, meaning if I do something else on my PC at the same time, when I return to my form it is blank.
I understand it's a matter of threading.
the problem is I can't call my callback function passed to the new thread with the ProgressBar parameter.
my Form creates a ProgressBar that my collecting function is supposed to operate, but it can't.
I get the error,
Cross-thread operation not valid: Control 'progressBarSampling' accessed from a thread other than the thread it was created on.
What I want to achieve is to be able to pass the Form's progressbar as parameter to my function
so it can use it.
Any help will be most appreciated.
regards.
|
|
|
|
|
You might want to take a look at the BackgroundWorker class. This will help you immensely.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
What do you mean by that?
that I should look for global information about the class?
|
|
|
|
|
I mean that if you search through that mystic portal called google on BackgroundWorker and take a look at some of the samples and articles, you'll see how this works and how it might help to solve your issue.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
The reason I asked you is because I thought maybe you are trying to direct me to problem specific
solution and not such a global shot in the air.
as far as I know, and I don't know much on that subject, a background worker only means it a thread that works in the back, how is that supposed to solve the problem of passing a form component to a
thread other then the one that created it, I don't know, but I am reading some material about that.
if you could direct me to some more problem specific information I will be most grateful.
|
|
|
|
|
Read up on the BackgroundWorker[^] class and it will be come clear. It gives you the option of reporting progress to your UI thread.
|
|
|
|
|
thanks I'll catchup on that
|
|
|
|
|
O.K
I read about background Worker but now I have another question,
my main problem is, that I run ,on my BGWorker, a function from a different class.
I want that function to report progress so I can update the progressBar that belongs to my form.
how do I make it possible for the function to update my outside control, or even call
the reportProgress??
Waiting for your help...
thanks in advanced.
private void OffsetAButton_Click(object sender, EventArgs e)
{
frmPicoBackgroundWorker.DoWork += new DoWorkEventHandler(frmPicoBackgroundWorker_DoWork);
frmPicoBackgroundWorker.ProgressChanged +=new ProgressChangedEventHandler(frmPicoBackgroundWorker_ProgressChanged);
frmPicoBackgroundWorker.RunWorkerAsync(updateProgress);
}
private void frmPicoBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
{
PICO.start_ChannelA_Offsetting(ref updateProgress);
frmPicoBackgroundWorker.ReportProgress(updateProgress);
}
private void frmPicoBackgroundWorker_ProgressChanged(object Sender, ProgressChangedEventArgs e)
{
progressBarSampling.Step = updateProgress;
progressBarSampling.PerformStep();
}
these are just samples of the problematic code.
hope it helps you understand what I don't understand
|
|
|
|
|
It would help if your worker method took a parameter which you could pass in the background worker instance. Your worker code then, every once in a while, calls the ReportProgress method on the BackgroundWorker object to fire off the ProgressChanged event.
|
|
|
|
|
Right - here we go, and I'll try not to digress. You have a form that you don't want to be put on hold while you have something else going on, and you want to display a progress bar. Rather than trying to pass the form component to another thread, you should delegate the measurement code to a background thread and handle the update on the main UI. Using the BackgroundWorker class makes the whole issue really easy.
This[^] article gives a sample and was found by googling on BackgroundWorker and progressbar. There are many more examples there.
Deja View - the feeling that you've seen this post before.
|
|
|
|