Posts

Celebrating Birthdays: A Tradition of Joy and Reflection

Birthdays are more than just a date on the calendar; they are milestones marking another year of life, growth, and experiences. Celebrated worldwide in countless ways, birthdays hold deep personal and cultural significance. Whether a grand party or a quiet reflection, this day offers an opportunity to embrace joy, appreciate loved ones, and look forward to the future. The Importance of Birthdays Birthdays symbolize the journey of life. They remind us of the passage of time and the progress we’ve made. They offer a chance to pause and reflect on personal achievements, challenges overcome, and lessons learned. While aging might sometimes feel daunting, birthdays are a celebration of resilience, memories, and the promise of tomorrow. For many, birthdays are also a time for gratitude. It’s an occasion to cherish the relationships that enrich our lives—friends, family, and colleagues who stand by us through thick and thin. The warm wishes and gestures of love on this day serve as a reminder...

Things you should consider before starting a blog

Image
It’s been a year, I am writing blog posts. I thought it is an easy task. However believe me it requires lots of efforts and dedication. Over the journey of one year I have made some mistakes and I want to share my thoughts on this. I am the only one maintaining my blog and I am a working professional. Post per week goal When I started writing I had a goal of writing post per week. However this requires strong dedication. As days passed by, I found it difficult to achieve this goal and almost failed. Another dimension is, you can’t just sit, start writing and publish. You should create quality and original content and creating quality content takes time. Hosting choice If you are thinking of starting a blog and thinking of hosting on your own then I would strongly recommend considering other options like free blog hosting on wordpress.com or google’s blogspot/blogger for at least initial period. Over this period you will gain some experiences about bl...

Building a TypeScript API SDK using Webpack that uses Authorization

Developing an SDK (Software Development Kit) simplifies interactions with APIs for client developers. In this blog, we’ll create a TypeScript SDK for a User API , using Webpack for bundling and extracting types into a separate file. We'll also include support for an Authorization header for secure API requests. This SDK will cover the following operations: Create a User ( POST /users ) Update a User ( PUT /users ) Get All Users ( GET /users ) Get a Single User ( GET /users/{id} ) Delete a User ( DELETE /users/{id} ) Partially Update a User ( PATCH /users/{id} ) We will go through below steps Project Setup Defining the User Types Creating the API SDK Configuring Webpack Building the SDK and Extracting Types Testing the SDK Conclusion 1. Proj...

6 steps to create local copy of your live WordPress site

I know there are bunch of other posts on how to create local copy of your live WordPress site, however, they are too much descriptive. Here I will show you step by step approach rather than descriptive one. 1. Export your live database into an sql file. 2. Download/Copy your live WordPress site folder to your local machine. 3. Move your downloaded WordPress site files inside local server’s web root. 4. Open exported sql file using notepad or any other editor of your choice and replace “http://www.yoursite.com” with “http://localhost/wordpress” and Save that file. (CAUTION: This file could be very large so replacing might take time. Command for replacing file content on *nix based system.) 5. Import database from that sql file into your local mysql database. 6. Open wp-config.php file which you can find inside your copied WordPress folder. In that file replace DB_NAME with your local WordPress database which you imported in above step. DB_USER with database user name. D...

Partially rendering Handlerbars from Backbone view

Image
While working on a project I had this situation where I wanted to render a view partially after some ajax is done. In this post I will explain how to render HandlerBar views partially. For the purpose of demonstrate I will simulate delay using setTimeout() function instead of an ajax request. So for an example lets consider following setup 1. Template <script id="PersonTemplate" type="text/x-handlebars-template"> <div> {{firstName}} {{lastName}} <div> <div id="divPartial"> <a href="{{website}}">{{website}}</a> </div> </script> 2. Backbone Model var PersonModel = Backbone.Model.extend({ defaults: { firstName: 'Bharat', lastName: 'Patil', website: '' } }); 3. Backbone view using Handlerbars view var TestView = Backbone.View.extend({ //assign model view instance model: objPerson, //get the...

Step by step Cordova calabash-ios automation

Step by step guide about how to integrate calabash-ios with Cordova in an automated way without opening Apple Xcode. Note: First try steps given on https://github.com/calabash/calabash-ios . If those steps aren’t working for you then try following steps. For me only manual steps given on above link worked. Also this script doesn’t create separate target same as “calabsh-ios setup” command. I also presume that you have already setup your cordova project and nodejs . sudo gem install calabash-cucumber If you get any error then try using following command sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future gem install calabash-cucumber reference Go inside your Cordova project directory npm install xcode npm install fs-extra npm install underscore Download script “cordova-calabash-ios.js” from here and paste it inside your cordova project at www level (not inside www). (Note: This is very primitive script you can modify it according to your n...

DataSync PhoneGap/Web applications using LocalStorage

Recently I have developed a PhoneGap application in which I wanted to synchronize data with server. In this post we will see a simple method to send data from PhoneGap application / Web application using LocalStorage as a queue. Conditions were like below: Store data in queue locally in LocalStorage Sync data with server if online when application comes online it should start syncing the data again if any upon successful sync remove from queue else try again synching one item at a time I have developed this solution using Backbone and Backbone LocalStorage plugin. Lets start understanding the solution. 1. Backbone Model var QueueModel = Backbone.Model.extend({ defaults:{ 'url': null, 'method': null //http method like GET, PUT, POST etc. } }); This model is nothing but representation of ajax settings that can be found here . 2. Backbone Collection used as a Queue which is using Backbone.LocalStorage plugin. You should use singleton p...

How to create syntax highlighter using jQuery

Image
Today I am going to show you how to create a basic code highlighter for website. This UI is actually inspired by sixrevisions.com . I have added functionality of showing line numbers. Following things will be covered How to add line numbers How to highlight single line comments i.e. those lines which starts with // How to highlight comment blocks i.e. those lines which are enclosed within /* */ Live Demo       Download Code To use this code highlighter you have to wrap your code inside <pre> tags. Really there is nothing new in it. It is the same traditional old method. <code> tag is another way of adding code into your post. However there is a difference between <pre> and <code> tag. To give analogy of their working I would give example of <div> and <span> respectively. This means <pre> is a block tag and <code> tag can be used inline. One important thing we need to consider is, in WordPress ...

KineticJS – draw lines using mouse tutorial

Image
In this post we will see how to draw lines using mouse with KineticJS canvas library. First we will go through a basic logic for drawing line. Also we will see how this logic can be implemented for KineticJS. live Demo  |  Download Code Logic for drawing line on canvas using mouse Listen for mousedown, mousemove, mouseup events on canvas on mousedown store x1, y1 relative to canvas element set started = true on mousemove if started = false then exit get current x, y element = line(x1, y1, x, y) on mouseup if started = false then exit get current x, y element = line(x1, y1, x, y) Explanation is as below Add following div into body <div id="canvasArea"> </div> Initialize a stage and layers var stage = new Kinetic.Stage({ container: 'canvasArea', width: 500, height: 500, draggable: false }), layer = new Kinetic.Layer({ name: 'layer' }), tmpLayer = new Kinetic.Layer({ ...

How to get local time from UTC using Moment.JS

Image
  Moment.JS is a beautiful javascript library for parsing, validating, manipulating, and formatting dates. This is a must have utility library when it comes to manipulating timestamps and dates in javascript. Here I will show how to get local time if you have a utc date time string. Lets say you have a UTC date-time string as  2014-02-19 05:24:32 AM and you want to determine time in your timezone then use following code: moment.utc('2014-02-19 05:24:32 AM').toDate(); toDate() method gives javascript Date() object. Below I have shared an example of how to use it. You can click on JavaScript link below to see the code.

Measure the height of keyboard on PhoneGap app using jQuery

Image
 I have been working on a PhoneGap project where I wanted  to scroll the content up and down whenever keyboard  appears and disappears.  After a bit of searching here and there, I found out that  whenever keyboard appears window's resize event if fired.  So to determine height of keyboard do the following steps  1. Inside device ready event store original window height  inside a window variable   window.height = $(window).height(); 2. Now on window resize event execute a callback function   $(window).resize(function(){     window.currentHeight = $(this).height();     window.heightDiff = window.height - window.currentHeight;  }); So whenever there is focus on an input element, window's resize event will be triggered which will execute above function and we will have the height of keyboard inside window.heightDiff variable. Putting it all together function onD...

iPhone 4s wifi grayed out temporary fix

Image
I am facing issues of WiFi button grayed out and battery draining very fast after upgrading from iOS 7.0 to iOS 7.0.3. I have been searching through internet right after this issue happened with my iDevice. My three colleagues don't have problems after upgrading to iOS 7.0.3 except for one saying battery draining is fast. Many people tried putting their iPhone's into freezer and I am one of them and it got fixed temporarily for at least 5 minutes. I kept it in freezer for 20 minutes and WiFi button reappeared. Interesting information, when in freezer it contracts hardware parts and WiFi reappears and again after sometime due to heat WiFi button gets grayed out again. You can see device logs by downloading iPhone configuration utility. Also I can see kernel panic logs related to WiFi inside iPhone diagnostic which you can see (if you have any) by going in Settings -> General -> About -> Diagnostic & Usage -> Diagnostic & Usage Data. Now question is,...

Real-Time collaborative coding in Eclipse using Saros

If you guys work as a team or most preferably pair programming then you are going to enjoy this post. Usually if you and your teammate want to write different functions into same file then either of you write first or later. However Saros lets two of you do this in real-time collaborative way. You can follow someone and whatever files open on his/her machines you can see on your machine instantly with the live changes being done. So how to install it and what are prerequisite software needed for that 1. If you have existing XMPP account you can use it or you can setup your own XMPP server. My and their preferable way is to install your own XMPP server and create accounts in it. You can use jabber servers too. Go to talk.google.com . I use Openfire server. 2. It is recommended that all accounts must be on same server and create all user accounts on Openfire server. 3. Install Saros eclipse plugin and configure it with your account. 4. Now create any project in your eclipse and...

Share text right away with your colleagues using Mailinator

Image
Some weeks ago in office there was a training program. Trainer wanted to share a link to his jsfiddle demo. As everyone in the room was from different project groups no one had a single point of sharing information. One of the guy in the room shouted send this link to synerzip@mailinator.com and everyone go on mailinator.com  and type synerzip and click on Check Inbox button. So this is how we shared information. 1. Now, What is Mailinator? A. They state that, it is "Free. Disposable. Email.". Basically, It is a public domain email. 2. How long shared information lasts? A. It will be deleted in several hours. 3. Can I share pictures, attachements and/or binary files? A. Simply, No. Only plain text. 4. Do they have any rejection criteria? A. Apart from question 3, other rejection criteria includes email size and too many recipients. After watching below steps of how to use it, it doesn't take much time to understand the notion. Step 1 Ste...

Share mouse, keyboard and files over WiFi with Free applications

Image
I am very happy to share information about applications that you will be reading below. These applications are not only for developers but also for end users of Windows or Mac or Linux. From last two days I have been working on two different computers i.e. on Mac as well as on Windows. I was continuously switching back and forth between these devices and I was fed up of using individual keyboard and touchpad. After thinking for a while I googled for "share mouse, keyboard and files over wifi" and I got following applications. Synergy - Share Mouse/Touchpad and Keyboard between computers. You just need to configure settings to work with, which are pretty easy to figure out. Install it on every device. Most important thing is, it's cross platform and open source. As Synergy does not yet support file copy and paste, I am using following utility to easily copy and paste files across machines. AnySend - This is a nice and free utility which you can run with...

A simple to use wrapper over Node.JS mysql library

Image
I was working on a project on Node.JS platform. In this project I was suppose to exchange data with MySql server. For this purpose I used two packages which are available in NPM repository, namely, mysql  and mysql-queues . Later is required because former driver yet doesn't support transaction feature of MySql database. If you go through them you will be confused a little bit and will find it difficult to understand in one go. To simplify this situation I created an easy to use wrapper over these two libraries. You can find my wrapper on GitHub by following this link . I am still in progress of making it feature rich. How to use this wrapper: Install mysql and mysql-queues using npm install command. Download wrapper by going on this link . Now you can use it in a way that is specified below: Initialize object var dbClass = require('DB'); var options = {}; options.host = 'localhost'; options.user = 'root'; options.password = 'root...

Repair anything yourself using guides on iFixit

Image
Recently, I raised my Macbook Pro's RAM up to 8 GB. My machine is Macbook Pro 13" (mid 2010). I was worried about opening my Mac and replacing RAMs myself. But still determined to change RAMs. After searching on internet I came across a website named iFixit.com . They say that it is a free repair manual. I followed this guide to change RAM. It is described in very simple and easy steps. Guide even tells you which tools will be required to perform repair. If you go to their about section, it states that, "We're building the free repair manual for everything". Also they encourage you to contribute repairs. You can follow this link to contribute repair. Currently you can find repair guides for following things Mac, Game Console, Phone, iPhone, Car & Truck, Camera, PC, iPad, iPod, Appliance etc. For those who are interested to know which RAM I used and from where I bought it. The answer for former is G.Skill SQ For MAC DDR3 4 GB and for later is Fl...

Monetize your Facebook application in four easy steps

Image
You have a great Facebook application and generating a decent amount of impressions then, probably, it's time to generate money from your Facebook application. There are various methods of monetizing, like displaying ads and/or using Facebook Credits. Facebook Credits are like a virtual currency. You can use it to buy virtual goods in any games or apps of the Facebook platform that accept payments. Currently, I am monetizing my Facebook application by the method of displaying ads. Follow below four simple and easy steps to start monetizing your Facebook application: Find the Facebook ads providers list by going on https://developers.facebook.com/adproviders/ Choose and register as a publisher with one of these ads providers. (Ads providers may take time because they will review your application.) Once ads providers review your application, you can create ads slots. Grab the code from those ads slots and place them into your Facebook application at appropriate place...

Map your trek route on Google Maps without any application andconnectivity?

Image
Last year on 16th of July, we trekked from Talapewadi to Bhimashankar. It was a very great experience and you feel relieved when you go close to the nature. While trekking as usual everyone was taking photographs and I was no exception. I was taking photographs using my brand new Nokia Lumia 800 (now I no longer own it) which has functionality of attaching GPS locations to clicked photographs. And luckily I clicked photographs on important turns of trek. Trek was of almost 23 kilometers. After returning home I used those photographs to extract GPS locations using Garmin Basecamp application. You can import these geotagged photos into Garmin Basecamp application. Give some nice name to the collection. Now right click on all photos and select "view in Google Earth" and you are done. So to summarize, the things that you will need to map your hike on Google Maps are as follows: A camera with geotagging facility. Software that can extract all the GPS co-ordinates from...

How to recover your forgotten ISP password from router?

Image
Most of us would like to use Internet on multiple devices at home or office. To use Internet on multiple devices, you need to make use of a router. Certainly you can share Internet connection using computer that is connected to Internet. However there are some limitations associated with that method. You have to keep that computer ON for others to let use Internet that will consume lots of power. Coming back to our real topic. So you have a router with ISP username and password in it and you don't remember the password. You can either call ISP and ask to reset the password that will take 2-3 days (may be more depends on willingness of ISP provider :)) OR you can follow below steps to recover the password: Make sure that you are connected to the router from which you have to recover ISP password. Login to your router using a web browser. Usually most routers have default IP address http://192.168.1.1 (unless you have changed it) which you have to type it in your browser's...