[ad_1]
Tags: questionmark, space, indonesia
9447 points, 639 comments.
[ad_2]
Humor | ReportWire publishes the latest breaking U.S. and world news, trending topics and developing stories from around globe.

[ad_1]
Mattijs‘s co-worker was responsible for an HTML-to-PDF converter that was used internally. While TRWTF is always going to be PDFs, there were some odd choices used in the converter, starting with the function named ConvertTagsToLowerCase.
private static string ConvertTagsToLowerCase(string RichText)
{
char[] array = new char[RichText.Length];
int arrayIndex = 0;
bool inside = false;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < RichText.Length; i++)
{
char let = RichText[i];
if (let == '<')
{
inside = true;
sb.Remove(0, sb.ToString().Length);
continue;
}
if (let == '>')
{
inside = false;
array[arrayIndex] = '<';
arrayIndex++;
string HTMLInside = sb.ToString().ToLower();
for (int j = 0; j < HTMLInside.Length; j++)
{
array[arrayIndex] = HTMLInside[j];
arrayIndex++;
}
array[arrayIndex] = '>';
arrayIndex++;
continue;
}
if (!inside)
{
array[arrayIndex] = let;
arrayIndex++;
}
else
{
sb.Append(let);
}
}
return new string(array, 0, arrayIndex);
}
So, the first question is: why do we need to do this? While HTML tags are by convention lower case, it doesn’t (and shouldn’t) really matter. But let’s set that aside, and walk through the code.
It’s easiest to understand this code by going from the bottom up. If they’re “inside” (of an HTML tag), they append the character to a string builder. Otherwise, they copy the character into our output array.
When we encounter an <, we are now “inside” an HTML tag, so we clear the string builder. We do this by Removeing every character out to its length, instead of using the Clear method, which is a strange choice clearly driven by not reading the docs.
Finally, when we encounter an >, we are no longer inside an HTML tag. We turn the string builder into a string, and then lowercase it. Now, we copy all the text from that string back into our output array… one character at a time.
And then, of course, as the cherry on top of this, is the misleading comment: remove any double tags which are not in supported tags. I assume this is meant to be marked as a TODO, but I have no idea. It certainly isn’t something happening here. Maybe it’s a prerequisite?
What puzzles me about this code is that they use both a string builder and an array of characters. The obvious “solution” with their knowledge is to just convert the string to an array, modify each character in place, and then return the new string. That’s at least simpler.
If this code is necessary at all, it’s because something they’re using to parse HTML is itself broken, and expecting a specific casing for tags. But the code itself is a terrible way to solve this problem.
[ad_2]
Remy Porter
Source link

[ad_1]
The post Not All People At Walmart Are Weird appeared first on People Of Walmart.
[ad_2]
Editor1
Source link

[ad_1]
While this is how vegans think animals die in the wild, the nature is actually quite brutal. Lions eat zebras, the zebras don’t care about other zebras, everyone cares only about their own butt. So… zebras are pretty much like humans.
The post Nature Explained: How Animals Survive In The Wild first appeared on Crazy Funny Pictures.
[ad_2]
liver
Source link

[ad_1]
We spent thousands of hours and compiled the greatest collection of trees that look like butts. It’s a sexy forest made just for you to enjoy. We believe this is the greatest achievement of mankind since the invention of the wheel. Scroll down and enjoy and share it with your coworkers to win a free trip to the HR!




















[ad_2]
liver
Source link

[ad_1]
CALL RON DESANTIS GOVERNOR GROOMER
If you’re a big lefty liberal patriot like me,
You probably watch way too much MSNBC.
It’s not the shows or the hosts that I dislike,
It’s MSNBC’s advertisers that make me gripe
Lume ads have made MSNBC unwatchable.
Demonstrating pussy deodorant applications
Every 10 minutes on TV is f**king disgusting!
LumeStarterPack.com is not the solution for
Your swampy vagina discouraging inhalation
Take a bath after your hourly masturbation!
Speaking of stench-ridden Florida snatches,
Republitarded racist Governor Ron DeSantis
Is so stupid he said slavery gave job skills?!
Like what?! How to rape slaves that you kill?
Gov. Ron DeSantis (R-FL) is a sexual abuser
Which is why he’s called Governor Groomer.
Getting underage girls drunk all of the time,
But Ron’s micropenis they still cannot find.
Jake Pickering
Arcata, CA, USA
P.S. — You can find out more about me and my widely published writings by clicking on the link: https://muckrack.com/jake-pickering-1
Signed: Jake Pickering
[ad_2]
Jake Pickering
Source link

[ad_1]
“This was taken just before we were attached to a steel cable and hurled through the Thai jungle (like a flying fox – the tour was called “Flight of the Gibbons.”) As you can see, my husband looks like he was quite excited about the tour.”
(submitted by Peta)
The post The Vacation Bunch appeared first on AwkwardFamilyPhotos.com.
[ad_2]
Team Awkward
Source link

[ad_1]
TAMPA, FL—In an effort to squeeze in all their usual activities during their annual visit to Tampa Bay, 43-year-old Ron Ortega told reporters Tuesday he had scheduled family fights into this year’s vacation itinerary. “We’re going to be pretty tired after going to the beach in the mornings, so setting aside a few blocks of time for blowout arguments in the afternoons will take the stress out of figuring out when to fight next,” said Ortega, adding that he had left some space after their museum visits for his family to squabble about where they were going to eat, and had budgeted a few hours halfway through the week for everyone to yell at everyone else about how they never get to do the thing they want to do on this trip. “Of course, these fights are all completely optional, so if my wife and son want to have a screaming match about buying souvenirs at the Busch Gardens gift shop, my daughter and I can either join them or head to the nearby Florida Aquarium. While we’d like to pack in as much as we can in Tampa Bay, we also need to be realistic and recognize that we may have to reschedule some of our bickering for the flight home.” At press time, the Ortegas had reportedly just arrived at their hotel and decided to multitask by yelling at each other about three different issues at once.
[ad_2]

[ad_1]
If you’re planning a heist, charming the guard dog might be the way to go. In July, a low-level criminal was trying to make a quick steal when he fell victim to the cutest guard dog ever.
The suspected San Diego bike burglar was caught on camera stealing a family’s electric bike from an open garage when the family’s ‘fearsome’ golden retriever popped in to investigate. The thief got away, but not before getting a few belly rubs in.
[ad_2]
Jackson
Source link

[ad_1]
How to know if you have a good doctor? If your conversation goes something like this. He’s always to help you… out.
The post A Good Doctor Is Always Ready To Help You Out first appeared on Crazy Funny Pictures.
[ad_2]
liver
Source link

[ad_1]
A common pattern is “global error handlers”- functions you call in your catch block that do some task, usually logging, when an exception occurs. Given that exception handling frequently involves a fair bit of repeated code, centralizing that isn’t a terrible idea. So when Magnus found code like this in the codebase, he didn’t think much of it:
public List<ErrandComboClass> GetErrandCombo()
{
List<ErrandComboClass> list = null;
try
{
using (MyEntities my = new MyEntities())
{
list = my.Errand.Select(x => new ErrandComboClass { ID = (int)x.Id, Name = x.Dnr }).OrderBy(x => x.Name).ToList();
}
}
catch (Exception ex)
{
ExceptionHelper.CatchError(ex);
}
return list;
}
I can’t say I love the naming conventions, but it’s a pretty straight forward C# Linq method, projecting and sorting data. I don’t think that the ToList should be there, because we could be leveraging lazy evaluation (or maybe we shouldn’t, I don’t know their access patterns, but at a guess, lazy would be better here). Anything goes wrong, we pass the error to our global exception handler.
This exception handler was called everywhere. So what did it do?
public static class ExceptionHelper
{
public static void CatchError(Exception ex)
{
string s = ex.ToString();
}
}
Oh, nothing. It does (basically) nothing. Presumably, once upon a time, this was meant to be an error handling framework that they’d hang a lot of functionality off of- but that never happened. This was their production code, and this was their error handling solution.
[ad_2]
Remy Porter
Source link

[ad_1]
The post Where are you looking? appeared first on People Of Walmart.
[ad_2]
Editor1
Source link

[ad_1]
“My husband, granny and sister-in-law at a Sears glamour portrait from the 80s.”
(submitted by Penny)
The post Ghost Town appeared first on AwkwardFamilyPhotos.com.
[ad_2]
Team Awkward
Source link

[ad_1]
“As a kid we had a rescue farm, and many weird animals came to live with us. I had a rescued crow that always sat on my head and here I am walking my pet snake.”
(submitted by IG @naomi_images)
The post Animal Planet appeared first on AwkwardFamilyPhotos.com.
[ad_2]
Team Awkward
Source link

[ad_1]
The news, even that about Kylie Jenner, doesn’t need to be complicated and confusing; that’s what any new release from Microsoft is for. And, as in the case with anything from Microsoft, to keep the news from worrying our pretty little heads over, remember something new and equally indecipherable will come out soon:
Really all you need to do is follow one simple rule: barely pay attention and jump to conclusions. So, here are some headlines today and my first thoughts:
It’s hard to tell if she’s lying with her face unable move.
… Next one comes with a medium fries and large drink.
… I think they’re not called Tweets, anymore, but XCrements.
Hunter Biden is the Roger Clinton of Billy Carters.
That’s because she doesn’t have a life she has ‘continued next weeks.’
In other words, ‘Star Dreck.’
DeSantis has taken the state so far backward, even the diseases are like Spain’s still in charge.
She’ll be done with traffic school in no time if they have oral exams.
That’s actually six, if you readjust it for jobs not taken by Ryan Seacrest.
While Kid Rock is on the ‘Error’s Tour.’
Although, I do hear there’s a vaccine for that.
That’s crazy!
Wall extra.
… Yeah, but he didn’t really mean it because he had on his underwear …
[ad_2]
Paul Lander
Source link
