Suramya's Blog

Visit suramya.com Who am I?

October 28, 2011

Royal Society journal archive made permanently free to access

Filed under: Interesting Sites,News/Articles — Suramya @ 4:38 PM

The Royal Society which is the worlds oldest publisher has made its entire archive of more than 69,000 articles open and given free access to everyone. For those of you who are wondering what Royal Society is all about, here’s a brief introduction:

Founded in 1660, the ‘Royal Society of London for Improving Natural Knowledge’, was granted, two years later, a charter to publish by Charles II. On March 6th, 1655, the first issue of Philosophical Transactions of the Royal Society was published under the editorship of Henry Oldenburg, who was also Secretary of the Royal Society at the time. He stipulated that the journal should be ‘licensed by the council of the Society, being first reviewed by some of the members of the same’ and Philosophical Transactions of the Royal Society thus became the first ever peer-reviewed journal.

The Royal Society is the world’s oldest scientific publisher and, as such, our archive is the most comprehensive in science. Treasures in the archive include Isaac Newton’s first published scientific paper, geological work by a young Charles Darwin, and Benjamin Franklin’s celebrated account of his electrical kite experiment. Readers willing to delve a little deeper may find some undiscovered gems from the dawn of the scientific revolution – including Robert Boyle’s account of monstrous calves, grisly tales of students being struck by lightning, and early experiments on to how to cool drinks ‘without the Help of Snow, Ice, Haile, Wind or Niter, and That at Any Time of the Year.’

Now anyone with a net connection can read Benjamin Franklin’s account of his kite experiment in his own words or other similar landmark issues and who knows what idea one of these might spark in someone’s mind. After all you never know what might spark an idea and inspire a person to create the next great thing. These issues are an amazing treasure for people interested in the history of science and just reading them gives the reader an idea of how science evolved over the ages.

These journals are available for online browsing or for download as PDF files. However at a quick glance I couldn’t figure out if they allow mirroring of this stuff on other sites or not. I have reached out to them for permission to mirror the content but I don’t know if it will be granted or not. I hope it is, but you never know.

Source: Royal Society Publishing & History Today

– Suramya

October 26, 2011

Connecting a WordPress blog to Facebook

Filed under: Computer Software,Linux/Unix Related,Techie Stuff,Tutorials — Suramya @ 5:01 PM

Over the past few months I have been trying to connect my blog to my Facebook account so that whenever a post is made on the blog it automatically gets posted on Facebook to varying degree’s of success. Most of the attempts would work for a while and then stop. I even tried using some of the existing plugins for WordPress but since they required a developer account (which needs a valid phone no or CC#) and for some reason I never get the validation code on my cell I was never able to get them to work.

Then I found an article on Linux Magazine on a Command Line interface for Facebook and decided to build on top of that to get the linkage working. Now this is a very hackey way and is not at all elegant or anything but it gets the work done which is what I wanted, so I am good. :) All the work was done in about 2 hours including testing so that should tell you something on its own.

I had to install this on my local system since my webhost didn’t have all the per-requisites to get this to work. That and the fact that I can’t connect to my MySQL db’s from a machine outside of my hosting provider is why this convoluted method was created. The steps I followed to get this to work are as follows.

Install Facebook Commandline

To install Facebook Commandline, follow the instructions on their site.

Authenticate the Application to be able to talk to Facebook

For some reason there was a difference when I run the application from the commandline and when I run it from the web, in as to where the preferences file and the session details were saved, so all the steps have to be done either from the command line or via the web, you can’t interchange the two.

Creating a Web interface for the FBCMD

Since I wanted to be able to get data from WordPress and pass it on to FBCMD I created a new PHP page called run.php that basically pulls the data from WordPress and then passes it to FBCMD as command line parameters. I know that using passthru is probably not very secure and I should have modified the FBCMD file to accept parameters as a URL but didn’t want to spend that much time trying to get this to work. (Hey! I told you it was a quick and dirty ‘fix’).

The contents of this file are very simple:

error_reporting(E_ALL);
$handle = fopen('http://www.suramya.com/blog/LatestPost.php', 'r');
$current = fopen('/var/www/fbcmd/latest.dat', 'r');
$current_id = fgets($current, 4096);
fclose ($current);

if ($handle) 
{
 $ID = fgets($handle, 4096);
 $link = fgets($handle, 4096);
 $title = fgets($handle, 4096);
 $content = fgets($handle, 596);
 $content = chunk_split(htmlspecialchars(strip_tags($content)), 500) . "...";

 if($ID != $current_id)
 {
  // If we have a new post then call FBCMD to make a post
  $command = '/usr/bin/php /var/www/fbcmd/lib/fbcmd/fbcmd.php POST " " "' . chop($title) . '" "' . 
              chop($link) . '" "' . $content . '"';
  passthru ($command);
  // Write the new PostID to a file
  $current = fopen('/var/www/fbcmd/latest.dat', 'w');
  fputs($current, $ID);
  fclose($current);
 }
}

The file basically calls ‘LatestPost.php’ and gets the latest post details on the blog(see below for details), then it checks if the post made is newer than the last post processed and if so it proceeds to post to Facebook using FBCMD.

‘LatestPost.php’ file looks like this:

< ?php

define('WP_USE_THEMES', true);
require_once( dirname(__FILE__) . '/wp-load.php' );

$month = $_GET['month'];
$year = $_GET['year'];

$args = array( 'numberposts' => 1);
$myposts = get_posts( $args );

//print_r($myposts);

foreach( $myposts as $post ) : setup_postdata($post); 
echo $post->ID . "\n";
the_permalink();
echo "\n";
the_title();
echo "\n";
the_content();
endforeach; ?>

This file need to be put on the server in the WordPress Root directory and when called returns an output in the following format:

Post ID
Post Link
Post Title
Post Content

Once all this is done and the FBCMD has access to post to Facebook all we need is a cron job to run on a frequent basis to run the code. So I created a shell script that contains the following line and have it run every 15 mins.

/usr/bin/curl http://localhost/fbcmd/run.php > /tmp/FBPost.out

That’s it. So far it looks like its working great and if this post shows up on my FB wall then all is well. If not, then its back to the code to see what went wrong this time.

– Suramya

October 25, 2011

Bio computers come a bit closer to reality

Filed under: My Thoughts,News/Articles,Techie Stuff — Suramya @ 6:29 PM

Readers of this blog (all 2 of you :) ) and people who know me, know that I have always been interested in Bio/DNA computers and have even written about them in the past. But to my sorrow most of the current work on Bio computers is still in the very theoretical stage.

Recently, Researchers at Imperial College London have claimed to have successfully built logic gates out of bacteria and DNA. The team built an AND gate using e-coli (Escherichia coli) bacteria which is normally found in the lower intestine and another team built on top of that to create a NAND gate which is basically an AND gate combined with a NOT gate.

While this doesn’t sound like much it is indeed a step forward because all computers are basically a collection of logic gates and if the team can manage to connect more of them together then we have the beginnings of a working Bio computer.

More details on their work is available at: Scientists create computing building blocks from bacteria and DNA

The study can be downloaded from here.

Sources: ZEE News & Wired UK

As always if I find more information I will post a follow-up entry here.

– Suramya

October 15, 2011

Solar plant that continues to work at night

Filed under: News/Articles — Suramya @ 11:21 PM

A major problem with Solar plants is that once the sun sets or its cloudy they are pretty much just taking up space and if I have spent a few million on a powerful solar plant I would want to be able to get as much use out of it as possible. People have tried various ways to work around the problem but till recently none of them were too successful.

Now a new solar plant has come up just outside Seville, Spain that claims to fix this problem, infact if their claims are to be believed it can function for upto 15 hours of dark. From their news release:

More than 2,600 concentrically-arranged mirrors at the Gemasolar installation just outside of Seville, Spain concentrate solar energy towards a centrally located molten nitrate salt tank. As the rays converge, they super-heat the salt to over 900 degrees Celsius, causing water around the tank to boil and drive steam turbines. In addition, any superfluous heat generated during the day is stored within the liquefied salt. It acts like a giant thermal battery for driving the turbines at night and during overcast days—up to 15 hours at a time with no sunlight.

This is pretty interesting and cool, however the price tag of $410 million is not that cool so don’t expect similar plants to start popping up all over the place anytime soon. But still… This plant alone will reduce atmospheric CO2 emissions by more than 30,000 tons a year and can produce up to 20 megawatts of power.

Source: The World’s First Solar Plant to Generate Electricity Even at Night

– Suramya

October 14, 2011

How I fix computers…

Filed under: Humor — Suramya @ 1:14 AM

This is so true…

– Suramya

October 13, 2011

A nerdy Guide To New York City

Filed under: Interesting Sites,Techie Stuff — Suramya @ 6:53 PM

Are you a big movie/comic book fan? If yes then you will like this map created by users on BuzzFeed. Basically, instead of showing typical tourist landmarks like the statue of liberty etc it shows the location of famous landmarks from comics, video games, movies etc. I wish it had been created a couple of months ago while I was visiting NY. Ah well, the next time I visit I know what I will be checking out during my trip around the city.

Check it out:


A nerdy guide to New York City

Now someone should create a similar map for locations in India that were used in Movies/comics/books etc. Hmm… not a bad idea for a project. Guess it should be possible to find a list of locations in India that were used in a book/movie/comic and them map them out in Google maps. The hard part would be compiling the list of locations, mapping it out shouldn’t be that hard.

Source: Ultimate Nerd Guide to New York City

– Suramya

October 12, 2011

Virus hits US Drone Fleet: Is Skynet finally ready to take over?

Filed under: Computer Related,My Thoughts,News/Articles — Suramya @ 4:28 PM

I typed an entire post while in flight back to Bangalore and then because the wordpress app for Android requires a netconnection to work and doesn’t allow you to work offline, I lost my entire post and now have to type it all again.

Looks like we are about ready for the end of the world and the start of the robot Apocalypse. A virus has infected the US Drone fleet and so far the admins have been unable to remove the infection. Now all we need is for the US military to hand over control of its entire system to a super AI and we are ready to go. To make things even better we also have early prototypes of HK’s (HunterKillers) in testing in various labs around the world.

Its funny how real life follows fiction at times. When I used to tell people that I was interested in Artificial intelligence, the most common reaction I would get was “are you crazy? Haven’t you seen Terminator?” Now if we have a rogue AI running around its actually possible for it to cause a whole lot of damage, maybe not to the tune of ‘end of the world’ but enough to make life miserable for a whole lot of people.

Maybe its time to stock up on my tin-foil hats and MRE’s :)

– Suramya

October 11, 2011

A funny book for kids who are now big…

Filed under: Humor — Suramya @ 12:23 AM

Good book to read now that you are big :)
Since most of you reading the blog were probably confused about what this is about, here’s a bit of an explanation. Basically its a sex education book from pre-teens & early teens but its written in a very funny and interesting way which is usually not the case for these kinds of books. So wanted to share.

BTW, if you are offended by such topics then don’t visit the link. Otherwise have a laugh…

– Suramya

October 10, 2011

SSR 1.1: Students Empowering Students

Filed under: Interesting Sites,My Thoughts — Suramya @ 4:55 PM

According to some estimates, there are 200 million children in India between the ages of 6 and 14 years who have not even completed basic eight years of elementary education.

My friend Tarini Mukherji is trying to change this. In her words:

—-
This is why with the project SSR 1.1, we wish to rise and change this. Please vote for our idea and help us bring a change.

I have been teaching in a street school for more than a year now and if I do qualify in this competition, the trust would be entitled for a grant that can help my students and many other underprivileged children to get an education. All you guys need to do is vote and if possible put the link on your Facebook status / links to share with your friends. I need a mammoth 5000-6000 votes to be in the lead. Any help would be great.

SSR 1.1

Please vote, and spread the word.
——

Do vote for this. I have known Tarini for over a decade now (doesn’t that make you feel old) and would urge you guys to help her in this.

– Suramya

October 5, 2011

Facebook does not like my Blog

Filed under: Website Updates — Suramya @ 12:21 AM

Looks like the integration between Facebook (FB) and my blog is broken once again. There is a plugin for WordPress that pushes your posts to Facebook but that requires you to setup an App in Facebook. However since I am not a Developer on FB so far I need to authenticate myself by giving FB either my Credit card # (So not happening) or my cell number (not working).

I have tried both my numbers but so far haven’t received any SMS’s from FB yet. Will try some other plugins while I am waiting but am not too hopeful that I will succeed in the integrating the two today. Lets see…

Update: Looks like all of the plugins require a Facebook app to be created in order to connect. :( Although the problem with me not receiving the SMS could be because Facebook is having issues. At present all profile images on Facebook are showing up as broken for me.

– Suramya

Powered by WordPress