Tuesday, February 22, 2011

Splitting and Joining

There is a popular phrase describing hairs: split ends. But I guess they are referring only to the free-flowing ends of the hairs, which is what most people are worried about! Well, I say they should worry about both ends of their hairs:

Hair split at both ends!

That takes care of the first half of the title. Now, on to the second half where I will rant about

POLORAMA GENERATOR

, its origin and so on. As you might have noticed, ‘Polorama’ is a portmanteau constructed from ‘Polar’ & ‘Panorama’. So, the origin of this program is simple enough to imagine: I saw one of these and wanted to make one myself! That was about two years ago. An attempt at that time got me to something GUIless like

v0.0 Release 0 (2009) which produced images with interesting fractal patterns:

M83 Fractal Polorama

Obviously, I was doing something wrong [(x,y)⇒(r,θ)] and thought I’d need to come up with an algorithm to average surrounding colors and put those on the ‘remaining’ white pixels to get a ‘proper’ image. Let me just say that this strategy is for morons. I realized this fact (thanks to an ‘out-of-context’ statement from PJ) which has led us now to

v1.0 Release 1 (2011) where I use a much simpler algorithm of just mapping (r,θ)⇒(x,y)! This gives us a proper polorama of galaxy M83:

M83 Polorama

Also, here are some of the poloramas I made. Oh! I should also show you how the GUI of this version looks here, right? Wrong. For that, visit

POLORAMA GENERATOR 1.0.π Release 1

Saturday, February 19, 2011

Straightening

Don’t you just love it when something does more than what it is supposed to do? Well, obviously, not in all cases or contexts but definitely in the one being discussed here!

Before Hugin(g)

After Hugin(g)

This is what has happened above! Find out what else is possible at

Hugin – Panorama Photo Stitcher

Monday, February 14, 2011

Since You’ve been Gone, I’ve been Alone

Since you’ve been gone, I’ve been alone
Like an arm without a bone
Dangling limply like a phone that’s out of charge
Like Homer without Marge
Like an egg without a spoon
Like a dugong on the Moon
Like a clownfish without Nemo
Like Twilight without Emo
Like Hardy without Laurel
Like high ground without the moral
Like Disney without Walt
Like battery without assault
Like a pet shop without gerbils
Like Hitler without Göbbels
Running naked through a wedding
Driving fast, way out past Reading
Children slaughter kittens, playing with a nail gun…
Children’s laughter, kittens playing, Withnail and I, gone are these pleasures
Like a dilemma without the di
Just a lemma and a sigh
Like déjà without vu
I am nothing without you
Till the day that you come back
I’m like Whitney without crack.
-Bill Bailey (Dandelion Mind)

More Ramblings

Monday, February 7, 2011

Moving on…

In this post, I’m going to rant about

SUDOKU SOLVER

, its origin, appearance and functionalities. The idea for SS originated in my head after Shantanu tried to teach me (well, I did ask him!) how to solve a Sudoku. It was during one of the CMP Lab hours of Autumn’05 before Puja holidays. He taught me a ‘human’ variant of the logic ‘Deduction & Reduction’ apart from looking for ‘Single Possibilities’ as described later.

It seemed to me that these ‘Logics’ could be coded and a logical Sudoku Solver made, which would mimic how ‘I’ would solve one! I thought about this quite a lot over the holidays and even came up with two more Logics ‘Deduction from doublets’ & ‘Reduction to doublets’. Later, these were generalized to ‘Deduction from Multi-sets’ & ‘Reduction to Multi-sets’. Two more logics ‘Deduction from Num-Grids’ & ‘Deduction from Num-Chains’ were added subsequently. Each Logic is assigned a number (like 3 for SP) which are summed, depending on ‘how much’ Logic goes into solving, to give a Sudoku its numerical score and  assign one of the ten difficulty levels: ‘Easiest’, ‘V. Easy’, ’Easy’, ‘Below Average’, ‘Average’, ‘Above Average’, ‘Hard’, ‘V. Hard’, ‘Hardest’ & ‘Out of the World’.

I decided that the major version number should reflect the number of Logics coded and the minor version should reflect… my Whim! The GUI for SS has remained the same since its inception. Though, the three menus (‘File’, ‘Tools’ & ‘Help’) have gained a few additions over time. Have a look at the oldest & the newest GUI:

Oldest GUI

Newest GUI

You can obviously Solve a Sudoku Completely but even Partially, which basically displays all the possibilities of individual (≤ 81) cells! However, there is no option of interrupting the (complete) solver and demanding the ‘partial’ results. (It is a Solver not a Trainer!) At first, I thought of not adding a Brute Force Algorithm but the graphics aspect of updating numbers while the recursive algorithm ran led me to include it! I also included an option ‘Use Logic’ but it can not be unchecked by usual means! The most latest addition is Speech Recognition, which allows one to input numbers by speaking them out loud as seen in this video:

SS 6.6 Demo

SS features a silly ‘security’ feature which supposedly prevents one from running the executable file of one computer on another! SS also asks for your name on the very first start to ‘license’ the program to you, which is displayed in ‘About SS’. It also saves the last Sudoku you solved for easy retrieval apart from providing usual functions like ‘Import’ & ‘Save’. You can also ‘Print’ the current screen to a .jpg file or a MATLAB figure. A Help file (accessible via ‘SS Know-How’) is included with the program along with a link to this post via ‘Learn SS Logic’. The latest release also has ‘Update’ & ‘Uninstall’ options!

This blog post will take place of the earlier Logic.pdf file as I link to the Site, which has an extensive collection of Logics used in Solving a Sudoku. The names (& possibly the implementation) of the ‘Strategies’ on that site differ from the names of the Logics in my Solver! In what follows, I’ll point out the many-to-one correspondence of the Strategies (30 excluding the Uniqueness & Trial and Error strategies) and Logics (6) below in [square brackets].

v1.0; Release 0 (2005) Single Possibilities [1, 2]

The simplest logic: Fill-in the single possibility for the particular cell! It can be represented in 4 ways:

Cell(R,C):N => Only no. (Abs. [Row, Col., Squ.])

R stands for Row (vertical numbers), C stands for Column (horizontal numbers) & N stands for the number filled in the specified cell.

v2.0; Release 0 (2005) Deduction & Reduction [6, 7]

Again 4 representations are possible here:

Squ.[sR,sC] & Row [Col.] R [C]: N =>
N removed from Row [Col.] R [C]

Row [Col.] R [C] & Squ.[sR,sC]: N =>
N removed from Squ.[sR,sC]

v3.0; Release 1 (2005) Reduction to Multi-sets [4]

3 representations are possible corresponding to 2, 3 or 4-sets. Sample shown for a 2-sets (doublet):

Cell(R₁,C₁) Cell(R₂,C₂): D₁ D₂ =>
N₁[N₂…] removed from Cell(R₁,C₁)
[M₁… removed from Cell(R₂,C₂)]

v4.x(0≤x≤9); Release 2-4 (2005-06) Deduction from Multi-sets [3, 5]

9 representations are possible ([2,3,4-sets]x[R,C,S]) here. A sample for doublet x R looks like:

Cell(R,C₁) Cell(R,C₂): D₁ D₂ =>
D₁ removed from Row R
[D₂ removed from Row R]

v5.x(0≤x≤5); Release 5-9 (2006-09) Deduction from Num-Grids [8, 11, 15]

6 representations are possible ([2,3,4-grids]x[R,C]) here. A sample for 2-grids x C looks like:

Cols(C₁,C₂) & Rows(R₁,R₂): G =>
G removed from Col.C₁ & Row(s):R₃[R₄…]
[G removed from Col.C₂ & Row(s):R₃…]

v6.x(2≤x≤7); Release 10-15 (2009-∞) Deduction from Num-Chains [9, 14]

4 representations are possible here:

NC – Type Ia:
N in Cells:(,) (,) […] &
N removed from Cells:(,) (,) […]

NC – Type Ib:
N in Cells:(,) (,) […] &
(,) […] =>
N removed from Cell(s):(,) […]

NC – Type IIa:
N in Cells:(,) (,) […] &
(,) […] with
N in Cell(s):(,) […] &
N removed from Cell(s):(,) […]

NC – Type IIb:
N in Cells:(,) (,) […] &
(,) […] with
N in Cells:(,) […] &
(,) […] =>
N removed from Cell(s):(,) […]

That makes a total of 12 out of 30 Strategies in SS, not bad, not bad at all! I’ve wanted to implement Y-Wing [10] & its generalizations [13, 18], which overlap with APE [19] for a long time but I guess that won’t happen in the near future. Anyway, I end this rather long post with

SUDOKU SOLVER 6.7.η Release 15

Monday, January 31, 2011

Time to Move On…

You do whatever you can and then it’s time to move on!
-Warren Siegel

… or something like that! I’m going to rant about

ACBOOK

in this post. Specifically, its origin, evolution, appearance, functionalities and current status. Let us begin the journey with

v1.0; Release 1 (2002-04: 3 Semesters at IITKGP) This was coded in C++, probably my last extensive programming endeavour in C++ (apart from the programming done for the ‘Programming & Data Structures’ course in second semester). It included 9 very basic functional choices (I don’t remember if this number included ‘Exit’ or not!) like Adding / Editing / Deleting Data (includes Date, Particulars & Amount); Selecting Accounts / Categories; Showing all Data; Viewing Balance Sheet (name changed later in v3 to Balance Summary!), etc. There may have been one or two functions associated with physical file manipulation but I don’t remember them as indicated by the shaded part below:

AcBook v1.0

The source filename was hard-coded and the data was automatically loaded from it when the program was run. There may have been a Save to File function if Data manipulation was not done directly on the file (like in later versions!), which would make 9 choices (including Exit). However, if saving was direct then I’ve no clue what could have been the last (two) choice(s).

Anyway, there were 9 or so different .cpp files compiled to give their own executable file and selecting a choice would run that particular .exe (heavy use of global & extern variables)! This ran all right on Windows XP for some time but – as is well-known to those (like Shantanu) who know it well – my programs have an inherent expiry date! After an year or so that started to show as the coordination between some of these executable files was lost. Fortunately by that time, I’d met MATLAB® and We were ready for

v2.x(0≤x≤9); Release 2-3 (2004-07: 7 Semesters at IITKGP) These were coded in MATLAB v6.0 & v6.5. I don’t remember what features were added in which minor version and release. But I’ll give what all was available at the end of v2’s lifetime! First of all, there was a cosmetic Password dialog box,

Password

which accepted ‘jkmsmkj’ only! After that, we got to see the relevant GUI:

AcBook v2.x

Let me confess that all the figures shown for v2.x are modified from those of v3.5&9! The ‘advanced’ panel features (i.e. boundaries) were not present in v2.x. The buttons are shaded above as there were 8 buttons in a 4x2 grid (not 7 as hidden above). Most probably they were arranged like: [LOAD, ADD; CLEAR, SHOW; EDIT, DELETE; (Save), (Exit)]. ‘Load’ loaded Data from ‘data.mat’. ‘Clear’ just cleared the Data fields. ‘Show’ showed ALL the data of the selected Account & Category in the Display Box sorted in chronological order. Both the Accounts & Category were hard-coded. The Accounts included Earning & Expenditure, which is still the case. The categories included ‘In Pocket-IC’, ‘PNB’, ‘In Pocket-NC’, etc.

The File menu must have included New, Open, Close, Save, Save As & Exit, which have quite obvious functions. The Tools menu would have included View Balance, Sort by, Search for & Generate File. ‘View Balance’ showed a bland pop-up window containing the ‘Balance Sheet’:

Balance Sheet

‘Sort by’ is just a placeholder: Data is ALWAYS sorted chronologically! ‘Search for’ may have been introduced in v3 (definitely not in Release 2) but as the name suggests, it searches for date, particulars & amount depending on which option is chosen. ‘Generate File’ (definitely in Release 3) gets a bit technical and hence beyond the scope of this post. The Help menu (even in v3) included ACBOOK Disclosed (opened help file) & About ACBOOK (showed version info as seen above).

This set of functionalities served me well till the end of my life at IITKGP but then in Summer’07, I started thinking of my future needs and that led us to

v3.x(0≤x≤9); Release 4-9 (2007-11: 3½ Years at SUNYSB) These were coded in MATLAB v6.5 & v7.9. Let me try to relate the minor version & release numbers: v3.0 R4; v3.5 R5-6; v3.9 R7-9! Let us now see how the program evolved. The major change in v3.0 R4 was the ability to have user-defined categories that led to a new Category menu, which becomes active only after a file has been opened. It had 3 sub-items: Add, Delete, Rename. The next revision was given a higher minor version (which seems a bit weird to me now!): v3.5 Release 5 and was the first to be recognized as an equal to the SuDoKu Solver and put online:

AcBook v3.5

As seen above, a cosmetic blue Login bar was added and 8 buttons were reduced to 7 and their positions rearranged. The missing ‘LOAD’ button was moved to the File menu and its accelerator ‘Ctrl+L’ took the place of clicking the button! After this, I got MATLAB v7.9 and added a toolbar containing icons for ‘Load’, ‘Close’, ‘Open’, ‘Save’ & ‘Exit’ which marked release 6. Obviously, the number of buttons in the buttons’ panel was now reduced to 5 with (Save) & (Exit) moved to the toolbar.

Another major change occurred in the next version v3.9 R7 when the Balance Sheet dialog was removed along with the ‘View Balance’ item from the ‘Tools’ menu. A table titled ‘Balance Summary’ was added at the bottom of the GUI which showed the ‘balance sheet’ all the time. One more item was added to the Category menu: Set Currency. In v3.9 R8, one more item was added to the Category menu: Reorder and one more to Tools: Combine Files. Speech functionality (as in the messages written in the Display box are spoken) was added in v3.9 R9.

AcBook v3.9

It now included java-based executable .jar file instead of an executable .exe file! This seemed like a good idea back then as the black DOS window didn’t pop-up before the GUI did which confused all the ‘users’! But then I realized that I had to bundle MATLAB’s javabuilder.jar file (~550KB) also in the installer. This led me to a lot of soul (& net)-searching and I found a way to suppress the DOS window and go back to the lovable .exe files in the latest

v4.2; Release 10 (2011-∞) This is a major revision (which makes me think why is its minor version only +3 compared to the last one!) and it has a proper ‘multi-user’ login functionality:

Login Screen

The passwords are stored after encryption so you can be rest assured that your password is that much safer to being cracked but your Data can be tinkered via MATLAB, though! Having this login functionality spawns a whole host of other features: Change Password [Tools], (Dis)Associate Users [Tools], Set as Default [File] & Lock [File]. In this new version, every file you create or save is associated with you exclusively. To allow others to access your files, you must select their usernames to be associated with your files via ‘(Dis)Associate Users’ option in the Tools menu. ‘Set as Default’ gives you an option to set your most frequently used file to be accessible with 1-click via ‘Load’ button (earlier it was hard-coded to be data.mat!). ‘Lock’ just locks AcBook screen analogous to Windows Lock!

File menu gets one more addition: Export, which exports currently loaded file to an MS Excel (.xls) file! Category menu also gets one more (hesitant) addition: Transfer, which basically transfers a specific amount between two categories. Most unusual additions are in the Help menu: Update & Uninstall which do whatever they are supposed to do!

Since the clicks on ‘Balance Summary’ table control the data shown in the Display box, the ‘SHOW’ button from the buttons’ panel was removed. The ‘ADD’ button was made larger to cover its absence, reducing the total number of buttons to 4 (half of what we started with in v2.0!). Also, only 50 Data items are shown in the Display box at a time now! The toolbar also gets a new look & buttons, which you can see in a snapshot of the program at work below:

AcBook v4.2

I’d like to thank Sn (younger brother of S from a couple of posts back) for giving me some ideas & feedback which led to

ACBOOK 4.2.o Release 10

Thursday, January 13, 2011

Learning New Tricks…

…on Olympus PEN E-PL1.

Here’s the ad which removes all doubt about buying one! Smile

Olympus PEN E-PL1 Ad

Here’s what the camera looks like in ‘my hands’. Believe me, it is very hard to make a ‘free-hand select region’ even on a tablet. I know it’s going too far to remove my hand and bearded chin around the camera but then who in their sane mind would not try this at least once in their lifetime!

Olympus PEN E-PL1

Here are two photos of a 'butterfly’ taken at different ‘Color Temperatures’ or as the technical jargon goes: different ‘White Balance’ (WB) reference. In fact, the latter one has WB reference set to the wall of my apartment and is almost the same ‘white’ which is seen by my eyes! Anyway, the colors are as bright as the real thing and as good as the former one shot using the Pop Art Scene (A1) mode which is supposed to pop out the colors.

Butterfly-1

Butterfly-2

This one was shot with flash on to remove the shadows. The flash has screwed up the WB, I guess.

Butterfly-3

Two shots of a cloudy day with different WB: (Which one do you think is more pleasing to the eyes?)

Cloudy Day-1

Cloudy Day-2

Two shots of snow-covered leaves. First with iAuto mode and Second with A1 mode (The colors do pop out!):

Leaves-1

Leaves-2

Snowy Night Scene

iAuto mode with tweaked WB:

EPL10050

iAuto (Brighten the bright areas):

EPL10051

iAuto (Darken the dark areas):

EPL10052

Flash on in iAuto / Shutter Priority modes (with different WB) to show that snow is actually falling (which is also visible in shots above only if you stare at them long enough till you eyes start glazing over):

EPL10049

EPL10046

EPL10045

A clear night shot just after sunset where blue (or what is left of it) of the sky looks as good here as it looked to the eyes! Also, the Image Stabilization (IS) works well and couple it with the 2s lag between pressing the shutter button and the picture actually being taken, it’s theoretically brilliant. But it didn’t make much difference in practice!

Clear Night

Anyway, I leave you with the

Actual-size Photos

Sunday, January 2, 2011

Old Year’s Accomplishments

People talk about New Year’s Resolutions, let me talk about my Old Year’s Accomplishments. I thought I’d make a list ordered by month like this one. But then I realized I do not have so many ‘accomplishments’ to boast about in this post! Well, what the hell? I’ll do it anyway…

January: Don’t remember any…

February: Don’t remember any… (Maybe I completed the 50th level of Microsoft Blackboard game in this month!)

March: It was a rainy day. I wasn’t expecting it would last 10, no 15, well make it 20 minutes! That conversation makes for some memorable moments. [?]

April: It was a cold day. I wasn’t expecting it would be fun! Searching for a restroom in the Central Park… Seeing fossils up-close for the first time... Eating south-Indian dish after walking miles… Having a couple think we’re making fun of them when we’re talking Physics just because ‘someone’ couldn’t stop giggling! On a lighter note, I wrote my first Parody Paper. [Picasa, Publications, Extras]

May: It was a sunny day. I wasn’t expecting it would last so long! Completed my first Time-Lapse Video. And also changed my room, which is definitely an accomplishment. [YouTube]

June: Don’t remember any…

July: It was a boring day. I wasn’t expecting it would be so immersing! Made a 2D surface visualizing program. [iCPPs, YouTube]

August: It was an exciting day. I wasn’t expecting it would work out so smoothly! Converted the compilation of my Sudoku Solver 6.5 & AcBook 3.9 from .exe to .jar and got it zeta-tested successfully. [AB3.9]

September: Don’t remember any…

October: (Going to meet family members and roaming around India & Nepal most probably does not count as an accomplishment… definitely NOT!) It was a busy day. I wasn’t expecting it would be so cumbersome. I completed my own Unicode-based Keyboard Layout to input Greek characters, Mathematical symbols and various accents directly from the physical keyboard. It is mostly based on my advisor’s keyboard layout shown below: [Extras, Flickr, Picasa]

Warren's Keyboard Layout

November: (Celebrating Diwali with family also does not count as an accomplishment.) It was an enlightening day. I wasn’t expecting it would be so simple! Realized what I was doing wrong and also the correct way to do it almost simultaneously. The trick was to concentrate on one hoop even if there were more and let symmetry take care of everything else! Also, upgraded SS 6.5 to SS 6.6 and made it ready for consumption. (Nobody consumes it is another matter!) [Research, SS6.6, YouTube]

December: It was an exhausting day. I wasn’t expecting it would be such a great learning experience. Figured out the differences between bitmap & vector graphics formats. The difference is seen at 800% zoom. My grammar & sentence construction skills leave a lot to be desired. After umpteenth corrections, my 1st (& 2nd & 3rd & 4th & 5th) paper of this year was put on arXiv. [Preprints, Publications]

As you’ve noticed, I haven’t linked to the ‘proofs’ of my accomplishments above. It’s just that it is an incomplete list and I’ve certainly missed some. So, instead of linking specifically to those mentioned above, I’ll post ‘categorical’ links below where even my future accomplishments would more or less appear now & then. Enjoy and Happy New Year 2011!!! (If you squint just right, you can see the Number 23 appearing here also.)

Anyway, here are numerous end-of-the-post-links which appeared above in [You’re wondering about these, weren’t you?]:

Preprints; Publications; Research; Extras;

YouTube; Picasa; Flickr;

SS6.6; AB3.9; iCPPs.

Friday, December 31, 2010

True Love

I was reading a story by Anton Chekov titled “Three Years”. In it, there’s a line that reads: “...before I was in love I, too, knew quite well what love was.” And I reflexively nodded in agreement, uttering “True, Indeed!” And then I heard someone shouting at me, “What the hell are you talking about?”, from within…

Anyway, what I want to draw (no pun intended!) your attention towards, in this post, is the fact that the following picture (which appeared on this blog in August this year) is a sketch hand-drawn by me in MS Paint on my Fujitsu T4410 Tablet.

Sketch-Sora

And so are these two:

Sketch-Natsumi

Sketch-Hazuki

Now, just because I sketch shoddy pictures on paper

Sketch-Sora0Sketch-Hazuki0

does not mean I only sketch shoddy pictures!  The above three copyrighted pictures of Sora, Natsumi & Hazuki are testament of my decent sketching skills! Well, ignoring Natsumi’s sketch, the sketches of Sora & Hazuki are indeed pretty… decent.

Even though this is a link-devoid post, I’ll as usual add an

end-of-the-post-link.

Monday, December 20, 2010

Spot the Shuttlecock!

In this post, let’s play a game. All you have to do is to spot the shuttlecock in the following photos, as simple as that! Come on, have a go:

StS-01

StS-02

StS-03

StS-04

StS-05

StS-06

StS-07

StS-08

StS-09

So, what are your answers? Post them as comments and I’ll verify them for you. The first one to spot them all receives a happy-new-year-wishing-call from me! Open-mouthed smile

For those who don’t know , this game is called

Badminton