Posts Tagged ‘jQuery’

2012w34

Sunday, August 26th, 2012

Society

Note to self: Never give United Airlines any of my business.

Control, or lack thereof

Steve Wozniak sees trouble in the cloud (that makes two of us) and doesn’t think that the Internet should have gatekeepers or regulators.

This hacker news thread contains a quote which perfectly sums up one aspect of what I feel is wrong with SAAS: SAAS means you’re vulnerable to vendor change with every pageload.

Privacy

Sociability’s value comes from privacy An essay by Kyro Beshay, via Cory Doctorow.

It is a poor grade upon humanity that sites like this need even exist.

Olympics and corporate greed

The Olympic games this year really made capitalism show its ugliest sides:

Case in point: VISA. Did they really think that hassling non-VISA-card holders would make them any new friends?

Case in point: London Olympics committee. I am not completely unreasonable, I understand that if too many people set up their own wireless hot-spots in close proximity to the “sanctioned” hot-spots, and on the same frequencies, bad things will happen, but at the same time I can’t shake the feeling that they just wanted a monopoly on providing connectivity, and forcing people to pay through the nose for it.

Good intentions and the road to hell

I understand the benefit to first responders, if we allowed for a government-controlled “emergency switch” to open up wireless routers for mesh-use in disaster areas, many people on Twitter recommended the inhabitants of Oslo to do just that after the attack, but I see the very real potential for abuse from the same government and since they get to define what is or isn’t an emergency, and when things are in people’s and society’s best interests, I give this idea a “thumbs down”-grade.

Drawing the wrong lessons from horrific events

Abuse of power

Case in point: VISA

DHS issuing take-down notices No free speech for you!

Security

A tutorial about off-the-record messaging courtesy of monkeyiq

Albeit not being anywhere near ready for primetime, cryptosphere still looks like a really interesting project

I am unsure as to whether Burner, the service which provides temporary phone numbers, will have a net positive or negative impact on society at large (if it has any impact at all). The concept is cool, and perhaps can be useful in certain settings, while it could probably be abused in others.

And I feel much the same way about Deadman. It could probably be awesome for hiking trips and the likes, for when you really don’t want to be disturbed, but if something were to happen it would be nice if emergency services knew roughly where to look.

Schneier on Security: $200 for a Fake Security System And as one commenter said: It’s all fun and games until your cat dies of exhaustion.

Development

The Best Programming Advice I Ever Got, a rather refreshing thought, it probably would be good to make ourselves a little less dependent on tools and have that grey matter exercise some more.

A jQuery extension called labelfor to associate labels with form input elements.

I’ve written before about this game, but I keep thinking about it and always forgetting what it’s called, so just a reminder to myself.
More than that however, is that I’ve also started taking an interest in Ren’Py the framework on which don’t take it personally, babe, it just ain’t your story is built.
I think that could be used in a plethora of ways, both for entertainment, but also education, if not both at once.

The shell

A blog post about steps to take to improve the performance of shell scripts. Really nice.

SSH

SSH forced commands pretty useful stuff.

Sorting on multiple columns

One of the previous weeks I needed to sort a bunch of lines, but I had concluded that it would be way too much work to transpose the columns in the file in a way that sort would magically work.

Which meant I needed to dig into the flags sort support. I was fairly certain that what I wanted done could be done, I just had to find the way. man sort got old real quick, so I hit duckduckgo instead and found this post which gave me everything I needed, and in a nicely formatted way :)

I can’t remember the actual data I needed sorting, but his example of sorting IP addresses was what helped me, specifically -k 2,2n -k4,4n (i.e. numeric sort by column 2 first, then by column 4)

Vim, autocmd and context-aware file headers

I don’t know when I picked it up, or from where (probably pesa’s Vim config, but for some time I’ve been using a filetype.vim file, in the root of my .vim directory, the contents of which is a bunch of lines, looking something like this:

au! BufRead,BufNewFile *.sh setfiletype sh
au! BufNewFile *.sh so ~/.vim/templates/sh_header

And this works like a charm, every new script I start writing on will get a shebang automatically inserted at the beginning of the file.

I never thought about what else one could do with these autocommands though, until I stumbled over a reddit thread, which pointed me here.

If you look into step 2, you will see that the autocmds there does not only read a header into the new file, but also modifies dates etc.

That’s actually pretty sweet.

Data mirroring

Using duplicity as a stateful rsync

Git stuff

A whole bunch of (git) ignore-files for use in various projects

And uet another git feature I feel I really need to learn ;)

Misc

As this video will tell you it is pretty darn hard to understand the scales of stuff like planets. The video does however make a pretty good attempt at visualizing it.

In the past I have linked to a post which wasn’t all that impressed with the idea of hiding the concept of files from users, and here’s another post, this one not particularly impressed with hiding the concept of directories from the users.
For my part, I consider this to be pure idiocracy

Depending on how well executed it ends up being (in my case, light weight has precedence) reditr could be enormously useful.

I have been eyeing dwb as a potential firefox replacement. We’ll see what happens.

Syntactic parses text, and try to build an “understanding” about words, and how they fit together.

The Future is not Real-Time. Put that way, I too really hope it isn’t ;)

2012w25

Sunday, June 24th, 2012

Quite a while since I wrote a post now, I’ve not been sick or anything, but there has been a lot of work abound, and outside work I prioritized sleeping over writing. But now I’m back for the moment, so let’s get down to business :)

Since last time I’ve come up with new ways of abusing awk, such as having it find the highest value from a command outputting in the following syntax:

\t<characters, integers, fullstop>: <integer>\n

To make it a little more different, the command also spits out a header, as well as an additional newline after the end of output.

I just now, while writing this, came up with a different solution, which doesn’t use awk:

theCommand | grep -v '^[^ \t]\+' | tr -d ' ' | cut -d':' -f2 | sort -r | head -n 1

but what I ended up using was:

theCommand | awk 'BEGIN { highest = 0 } $0 ~ /^[ \t]/ { if ( $2 > highest ) { highest = $2 } } END { print highest }'

In this case, from what I can gather, awk is the more efficient solution. One process versus five.

Update: As Werner points out, the if statement isn’t really necessary (which also makes it possible to cut out the BEGIN statement as well):

theCommand | awk '/^[^ \t]/ && $2 > highest { highest = $2 } END { printf "%d\n", highest }'

Utilities

  • ditaa (a.k.a DIagrams Through Ascii Art) makes it easy to generate nice-looking diagram images from… rather nice-looking ASCII diagrams
  • docopt, a command-line interface description language, which also seems to support generating the parser for the CLI being described
  • Peity for generating different types of charts using jQuery and <canvas>
  • Ghost.py interacting with web pages, programmatically

As of late I have been thinking a great deal about backups and the project which seems the most interesting to me is Duplicity.

Random tech stuff

Other random not-so-techy stuff

What I pass for humour

:wq

2012w13

Sunday, April 1st, 2012

This week has been stressful. Mostly due to the fact that we have an upcoming deadline and problems have a tendency to appear just at that time to exacerbate things further…

But with problems resolved, and tests underway, I found some time to help a colleague out with a script to automate some pretty tricky measurement tests.
This included doing some expect-scripting.

In this particular instance I needed to get a bunch of parameters sent to expect, and treat them as a single string. Ordinarily something like ./foo.exp "some space separated parameters" would have worked, but quoting would be a hassle, so if I could avoid that it would be great.

So I learnt about Tcl’s lrange (up to that point I’d only worked with lindex) and constructed something along the lines of set foo [lrange $argv 3 end] (the first three parameters were other things).

This week I’ve also had the pleasure to read about some pretty cool people this week:

Of course, there are people in the other part of that spectrum, people who doesn’t seem to like the ugly truth or who’d just like to kill off the Internet in its present form.

Now, if you’re still a Firefox user (these days it seems people have all jumped on the Chrome bandwagon) and you still don’t understand why it could be good idea to use NoScript, RequestPolicy or BetterPrivacy, Collusion, from Mozilla might visualize it for you. For my part, with those add-ons activated, there weren’t any surprises, but just for fun I turned them off, only leaving collusion on. Frak me! A whole lot of stuff happening behind the scenes.

I also sniffed out a new timeline library which uses jQuery and is powered by JSON.

:wq

2011w22

Sunday, June 5th, 2011

SSH tunnelling

This Friday I finally got a valid reason to dig into how one sets up an SSH tunnel between two machines. The reason was that I was sitting at the new FFKP office lulzing about with razor, and found myself needing to test some PHP I had been working on.

So I was not at home, I am not stuffing Apache and PHP and MySQL onto my netbook just to do web dev stuff, so I needed contact with my “server” back home.

The slight problem being that since it is for development use only, I don’t expose its Apache to the Internet, only to the local network. SSH is another matter altogether.

So I thought that it shouldn’t be impossible to set up what I wanted, i.e. from my netbook, type in localhost:8080 (or whatever port number floats your boat) and be routed through the tunnel to the server.

It turns out there was this really neat write up on how to do it, already available, and even better, it was really simple:

ssh -f <user>@<remote-host> -L <local-port>:<remote-host>:<remote-port> -N

-f makes it a background process, -L tells SSH we want a tunnel, -N tells SSH that we aren’t trying to execute a command.

This is something I might even begin to remember :)

wmfs

wmfs, or window manager from scratch, seems like an awfully nice little tiling window manager.

Unfortunately I haven’t gotten the time this weekend to play with it, but perhaps a little later today?

I was warned on diaspora that there is a pretty huge-ish performance-related bug in the code right now, and since I haven’t tested it yet I can’t make any recommendations, but from the very superficial (and that will hopefully soon change) observation of the documentation, it seems like it could be a wmii-replacer.

Links

As I am attempting to learn git, I soon came to the conclusion that the best way to learn it would be to use it.

After all, the basics are not extremely different from mercurial, and while most of my projects remain single-person-projects, the basics are more than enough for me.

So I hereby solemnly swear that the next little project I start, whatever it may be, will be versioned using git instead of mercurial.

My foray into the git world also meant that I started looking at the two largest git hosting solutions (both of them free as in beer, and one free as in freedom, github and gitorious.

In doing so, I ran through the list of hosted projects, and there is so much cool stuff out there to test, and try, and learn, and play with… so many things, so little time.

  • z – jump around, which studies your usage of the various directories on your machine, learns, and then makes it easy to jump to “popular” directories easily
  • yajl, Yet Another JSON Library, and I likes me sum JSON
  • Underscore.js, a javascript “utility-belt” library
  • wormhole a jQuery plugin, which for most parts would probably be more fun than useful, but it seems to have been initially written to scratch an itch
  • Backbone.js, which I had already read about here and been wanting to play with it ever since
  • Microjs, a site for finding the javascript framework you need, in order to do what you want
  • Raphaël, a javascript library for working with SVG
  • TMS, a Temporary Mail Server, written in Python, this just must be useful for testing and debugging mail-stuff
  • tablib, another Python module, this one for parsing and converting tabular datasets between various formats, (i.e. csv, html, json, ods, xls(x), yaml)
  • twotwodo, a personal 2do list in the browser, using jQuery (javscript) for logic, and cookies for storage (so it is local to the machine, with no shared storage back-end, which can be good sometimes
  • protovis, nice javascript visualization toolkit

Two other links I find worth mentioning are:

FamFamFam has a rather nice-looking icon set (Silk), licensed using CC By 2.5 or 3.0, which I might finally get to use in a project of mine (haven’t really gotten a chance since it was a long time since I did any serious web programming.)

Finally, a blog which has helped me greatly in understanding various things is BetterExplained which has now released something new which they call aha.betterexplained.com, and I will follow this with great interest.

Revelation of the week

The one real “aha” moment this week was Friday afternoon, when Grégoire showed me that it was possible to add people from other diaspora seeds by searching for their <username>@<other-seed>.
That was good news since I was rather bummed out about razor and greg had set up shop at diasp.org leaving me with relatively few contacts on “my” seed.

Other than that, to be honest, this week has been pretty boring. I did get a whole lot done in timetrack yesterday, and found a deeper love for grep‘s -A flag, and I have been doing some serious thinking about writing my own “makefile blogging”-thingy.

Friday night right before falling asleep I got the idea to write a little script which would pick a wallpaper at random and set that as the active wallpaper at startup. Since I use wmii, and wmii uses xloadimage, given a path, I could simply put all my wallpapers in a directory and have the script symlink one at random on start up.

Introducing jQuery.xmastree

Saturday, January 15th, 2011

With this post I hereby announce the first release of a little jQuery-script I call xmastree. This script has NOTHING to do with Christmas decorations.

I could have given the project the more specific name jQuery.HullOpeningIndicator, but that is both long and ugly, and I fear that it would also have trapped people in thinking that it could only be useful for indicating whether openings in a submarines hull were either open or closed.

In simplified terms, an xmastree on board a submarine is a panel which displays the state of every opening into said submarine. In a submarine, the only two reasonable states are “open” and “closed”.

As such, a submarine xmastree (hull opening indicator) visualizes a series of binary states.

And that is what jQuery.xmastree attempts to mimic. Of course, this xmastree will make no assumptions about what these states represent, or how they should be visualized (that is configurable and left to the user to decide). In fact, jQuery.xmastree make no assumption about the data being visualized is binary either. It most certainly doesn’t need to be, there are no such limitations in the code.

The demo use ASCII for visualization, but one could just as simply modify data.json to have xmastree output <img> tags and thus images.

This project is released under the GNU GPL version 3 or later, and the source may be found here.

:wq