Uploading file in iOS

Multipart form data and HTTP (body content) are most popular ways to upload files. In iOS, using AFNetworking 2.0, it is very easy to manage. Let’s jump:

1) Using multipart form data to form request:

    NSString *path = [[NSBundle mainBundle] pathForResource:@"MyFileToUpload" ofType:@"jpg"];
    
    NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://harit.kotharee.com/uploadMyImageMultipart.php" parameters:nil constructingBodyWithBlock:^(id<AFMultipartFormData> formData)
    {
        [formData appendPartWithFileURL:[NSURL fileURLWithPath:path] name:@"file" fileName:@"MyFileToUpload.jpg" mimeType:@"image/jpeg" error:nil];
    } error:nil];

2) Using HTTP POST to form request – here in this case A JSON request

    NSString *fileName = @"MyFileToUpload.jpg";
    UIImage *newImage = [UIImage imageNamed:fileName];
    NSData *data = UIImageJPEGRepresentation (newImage, 1.0f);
    
    NSString *strEncoded;
    if ([data respondsToSelector:@selector(base64EncodedStringWithOptions:)])
    {
        strEncoded = [data base64EncodedStringWithOptions:kNilOptions];  // iOS 7+
    }
    else
    {
        strEncoded = [data base64Encoding];        // pre iOS7
    }
    
    // have your own JSON or other format of request
    NSString *jsonRequest = [[NSString alloc] initWithFormat:@"{\"FileName\":\"%@\",\"ImageContent\":\"%@\"}", fileName, strEncoded];
    
    NSURL *url = [NSURL URLWithString:@"http://harit.kotharee.com/uploadMyImageHTTPbody"];
    
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
    NSInputStream *imageStream = [[NSInputStream alloc] initWithData:[jsonRequest dataUsingEncoding:NSUTF8StringEncoding]];
    
    [request setHTTPMethod:@"POST"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    // This is key part, instead of appending NSData, use stream when you expect the data to be larger
    [request setHTTPBodyStream:imageStream];

That’s pretty much done. Rest is simple and common for both ways:

    // handling operation response
    AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    [operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
    {
        NSLog(@"Cool! Let's proceed!");
    }
    failure:^(AFHTTPRequestOperation *operation, NSError *error)
    {
        NSLog(@"Oops! Handle gracefully!");
    }];
    
    [operation start];

In case of multipart request, we need to pass absolute URL of file. Of course, we can get it for bundle as well as camera roll. The deal with multipart request is that actual content of file is not loaded on iOS as data objects at runtime. Rather, HTTP (protocol) handles the it (add breakpoint at line #5 in [1] and debug!), so is a nice and probably best way to use for large size data, without worrying about memory issues.

Raw text printing from Adobe AIR

Printing raw text in Adobe AIR is kinda pain, specially if the text is too large, or multipage!

After some research and gerring ideas, I derived my own version of Util class which manages basic functionality.

package
{
	import mx.utils.StringUtils;
	
	import flash.display.Sprite;
	import flash.geom.Rectangle;
	import flash.printing.PrintJob;
	import flash.printing.PrintUIOptions;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;

	public class PrintUtils
	{
		public function PrintUtils()
		{}
		
		public static function printText(textString:String, printPageCount:Boolean = false):Boolean
		{
			var marginX:Number = 10;
			var marginY:Number = 10;
			var printJob:PrintJob = new PrintJob();
			var uiOpt:PrintUIOptions = new PrintUIOptions();
			
			if (!PrintJob.supportsPageSetupDialog) 
				return false;
			
			printJob.showPageSetupDialog(); 
			if( !printJob.start2(uiOpt, true) )
			{
				printJob.terminate();
				return false;
			}
			
			try
			{
				var fontSize:int = 10;
				var fontColor:uint = 0x000000;
				var format:TextFormat = new TextFormat( null, fontSize , fontColor );
				var printableArea:Rectangle = new Rectangle(0, 0, printJob.printableArea.width, printJob.printableArea.height);
				var lastChar:Number = 1;
				var pageCounter:int = 1;
				var pageCounterLine:int = printPageCount ? 1 : 0;
				while(lastChar > 0)
				{
					var remainingTextField:TextField = new TextField();
					remainingTextField.width = printableArea.width - (marginX*2);
					remainingTextField.height = printableArea.height - (marginY*2);
					
					remainingTextField.autoSize = TextFieldAutoSize.LEFT;
					remainingTextField.defaultTextFormat = format;
					remainingTextField.multiline = true;
					remainingTextField.wordWrap = true;
					
					remainingTextField.text = textString;
					
					// text strip out logic
					var lastLineTextString:String = StringUtil.trim(remainingTextField.getLineText(remainingTextField.bottomScrollV-pageCounterLine));
					if(lastLineTextString=="")
					{
						// find next printable line
						for(var j:int=1 ; j<(remainingTextField.bottomScrollV-pageCounterLine) ; j++)
						{
							lastLineTextString = StringUtil.trim(remainingTextField.getLineText(remainingTextField.bottomScrollV - pageCounterLine - j));
							if(lastLineTextString!="")
								break;
						}
					}
					
					lastChar = textString.indexOf(lastLineTextString) + lastLineTextString.length;
					var pageString:String = StringUtil.trim(textString.substr(0, lastChar));
					textString = StringUtil.trim(textString.substr(lastChar+1));
					
					if( StringUtils.isBlankOrNull(textString) )
						lastChar = 0;
					
					// print grabbed text on one page----------------------------------------------
					var printableSprite:Sprite = new Sprite();
					printableSprite.graphics.clear();
					//printableSprite.graphics.beginFill(0x00FF00);
					//printableSprite.graphics.drawRect(marginX, marginY, printableArea.width, printableArea.height);
					//printableSprite.graphics.endFill();
					
					var textFieldPrint:TextField = new TextField();
					textFieldPrint.width = printableArea.width - (marginX*2);
					textFieldPrint.height = printableArea.height - (marginY*2);
					textFieldPrint.x = marginX;
					textFieldPrint.y = marginY;
					
					textFieldPrint.autoSize = TextFieldAutoSize.LEFT;
					textFieldPrint.defaultTextFormat = format;
					textFieldPrint.multiline = true;
					textFieldPrint.wordWrap = true;
					
					textFieldPrint.text = pageString;
					
					printableSprite.addChild(textFieldPrint);
					
					// add pageCount
					if(printPageCount)
					{
						var pgCountTextFieldPrint:TextField = new TextField();
						
						pgCountTextFieldPrint.autoSize = TextFieldAutoSize.LEFT;
						pgCountTextFieldPrint.defaultTextFormat = format;
						pgCountTextFieldPrint.multiline = false;
						pgCountTextFieldPrint.wordWrap = true;
						pgCountTextFieldPrint.text = "Page " + pageCounter;
						
						pgCountTextFieldPrint.width = printableArea.width - (marginX*2);
						pgCountTextFieldPrint.x = marginX;
						pgCountTextFieldPrint.y = printableArea.height - pgCountTextFieldPrint.height - (marginY*2);
						
						printableSprite.addChild(pgCountTextFieldPrint);
						
						pageCounter++;
					}
					printJob.addPage(printableSprite, printableArea); 
				}
			}
			catch(error:Error)
			{
				return false;
			}
			printJob.send();
			return true;
		}
	}
}

This handles multi page text based on selected page size and margin. Also has minor feature of adding page number and so. This isn’t certainly rich utility, but also is enough to get started to add more features.

Lazy Loading of Proxies

While working on a pureMVC project, I realised that there were N number of proxies registered with facade (yes, ApplicationFacade). The truth was, not all have been used during life cycle of a typical user functionality.

So what? It was merely difficult to categories the proxies for need of individual module/functionality.

The simple idea is to implement Lazy Loading / Lazy registration of proxy!

Instead of declaring statement at compile time like

facade.registerProxy(new MyProxy()); 

I overridden

retrieveProxy(...)

function in extended Facade class:

override public function retrieveProxy(proxyName:String):IProxy
{
 var proxyInstance:IProxy = super.retrieveProxy(proxyName);
 if(proxyInstance==null)
 {
 var myClass:Class = getDefinitionByName(proxyName) as Class;
 if(!myClass)
 return null;

 var proxyInstance:IProxy = new myClass();
 if(proxyInstance)
 registerProxy(proxyInstance);
 }
 return proxyInstance;
}

This also takes care of not registering duplicate proxy.
Uh oh! While doing this trick, I encountered on more problem.


ReferenceError: Error #1065: Variable myClass is not defined.

I banged my head and tried to figure out the reason. After digging for some time, I found that the (class) definition of proxy was somehow not been retrieved with

getDefinitionByName() 

.
It wasn’t possible to simply add import statements with those Proxy class names as Flex compiler ignores such unused (yes while compiling none of proxy was referenced) imports.

Simple trick worked:
in extended facade class constructer, I declared each proxy as variable, something like:

public class ApplicationFacade extends Facade
{
 public function ApplicationFacade(parameter:SingletonEnforcer)
 {
 super();

 var myProxy:MyProxy;
 }
}

and that’s all I wanted! The trick is this code doesn’t force an instance of proxy to be created, still at runtime when required, it finds definition of MyProxy class.

Amritsar trip – ended with a joke by almighty

It was a weekday late evening in December 2011, my family was sat together after supper, just chit chatting and laughing. We, casually celebrated year 2011 as year of tourism, with many trips and vacations! I just asked if there is one more plan to celebrate the year and so quickly we decided to book tickets for Amritsar for January 2012. Me and my brother finished travel booking on the very same day after tentative planning!!

With some words of mouth, we got to know that Sarai is right and clean place to stay. With my uncle’s reference, we also managed to get booking at one of Sarai.

This started executing on 13th late night with train to Amritsar at early morning on 14th. It was general cold, as expected throughout the root. By the time we were reaching destination, we already saw glimpses of rainy weather. And it was indeed raining in Amritsar. We reached on 15th morning with 2 hours delay from schedule.

The very same day, just after dropping our bags at Sri Guru Gobind Singh Ji Yatri Niwas - Sarai and little relaxation, we thought to have quick visit to the Golden Temple. It was Sunday and so was pretty crowded, of course moving ahead in well discipline. We decide to visit the temple and pray very next day in early morning. We only did a circular walk in the temple campus and moved for lunch. With quickly finishing lunch, we booked a taxi and by the time driver came with his car, we made a not-so-in-hurry visit to Jaliawalla Baugh.

With light rain, we moved towards Atari, border and junction to Pakistan. It is itsa kind of experience to see flag lowering ceremony live!

By evening, we returned to Amritsar. Before going for dinner, thought to check for woolen specialities and winter wear. We checked in Oswals and almost completed shopping!!! After decent shopping experience, went for dinner and finished with sweet hot Gulab Jamun! It was bit exhaustive day since we did not spend much time for rest or sleep and so we went straight back to Sarai.
We adjusted our beds and all were just relaxing. Suddenly daddy thought to have a bottle of water (in Sarai, everything is self serviced!). And he went downstairs.

We were completely unaware, but this was beginning of gloomy side of our trip…

He did not return in half an hour. We were just bit serious and thought to start his search. Very soon, a person shouting if somebody’s on floor, came around and he was shouting an ‘unknown’ person fell down. Without thinking anything we rushed to ground floor and found him laid down on a bench. The Sarai authorities had already called up ambulance and also informed the ‘uncle’s reference’ about this man! We immediately rushed to Shri Guru Ramdas Hospital by the ambulance. Doctors did EEG and gave immediate report – what I cannot believe, hear or even listen. Dad left me, us and all wondering…..! :(

It is very hard to write in words, what happened further.

Uncle’s reference was none but Iqubal Singh, branch manager of Vijaya Bank, Amritsar. He reached to hospital, with almost shocked, unaware of final verdict. Knowing the situation, the gentleman and lady (aunty) gave immediate support and were the host to arrange our night stay at their warm home.

What happened next is again difficult to write in one go, shall add it to the post after gaining some energy.

Many of photos taken by dad are here.

Dubai – Sharjah visit

For last few months, got opportunity to travel to, explore and work in Dubai, for over a short period of time. The place isn’t much interesting for IT in terms of development. Of course, service and maintenance is a market there.

I captured this opportunity more in terms of travel! My uncle and auntie were major pointers for weekend visits.

I also learnt from grand-auntie that before 30 to 40 years the land was simply dry and like unexplored-undeveloped place. A few tribes settled on shores of Gulf. Post 90s, real and infrastructural development started. According to uncle, real and considerable development happened in just a span of 10 years from 2000 to 2010. Economic crisis of 2009 slowed this. But by then its been pretty much developed.

In general local people are very much calm and little lazy. However the land has accepted expats warmly. Indians, Pakistanis,Philippi, African are dominating expats in head count.

In general place is very much tourist friendly – specially. Being born and brought up in India, developing country, it was next to impossible without compare.

Had both side of experiences from Bus transport – at times drivers failed to respond properly, on the other hand drivers used to stop bus for long time on seeing passenger coming towards. Height of unexpected support and help was that once driver jumped (there is no conductor – helper in public buses) from his cabin and lifted two of my trolley bags and wished for happy weekend!

Help desks on metro / bus stations were also very much useful place to plan in a direction.

Shopping is obviously very much fun and enjoyable experience. Taste of fragrance of perfumes to body sprays, and electronics – I just loved it. Customer retention and care is very much considerable. I too had such experience – On purchase of major electronics the bill had minor error. After reaching home I called them to check and manager asked to visit them next day. He accepted error and ‘gifted’ an SD card on my visit!

I indeed enjoyed cashless shopping.

FMCG shopping has never fun to me, even at departmental store. Of course, being a hub joining east and west,Dubai and Sharjah stores are full of varieties and options from both sides of world. I was amazed to find two date counters with so many varieties!

Overall public transport is very good. Of course, routes were altered frequently – a few stations also being dropped. But this is sign of improving and reviewing transport system. Most places in Dubai were approachable with metro or metro+bus. Taxis were also easily available. However my little experience with taxi drivers was not much good.

For now, I am listing table of places I visited:

Date Place Nearest point (metro / bus) Photos
17 June 2011 Wafi Mall link
18 June 2011 Dubai Museum, Al Fahidi Fort Khalid Bin Al Waleed Metro Station link
Al Sabkha Abra Station Bur Dubai
Dubai Gold Souq Deira link
25 June 2011 Ibn Battuta Mall Ibn Batuta Metro Station link
Palm Jumeirah & Atlantis Hotel DubaiMarina Metro Station link
30 June 2011 Jumeirah Mosque Karama Metro Station link
Mercato Mall Karama Metro Station
Burj Al Arab Mall of Emirates Station, Nakheel Metro StationSeaside
Madinat Jumeirah Mall Mall of Emirates Station
Jumeirah Beach Residence – The Walk JLT Metro Station
9 July 2011 Mall of the Emirates Mall of Emirates Metro Station link
10 July 2011 Burj Khalifa 124 floor Dubai Mall station link
Internet City Internet City Metro Station

I started listing places very much late, till then I visited Sharjah Museum, Sharjah Gold Souk, Sharjah Corniche area, Dubai Mall, etc.

Here goes misc photos.

I am yet to enjoy desert safari, visit toAbu Dhabi, Al Ain, Al Fujirah!

Infibeam Pi – a review

After using – playing with infibeam.com’s Pi, for almost about 4 months I thought to write about it. Many people have been asking me online and offline ‘How is it?’ And could simply respond with ‘Good’!

If you think this is smart device, can do much more like iPad, Galaxy Pad or so, its absolutely misconception. Its very very simple and dedicated eBook reader, and almost nothing beyond that. No wi-fi, no 3G, no browser, no touch-screen!
The device is meant for very specific purpose.

Battery:
The battery lasts long and the main reasons behind them is the way is designed – no backlight and E-ink  screen. This is indeed smart technique, absence of back light and flat simple screen provides very smooth, no eye itching experience. This definitely provides equally pleasant experience as if you were reading physical – paper book. Battery indeed lasts more than a week for me after a complete charging cycle.

Connectivity:
Connectivity is pretty simple way, charging and data transfer is possible with mini USB interface. It also has SD card  slot, so you every time do not need to connect reader via cable to transfer books.

Ebook reading / formatting:
Though it supports vast variety of formats including, TXT, EPUB, PDF, HTML, and more, the device converts – formats text on its own. For non technical reading, its indeed good. This may result into different placement of image, but is fine as long as you can link the reference!
However, for technical ebooks, this isn’t good. For instance, code snippet or some tips also gets converted and formatted with different font. This makes it little annoying to understand flow. Also, limited screen size may also split continuity. Reference to diagram involves multiple flips between few pages.
The best and i-like-most part is support for major Indian languages. Font support and formatting is really very nice when it comes to Indian regional text.

Audio:
It has very basic audio player which supports MP3 format. This player is indeed basic, don’t expect rocking sound experience! The ideal purpose, though not highlighted much anywhere, is audio ebook listening, and nothing beyond.

Screen / display:
It has simple 600 by 800 pixels of display which is sufficient for normal book reading. The landscape and full screen book reading experience is good for continuous reading.

  • Font families – changeable includes Georgia, Courier, MTX Bold
  • Size switches – increase / decrease actually changes font size and reformats text. For ebooks with scanned image type text, text recognition is not there, so can also use zoom in-out.
  • E-ink displays image in grayscale.
  • Refresh / response time is bit more, so requires patience after button press! :D

Others:
No keyboard, very limited functional buttons, so no confusion for first time users.
Sudoku game, image viewer.

Minor bugs:

  • Landscape mode reading doesn’t show full title of ebook, even if it has sufficient space.
  • Header shows date, but not time – crazy!
  • For Indian scripts, specially with subscript characters and superscript characters, post formatting gives little annoying experience, for example a signle word is broken in such a way that first line terminates with consonant character and associated vowel goes to next line beginning! :)
  • About section – device says “GNU General Public License – this product contains software which applies to GPL. You may obtain and redistribute the GPL source code.” This is indeed crazy, GPL is license and not any type of source code. And the company – infibeam doesn’t mention which software (under GPL) is used, and from where! (consider it major, if you’re also open source promoter, like me.)

The bottom line:
This is dedicated ebook reader for India, but not as per ‘Indian Price’ – bit more expensive considering set of features. However the available options are good enough for non technical or semi technical reading.

Couple of one liners from my friends when they played with my reader.
“Please remove paper placed on screen and switch it on, I want to see!” (though actually it was on with some book opened)

“If this is offered around Rs.5000, I shall get one.”

“This is a book only, and is thinner than our technical books.” (when I handed over with leather case)
Bonus for readers of this post –

Get your favorite newspaper delivered to your e-mailbox, daily and read using this reader

  • Grab copy of Calibre Ebook Management software. It’s free and open source, supports multiple operating systems.
  • Install and open
  • Click on Fetch newsSchedule news download and you will see a window like below:Schedule news download
  • search for your favorite newspaper / magazine and click on the name. Of course, you can also add your own way – own news feed. But this requires little technical knowledge.
  • When you select – highlight the item, Schedule option on right side will be enabled, just select preferred time and frequency and save.
  • Now click on Connect / Share icon and setup your email account, make sure you enabled auto send option.
  • That’s it!

Note, this trick requires software to be open and internet to be connected, for the time you have scheduled. You can use scheduled activity to start / wake up your computer before the schedule and hibernate / shutdown post schedule.

I also recommend Calibre Ebook Management software as it has vast options to convert ebook to multiple formats.

Update:

infibeam Pi is just a wrapper and Indian branding of netronix ebook device! I was bit surprised to find this. Also, firmware upgrade is also not smooth. Post upgrade, you may expect some bugs as new gifts! :D

Auto fare Calculator for Indian cities

Many people either carry copy of auto fare card with them or do remember formula. However, it becomes difficult when you are roaming in multiple cities frequently.

A lot many similar apps available, however they are either platform specific, outdated or requires GPRS or other network connection. Few others are city specific.

This is a very simple attempt to overcome a couple of situations.

The application:

  • Works on almost any mobile with basic browser (internet browsing software)
  • Does not require any GPRS or other connection to run the app
  • Has support for multiple cities of India
  • Support for night fare calculation – based on device time
  • No installation required, just copy to mobile and run
  • No advertisement, no license fee – free and open source
  • Can be very easily updated
  • Has very basic and simple interface, executes and works simply

Grab it : Download http://harit.kotharee.com/app/fareCalc.htm . (Right click to the link and select ‘Save As…’ and save to your computer / or save the copy on your mobile.)

Use it : Open the saved copy of fareCalc.htm from your mobile or equivalent device, in most cases, it should open with default available browser. That’s it. No need to explain further. :)

Why HTMLand JavaScript?

  • Most mobile browser supports
  • No formatting / styling required
  • Widest compatibility across mobile platforms
  • No rebuild, easy to update
  • No installation required
  • Easy to share

Chrome and popup policy

Google Chrome has different policy to detect and block popup window.

Generally, a browser blocks popup if it’s automated, i.e. with some JavaScript call on page load or so. Moreover the way state of popup can be known by browsers using JavaScript only.

Chrome is bit smarter in this.

window.open(); is expected to return reference to opened popup window, or null / undefined if popup is blocked.

But, chrome holds reference of so called popup as non null value and still blocks popup.

Below snippet is perfect example to test:

<script language="JavaScript">
<!--
function showpopup()
{
	setTimeout ( "showpopupAfterTime();", 1000 );
}

function showpopupAfterTime()
{
 var popwin = window.open("http://harit.kotharee.com/", "popupwindow",
   "width=400,height=300,resizable,status,menubar,scrollbars");
 popwin.focus();
}
//-->
</script>

<a href="javascript:showpopup()">Click for a pop-up window!</a>

Chrome allows popup only if opened directly, i.e. without any kind of delay through JavaScript or any other means of delay.

So, in the above example, it will work only if showpopupAfterTime(); is called on hyperlink!

Adobe Flash Player & KeyboardEvent – FullScreenEvent relation explored

Since Adobe Flash player has allowed limited keyboard support for full screen mode (application), the feature also comes with a strange cost.

When KeyboardEvent.KEY_DOWN event listener is registered on stage, KeyboardEvent with keycode 32 (equivalent to Space key) is fired always when the application goes from normal state to full screen state!

To make sure, I made a sample test application as under:

package 
{
	import flash.display.*;
	import flash.events.*;
	import flash.text.TextField;
	import flash.net.URLRequest;
	import flash.ui.Keyboard;

	public class fullScreenTest extends Sprite
	{
		private var loader:Loader;
		private var player:Object;
		public function fullScreenTest()
		{
			super();
			if(stage)
				onAddedToStage();
			else
				addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
		}
		
		private function onAddedToStage(event:Event = null):void
		{
			if(hasEventListener(Event.ADDED_TO_STAGE))
				removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
			var changeScreenState:TextField = new TextField();
			changeScreenState.text = "Change Screen State";
			changeScreenState.selectable = false;
			changeScreenState.addEventListener(MouseEvent.CLICK, onChangeScreenState);
			addChild(changeScreenState);
			
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			stage.addEventListener(FullScreenEvent.FULL_SCREEN, onToggleFullScreen);
			stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
		}
		
		private function onChangeScreenState(event:Event = null):void
		{
			if(stage.displayState == StageDisplayState.NORMAL)
				stage.displayState = StageDisplayState.FULL_SCREEN;
			else
				stage.displayState = StageDisplayState.NORMAL;
		}
		
		private function onToggleFullScreen(event:FullScreenEvent):void
		{
			trace("is app in full screen? "+event.fullScreen);
		}
		
		private function onKeyDown(event:KeyboardEvent):void
		{
			if(event.keyCode == Keyboard.SPACE)
			{
				trace("event target : " + event.target +
						"\n\tevent keycode : " + event.keyCode);
			}
		}
	}
}

Up to surprise, KeyboardEvent.KEY_UP listener does the same job, perfectly fine, without sending extra KeyboardEvent with SPACE keyCode! Of course, this doesn’t apply when application state changes to normal, from full.

So, in a way the solution to this is either only use KeyboardEvent.KEY_UP event listener(s) or, remove event listener registered with KeyboardEvent.KEY_DOWN while switching from normal screen state of application to full screen, after some dummy time, (re)register listener for KeyboardEvent.KEY_DOWN !

I am yet not sure why FullScreenEvent event comes with KeyboardEvent event instance propagating through!

Exploring Himalayan Valleys

It’s been more than a month since I already returned from the vacation, but this summer reminds me to write and ruminate about it!

Yes, already excited since planned. The journey began from Chandigarh, a shared capital of Punjab and Haryana, 2 neighboring states. We reached Chandigarh on 28th March, 2010 morning.

Plan was to catch booked taxi and have a quick city tour of Chandigarh. But the taxi operator had some problems with the reserved taxi and driver. Also he could not manage for alternate.
With another contact of my uncle, somehow managed to get another taxi, fortunately, with that delay we could adjust the schedule to reach Mandi, by skipping Chandigarh sight seeing!

We reached Mandi, a pre destination place for halt on 28th late evening. Almost everybody was tired.

We again started for Manali on 29th morning. On the way to Manali, we found one of the best utility of gravitation force, an automated ropeway to transfer goods – between higher peak to lower peak in diagonal distance!

Automated Ropeway 1

Automated Ropeway 1

Automated Ropeway 2

Automated Ropeway 2

Idea was simply good. Use of 2 trolleys, one for carrying goods, another (with heavier water containers) for pulling goods to upper side!
Passing appx. 5 KM long tunnel and beautiful mountain ranges, we were following Beas river almost throughout route.

Tunnel

Beas River

Beas River

Rope Bridge on Beas River

Rope Bridge on Beas River

During this, I realized the value of rope, especially in mountaineering. Be it making a bridge or transfer of goods, ropes make these things dynamic!

View from Hotel @ Manali

View from Hotel @ Manali

We touched Manali by evening; found and finalized stay at a hotel, little away from main city and market, but closer to nature, a very peaceful area.

Hidimba Temple

Hidimba Temple

The next day we visited Hidimba Temple. The design was very different, had a touch of Mongolian building style.

Apart from this, its an historical place. The building design was different from what I had seen so far, it was constructed with both stones and wooden slabs as packing. Possibly this combination is an invention to protect against earthquake shocks and frequently changing weather.

Yak, near Hidimba Temple, Manali

Yak, near Hidimba Temple, Manali

I saw ‘live – moving’ yak, for the first time in my life!

The owner asked for Rs. 50 for taking photo, after it was captured!!! The owner should not keep his yak in public then!!!! :D

Evening @ Manali Market

Evening @ Manali Market

Manali was beggar free, one good point especially being a tourist place.

Way to Rohtang Pass

Way to Rohtang Pass

Snow fall @ Rohtang Pass

Snow fall @ Rohtang Pass

Snowsuit

Snowsuit

Get ready to ski

Get ready to ski

Bhojpatra

Bhojpatra

On 30th March early morning started for Rohtang Pass, probably most exciting, adventurous and beautiful place.

Rain wear was available on rent on the way to Rohtang Pass. Gum boots and snow resistant suit made all look fatty. I made some attempts to learn skiing, but low air pressure and suddenly started snow fall stopped me for more attempts. But experience and feeling being under snow fall was amazing!

The icy hills are best condition for Bhojapatra – an ancient white tree to grow self. These trees’ skin was used to write notes in old days.

My evening was bit boring as elders were busy shopping in Manali market. I passed time by updating through tweets.

The financial year may although passed with a tag like ‘recession’, but end was definitely going to override such tags as I was enjoying vacation at heavenly places.

On financial year end day, we visited Naggar, a nearby place to Manali. It has renovated and hotel turned castle. Although castle is not gigantic viz campus, the structure and design is perhaps unique.

Naggar Castle 1

Naggar Castle 1

Naggar Castle 2

Naggar Castle 2

Naggar Castle 3

Naggar Castle 3

Naggar Castle 4

Naggar Castle 4

Next visit was a Buddha Monastery and Manikaran, a holy place for the Sikhs, situated on the banks of river Parvati.

Buddha Monastery 1

Buddha Monastery 1

Buddha Monastery 2

Buddha Monastery 2

Buddha Monastery 3

Buddha Monastery 3

Buddha Monastery 4

Buddha Monastery 4

Manikaran

Manikaran Gurudwara

Rafting in Beas 1

Rafting in Beas 1

Rafting in Beas 2

Rafting in Beas 2

By evening, shopping of shawls from Factory outlets in Kullu highway was finished. Thereafter I enjoyed water rafting in Beas river with my daddy and rafting crews!

For safety measure, the authority was running a parallel raft boat with ours! This was probably next major adventurous and exciting experience for me, next to Rohtang.

On fools day, morning we left Manali and started for Dharmashala, another place with scenic beauty and closest place to headquarter of the Lamas. Highway was beautiful as Tea gardens passed by.

We settled at a hotel in Dharmashala by evening.

On 2nd April only plan was to visit McLeod Ganj, the most important and famous place, especially for Buddhist. This place in fact was giving essence like a capital of Tibet, too many Tibetians and foreigners.

McLeod Ganj 1

McLeod Ganj 1

McLeod Ganj 2

McLeod Ganj 2

McLeod Ganj 3

McLeod Ganj 3

McLeod Ganj 4

McLeod Ganj 4

3rd April was driving us towards end of vacation. We reached Pathankot railway station to catch train for return journey, by noon.

Visit to such places definitely expects good driving skills for any vehicle owner. The only thing we could not enjoy much is food, either traditional food in Himachal Pradesh consists more of non veg or that food is not much in focus. The only served Punjabi dishes, that we ate, were also not always satisfactory. But we did not go to such places to have food, so was ok to compromise at.

We had Ramesh & Bharati Dave, a known couple in Gujarati literature, with us, during the trip. To us, they are living encyclopedia of trees and flowers. Having them with us was another angle of fun and chance to grab some knowledge about nature! Sapling and shawls were the only shopping that they did!

Photos of trip are available at here, credit goes to my dad, brother and me! :)

%d bloggers like this: