ReportWire

Category: Humor

Humor | ReportWire publishes the latest breaking U.S. and world news, trending topics and developing stories from around globe.

  • Capitalizing on Memories

    Capitalizing on Memories

    [ad_1]

    Gavin inherited some "very old" C code, originally developed for old Windows systems. The code is loaded with a number of reinvented wheels.

    For example, they needed to do a case insensitive string comparison. Now, instead of using stricmp, the case insensitive string comparison, they wrote this:

    int uppercmp( char *sStr1, char *sStr2 )
    {
    	char *sUStr1;
    	char *sUStr2;
    	int iRet;
    
    	if ( ( sStr1 == NULL ) || ( sStr2 == NULL ) ) return -1;
    
    	__try
    	{
    		sUStr1 = strupr(strdup( sStr1 ));
    		sUStr2 = strupr(strdup( sStr2 ));
    
    		iRet = strcmp( sUStr1, sUStr2 );
    
    		return iRet;
    	}
    	__finally
    	{
    		FreeIfNotNULL(sUStr1);
    		FreeIfNotNULL(sUStr2);
    	}		
    
    	return
    }
    

    This uses Microsoft's structured exception handling extensions to C, hence the __try. SEH is its own weird beast, with huge amounts of caveats and gotchas and weirdness. It's honestly more interesting than this function, which isn't itself a WTF- it's just bad. They duplicate the input strings, convert them to upper case, and then compare. The real ugly thing is the return value- a -1 if either input string is NULL, but also a -1 from strcmp if sUStr1 < sUstr2. And of course, an empty return if anything causes an exception.

    This code was so nice, they wrote it twice, as here's their StringEqual function.

    BOOL StringEqual( IN char *sSearch,
    				  IN DWORD dwSearchLen,
    				  IN char *sToken,
    				  IN DWORD dwTokenLen,
    				  IN BOOL bCaseInsensitive )
    {
    	char *sUpperSearch;
    	char *sUpperToken;
    	BOOL	bStringEqual = FALSE;
    
    	// If the lengths are mismatched or the parameters NULL, its not a match
    	if ( (dwSearchLen < dwTokenLen) || (sToken == NULL) || (sSearch == NULL) )
    	{
    		return FALSE;
    	}
    
    	// Check for case insensitivity
    	if ( bCaseInsensitive )
    	{
    		__try
    		{
    			// Make upper case versions of the comparitor and the comparitand (my own words ;)
    			sUpperSearch = strdup( sSearch );
    			sUpperToken = strdup( sToken );
    
    			_strupr( sUpperSearch );
    			_strupr( sUpperToken );
    
    			// And return a TRUE if there is a match
    			return ( strncmp( sUpperSearch, sUpperToken, dwTokenLen ) == 0 );
    		}
    		__finally
    		{
    			FreeIfNotNULL(sUpperSearch);
    			FreeIfNotNULL(sUpperToken);
    		}
    	}
    	else
    	{
    		// Return if there is a case sensitive match
    		return ( strncmp( sSearch, sToken, dwTokenLen ) == 0 );
    	}
    
    	// This line never gets called, but lets keep it here to make the
    	// warning go away
    	return FALSE;
    }
    

    Here, they're wrapping strncmp, which expects the caller to supply the length of the strings (instead of relying on null terminators). That's arguably a good practice, but it's foiled by using strdup, and _strupr– which are looking for null terminators.

    With all these homebrew string handling functions, would you be shocked to know they have a homebrew memory management function too? Here's OverlappedMemcpy.

    void OverlappedMemcpy( IN OUT void *vDest,
    					   IN void *vSrc,
    					   IN DWORD dwLen )
    {
    	void *vTemp;
    
    	__try
    	{
    		// Store the from store
    		vTemp = malloc( dwLen );
    
    		// Copy the source
    		memcpy( vTemp, vSrc, dwLen );
    
    		// .. to the dest through the temporary intermidiate
    		memcpy( vDest, vTemp, dwLen );
    	}
    	__finally
    	{
    		FreeIfNotNULL(vTemp);
    	}
    }
    

    I do not know what about this is "overlapped". It's just a regular memcpy where we added an intermediate step of copying into a temporary buffer before copying to the destination buffer. So it's just really inefficient, for absolutely no benefit to anyone.


    .comment { border: none; }

    [Advertisement]
    Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!

    [ad_2]

    Remy Porter

    Source link

  • Kennedy Casts Stones in His Glass House – Bill Tope, Humor Times

    Kennedy Casts Stones in His Glass House – Bill Tope, Humor Times

    [ad_1]

    Sen. John Kennedy questioned public health experts on the escalation of gun violence, a bit like throwing stones in a glass house.

    On Tuesday at a Senate hearing on gun violence, Sen. John Kennedy (R-LA) imperiled his own glass house, questioning public health experts on the reason for the escalation of firearm violence.

    John Kennedy glass house
    Sen. John Kennedy (R-LA) asking more dumb questions, casting stones in his own glass house. Photo: C-SPAN, Public Domain.

    He asked Dr. Megan Ranney, a Yale Professor, if the reason that Chicago, Illinois was “the nation’s largest outdoor shooting range” was the existence of “law-abiding citizens owning a gun for protection or perhaps for hunting.”

    He dug at the dirt under his nails with a prodigious Buck knife. “Or,” he asked conversationally, was it due to a “finite, unique set of illegally-armed darkies?”

    Ranney replied that everyone was law-abiding, “until they’re not,” and added that Kennedy’s home-state of Louisiana ranks far above Illinois in gun violence rates. She added that most mass shooters were, in fact, first-offenders and purchased their weapons legally.

    Ranney went on to say that environmental factors, such as urban renewal and creation of green spaces, have been shown to have an effect on rates, decreasing them by as much as 12%.

    Kennedy shook his large head ponderously and dismissed Ranney’s remarks as “word salad.” “I know,” he went on, “that it’s mostly in Democrat cities chock full of nigras where all the gun violence takes place.”

    When Ranney said she’d stake her reputation on her remarks, Kennedy cut her often a second time, saying that Ranney only got to be a Yale professor through “a woke affirmative action program prevalent in the Ivy League.”

    Kennedy then moved to pause the hearing for a “potty break.” He sat back calmly picking his nose.

    Bill TopeBill Tope
    Latest posts by Bill Tope (see all)
    ShareShare

    [ad_2]

    Bill Tope

    Source link

  • Here's a Wild Idea That's Taking Root – Jim Hightower, Humor Times

    Here's a Wild Idea That's Taking Root – Jim Hightower, Humor Times

    [ad_1]

    Students are organizing locally with a wild idea that makes a difference and makes a statement.

    Growing up, I absorbed a lot of values from my Ol’ Texas Daddy: a strong commitment to the common good, a healthy work ethic and a lively sense of humor. But one thing about him I’ve rejected: his determination to have a perfect yard of thick, verdant St. Augustine grass. Lord, how he worked at it — laying sod, (watering), fertilizing, (watering), weeding, (watering), spreading pesticides, (watering), mowing… (more watering). But it was too hot, too dry, too infested with blight, bugs, slugs and such. He was up against Texas nature, and he just couldn’t win.

    So, I’ve gone in the opposite direction — slowly nurturing a natural yard of native trees, drought-tolerant plants and a general live-with-nature ethos in my little landscape. I’m hardly alone in this rejection of the uniform “green grass imperative.” A spontaneous yard rebellion is taking hold across our country as more and more households, neighborhoods, businesses, etc. shift to a nature-friendly approach. A particularly encouraging push for change is coming from schoolkids — elementary through college — who are appalled by the poisoning of our globe and organizing locally to do something that both makes a difference and makes a statement. One exemplary channel for their activism is a student movement called Re:wild Your Campus.

    Of course, some people consider this a wild idea, after all, wild yards tend to be scruffy, ugly… unruly. That’s their choice, but some also insist that tidy grass lawns must be everyone’s choice. So, they proclaim themselves to be the yard police, demanding that cities and homeowners associations make green-grass uniformity the law, filing busybody lawsuits and running right-wing social media campaigns targeting people and groups that disobey.

    These attacks are silly because… well, they are silly, and also because they’re attacking the future, which is nearly always a loser strategy. To work for yard sanity and choice, go to Rewild.org.

    Voters Reject the Illiberal Bigotry of Moms 4 Liberty

    In one of their satirical songs, the Austin Lounge Lizards lampooned the ridiculous bigotry of some Christian factions, singing: “Jesus loves me. But he can’t stand you.”

    That could be the bellicose anthem of a quasi-religious Republican front group with a very sweet-sounding name: “Moms for Liberty.” Far from sweet, however, these moms are funded by rich Republicans to be ground troops in the party’s culture wars — essentially an anti-liberty campaign against people, books, teachers and ideas they don’t like. In the last few years, squads of these moms have turned into political hate groups, persecuting small town school board members by baselessly accusing them of conspiring to indoctrinate children with pornography, hatred of white people and “liberal” thinking.

    Having stirred up dust devils of division and fear, the momsters ran candidates in local board elections this fall, hoping to take over public schools. But they miscalculated on an essential political reality: Most Americans are not right-wingers, bigots or Christian nationalists. The group had counted on surprising voters in what are usually low visibility/low-turnout races, but the extremists were the ones surprised by an aggressive voter pushback against their scheme.

    Indeed, various surveys show that the GOP’s mom-wing lost about 80% of its races across the country, even in major swing states like Ohio, Pennsylvania and Virginia. For example, in the very conservative school district of Pennridge, Pennsylvania, where a far-right majority of the board was attempting to impose a national model of a politically driven educational system, five Republican incumbents were up for reelection. All five were swept out, turning the Pennridge school board blue for the first time in years!

    To help push back against right-wing politicizers of your school district, contact Campaign for Our Shared Future.

    Jim HightowerJim Hightower
    Latest posts by Jim Hightower (see all)
    ShareShare

    [ad_2]

    Jim Hightower

    Source link

  • “There Are Too Many Passwords”: 80 Things People Are Sick And Tired Of

    “There Are Too Many Passwords”: 80 Things People Are Sick And Tired Of

    [ad_1]

    After all the heated arguments on everything from technology and social media to work and the economy, who could’ve predicted that baby boomers and the younger generations would find something in common?

    But last month, X (formerly known as Twitter) user Girl Fieri (@realgirl_fieri) asked all the non-boomers on the platform to share their most boomer-esque complaints, and the replies immediately started pouring in.

    Image credits: realgirl_fieri

    So we decided that taking a look at the submissions would be a nice change of pace to the never-ending discourse on intergenerational differences. Or, in this case, similarities!

    [ad_2] Justinas Keturka
    Source link

  • “Welcome To Fascinating”: 60 Posts From The Online Group Dedicated To Incredible Things

    “Welcome To Fascinating”: 60 Posts From The Online Group Dedicated To Incredible Things

    [ad_1]

    Who doesn’t love learning new things? Our brain floods our body with dopamine when we see, to quote the American rock band Semisonic, an F. N. T. That stands for “fascinating new thing”. And although the group was singing about a girl, the reference still stands, right? A spiky tiny mushroom or a transparent octopus can be a fascinating new thing too.

    The subreddit r/fascinating then is heaven for those who want to satisfy their curiosity and get a dopamine rush. It’s a Reddit community with over 40k members where people post interesting pictures and facts. Check out our selection from the subreddit below!

    Bored Panda also got some thoughts from an insider. One of the moderators from r/fascinating, WeirdPineapple, was kind enough to answer some questions. Check out our short interview with him below!

    [ad_2] Mindaugas Balčiauskas
    Source link

  • We're Still Not Sure Why The Photographer Suggested This

    We're Still Not Sure Why The Photographer Suggested This

    [ad_1]

    “My parents brought my son and his cousins to a photo session. We’ve always wondered what they were looking at.”

    (submitted by IG @seeds_of_determination

    The post Look Up appeared first on AwkwardFamilyPhotos.com.

    [ad_2]

    Team Awkward

    Source link

  • When The Photographer Isn't At Full Capacity

    When The Photographer Isn't At Full Capacity

    [ad_1]

    “Found this Olan Mills beauty from 1983. My dad claims he remembered the photographer to be pretty hungover. You think?”

    (submitted by IG @margar_et_)

     

    The post The Hungover Photographer appeared first on AwkwardFamilyPhotos.com.

    [ad_2]

    Team Awkward

    Source link

  • Our Infamous “Matching Outfits” Photo

    Our Infamous “Matching Outfits” Photo

    [ad_1]

    “It’s 1964 and mom is pregnant with baby number 5 in this photo.”

    (submitted by Sharon)

    The post The Wild Bunch appeared first on AwkwardFamilyPhotos.com.

    [ad_2]

    Team Awkward

    Source link

  • Extremely Accurate Birds: Perfect Bird Drawings

    Extremely Accurate Birds: Perfect Bird Drawings

    [ad_1]

    Have you ever considered bird watching as a hobby? These pictures might come in handy: created by illustrator Tommy Siegel, these extremely accurate drawings of birds might serve as valuable tools that aid a newbie birder in his identification and documentation efforts.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    Extremely accurate bird drawing.

    If you enjoyed these drawings and wish to get more of Tommy Siegel’s cartoons, check out his books: Candy Hearts and I Hope This Helps. Both books are available on Amazon. Please note that this site is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate affiliate we earn from qualifying purchases.

    [ad_2]

    liver

    Source link