tag:blogger.com,1999:blog-28889561438525964392024-03-05T20:14:56.809+05:30Solid SmokeThoughts, reviews, notes, rants, mumblings, yawnsSyamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.comBlogger106125tag:blogger.com,1999:blog-2888956143852596439.post-84754526203910625872021-06-03T09:14:00.000+05:302021-06-03T09:14:01.184+05:30CMake configuration for reproducible builds of C++ projects with gcc/Linux<div style="text-align: justify;">This is a quick guide for configuring CMake such that every rebuild of the same C++ code generates bit-by-bit identical binaries. This is useful in verifying if a given binary is indeed generated from the given sources and comes in handy for configuration control. This article is not a detailed documentation on the reasons or mechanisms that cause binaries to differ from build to build nor the rationale behind the <i>countermeasures</i> explained in great detail. That information is already covered elsewhere and a few helpful links are provided in the end. This post is made because all of this information was not available in one place.<br /></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;">In general, the same C++ code <i>should</i> generate the same executable (or library) every time it is compiled using the same build system on the same platform. But in practice, <a href="https://blog.conan.io/2019/09/02/Deterministic-builds-with-C-C++.html">several factors</a> cause the final binaries to differ. There are a few things developers need to take care of to avoid these:</div><div style="text-align: justify;"><br /></div><div style="text-align: justify;"><ol><li>Eliminate differences due to build path.<br /><br /><span style="font-family: courier;">target_compile_options(projfoo PUBLIC "-ffile-prefix-map=${CMAKE_SOURCE_DIR}=.")</span><br />
<br /></li><li> Generate compile errors if macros like __DATE__ are used in the code.<br /><br /><span style="font-family: courier;">target_compile_options(projfoo PUBLIC "-Werror=date-time")<style type="text/css">p, li { white-space: pre-wrap; }</style><br /></span><br /></li><li>Use filename as gcc's <i>random seed</i> (instead of random numbers) when it needs to generate unique symbol names<br /><br /><span style="font-family: courier;"><span style="font-size: small;">foreach(_file ${SOURCES})<br /> set_property(SOURCE ${_file} APPEND_STRING PROPERTY COMPILE_FLAGS "-frandom-seed=${_file}")<br />endforeach()</span></span><style type="text/css">p, li { white-space: pre-wrap; }</style><br /><br /></li><li>For static library projects (.a), pass 'D' arguments to <i>ar</i> and <i>ranlib</i> for deterministic output<br /><br /><span style="font-family: courier;">set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcD <TARGET> <LINK_FLAGS> <OBJECTS>")<br />set(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")</span></li></ol><b>Notes</b></div><div style="text-align: justify;"><b> </b><br /><ul><li>Point no. 2: if macros such as <span style="font-family: courier;">__DATE__</span>, <span style="font-family: courier;">__TIME__</span> etc. cannot be avoided in the code, then setting the environment variable <span style="font-family: courier;">SOURCE_DATE_EPOCH</span> can force them to deterministic fixed values.</li><li>Point no. 3: The value for -frandom-seed needs to be unique for each source file. Some examples use a hash of the file contents. But if your project does not have source files with the same name, then the file name should suffice. This way, adding comments in the source files will not change the argument values. The example here assumes that the CMake project file has all the source files added to a CMake variable named <span style="font-family: courier;">SOURCES</span>.<br /></li><li>Point no. 4: This is required only for projects that generate a static library file (libfoo.a). For C projects, use CMAKE_C_... instead of CXX equivalents in the example.<br /></li></ul><p>These instructions are specifically for gcc & Linux. Please refer to the other articles linked here for more comprehensive documentation. <br /></p><b> </b></div><div style="text-align: justify;"><b>References</b></div><div style="text-align: justify;"></div><div style="text-align: justify;"></div><div style="text-align: justify;"></div><div style="text-align: justify;"> </div><div style="text-align: justify;"><ul><li><a href="https://blog.conan.io/2019/09/02/Deterministic-builds-with-C-C++.html">An introduction to deterministic builds with C/C++</a> - an excellent resource on the subject</li><li><a href="https://reproducible-builds.org/">Reproducible builds</a> - a comprehensive effort to ensure a verifiable path from source to binary code. They have excellent documentation.<br /></li><li><a href="https://github.com/Kitware/CMake/blob/4b266927c7556f74d11d6f499360d682117e0a60/Modules/CMakeCXXInformation.cmake#L257">CMake source</a> from github</li><li>gcc <a href="https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Option-Summary.html#Option-Summary">documentation</a> for -ffile-prefix-map and -frandom-seed </li><li>Documentation of <a href="https://man7.org/linux/man-pages/man1/ar.1.html">ar</a> and <a href="https://man7.org/linux/man-pages/man1/ranlib.1.html">ranlib</a> from binutils <br /></li><li>There are <a href="https://stackoverflow.com/questions/62339192/how-set-cmake-static-linker-flags-immediately-after-the-executable-file-tcc-a">some</a> Stack Overflow <a href="https://stackoverflow.com/questions/67802356/how-to-make-cmake-pass-d-argument-to-ar-for-reproducible-build-of-a-static-libra">questions</a> that have useful information<br /></li></ul></div><div style="text-align: justify;"> </div><div style="text-align: justify;">All comments are most welcome.<br /></div><div style="text-align: justify;"><br /></div>Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-91866376073120171482020-12-05T13:07:00.003+05:302020-12-05T13:07:59.772+05:30qView - a simple, fast image viewer for Linux<br /><div align="justify" style="font-size: 12pt;">
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsOHzo-btJhBVJLj-YHUqEB92aHzXdVHafx1DegoSMrH3P1yYpsNEQxbwyK-PSTUfjYdlT4UQKLBEqWKUMafNFQtLLZ0g_92_L2FpUAKZ1YEAeaIVGXTcPwZa3F40JNzpTRY6l3QKSY5s/s1138/qview_screenshot.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="920" data-original-width="1138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhsOHzo-btJhBVJLj-YHUqEB92aHzXdVHafx1DegoSMrH3P1yYpsNEQxbwyK-PSTUfjYdlT4UQKLBEqWKUMafNFQtLLZ0g_92_L2FpUAKZ1YEAeaIVGXTcPwZa3F40JNzpTRY6l3QKSY5s/s320/qview_screenshot.png" width="320" /></a></div><div style="text-align: justify;"><a href="https://interversehq.com/qview/" target="_blank">qView</a> is a simple, minimalistic and fast image viewer for Linux, Windows and macOS. It's built using Qt and is GPL v3 licensed free software. It supports pretty much all features that one expects from a fast and no-nonsense image viewer. It has replaced <a href="https://apps.kde.org/en/gwenview">Gwenview</a> as the default image viewer on my <a href="https://kde.org/plasma-desktop/" target="_blank">KDE Plasma</a> <a href="https://getfedora.org/">Fedora</a> desktop. Gwenview is of course more feature-rich and fancier, but I like qView for simply viewing and cycling through images.<br /></div>Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-79076822601424692112019-06-17T18:22:00.001+05:302019-08-02T16:49:13.847+05:30Dangerous ride with a worn out motorcycle tyre - lesson learnt!<div align="justify" style="font-size: 12pt;">
My <a href="http://mahindramojo.com/" target="_blank">Mahindra Mojo</a> had munched over 11,000km and my rear tyre had been almost completely worn out. The Mojo comes with <a href="https://www.pirelli.com/tyres/en-ww/motorcycle/all-tyres/sheet/diablo-rosso-2" target="_blank">Pirelli Diablo Rosso 2</a> which are soft-compound tyres. That meant they would offer great grip on the roads, but would wear out faster. My rear tyre was worn out way beyond the limit indicated by the <a href="http://atmaindia.org/tread-wear-indicator-twi/" target="_blank">Tread Wear Indicators</a> and at one or two places, the steel radial wires were slightly visible. That's terrible, I know! My daily rides were limited to 5-6km through private roads and so I felt lazy and put off replacing the tyre. And one day, this happened!</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
A few weeks back, one fine morning, I got a call from a friend to go on a bike trip to <a href="https://en.wikipedia.org/wiki/Hogenakkal_Falls" target="_blank">Hoggenakkal</a>, which is around 140km from my place. Against my better judgement, I agreed and we rode to Hoggenakkal. Throughout the ride, we were mindful of the tyre condition. Anyway, the onward ride was uneventful and Hoggenakkal was terrible and disappointing (borderline disgusting).<br />
<br />
On our ride back to Bengaluru, we got heavy rains and had to make 2-3 stops on the way. Around 6km before the destination, I started hearing some rubbing sound from the bike's rear and we stopped to inspect. At first, I thought some piece of garbage might have gotten stuck in the tyre. To our shock, we found that a long metal wire had gotten entangled and wound around the rear wheel axle. On closer inspection, we found that it was nothing other than a piece of the tyre's steel radial wire that had come off and gotten entangled! At a few other locations too, up to one foot long wire pieces were poking out of the tyre! I hope the horror can be understood from the photos below (click for larger versions).</div>
<div align="justify" style="font-size: 12pt;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitWzJCMq_oH89MljCXKS8MPaAHdq-HOJ_KujXS2bdE-TvlQFwUcPRgSXyKzxZl_WwzJavMbFO6iJx48ggNAQyZikqxRqplhDuXngpsnPAM4_BADtLREO5RXq2GKySbqdG_015tqnlbOOE/s1600/IMG_20190606_085227.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="756" data-original-width="1600" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitWzJCMq_oH89MljCXKS8MPaAHdq-HOJ_KujXS2bdE-TvlQFwUcPRgSXyKzxZl_WwzJavMbFO6iJx48ggNAQyZikqxRqplhDuXngpsnPAM4_BADtLREO5RXq2GKySbqdG_015tqnlbOOE/s400/IMG_20190606_085227.jpg" width="400" /></a></div>
<div style="text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga66DRw2mkokFRU51i3DWhBzoEdgLJQPmppLGnfHo6v5TIkicR7d03h4L-syroJEJrNOSl2GtRTS5IwU7CqCsOTXkjSwoSK3SXDEnycXxqqT0kG-fufwzVEQaBywQpeyor5Ol8Pf8T3pM/s1600/IMG_20190606_085239.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="1600" data-original-width="756" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga66DRw2mkokFRU51i3DWhBzoEdgLJQPmppLGnfHo6v5TIkicR7d03h4L-syroJEJrNOSl2GtRTS5IwU7CqCsOTXkjSwoSK3SXDEnycXxqqT0kG-fufwzVEQaBywQpeyor5Ol8Pf8T3pM/s200/IMG_20190606_085239.jpg" width="94" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi58olJbFKPxGKGwG-frL7y-5Y18qqtr6pfOZHIX7Z21qwRIrg8Ond94rGSfLQE3dbBb717yWQXwHuRMg6E2HAQ1VxjPnom3Uz9hvA6g_wXTH0r6sAV1cZRSoER2MsNfY7gP_21w-XUBMU/s1600/IMG_20190606_085216.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkXzkSNb4x9OkI_hWxzygzbp83lLSgCqlsiyyDm84IJhjqLGw29yF_rimojbCeFSPsIpBxTr_Agj6TriA0G_cZs48AL24G8qu88SDjwIb5LYLyN0ZGAuYpc3GS9aYclkbCVKLNFVPlxNw/s1600/IMG_20190606_085221.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" data-original-height="756" data-original-width="1600" height="188" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkXzkSNb4x9OkI_hWxzygzbp83lLSgCqlsiyyDm84IJhjqLGw29yF_rimojbCeFSPsIpBxTr_Agj6TriA0G_cZs48AL24G8qu88SDjwIb5LYLyN0ZGAuYpc3GS9aYclkbCVKLNFVPlxNw/s400/IMG_20190606_085221.jpg" width="400" /></a></div>
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi58olJbFKPxGKGwG-frL7y-5Y18qqtr6pfOZHIX7Z21qwRIrg8Ond94rGSfLQE3dbBb717yWQXwHuRMg6E2HAQ1VxjPnom3Uz9hvA6g_wXTH0r6sAV1cZRSoER2MsNfY7gP_21w-XUBMU/s1600/IMG_20190606_085216.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="1600" data-original-width="756" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi58olJbFKPxGKGwG-frL7y-5Y18qqtr6pfOZHIX7Z21qwRIrg8Ond94rGSfLQE3dbBb717yWQXwHuRMg6E2HAQ1VxjPnom3Uz9hvA6g_wXTH0r6sAV1cZRSoER2MsNfY7gP_21w-XUBMU/s200/IMG_20190606_085216.jpg" width="94" /></a><br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div align="justify" style="font-size: 12pt;">
</div>
<div align="justify" style="font-size: 12pt;">
</div>
<div align="justify" style="font-size: 12pt;">
</div>
<div align="justify" style="font-size: 12pt;">
We were extremely lucky that the tyre didn't lock-up and cause us to fall. That would have been quite dangerous in all that traffic and rain. We hired a pick-up vehicle and brought the bike safely home and I have since changed the tyre to a <a href="https://www.michelin.in/motorbike/tyres/pilot-street-radial" target="_blank">Michelin Pilot Street</a> (which is cheaper than Pirelli and has better life, at the expense of grip of course).</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
So, overall, a valuable lesson learnt - <b>never ride with a worn-out tyre!</b> A worn-out tyre gives reduced grip and increases the chance of skidding and punctures. Further, the steel radial wires coming out of the tyre and getting entangled with the mechanicals is something that could be fatal.</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com1Bengaluru, Karnataka, India12.9715987 77.59456269999998312.4764182 76.949115699999979 13.4667792 78.240009699999987tag:blogger.com,1999:blog-2888956143852596439.post-58755824215609985112019-06-07T12:23:00.000+05:302019-06-07T12:23:12.461+05:30മിയ എന്ന പൂച്ചക്കുട്ടി<div align="justify" style="line-height: 100%; margin-bottom: 0in;">
<span lang="ml-IN">
മൂന്ന് വര്ഷങ്ങള്ക്ക് മുമ്പാണ് <a href="https://www.facebook.com/ashtamoorthi.vasudevan" target="_blank">അഷ്ടമൂര്ത്തി</a> സാറിന്റെ ഒരു <a href="https://www.facebook.com/ashtamoorthi.vasudevan/posts/10207125195427433" target="_blank">കുറിപ്പിലൂടെ</a> <a href="https://www.facebook.com/advrojanarimboor.chalissery" target="_blank">CP റോജന്</a> എഴുതിയ "<a href="https://handcbooks.com/shop/miya-enna-poochakutty/" target="_blank">മിയ എന്ന പൂച്ചക്കുട്ടി</a>" എന്ന പുസ്തകത്തെക്കുറിച്ച് അറിയുന്നത്. തിരുവനന്തപുരത്ത് ഒന്ന് രണ്ട് പുസ്തകക്കടകളിലും പിന്നെ പല ഓണ്ലൈന് കടകളിലും അന്വേഷിച്ചിട്ട് പുസ്തകം കിട്ടിയില്ല. അവസാനം ഞാന് ഫെയ്സ്ബുക്കിലൂടെ ശ്രീ റോജനുമായി ബന്ധപ്പെട്ടു. പുസ്തകം തിരുവനന്തപുരത്ത് എവിടെക്കിട്ടുമായിരിക്കും എന്ന ചോദ്യത്തിന് "വിലാസം തരൂ ഞാന് അയച്ചുതരാം" എന്നായിരുന്നു മറുപടി. അക്കൗണ്ട് വിവരങ്ങള് തന്നാല് പുസ്തകത്തിന്റെ വില ഞാന് തരാം എന്ന് പറഞ്ഞപ്പോള് "ആദ്യം വായിക്കൂ, എല്ലാത്തിനും സമയമുണ്ട്" എന്ന മറുപടി. എന്നാല് ശരി ബാക്കി വായിച്ചിട്ട് അറിയിക്കാം എന്ന് ഞാനും പറഞ്ഞു. പുസ്തകം വന്നു. വായിച്ചു. ഒരുപാട്, ഒരുപാട് ഇഷ്ടപ്പെട്ടു. പക്ഷേ റോജനെ അറിയിക്കാന് ഏതോ തിരക്കിനാല് വിട്ടുപോയി. </span><br />
<br />
<span lang="ml-IN">ഇതെല്ലാം നടക്കുന്നത് 2016 സെപ്റ്റംബറില്. വളരെ മോശമായിപ്പോയി എന്ന് ഞാന് എന്നോട് തന്നെ ഇടയ്ക്ക് ഓര്മ്മവരുമ്പോള് പറയും. ഇത്രയും കാലം കഴിഞ്ഞിട്ടും ഈ പുസ്തകവും എഴുത്തുകാരനും പക്ഷേ മനസ്സില് നിന്ന് മാഞ്ഞില്ല. അത്രയും ശക്തവും തീക്ഷ്ണവുമാണ് ആ എഴുത്തും ഓര്മ്മകളും. അങ്ങനെ ഞാന് കുറച്ചുനാള് മുന്പു് റോജനുമായി വീണ്ടും ഫെയ്സ്ബുക് വഴി ബന്ധപ്പെട്ടു, പുസ്തകത്തെക്കുറിച്ചുള്ള എന്റെ അഭിപ്രായം അറിയിക്കുകയും ചെയ്തു. </span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTafdGNh0INxHVMJsuOmoD7HY73xC3fuQ2RmvwlsRAHqv1-3_kMaMAteqonP5rtfvPEh0nfHxzwrQzWxzjGnJivEUs2rTwYo8JlgfYvUl7H49J8hhLO-FPSj0NBF9HM1jKdQLdxNmtR0/s1600/mia3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="735" data-original-width="480" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtTafdGNh0INxHVMJsuOmoD7HY73xC3fuQ2RmvwlsRAHqv1-3_kMaMAteqonP5rtfvPEh0nfHxzwrQzWxzjGnJivEUs2rTwYo8JlgfYvUl7H49J8hhLO-FPSj0NBF9HM1jKdQLdxNmtR0/s320/mia3.jpg" width="208" /></a></div>
<span lang="ml-IN">ഇനി പുസ്തകത്തെക്കുറിച്ച്. ഫെയ്സ്ബുക്കില് പലപ്പോഴായി എഴുതിയ കുറിപ്പുകളൂടെ സമാഹാരമാണ് ഈ ചെറിയ പുസ്തകം. 50 പേജ് കഷ്ടി. “വായന നീറുന്ന ഒരനുഭവമായി എന്നൊക്കെ അലങ്കാരമില്ലാതെ പറയാനാവുന്ന ഒരു പുസ്തകം" എന്നാണ് അഷ്ടമൂര്ത്തി സര് 'മിയ'-യെ കുറിച്ച് എഴുതിയത്. അക്ഷരംപ്രതി സത്യം. ബാലചന്ദ്രന് ചുള്ളിക്കാടിന്റെ ചിദംബരസമരണയ്ക്ക് ശേഷം ഇത്ര ഹൃദയസ്പര്ശിയായ ഒരു പുസ്തകം ഞാന് വായിച്ചിട്ടില്ല. എനിക്ക് പൊതുവേ "എന്നെയാരും സ്നേഹിച്ചില്ല, എന്നെയാരും മനസ്സിലാക്കിയില്ല, എന്നോളം ദുരിതമാരും അനുഭവിച്ചിട്ടില്ല, അതിനാല് എന്നോട് സഹതപിക്കൂ" മട്ടിലുള്ള വിലാപകാവ്യങ്ങള് ഇഷ്ടമല്ല. 'എന്റെ കഥ'-യിലെ മാധവിക്കുട്ടിയോടും പെരുമ്പടവത്തിന്റെ സങ്കീര്ത്തനത്തോടും അതുകൊണ്ട് തന്നെ എനിക്ക് തീരെ മതിപ്പില്ല. പക്ഷേ 'മിയ' അങ്ങനെയല്ല. സ്വന്തം ജീവിതത്തിലെ അനുഭവങ്ങളും പാളിച്ചകളും എല്ലാം തുറന്നെഴുതിയിരിക്കുന്നു. വായനക്കരന്റെ സഹതാപത്തിന് വേണ്ടിയുള്ള വിലാപങ്ങളില്ല. അതുകൊണ്ട് തന്നെയായിരിക്കണം ചിദംബരസ്മരണ ഓര്മ്മ വന്നത്. അദ്ദേഹത്തിന്റെ അനുഭവങ്ങളും, ഭാഷയും എഴുത്തിന്റെ സത്യസന്ധതയും എന്നെ സ്പര്ശിച്ചിരിക്കുന്നു. അതിന് ഇട വരുത്തിയ അഷ്ടമൂര്ത്തി സാറിന് നന്ദി. </span><br />
<br />
<span lang="ml-IN">ഇതുവരേയ്ക്കും ഞാന് റോജന് പുസ്തകത്തിന്റെ പൈസ കൊടുത്തിട്ടില്ല. കടക്കാരനായിട്ടിരിക്കുന്നു. എന്ന് വീട്ടുമോ ആവോ. റോജനോട് ഒന്നുകൂടി ചോദിക്കണം. </span><br />
<br />
<span lang="ml-IN">PS: പുസ്തകം </span><span lang="ml-IN"><span lang="ml-IN">ഇപ്പോള് </span>H&C പ്രസിദ്ധീകരിച്ചിട്ടുണ്ടെന്ന് തോന്നുന്നു (നേരത്തേ ഖനിതകം ബുക്സ് എന്നായിരുന്നു). <a href="https://handcbooks.com/shop/miya-enna-poochakutty/" target="_blank">ഇവിടെ നിന്ന്</a> ഓണ്ലൈന് ഓര്ഡര് ചെയ്യാം. അവരുടെ പുസ്തകക്കടകളുടെ ലിസ്റ്റ് ചുവടെ.</span><br />
<br />
#mia_enna_poochakkutty #miya_enna_poochakutty<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY58WBn0penwHN1eIbndwHm7rXJWmHhA500R5b_yE5ytd8-cem18oXdc4aBFvvX5JBw0UXhn-YPn76EelQQf0P44uNFrzL8UWNqExDcKkO0Ktx04oXxIyMsWsewegw8UiOTaQX_D_tHVE/s1600/mia2.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" data-original-height="1600" data-original-width="1055" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgY58WBn0penwHN1eIbndwHm7rXJWmHhA500R5b_yE5ytd8-cem18oXdc4aBFvvX5JBw0UXhn-YPn76EelQQf0P44uNFrzL8UWNqExDcKkO0Ktx04oXxIyMsWsewegw8UiOTaQX_D_tHVE/s320/mia2.jpg" width="209" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8MF_k_YnoOCVNrar7Xp2dudo0duIt6MhsAEDizl9_z2dYhgQHWLQuDMtreUAf9KeBNHF7uRGriyRpgY6wBm1p1Mvtj00fdq2f6PHii-yRdyEcwPYN-F2RyG4Z5jfOBv_13TezAyfFB1Y/s1600/mia1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1600" data-original-width="1043" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8MF_k_YnoOCVNrar7Xp2dudo0duIt6MhsAEDizl9_z2dYhgQHWLQuDMtreUAf9KeBNHF7uRGriyRpgY6wBm1p1Mvtj00fdq2f6PHii-yRdyEcwPYN-F2RyG4Z5jfOBv_13TezAyfFB1Y/s320/mia1.jpg" width="208" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEm4hOEAx2ZEjuaw5zCXaRkRqE17xfPv1e0GY9Fiu6MFOJKDzPQfBHMBDly83RqzOf6t575lmLdkO6V5j_m8qv153EYwSXsy6t7Bwe5iCR3XJladXZi-wJ_dSWvujaK62oKof8BGrstLM/s1600/mia4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="526" data-original-width="480" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEm4hOEAx2ZEjuaw5zCXaRkRqE17xfPv1e0GY9Fiu6MFOJKDzPQfBHMBDly83RqzOf6t575lmLdkO6V5j_m8qv153EYwSXsy6t7Bwe5iCR3XJladXZi-wJ_dSWvujaK62oKof8BGrstLM/s320/mia4.jpg" width="292" /></a></div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-11614362059703796452019-04-13T19:56:00.001+05:302020-09-01T22:23:31.133+05:30Qt - Enabling qDebug messages and Qt CreatorI have been struggling for the past two hours to get qDebug() messages from my Qt 5 application to show up on the 'Application output' pane in Qt Creator IDE on Linux. Finally I found a solution, thanks to a user on Qt IRC channel.<br />
<br />
<u>To enable log messages in Qt, do the following:</u><br />
<br />
Edit <span style="font-family: "courier new" , "courier" , monospace;">~/.config/QtProject/qtlogging.ini</span> and make sure it has:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">[Rules]<br />*.debug=true<br />qt.*.debug=false</span><br />
<br />
With this, I was getting the messages when I run the application from a terminal. But Qt Creator was not showing the qDebug() messages.<br />
<br />
<br />
<u>To have the messages displayed in Qt Creator, do the following:</u><br />
<br />
Qt creator > Tools > Options > Kits, select your kit, find Environment, click change and add:<br />
<span style="font-family: "courier new" , "courier" , monospace;">QT_ASSUME_STDERR_HAS_CONSOLE=1</span><br />
<br />
This fixed the problem for me. I thought I should document the full process here as Google wasn't getting me good leads.<br />
<br />
My environment:<br />
Fedora 29 Linux x86-64<br />
Qt 5.11.3<br />
Qt Creator v4.7.2<br />
<br />
<br />
<u>References:</u><br />
<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1227295">https://bugzilla.redhat.com/show_bug.cgi?id=1227295</a> <br />
<a href="https://www.devdungeon.com/content/how-enable-qdebug-messages-qt">https://www.devdungeon.com/content/how-enable-qdebug-messages-qt</a> <br />
<a href="https://bugreports.qt.io/browse/QTBUG-66153">https://bugreports.qt.io/browse/QTBUG-66153</a><br />
<div align="justify" style="font-size: 12pt;">
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com8tag:blogger.com,1999:blog-2888956143852596439.post-65010248284104787302014-11-13T22:37:00.001+05:302017-01-10T07:54:02.116+05:30ബിഗ് റേഡിയോ ഇതിഹാസം<div align="justify">
<span style="font-size: large;">ഇന്ന് തിരുവനന്തപുരത്ത് 92.7 ബിഗ് എഫ്എം റേഡിയോ പരിപാടിയില് കേട്ടത്.. </span><br />
<span style="font-size: large;">പരിപാടി: "<a href="https://www.facebook.com/AncyGeorge/" target="_blank">സ്വീറ്റ് ആന്സി</a>" അവതരിപ്പിക്കുന്ന റിക്വസ്റ്റ് രാഗ, യെസ് ഓര് നോ ഗെയിം</span><br />
<br />
<div style="text-align: center;">
<span style="font-size: large;">...</span></div>
<span style="font-size: large;">സ്വീആ: ഹലോ, ആരാ വിളിക്കുന്നത്? </span><br />
<span style="font-size: large;">റസാക്ക്</span><br />
<span style="font-size: large;">സ്വീആ: റസാക്ക് അല്ലേ.. "റസാക്കിന്റെ ഇതിഹാസം" വായിച്ചിട്ടുണ്ടോ?</span><br />
<span style="font-size: large;">റസാക്ക്: ഇല്ല</span><br />
<span style="font-size: large;">സ്വീആ: എന്താ റസാക്കേ, സ്വന്തം പേരില് ഒരു പുസ്തകമൊക്കെ ഉള്ളപ്പോള് അത് വായിക്കണ്ടേ?</span><br />
<span style="font-size: large;">റസാക്ക്: ങേ?</span><br />
<div style="text-align: left;">
<span style="font-size: large;">...</span></div>
<span style="font-size: large;">സ്വീആ: അപ്പോള് റസാക്കിനും റസാക്കിന്റെ ഇതിഹാസം ഇഷ്ടപ്പെടുന്ന വായനക്കാര്ക്കും വേണ്ടി ഈ പാട്ട് ഡെഡിക്കേറ്റ് ചെയ്യുന്നു...</span><br />
<br />
<div style="text-align: center;">
<span style="font-size: large;">... </span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-size: large;"><i>വാല്: മഹാനായ എഴുത്തുകാരന് പിണറായി വിജയന് എഴുതിയ "റസാക്കിന്റെ ഇതിഹാസം" എന്നോ മറ്റോ പറയാതിരുന്നത് തന്നെ ഭാഗ്യം</i></span></div>
<div style="text-align: center;">
<span style="font-size: large;">... </span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-size: large;">ചോദ്യം: 'ചങ്ങമ്പുഴ' എന്ന കവിത എഴുതിയത് ആരാണ്?</span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഉത്തരം: അങ്ങനെയൊരു കവിതയുണ്ടെങ്കില് അതെഴുതിയത് രമണനായിരിക്കും!</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><span style="font-size: small;">(കടപ്പാട്: കണ്ട് മറന്ന ഒരു പഴയ മലയാളം സിനിമ)</span> </span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com2tag:blogger.com,1999:blog-2888956143852596439.post-1173018193088405172014-10-19T14:46:00.001+05:302018-07-07T18:36:02.166+05:30ജനറേഷന് ഗ്യാപ്പ്<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpecyOgodzSs8SeSAkZ6fv30TdbHHskccIzg_TgxWdHgzmLoJihP71GVKvYJNdb49GEFFZcEIKKnsaIQREur6tTjwrQw3yATOs8AnVKLl6JuI0wZZZYb2rj07mzyETuQPKlLiLL7eWhTE/s1600/carto.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="150" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpecyOgodzSs8SeSAkZ6fv30TdbHHskccIzg_TgxWdHgzmLoJihP71GVKvYJNdb49GEFFZcEIKKnsaIQREur6tTjwrQw3yATOs8AnVKLl6JuI0wZZZYb2rj07mzyETuQPKlLiLL7eWhTE/s1600/carto.jpg" width="150" /></a></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഇന്നലെ വൈകുന്നേരം വണ്ടിയോടിക്കുമ്പോള് കേള്ക്കാനിടയായ തിരുവനന്തപുരം അനന്തപുരി FM-ന്റെ ഫോണ്-ഇന് പരിപാടിയില് നിന്ന്. പരിപാടി അവതരിപ്പിക്കുന്നത് താമരശ്ശേരി നീലാംബരന് സാര്.</span><br />
<div style="text-align: center;">
<span style="font-size: large;">---------------------------------------------------------------</span></div>
</div>
<span style="font-size: large;">നീലാംബരന് സാര്: ഹലോ..</span><br />
<span style="font-size: large;">രാഹുല്: ഹലോ..</span><br />
<span style="font-size: large;">... </span><br />
<span style="font-size: large;">സാര്: മോന് ഏത് ക്ലാസ്സിലാ പഠിക്കുന്നത്?</span><br />
<span style="font-size: large;">രാഹുല്: ഏഴാം ക്ലാസ്സില്</span><br />
<span style="font-size: large;">സാര്: പഠിത്തമൊക്കെ എങ്ങനെ പോകുന്നു? ക്ലാസ്സില് രാഹുല് എത്രാമനാ? <span style="font-size: x-small;">(മലയാളത്തിന് നന്ദി. ഇംഗ്ലീഷില് ഇത് ചോദിക്കാന് കുറച്ച് കഷ്ടപ്പെട്ടേനേ..)</span> ഒന്നാമതാണോ?</span> <br />
<span style="font-size: large;">രാഹുല്: അല്ല. ഞാന് രണ്ടാമനാ</span><br />
<span style="font-size: large;">സാര്: രാഹുല് നന്നായി പഠിച്ച് വേഗം തന്നെ ഒന്നാമനാകണം. കേട്ടോ..</span><br />
<span style="font-size: large;">രാഹുല്: ശരി (?)</span><br />
<span style="font-size: large;">സാര്: രാഹുലിന് ഏത് വിഷയമാണ് ഏറ്റവും ഇഷ്ടം?</span><br />
<span style="font-size: large;">രാഹുല്: സയന്സ്</span><br />
<span style="font-size: large;">സാര്: ആഹാ.. വലുതാവുമ്പോള് മോന് ആരാകണമെന്നാ ആഗ്രഹം?</span><br />
<span style="font-size: large;">രാഹുല്: കാര്ട്ടോഗ്രാഫര്!</span><br />
<span style="font-size: large;">സാര്: ങേ? ജെബാ? </span><br />
<span style="font-size: large;">രാഹുല്: കാര്ട്ടോഗ്രാഫര് (?)</span><br />
<span style="font-size: large;">സാര്: ഏ? ങ്ഹാ.. അതാകാനാണല്ലേ ആഗ്രഹം.. ശരി ശരി.. മോനേത് പാട്ടാ വേണ്ടത്? (ഹാവൂ..)</span><br />
<span style="font-size: large;">...</span><br />
<span style="font-size: large;">സാര്: ബ്ലഡി ഔട്ട്സ്പോക്കണ് കാര്ട്ടോഗ്രാഫേഴ്സ്! <span style="font-size: x-small;">(എന്ന് മനസ്സില് പറഞ്ഞിട്ടുണ്ടാകണം)</span></span><br />
<br />
<div style="text-align: center;">
<span style="font-size: large;">---------------------------------------------------------------</span></div>
<span style="font-size: large;"></span><br />
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><i>വാല്: <a href="http://en.wikipedia.org/wiki/Cartography" target="_blank">കാര്ട്ടോഗ്രഫിയില്</a> താത്പര്യം കാണിച്ച ആ കൊച്ച് മിടുക്കന് അഭിനന്ദനങ്ങള്! സ്കൂളില് map projection പഠിപ്പിക്കുമ്പോള് ഒരു മണ്ണാങ്കട്ടയും മനസ്സിലാകാതെ ബ്ലിങ്കസ്യ: ആയി കേട്ടിരുന്നത് ഓര്ക്കുന്നു.</i></span><br />
<br />Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-15149283012472091752014-02-19T20:48:00.001+05:302014-03-24T06:54:35.278+05:30Fear and Loathing in KDE Land?<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<b>Full disclosure:</b> My only contributions to KDE project are several bug reports and perhaps a few new users. So my qualifications to comment on the issue is of course almost non-existent. But hey, I've been a faithful KDE user for all these years, and so I think I have some right to make comments at least from a user's perspective.</div>
<div style="text-align: center;">
-------</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
There's been some discussions on KDE land regarding replacing Nepomuk (or Nepomuk-KDE for the politically correct) with a <a href="http://mail.kde.org/pipermail/nepomuk/2013-December/004858.html" target="_blank">new project named Baloo</a>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The Baloo project is headed by KDE developer Vishesh Handa, who apparently was very much involved in Nepomuk as well. Baloo wasn't announced officially to the 'public' till now, but thanks to recent <a href="http://www.phoronix.com/scan.php?page=news_item&px=MTYwNjM" target="_blank">Phoronix</a> <a href="http://www.phoronix.com/scan.php?page=news_item&px=MTYwODU" target="_blank">articles</a>, it's been gaining some attention. The article titled "KDE's Nepomuk Doesn't Seem To Have A Future" went on to say:</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<i>"It appears there isn't much of a future left to KDE's Nepomuk framework that was developed at a cost of 17 million Euros... It's going to be replaced going forward in the KDE land."</i></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
The tone of the article hasn't pleased everybody. Now there's some storm on KDE promo mailing list with KDE guru Aaron Seigo suggesting that the new project should've been branded as just another version of Nepomuk. Many members, and especially Vishesh Handa, the project maintainer are <a href="http://lists.kde.org/?l=kde-promo&m=139280596415422&w=2" target="_blank">opposed to this idea</a> and want Baloo to remain as a new project, one that replaces Nepomuk.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I've been a moderate fan of Seigo, but reading through the mailing list, I couldn't stand the stink of his PR bullshit.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Some things that everybody (even Seigo) seem to agree on:</div>
<ul>
<li>Nepomuk wasn't the greatest piece of software</li>
<li>It hasn't got any love from users</li>
<li>The 'semantic features' introduced by Nepomuk had few users</li>
<li>Baloo is significantly better and faster than Nepomuk ever was</li>
</ul>
<br />
<div style="text-align: justify;">
As for me, <b>the very news that Nepomuk is going to be removed is reason to rejoice</b>. Nepomuk was a f**ked-up useless piece of bloat-ware. For some reason, <a href="http://aseigo.blogspot.in/2010/05/i-dont-need-no-stinking-nepomuk-right.html" target="_blank">its proponents</a> were pushing the idea that 'rating and tagging your files' was the next big thing that users want to do. Then there was this desktop indexing/search that would suck the juice out of your desktop experience - something Java does to your online experience.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
In fact, disabling desktop search and Nepomuk is the first thing I do after a fresh installation of Fedora. I wonder if Nepomuk had as many happy users as it had developers and PR dudes!</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Seigo seems to think that Nepomuk-KDE (and KDE's association with Europian Union project) is something to boast about and he apparently fears that the PR team would lose this if they are to switch to Baloo. He proposes to brand Baloo as Nepomuk v2 (or v3 or whatever) so that the <i>awkward</i> situation of accepting Nepomuk's failure can be avoided or at least soothed.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I'd say that a press release announcing the death of Nepomuk-KDE would only evoke positive emotions from users. One may hide behind euphemisms and other PR tricks, but the facts of the case are undisputed.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: center;">
------</div>
<div style="text-align: justify;">
Read the mailing list entries:</div>
<div style="text-align: justify;">
<a href="http://lists.kde.org/?t=138997753600002&r=1&w=2" target="_blank">Article about Baloo</a></div>
<div style="text-align: justify;">
<a href="http://lists.kde.org/?t=139277203700006&r=1&w=2" target="_blank">nepomuk / baloo naming implications</a></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="font-size: 12pt; text-align: justify;">
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com13tag:blogger.com,1999:blog-2888956143852596439.post-39143071663447043812013-11-23T19:19:00.000+05:302013-11-23T19:19:35.083+05:30My very first self-made wine!<div style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJmjqz6ol_r9N9ywXda6IOibUtdowAkQ9NIP4k38epiY3oc2eIuboHChFx8wMqTmNPm_IaQ9qk_2SiOQEm2D7V1y33GFk5zTVWG1XGDflGydckhvjHpU9MkIAR98TyN9gwyEGrtOEfpIQ/s1600/wine.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJmjqz6ol_r9N9ywXda6IOibUtdowAkQ9NIP4k38epiY3oc2eIuboHChFx8wMqTmNPm_IaQ9qk_2SiOQEm2D7V1y33GFk5zTVWG1XGDflGydckhvjHpU9MkIAR98TyN9gwyEGrtOEfpIQ/s320/wine.jpg" width="243" /></a></div>
<div style="text-align: justify;">
Today I tasted the result of our first ever home-made wine experiment - and it was awesome. The wine turned out to be sweet and reasonably strong.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I followed the popular instructions from <a href="http://www.kosukadi.com/make-wine-at-home-easy-and-cheap-home-made-red-wine-recipe/" target="_blank">Kosukadi</a>. We used only common ingredients - regular dark grapes and yeast. Didn't look for any fancy grape varieties or special yeast.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The only deviation from the recipe was that I didn't add any egg white. And perhaps I slightly overdosed on the wheat too. Don't know if that has any effect anyway.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
I followed the instructions thoroughly. The ingredients were mixed in a sterilized glass jar. As instructed, for the first 21 days, I opened it regularly and mixed the contents with a clean spoon. I might have missed a day or two, though. On the 21st day, the contents were filtered and the solid residue was removed. The filtered brew was stored back in the jar for about another 40 days (no daily stirring required).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
And today, I siphoned off the clear liquid from the top in to glass bottles using a clean plastic tube. The wine turned out to be both sweet and strong. We loved it. I'm not a seasoned wine taster, so I can't make an educated comment on its quality. But for me, the experiment is a resounding success and inspiration to try out more variations and recipes :-)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For those wanting to try wine making, I'd strongly recommend Kosukadi's recipe. Its simple, cheap and gets great results.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Once we're done with this batch, I think I should try pineapples. He he..</div>
<div style="text-align: justify;">
<br /></div>
<div style="font-size: 12pt; text-align: justify;">
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com2tag:blogger.com,1999:blog-2888956143852596439.post-26196043867727208472013-11-11T01:17:00.001+05:302013-11-11T01:19:02.716+05:30Philips and the Monkey Pen - Movie Review<div align="justify" style="font-size: 12pt;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4nnZYaypzqZDnXjVxKt69h0ShTEL_qnfOgK-39c1N9buzeQfk07uq8qxHROKfCLjVpNyxRjzZbmvTVTdzES0KFT47IMv6lqhDw3WTO3ScGlpdEOKPeDzXLPafE2ODczK7p1JrbPGRZDI/s1600/3964philips_and_the_monkey_pen_movie.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="223" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4nnZYaypzqZDnXjVxKt69h0ShTEL_qnfOgK-39c1N9buzeQfk07uq8qxHROKfCLjVpNyxRjzZbmvTVTdzES0KFT47IMv6lqhDw3WTO3ScGlpdEOKPeDzXLPafE2ODczK7p1JrbPGRZDI/s400/3964philips_and_the_monkey_pen_movie.jpg" width="400" /></a></div>
<br />
Philips and the Monkey Pen is a children's film that showcases the innocence of childhood. The central character is Ryan Philips (played by Sanoop, actress Sanusha's brother), a mischievous school boy who has a special dread for Mathematics. His parents (played by Jayasurya & Remya Nambisan) are good folks who love him and generally let him do whatever it is that he does.<br />
<br />
Ryan is exceptionally bad at mathematics. He is terrified of the subject and hates the teacher (played by Vijay Babu) who regularly mocks and canes him for not doing his homework. Ryan's quest for a solution to his maths homework chores first takes him to his love interest - Joan. After that route fails, he stumbles up on a magic pen - <i>The Monkey Pen</i>, from his grand father's (Joy Mathew) antique collection. The pen is believed to have magical powers and had even helped <a href="http://en.wikipedia.org/wiki/Robert_Bristow" target="_blank">Robert Bristow</a> to build Kochi's <a href="http://en.wikipedia.org/wiki/Willington_Island" target="_blank">Willingdon island</a>. The rest of the story is about how Ryan's days are transformed by the pen and the <i>magic</i> it does to his life.<br />
<br />
Sanoop as Ryan Philips has delivered a decent performance although some of his lines seemed to be artificial and forced. Jayasurya has done a fair though not spectacular job while Remya Nambisan didn't have to do much with her role. Vijay Babu as the mathematics teacher was convincing while Mukesh's character as the school principle wasn't specifically noteworthy.<br />
<br />
<b>Overall I find the film only slightly above average. </b><b>The film is notable for its great visuals and good performances by the child actors. However the script and direction weren't up to the mark and the story telling left a lot to be desired.</b> The movie wanders off track in several places and the makers seem to be confused about the correct dosage of preaching to be stuffed in the movie.<br />
<br />
When Ryan went to work at the school with his magic pen, I couldn't help but recollect <a href="http://www.imdb.com/name/nm0005286/" target="_blank">Haley Joel Osment</a>'s performance in the movie <a href="http://www.imdb.com/title/tt0223897/" target="_blank">Pay It Forward</a> (just another kid-in-a-school story, no plagiarism accusations please). <br />
<br />
<br />
<b>PS</b>: I wonder how they come up with the kids' names! Ryan Philips is perhaps one of those stylish (read western) christian names that have become popular these days (along with the likes of Rex, Max etc.). His friends have <i>Amar-Akbar-Antony</i> names, making it look like they want to maintain cultural balance in their panel for winning the next elections! The class topper is named Decimal! What's next, Binary?<br />
<br />
<br />
<b>PPS:</b> മങ്കി പെന്, മങ്കിപ്പെന്, മണ്ടിപ്പെണ്ണ്.. ആ..യെന്ത്? ഛെ ഛെ..<br />
<br />
<br />
<br /></div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com7tag:blogger.com,1999:blog-2888956143852596439.post-41139394708040020082013-10-26T23:50:00.002+05:302013-10-26T23:50:58.635+05:30Wishbone - Restaurant<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Wishbone is a relatively new restaurant at Kuravankonam Junction (just beside Cafe Mojo) offering healthy <i>and/or</i> tasty dining to the city folks.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
The restaurant is overseen by Ms. Lalitha Appukkutan, a nutritionist who occasionally appears on TV shows (related to diets).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The restaurant almost exclusively focuses on chicken, besides its choice of vegetarian dishes. They have two menus - <i>Ultimate Wish</i> & <i>Heavenly Wish</i>. The Ultimate menu is for the calorie conscious and the Heavenly one is for those who wish to honour their taste buds. Both menus have veg & non-veg dishes, but I found the Heavenly menu more attractive because it had more chicken dishes :-)<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgInmpwMajS-grTtIESR4Qh2q9Uxwb6KaoiVt3MUUzBA7HTIlmNNDYbVSSbfM0h-DLNke47pQSnoJuGH8OnjX9EPcAAVy9yvpOWoItcEbL-hMxgaRSU1wqB6VE-NkTnByIvngmqAzJagVA/s1600/wishbone.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="226" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgInmpwMajS-grTtIESR4Qh2q9Uxwb6KaoiVt3MUUzBA7HTIlmNNDYbVSSbfM0h-DLNke47pQSnoJuGH8OnjX9EPcAAVy9yvpOWoItcEbL-hMxgaRSU1wqB6VE-NkTnByIvngmqAzJagVA/s320/wishbone.jpg" width="320" /></a><br />
The restaurant is very well furnished and give off a comfy ambience. The place is not very big and sometimes it does feel a bit crowded and noisy depending on who your neighbours are. But the food is really good. All curries are served steaming hot and have a distinct freshness about them. Serving quantity is medium and even low for some dishes. All items are very reasonably priced - about Rs. 90-140.<br />
<br />
I found all dishes (I mean the ones we had, of course) to be excellent, except for 'Irachi Puttu' which was a let down. The dessert menu is also quite limited. I tried the Coffee Vanilla pudding and Coconut pudding. Both were quite okay.<br />
<br />
I wouldn't use the word <i>exquisite</i>, but it was the best dinner I had in recent times. So if you crave for some good food, do checkout Wishbone.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="font-size: 12pt; text-align: justify;">
</div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-90705555411081825082013-10-20T21:42:00.000+05:302013-10-27T00:07:17.857+05:30ഇടുക്കി ഗോള്ഡ് - Movie Review<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
<div style="text-align: justify;">
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDz6K78BpllK5V2RdphcA_ieBLXUZOCk278lZXtqlp_Nq0GiYB9_Vj060c0XgK73rZWvhW0yG1q1k-8bkx39FdXLRFhBQerDCXdwegWssLgWomGvIC_cdUpmon2L_kq4XF5KMatyDVRaI/s1600/idukki_gold_xlg.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDz6K78BpllK5V2RdphcA_ieBLXUZOCk278lZXtqlp_Nq0GiYB9_Vj060c0XgK73rZWvhW0yG1q1k-8bkx39FdXLRFhBQerDCXdwegWssLgWomGvIC_cdUpmon2L_kq4XF5KMatyDVRaI/s320/idukki_gold_xlg.jpg" width="240" /></a></span></div>
<span style="font-size: large;">ആഷിക് അബുവിന്റെ പുതിയ സംരംഭം 'ഇടുക്കി ഗോള്ഡ്' പ്രദര്ശനം തുടങ്ങിയിട്ട് ഇപ്പോള് ഏതാനും ആഴ്ചകളായിരിക്കുന്നു. പ്രതാപ് പോത്തന്, രവീന്ദ്രന്, മണിയന്പിള്ള രാജു, ബാബു ആന്റണി, വിജയരാഘവന് എന്നിവര് മുഖ്യകഥാപത്രങ്ങളെ അവതരിപ്പിക്കുന്നു. സജിത മഠത്തില്, ജോയ് മാത്യു, രവി വള്ളത്തോള് എന്നിവര് അത്ര പ്രധാനമല്ലാത്ത റോളുകളില് ഉണ്ട്.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഇടുക്കിയിലെ ഒരു ചെറിയ സ്കൂളില് പണ്ട് ഒന്നിച്ച് പഠിച്ച അഞ്ച് കൂട്ടുകാര് വര്ഷങ്ങള്ക്ക് ശേഷം (അതായത് അവര് പ്രതാപ് പോത്തന്റേയും, വിജയരാഘവന്റേയുമൊക്കെ പ്രായമായപ്പോള്) ഒത്തുകൂടുന്നതും ഓര്മ്മകള് അയവിറക്കാന് ഇടുക്കിയിലേക്ക് നടത്തുന്ന യാത്രയുമാണ് കഥാവൃത്തം. ഭൂതവും വര്ത്തമാനവും ഇടകലര്ത്തിയാണ് സിനിമ പുരോഗമിക്കുന്നത് (പേടിക്കണ്ട, <a href="http://www.imdb.com/title/tt0209144/" target="_blank">Memento</a> പോലെ വട്ടാക്കുന്ന ഫ്ലാഷ്-ബാക്കുകളൊന്നുമല്ല).</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഇടുക്കിയിലെ മലനിരകളില് വളരുന്ന കഞ്ചാവാണത്രേ ഈ 'ഇടുക്കി ഗോള്ഡ്'. "ശിവന് മുതല് ചെഗുവേര വരെ" വലിച്ചിരുന്ന നീലപ്പുക എന്ന് ചിത്രം അവകാശപ്പെടുന്നു. ഈ കഞ്ചാവ് ചിത്രത്തിലെ കഥാപാത്രങ്ങള്ക്ക് ഒരു പ്രധാന മോട്ടിവേറ്ററാണ്. പഴയകാലം ഓര്ക്കുക മാത്രമല്ല, ഇടുക്കി ഗോള്ഡ് ഒന്ന് പുകയ്ക്കുക കൂടിയാണ് ഇവരുടെ യാത്രയുടെ ഉദ്ദേശ്യം. കഞ്ചാവിനെ ഗ്ലോറിഫൈ ചെയ്യുകയാണീ സിനിമ എന്ന് വ്യാപകമായ വിമര്ശം ഉണ്ടല്ലോ. എന്തായാലും Marijuana കേന്ദ്രീകരിച്ചുള്ള എത്രയോ ഇംഗ്ലീഷ് <a href="http://en.wikipedia.org/wiki/Stoner_film" target="_blank">stoner comedy</a> സിനിമകള് നാം കണ്ടാസ്വദിച്ചിരിക്കുന്നു. അതിനൊന്നുമില്ലാത്ത പ്രശ്നമൊന്നും ഈ ചിത്രത്തിനുമില്ല. പിന്നെ, ഈ കാരണം കൊണ്ട് ഇതൊരു "കുടുംബ ചിത്രം"</span><span style="font-size: large;"> അല്ലായിരിക്കാം. ഇറങ്ങുന്ന ചിത്രങ്ങളെല്ലാം ദിലീപിന്റെ വളിപ്പുകള് പോലെ "കുടുംബ ചിത്രം" എന്ന ബാനറില് വേണമെന്നില്ലല്ലോ. എല്ലാ തരം ചിത്രങ്ങളും ഉണ്ടാകട്ടെ.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"><b>കഞ്ചാവ് വിവാദങ്ങള്ക്കപ്പുറം, തരക്കേടില്ലാത്ത ഒരു സിനിമയാണ് ഇടുക്കി ഗോള്ഡ്. കൊള്ളാവുന്ന ഒരുപാട് തമാശകളും, ഉഗ്രന് വിഷ്വല്സും, നല്ല ഏഡിറ്റിങ്ങും, ഗാനങ്ങളും ചിത്രത്തിന്റെ മുക്കാല് ഭാഗം വരെ നന്നാക്കിയിട്ടുണ്ട്.</b> <b>എന്നാല് സിനിമയുടെ അവസാനം സാമാന്യം ബോറാണ്. ഇതെങ്ങിനെയും കൊണ്ടൊന്ന് തീര്ക്കണമല്ലോ എന്ന മട്ടിലാണ് ക്ലൈമാക്സ്.</b></span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span>
<span style="font-size: large;">കഥാപാത്രങ്ങളുടെ ബാല്യകാലം അഭിനയിച്ച പിള്ളേരെല്ലാം നന്നായിരുന്നു. രവീന്ദ്രന് (പഴയ ഡിസ്കോ രവീന്ദ്രന്) കലക്കിയപ്പോള്, ബാബു ആന്റണി, മണിയന്പിള്ള രാജു, പ്രതാപ് പോത്തന് എന്നിവര് ശരാശരി നിലവാരം പുലര്ത്തി. ബാബു ആന്റണിയെ ചിത്രത്തില് കാസ്റ്റ് ചെയ്തത് എനിക്കിഷ്ടപ്പെട്ടു. എന്നാല് വിജയരാഘവന് അത്ര ശരിയായോ എന്ന് ഒരു സംശയം. ജോയ് മാത്യുവിനെ ഇറക്കിയത് നന്നായെങ്കിലും സജിത മഠത്തിലിന്റെ അപ്പിയറന്സ് വെറുതേയായിപ്പോയി.</span><br />
<br />
<span style="font-size: large;">സിനിമ പൊതുവേ ഒരു തമാശ ലൈനാണ്. അവസാനത്തെ ഏതാണ്ട് അര മണിക്കൂറൊഴിച്ചാല്. ഈ അര മണിക്കൂര് തന്നെയാണ് ചിത്രത്തിന്റെ പ്രധാന ന്യൂനതയും. ഒരു കാട്ടാന ജീപ്പിനെ ആക്രമിക്കുന്ന രംഗമുണ്ട്. ന്യൂ ജെന് സ്റ്റൈലില് പറഞ്ഞാല് വന് ഡെസ്പ്! കുറച്ചുകൂടി നന്നായിട്ടഭിനയിക്കുന്ന മറ്റേതെങ്കിലും പ്രതിമ ആനയെന്ന് പറഞ്ഞ് കൊണ്ടുവയ്ക്കാമായിരുന്നു.</span><br />
<span style="font-size: large;">പിന്നെ ചിത്രത്തിന്റെ ക്ലൈമാക്സും അത്ര സുഖം പോര. കൂടുതല് പറഞ്ഞാല് സ്പോയിലര് ആകും എന്നതിനാല് ഒന്നും എഴുതുന്നില്ല.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span>
<span style="font-size: large;"></span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ചിത്രത്തെക്കുറിച്ച് വിമര്ശനങ്ങളും വഴക്കുകളും വരെ സോഷ്യല് മീഡിയകളിലും മറ്റ് സൈറ്റുകളിലും സജീവമാണ്. കുറ്റം പറയുന്നവരെ പ്രതാപ് പോത്തന് ഫെയ്സ്ബുക്കില് തെറിവിളിക്കുകയും ചെയ്തിരിക്കുന്നു. ഇടുക്കി ഗോള്ഡ് ശരാശരിയിലും ഭേദപ്പെട്ട ഒരു സിനിമയാണെന്നാണ് എന്റെ അഭിപ്രായം. പക്ഷെ ഇത് ആഷിക് അബുവിന്റെ ഫാന്സും പ്രതാപ് പോത്തനും വിശ്വസിക്കാനാഗ്രഹിക്കുന്നത് പോലെ മഹത്തായ കലാ സൃഷ്ടിയോ ബ്രില്ല്യന്റ് സിനിമയോ ഒന്നുമല്ല. മലയാളത്തിലെ ആദ്യ stoner movie എന്ന് പറയാം. അതിനെന്തായാലും ഈ ചിത്രത്തിന്റെ ശില്പികള് അഭിനന്ദനമര്ഹിക്കുന്നു.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
<div style="text-align: justify;">
</div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-2257255270616898392013-10-19T21:24:00.001+05:302019-09-01T21:42:19.003+05:30Fun with arrays in C & C++ - Part2<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
In <a href="http://solidsmoke.blogspot.in/2013/10/fun-with-arrays-in-c-c-part1.html" target="_blank">Part-1</a>, we saw a couple of examples on array indexing and pointer arithmetic.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Lets dive a little deeper in to array <i>types</i>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>Arrays & pointers</b></u></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
An array is a series of contiguous values in memory and the array name gives us a <i>handle</i> to this list. In C and C++, a <i>pointer</i> refers to (or <i>points to</i>) another object in memory. Since arrays are guaranteed to be contiguous, if we have a pointer to the first element in the array, we can access the whole array (as long as we know how big it is)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Assigning the address of the first element to a pointer:</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>int a[100];</b></span></div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>int *p = a; //p now points to a[0]</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Here p is a <i>pointer to int</i> and we are simply using the array name for assignment. <u>The array name is said to freely <i>decay to a pointer to</i> <i>the object's type</i></u>. i.e. if a is an array of objects of type T, then it can be seamlessly converted to a <i>pointer to T</i> (i.e. to a <i>T*</i>).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
This is what happens when you pass an array's name to a function that takes a pointer as argument.</div>
<div style="text-align: justify;">
For example:</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>char str[] = "hello %d";</b></span></div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>printf(str, 123);</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The first argument to <span style="font-family: "courier new" , "courier" , monospace;"><b>printf</b></span> is actually a <span style="font-family: "courier new" , "courier" , monospace;"><b>char*</b></span> (well, <span style="font-family: "courier new" , "courier" , monospace;"><b>const char* restrict</b></span>, to be precise) but we're passing an array instead. This works alright without casts because the array type gets converted to pointer type.</div>
<div style="text-align: justify;">
(Note that explicitly specifying array size is optional when it is initialized to some value).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>Type of an array</b></u></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Since arrays get converted to pointers quite easily, people make the mistake of thinking they are the same, but they really aren't.</div>
<div style="text-align: justify;">
The type of a when declared as:</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b> int a[100];</b></span></div>
<div style="text-align: justify;">
is:</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b> int [100]</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
It gets converted to <b><span style="font-family: "courier new" , "courier" , monospace;">int*</span></b> easily, but its native type is <span style="font-family: "courier new" , "courier" , monospace;"><b>int[100]</b></span>. In many contexts, this distinction makes quite a difference.</div>
<div style="text-align: justify;">
<br />
<br />
<b><u>Multi-dimensional arrays</u></b><br />
<br />
Consider this so called <i>2D</i> array:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int a[3][5];</b></span><br />
<br />
Most people think of it as a two dimensional array - one that has 3 <i>rows</i> and 5 <i>columns.</i> We can index all 15 elements (3x5) by using double subscripts:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>a[0][0]</b></span> gets us the <i>first row, first column</i> element and <span style="font-family: "courier new" , "courier" , monospace;"><b>a[2][4]</b></span> gets us the <i>last row, last column</i> element. Right?<br />
Although the row-and-column way of thinking works, it doesn't scale well when the number of dimensions are more. With three dimensions, we can still visualize the array in 3D space but beyond that, all hell breaks loose for most people.<br />
<br />
<u>A more convenient way to understand multi-dimensional arrays is to think of them as <i>array of arrays</i>.</u> Actually, more than being convenient, it possibly is a <i>more correct</i> way.<br />
In this approach, this is how you interpret an array declaration:<br />
<ol>
<li>Identify the array name</li>
<li>The number that immediately follows the array name is the array length</li>
<li>Whatever remains is the array object type</li>
</ol>
Using the above method, let's interpret:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int a[3][5];</b></span><br />
<ol>
<li>The array name is: <span style="font-family: "courier new" , "courier" , monospace;"><b>a</b></span></li>
<li>The length of the array is: 3</li>
<li>The type of each object in the array is: <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span></li>
</ol>
Therefore: <i>a is an array of length 3, and each element of a is an int[5]</i>. i.e. a is an array of three arrays, each 5 int's long.<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>a[0]</b></span> now gets the first element in the array - i.e. the first <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span>. <span style="font-family: "courier new" , "courier" , monospace;"><b>a[1]</b></span> gets us the next <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span> and <span style="font-family: "courier new" , "courier" , monospace;"><b>a[2]</b></span> the last <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span>.<br />
<br />
<br />
<u><b>Pointer conversions</b></u><br />
<br />
Continuing with the above example of <b><span style="font-family: "courier new" , "courier" , monospace;">int a[3][5]</span></b>, what should be <i>some-type</i> for the following assignment to work? <br />
<br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;"><i>some-type</i> p = a;</span></b><br />
<br />
It is common for people to try <span style="font-family: "courier new" , "courier" , monospace;"><b>int** p</b></span>; When that doesn't work, they try to get around it by doing an explicit type-cast of <span style="font-family: "courier new" , "courier" , monospace;"><b>a</b></span>. This obviously is the wrong thing to do.<br />
<br />
To answer the question, remember that the array name can convert to pointer to array object's type. In our example, each element in the array is of type <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span>. So <span style="font-family: "courier new" , "courier" , monospace;"><b>a</b></span> should seamlessly convert to <i>pointer to int[5]</i>. Right?<br />
How do we declare a 'pointer to int[5]'? Here it is:<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int (*p)[5];</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>p = a;</b></span><br />
<br />
The parentheses around '<span style="font-family: "courier new" , "courier" , monospace;"><b>p</b></span>' is needed as without it, the declarion would read:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int *p[5];</b></span><br />
which declares <i>an array of pointers</i> (to int) rather than <i>a pointer to an array</i>.</div>
<div style="text-align: justify;">
<br />
<br />
Now, how about this:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b><i>some-type</i> p = a[1]<i>;</i></b></span><br />
<br />
What is <i>some-type</i>? Again, we know that <span style="font-family: "arial" , "helvetica" , sans-serif;"><b>a[1]</b></span> has type <b><span style="font-family: "courier new" , "courier" , monospace;">int[5]</span></b>. So <span style="font-family: "courier new" , "courier" , monospace;"><b>p</b></span> should also have the same type, right? However, <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span> is an array type and C (or C++) doesn't allow arrays to be assigned to each other. So <span style="font-family: "courier new" , "courier" , monospace;"><b>p</b></span> couldn't be an <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span>. But it can be something that an <span style="font-family: "courier new" , "courier" , monospace;"><b>int[5]</b></span> gets freely converted to. Using the knowledge that an array type can convert to a pointer to object type, it must be an <span style="font-family: "courier new" , "courier" , monospace;"><b>int*</b></span>.<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int *p = a[1];</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>*p = 5; //writes to a[1][0]</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>p[2] = 9; //writes to a[1][2]</b></span></div>
<div style="text-align: justify;">
<br />
The advantage of this method is that it easily scales to higher dimensions.<br />
<br />
Example: <br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>int a[3][5][9];</b></span><br />
<br />
<i>a is an array of length 3, each element of which is an int[5][9].</i><br />
<br />
Some sample pointer conversions follow: <br />
<br />
<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">int (*p1)[5][9] = a;<br />int (*p2)[9] = a[0];<br />int *p3 = a[0][0];<br />int x = a[0][0][0];</span></b><br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;"><b><span style="font-family: "courier new" , "courier" , monospace;"><b>a[0][0][0] = 5;</b></span> </b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>p2 = p1[0];<br />p3 = p2[0];</b></span><br />
<span style="font-family: "courier new" , "courier" , monospace;"><b>x = p3[0]; //x becomes 5</b></span><br />
<br />
<br />
<br />
<u><b>Summary</b></u><br />
<br />
<ul>
<li>Be aware that an array and a pointer are not identical</li>
<li>The type of array is different from a pointer to the element type</li>
<li>Interpret a multi-dimensional array as an <i>array of arrays</i></li>
<li>Use the correct pointer types to access multi-dimensional arrays and avoid incorrect type-casts</li>
</ul>
<br />
<br />
<br /></div>
<div style="text-align: justify;">
<br /></div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com5tag:blogger.com,1999:blog-2888956143852596439.post-64312509783094109662013-10-16T23:04:00.002+05:302019-09-23T20:36:09.522+05:30Fun with arrays in C & C++ - Part1<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
I was explaining some stuff about arrays and pointers to a colleague and thought I should do a post about this. So here goes..</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Declare 'a' as an array of 100 int objects:</div>
<div style="text-align: justify;">
<b><span style="font-family: "courier new" , "courier" , monospace;">int a[100];</span></b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Set the 10th element to the value 1000:</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>a[9] = 1000;</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The square brackets we used in the above expression is called the <i>subscript operator</i>. We use the index value 9 to access the 10th element because arrays in C and C++ are indexed from 0.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So far so good. Now, what if that statement is slightly modified to:</div>
<div style="text-align: justify;">
<b><span style="font-family: "courier new" , "courier" , monospace;">9[a] = 1000;</span></b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
If that looks weird and possibly wrong to you, be assured that it is perfectly legal C/C++ code! Moreover, it is identical to the statement: <span style="font-family: "courier new" , "courier" , monospace;"><b>a[9] = 1000.</b></span></div>
<div style="text-align: justify;">
If this is news to you, then you need to read on..</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>The subscript operator</b></u></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The subscript operator works like this:</div>
<div style="text-align: justify;">
The expression <span style="font-family: "courier new" , "courier" , monospace;"><b>E1[E2]</b></span> is equivalent to <span style="font-family: "courier new" , "courier" , monospace;"><b>*(E1+E2)</b></span>; where E1 and E2 are expressions themselves. i.e.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>E1[E2] = *(E1+E2) = *(E2+E1) = E2[E1]</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
(keep in mind that we've not yet discussed operator overloading in C++, so the above explanation involving symmetry of + operator remains valid for basic data types)</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
That explains why:<br />
<b><span style="font-family: "courier new" , "courier" , monospace;">a[9] = *(a+9) = *(9+a) = 9[a]</span></b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
For <span style="font-family: "courier new" , "courier" , monospace;"><b>E1[E2]</b></span> to work, <span style="font-family: "courier new" , "courier" , monospace;"><b>(E1+E2)</b></span> should have an address type so that the <i>dereferencing operator</i> * can be applied to it. That requires one of E1 & E2 to be of pointer type and the other be of integral type.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>Pointer Arithmetic</b></u></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The result of adding an integer 'n' to a pointer is an address that is 'n' <i>objects </i>(and not <i>bytes</i>) away from the original address; <u>but only if the original address and the resulting address are in the same array</u>.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
For the example array declared above, the expression <span style="font-family: "courier new" , "courier" , monospace;"><b>(a+99)</b></span> yields a pointer to the last element of the array: <span style="font-family: "courier new" , "courier" , monospace;"><b>a[99]</b></span>. But it is illegal to evaluate <span style="font-family: "courier new" , "courier" , monospace;"><b>(a+200)</b></span> since the array is not large enough for the resulting address to be valid. Evaluating such an expression leads to <a href="http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html" target="_blank"><i>undefined behaviour</i></a> (demons flying out of your nose and things like that). One subtle exception is that you're allowed to evaluate such expressions if the addresses involved point to <i>one past the last element</i> of the array. i.e. it is OK to do <span style="font-family: "courier new" , "courier" , monospace;"><b>(a+100)</b></span> even though <b><span style="font-family: "courier new" , "courier" , monospace;">a[100]</span></b> is invalid. However, you are not allowed to dereference such an address and that is why evaluating <b><span style="font-family: "courier new" , "courier" , monospace;">a[100]</span></b> is not legal (that involves applying * to the address one past the last element).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Another side effect of the definition of pointer arithmetic is that you can add integer values only to pointers that point to elements in an array. Other expressions will compile fine (since the compiler does not have any mechanism to determine where the pointer is going to point to at runtime) but result in undefined behaviour.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Note that we said <i>objects</i> and not <i>bytes</i> in the definition of pointer addition. Adding an
integer value to an address always advances that address by that many
elements, irrespective of the size of one element. On a 32-bit machine
where <span style="font-family: "courier new" , "courier" , monospace;"><b>int</b></span> is 4 bytes long, adding 10 to an <span style="font-family: "courier new" , "courier" , monospace;"><b>int*</b></span> actually advances it by 40 bytes. Adding the same value to a <span style="font-family: "courier new" , "courier" , monospace;"><b>double*</b></span> will advance it by 80 bytes since a <span style="font-family: "courier new" , "courier" , monospace;"><b>double</b></span> is 64-bits wide. That is why <b><span style="font-family: "courier new" , "courier" , monospace;">a[10]</span></b> which is <span style="font-family: "courier new" , "courier" , monospace;"><b>*(a+10)</b></span> always gets the 10th element in the array, irrespective of the type of elements in the array.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The result of subtracting an integer from a pointer works in a similar way. Both the operand address and the resulting address must be within the same array (or at most one past the last element of an array).</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
Unlike addition, you are allowed to subtract two pointers. This works as long as both are pointers to elements (or one past the last element) in the same array. The result is an integer and is equal to the number of elements between the two addresses.</div>
<div style="text-align: justify;">
i.e. <b><span style="font-family: "courier new" , "courier" , monospace;">(a+50) - (a+10)</span></b> yields 40.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<u><b>Summary</b></u></div>
<div style="text-align: justify;">
</div>
<ul style="text-align: justify;">
<li><span style="font-family: "courier new" , "courier" , monospace;"><b>a[b] = *(a+b) = *(b+a) = b[a]</b></span></li>
<li>You can add or subtract an integer to/from a pointer to get a pointer as result</li>
<li>But you can't add two pointers since that doesn't make sense</li>
<li>But you can subtract two pointers to get an integer result</li>
<li>In all pointer arithmetic, the operand address and the resulting address must point to elements within the same array or at most one past the last element of an array</li>
<li><span style="font-family: "courier new" , "courier" , monospace;"><b>(a+n)</b></span> gets you<i> </i>the address of <span style="font-family: "courier new" , "courier" , monospace;"><b>a[n]</b></span>. i.e. it is equivalent to <span style="font-family: "courier new" , "courier" , monospace;"><b>&a[n]</b></span>.</li>
</ul>
<br />
<br />
<div style="text-align: justify;">
<b><u>Food for thought</u></b></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
What does the following expression mean?</div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><b>5["helloworld"]</b></span></div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">The <i>fun</i> continues in <a href="http://solidsmoke.blogspot.com/2013/10/fun-with-arrays-in-c-c-part2.html" target="_blank">Part-2</a> ;-)</span></div>
<div style="text-align: justify;">
<br /></div>
<div style="font-size: 12pt; text-align: justify;">
</div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com2tag:blogger.com,1999:blog-2888956143852596439.post-84565562097892197202013-10-13T22:47:00.000+05:302013-10-13T22:47:26.136+05:30Raja Rani (Tamil) - Movie Review<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
Raja Rani directed by debutant <a href="http://en.wikipedia.org/wiki/Atlee_(director)" target="_blank">Atlee</a> (I couldn't help wonder, what kind of a name is that?) and produced by <a href="http://en.wikipedia.org/wiki/AR_Murugadoss" target="_blank">AR Murugadoss</a> has <a href="http://en.wikipedia.org/wiki/Arya_(actor)" target="_blank">Arya</a>, <a href="http://en.wikipedia.org/wiki/Nayantara" target="_blank">Nayantara</a>, <a href="http://en.wikipedia.org/wiki/Nazriya_Nazim" target="_blank">Nazriya</a> and <a href="http://en.wikipedia.org/wiki/Jai_(actor)" target="_blank">Jai</a> in lead roles. Veteran actor <a href="http://en.wikipedia.org/wiki/Sathyaraj" target="_blank">Sathyaraj</a> and new-gen comedians <a href="http://en.wikipedia.org/wiki/Sathyan_Sivakumar" target="_blank">Sathyan</a> and <a href="http://en.wikipedia.org/wiki/N._Santhanam" target="_blank">Santhanam</a> also handle major roles in this flick.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPeYD_9W0CJIntiOUuLmrOyKTg6vFsalQJ5WEQGBAgx1S5bSYXpW7etTthMiqUV4p54q8v2uCyobK7PlOQhl41N9lPj1XO4eHTg5rciO7cgIHemChR0R9_ud0ltcRMxUGan-OKe-GWk5w/s1600/Raja-Rani-Arya-Nayanatara-Stills11376802055.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="212" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPeYD_9W0CJIntiOUuLmrOyKTg6vFsalQJ5WEQGBAgx1S5bSYXpW7etTthMiqUV4p54q8v2uCyobK7PlOQhl41N9lPj1XO4eHTg5rciO7cgIHemChR0R9_ud0ltcRMxUGan-OKe-GWk5w/s320/Raja-Rani-Arya-Nayanatara-Stills11376802055.jpg" width="320" /></a></div>
<div style="text-align: justify;">
The movie opens with a christian wedding ceremony - between John (Arya) and Regina (Nayantara). Both bride and groom appear to be least interested in getting married and put on desperate faces. The bride even accidentally calls out the name of her previous lover (apparently, at this time in the movie) - Soorya (Jai). However everything proceeds as usual and the wedding materializes, forcing the duo to live together in one apartment. The movie proceeds to explain why these people got married in the first place and why they're so miserable. The first half has Regina's story (featuring Soorya) and the second half has John's (featuring Keerthana - Nazriya).<br />
<br />
<br />
Before writing further, I'll summarize my review: <b>Raja Rani is a terribly stupid movie. It is torture to sit through 159 minutes, watching Arya and Jai fighting for the title of Worst Actor Ever</b>!<br />
<br />
<br />
<b>Warning: Spoilers ahead....</b><br />
<br />
<br />
It just feels dumb to watch Arya's act whether he's playing drunk or as bitten by the love bug. He just looks like a retard in most parts of the movie and his dialog delivery sucks.<br />
But the award for the most irritating actor of the movie undoubtedly goes to Jai. I cherished the brief moments in the first half when his character would shut up. Having him dead in the first half itself brings some relief though. Its hard to believe he's the same guy from Subramaniapuram.<br />
Nayantara was quite okay. She looks great and has done a decent job with her role. Nazriya, as always, looks cute and bubbly. A bit too <i>cho-chweet</i> line though (reminds me of Genelia). In fact, the female actors are the only bearable thing in this movie.<br />
Sathyaraj's character doesn't need to do much, but he hasn't done bad either.<br />
<br />
Why is Regina, the daughter of a ridiculously rich man (who drives his own Jaguar though) married to an ordinary car salesman? That too by arranged marriage? Couldn't the father find a more suitable groom for his one and only <i>darling</i> daughter? I couldn't understand this point even after finishing the movie!<br />
<br />
The basic plot and story line is all too predictable. Several people have already pointed out the similarity with Maniratnam's <a href="http://en.wikipedia.org/wiki/Mouna_Ragam" target="_blank">Mouna Ragam</a>. Is Raja Rani about eternal love, or is it about how time heals things? Well, I don't know for sure. It seems to be about a little bit of both, though that sounds contradictory.<br />
In Raja Rani, people fall in love very quickly and sing songs and dance around before moving on to the inevitable tragedy that awaits them. And by that I mean death and not marriage. So you lost your one true love.. so what? Your next true love will come along and you can kick-start your life whenever you want. That's the message this movie tries to convey through these terrible actors and stupid scenes.<br />
<br />
<br />
The climax was the worst part. This movie doesn't have a climax scene. It has a climax hour (does that sound like the punch-line for a brand of condoms?). It drags on between Arya & Nayantara without making any connection with the audience. The makers even try to push a twist in to this mess in the last minutes.<br />
<br />
Overall, Raja Rani is a highly overrated movie. It's downright a bad movie that shouldn't have been made.<br />
<br />
<br />
<br />
<br /></div>
<div style="text-align: justify;">
<br /></div>
<div style="font-size: 12pt; text-align: justify;">
</div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com4tag:blogger.com,1999:blog-2888956143852596439.post-70884084201939944582013-10-02T11:05:00.000+05:302013-10-02T11:38:04.805+05:30മൊഴിമുത്ത്<div dir="ltr" style="text-align: left;" trbidi="on">
ഭാര്യേ, ഞാനിന്ന് കുറച്ച് പോര്ക്ക് വാങ്ങി വന്നാലോ? തനിക്ക് വയ്ക്കാനറിയുമോ?<br />
<br />
ഛീ.. ഗ്വാ.. മനുഷ്യാ.. ഇതൊന്നും വീട്ടില് കേറ്റാന് പറ്റില്ല്യാട്ടാ.. പിന്നെ നമ്മള് ഹിന്ദുക്കള് പന്നിയെ തിന്നാന് പാടില്ല..<br />
<br />
അത് മുസ്ലിംകള്ക്കല്ലേ? നമുക്കെന്താ കുഴപ്പം?<br />
<br />
വരാഹം വിഷ്ണുവിന്റെ ഏഴവതാരങ്ങളില് ഒന്നാണെന്നറിയില്ലേ?<br />
<br />
ങ്ഹേ? ഏഴ്.. ഏഴോ?<br />
<br />
ആം.. എട്ടായിരിക്കുമല്ലേ? (വിജയഭാവത്തില്) അഷ്ടാവതാരങ്ങള് എന്നാണല്ലോ! <br />
<br />
അതേയതേ... പഞ്ചപാണ്ഡവര് കട്ടില് കാലു പോലെ... (നിശ്വാസം ഫോളോവ്ഡ് ബൈ അട്ടഹാസം)<br />
<br />
<br /></div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-43618185123154680772013-10-02T10:51:00.000+05:302013-10-02T10:53:08.338+05:30സഞ്ജയന് ഗുരുക്കളേ.. നമഃ<div dir="ltr" style="text-align: left;" trbidi="on">
ഇന്നത്തെ പത്രത്തില് കണ്ട ഒരു പരസ്യം:<br />
<br />
<i><u><b>കാമദേവാകര്ഷണ ഏലസ്സ്</b></u></i><br />
<br />
<div align="justify" style="font-size: 12pt;">
<i>ശത്രുവശ്യം, രാജവശ്യം, പൊതുജനവശ്യം, പിണങ്ങി പിരിഞ്ഞ ഭാര്യാ ഭര്ത്താക്കന്മാര്, കാമുകീ കാമുകന്മാര്, പ്രിയസുഹൃത്തുക്കള്, ബന്ധുമിത്രാദികള് എന്നിവര് തിരിച്ചു വരുന്നതിനും, എന്നെന്നും പരസ്പരാകര്ഷണത്തോടെ കഴിയുവാനും ആരെയും മയക്കുന്ന അനംഗമന്ത്രം ചേര്ത്ത് തയ്യാര് ചെയ്യുന്ന അതിശക്തിയേറിയ കാമദേവാകര്ഷണ ഏലസ്സ്. വശീകരിക്കുന്നതിനു വേണ്ടി അത്ഭുതകരമായ രീതിയില് പ്രവര്ത്തിക്കാന് മാന്ത്രിക തകിടില് അംഗരാഗ കുങ്കുമവും സിദ്ധൗഷധവും ചേര്ത്ത് തയ്യാര് ചെയ്യുന്നു. ആനന്ദമകരന്ദം ആയുസ്സ് മുഴുവന്. ഈ വശീകരണ ഏലസ്സ് വേണ്ടവര് താഴെക്കാണുന്ന അഡ്രസ്സില് എഴുതുക/ഫോണ് ചെയ്യുക. xxxxxxxxxxxxxxx പാലക്കാട്-12 ph. 0491-xxxxxxx, xxxxxx.</i></div>
<br />
<div align="justify" style="font-size: 12pt;">
</div>
<div align="justify" style="font-size: 12pt;">
<i>NB. അനുകരണം അഭിനന്ദനമാണ് പക്ഷേ അത് കച്ചവട വിഷയങ്ങളില് മാത്രമാണ് ആദ്ധ്യാത്മിക രംഗത്ത് അനുകരണം കബളിപ്പിക്കലാണ്. അനുകരണങ്ങളെ സൂക്ഷിക്കുക. അവഗണിക്കുക. കാമദേവാകര്ഷണ ഏലസ്സ് ഈ പൂജാമഠത്തിലല്ലാതെ ലോകത്ത് മറ്റൊരിടത്തും തയ്യാര് ചെയ്യുന്നില്ല.</i></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div style="font-size: 12pt; text-align: center;">
---------------</div>
<div style="font-size: 12pt; text-align: justify;">
</div>
<div style="font-size: 12pt; text-align: justify;">
രുദ്രാക്ഷ മാഹാത്മ്യം പാഠപുസ്തകത്തില് ഉള്പ്പെടുത്തിയിട്ടൊന്നും ഒരു കാര്യവുമില്ല! തേക്കും, മാഞ്ചിയവും, ആടും, മണി ട്രീയും കഴിഞ്ഞ് ഇപ്പോള് ഏലസ്സും, പെന്ഡന്റും, കുബേരനും, റൈസ് പുള്ളറും, നാഗമാണിക്യവും, അമ്പും വില്ലും, മലപ്പുറം കത്തിയും.. വാഴ്വേ മായം!</div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-47359915309317891372013-03-23T08:10:00.000+05:302013-03-23T08:11:14.591+05:30Wikipedia thanked me!<div align="justify" style="font-size: 12pt">
Well, they really did! I donated a meagre Rs.500 to their fund-raiser :-)
<p>
It was in 2009 that I last noticed their request for donations. That time you had to see Jimmy Wale's face on top of every Wikipedia article. I had <a href="http://solidsmoke.blogspot.in/2009/12/thank-you-wikipedia.html">donated $10</a> then.
This time, there's no photo, just a yellow banner on top of the article pages.
<p> One interesting thing was that the donation amounts were specified in INR rather than USD. I really liked that and perhaps that gave the extra push for clicking the donate button.
<p>
<a href="http://wikimediafoundation.org/wiki/Support_Wikipedia/en" imageanchor="1" ><img border="0" src="http://wikimediafoundation.org/w/extensions/skins/Donate/images/banners/Banner_468x60_0000_A.jpg" /></a>
</div>Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-80985376014799043742012-10-02T15:56:00.000+05:302013-01-28T21:28:33.333+05:30പേര്<div dir="ltr" style="text-align: left;" trbidi="on" lang="ml">
<div align="justify">
<span style="font-family: inherit;"><span style="font-size: large;">ഒരു <a href="http://solidsmoke.blogspot.in/2012/05/blog-post.html" target="_blank">പേരിലെന്തിരിക്കുന്നു</a> എന്ന് പലരും ചോദിക്കറുണ്ടല്ലോ.. പക്ഷേ ചില കുട്ടികളുടെ പേരുകള് കേട്ടാല് ഇത്രയും വേണമായിരുന്നോ എന്ന് തോന്നിപ്പോകും. ഈയടുത്ത് ഒരാള് 'മൃത്യു' എന്ന് പേരുള്ള ഒരു കുട്ടിയെ പരിചയപ്പെട്ടു എന്ന് പറഞ്ഞുകേട്ടു.</span></span></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-family: inherit;"><span style="font-size: large;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXJCjrK1R4-hpUgz8jYrSyZtVRe8wiEXQIXZQoV0RS7LXYfqDdK3YjxXjG9zQ-Hd0U5VNfUPOlAb0FPzPqpfZ_dQvoJUFZjHUKstz7fO2H2T0l-fWM6wepCzdDWQbUz07DcalOZnTDQn4/s1600/boy_girl.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXJCjrK1R4-hpUgz8jYrSyZtVRe8wiEXQIXZQoV0RS7LXYfqDdK3YjxXjG9zQ-Hd0U5VNfUPOlAb0FPzPqpfZ_dQvoJUFZjHUKstz7fO2H2T0l-fWM6wepCzdDWQbUz07DcalOZnTDQn4/s200/boy_girl.png" width="163" /></a></span></span></div>
<div align="justify">
<span style="font-family: inherit;"><span style="font-size: large;">ഏതാണ്ട് ഒരു കൊല്ലം മുമ്പ് ഞാനും ഭാര്യയും ഞങ്ങള്ക്ക് ജനിക്കാനിരിക്കുന്ന കുഞ്ഞിന്റെ പേര് തപ്പിനടക്കുകയായിരുന്നു. സ്കാനിങ്ങ് ചെയ്തപ്പോഴൊന്നും കുട്ടി ആണാണോ പെണ്ണാണോ എന്നൊന്നും ഞങ്ങള് അന്വേഷിച്ചില്ല. പക്ഷേ യാതൊരു അടിസ്ഥാനവുമില്ലാത്ത ഏതോ തോന്നല് കാരണം കുട്ടി പെണ്ണ് തന്നെ എന്ന് ഞങ്ങള് ഉറപ്പിച്ചു.</span></span></div>
<div align="justify">
<span style="font-family: inherit;"><span style="font-size: large;">എന്റെ പേരന്വേഷണത്തിലുള്ള ചൂടില്ലായ്മയെ പഴിച്ച് പ്രിയതമ കൊണ്ടുപിടിച്ച അന്വേഷണം തുടങ്ങി. അദ്ദേഹത്തിന് ഒരുപാട് നിബന്ധനകള് ഉണ്ടായിരുന്നു. ആരും കേട്ടിട്ടുള്ള പേരായിരിക്കരുത്, S, U, Vമുതലായ അക്ഷരമാലയില് അവസാനത്തില് വരുന്ന അക്ഷരങ്ങളില് തുടങ്ങരുത് മുതലായ കഠിനമായ നിബന്ധനകള്. അങ്ങനെ ഇടയ്ക്കിടയ്ക്ക് ഇദ്ദേഹം ഓരോ പേരുകള് കണ്ടുപിടിച്ച് കൊണ്ടുവരും. ഒട്ടുമിക്ക പേരുകളും ഞാന് വീറ്റോ ചെയ്തുകളയും. ഇത് വായിക്കുമ്പോള് നിങ്ങള്ക്ക് ഒരു പക്ഷേ ഞാന് ചെയ്തത് ശരിയായില്ല എന്ന് തോന്നുന്നുവെങ്കില് എന്റെ ഭാര്യ കണ്ടുപിടിച്ച പേരുകള് ഒന്ന് വായിച്ചു നോക്കൂ:</span></span></div>
<div align="justify">
<span style="font-family: inherit;"><span style="font-size: large;"><br /></span></span></div>
<div align="justify">
<ol>
<li><span style="font-family: inherit;"><span style="font-size: large;">മാനസ</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ചിന്മയി </span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ഹൈമവതി</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">സവ്യദക്ഷിണ</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">മൈത്രേയി</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">വൈശാഖ</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ചാരുത</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">സ്മരണിക</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ഹാസിനി</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">പാവനി</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">വിപ്രപ്രിയ</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ശുഭകാംഷി</span></span></li>
<li><span style="font-family: inherit;"><span style="font-size: large;">ദിവംഗത</span></span></li>
</ol>
<span style="font-family: inherit;"><span style="font-size: large;">എങ്ങനെയുണ്ട്? ഈ വക പേരെങ്ങാനും ഇട്ടിരുന്നെങ്കില് കുട്ടി വലുതാകുമ്പോള് എന്നെ കുനിച്ച് നിര്ത്തി ഇടിച്ചേനെ! </span></span><br />
<span style="font-family: inherit;"><span style="font-size: large;"><br /></span></span>
<span style="font-family: inherit;"><span style="font-size: large;">ശുഭകാംഷി പോലും.. കേള്ക്കുമ്പോള് സിനിമകളിലെ സീനുകള് ഓര്മ്മ വരുന്നു:</span></span><br />
<blockquote class="tr_bq">
<span style="font-family: inherit;"><span style="font-size: large;"><i>ഹലോ പോലീസ് സ്റ്റേഷന്? ഇന്നത്തെ മദ്രാസ് മെയിലില് ബോംബ് വച്ചിട്ടുണ്ട്<br />ഹേ? നിങ്ങളാരാ?<br />ഒരു അഭ്യുദയകാംഷി!</i></span></span></blockquote>
<span style="font-family: inherit;"><span style="font-size: large;">ഇതില് അവസാനം പറഞ്ഞ പേര് - ദിവംഗത കേട്ടപ്പോള് ഞാന് ഉരുണ്ട് കിടന്ന് ചിരിച്ചു. എന്തോ പന്തികേട് തോന്നിയ ഭാര്യ ഉടനേ: <i>"ഞാന് ഉദ്ദേശിച്ചത് ദിവ്യംഗത എന്നാ.. അതായത് ദിവ്യങ്ങളായ അംഗങ്ങളുള്ളവള് എന്ന്".</i> ചിരിച്ച് ചിരിച്ച് കണ്ണ് മപ്പിയ അവസ്ഥയിലായിരുന്നതിനാല് ഞാന് പ്രതികരിച്ചില്ല.</span></span><br />
<span style="font-family: inherit;"><span style="font-size: large;"><br /></span></span>
<span style="font-family: inherit;"><span style="font-size: large;">ഇനി എങ്ങാനും ആണ്കുട്ടിയായാലോ എന്ന് വിചാരിച്ച് ഒരു പേരും കൂടി മഹതി കണ്ടുപിടിച്ചു: ദേവവ്രതന്. കേട്ടപ്പോള് ഞാന് കല്ലെടുത്തെറിഞ്ഞില്ലെന്നേ ഉള്ളൂ..</span></span><br />
<span style="font-family: inherit;"><span style="font-size: large;"><br /></span></span>
<span style="font-family: inherit;"><span style="font-size: large;">ഒടുവില് ആ സുദിനം വന്നെത്തി. സുന്ദരനായ ഒരു ആണ് കുഞ്ഞ്! മലപ്പുറം കത്തിയും അമ്പും വില്ലുമെല്ലാം വെറുതെയായി! "ബേബി ഓഫ്..." വച്ച് അഡ്ജസ്റ്റ് ചെയ്തു!</span></span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><span style="font-size: large;"><span style="font-size: small;"><i>വാല്: ഭാര്യ ഇത് വായിക്കുന്ന ദിവസം തല്ല് ഉറപ്പാ..</i></span> </span></span><br />
<span style="font-family: inherit;"><span style="font-size: large;"><br /></span></span></div>
</div>
Syamhttp://www.blogger.com/profile/05218298295445175825noreply@blogger.com8tag:blogger.com,1999:blog-2888956143852596439.post-47793379301113128182012-08-05T15:04:00.003+05:302013-12-03T19:18:49.279+05:30Unlikely lullabies<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-size: 12pt; text-align: justify;">
</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
I have no problems in admitting that I'm a terrible singer. I do like music and have my fair share of favourite tracks. But when it comes to putting my musical cords to work, you better be somewhere else.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
However, having a 10-month old son has forced me to exercise my singing skills. When the baby needs to sleep and his mother is not around, or when she's not up to the job :-) I have to pitch in. I don't know any of the standard lullaby songs, so as any engineer would do, I make use of what I have.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
The following tracks are perhaps the last ones to pass for as lullabies, but nevertheless, these are my, or rather <i>our</i> lullabies:</div>
<ul style="text-align: justify;">
<li><a href="http://www.youtube.com/watch?v=qGFKqyliDVE" target="_blank">Koi jab tumhara hriday tod de</a> <span style="font-size: x-small;">(Mohammed Rafi, Purab aur Paschim, 1970)</span></li>
<li><a href="http://www.youtube.com/watch?v=81v-RHKZbiw" target="_blank">Mera jeevan kora kagaz</a><span style="font-size: x-small;"> (Kishore Kumar, Kora Kagaz, 1974)</span></li>
</ul>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Apart from these two, I try my hand at <a href="http://www.youtube.com/watch?v=42Xd4wqGuuU" target="_blank">Etho varmukilin</a> (G Venugopal, Pookkalam Varavai, 1991), the only track that would qualify for the purpose.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Anyway, in case you are wondering if these songs work, then my answer is yes! At least I try to think so. More than the musical content (or the lack of it), my guess is that he stays calm because he doesn't feel lonely.</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
My wife says its a good thing that my baby can't talk yet and I can pass for as a singer till he does :-)</div>
<div style="text-align: justify;">
</div>
<div style="text-align: justify;">
Whatever works, right?<br />
<br />
<b>Update:</b> I'm happy to report that I've had great success with <a href="http://www.youtube.com/watch?v=kNLQhhcfL4g" target="_blank"> Ayiram Kannumai</a> (Yesudas, Nokketha Doorathu Kannum Nattu, 1985). He's 2 years old now and still loves it!</div>
</div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2888956143852596439.post-43924280579196891712012-07-22T14:49:00.000+05:302012-07-22T14:49:03.130+05:30rpmbundle - Copy RPMs for offline installation<div align="justify" style="font-size: 12pt;">
Installing Fedora (and most other <i>free</i> distros) on computers without a fast (and economical) Internet connection is a bit painful since most of the popular multimedia <a href="http://fedoraproject.org/wiki/FAQ#Why_doesn.27t_Fedora_include_support_for_proprietary_formats_like_MP3_or_MPEG.3F" target="_blank">file formats aren't supported out of the box</a>. Being a <i>free</i> distribution, Fedora only supports and includes free and open source software.</div>
<br /><div align="justify" style="font-size: 12pt;">
Support for all the other patent encumbered formats are available from <a href="http://rpmfusion.org/" target="_blank">RPMFusion</a> repository. However, you'll need a fast (and reasonably cheap) Internet connection to download several megabytes worth of RPM files from these repositories.</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
I present here the steps and a small utility program for copying RPM files from a PC with Internet connection for offline installation at other computers. This can be used to update existing installations or to install new software on stand-alone PCs.</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<h3>
<b>Step 1 - Download RPMs</b></h3>
</div>
<div align="justify" style="font-size: 12pt;">
The simplest way to harvest RPMs is to enable YUM's cache on the source machine. This way, everything YUM fetches on the machine will be available in one place from where we can copy the required ones.</div>
<div align="justify" style="font-size: 12pt;">
</div>
<div align="justify" style="font-size: 12pt;">
To enable yum cache, edit /etc/yum.conf and set <i>keepcache=1</i> and <i>cachedir</i> to a directory of your choice (for example, <i>cachedir=/mnt/disk/yumcache</i>). Keep in mind that you might be downloading quite a lot of RPMs when you update your computer and install new software and so the cache location must have sufficient free space. Don't forget to manually create the cache directory (/mnt/disk/yumcache).</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
From now on, every time you install/update a package using YUM, the corresponding RPM file will be available in the cache directory.</div>
<div align="justify" style="font-size: 12pt;">
For example, when you do something like:</div>
<blockquote class="tr_bq">
<div align="justify" style="font-size: 12pt;">
<span style="font-family: "Courier New",Courier,monospace;">yum install vlc</span></div>
</blockquote>
<div style="text-align: justify;">
all RPM files downloaded by YUM (including the VLC package and any other dependency/update packages) will be cached.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Step 2 - Copy RPM files for bundling</h3>
<div style="text-align: justify;">
When you're ready to copy out files, follow these steps:</div>
<blockquote class="tr_bq">
<span style="font-size: small;"><span style="font-family: "Courier New",Courier,monospace;">mkdir ~/rpms</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">cd /mnt/disk/yumcache</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">find -iname *.rpm -exec cp -arvu {} ~/rpms \;</span></span></blockquote>
<div style="text-align: justify;">
The above commands would copy all RPM files in the cache directory to 'rpms'. The arguments to cp are selected to avoid unnecessarily overwriting existing files in the destination directory.</div>
<div style="text-align: justify;">
<br /></div>
<h3 style="text-align: justify;">
Step 3 - Removing old versions</h3>
<div style="text-align: justify;">
One problem with using yum's cache is that it tends to bloat over time. After a while, the cache will contain multiple old versions of the same package files. Although yum should gracefully handle these multiple versions and select the newest version during installation, copying all these files will only serve to increase the size of the offline install bundle. Further, I recently noticed a (probably x86_64 specific) <a href="https://bugzilla.redhat.com/show_bug.cgi?id=816636" target="_blank">bug</a> that causes problems when you try to install multiple version RPM files of the same package.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
So, I cooked up an extremely naive <a href="https://github.com/syamcr/rpmbundle" target="_blank">Python script</a> that scans the list of RPMs and deletes the old versions. It will tell you which files are to be kept and which ones are to be deleted and if the user wishes, it will delete the redundant ones too.</div>
<div style="text-align: justify;">
Here's how to use it:</div>
<blockquote class="tr_bq">
<div style="text-align: justify;">
<span style="font-family: "Courier New",Courier,monospace;">cd ~/rpms</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">./rpmbundly.py</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Files to keep:</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> anjuta-3.4.3-1.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> apg-2.3.0b-16.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> apper-0.7.2-2.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> argyllcms-1.4.0-2.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> .....</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">Files to remove:</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> apper-0.7.1-5.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> apper-0.7.2-1.fc17.x86_64.rpm</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;"> ...</span><br style="font-family: "Courier New",Courier,monospace;" /><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">confirm delete[y/n]:</span></div>
</blockquote>
<div style="text-align: justify;">
As you can see from the above example, two old versions of the package apper have been marked for deletion. If the user chooses 'y' for the confirmation, these files will be deleted from the current directory.</div>
<div style="text-align: justify;">
<br /></div>
<div style="text-align: justify;">
You can download the <a href="https://github.com/syamcr/rpmbundle/blob/master/rpmbundle.py" target="_blank">script file</a> from github, or even clone the repository by doing:</div>
<blockquote class="tr_bq">
<div style="text-align: justify;">
<span style="font-family: "Courier New",Courier,monospace;">git clone git://github.com/syamcr/rpmbundle.git</span></div>
</blockquote>
<br />
<h3>
Step 4 - Copy the RPMs & install on target machine</h3>
<div style="text-align: justify;">
You need to manually copy the RPM files to the target computer. Note that the distro version and architecture (i686, x86_64 etc.) of both machines must match. You can't use a 32-bit machine to download the RPMs and then try to install them on a 64-bit machine. Nor can you install the RPMs for Fedora 17 on a Fedora 16 installation. Technically, it is possible to download the RPMs matching the target machine on any other machine. But the steps involved are lot more complicated than those described here.</div>
<br />
<div style="text-align: justify;">
Once you've copied the RPMs to the target machine, you can install them with yum:</div>
<blockquote class="tr_bq">
<span style="font-family: "Courier New",Courier,monospace;">cd ~/rpms</span><br style="font-family: "Courier New",Courier,monospace;" /><span style="font-family: "Courier New",Courier,monospace;">yum install *.rpm</span></blockquote>
Now just sit back and enjoy as yum does all the heavy lifting involved in the installation/updates.<br />
<br />
<div style="text-align: center;">
------------------------------------------------ </div>
<br />
<br />
<div style="text-align: justify;">
<i>PS: I'm a pathetic noob when it comes to Python programming. This is my first serious Python program and my first upload to github. So feel free to offer advice and suggestions.</i></div>
<div style="text-align: justify;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-2888956143852596439.post-23432804790024495642012-07-14T19:29:00.003+05:302022-05-01T20:04:19.042+05:30A caveat on using %u with scanf for reading positive integers<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify" style="font-size: 12pt;">
</div>
<br />
<span style="font-size: large;"></span><br />
<span style="font-size: large;"><i>Do you use scanf() class of functions</i>?</span><i><span style="font-size: large;"> Do you use the %u conversion specifier to read positive integer values? Do you use the return value of scanf() as a confirmation of successful operation? If you do, then read on..</span></i><br />
<i><br /></i>
<u><span style="font-size: large;"><b>The task</b></span></u><br />
<br />
Parse a string (e.g. "42") (or a field within a string) to read a positive decimal integer value and validate it by confirming that the string indeed is a positive integer (and not things like "abcd", "-42"). Use the <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" target="_blank">C programming language</a>.<br />
<br />
<br />
<span style="font-size: large;"><u><b>The sscanf method</b></u></span><br />
<br />
The scanf class of functions (scanf/sscanf/fscanf) supports several <i>conversions</i> for reading different types of values - integers, floats, strings etc. The conversions to be done on the input are specified by means of a <i>format string</i> argument. A conversion specification typically consists of the '%' character followed by a character specifying the conversion to be performed. For example, "%d" is for reading 'int' values, "%u" for 'unsigned int' objects, "%s" for strings and so on.<br />
The return value of these functions is the number of of input items successfully matched and assigned.<br />
<br />
So the most straight forward solution is to use scanf() with %u conversion to read an 'unsigned int' and check its return value to confirm the operation was successful:<br />
<br />
<u>Listing-1:</u><br />
<blockquote class="tr_bq">
<div style="font-family: "Courier New", Courier, monospace;">
char str[] = "42";</div>
<div style="font-family: "Courier New", Courier, monospace;">
int ret;</div>
<div style="font-family: "Courier New", Courier, monospace;">
unsigned int val;</div>
<div style="font-family: "Courier New", Courier, monospace;">
</div>
<div style="font-family: "Courier New", Courier, monospace;">
ret = sscanf(str, "%u", &val);</div>
<div style="font-family: "Courier New", Courier, monospace;">
if(ret == 1)</div>
<div style="font-family: "Courier New", Courier, monospace;">
printf("success: %u\n", val);</div>
<div style="font-family: "Courier New", Courier, monospace;">
else</div>
<span style="font-family: "Courier New",Courier,monospace;"> printf("failed\n");</span></blockquote>
As such, the above code prints "success: 42" and seems to work fine. It also prints "failed" for non-numeric inputs. <br />
<br />
Can you spot any problems with listing-1? For the time being, we can ignore the fact that it converts only the initial part of the string and will stop at the first invalid character. i.e. for inputs such as "42abcd" and "42.5", sscanf() will return 1 (indicating a successful conversion) and the converted value will be 42. This is a common nuisance when processing the last field of a string.<br />
<br />
So, problem solved? Not quite!<br />
<br />
<br />
<span style="font-size: large;"><u><b>The caveat</b></u></span><br />
<br />
<br />
Testing the code in listing-1 with a negative integer as input produces a surprising (at least for me) result:<br />
<br />
<u>Listing-2:</u><br />
<blockquote class="tr_bq">
<div style="font-family: "Courier New", Courier, monospace;">
char str[] = "-5";</div>
<div style="font-family: "Courier New", Courier, monospace;">
int ret;</div>
<div style="font-family: "Courier New", Courier, monospace;">
unsigned int val;</div>
<div style="font-family: "Courier New", Courier, monospace;">
</div>
<div style="font-family: "Courier New", Courier, monospace;">
ret = sscanf(str, "%u", &val);</div>
<div style="font-family: "Courier New", Courier, monospace;">
if(ret == 1)</div>
<div style="font-family: "Courier New", Courier, monospace;">
printf("success: %u\n", val);</div>
<div style="font-family: "Courier New", Courier, monospace;">
else</div>
<span style="font-family: "Courier New",Courier,monospace;"> printf("failed\n");</span></blockquote>
The output of listing-2 (with gcc v4.7 on glibc/Linux) is:<br />
"success: 4294967291".<br />
i.e. even though the input is negative, sscanf returns 1 indicating that it made a successful 'unsigned int' conversion.<br />
<br />
Is this really valid behaviour, or a compiler bug??<br />
<br />
Unfortunately, the behaviour is perfectly valid; says the <a href="http://www.open-std.org/JTC1/SC22/WG14/www/standards" target="_blank">ISO C language standard</a>. Here's what the standard (c99) says about the 'u' conversion for fscanf() (the emphasis is mine):<br />
<br />
<blockquote class="tr_bq">
"Matches an <b>optionally signed</b> decimal integer, whose format is the same as expected for the subject sequence of the <b>strtoul</b> function with the value 10 for the base argument. The corresponding argument shall be a pointer to unsigned integer."</blockquote>
Okay. So the input can be <i>optionally</i> signed and the rules of the conversion is essentially same as those for strtoul(), another C library function. To understand further, we must necessarily refer to the documentation of strtoul(). And so it goes:<br />
<blockquote>
If the subject sequence begins with a minus sign, the value resulting from the conversion is negated (in the return type).</blockquote>
There you have it. The behaviour of %u with scanf is identical to that of strtoul(). And strtoul() considers a negative number as a valid input. For such values, the function returns the negative number in its unsigned form (i.e. 2's complement for most platforms).<br />
<br />
Because of this, when using scanf(), there's no direct way to know if the input really was positive.<br />
<br />
<br />
<u><span style="font-size: large;"><b>The solution</b></span></u><br />
<br />
If the acceptable range of inputs is representable by a signed int, then you can use %d instead of %u and use a plain 'int' object to hold the value. You must check the return value of scanf() and then check the value of the converted integer to be within the required limits (i.e. greater than zero and less than some upper limit).<br />
<br />
However, if you need to read huge numbers that can be represented only by the unsigned int type, then you must use some other indirect method. One way would be to use %s to read the field as a string first, and then check if the first character is not a '-' sign. Once that is clear, use strtoul() to perform the conversion. One additional benefit of this method is that strtoul() will tell you if there were any additional invalid characters in the input - use the second argument to get a pointer to the first invalid character, which should be the terminating null character if the whole string was successfully converted. With this scheme, invalid inputs such as "42abcd" and "42.5" can be successfully caught.<br />
<br />
<br />
<span style="font-size: large;"><u><b>Conclusion</b></u></span><br />
<b> </b><br />
<br />
<div style="color: red;">
<b>Avoid using %u with scanf() class of functions. In most practical cases, the range of acceptable values will be sufficiently small to fit in a signed integer. So use %d to read a plain 'int' and then check if the value is negative.</b></div>
<b><br /></b>
<u>The 'u' conversion is useful <i>only</i> if you really want to read in huge positive numbers</u> that are not representable by a signed int.<br />
<br />
<br />
So, check your code to see if you have any instances where %u is used to read positive integers and the return value of scanf() is used as a confirmation of valid input.<br />
<br /></div>
Unknownnoreply@blogger.com3tag:blogger.com,1999:blog-2888956143852596439.post-40806239239221851122012-07-06T19:29:00.002+05:302012-07-14T16:46:32.559+05:30Mocking my intelligence - 1<div align="justify" style="font-size: 12pt;">
</div>
I got this SMS a couple of days back and almost literally LOL'd<br />
<br />
<br />
<div style="color: #674ea7;">
Choose any one soap</div>
<div style="color: #674ea7;">
PEARS</div>
<div style="color: #674ea7;">
LUX</div>
<div style="color: #674ea7;">
DOVE</div>
<div style="color: #674ea7;">
DETTOL</div>
<div style="color: #674ea7;">
HAMAM</div>
<div style="color: #674ea7;">
& Know wats ur lover think</div>
<div style="color: #674ea7;">
about you on ur first meeting!! SMS SP <ur option=""></ur></div>
<div style="color: #674ea7;">
to ???????? at Rs.3/MT</div>
<br />
I wonder how many poor souls actually fall for these things!Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-2888956143852596439.post-72459685142588618792012-07-06T12:19:00.002+05:302012-07-06T19:08:26.304+05:30ഇരവില് വിരിയും പൂ പോലെ?<div style="font-size: 12pt; text-align: justify;">
</div>
<div style="text-align: justify;">
<span style="font-size: large;">ശ്യാമപ്രസാദിന്റെ ഏറ്റവും പുതിയ സിനിമയായ "<a href="http://en.wikipedia.org/wiki/Arike" target="_blank">അരികെ - so close</a>" -ലെ '<a href="http://malayalasangeetham.info/s.php?193670" target="_blank">ഇരവില് വിരിയും പൂ പോലെ</a>' എന്ന ഗാനം റേഡിയോവില് കേല്ക്കാന് ഇടയായി. പാട്ടു കേട്ടപ്പോള് എവിടെയോ കേട്ടുമറന്ന മാതിരി. ഒടുവില് തപ്പി കണ്ടുപിടിച്ചു.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഔസേപ്പച്ചന് ഈണം നല്കി, മംത മോഹന്ദാസ് ആലപിച്ച ഈ ഗാനത്തിന് <a href="http://en.wikipedia.org/wiki/Aamir_%28film%29" target="_blank">ആമിര്</a> (2008) എന്ന ഹിന്ദി ചിത്രത്തിലെ 'ഏക് ലോ ഇസ് തരഹ്' (ആലാപനം <a href="http://en.wikipedia.org/wiki/Shilpa_Rao" target="_blank">ശില്പ റാവു</a>, സംഗീതം അമിത് ത്രിവേദി) എന്ന ഗാനവുമായി അനിഷേദ്ധ്യമായ സാമ്യമുണ്ട്.</span></div>
<div style="text-align: justify;">
<span style="font-size: large;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-size: large;">ഈ രണ്ട് ഗാനങ്ങളും ഒന്ന് കേട്ടു നോക്കൂ..</span><br />
</div>
<div style="text-align: justify;">
<a href="http://www.youtube.com/v/bYFyR9kerFA" target="_blank"><span style="font-size: large;"><b>ആമിര് - ഏക് ലോ ഇസ് തരഹ്:</b> </span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/bYFyR9kerFA?feature=player_embedded' frameborder='0'></iframe></span></div>
<div style="text-align: justify;">
<br />
<a href="http://www.youtube.com/v/9wu8j6k3zxM" target="_blank"><span style="font-size: large;"><b>അരികെ - ഇരവില് വിരിയും പൂ പോലെ:</b> </span></a></div>
<div class="separator" style="clear: both; text-align: center;">
<span style="font-size: large;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/9wu8j6k3zxM?feature=player_embedded' frameborder='0'></iframe></span></div>
<div style="text-align: justify;">
<br />
<span style="font-size: large;">എന്ത് തോന്നുന്നു?</span></div>
<div style="text-align: justify;">
</div>Unknownnoreply@blogger.com4tag:blogger.com,1999:blog-2888956143852596439.post-48963997450175296302012-07-06T11:13:00.002+05:302012-07-06T11:13:55.406+05:30മേല്വിലാസം - Movie Review<div align="justify" style="font-size: 12pt;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrqKFNM4ae0Y77vTjjeMuK7QrPj5uBNtzLcyEFMFEcTHmcC733E8-4VDUXldIudD4hcnGPCMPpnTMiOcnNCq7rwaDRKOYScW-RRvFObY92tFkF2zKMxqBcSXf7JhOAIxAbSxnHQoJkXp0/s1600/Melvilasom_4.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrqKFNM4ae0Y77vTjjeMuK7QrPj5uBNtzLcyEFMFEcTHmcC733E8-4VDUXldIudD4hcnGPCMPpnTMiOcnNCq7rwaDRKOYScW-RRvFObY92tFkF2zKMxqBcSXf7JhOAIxAbSxnHQoJkXp0/s1600/Melvilasom_4.jpg" /></a></div>
<br />
<a href="http://www.sooryaindia.com/" target="_blank">സൂര്യ</a> <a href="http://en.wikipedia.org/wiki/Soorya_Krishnamoorthy" target="_blank">കൃഷ്ണമൂര്ത്തിയുടെ</a> തിരക്കഥ അടിസ്ഥാനമാക്കി മാധവ് രാമദാസന് സംവിധാനം ചെയ്ത ഈ സിനിമ ഇറങ്ങിയിട്ട് കുറേ കാലമായെങ്കിലും, പലര്ക്കും ഇങ്ങനൊരു സിനിമ ഉണ്ടെന്ന് പോലും അറിയില്ലെന്ന് തോന്നുന്നു. അതുകൊണ്ട് വൈകിയാണെങ്കിലും എന്റെ വക ദാ ഇവിടെ..</div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
ഒരു പട്ടാള ഓഫീസറെ വെടിവച്ചു കൊല്ലുകയും മറ്റൊരു ഓഫീസറെ കൊല്ലാന് ശ്രമിക്കുകയും ചെയ്ത കുറ്റത്തിന് ഒരു സാദാ ജവാനെ (ജവാന് അല്ല, <a href="http://en.wikipedia.org/wiki/Sawar" target="_blank">സവാര്</a> ആണത്രേ) പട്ടാളക്കോടതി വിചാരണ (<a href="http://en.wikipedia.org/wiki/Court-martial" target="_blank">court-martial</a>) ചെയ്യുന്നതാണ് കഥ. സിനിമ മുഴുവനും ഈ ഒറ്റമുറിയില് നടക്കുന്ന സംഭവങ്ങളാണ്.</div>
<div align="justify" style="font-size: 12pt;">
പ്രതിയായ സവാര് രാമചന്ദ്രന് (<a href="http://en.wikipedia.org/wiki/Parthiban" target="_blank">പാര്ത്ഥിപന്</a>) കുറ്റസമ്മതം നടത്തുന്നുവെങ്കിലും അയാള്ക്കായി നിയോഗിക്കപ്പെട്ടിട്ടുള്ള defense counsel ക്യാപ്റ്റന് വികാസ് റായ് (<a href="http://en.wikipedia.org/wiki/Suresh_Gopi" target="_blank">സുരേഷ് ഗോപി</a>) കോടതിയില് അയാളുടെ മൗനത്തിനു പിന്നിലെ സത്യം തേടുന്നു. ഒരു <i>open and shut case</i> എന്ന് എഴുതിത്തള്ളിയേക്കാവുന്ന സംഭവം അങ്ങനെ കൂടുതല് സങ്കീര്ണ്ണമാകുന്നു. വിചാരണക്കോടതിയുടെ കര്ക്കശക്കാരനായ പ്രിസൈഡിങ്ങ് ഓഫീസറായ കേണല് സൂരത് സിങ്ങ് എന്ന കഥാപാത്രത്തെ അവതരിപ്പിക്കുന്നത് തമിഴ് നടനായ <a href="http://en.wikipedia.org/wiki/Thalaivasal_Vijay" target="_blank">തലൈവാസല് വിജയ്</a>. അശോകന്, കൃഷ്ണകുമാര്, <a href="http://en.wikipedia.org/wiki/Nizhalgal_Ravi" target="_blank">നിഴല്ഗള് രവി</a> എന്നിവര് മറ്റു കഥാപാത്രങ്ങളെ അവതരിപ്പിക്കുന്നു.<br />
<br />
<br />
സൂര്യ കൃഷ്ണമൂര്ത്തിയുടെ തന്നെ ഇതേ പേരിലുള്ള ഒരു നാടകമാണ് തിരക്കഥയ്ക്കാധാരം. സ്വദേശ് ദീപകു് എഴുതിയ 'കോര്ട്ട് മാര്ഷല്' (1991) എന്ന ഹിന്ദി നാടകമാണ് 'മേല്വിലാസം' എന്ന നാടകത്തിനാധാരം. (ചിത്രത്തിന്റെ ഓപ്പണിങ്ങ് ക്രെഡിറ്റ്സില് 'the source of inspiration to write the script is a Hindi <i>story</i> by Prof. Swadesh Deepak' എന്നാണ് സൂര്യ കൃഷ്ണമൂര്ത്തി എഴുതിയിരിക്കുന്നത്. വരികള്ക്കിടയിലൂടെ വായിക്കണോ ആവോ..).<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aGWjZSkGOhEdNaoOEybG9b7FiXmGghaLyeFusm8QsBL5SxGFVYtJvCqiYpASTCa3T85M3C1ai68Qw_8oGIsxd2HmyxmAh4fsc0yND0hgQd-PLptAWFL-aFQmnzKsn-eH_DrxVU8GyMc/s1600/sureshgopi.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9aGWjZSkGOhEdNaoOEybG9b7FiXmGghaLyeFusm8QsBL5SxGFVYtJvCqiYpASTCa3T85M3C1ai68Qw_8oGIsxd2HmyxmAh4fsc0yND0hgQd-PLptAWFL-aFQmnzKsn-eH_DrxVU8GyMc/s200/sureshgopi.jpg" width="175" /></a></div>
എന്തായാലും സിനിമയുടെ സംഭാഷണങ്ങള് വളരെ നാടകീയമാണ്. നാടകത്തില് നിന്ന് സിനിമയിലേക്കുള്ള ദൂരം ഏറെ തന്നെ എന്ന് ഈ സിനിമ കാട്ടിത്തരുന്നു. ഒട്ടു മിക്ക രംഗങ്ങളും, സംഭവങ്ങളും സംഭാഷണങ്ങളും എല്ലാം സിനിമയേക്കാള് നാടകങ്ങള്ക്ക് യോജിച്ചവയാണെന്ന് തോന്നും. കാഴ്ചക്കാര് ബുദ്ധി കുറവുള്ളവരാനെന്നും കാര്യങ്ങളെല്ലാം വളരെ സ്പഷ്ടമായി സംഭാഷണങ്ങളില് ഉള്കൊള്ളിച്ചാല് മാത്രമേ അവര്ക്ക് വല്ലതും മനസ്സിലാവൂ എന്ന മട്ടിലാണ് കഥാപാത്രങ്ങളുടെ സംസാരം. കേന്ദ്ര കഥാപാത്രങ്ങളൊഴിച്ചുള്ളവരുടെ വരികള് തികച്ചും അസ്വാഭാവികം.<br />
<br />
ചിത്രത്തിന്റെ കഥ അല്പം കാലഹരണപ്പെട്ടതാണെന്നാണ് എന്റെ അഭിപ്രായം. ഒരു പക്ഷേ നമ്മള് തെക്കേ ഇന്ത്യക്കാരായത് കൊണ്ട് തോന്നുന്നതാവാം. എങ്കിലും ഇത് ഒരു രസംകൊല്ലിയാവുന്നില്ല എന്നത് സമാധാനം. ആകെ മൊത്തം <a href="http://www.imdb.com/title/tt0104257/" target="_blank">A Few Good Men</a>, <a href="http://www.imdb.com/title/tt0050083/" target="_blank">12 Angry Men</a> എന്നീ ഹോളിവുഡു് സിനിമകളെ ഓര്മ്മപ്പെടുത്തുന്ന അന്തരീക്ഷം.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAhKsn-99KJyLW4UTj7x_5iWuohlDYVGRkf4YzcFW5Jd6E9Lc2liB9noMGwQqMRilWaGKHTG98zuqRs0L2mlNwWAmgPX9Q20wlLNrWM9FitQQJUWuYSmueqk545r5Te2-F_gR0NBbdWCY/s1600/parthipan.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="200" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAhKsn-99KJyLW4UTj7x_5iWuohlDYVGRkf4YzcFW5Jd6E9Lc2liB9noMGwQqMRilWaGKHTG98zuqRs0L2mlNwWAmgPX9Q20wlLNrWM9FitQQJUWuYSmueqk545r5Te2-F_gR0NBbdWCY/s200/parthipan.jpg" width="133" /></a></div>
അഭിനേതാക്കളുടെ കാര്യമെടുക്കാം. പാര്ത്ഥിപന് മികച്ചുനിന്നപ്പോള് സുരേഷ് ഗോപി അലോസരപ്പെടുത്തി. ഇത്രയും പരിചയസമ്പന്നനായ ഒരു നടന് എന്തിനാണ് യാതൊരു നിയന്ത്രണവുമില്ലാതെ ഇങ്ങനെ അമിതമായ നാടകീയത കലര്ത്തി ഡയലോഗുകള് പറയുന്നതെന്ന് മനസ്സിലാകുന്നില്ല (ഇപ്പോള് ടിവിയില് ഓടുന്ന "നിങ്ങള്ക്കും ആകാം കോടീശ്വരനിലെ" പ്രകടനവും വ്യത്യസ്തമല്ല). തലൈവാസല് വിജയ് വളരെ മോശം. ചിത്രത്തിന്റെ അവസാന രംഗങ്ങളില് ഇദ്ദേഹത്തിന്റെ പ്രകടനം അസഹനീയമാണ്. ബാക്കിയുള്ളവര്ക്ക് കാര്യമായൊന്നും ചെയ്യാനില്ലെങ്കിലും കൃഷ്ണകുമാറും രവിയും തരക്കേടില്ലാത്ത പ്രകടനം കാഴ്ചവച്ചിരിക്കുന്നു.<br />
<br />
ആകെ മൊത്തം ഇതൊരു ഭേദപ്പെട്ട ചിത്രമാനെന്നാണ് എന്റെ അഭിപ്രായം. മുകളില് പറഞ്ഞ ന്യൂനതകള് ഉണ്ടെങ്കിലും പ്രോത്സാഹിക്കപ്പെടേണ്ട ഒരു സിനിമ തന്നെയാണ് മേല്വിലാസം. ഈ സിനിമ ചാനലുകളിലോ മറ്റോ കാണാന് അവസരം കിട്ടിയാല് നഷ്ടപ്പെടുത്തണ്ട.<br />
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>
<div align="justify" style="font-size: 12pt;">
<br /></div>Unknownnoreply@blogger.com0