spudtater: (Default)
( Sep. 2nd, 2010 01:23 pm)
I got an email from [personal profile] galaxy_girl today asking about generating passwords for a whole load of individual documents. This set me thinking.

It's easy to generate random passwords in large quantities. But these generally aren't memorable — how easy is it going to be for an average user to remember something like "uJ5we0B"? There's techniques for generating memorable passwords, but these are generally quite long-winded; not really suitable for generating passwords in quantities.

I'm thinking more simple, mass-produced, low-security passwords along the lines of those which AOL used to send out on the back of their trial CDs. They would use paired dictionary words, all in uppercase, like BERRY-BRING, BRAIN-MUNCH or ICHOR-HAPPY.

AOL's approach got me wondering: what actually makes these memorable? Is it that they're real words, or is it that they're pronounceable? I put together a quick script to see what a bunch of pronounceable, but nonsensical, words would look like. The result looks like a mixture of Lewis Caroll and J.K. Rowling — with a scattering of medical-sounding nonsense thrown in for good measure:
hopivels     cholatids    nobuderm     claronilts   pomunits
chizitacks   mulemicks    ponawack     blupivads    gafirons
kupiperts    slunijords   blogamecks   pravozim     glufapurts
betaweld     cremutins    pluzarungs   prosinacks   valopings
pukinilds    flofutalls   losiwelt     dritulorms   boripungs
grojesicks   glewabocks   trebizurt    namiruss     blavokerms
tabamungs    thetipurds   crividum     vokulash     slutifoss
kurumulls    grifuvids    bligeling

This tickled my fancy enough to translate it into JavaScript, and put it up on my webpage. I'm still not sure if these are any good as passwords, but it's an amusing toy.
spudtater: (Default)
( Sep. 1st, 2010 02:58 pm)
Which is more evil?
public MyReturnClass<ILikeGenerics> doSomethingAndTimeIt1(MyClass parameter) {
    long startTime = System.currentTimeMillis();

    MyReturnClass<ILikeGenerics> result =
        doSomethingComplicatedHere(parameter, this.someInstanceVariable);

    log.debug("Took " + (System.currentTimeMillis() - startTime) + "ms");
    return result;
}

public MyReturnClass<ILikeGenerics> doSomethingAndTimeIt2(MyClass parameter) {
    long startTime = System.currentTimeMillis();

    try {
        return doSomethingComplicatedHere(parameter, this.someInstanceVariable);
    } finally {
        log.debug("Took " + (System.currentTimeMillis() - startTime) + "ms");
    }
}
spudtater: (Default)
( Apr. 22nd, 2010 12:55 pm)

Hmmm... that's the same for me as it was for two of my friends list.

*Tap tap*

This thing working?



Never a good sign:

customer/stock/sql/GetCurrentStockValueDaveStyle.sql
spudtater: (Default)
( Jan. 9th, 2010 09:36 pm)
So, recently I've been quite excited about Android phones, and have been meaning to get one for a while.

In a happy turn of events, my brother, who works for Google (marketing, not programming), has obtained a surplus GooglePhone (specifically, the HTC Dream) which is almost entirely working. Unlocked. Which he just gave to me.

Yays! I have installed the Android Scripting Environment, and now have sh and python shells on my phone. Geekiest... phone... ever.

Coincidentally, the Doctor Who episode that has just come on TV is the one with the Anne-droid.
I have ranted in the past about people who see a nested list and think "that needs to have little pluses and minuses in it to make it dynamically browsable!"

I stand by that rant. 95% of the time it's absolutely unnecessary. However, in some cases it really might come in handy — and in a lot of other cases people just like the shiny. So I thought to myself: now that I know more about JavaScript (and have discovered the magic of Prototype), how could I improve this?

The result is my CollapsibleList utility. No more mucking around with 'onclick' attributes — simply drop in the script and a bit of CSS, call "new CollapsibleList('myListID');", and Robert's your parent's sibling.

Bonus features: javascript calls to expand entirely, collapse entirely, or collapse to a specific level. Magical pluses and minuses automatically keep up.
spudtater: (Default)
( Jun. 12th, 2009 10:55 am)

Further to my last post:

Google has introduced an Android scripting environment that lets you code stuff for the Googlephone on the Googlephone. [...] It sits on the Android handset itself, giving coders the power to write and run scripts in Python, Lua, and BeanShell - without help from a PC.

Google lets you code for Googlephones on Googlephones, The Register, 9th June 2009

Did I mention my next phone was going to be an Android?

spudtater: (Default)
( Jun. 11th, 2009 09:23 am)
Interesting talks at the Tech Meetup last night. By accident or design, one of the talks (given by Kate — hi Kate!) was on developing for the iPhone, the other for Google's new "Android" platform. The contrasts were extremely illuminating.

Cut for geekery )

Anyway. I think my next phone will be an Android...
spudtater: (Default)
( Aug. 16th, 2008 07:00 pm)
I'm at it again! Sokoban (a block-pushing puzzle) for mobile phones. Level data shamelessly ripped off an online version.

Install (JAR)
JAD, source code

Let me know if you've had a play of it. I crave feedbacks!
Also, if anybody wants to have a go at crafting a level, please leave a comment.
spudtater: (Default)
( May. 30th, 2008 08:32 pm)

So I handed my dissertation in today. "An Investigation Into the Parallel Programming of a Lego NXT Mindstorms Robot". 43 pages of writeup (close to 13,000 words), plus uncountable pages of code (including tests), plus a seven-page paper co-written with my supervisor, plus a few pictures (E.g.).

Two copies to hand in, plus a copy to keep for myself (for which I decided I didn't need to print out every single piece of code; hence the slightly slimmer copy).

It turns out that paper is quite heavy.

P.S. I'm FREEEEEEEEEEEEE!!!!!

spudtater: (Default)
( May. 25th, 2008 11:58 am)
This is No Good. I cannot program to Dream Theater. The screen is moving up and down and up and down and up and down. And there is hair in the way.
...I go and discover something new about it. For instance, I never realised you could do this:

class MyClass {
    public static HashMap<String,String> myDict;

    static {
       myDict = new HashMap<String,String>();
       myDict.put( "Do", "A deer, a female deer" );
       myDict.put( "Re", "A drop of golden sun" );
       myDict.put( "Mi", "A name I call myself" );
       myDict.put( "Fa", "A long, long way to run" );
    }

    /* ... more stuff ... */
}

Which is so incredibly useful, I can't believe I never discovered it before.

Edit: and now a not-so-useful example: An alternative 'hello, world' )
Edit 2: That can, in fact, be public static final HashMap<String,String> myDict;, which is arguably more useful.
spudtater: (Default)
( Apr. 9th, 2008 10:18 pm)
Sun's Javadoc documentation tool allows for sections of code ("methods") to be marked as "deprecated", to warn future developers to avoid using them. The reason for this is usually because the old method is not fully-featured, compatible, or technically correct enough. But sometimes there are other reasons.

Found in the official Java API:

 int	 getMaxDecent() 
          Deprecated. As of JDK version 1.1.1, replaced by getMaxDescent().
You see a Ladbrokes sign:



...and you think "I'm not sure a regular expression is strictly neccessary in this context".
spudtater: (Default)
( Dec. 3rd, 2007 06:15 pm)
ASP is a dead language[1], as dead as dead can be. It killed the ancient Egyptians[2], and now it's killing me.

[1] Okay, well, framework, then.
[2] It killed Cleopatra[3], anyway.
[3] Reputedly.
spudtater: (Default)
( Apr. 26th, 2007 03:22 pm)
Went to an interview yesterday with VisitScotland.com in Livingston; they're looking for a graduate to work for them for 12 months, with a possibility of a permanent job at the end of it. It's Web/Java development, so right up my street.

Amazingly, I did well at the interview! I think it helped that there were only two people interviewing, and that they were friendly and informal. Amusingly, one of them had just come back from the dentist (gaining a numb mouth in the process), and so was in perhaps a more embarassing situation than I was.

I was in fact rather chatty, setting off on various asides, which helped stop me getting nervous, as well as breaking the ice a little. I also managed to show off my Conway's Game of Life simulation which I'd programmed on my mobile phone — I think that impressed them! I think I have a fairly good chance of being invited back for second interview.   8^)

Excerpt from the assignment given as part of the "server-side programming" module:

If the username and password are not correct, open a window, displaying “The login failed!”. Also display whether username or password is incorrect.

To all non-programmers on my friends list: can you figure out why this would be a bad and wrong thing to do?   8^]

...you come home from a busy day of programming, and decide to unwind by doing a little programming.

(It's stuff I want to do, therefore it's not work...)
spudtater: (Default)
( Feb. 10th, 2007 03:04 pm)
I've been learning Groovy for one of my university modules this term. Is interesting. It compiles to java byte code, and uses Java class libraries, but is dynamic, flexible, and generally completely unlike Java itself. And it has closures, which I've never really used before, but which I can see myself really growing to like.

The lecturer claims that Groovy is going to be built in to Java 1.7 (or should that be 7.0?), though I can't find anything on t'internet to back this up.

Of course, Groovy isn't the first scripting language that compiles to Java byte code. We've already got Jython, Jruby, BeanShell... etc. Groovy's developers say that it's "more similar to Java syntax" than other scripting languages, but I'm not so sure — to me, it looks more Python-like than anything else. (Albeit with braces).   8^)

Here's a bit of Groovy (from this page on the Groovy main site):

class Employee {
    def salary
}
def highPaid(emps) {
    def threshold = 150
    return emps.findAll{ e -> e.salary > threshold }
}

def emps = [180, 140, 160].collect{ val -> new Employee(salary:val) }

println emps.size()
println highPaid(emps).size()


Anyone else come across Groovy before?
.

Profile

spudtater: (Default)
spudtater

Syndicate

RSS Atom

Most Popular Tags

Powered by Dreamwidth Studios

Style Credit

Expand Cut Tags

No cut tags