1.12.2009

Vim paste-honing

Want to paste the last yanked?
And not the c/d/x? "0p does work well, but mapping to ctrl-p works too:
" -- paste last yanked (0 reg)
nmap "0p
imap "0pi
vmap "0p

nmap "0P
imap "0Pi
vmap "0P


Want to paste into command?
ctrl-r
or
ctrl-f to edit the command line
:help c_ctrl-r
:help 'cedit'

23.11.2009

Ocaml fever

Twitching to learn a new language. I want something that has computational power of C, and the contemporary advances in Computer Science that ruby contains.

Ocaml seems suitable.

A quick dump of research sources:
http://www.ffconsultancy.com/products/ocaml_for_scientists/chapter1.html
http://blog.camlcity.org/blog/ocamlnet3_mp.html
http://flint.cs.yale.edu/cs421/case-for-ml.html
http://en.wikipedia.org/wiki/Objective_Caml
http://www.soton.ac.uk/~fangohr/software/ocamltutorial/index.html

21.11.2009

Ruby Princess number 45232

Its funny what lack of sleep does to a person. There's this guy writing a ruby guide on freenode #ruby. I had earlier proofread the first chapters of this guys guide. Haha.

...
09:00 < krainbolt> What are some of the bad sides of Ruby? The problems, if you will?
...
10:53 < csmrfx> krainbolt absolutely none. While ruby is not perfect, its still the best.
10:56 < krainbolt> That has to be a joke.
10:56 < krainbolt> Please tell me you're joking.
10:56 < csmrfx> No.
10:56 < krainbolt> Oh jesus.
10:57 < krainbolt> That was a quick ignore.
10:57 < csmrfx> Keep religion out of this.
10:57 < csmrfx> krainbolt wasnt such a mellow guy after all...
10:58 < csmrfx> ...lol I even proof read his silly commie guide for him.
10:58 < csmrfx> Talk about rockstars...
10:58 < krainbolt> This is why I have a part in my guide about fanatics in the community. Absolutely none, jesus christ.
10:59 < csmrfx> krainbolt better also add that the guide was written by a person with no sense of irony
11:00 < csmrfx> Oh well, live'n'learn
...

Irb tab-completion

Wowza! I just had a brief peek at The Ruby Way -book by Hal Fulton. It's chock full of tasty tips, such as this one: Irb tab completion. Check it out!

Just paste this into your .irbrc:

IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:LOAD_MODULES] ||= []
IRB.conf[:LOAD_MODULES] |= ['irb/completion']

20.11.2009

OpenGL with Ruby

To do 3D in ruby with OpenGL. Is it possible? It certainly sounds dreamy. It is time to find out!

Ruby OpenGL bindings - http://ruby-opengl.rubyforge.org/
Simple: require "opengl"

OpenSceneGraph
I found OpenSceneGraph after a brief inquiry into approaching OpenGL. OpenSceneGraph is a open high-level OpenGL library. http://www.openscenegraph.org

Windowing
http://ruby-glfw.rubyforge.org/
http://www.kmc.gr.jp/~ohai/index.en.html

Alternatives
Hm, maybe SDL would be easier for simple 3D apps: http://www.kmc.gr.jp/~ohai/rubysdl.en.html

Scan Processor Studies -related
http://developer.apple.com/mac/library/samplecode/PBORenderToVertexArray/index.html - read readme.txt!
http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial3.html
http://github.com/xaviershay/socialbeat
http://www.lighthouse3d.com/opengl/index.shtml

17.11.2009

Ruby gem install troubleshooting

So, often its the little things that fail. Here is a troubleshooting list.

Simple snafu's

  • require "rubygems" #before requiring gem?

  • See if gem shows with '$:' command inside Irb. If not, it's not installed.

  • If in irb, and installing gems, you must restart it.



Often forgot

  • extconf.rb:8:in `require’: no such file to load — mkmf (LoadError)? -- On Debian and Ubuntus installing ruby and gem doesnt install mkmf. Install ruby-dev -package, too (sudo apt-get install ruby1.91.-dev for example)

  • On Ubuntus Assert 'sudo gem install blah'. Not as user.

  • On Debians, rubygems may need to be installed outside apt (rails, etc).




To be updated.

15.11.2009

Epiphany Wishlist


Epiphany is currently my favourite browser. The version 2.26.1 is light, fast and renders HTML and SVG very well. It is based on gecko engine. It is faster than Opera, not to mention Firefox.

Here is my Epiphany feature wishlist:

- Quick menu with Javascript on|off, Java on|off, cookies accept all|ask|none, clear cache and clear cookies -options.
- Clear LSO (Flash cookies)
- Drag-n-drop of tabs between Epiphany windows.

Thank you Epiphany developers!

21.10.2009

Error message archaelogy

I learned a funky way to dig up old kernel logs today on #linux. To find out what caused segfaults, type

sudo zcat /var/log/kern.log.*.gz | grep 'seg'

On this box that shows segfaults as far back as last May.

Of course for more recent seg faults one might just say..

dmesg | grep 'seg fault'

Nice. Thanks to Chris V.

More to come later.

Flash cookies invade your privacy


Adobe likes to ignore your interest of privacy.

Adobes Flash stores next-generation cookies that are not erased when you empty your browser cache. Flash-cookies, or Local Stored Objects, LSO's, can store any data up to 100 kb, indefinately.

While LSO's are stored on your computer, the contained information can be transmitted back to the server the flash originated from, across sessions, thus making you very easy to track.

All without your permission.

Evil.

And it looks like flash-apps can access all these LSO's. You can see a list of them here: http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html

Why cant the user delete them from the browser cache or browser settings? This is just not right.

And for all of you saying "but you agreed to this in the user terms". Nobody reads all of those terms. Its pages long! Some people already have flash on the computer they purchase and have never even agreed to the terms.

This nonsense of violating privacy "because you agreed to the Terms Of Use" must end. Would it be ok to include an EULA or Terms Of Use stating "By the way, if you use this program, your car and house belongs to us"?

Whether you would read the long terms/EULA, or whether you would agree or not - of course thats not valid. Why is Adobe allowed to propose that this kind of invasion of privacy would be legal?


What kind of legal action would it take to stop this? Are people really content with storing such extensive data on their online behaviour and sending it around the net. Ps. its not going to be sent encrypted.

Stop Enabling Invasion Of Privacy, Adobe!

According to Wired article on flash cookies, LSO's might be found in the following locations:
  • Windows: user's Application Data directory, under Macromedia\FlashPlayer\#SharedObjects.
  • Mac OS X: For Web sites, ~/Library/Preferences/Macromedia/FlashPlayer. For AIR Applications, ~/Library/Preferences/[package name (ID)of your app] and ~/Library/Preferences/Macromedia/FlashPlayer/macromedia.com/Support/flashplayer/sys
  • GNU-Linux: ~/.macromedia

18.10.2009

SVG and rotations

While building a exporting facility into bunch of geometry-generation classes, I ran into simple, yet interesting problems related to the way transforming happens in SVG.

Thus, here are some notes related to transforming SVG-elements.

Some ways to rotate SVG-elements.

Attribute transform:

<rect x="25" y="50" width="150" height="100" transform="rotate(-45 100 100)">
</rect>


Enclosing inside a group:

<g transform="rotate(45)"> <!-- graphics elements go here --> </g>


Enclosing inside a use:

<pre><defs>
<rect id="MyRect" width="60" height="10">
</rect>
</defs></pre><use x="20" y="10" href="#MyRect">
</use>

6.10.2009

Microsoft webmail-service hacked

Thousands of passwords to Hotmail -accounts starting with letter A or B were posted to pastebin.

Neowin.com reports
that the passwords were either hacked or phished, and that MS has confirmed the problem.

27.9.2009

United Arab Emirates Deports HIV- and Tuberculosis -patients

United Arab Emirates deports sick people instead of providing them with health care. People were detained for up to a year without access to medication and HIV-positive migrants were deported.

Must be a really poor country. Only I am not sure if this is economical poverty?

Read all about it: http://business.maktoob.com/20090000376082/UAE_deports_1_500_HIV_sufferers/Article.htm

26.9.2009

G20 - The End Of The Freedom of Assembly?

Freedom of Assembly... No, not the computer-assembly.

In Pittsburgh, police have attacked basically anyone in public, at the pretense of people rioting. Tear gas, riot gear, sound cannons, bright lights, intimidating with police violence.

Seems like all over the World the interest of the few richest corporate industrialists are protected at the expense of the thousands of local residents.

Why is it all these G20 or G8 meetings need such high level of security? I mean, isn't all well and swell in the World? Why on earth would anyone want to oppose or change the way these industrialists are running their business! Surely they are working for the best of all of us, for freedom and equality through global corporate matrix! Why would anyone need to demonstrate against them?

And why would the police need to allow such demonstrations? Appalling idea! Trying to use the right to express ones opinion, demonstrate, or hell, just hang and assemble around should not be tolerated!

Here are couple of links:
Youtube video: http://www.youtube.com/watch?v=2RlVKgIfqsk&feature=related
New York Times: http://www.nytimes.com/2009/09/26/world/26pittsburgh.html?em
World Socialist Site (!?) http://www.wsws.org/articles/2009/sep2009/g20r-s26.shtml

Ps. Go Steelers!!

13.9.2009

Next - the new rubyword for today

I learned a new word in ruby today while reading the brilliant Ruby Quiz, namely quiz #162 - The Turing Machine.

'Next' works with loops like '.each' or '.times', starting the next iteration of the loop. It is useful for conditionally ending the current iteration.
File.open(file).each_line do |line|
line.gsub!(/#.*/, '') # remove comments
next if line =~ /^\s*$/ # skip blank lines

line = line.split(/\s+/)
@state = line[0] if @state.nil?
@program[line[0..1]] = line[2..4]
end

Funny, but next hadn't stuck on me before. Maybe this time.

9.9.2009

LXDE making noise


It looks like LXDE-desktop is coming up fast.

I first bumped into LXDE a year or two back when it was used in gOS where it made some lasting impressions on me.

Now it looks like there is going to be an Ubuntu flavor with LXDE - Lubuntu. The Eeebuntu -distribution has a LXDE-Eeebuntu in beta 2 at the moment. Aside from those there is U-lite, and naturally you can install LXDE in dozens of other distros aswell.

LXDE includes:
Openbox - Lightweight, standard-compliant, and highly-configurable window manager.
PCManFM - file manager, tabbed, desktop icons
LXPanel - desktop panel, menu, quick launch icons, systray, clock, graphical conf.
LXSession - Standard-compliant X11 session manager
LXAppearance - GTK+ theme switcher for themes, icon themes, and fonts.
LXLauncher - topic oriented desktops (?)
GPicView - lightweight image viewer featuring immediate startup.
Leafpad -text editor, tiny!
LXDE Common - default configuration files.
LXTerminal - VTE-based terminal emulator
XArchiver - file archiver
LXRandR - display conf tool.
LXNM - network connection manager.
LXMusic - music player.
GtkNetCat - netcat gui.

5.9.2009

CIA Torture Memo analysis, Part 4


Andy Worthington, author of The Guantánamo Files, analyzes ten particularly disturbing facts to emerge from the four memos, purporting to justify the use of torture by the CIA, which were issued by the Justice Department’s Office of Legal Counsel (OLC) in August 2002 and May 2005, and released by the Obama administration last week.

Lisp, lisp, scheme, sicp...


Revenge Of The Nerds, Paul Graham - The pointy haired boss and Java, Lisp and Python.

Why Ruby Is An Acceptable Lisp, Eric Kidd

Structure And Interpretation Of Computer Programs, Abelson, Sussman, Sussman

How To Design Programs, Felleisen, Findler, Flatt, Krishnamurthi

rvm hoards different rubies for you



After a nigth of troubleshooting 3 different people ruby 1.9.1 problems with gems on debian or ubuntu, looks like theres a project that just might provide some help with that in the future: rvm.

They say that "Easy installation and switching between available Ruby versions and runtimes, without messing up your current Ruby install! rvm also allows you to use multiple versions of ruby in separate terminals concurrently!" - quick, go get a load of this on http://rvm.beginrescueend.com/

Costs of hacking the genome falling


Hacking the wetware will happen in the kitchens nearby sooner than we think. The Economist claims that hacking is about to go squishy.

How internet changes culture, part 1

Time spent doing nothing and watching television are among the disappearing activities Matthew Moore lists 50 things that are being killed by the internet in his Telegraph article.

4.9.2009

Ruby gems 1.9 apt-gotten

On Ubuntu and Debian -boxes I keep having the same problem over and over again. Rubygems are installed by apt-get in 'non-usual' place, and once you have 'sudo gem install'-ed some gem someplace, it wont load with "require 'gemnamehere'" -- you end up with the fun error

LoadError: no such file to load -- narray

So, once again its been enough time, four months or so that I dont remember how I solved this the last time. I did find some old source where I simply required the gem lib directly ("/var/lib/gems/1.8........") but thats not very smart.

So, I am writing this for myself as a troubleshooter:

1. Assert 'sudo gem install blah'. Not as user.
2. See in irb if gem shows with '$:' command.
3. If in irb, and installing gems, restart it before trying to 'load' or 'require.

This time it was the 1 and 3. Silly me.