Thursday, December 5, 2013

Build and run Blackberry app in simulator

I new requirement is to build the blackberry application and run it in the blackberry simulator. I created a application using phonegap, now next task is to run in the blackberry simulator.

I have to setup the simulator locally. Step as follows:-
  • Install Jdk.
  • Install vmware.
  • download the simulator from blackberry site.

Now you are done with the  simulator setup. You have to start the simulator in the vmware  and enable the development mode.

The one this you have to note the ip-address of the simulator which is present in the bottom left.

you have to setup the couple of things:-
  • blackberry 10 sdk
  • apache
  • ant
after you done with the setup you have to do couple of settings changes in the project properties file.

  1.  update the
    qnx.bbwp.dir =
  2. qnx.sim.ip =
now you are done with all the settings.
go to project directory and type couple of commands
  1. ant qnx build
  2. ant qnx load-simulator
 

Thursday, November 28, 2013

How to load the server page in mobile application using jquery mobile

My application requirements is to show the dynamic pages on the mobile application using the jquery mobile.

Here is my approach
1) bind the pagebeforechange event.
2) Call the javascript function inside the pagebeforechange function.
3) Inside the function call the ajax and insert the content in the page.
4) Onsuccessfull ajax request trigger the pagechange event.


Here is sample code:
1) $(document).on('pagebeforechange', function (e, data) {
      if (typeof data.toPage === "string") {
           if (u.hash.search(/^#action_url/) !== -1) {

                populate_content(u, data.options);

                e.preventDefault();
            }  
     }
});


2) function populate_content(u, options) {
  
    $.ajax({url: remote_location_url,
                success: function (result) {
                      insert content here ............
                }
              
            });

            $.mobile.changePage($('#page_change'), options);

        } 

}

Thursday, November 14, 2013

Cookies are not set in AJAX request

I am setting the cookies to browser by an .js ajax request. After some time when i am sending the .html extension ajax request  my browser is not sending cookies along with the request in ajax call. After some googling i found that i have to set the

xhrFields: {
           withCredentials: true
}

in my ajax call.

Thursday, November 7, 2013

Get the controller object in model rails

My Site require a audit trail functionality who did activity, what are changes he made, from which ip address and lot more details. So i written the after_create, after_update, and after_destroy ActiveRecord callback in the ActiveRecord::Base class. It solves my purpose but i need who did it, from which ip he did it.

So i added a before filter in application controller which add the controller instance to current thread,

 Thread.current.thread_variable_set('controller', self)

As in the same thread the operation happening on the ActiveRecord.

So i can get back the controller instance and call the current_user method on it

Thread.current.thread_variable_get('controller').current_user

now i have to make my current_user method public and to avoid it calling from browser as action i have to hide it by

hide_action :current_user

Monday, June 24, 2013

Whitelisting the system tray in ubuntu 13.04

As you probably know, the Unity notification area (systray) whitelist is no longer available in Ubuntu 13.04 so you can't whitelist applications to be able to use the systray.  

If you can't live without an application that still uses the old notification area, here's how to get the Unity systray whitelist back in Ubuntu 13.04 


sudo add-apt-repository ppa:timekiller/unity-systrayfix
sudo apt-get update
sudo apt-get upgrade
 
 

You install Skype and expect it to work as it used to. But if you close the main window - you soon notice that Skype icon is not being displayed in top panel.

To fix this you will need to run a few commands. So open up your terminal and run this:
 
gsettings get com.canonical.Unity.Panel systray-whitelist

You should get something like this:

 
['JavaEmbeddedFrame', 'Wine', 'Update-notifier'] 
 
Basically this means, that Skype is not whitelisted, thus is not allowed by default to display 
its tray icon. We need to fix this. Append 'Skype' to the list so that you have something like this:
 
settings set com.canonical.Unity.Panel systray-whitelist "['JavaEmbeddedFrame', 'Wine', 'Update-notifier', 'Skype']" 

Now just copy this to your Terminal and execute the command. Reboot afterwards. Now you should see the icon.

Thursday, June 20, 2013

How to connect RJ-45 connector to ethernet cable

The connector at the end of a CAT-5 cable is called an
RJ-45 connector. It allows you to plug your cable into a wall jack or the
network port of a network device like a computer.

Each wire in the cable goes into a slot inside the RJ-45 connector, and
this connects it to a pin in the connector.

So which wire goes where?

The position of each wire is important.

When you plug an RJ-45 connector into a jack, the pins on the
connector make contact with pins in the jack. If the wires are in the
correct position, this allows information, in the form of electrons, to
flow. If the wires are in the wrong position, the information won’t be
able to get through.

The order of the wires in an RJ-45 connector conforms to one of two
standards. These standards are 568A and 568B.

568A and 568B are cabling standards that tell you which order your wires
need to go in when fitting an RJ-45 cable.

  • The 568A wire order
    If you’re following the 568A wiring standard, you use the following wire order:
    Striped green, solid green, striped orange, solid blue, striped blue, solid orange,striped brown, solid brown.
  • The 568B wire order
    If you’re following the 568B wiring standard, you use the following wire order instead:
    Striped orange, solid orange, striped green, solid blue, striped blue, solid green, striped brown, solid brown.

The 568B wire order is like the 568A wire order but with the position of
the green and orange wires switched around.

Can you see any similarities between the 568A and 568B wire orders? The
order for each standard is basically the same except the orange and green
wires are switched over.

So which standard should you use?
When you attach an RJ-45 connector, the key thing is that both ends of
the cable use the same standard. Before fitting a new RJ-45 connector, take
a look at the other end of the cable. If the other end of the cable uses
standard 568A for the RJ-45 wire order, then fit your new RJ-45 connector
using the 568A standard. If it uses 568B, then use this standard instead.

Ethernet cable color coding and their meaning

Ethernet cable is category-5(cat-5) standard cable.

The color and their meaning as follows:-
  • Orange pair sends data.
  • Green pair receives data.
  • Blue and Brown wire are kept for future mainly to increase the bandwidth.
 note :- Blue and brown wires don’t do anything yet, but they will in the
future. The cable standards folks designed CAT-5 with the extra
colored wires so that they could be used for higher bandwidths in
the future.


More wires = more bandwidth

Now we also have cat-5e and cat-6 ethernet cables as well.