Archive

Posts Tagged ‘conventions’

An image splits; time lack distinctinction

June 21st, 2009

A man named Shaun E. Kiernan asks if I know of any programs purposed toward splitting PNG files. Barring image editors, I do not.
Saying no to people is not something I do well. I offer to make him one. Development time should be brief.

I do so. It is so.

I rebel against the common over-use of text fields. I do not worry about certain conditions. If an image cannot be evenly divided, it will try for pixel fractions. This is an obvious mistake, but the fault is theirs. I implement tarring, for increased ease-of-use. I commandeer and massage code from Bradicon. It is done in under an hour.
He laments its interface, though it seems functional. He claims it suits his need.

I spend some more time on the user interface. This is as far as I see it going.

It is a program that splits an image, and split images is what it does.

Dev, Uncategorized , , , , , ,

When Google is not available, I ask Karl

March 7th, 2009

I don’t know if you’ve ever used a web browser before, but a common UI convention is to display a box at the top of the window, into which you type an address – or URL. It let’s the browser know what you want to retrieve, and soon you are browsing away like a professional.
With certain websites, Chrome asks if I’d like to preform a website-specific search using a query typed directly into his very own address bar – something I find very cool and also reasonably useful.
Firefox, too, but who cares about him?

Anyway, It caught my interest and when that happens there is one friend I turn to most of all. I asked Google about the situation, and he told me about Open Search description documents. I listened carefully, impressed by his knowledge and references – and guess what? They are super easy to make!

Also there are related plugins available for wordpress. Now you can search the GC from within your address bar! I think the future was yesterday.

Speaking of plugins, I installed another one that does syntax highlighting using Geshi, similar to codepaste classic nano touch.

the Altered Effect businesscard

Umm.. I submit that they look better in real life, which may even be true. The black side has shininess on it, in the shape of a portion of the altered effect logo. The gloss scratches off relatively easily, but whatevs.
The text on the black side is almost unnoticeable from most angles. Not what I intended, but I’m actually pretty cool with it.

I really like the weight and texture of the cards. They feel almost plastic-like. They came 7 days early, and I have ~950 of them. I am basically swimming in a sea of identical business cards right now.

Also, I’ve installed Portal on my media server and set it up with the wireless xbox360 receiver. When people come over, we can play portal on the TV now with the XBox360 controller – in addition to Left 4 Dead, and N+.

Brad out.

Business, Discoveries, Personal, Uncategorized , ,

When paths diverge indecision attacks with a sort of brutal pride

February 19th, 2009

Guys, I have a problem. Sometimes a decision seems so trivial it stops me completely, and that was the case today.
I was trying to decide how to pass data:

data[0] = 3
data[1] = 9

or

data[3] = 1
data[9] = 1

The first method creates an array whose elements are the object IDs we want. The second, an associative array whose keys are our IDs.
I know. You’re thinking: Who the eff cares? Also, I know that you’re Shaun.
And you’re right, it doesn’t matter. At all. But I had no preference in terms on convention.

I did what anyone would do – the only thing I could do, I wrote a script to test the speeds of the two pertinent PHP functions. I call it in_array vs. array_key_exists. In case you haven’t guessed, it compares the relative speeds of in_array and array_key_exists. Feel free to play with it.

In fact, I’ll post the code. Give it a look, and decide I did it wrong.

But who really wants to click on so many links? Good news! You don’t even have to; array_key_exists won. And for the search engines: array_key_exists is faster than in_array.

If you didn’t take my word for it, and jumped from link to link searching for personal verification, you may have noticed that decreasing the number of operations often leads in_array to victory. This, I suspect, is because with fewer operations unrelated overhead has greater impact.

Guys, this is important stuff. Those ~0.003 seconds over 20,000 operations is a big deal. In fact, I submit it is everything. Those are three one thousandths of a second you might otherwise never get back.

Dev, Discoveries, being helpful to people less experienced than myself in the ways of the world; mostly in the ways of the web actually , ,

returning false; this is a weird post at sheldon’s insistence

February 15th, 2009

Days ago, I shared a conversation with a man named Jeff. We met in an alley off the a lesser-known junction of the Canadian arterial internet pipe. I was afraid, at first, as he is tall and wildly bearded. But he was not an electronic mugger, and wished instead to discuss an issue encountered while using XHTML Strict.
This was convenient for me, for I had no wish to be mugged, and he said: When clicking on links to #, you are jumped to the top of the page.

<a href=”#” onclick=”do_some_js_stuff();”>JS Interface link</a>

I agreed with him, not yet convinced his intentions completely mug-free, and suggested returning false.

<a href=”#” onclick=”do_some_js_stuff(); return false;“>JS Interface link</a>

Dawn found my words effective, as I left that alley with both wallet and dignity.

But the experience got me thinking. I would prefer an internet better lit, and I might approach it like this:

<a href=”#” class=”jsui” onclick=”do_some_js_stuff();”>JS Interface link</a>

And with jquery, use the jsui class to automatically return false on clicks:

$('.jsui').click( function() { return false;});

An other option would be to return the return value of the event handler you’re already using:

<a href=”#” onclick=”return do_some_js_stuff();”>JS Interface link</a>

And just be sure to return false from applicable handlers.

In summary, when clicking on a link to # while using XHTML Strict, you will be jumped to the beginning of the page. We can combat this by returning false. There are many ways you can do that, but which you use probably only matters if you are a snob.

Dev, Opinions, being helpful to people less experienced than myself in the ways of the world; mostly in the ways of the web actually , , ,