learning javascript

Am beginning to learn node.js from here(http://www.nodebeginner.org/). And can’t help but observe the ability to pass a function as an argument to another function*, is a what python would call as first class functions, and is also the reason some consider javascript a good tool to learn functional programming.
May be that’s the most crucial part of functional programming, and haskell has just designed/added other features too based on their purity principle, while python has followed the “Practicality beats purity**” principle.

And am beginning to see, nay grok the meaning of asynchronous call back/event-driven design. Still convinced, it’s over-hyped, but am barely beginning to imagine why it has created excitement among programmers. Kinda like monads(i.e isolating I/O)***, this design enables the programmer to focus on a single sequence of events, while letting the side-effects happen, whenever they do. What i don’t like though is the uncertainty involved.

And the functions are referentially transparent.(atleast AFAIK).And variable scoping is different from that of python. i.e. variable declared outside a function are not automatically available inside it. or for that variables from a caller in a callee(Well, neither does so in python).
But the http module objects response and request are available to the callback functions to a http module function.

Looking through the node.js, http module indicates that they have a exports special keyword and assign the objects they want exported as exports. = object. Interesting…….

The most annoying parts of javascript programming(to me) is the nature of the code,debug,fix,run loop. i.e. I have to absolutely use the mouse for some parts of loading in the browser and debugging. sure there are shortcuts and the fact that i don’t know a lot plays a role…but i can’t help wondering if the problem is aggravated by browsers/websites, rarely designed from a keyboard centric UI standpoint.

*-Essentially like any other variable in the language.
**- Mentioned in import this.
*** – looks like i need to learn monad concepts better. I can see the analogy is either incomplete/wrong.

Apparation Time

Time to apparate. Anand Focus on the 3D’s and practice.. Determination,Destination,Deliberation. Exactly in that order of priority. The other orders(Deliberation,Determination,Destination or Destination,Determination,Deliberation) both have failed in your past experience. Now it’s time to focus on the other leftover order and repeat and repeat.

Lumosity trends

Have opened an account at lumosity and started playing it at various times. think after about 10-11 hrs, am now at the baseline level and can start documenting variance in performance over the scores there.
22-Sep-2011 10:18 hrs.
Speed and Problem Solving skills have risen from last night’s score. Memory, seems to have taken a dip, though it looks insignificant due to the nature of the games i got this morning selected by the training session.
Attention seems to have gone down too. though this looks like it might be a little more significant.
Flexibility has gone down, but think this is again insignificant due to the nature of games.

Just played out another set of games.. and tried a new attention game.. guess what my Attn BPI shot up by a 100 points.. clearly something to be said for change of task for shooting up attention….
A very good week in terms of exercise routine. Lumosity trends have been interesting.
Memory and problem solving have remained same or small insignificant increase. Attention and Flexibility have continued increasing at the steep rate they have been over the last couple of weeks. Speed has increased too, but not as much as in the last couple of weeks.
Hmm… interesting…

Will need to get into a little more well designed experimenting..perhaps diet?? but then, am yet to get it set down to some baseline yet… But one thing is sure the data(weekly) is inconclusive about exercising.. will continue for a couple more weeks and see..as i only started recording (exercise) since 20th and weekly comes only till 26th..

Update: 04-Oct-2011.
Ok this doesn’t make any sense at all. rate of improvement speed games has actually fallen. Looks like the baseline has not yet been settled yet. So for the next couple of weeks or so only one game a day, till i get a flat line for weekly changes. Then begins the experimentation with diet and exercise intensity etc…

Update: 08-Oct-2011
Clearly speed goes up based on the time of the day. Mornings are faster compared to evenings

iOS developer program

If i am not working with an institution or a company, i have to pay 99 USD, to just enroll in the iOS developer program and try out the tools. Phew..Apple is indeed maintaining it’s elitist, haute couture style. Am reminded of the movie “Pirates of Silicon Valley” where the Steve Jobs character says “They don’t have culture.We are better. We are artists.”
Can see how that has become a core part of their brand identity. But annoying to the others who are not part of the mile high club. Not unlike, high school groupism.

Anecdotal evidence for embodied cognition

Over the last couple of months, i realized, i have been growing ever so unfit, adding more fat..Decided to work on it, and have begun running. Not long enough to call it a healthy habit yet, but enough to be hopeful of the way forward. Anyway, i have noticed that this has already begun to influence my cognition(more precisely, my decision making). This seems to be enabling me to decisions, a lot more freely, whereas, i used to hesitate and worry about possible problems a lot more earlier. Now I have put that as if my decision making has become better, but the truth is i don’t know whether it has become better or worse. I don’t have a journal and it’s too early to judge even if i did. I would prefer to maintain a journal over a couple of years before i make a call on that. But what i do know is that i am happier about my decision-making. Phew, no wonder, there’s a following of embodied cognition.

And boy, those testosterone/serotonin surges…. are great…

Haskell— a history

Some problem with my fedora box,forced me to watch the tech video(only thing on hd that would play) history of haskell video by Simon Peyton Jones. The initial 15-20 minutes were a little odd, what with his old-fashioned jokes and mostly history, a little of how they persevered(though i guess, i might do the same in his position). But by the time he explained quickCheck, it was holy shit….that’s cool.(I had just started with typeclasses chapter in haskell tutorial).Anyway, i think they(typeclasses and instances) are the coolest kind of meta-programming i have come. The last time i was this excited was when i learnt i can overload and/or override data types with classes and operator overloading in C++.) i automatically started clapping and wondered why the audience didn’t…Hmm.. And the last question about triple(values,types,typeclasses) and the answers, comments were the most fun, i have had watching vid in a while…

Damn, now i gotta go and fix that video player issue.

My laptop entropy

Suddenly, had an interest in finding out the entropy of my laptop and ran time dd if=/dev/random of= bs=1M count=500.

For those of you who don’t know what /dev/random does, here’s a quote from wikipedia link.

In Unix-like operating systems, /dev/random is a special file that serves as a blocking pseudorandom number generator. It allows access to environmental noise collected from device drivers and other sources.[1] Not all operating systems implement the same semantics for /dev/random.

And the results are in:

Date:17-Sep-2011. Torrent download going on. System uptime for about 7-8 hrs

	time dd if=/dev/random of=test_entropy bs=1M count=500
	0+500 records in
	0+500 records out
	4025 bytes (4.0 kB) copied, 564.065 s, 0.0 kB/s

	real	9m24.855s
	user	0m0.005s
	sys	0m0.125s

Date: 19-Sep-2011   
Just did some moving of files to the tune of close to 11-13GB. Torrent download going on.
Here goes the results.
anand@localhost:~ $ uptime
23:29:10 up 43 min,  2 users,  load average: 0.61, 1.76, 2.49
anand@localhost:~ $ time dd if=/dev/random of=test_entropy bs=1M count=500
0+500 records in
0+500 records out
4413 bytes (4.4 kB) copied, 342.514 s, 0.0 kB/s

real	5m42.538s
user	0m0.007s
sys	0m0.125s

Date: 20-Sep-2011. After a two hour movie. Here are the stats.
14:58:53 up  2:14,  2 users,  load average: 6.62, 5.51, 5.31
0+500 records in
0 records out
4058 bytes (4.1 kB) copied, 367.482 s, 0.0 kB/s

real	6m7.518s
user	0m0.015s
sys	0m0.108s

21-Sep-2011 Just moved 14GB data across two logical volumes.
Wed Sep 21 13:42:25 IST 2011
 13:42:25 up  3:59,  2 users,  load average: 0.13, 0.60, 1.35
0+500 records in
0+500 records out
4296 bytes (4.3 kB) copied, 447.277 s, 0.0 kB/s

real	7m27.311s
user	0m0.006s
sys	0m0.104s
Uh..Think it's time to put this into a script+cron and store the data in a log file.

Uh..umm.. how do i change this to an entropy measure?? Anybody worked a formula yet or do i have to read up the manuals(and/or source code) and come up with my own?? Since /dev/random depends on the system interrupts(kb,mouse,HD access), i can get more datapoints, with trying it with some hd file transfers, playing some 3D game(openArena)/ simple game minesweeper/network download (torrent) etc…. Hmm. wonder if anyone has done this for their thesis, trying out various datapoints and fitting it into a curve. That would give an idea of the formula. Ofcourse, i have ignored the hardware differences, but it seems like a good thesis project for a Master’s graduate??.