Suramya's Blog

Visit suramya.com Who am I?

January 13, 2012

Official style guide for Android developers launched

Filed under: Computer Software,Interesting Sites — Suramya @ 3:01 PM

Google has just launched Android Design, a website created to help aid developers in the creation of applications for ICS. This makes it easier for developers to code visually consistent applications, so if you are interested in Android development check it out. I took a look and it has some good tips/suggestions on design etc.

Duarte wants to remedy this. On Thursday, Google launched Android Design, a web site created specifically to help aid developers in the creation of applications for ICS. The site offers a comprehensive visual to third-party application developers, giving suggestions on everything from how to implement different visual elements to overall back-end patterns for the OS itself.

In theory, it will help developers better understand just how the Android team thinks about layout and implementation, while simultaneously giving suggestions to interaction designers on how to maintain visual integrity. Basically, it will help both first-time developers and Android veterans make apps look less crappy.

Since have been thinking of diving back into mobile development for the past few days, this site will be very useful and has been launched at just the right time. Considering the previous experience I have with mobile development was on Symbian using Python, I can use all the design help I can get.

– 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

September 19, 2011

Trouble-Maker: Learn to fix computer issues

Filed under: Computer Software,Linux/Unix Related,Techie Stuff — Suramya @ 2:38 AM

This interesting app randomly breaks your system so you can learn how to fix it.

Haven’t tried it yet because as of now I only have one working Linux system at home, but as soon as I fix that I will be installing this on my secondary system. Once I do that I will log my experiences here.

You can download it from Trouble-Maker‘s site.

– Suramya

May 18, 2010

Boot From a USB Drive even when your BIOS Won’t Let You

Filed under: Computer Software,Computer Tips — Suramya @ 11:37 PM

If you are like me then you have gotten into the habit of carrying a Live Linux CD with you at times, I keep mine in my Laptop bag so its there when I need it. However CD’s have a lot of inherent problems like, an inability to update the version without burning a new disk and a susceptibility to scratches.

Having a Bootable USB drive with the latest version of Linux solves all these problems. USB drives are quite cheap now and it makes sense to have one available loaded with the latest diagnostic tools. But till date I didn’t carry a bootable USB drive with me because a lot of the systems I encountered didn’t allow me to boot from USB which made the bootable drive pretty much useless. Now, there is a way to fix the problem. What you need is a Blank CD and the latest version of PLoP.

PLoP is a Bootmanager that allows you to create a boot CD that will enable the system to boot from a USB drive even when that option is not supported by the BIOS. You can download PLoP from here. Installing it is quite easy. You just need to extract the .ZIP file that you downloaded and burn the .iso image to a CD. There are two ISO images on the CD and you can use either one of them, however according to the readme file plpbtnoemul.iso should work “everywhere” so if you have some doubt use that image.

Once you burn the image to the CD, reboot the system and configure it to boot off the CD. When the system boots up you will get a boot menu that will allow you to choose USB as the device to boot from. Once you do that the system will boot off the USB drive as normal and you can proceed from there.

Hope you find this as helpful as I am going to.

– Suramya

Source: Boot From a USB Drive Even if your BIOS Won’t Let You – How-To Geek.

February 24, 2010

Getting Wireless on my HP Pavilion DV5000 to work on Linux

Filed under: Computer Software,Knowledgebase,Linux/Unix Related — Suramya @ 10:46 PM

I have heard that connecting to wireless networks can give a lot of trouble in Linux. I have even experienced the same when I tried out Debian and Red Hat Enterprise Linux (RHEL) 5 on my HP Pavilion DV5000 laptop. In Debian I managed to get the card working but on RHEL I couldn’t get it to work.

Actually I could have gotten it to work but lacked the time to spend trying out various solutions. Plus the final solution wasn’t very elegant or portable. Basically what I ended up doing was hardcoding the config file to connect to a particular wireless network. Which obviously wasn’t a very portable solution.

When I decided to try out Backtrack 4 which is a Linux-based penetration testing distribution that is based off Ubuntu I was worried that my wireless card (Broadcom BCM4318) would again cause issues. If you have been using Linux then you probably have heard of this-chip set as earlier versions of Linux had a lot of problems getting this card to work and so I was expecting a lot of work before I got the card to work.

While the OS was installing I did a little search on google and that reminded me of a post on Tech Republic that talked about 10 tools to connect to wireless networks in Linux so I decided to try out each of them to see which one worked for me.

Fortunately for me the first program I tried (wicd) solved my problem. All I had to do to get the network working was: log in as root and then run the following command:

/etc/init.d/wicd start

Once I ran the command all my network cards were automatically detected and I could configure them. However since its a pain to configure the cards manually, I ran the following command to start the GUI based client for wicd:

wicd-client

When you run wicd-client a new icon shows up in the system tray (next to the clock) and if you double click on the icon the Wicd manager starts and allows you to configure any wireless/wired network that the system detects.

Over all, wicd is quite easy and a lot more intuitive than the default KDE Network manager, plus another advantage is that wicd supports WPA which the default KDE Network manager doesn’t.

Now that I have gotten the card working on Ubuntu I am going to re-install RHEL on the laptop and see if wicd can get the card working over there also. But that’s work for another day.

– Suramya

February 15, 2010

Augmented Reality: Tattoo that transforms into a flying dragon

Filed under: Computer Related,Computer Software,My Thoughts,Techie Stuff — Suramya @ 7:52 PM

Augmented reality, the words bring to mind a science fiction world where people wear glasses hooked up to computers that give additional information on the item being looked at. I have read scores of novels where this technology is in use by humans (both in a positive and negative sense) but till date this technology was still in the realm of Science Fiction.

Now this has changed. ThinkAnApp studio based in Buenos Aries has developed specialized software that allows them to create a tattoo that when viewed through a camera gets transformed into a flying dragon. Or anything else you want. Pretty cool eh?

Here’s what the Tattoo looks like when viewed through a camera:

Check out the video demoing the tattoo in action here.

This is just a prototype and isn’t released for public use yet. But it is a step in the right direction and slowly but surely we are moving closer to the day when the virtual world will overlay the real world and open up all the awesome possibilities that entails.

Source: ThinkAnApp – Augmented Reality (tattoo).

– Suramya

December 11, 2009

Google Calendar Notifications/Issues

Filed under: Computer Software — Suramya @ 4:12 AM

Google recently made a change to its Calender service that I had been waiting for a long time. Actually they might have launched it a while ago but I only noticed it recently.

You now have the ability to send the reminder for an event to a mobile phone as a SMS. The best part is that it even works with my cell phone in India. So now I get reminders even when I don’t have access to my email (which I admit is pretty rare).

The only issue I have found so far is that the reminder via SMS is set about a day before the event no matter what setting I put in the interface. I have set the system so that I get a reminder 15 mins before any appointment set in my calender but I keep getting the reminder a day before, i.e. if the event is on the 8th I get the reminder on my cell phone on the 7th. Hopefully they will fix it soon.

The other issue I hit on the calender is that it seems to be impossible to change the date for an existing event. I wanted to change the date and time for a reminder but it refused to let me change the date. It did change the time to the new time but kept the event on the old date. I finally had to delete the old event and create a new event.

Now if I can get it to sync with my Phone it would be great. I got the phone to sync with my system but still need to get Google to sync to evolution. (The connection keeps timing out for some reason).

Other than these minor issues I really like the Google Calender.

– Suramya

August 15, 2009

Posting to WordPress Blogs from Lifeblog on Nokia Phones

Filed under: Computer Software,Software Releases — Suramya @ 4:45 AM

I have been wanting to have the option to make blog posts directly from lifeblog on my N95 for a while now but so far was unsuccessful because no plugin existed that worked with the latest version of WordPress.

So I downloaded the latest available copy of the plugin from this blog post and modified it to work with the latest version of WordPress.

You can download the latest version of the plugin from the Scripts Directory. This version works with WordPress 2.8.x (I tested it with 2.8.2 and 2.8.4).

Changelog :
Ver 3.5: (15th Aug 2009):

* Plugin is now compatible with WordPress 2.8.x (Tested upto 2.8.4)
* Replaced the SQL queries for categories creation/check with WordPress Functions
* Replaced the SQL queries for user checks with WordPress functions
* Added ability to Enable/Disable Debug Logging by changing one variable

Let me know if you have any questions/issues.

– Suramya

June 23, 2009

Firefox 3.5 RC2 and my experience with it

Filed under: Computer Software,My Thoughts — Suramya @ 11:21 PM

I have been using the latest version of Firefox(FF) 3.5 for the past few days and I am pretty happy with it so far. I first started using FF when it was version 0.5 (or was it 0.6). Since then I have used every alpha and beta version that Mozilla released for any of its new versions.

This is the first release for which I never tried out the alpha/beta versions. The first time I downloaded it was the pre-RC version Beta 99 that was released just before RC1.

Some of the things have changes. One major change that I have noticed is that it is using a lot less memory than any of the previous versions. Previously it would routinely take up 200-300 MB of RAM, currently it is using 100MB after about a day of surfing.

The privacy mode is also nice but I haven’t really tried it out yet. I haven’t really noticed a lot of speed difference while surfing yet but it does start up faster.

I am eagerly waiting for the final version to come out so that I can play with it.

Well this is all for now. Will post more later.

– Suramya

September 23, 2008

SugarCRM Silent upgrade issues and fixes

Filed under: Computer Software,Knowledgebase — Suramya @ 5:59 PM

The past few weeks I have been working on the SugarCRM Silent upgrade script that upgrades the CRM from ver 4.5.1 to Version 5.0 and I hit some issues that took ages to fix. So I am sharing the fixes/solutions here for others who might have hit these issues and are looking for a solution:

1. The upgrade fails suddenly with the following error message in the upgradeWizard.log file:

Wed, 24 Sep 2008 08:28:20 -0500 [UpgradeWizard] - *** ERROR: could not copy file: /home/suramya/public_html/CRM/include/SugarFields/Fields/Address/DetailView.tpl

To fix this issue you need to extract the upgrade zip file that you downloaded and then copy the SugarFields folder from the includes directory into the include folder of your CRM. Once you do that the CRM upgrade will continue normally.

2. Upgrade fails with the following error message:


Fatal error: Call to a member function on a non-object in /home/suramya/public_html/CRM/include/dir_inc.php on line 135

This one was an interesting one to fix. I had already migrated a couple of test installs on that server so I knew the server supported the upgrade script and I was migrating the same install again so I knew that the install could be upgraded.

Finally figured out that if you rename the upgrade zip file to another name it will fail with that error message. Which is kind of silly because we give the installer the name of the upgrade zip file when running it…

Hope this helps someone else out there.

– Sur

« Newer PostsOlder Posts »

Powered by WordPress