Friday, December 30, 2011

Flash Sucks

But everything else sucks more.

Where is the alternative to the write-once run-anywhere platform that has a rich UI toolkit, is installed on almost all machines ... what? Java you say? Really, come now; Loading anything in Java in the browser feels like I'm booting up a Virtual Machine. What about Silverlight? No, not that either.
Standards you say? Ok, let's roll. You can do most of what Flash does with:
  1. CSS3
  2. HTML Video
  3. WebGL
  4. Adaptive Bitrate Streaming (progress)
  5. HTML Canvas
  6. Imaginary Partial Loading Support That Doesn't Exist (maybe the partially supported <script defer="defer">)
  7. SVG
  8. The Imaginary Sandboxing for Separation of Applications standard
  9. HTML Audio
  10. HTTPS
  11. WebSockets
  12. Imaginary Crossdomain.xml Equivalent That Doesn't Exist
  13. LocalStorage
  14. ECMAScript 5
  15. IndexedDB
And even if you got the imaginary things working and the drafts finalized you still need a solution that
  • Works on all major platforms
  • Works on all major browsers
  • Has no nuanced implementation details
  • Has non-conflicting, non-ambiguous standards
  • Is well understood
  • Has a usable IDE for graphic designers
  • Has a wide, cheap, coder base.
Flash does this. In fact, I had streaming, synchronized, animation and audio in 1996, on Netscape 2.0, on a Pentium 1 @ 120Mhz with 16MB of RAM, on a 28.8Kbps connection, on Windows 95. All I had to do was download a 160KB add-on and restart my browser; back before DOM 0, and when the W3C was moving from SGML to the fancy new "XML" standard.
A decade and a half later, going to the CSS3 equivalent I have to carefully choose the browser, then see my cpu hosed and still have frame drop, have audio sync problems, and have to load ALL of it before seeing ANY of it.
The Flash hate is totally misplaced. What they have done is absolutely phenomenal. I'm sorry that you see teeth whitening ads and porno site popups with it, but don't blame the technologists; that's like blaming Honda Of Japan because some asshole cut you off on the Freeway.
And besides, what will the ad-haters use in this future world of 2022? Some amalgamated FlashBlock equivalent that can easily just turn off all the annoying stuff? This line will be blurred and it won't be possible.
Adobe has done, and continues to do what Microsoft Failed at, what Apple Failed at, what Sun Failed at, and what Google is almost, but not quite, succeeding in, decades later.

Sunday, November 27, 2011

What a Nice Logo you have, Where Did You Find it?

The small record label Balance Underground (or Alliance) has apparently lifted the Debian swirl as their logo for the past few years (actually legal, but only if the jackets have a disclaimer). It's a sub-label of another swirly label called Balance Recordings that appears to have different artwork.

Apparently they were also Spelling-Bee Champions.



Here's some releases, most of them link back to discogs; the ones at the bottom are from their Facebook page.



About the author
Chris Mckenzie writes Free software.

Edit 1: The Debian swirl appears to be trivial to construct and has been used by other organizations.
Edit 2: A representative from the organization in question has some replies below concerning the logo! :)

Wednesday, November 23, 2011

Augmented Wiki Model

Augmented Wiki Model

Statement of problem

An artifact of the traditional wiki model is that malice, bias, and fiction (un-valued content) can masquerade itself as factual information. The mechanisms deployed to prevent this; banning users, protecting, and locking pages each require manual intervention by a member of a privileged group of users.

Objective

To minimize the amount of un-valued content on a wiki by augmentation of the wiki model.

Assumptions

  1. The value of a user's recent contributions can be used to predict the value of a user's contributions in the near future.
  2. The value of a page of content currently to a wiki community can be used to predict the value of the content in the future under a certain guideline (outlined below).

Methodology

Given the above axiomatic assumptions, I propose to augment the wiki model as follows:

  1. Assign a variable to every user and to every page.

    1. The user variable will be called the "integrity" of the user and be a signed number starting at 0.

    2. The page variable will be called the "value" of the page and be a signed number starting at 0.

  2. Every user will be allowed to state a fully retractable, single "+1" "0" or "-1" on another user's or page's value. In theory this will create the following:

    1. The value of the user's contributions will be directly reflected by the sum of the value of their integrity, assigned by other users.

    2. The value of the page's content will be directly reflected by the sum of the value of the page, assigned by users.

  3. Under the above constraints, the following limitations, that by assertion preserve the spirit of the wiki, can be imposed:

    1. There will be two types of edits: moderated, and un-moderated.

      • Moderated edits

        • Another user has to approve the edit

        • Any edit where a user's integrity is less than a page's value becomes a moderated edit

        • Only users whose integrity is greater than or equal to the value of the page can approve an edit queued for moderation

      • Un-moderated edits

        • An edit that does not need approval.

        • Any edit where a user's integrity is greater than or equal to the value of the page becomes an un-moderated edit

    2. Furthermore, the following safeguards will be used

      • Since certain accounts will now be of more value than others, hijacking will become a problem.

        • A user's integrity will only be viewable by a user with more integrity.

        • Page values will always be viewable.

        • Only a user with an integrity greater than or equal to the a page's value can view the queue for moderation with the exception of

          • A user who submitted an edit for moderation can purge their submission from the queue

        • The history of a page will not reveal to a user with insufficient integrity which edits were moderated and which edits were not

        • Since people can gain integrity through deceit, and then only disclose malicious intent after accumulation of power, any vote placed upon a user or a page is fully retractable.

Hypothesis 1

Under the augmented wiki model as proposed above, the quantity of un-valued content on a wiki will decrease.

Hypothesis 2

The augmented wiki model as proposed above eliminates the need for the traditional manual protection mechanisms employed to prevent un-valued content being committed.

Friday, November 11, 2011

The winners are: Opera, IE, Firefox, Chrome, Safari; in that order.

This is a response to a contentious blog entry I wrote two days ago.

In under 36 hours, a lot has changed:
  • ECMAscript.org has updated their tests
  • Opera 12 Alpha is out.
  • Firefox 10 Alpha is out.
Also, many said I didn't give Opera a fair shake. So now the beta and alpha builds have been included.

Here's the updated (2011-11-11) results. Each browser's data is compressed with bzip2.
BrowserFailsThe photoThe dataRelease Status
Opera 11.60 beta 11471ScreenshotXML ResultsBeta
IE 10 10.0.8102.06ScreenshotXML ResultsAlpha
Opera 12.00 alpha 111611ScreenshotXML ResultsAlpha
Firefox 10.0a2 2011-11-11160ScreenshotXML ResultsAlpha
Firefox 9.0164ScreenshotXML ResultsBeta
Firefox 8.0164ScreenshotXML ResultsRelease
IE 9 9.0.8112.16421322ScreenshotXML ResultsRelease
Chrome 17 17.0.932.0 dev-m415ScreenshotXML ResultsAlpha
Chrome 16 16.0.912.36 beta-m415ScreenshotXML ResultsBeta
Chrome 15 15.0.874.120 m416ScreenshotXML ResultsRelease
Safari 5.1.1 6534.51.22772ScreenshotXML ResultsRelease
Opera 11.52 11003751ScreenshotXML ResultsRelease
IE 8 8.0.6001.18702N/A[1]ScreenshotN/ARelease
1The test fails to run in IE8, much like the last time. But after the error is hit, the status bar quickly goes back to saying "done". The developers tools, however, shows the error in the same place.

Well, Opera wins. and the old becomes new again. IE10 still takes the number 2 slot with everything else staying nearly the same.

about:
Tests were done on Windows 8, XP, and Vista; to try to main consistency. If you want to contact the author, reply here below. The author is Chris McKenzie; a programmer dedicated to truth, no matter how crazy it gets. Check out his projects on github.

Wednesday, November 9, 2011

The Acid3 of JS has a few surprises.

Edit: Updated Results Are Available Here

Wikipedia has an article on a Javascript conformance test called sputnik from Google.

It has the results from various Desktop browsers on how standards-compliant they are. Now I know what you are thinking, probably #1 is Chrome because the test is from Google, followed by Opera, Safari, and Firefox; with IE trailing behind in a pitiful display of brokenness.

But that's not what Wikipedia shows. In fact, it shows IE as the most standards-compliant browser.

Microsoft has quite brilliant engineers and recently they've began to take their browser seriously again, but to say that Internet Explorer has the most standards compliant JS engine? This would be quite a departure from history.

I needed to verify these results, for my own sanity.

According to Wikipedia, the test has changed hands and is now hosted at test262.ecmascript.org. You can go there now, it's on a domain registered by Mozilla Corporation. So this doesn't look like some wonky unfair comparison that almost looks to be designed to make Microsoft look good. Let's get questions of legitimacy out of the way.

Here's the updated (2011-11-09) results. Each browser's data is compressed with bzip2.
BrowserFailsThe photoThe data
IE 10 10.0.8102.06ScreenshotXML Results
Firefox 8.0164ScreenshotXML Results
Firefox 9.0 (2011-11-08)164ScreenshotXML Results
IE 9 9.0.8112.16421322ScreenshotXML Results
Chrome 16.0.912.32 beta-m415ScreenshotXML Results
Chrome 15.0.874.106 m416ScreenshotXML Results
Opera 11.523750ScreenshotXML Results
IE 8 8.0.6001.18702N/A[1]ScreenshotN/A
1The test fails to run in IE8 and hits a Javascript error fairly early on.

IE 10 did the best by far. Surprised? Me too. The next up was Firefox. Also surprised? Yeah, here too. Then IE 9 ... IE 9? The world is crazy sometimes. Chrome comes in right above Opera, which basically eats shit ... that's a new one. What has this world come to?

One of the important things to note is that failures seem to happen in batches. That is to say it's successful for a few hundred (or a few thousand) tests, then a bunch of tests fail consecutively. Almost makes me think of that math exam you once got where questions 2-8 depended on you getting question 1 right.

These tests also don't speak to how performant the browsers are on, well, anything. Their are more factors than compliance-to-standards when it comes to providing the best web experience. Regardless, these results certainly support the on-going notion that IE is finally back in the running.

Further Work

I just looked at the number of failed tests; not focusing on the content of what tests failed. I'm not familiar enough (and just plain not smart enough) with the internals of ECMAScript to know whether the results warrant further investigation or concern. I do know from my own experience that I've fallen victim to many more IE Javascript bugs then other browsers. And perhaps, that's the important thing; not whether a feature is implemented, or passes a smoke screen test, but whether the feature has problems. It would be great to hear what some of the browser developers have to say about these results.

about:
Tests were done on Windows 8, XP, and Vista; to try to main consistency. If you want to contact the author, reply here below. The author is Chris McKenzie; a programmer dedicated to truth, no matter how crazy it gets. Check out his projects on github.

Friday, November 4, 2011

PHP? LOLZ!

First, complaints from an imagined developer:
OMG PHP,
  1. You are not nerdporn. When I do my contracting as a developer, I can no longer take my fixie to the local programmers coffee shop to do work and look cool. Since I don't go out otherwise, how the hell am I going to get a girlfriend in Sunnyvale with such crap?
  2. You are so easy to use that your community is chock full of people who can't code. Like a business guy fooled into the idea he can skimp out on hiring one of us expensive nerds by coding that brilliant facegrouptube idea himself (with an iphone app of course, it'll make millions!). How hard can it possibly be to write a product and platform? Pshh!, piece-o-cake!
  3. You are simply not expressive enough. My coding boner goes way flaccid when I see how not purty PHP is. When my emacs window doesn't follow the rule of thirds when looking at code I get pissed off and it makes baby jesus cry.
Sincerely,
Programmers of the Internet.
With all the hate, why is it still hands down, the most popular language for websites that people actually use?

Things get done when bickering pedantic coders stop caring about process and focus on product. Picky nerd debates about refactoring, design, coding approach ... get tossed, because they are more annoyed by the environment then they are by all those lost Dr Who episodes. This speeds things up enormously (because nobody is arguing any more) and like magic, shit actually gets done.

This makes PHP an extremely productive, fluff-free language. It's not going to change any time soon and nobody is excited about it; people don't assemble in church basements on a Tuesday night like narcotics addicts to talk about how awesome it is at solving all your problems.

It becomes just a tool; which is the ideal position of any language.

Wednesday, October 5, 2011

Americas wealthiest company put out a press release today.

iPhone 4S reviews weren't what we expected

So we pulled the plug. There will be no Jobs. No Jobs today, no Jobs tomorrow; no Jobs forever! Now go away because without Jobs, we'll never again have anything you'll want.

Monday, October 3, 2011

Droid X Gingerbread Review

I "upgraded" my Motorola Droid X recently to Gingerbread:
  • Recording videos doesn't work. Instead my phone skillfully convinces me it's recording but then has no stop button, no way to leave the application, and stays in the video mode until I pull the battery.
  • The phone now runs hot and the battery lasts about 1/3 the time as before. Might as well carry around an assortment of extra batteries just so I can use it throughout a regular business day.
  • Swype now prefers really obscure words like "tutu" when I mean to type "you" and half the time fails to put a space in between words. The browser gets real confused when that happens and clears the input, not permitting me to manually add a space after I realize the mistake.
  • Although the experience is now shinier with gradients and catchy animations, it is effectively immaterial when applications are hanging left and right and the actual interface for major components (like marketplace) have discarded basic features and transformed themselves from applications to advertisements.
Now here's some big questions:
  • Why is task switching still unsolved? I need to download third party apps just to go in between two running processes. Really?
  • Why is task killing still so difficult? To kill a task, Simply follow these 10 basic steps: (1) Go to the home screen, (2) Click the left button, (3) Press "Settings", (4) Scroll the menu down, (5) Press "Applications", (6) Press "Manage applications", (7) Press the "All" tab, (8) Scroll through the application list, (9) Press the menu item of the application you want to stop, (10) Press "Force stop".
    What the hell is that? 10 steps to exit a program?
    I'd hope that making this easier would be somewhat a priority.
Useful things that shouldn't have been removed
  • Was moving an icon from the application list to the home screen so unbelievably hard and counterintuitive that you had to axe it and replace it with a 3 step process (which doesn't work if you have a task switcher btw)
  • What is the white gradient near the bottom of the screen? My guess is that 1 out of every 10,000 users had some phone background that was just a montage of android icons and then they went in to their carrier, complaining that they couldn't find the buttons on the interface. It really harkens back to the old days when there was a d-pad with an "ok" button in the center wherein the default functions for the d-pad were operations that incurred a charge, like calling your voicemail or depositing money directly into your carriers bank account.
  • The interface is now branded everywhere with my mobile carrier. Are they so insecure that I need to be reminded every screen in the largest letters on the screen, who I pay every month? My carrier has already opted to plaster their logo on both sides of the phone (in fact, it is etched in the back).
Features that nobody wants
When I press the home key slightly too quickly, a very slow and clunky application pops up that overrides my silent volume setting and chimes "Say a command". I usually get here when I am trying to exit a hung application in order to go through the ten stop process to kill it. However, I get redirected to conversation mode. I've tried "Go fuck yourself" or "Eat shit" but it just responds with "Did you say ... Call Mom?"

And finally, Blockbuster. Costumers are literally going way out of their way, with the possibility of bricking their phone in order to remove their application from the default install list. That's how bad blockbuster actually is. People hack their phone to uninstall it.

Conclusion
I know how hard it is to make an Operating System; but having things like the video recorder crashing the phone should have been caught in early QA testing; a user trying swype for five minutes would notice the expansive vocabulary that the phone guesses when you are trying to say "I am outside near the gas station", and they should have noticed way early that they literally cut the phones battery life by 70% ... and then should have been like "hrmm ... let's not release this."

This version is a major disappointment. It's such an important time too; Google has an opportunity to really snatch the marketshare from Apple; but it's not going to happen with crap like this.

Thursday, September 1, 2011

Sometimes Old Ideas just need Good Execution

When ideas that have never been successful keep coming up over and over again it's usually because they simply haven't been implemented right and are just waiting for someone to think up the right sauce.

Ambitious successful technology is usually a culmination of decades of failure. For example:

1. Touch screen computing (iPad)
2. On-demand video (YouTube, Hulu)
3. Video phones (Skype)
4. The all-in-one fits-in-the pocket pda/phone (Android/iPhone)

If you talked to say, a YouTube exec in 2004 about their ideas you'd probably walk away thinking "Oh yeah, that idea; the one that has failed so hard, so many times, that I was looking for the hidden cameras".

And you'd be dead wrong.

This isn't new, if you go back 40 years you'll find that Credit Cards, Bar Codes, ISBN numbers, the home theater, all had predecessors that sucked. Even the personal computer and the home video game system had years of failed starts.

Monday, August 29, 2011

The Lottery Analogy

I've told you the lottery ticket analogy, right? It's really important that everyone understands this:

If you want to win the lottery, you need to do something that makes that possible; in this case it's buy a ticket. But you'll probably lose and that ticket will probably be worthless. However, you cannot win the lottery without it. And who knows? You might, actually, indeed, win.

Here's the rules:
  1. You can't win without playing.
  2. Every time you play, you get a new chance to win, independent of the previous chances.
  3. Doing the right thing on the wrong day is worthless. Even if you do everything perfect and you get really lucky, there are still externalities that will almost always snatch the victory from you. You will then see someone doing the exact same thing as you on another day and succeeding.
  4. When you realize that you picked the right numbers on the wrong day, get over it and Play Again. Don't allow your past to paralyzed you.
  5. You will officially lose far before you personally know it. Make sure you know what failure and loss looks like and then accept it. Never fool yourself into thinking you have a winner, acknowledge the loss and move on as quickly as possible.
This is true in all aspects of life: you want to have a famous pop song? You need to do something that makes that possible; in this case work quite hard and make a song. But you'll probably lose. That song, will probably be listened to by nobody. However, you can't have a famous song without it.

Want to be a successful author or get a good job or make money on the stock market or be a famous scientist? The same rules apply.

Wednesday, July 20, 2011

on getting a job

know what you can tolerate
if you don't think you could put up with being a sysadmin every day, don't ever apply as one; regardless of skill; you won't get the job unless you interview at a dysfunctional company that you won't want to work at. know what role you would be willing to put up with and apply strictly for those positions.

getting an interview

resumes are important, github is more. you are pitching yourself, over email. silence isn't a problem. keep trying until someone explicitly says no. remember you are talking to humans and not grammar professors. be cordial but formal; assertive, eager, and well-mannered.

interviewing
smile, agree with everything, answer slowly and clearly, make eye contact, laugh at their jokes, gloss over their mistakes, don't bring in any baggage, and don't worry too much.

after the interview
it's critical to send an email after about 4 but less then 24 hours later. repeat the same pleasantries.

about pay
understand what you need to leverage before it comes on the table. you should make the first offer, always. do it at the point of accepting the job after the employer has vested in you as a future employee. make it implicitly but not explicitly clear that you will quickly back out if conditions aren't met.

remember why are you working
most programmer I know would rather be working on their pet project (which is The Next Big Thing) full-time instead of for a company. If this is your goal, remember this at the negotiation table; 5 day work weeks, coming in around noon, leaving at 5 strictly every day; all of these accommodations are best set at this point.

Friday, May 27, 2011

Abandon your cake

Pretend you spend all day making your spouse a cake. You carefully research the ingredients and then painstakingly try to the best of your effort to do everything well. However, it comes out slightly too brittle; the hand-made frosting is a little tart. But you spent a lot of time on it.

You present the cake. After the overjoyed response, you proceed to cut the first slice and your spouse takes the first bite, rolls the taste around, ponders a bit and very seriously states, "A bit bland, the frosting needs some work. Let's go to the grocery store and get a better one."

You are shocked. "Let's go to the grocery store?!", you spent all day on that damned thing; the store wasn't even open when you started; there were not even cakes available for sale at the time you began.

But sure, you aren't a pastry chef and you probably made a few mistakes along the way, but it's your cake. You made it specifically for your spouse.

But now, of all things, your spouse looks impartially at it, throws out the idea that you had anything to do with it and does some objective comparison. The conclusion is inescapable; the store is in fact open now, and does sell better cakes than the one that you made and instead of making it yourself you probably should have just gone out and bought one when the store opened, spending all of 20 minutes.

However painful it may be, you must acknowledge that if you want to enjoy a great cake, you should toss yours in the garbage, forget about it, and grab one from off the shelf.

Software is the same way. Oftentimes you will find that a solution baked in-house by a colleague you know and respect is not as mature as one that is open source.

Sometimes although the in-house solution may predate the open source one by many years, the open source solution appears to have raced ahead in quality, stability, and features.

You know intellectually that you will get a better product if you go forward with the open source solution that is well supported and well written. You know that you will free up the time of all parties involved. It looks like a pure business and logical decision. It's easy to forget the fact that you are suggesting to toss out someone's handmade cake by effectively saying:
Hi. I just wanted to say that you wasted your time and your solution is inferior to something I found in 30 seconds on google. We should be using this instead.
Breaking this news is one of the most difficult things to do at a personnel level on any programming team. You look like the new kid tossing out personal insults, disparaging the quality of your colleagues works; suggesting that they produced inferior code that simply is not good enough to be put in any project that you want to work on.

The truth is though, adopting open source (ie, off-the-shelf) components over in-house solutions can often be a leading factor in whether a project is successful and done on schedule. Off-loading as much responsibility as possible permits your team to focus on the product and not the dependencies.

When you are the cake maker, this reality is a very difficult thing to accept. "My cake is worthless?", you incredulously pout. You skeptically go over the open source project with a fine-toothed comb. "But wait", you insist, "It can't do xyz, and I can. Ha!" or "Let's run some performance tests and see how this POS does".

However, you acknowledge that it is well done. They are catching errors that you were too lazy to check for; they have active mailing lists and people around the world fixing bugs while you are at home sleeping. Intellectually, you know what to do:

Abandon Your Cake.
Implement the stuff you have that the open-source project does not and submit a patch. Probably introduce yourself as someone who has written a similar project but has done the grief of switching over.

Once you get over yourself and toss your cake away, you can hop on the winning team with enough courage and strength.

Don't look at it as if you need to match the feature-set of the project but as a collaborative project with open-membership that you have specific expertise on.

You came up with a solution to a generic problem that many people face and you learned a lot by building it out yourself. You have a lot of knowledge to contribute. You were good enough to do the solution single-handed; you are certainly good enough to contribute to a group effort.

So someone else won the internet lottery fame game this time, it happens. Go join them and you will be a valued member of their team. After a little while you will be able to faithfully consider it your project as much as any other contributor.

It will be easier, you'll get more exposure, and you can claim part ownership of something that people actually have heard of instead of filling your resume with github projects that are only watched by yourself.

Sharing the fame beats pounding the pavement any day.

Sunday, April 17, 2011

hold on ... even better


if($level=="Level 1" && $month=="Month 1")
{
$newLevel="Level 1";
$newMonth="Month 2";
}
else if($level=="Level 1" && $month=="Month 2")
{
$newLevel="Level 1";
$newMonth="Month 3";
}
else if($level=="Level 1" && $month=="Month 3")
{
$newLevel="Level 1";
$newMonth="Month 4";
}
else if($level=="Level 1" && $month=="Month 4")
{
$newLevel="Level 1";
$newMonth="Month 5";
}
else if($level=="Level 1" && $month=="Month 5")
{
$newLevel="Level 1";
$newMonth="Month 6";
}
else if($level=="Level 1" && $month=="Month 6")
{
$newLevel="Level 2";
$newMonth="Month 1";
}
else if($level=="Level 2" && $month=="Month 1")
{
$newLevel="Level 2";
$newMonth="Month 2";
}
else if($level=="Level 2" && $month=="Month 2")
{
$newLevel="Level 2";
$newMonth="Month 3";
}
else if($level=="Level 2" && $month=="Month 3")
{
$newLevel="Level 2";
$newMonth="Month 4";
}
else if($level=="Level 2" && $month=="Month 4")
{
$newLevel="Level 2";
$newMonth="Month 5";
}
else if($level=="Level 2" && $month=="Month 5")
{
$newLevel="Level 2";
$newMonth="Month 6";
}
else if($level=="Level 2" && $month=="Month 6")
{
$newLevel="Level 3";
$newMonth="Month 1";
}
else if($level=="Level 3" && $month=="Month 1")
{
$newLevel="Level 3";
$newMonth="Month 2";
}
else if($level=="Level 3" && $month=="Month 2")
{
$newLevel="Level 3";
$newMonth="Month 3";
}
else if($level=="Level 3" && $month=="Month 3")
{
$newLevel="Level 3";
$newMonth="Month 4";
}
else if($level=="Level 3" && $month=="Month 4")
{
$newLevel="Level 3";
$newMonth="Month 5";
}
else if($level=="Level 3" && $month=="Month 5")
{
$newLevel="Level 3";
$newMonth="Month 6";
}
else if($level=="Level 3" && $month=="Month 6")
{
$newLevel="Level 4";
$newMonth="Month 1";
}
else if($level=="Level 4" && $month=="Month 1")
{
$newLevel="Level 4";
$newMonth="Month 2";
}
else if($level=="Level 4" && $month=="Month 2")
{
$newLevel="Level 4";
$newMonth="Month 3";
}
else if($level=="Level 4" && $month=="Month 3")
{
$newLevel="Level 4";
$newMonth="Month 4";
}
else if($level=="Level 4" && $month=="Month 4")
{
$newLevel="Level 4";
$newMonth="Month 5";
}
else if($level=="Level 4" && $month=="Month 5")
{
$newLevel="Level 4";
$newMonth="Month 6";
}


That must have taken like days or something ... I don't know if the programmer even knew about the advanced "copy" and "paste" concepts.

Saturday, April 16, 2011

wait wait

I can top that (below)



switch($month)
{
case'1':
$date = calculateenddate(1,$weakly,7,$unixtime);
break;
case '2':
$date = calculateenddate(2,$weakly,7,$unixtime);
break;
case '3':
$date = calculateenddate(3,$weakly,7,$unixtime);
break;
case '4':
$date = calculateenddate(4,$weakly,7,$unixtime);
break;
case '5':
$date = calculateenddate(5,$weakly,7,$unixtime);
break;
case '6':
$date = calculateenddate(6,$weakly,7,$unixtime);
break;
case '7':
$date = calculateenddate(7,$weakly,7,$unixtime);
break;
case '8':
$date = calculateenddate(8,$weakly,7,$unixtime);
break;
case '9':
$date = calculateenddate(9,$weakly,7,$unixtime);
break;
case '10':
$date = calculateenddate(10,$weakly,7,$unixtime);
break;
case '11':
$date = calculateenddate(11,$weakly,7,$unixtime);
break;
case '12':
$date = calculateenddate(12,$weakly,7,$unixtime);
}
return $date;

What is a loop?


function duedates($programStartDate, $month, $request) {
if ($request == "accelarate")
{
$weakcycle = '2';
}
else if ($request == "deaccelerate")
{
$weakcycle = '4';
}
else
{
$weakcycle = '4';
}
$db = new databasemanager();
$unixtime = strtotime($programStartDate);

switch($month)
{
case'2':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
break;
case'3':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
break;
case'4':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
break;
case '5':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
break;
case '6':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
break;
case '7':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
break;
case '8':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
$date[] = calculateenddate(7,$weakcycle,7,$unixtime);
break;
case '9':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
$date[] = calculateenddate(7,$weakcycle,7,$unixtime);
$date[] = calculateenddate(8,$weakcycle,7,$unixtime);
break;
case '10':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
$date[] = calculateenddate(7,$weakcycle,7,$unixtime);
$date[] = calculateenddate(8,$weakcycle,7,$unixtime);
$date[] = calculateenddate(9,$weakcycle,7,$unixtime);
break;
case '11':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
$date[] = calculateenddate(7,$weakcycle,7,$unixtime);
$date[] = calculateenddate(8,$weakcycle,7,$unixtime);
$date[] = calculateenddate(9,$weakcycle,7,$unixtime);
$date[] = calculateenddate(10,$weakcycle,7,$unixtime);
break;
case '12':
$date[] = calculateenddate(1,$weakcycle,7,$unixtime);
$date[] = calculateenddate(2,$weakcycle,7,$unixtime);
$date[] = calculateenddate(3,$weakcycle,7,$unixtime);
$date[] = calculateenddate(4,$weakcycle,7,$unixtime);
$date[] = calculateenddate(5,$weakcycle,7,$unixtime);
$date[] = calculateenddate(6,$weakcycle,7,$unixtime);
$date[] = calculateenddate(7,$weakcycle,7,$unixtime);
$date[] = calculateenddate(8,$weakcycle,7,$unixtime);
$date[] = calculateenddate(9,$weakcycle,7,$unixtime);
$date[] = calculateenddate(10,$weakcycle,7,$unixtime);
$date[] = calculateenddate(11,$weakcycle,7,$unixtime);
break;
}
return $date;
}



... Solid Gold I tell you ... solid gold ....

Sunday, April 10, 2011

horrible css today


<div class="heading18 width250 brdrbtm padbtm_10">Search for
Trainings</div>
<div class="gr10New width250 pad_top">
<strong class="bluetext11">
Search for Upcoming Teacher Training Programs
</strong></div>
<div class="pad_b3 width250 pad_top"><strong>Select Level:</strong></div>

Now look what you did; you broke the internet.

Horrible SQL


$db->query("delete from email_campain_settings where UserID='".$_POST['objID']."' and
TagValue='Active' and TagID='free' ");
$db->query("delete from email_campain_settings where UserID='".$_POST['objID']."' and
TagValue='Active' and TagID='paid' ");
$db->query("delete from email_campain_settings where UserID='".$_POST['objID']."' and
TagValue='Active' and TagID='GOLD' ");
$db->query("delete from email_campain_settings where UserID='".$_POST['objID']."' and
TagValue='Active' and TagID='SILVER' ");
$db->query("delete from email_campain_settings where UserID='".$_POST['objID']."' and
TagValue='Active' and TagID='PLATINUM' ");


Fantastic. Just go home, ok?

Friday, April 8, 2011

Javascript Database

Throwing my hat into this one: A Generic Javascript Database for all.

Saturday, March 19, 2011

abusing php header redirect

header('location:confirm.php?error=true&CN='.$_REQUEST['CNumber'].'&EY='.$_REQUEST['ex
pYear'].'&EM='.$_REQUEST['expMonth'].'&CHF='.$_REQUEST['CHolderFName'].'&CHL='.$_REQUEST['CHolderLName'].'&Cvv='.$_REQUEST['CV
V2'].'&CT='.$_REQUEST['CardType'].'&Message='.$myRsMessage);

Wow. Just, wow.

Monday, January 17, 2011

horrible css again

<div class="clear"></div>
<div class="text_center pad10">- or -</div>
<div class="clear"></div>
...
.pad10 {
padding:10px;
}

.text_center {
text-align:center;
}

.text_right {
text-align:right;
}

.bg_white {
background-color:white;
}

.show {
display:block;
}

.hide {
display:none;
}
...

sigh

CSS is not a macro programming language.


Look, I know CSS is hard. That's why you get paid well; cause you are doing difficult things. Now for the love of god, do it right. Because all you are doing here is creating a mess.

Sunday, January 16, 2011

Crazy PHP round 2

function createARB($refId, $name, $length, $unit, $startDate, $totalOccurrences, $trialOccurrences, $amount, $trialAmount, $cardNumber, $expirationDate, $firstName, $lastName,$loginname, $transactionkey, $host,$path,$address,$city,$state,$zip,$country,$phone,$email,$address2,$city2,$state2,$zip2,$country2) {

^^^ THAT ^^^ has a bigger brother:


function fetchRequestString($login, $password, $trans_id, $x_first_name, $x_last_name, $x_address, $x_city, $x_state, $x_zip, $x_country, $x_phone, $x_email, $x_Amount, $x_card_num, $x_card_code, $x_exp_date, $desc, $merchantEmail, $transKey,$x_invoice_num,$x_ship_to_first_name,$x_ship_to_last_name,$x_ship_to_address,$x_ship_to_city,$x_ship_to_state,$x_ship_to_zip,$x_ship_to_country, $x_tax, $x_freight,$x_line_items = false){


You know, modern languages can pass in structured data, right? We don't have to push things on to the stack like we did in 1965; you know this, right?

USPS API is horrible

Garbage Names


On January 2nd, USPS changed shipment option names from things like

First Class Mail International Package

to

First-Class Mail&lt;sup&gt;&amp;reg;&lt;/sup&gt; International Package**

This is not a bug. This is what USPS intentionally wants to use going forward.

The solution suggested to fix the apis that break on this is to do something like "strip &lt;sup&gt;&amp;reg;&lt;/sup&gt; and the **".

That is to say, that programmers should now put in a data sanitizer because USPS has decided to supply a bunch of garbage tags in their latest API. The recommended solution is to drop the new garbage.


Let me take some time and try to figure out how this could have ever possibly went down:

In December there was a board meeting:

Manager: Our brand name needs to be protected. Are we putting a ® everywhere that our brand "First-Class Mail" appears?
Programmer: Well, not exactly. Our programmer facing API...
Manager (interrupts): I've heard enough. When should we do this? Now, or after we fire you?
Programmer: B..but, this will break everything!
Manager: Well then, we will find someone that will respect our brand.
Programmer (under her breath): Holy fuck...
Programmer: Alright ... no problem sir. We'll have to send an email out.
Manager: The email has already been sent. We can't send out a second.
Programmer: Again, this will break everything, internatio...
Manager (interrupts): One email only. It's already been sent. People will adapt.
Programmer: Let's at least update our documentation by that week.
Manager: The documentation server are due for a scheduled downtime that week. We can't change this - the policy has been set.
(yes, they went down that week)

Really odd requirements


Ordering of things that probably ought to not matter, really do for USPS. For instance, This is correct:

<Length>12</Length>
<Height>8</Height>

This is wrong:

<Height>8</Height>
<Length>12</Length>

You have to do Width, then Length, then Height ... and only in that order. Similarly, you have to do Pounds, then Ounces, then Machinable, then MailType, then GXG, then ValueOfContents (mind the case), then Country, then Container, then Size, ... etc... in this order, and only this order.

And when it says it's optional on the documentation, don't count on it. It's required.

Here's how this may have happened, maybe.


Programmer: Let's use XML for our API.
Manager: What if someone specified Ounces first, then Pounds, instead of Pounds then Ounces?
Programmer: The keys are unique, that ordering will not be a problem.
Manager: What if it was a mistake?
Programmer: XML shouldn't care. The siblings orders should be interchangeable in the case of Key/Value assignment like this.
Manager: There should be only one correct way?
Programmer: We would have to go way out of our way to make this.
Manager: We pay you well, right?
Programmer: Ok Ok, let's at least state this in our documentation.
Manager: What? That there is only one correct way? Isn't this assumed? You are a programmer right? Aren't computers supposed to be this pedantic?
Programmer: Yeah well ...
Manager: We pay you well, don't worry about it.


Horrid Documentation


And why on earth does http://www.usps.com/webtools/htm/Rate-Calculators-v1-2a.htm take sooo damned long to load?

A peak at the source reveals:
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 11">

Yes. They write there technical APIs in Microsoft Word and then just save them as HTML and post them directly to the site. Genius. At least we can scrape a few things:

<o:Subject>Web Tools API Reference</o:Subject>
<o:Author>john.f.johnson@hp.</o:Author>
...
<o:LastAuthor>Amanda Loser</o:LastAuthor>
...
<o:_AuthorEmail dt:dt="string">Sherry.McNeill@hp.com</o:_AuthorEmail>
<o:_AuthorEmailDisplayName dt:dt="string">McNeill, Sherry</o:_AuthorEmailDisplayName>

My first tone of complaint will be the fact that they don't talk about the changes, although they seem to suggest there has been some. You see stuff like this in there example code:

First-Class Mail Interna<!--127 suppressed-->)

So their example code, isn't actually an example; it's a neutered copy and paste that doesn't actually illustrate a full exchange. It fails to serve its most fundamental purpose; which is to illustratively show what one means.

Followers