Recent Articles

Nov 2008

nice_num, mean_programmer

by in CodeSOD on

When Timothy stumbled across a function that had a vague name, no comments, and variables, he took a few minutes to try to break it down in his head.

static char *nice_num(long n)
{
    int neg = 0, d = 3;
    char *buffer = prtbuf;
    int bufsize = 20;

    if (n < 0)
    {
        neg = 1;
        n = -n;
    }
    buffer += bufsize;
    *--buffer = '\0';

    do
    {
        *--buffer = '0' + (n % 10);
        n /= 10;
        if (--d == 0)
        {
            d = 3;
            *--buffer = ',';
        }
    }
    while (n);

    if (*buffer == ',') ++buffer;
    if (neg) *--buffer = '-';
    return buffer;
}

I Can't See What You're Saying

by in Feature Articles on

"Why won't this stupid thing just... just... graagh!" The salesman clutched the edges of his massive keyboard tightly, his knucles white. While he looked angry, he wasn't actually angry; rather he was frustrated approaching angry.

The year was 1984, and the PC was finally moving out of the "early adopter" range and companies started sending them out into the field. Ricky happened to be working at a help desk during this exciting time, aiding in the rollout of the shiny new PCs to various teams in the company. Unfortunately for him, one of the first teams that needed the PCs most desperately was also one of the departments least able to understand and use them – sales.


Why Indeed

by in Representative Line on

Having just inherited a mammoth, ASP-based ecommerce application created in a developmestuction by a handful of different consultants over several years, Ryan Davis found himself asking one question, over and over: why?

Why didn't they use some off-the-shelf ecommerce site? Why aren't there any comments, anywhere?? Why did anyone let the original developer near a keyboard, let alone allow him to program!? Why did I even bother coming in today!?!?


The Mandatory Three, The Easy Road to Success, and Relevant Inexperience

by in Tales from the Interview on

The Mandatory Three (from Jim)
After the dot com bust, I spent a lot of time interviewing. It was mostly dead ends or companies that were only willing to hire one person to do the job of four (specifically, the four that they had just laid off). A friend of mine who worked at a school, told me about an IT position there. Being out of work for so long, I was very eager to get in for an interview, and figured I might have an "in" since he was working there already.

When I arrived at the interview, there were two other candidates waiting. I was to go in first, and I was informed that all three of the interviews would be done in "rapid fire" succession, and each would take just 30 minutes. I went into their conference room, and was a bit startled by the fifteen people sitting around the table. This was known as "The Gauntlet." This group of people only asked a few, fairly non-technical questions. Most seemed bored, and some occasionally looked at their watches and yawned! Now, I am not the most exciting person in the world, but I am certainly not that boring. I finished the interview and left feeling quite confused. What the hell just happened?


This Just In, What?

by in Error'd on

"I've heard of Gisborne, Ashburton, Darfield, and Kaikoura", writes Steve Chadbourne, "but that last town is a new one to me."


Choose Your Own Include File

by in CodeSOD on

It seemed like a simple request. "Please add 'MAINT-CNTRL-ADMIN' to the cost center dropdown for client #876." It was also Scott A's very first assignment, having recently started as a web developer for the B2B merchandise reseller.

The ecommerce application he was hired to maintain was ASP-based and had been developed over the course of several years by an outside consultant. During the job interview, the system looked pretty decent: it tracked orders, inventory, products, etc. The UI wasn't wonderful, but it worked.


DOLLARS and SENSE

by in Feature Articles on

The billing application was slow. And not slow in the taking-30-seconds-to-start-up sense, but slow in the ridiculously-freaking-slow sense. Loading an invoice took between ten and fifteen minutes. Updating a line item on an invoice took up to a minute. And saving the invoice back to the database took even longer than loading it in the first place. Clearly, things couldn't stay this way – a minimum of 25 minutes to update a single invoice was completely unacceptable. They needed an expert. They needed... The Optimizer.

Kent had earned his reputation by making a simple but dramatic improvement in another application's performance. A database server had been set up with the default cache size, 64KB. Seeing that it could have been using a full 16MB, he changed the setting and performance improved considerably. Simple as it was, he was immediately hailed as a hero, and because of that, the powers that be wanted to put him on the billing application.


Y2K Pedaling

by in Error'd on

"Thank goodness this bicycle I'm borrowing still works after Y2K," Robin Sheat notes, "I can't even imagine the programmer-hours required to bring it up to spec."


The Hangar Management System

by in Feature Articles on

Photo Credit: 'amber :)' at Flickr Back in 1998, at the Department of Informatics at the University of Umeå in Sweden, the professors had decided that instead of the final exam being solely a regurgitation of knowledge gleaned from text books and lectures, it would be a good idea for students to venture out into the real world to complete their bachelor's degrees. In teams of two, they would spend time with a local business, learn how Information Technology fit in with their daily work, and present it back to the professors.

While most students received mundane case studies, the one that Niclas Olovsson and his teammate were assigned became the envy of the other students - the usage of IT tools for supporting flight mechanics at a local airport. Upon receiving their assignment, Niclaus figured that any modern airport would require a state-of-the-art system to keep their airplanes in the air. He imagined hand held smart terminals that received work orders over an intranet, sent data back over an extranet to a VB application over the internet! The synergistic combinations of buzzwords were endless! However, on the morning of their arrival, much to their chagrin, all they found was a greasy old PC...and Klaus.


Stupid Coding Tricks: The T-SQL Mandelbrot

by in CodeSOD on

The bar for entry into CodeSOD is pretty straight forward: professionally-developed code that elicits that certain What The— reaction. Though there have been a few exceptions over the years, generally speaking, student code, hobbyist code, and amateur code need not apply. That said, I'd like to try something a little different today. Today's example is not technically professionally-developed, it's a Stupid Coding Trick.

"So I was bored at work one day," Graeme Job explains, "and wondered, what's the most useless thing I could do with my time without actually doing anything. Then it hit me. I could use T-SQL to generate... Mandelbrot."


Hidden Tax Moves

by in Feature Articles on

It was fall of 1995 and everyone was gearing up for the 1996 tax season. After years of maintenance of a DOS-based tax application, TaxQuik -- as we'll call the company -- had to get with the times. New, spunky companies were building tax software for Windows with fancy GUIs, integrated help and even Internet-enabled features, while TaxQuik was still in the text-based stone age of DOS.

The one thing that the new companies all lacked was the name recognition and brand loyalty of TaxQuik's customers. The company developed an aggressive plan to continue to support the DOS version, while simultaneously building a Windows version of the software. And by all accounts, the plan worked like a charm.


Act Fast!

by in Error'd on

Go ahead Michael Fulker, make your move. I'll count to one.


Keep it Simple and Stupid

by in CodeSOD on

Diego G. lives in Argentina and is working with a developer from the USA on a PHP project. Recently they were discussing the merits of handling the communication from the backend to the frontend via XML or JSON. The system used XML elsewhere already, but for the new work it looked like it'd be quicker and easier to work with JSON in the PHP pages.

The contact in the US didn't like one solution more than the other, and in the interest of getting the project done quickly, sent an email with his solution.


The Steak Dinner

by in Souvenir Potpourri on

Ever since the first Free Sticker Week ended back in February '07, I've been sending out WTF Stickers to anyone that mailed me a SASE or a small souvenir. More recently, I've been sending out the coveted TDWTF Mugs for truly awesome souvenirs. Nothing specific; per the instructions page, "anything will do." Well, here goes anything, yet again! (previous: A Crapton of Candy).


It's not every day that one is treated to a nice, steak dinner. Even rarer is when said dinner shows up at your front door, completely randomly and unexpected. Brandon "galgorah" Leach (Boston, MA) wrote, "here's at least one lunch you shouldn't be able to complain about. Well, unless you eat this all in one sitting."


Mini Support Stories and Shake It, Baby

by in Feature Articles on

Having worked in support for years, Ben has amassed quite the compendium of quick stories.

Double-Click on My Computer
I was on a call with a lady who was having Internet connectivity issues. I listened to her describe what was happening and was just starting to guide her through a few things to try to find the problem. I asked her to double-click on My Computer to which she replied, "How can I double-click on your computer?" I had to hit mute and collect myself because I didn't see that one coming.


The Toggle that Wouldn't

by in CodeSOD on

"I work for a software development house that creates business software, maintaining legacy MFC applications," Graf writes. "We recently received an issue where a filter-toggle wouldn't switch back and forth, never changing from its default value. It's was a small utility function, rarely used, so we were a bit surprised to see it come up. Taking a quick glance at the code revealed the following:


MUMPS Madness

by in Feature Articles on

This year’s Corporate Technology Expo was no different than the ones for years previous. Various departments gathered in the company’s large, wood-paneled group meeting hall and highlighted their top projects and initiatives that were completed during the past year. There was everything from the ASP-to-ASP.NET upgrade of the customer portal to the enterprise-wide implementation of COGNOS 7. The scene was a three-hour, seemingly unending procession of PowerPoint slides with enough laser pointers to take down an incoming ICBM.

Nobody would probably show, let alone stay awake, if it weren’t for the free coffee and bagels.


Status, Please

by in Feature Articles on

“Just give me a damn status!” growled Murray, the aging IT project manager who everyone thought would have been retired by now. In fairness, the fifty-nine year old’s job performance hadn’t waned one bit through his decades-long tenure at Bell Labs. In fact, some would even say that in his later years, he traded some of his trademarked ferocity for geniality. “Dammit,” Murry barked two seconds later at Tom Limoncelli, one of the developers sitting around the conference table, “I don’t have all day! Give me a status!”

“Okay, okay,” Tom nervously responded, flipping through some papers, “we’re… uh, 30% through AMQ, 60% percent towards AMA-2, and… err… 100% for DBD.” Murray frowned and gruffly murmured something unintelligible. That was his way of saying “thank you.”


$50 Cash Fast

by in Error'd on

I don't know, Dexter, I don't see anything weird about getting $50 fast cash...


Now I Have Two Hundred Problems

by in CodeSOD on

-rw-r--r--. If that looks familiar to you, skip this and the next paragraph.

OK, now that it's just you and me, Bill Gates, it is an example of Unix file permissions. The example given means that the user (owner) can read/write to the file, and others can only read it. Checking these permissions in Perl is simple; just use the stat method to check its mode (the file type and permissions). For example, if you wanted to check read permissions, you'd check bits 4 (owner read), 32 (group read), and 256 (other read). This is 292 in decimal, 0444 in octal. Compare that to the mode, and you'll know whether you can read the file. In code, stat($path)->mode & 0444. Easy peasy!


A Touch of Genius

by in CodeSOD on

“I recently started on a new contract,” Vedran R writes, “and the experience has been rather… interesting. The project I’ve been assigned to is a VB .NET 1.1 web application, and the code is rather… bad. Now, I know that developers make all kinds of compromises because of lack of time or experience but this is just… well, here’s some of the code.”

“Why fix the problem where it originates, it’s much simpler to handle it this way!”


Go Phish

by in Feature Articles on

A few years ago, researchers at Harvard University and UC Berkeley published a rather interesting study about phishing. After running a usability study to see how well people can detect phishing attempts, they found that:

  • 23% of the study's participants did not look at the address bar, status bar, or the security indicators
  • 68% proceeded without hesitation when presented with popup warnings about fraudulent certificates
  • 90% were fooled by good phishing websites.
  • Neither education, age, sex, previous experience, nor hours of computer use showed a statistically significant correlation with vulnerability to phishing.

To make matters worse, the study's participants were actually trying not to get tricked. "Our study primed participants to look for spoofs," the researches explain, "thus, these participants are likely better than 'real-world' (un-primed) users at detecting fraudulent web sites."


Moving Technology Forward

by in Error'd on

"I saw this sign in the window of an empty storefront," Jason Sullivan wrote, "and I can't decide if the biggest WTF is using poster board, stencils and multiple colors of what appears to be chalk in their quest of 'moving technology forward', or the fact that they apparently made a mistake while putting the 'N' in consulting and just decided to use a bit of masking tape to correct it, rather than flip the board over and start again."


Slow-Motion Automation

by in Feature Articles on

Photo Credit: Pulpolux !!! @ Flickr Despite being considered a small player in the insurance field, Mike I.'s company writes $1.1 billion in premiums annually and has carved itself a nice niche in the area of non-standard automobile insurance. Non-standard is for drivers who are rejected due to things like too many speeding tickets, fender benders or DUIs. Like all other insurance companies, Mike's relies on complex custom software to quote and write its policies.

Complex is a bit of an understatement. Because the company does business in more than 40 states, it has to comply with each and every state's specific insurance regulations. Certain types of coverage aren't allowed in some states, deductibles vary everywhere and the limits seem to randomly change. One of the biggest challenges with such complex software is that testing becomes very difficult.


If I've Said It Once, I've Said It Fifty Times

by in CodeSOD on

I can think of several ways to improve the code below from Jeff S., or at least to reduce its line count by two or three.

function submitTrap3()
{
    var n = 0;
    var f =0;
    var elementItem = "";
    if (window.event.keyCode == 13)
    {
        for (n=0;n<document.forms[0].elements.length;n++)
        {
            elementItem = document.forms[0].elements[n].name;
            if ((document.forms[0].elements[n].value != "") &&
                (elementItem == trim(document.forms[0].txtControlName.value)))
            {
                switch (elementItem)
                {
                    case "header1:SearchBox" :
                    {
                        __doPostBack('header1:goSearch','');
                        break;
                    }
                    case "Text1":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text2":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text3":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text4":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text5":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text6":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text7":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text8":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text9":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text10":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text11":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text12":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text13":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text14":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text15":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text16":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text17":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text18":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text19":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text20":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text21":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text22":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text23":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text24":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text25":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text26":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text27":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text28":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text29":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text30":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text31":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text32":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text33":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text34":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text35":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text36":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text37":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text38":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text39":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text40":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text41":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text42":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text43":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text44":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text45":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text46":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text47":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text48":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text49":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                    case "Text50":
                    {
                        window.event.returnValue=false;
                        window.event.cancel = true;
                        document.forms[0].elements[n+1].focus();
                        break;
                    }
                }
            }
        }
    }
}

Circling the Solution

by in Feature Articles on

Tore S. had it made. He landed an enviable position that many of his fellow students had been gunning for – an evening/night shift as a Unix admin and general support for a large company that let him work from home. And you know what that means: equal time given to work and dancing around in your PJ's Risky Business-style. He could sleep and get paid for it, so long as he kept his cell phone on and would wake up and answer if/when it rang. Then he'd have to VPN into the network, do his thing, and then carefully weigh the decision to have another one-man dance party or go back to sleep. (Sleep usually won.)

One fine Saturday morning around 11:00, Tore was sound asleep, visions of sugarplums dancing in his head – only to have his wonderful dream violently interrupted by the screech of his cell phone. Tore squinted, rubbed his eyes, and read the caller ID. Damn, it was work. He quickly practiced saying "hello" without sounding tired, and then answered.


Not Quite $30

by in Error'd on

"I took this with my cell phone at the gas station," T. Bare writes, "I think there's something wrong with their rounding... unless there invented a new increment of the dollar that I'm unaware of."


Raiding the RAID

by in CodeSOD on

"I'm currently in the process of customizing the firmware for a RAID controller used in some of my company's products," jspenguin wrote, "The LCD Controller Module (LCM) is written in PHP and, as it turns out, an LCM is not quite what PHP was designed for. In addition to abusing exec() all over the place, they poorly re-implement functions that are built-in to PHP."

function strcenter($string, $len = LCM_ROW_LEN)
{
    //printf("%s\n", __FUNCTION__);
    $size = strlen($string);
    if ($size > $len) return $string;

    $divisor = ($len - $size) / 2;
    
    unset($new_str);
    for ($i = 0; $i < $divisor; $i++) {
        $new_str .= " ";
    }

    $new_str .= sprintf("%s", $string);
    
    for ($i = strlen($new_str); $i < $len; $i++) {
        $new_str .= " ";
    }
    //$test = strlen($new_str);
    //echo "len = $test\n";
    return $new_str;
}

function strleft($string, $len = LCM_ROW_LEN)
{
    //printf("%s\n", __FUNCTION__);
    $size = strlen($string);
    if ($size > $len) return $string;

    $remainder = $len - $size;
    
    unset($new_str);
    $new_str .= sprintf("%s", $string);
    
    for ($i = 0; $i < $remainder; $i++) {
        $new_str .= " ";
    }
    //$test = strlen($new_str);
    //echo "len = $test\n";
    return $new_str;
}


 function LCM_get_base_position($length, $tag=TAG_NONE)
{
    for ($i = 0; $i < $length; $i++) {
        $string .= "X";
    }
    
    switch ($tag) {
    case TAG_ENT:
    case TAG_SCROLL:
        $max = LCM_ROW_LEN - 1;
        break;
    case TAG_SCROLL_ENT:
    case TAG_UP_ENT:
    case TAG_DN_ENT:
        $max = LCM_ROW_LEN - 2;
        break;
    case TAG_NONE:
    default:
        break;
    }

    $string = strcenter($string, $max);
    //printf("%s: str = %s, max = %d, length = %d\n", __FUNCTION__, $string, $max, $length);
    $pos = strpos($string, 'X');
    
    if ($pos == false) {
        printf("%s: Failed to get postion\n", __FUNCTION__);
    } else {
        return $pos;
    }
}