|
Happened to stumble upon a similar message yesterday:
Deprecated: Function set_magic_quotes_runtime() is deprecated in /www/htdocs/w0076eaa/(redacted)/counter/counter.php on line 61
chCounter: MySQL error!
Error number: 1045
Access denied for user 'd004ed82'@'localhost' (using password: YES)
Script stopped.
|
|
|
|
|
i'm confused about the password being YES or if it says that the user used a password
|
|
|
|
|
But he won't catch me so easily.
I've passed along links to Parsing Html The Cthulhu Way[^] many times so I always have the issue in mind. I usually read HTML with an XmlDocument (when I can) or the WinForms WebBrowser control, and I've seen others recommending the HTML Agility Pack.
This week I received a bunch of large HTML files to scrape.
They're not well-formed XML -- no surprise there.
So I decided that this would be a good opportunity to try the HTML Agility Pack.
It was able to read a sample, but it complained about “Start tag <td> was not found” -- which was surprising.
The problem? Several elements like this:
<th style="width: 5%"><!--</td>
The WinForms WebBrowser control is also able to read it, but the two tools treat it slightly differently and my initial feeling is that the WebBrowser handles it a little better.
So, the next time you encounter a developer who insists on consuming HTML with RegEx, pass them a sample like that, sit back, and watch the fun.
|
|
|
|
|
My favorite is AngleSharp[^]
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
We're moving off the AgilityPack onto AngleSharp.
cheers
Chris Maunder
|
|
|
|
|
AngleSharp is easily one of the best parsers out there.
And it seems Firefox doesn't think parsers is a word and wants it to be passer or parers.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
I'm beginning to think that the HtmlAgilityPack uses RegularExpressions.
I'll have to try AngleSharp. Oh, look, an article...
|
|
|
|
|
A quick look at the HAP source code and it seems they parse it character by character.
I guess that's why it was so slow (it spent over three minutes 'parsing') when I tested it on a 1298 line HTML file (I can't remember where I found that file).
AngleSharp parsed the same file much faster (in a few seconds).
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
One of my earliest gigs was writing and XML, and then HTML, parser.
I learned why browsers treat HTML so differently, but never learned why browser writers were so pig-headed in their insistence on sticking to clearly ludicrous decisions when ambiguity in the "spec" surfaced. As it did often back then.
So everytime I see a HTML parser I give a solemn nod to the author. And then wish them the speediest exit possible from that gig.
cheers
Chris Maunder
|
|
|
|
|
Somehow, I immediately thought of this when I saw the title of your post.
Enjoy[^]
|
|
|
|
|
Thanks for the listen man!
I now want to kick ass on this morning.
|
|
|
|
|
PIEBALDconsult wrote: the next time you encounter a developer who insists on consuming HTML with RegEx, pass them a sample like that, sit back, and watch the fun
You're a cruel, cruel man.
I like it.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I open the code of a friend of a friend and I see several lines like:
[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNReadMag", CharSet = CharSet.Auto, SetLastError = true)]
static extern int ZBRPRNReadMag(IntPtr _handle, int prn_type, int trksToRead, byte[] trk1Buf,
out int trk1BytesNeeded, byte[] trk2Buf, out int trk2BytesNeeded, byte[] trk3Buf,
out int trk3BytesNeeded, out int err);
[DllImport("ZBRPrinter.dll", EntryPoint = "ZBRPRNWriteMag", CharSet = CharSet.Auto, SetLastError = true)]
static extern int ZBRPRNWriteMag(IntPtr _handle, int prn_type, int trksToWrite, byte[] trk1Data,
byte[] trk2Data, byte[] trk3Data, out int err);
Oh boy, calling a bunch of un-managed drivers from managed codes sounds fun.
i cri evry tiem
|
|
|
|
|
Bad? Maybe.
Unfortunate? Yes.
Looks like he is working with Zebra printers; better he than me!
|
|
|
|
|
It may be cleaner to write the printer interaction in a C++ library and then export simpler functions that are called from C#, or even a very thin C++/CLI wrapper.
|
|
|
|
|
A colleague told me about a great bugfixing experience: a local variable had the same name as a member variable. "But the compiler will show you a warning." - "No, it does not."
Hard to believe, hence I tried it with a very simple class. My colleague was right: there is no compiler warning when a local variable overwrites a member variable.
But there are some tools which could help us here, like StyleCop. I installed StyleCop, and eventually got it accepting my code:
namespace Nonsense
{
public class DontDoThat
{
private int someValue = 0;
public void DoSomething()
{
if (this.someValue == 0)
{
this.DoSomethingElse();
}
}
private void DoSomethingElse()
{
int someValue = 42;
int somethingElse = someValue * someValue;
}
}
}
Well, that's clean code, isn't it? StyleCop suggested great things. Still a local variable can overwrite a member variable, but now you see the difference more clearly: a member variable has a "this." prefix. Hungarian notation is so great.
|
|
|
|
|
If Visual Studio did everything for you, there'd be no reason to buy a tool like ReSharper!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Good point. But are sure that ReSharper does find that? Really, did you check it?
|
|
|
|
|
|
It doesn't give you a warning because it's perfectly valid code. If you want to use the class var, you can qualify it with this.varname .
Don't make the mistake of using the IDE as a crutch.
".45 ACP - because shooting twice is just silly" - JSOP, 2010
- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010
- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Why would the compiler complain, name scope is part of the language
|
|
|
|
|
Strictly speaking, there is no need for a compiler warning here really. It's well defined C# language behavior. Also, nothing's overwriting anything here. You declare a local and use the local. It has the same name as a member, but that's not the compiler's problem.
That said, code analysis would catch this.
See CA1500: Variable names should not match field names[^]
|
|
|
|
|
# Human injection
#
# Strings which may cause human to reinterpret worldview
If you're reading this, you've been in a coma for almost 20 years now. We're trying a new technique. We don't know where this message will end up in your dream, but we hope it works. Please wake up, we miss you.
from the big list of nasty strings[^]
|
|
|
|
|
I used to work with Tyson.
|
|
|
|
|
F-ES Sitecore wrote:
I used to work with Tyson. |
Is that a euphenism?
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|