Saturday, February 16, 2013

Stop reading start doing

Just stop reading all these blog posts, news articles and every thing all the time.
We, programmers love to think. So we get inspired by a well thought out solution for a problem.

But will this inspiration lead us to becoming a great black hole for inspiration,
reaching for more inspiration and even more and more.

Its good to think about the great ways that the other great minds have stepped through.
But how good it would be if didn't think on our own?

So now let's set a break-point and start thinking of our own well thought out solution!

Monday, October 8, 2012

Releasing Krypton v1.0

Krypton - a super experimental ASCII cipher from the planet Krypton
For general general help --> python krypton.py --help
Use with caution. Not recommended for any serious work.

Source code available at: https://gist.github.com/sransara/6024720
Feel free to criticize on any un-pythonic code.

As an effort to learn crypto BIG ideas:
1. Confusion - Caesar cipher
2. Diffusion - Column transportation
3. Secret only in the key - As obvious as it is
http://www.moserware.com/2009/09/stick-figure-guide-to-advanced.html

How the encryption works:
  1. Diffuse the key - with a column transportation of state size 16
  2. Confuse the data with something similar to Caesar cipher with confusion
    in the size of original key length
  3. Then do an awesome XOR
+  To decrypt go in reverse order

The testing:
# Encrypt a simple ASCII text file
python krypton.py -i test.in -o test.enk -k apple
# -D option to Turn on the Decryption mode
python krypton.py -D -i test.enk -o test.dek -k apple

# -B option to Encrypt a binary file
# Encrypted file will be double the size of original file
python krypton.py -B -i debian.torrent -o debian.enk -k"apple!booz"
# -B -D options to Turn on the Decryption mode with binary file
python krypton.py -B -D -i debian.enk -o debian.dek -k"apple!booz"

DIFF
diff test.dek test.in
diff debian.dek debian.torrent -b

Test in one shot
rm *.enk *.dek
python krypton.py -i test.in -o test.enk -k apple
python krypton.py -D -i test.enk -o test.dek -k apple
diff test.dek test.in

python krypton.py -B -i debian.torrent -o debian.enk -k"apple!booz"
python krypton.py -B -D -i debian.enk -o debian.dek -k"apple!booz"
diff debian.dek debian.torrent -b

Saturday, April 7, 2012

Story of a question @stack

Asking a good question needs a little more work than some one would expect. Asking a great question especially in Stackoverflow is not that easy [My respect for the guys who were able to ask great questions].

I love to hangout @Stackoverflow in my free time [By the way it is quite addictive]. I see stackoverflow as a wealth of knowledge for the developers by the developers.

I asked my first question @Stackoverflow, it was all exciting. And as expected got some helpful answers. Okay now wait, did I get the answer that I was really looking for -- nope. But there was a close one.  

Blame it on the stack! Read on before going crazy, it was all my fault. I realized that I am doing something(s) wrong. It was an out of ordinary question (who says that, I say it). It was a question that I wondered for a long time,  to find THE solution (any thing that was already implemented).

If you know a bit of javascript you would probably know that it's current implementation is single threaded. Asking the impossible was out of ordinary in my question. In no-time there it was, a comment, letting me know that I am not following the right track. It was the hard truth that I didn't like to accept.
It cannot be done, the function will not return control to anything until it is finished. – Esailija - link
When expecting the answer, I knew about web workers, javascripts' single threadedness. But the answers I got were telling me the same, that I have found out already. What have I done wrong?

Its just simple. I have obviously skipped the mandatory section of a good question. What have I tried? No matter whether I have spend years, months or days to find a solution, no matter the question was answered by industry experts, I am not getting the right answer that I want just because no one is able to get into my head and see what have I tried? In this particular question - What do I know?

So ending up the tale of my question, I accepted an answer - accepted for its help as well as for the time and work dedicated just for answering my insane question. I felt guilty for not asking a good question. Felt bad not for up-voting the other answers, because I said "Any help is greatly appreciated! Thanks a lot." Finally it ended up voting up every answer just for their effort they have put on. I am discouraged to rephrase and ask the same question but properly -- once again.

It was a great experience, I like to learn by my mistakes.
And by the way I am still interested in answering the impossible. 

Ask questions to find answers

Sunday, December 25, 2011

Clean Tabs CSS Styles Pack - 0.1

There are 2 main styles, But you can change the color variables in SCSS to create more nice looks.

What's cool:

- No more hassle creating tabs with icons

Just use the jquery-ui's ui-icon and ui-icon-home & ui-icon-heart CSS classes. Or would work with your own icons, you can get it with a glimpse on to the code.


- Used SCSS so you can customize very easily

Variables section gives you the ability to change color themes without any challenge

Saturday, November 26, 2011

How to get rid of "Microsoft Office Click-to-Run 2010 (Protected)" drive from My Computer

MS Office starter package came free with my Windows box.
Although I was happy with the Microsoft freebie, what annoyed me was the new Drive (Q:), named as "Microsoft Office Click-to-Run 2010 (Protected)", that the installer configured with the installation. Seems like there is no official support to remove it from 'My Computer'.

Solution
My solution was just to hide the drive (Q:), named as "Microsoft Office Click-to-Run 2010 (Protected)". The following simple Registry tweak worked quite well for me..
1. Open Run (with 'Win key'+R or Start 'Run')
2. Type Regedit press OK -- this will open the 'Registry editor' (Be cautious when editing registry)
3. Go to 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer'
4. Create a DWORD value named 'NoDrives' and set its value in 'Decimal' according to the drive letter you want to hide.
A: 1, B: 2, C: 4, D: 8, E: 16, F: 32, G: 64, H: 128, I: 256, J: 512, K: 1024, L: 2048, M: 4096, N: 8192, O: 16384, P: 32768, Q: 65536, R: 131072, S: 262144, T: 524288, U: 1048576, V: 2097152, W: 4194304, X: 8388608, Y: 16777216, Z: 33554432
Mine was letter Q. So 65536 in Registry edit looked like below.
And there were no problems with MS Office after hiding the drive and I do not expect any. Restart the machine to see changes in 'My Computer'.

Tested and worked well on a Win 7.
Refer to this article about hiding drives from 'My Computer'

Friday, November 4, 2011

Interesting from the web

Some interesting stuff from the web

Thursday, October 27, 2011

Overcoming the 'graying' problem in Gnome panels

I am running Ubuntu in VirtualBox (on a Windows 7 host). Several times now, the top-level menu bar, the task bar — and seemingly every system dialog — have forgotten the out-of-the-box "Ambiance" theme they conform to when I first installed the system. Window captions still preserve the theme, but pretty much nothing else does -- from askubuntu.com question
I was running into the same problem in Linux Mint, the bottom panel and all dialog boxes and panels were having an unintended gray color as in a Windows classic theme.
Below is the hack that worked for me.
Yout too can go through this simple process to beat the bug
Open the terminal and ..
user@machine ~ $ su
Password:
machine user # cd /etc/xdg/autostart/
machine autostart # sudo gedit graybarhack.sh
Or use editor of your choice. Copy and paste the below code
#!/bin/bash

pid=$(pgrep gnome-settings-)

while [ -n "$pid" ];
do
pid=$(pgrep gnome-settings-)
sleep 0
done
killall -9 nautilus

exit 0
After closing saving the file in the terminal run
machine autostart # chmod +x graybarhack.sh
machine autostart # sudo gedit gnome-settings-daemon.desktop
change the Exec line to
Exec=bash -c '/etc/xdg/autostart/graybarhack.sh;/usr/lib/gnome-settings-daemon/gnome-settings-daemon'
Now you are ready. Restart the system to see how it works! Code came up through guidance of this answer and more googling