Harit, in his own thoughts…

June 30, 2009

Flex application & new fonts

Filed under: Flex / AS, Internet, Programming — Tags: , , , , , — haritkothari @ 5:21 PM

A typical requirement was to provide some means so that anyone can upload / add new font(s) and the same can be used by Flex application. The Flex project should not require recompilation process.

Font, as a TTF or FON file cannot be used unless embedded, but that requires recompilation.

Searching around net gave me a way to solve this gave me a reasonable good solution.

Instead of specifying external styles such as <mx:Style source=”assets/styles/fonts.css”/> I used StyleManager.

Any change in fonts.css requires project recompilation to get the change in effect.

So, I compiled fonts.css using mxmlc fonts.css . This compiled CSS to SWF.

Then I loaded fonts at runtime using StyleManager.loadStyleDeclarations(”fonts.swf”, true, true);

And that’s it….! The font(s) inside fonts.swf can be used and that gives the same effect as embedded.

June 22, 2009

RIA in a new avtar with Flash Builder 4

Filed under: Blog, Flex / AS, Programming — Tags: , , , , , , — haritkothari @ 8:13 PM

Adobe Flash Builder, formerly Flex Builder is already out with beta tag at present. Personally, I dislike the renamed brand as Flash Builder. Already, many have misconception that Flash and Flex are similar! The only common point is that both supports ActionScript (ECMA 335), but so what? Application of both suits are totally different. Of course, the SDK brand remains same, Flex SDK version 4, Gumbo.

It is near to Adobe’s Creative Suite family. In Flash Builder 4, you can work with Flash MovieClip, import designs from Catalyst. So is pointer in that direction.

Data centric features are really attractive, be it data binding or data object like Hibrnate in java, representing data as POJO. But, this is limited to CRUD only. Flex 4 has backward compatibility – with halo components!

Features with newer IDE is welcomed, especially network monitor. This eliminates need of httpfox and such third party browser plug-in!

Overall, Flex 4 seems to be reached to the community expectations! :) Here is something more. Tim Buntel says this.

Adobe Flash Builder, formerly Flex Builder is already out with beta tag at present. Personally, I dislike the renamed brand as Flash Builder. Of course, the SDK brand remains same, Flex SDK version 4, Gumbo.

It is near to Adobe’s Creative Suite family. In Flash Builder 4, you can play with Flash MovieClip, import designs from Catalyst. So is that pointer.

Data centric features are really attractive, be it data binding or data object like in Hibrnate with java, representing data as POJO. But, this is limited to CRUD only. Flex 4 has backward compatibility – with halo components (I am yet not sure about the level)!

Features with newer IDE is welcomed, especially network monitor. This eliminates need of httpfox and such third party browser plug-in!

Overall, Flex 4 seems to be reached to the community expectations! :)

June 8, 2009

Moon Mission

Filed under: Camera, Fun, Inspiration, Photography, personal — Tags: , , , , , , — haritkothari @ 7:35 PM

This weekend, Saturday night a sudden power failure in our area stopped many activities, but gave me a chance. Moisture in air drove everybody to go on terrace. Suddenly an idea clicked in my mind to have photography experiment on my dad’s Nikon D60 DSLR camera.

Full moon gave another opportunity. Here are few results….

Once again...

Once again...

Moon with co-star, photo taken with improper settings led to the blur photograph.

Not bad

Not bad

Good photo with co-star far away, but acceptable result and concentration.

I felt this photo best – it has a costar visible, rough surface on moon (no Hubble telescope is used! :p), sharpness is at expectedly best level.

Mission accomplished!

May 29, 2009

Flex (Flash Player) – DPI and input/output

Filed under: Flex / AS, Internet, Programming, webApp — Tags: , , , , , , , , , , — haritkothari @ 5:22 PM

DPI is often confused with screen resolution. Actually when screen resolution changes (in pixel height x width) the DPI rate is not necessarily changed.

In most cases DPI remains same, unless changed intentionally. In simple language, increasing screen resolution will allow more dots to be displayed on screen, by decreasing distance between each dot. Increasing DPI rate of screen but keeping resolution will increase number of dots per inch; by decreasing dot thickness, and that will eventually result into more dots in whole screen, with unchanged resolution.

When image resolution comes into picture, DPI plays role to consider depth of an Image. More the DPIs, better is the image – depth.
Two similar looking image (at its original size) may have different DPIs. The image with higher DPI rate, if zoomed in, will not get blurred or distorted very easily.

DPI is the somewhat similar concept of mega pixel – the camera term.

This term and its effect came into picture when I started input and output to real wprld from Flex application!
Flex application (or flash player) accepts width, height, x, y or such dimension properties in pixels only. The real world deals with inch, foot, centimeter or any such unit.

So where the game is?

Above simple question puzzles many.
widthInch = widthPixels/DPI is the key!

Say you have image with 500 pixels, width in inch will be 500/DPI. So if DPI is 96, then width is 500/96inches.

In case of flash player, DPI rate is 96.
So if I want to display an image in 2 inches width, I need to set image width to 2*96 pixels. This ignores Image (physical image file) and its DPI rate as I am going to display in flash player, not any image editor.

Also, this bug post is strange upto my knowledge. Flash Player’s DPI seems constant, ignoring screen DPI.

May 4, 2009

Color Fill in Flex

Filed under: Flex / AS, Programming — haritkothari @ 12:08 PM

<mx:Script>
	<![CDATA[
		private function fill(event:MouseEvent):void
		{
			var data:BitmapData = Bitmap(imageObject.content).bitmapData;
			data.floodFill(event.localX,event.localY,0x00ffff);  // replace 0x00ffff with your choice of color
		}
	]]>
</mx:Script>
<mx:Image id="imageObject" source="...." click="fill(event)" />

This few lines simply fills selected or defined color to DisplayObject / Image like fill tool of any Paint tool.

May 3, 2009

Gondal – a model town

Last weekend, I visited Gondal, a famous town of Saurashtra, Gujarat. The town is located appx. 100 kilometers away from Rajkot.

Although, Gondal is having a status of town with few statistical parameters like population, infrastructure, etc. following are remarks about the town.

  • Town planning has been good since the time of Bhagawadsinhji. The roads have more than required – good enough margins and well maintained footh paths in almost every street.
  • The town is peaceful.
  • Town is rich with good institutes in variety of subjects
  • The very well famous, encyclopedia of Gujarati language – Bhagwadgomandal, had been developed by King Bhagwadsinhji. That was not a small project in any sense – collection, quality, authenticity. It is a de facto standard encyclopedia of present time, without any modification
  • The Gondal kings were fond of cars, the followers have also preserved cars in well manner. [See my photos of this visit]

Here are the photos of the visit. The photos include antic car collection too!

* Bhagwadgomandal digital downloadable edition has also been launched on 1st May, 2009.

April 18, 2009

Simple solution to a complex problem – customized Rich Text Editor

Filed under: Flex / AS, Programming — Tags: , , , , , , — haritkothari @ 5:38 PM

Apparently, creating customized RichTextEditor component in flex was looking time consuming. The rich APIs that flex provides made this task easier.

I retrieved reference of different styling controls from a hidden richTextEditor object, arranged them as per my requirement, and its done!

I thought to make a custom editor with customized control positions is a big task, but is not what I thought! :)


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
	<mx:Script>
		<![CDATA[
			import mx.controls.Button;
			import mx.controls.TextArea;
			import mx.controls.TextInput;
			import mx.controls.RichTextEditor;

			private function init():void
			{
				var textInput:TextInput = rte.linkTextInput;
				textInput.visible = false;

				var bulletsButton:Button = rte.bulletButton;
				bulletsButton.visible = false;

				var fontFamily:DisplayObject = rte.fontFamilyCombo;
				font.addChild(fontFamily);
				var fontSize:DisplayObject = rte.fontSizeCombo;
				font.addChild(fontSize);

				var alignBtns:DisplayObject = rte.alignButtons;
				effects.addChild(alignBtns);

				var boldBtn:DisplayObject = rte.boldButton;
				var italicBtn:DisplayObject = rte.italicButton;
				var underlineBtn:DisplayObject = rte.underlineButton;
				var colorPicker:DisplayObject = rte.colorPicker;
				var styles:HBox = new HBox();
				styles.addChild(boldBtn);
				styles.addChild(italicBtn);
				styles.addChild(underlineBtn);
				styles.addChild(colorPicker);
				effects.addChild(styles);

				var textArea:TextArea = rte.textArea;
				editor1.addChild(textArea);
			}
		]]>
	</mx:Script>
	<mx:VBox id="controls" width="250" height="100">
		<mx:HBox id="font" />
		<mx:HBox id="effects" />
	</mx:VBox>
	<mx:Panel id="editor1" x="300" width="300" height="300"/>
	<mx:RichTextEditor id="rte" visible="false" />
</mx:Application>

April 7, 2009

Summer Programmes @ VASCSC

Vikram A sarabhai Community Science Center, Ahmedabad has announced schedule for special programmes for this Summer – 2009.

Click below image to enlarge.

Program Page1Program Page 2

VASCSC is really a wonderful place to learn and have lot of experiments.

It had been my favorite place to hang and do experiments in vacation time during my school days.

I highly recommend at least a visit to this organisation.

March 15, 2009

Wake Up call for Indian Consumers

CERC has started consumer grievance helpline – 1800-233-0222. This helpline is toll free for BSNL Gujarat users.

This is really a welcome step by CERC in association with Consumer Affairs, Government of Gujarat. This helpline is available from 10.30 AM to 5.30 PM as per IST. (GMT +530)

CERC is very reputed non profit NGO serving and solving sonsumer complaints / grievance for its members. Its membership detail is here. You can become member by paying online instead.

To add few lines about the organisation’s prestigeous standing I can summarise few of my experiences:

  • When Vodafone Essar was Hutch, in undisclosed billed amount about Rs.500 for my postpaid mobile connection, I requested for justification and company ignored. I stopped using mobile services by paying genuine amount along with accounting statement which was genuine. Later, the company sent a legal notice that drove me to CERC. I have been member since then. CERC did some correspondance on my behalf. Company failed to respond and that proved the legal notice was no more legally valid or important!

  • HP refused to replace damaged front panel, damaged due to its design defect. Legally and as per company’s terms it is possible to replace such parts under cosmetic damaged parts category. Again, approaching CERC solved, front panel get replaced without any legal procedure.

  • In the matter of unsolicited call from ICICI Bank, I did some correspondence with bank and just by sending copy of the same to CERC taught the bank. The bank sent letter of forgiveness through courier!

Some points about CERC:

  • Complaint department listens and guides to complaint very genuinly. Consumer can feel free to express whatever his / her experience is / was.

  • Complaint department has very systemetic approach from receiving and registering complaints from its members to dealing with associated parties / business houses.

  • Genuine complaint can be registered through email to CERC as well. CERC’s method for dealing with non local complaint is really appreciative.

  • Insight, a bimonthly magazine from CERC is really worth to read. It is a leading publication in India for consumer awareness.

  • One membership serves complaint registered by his / her family members. (of course, not a joint family! :P )

  • Membership fees are normal or perhaps nominal for the kind of activities CERC does.

  • Most importantly, an Indian can be a member, get free Insight magazine and register for grievance too.

  • Different consumer product surveys carried & published by CERC are added advantage for consumers.

I highly recommend to become member of CERC, to boost its activities, to have Insight knowledge of consumer laws and if required to solve your complaints being a consumer.

March 13, 2009

How to read Mobile Feed / QR Code?

Filed under: Blog, Google, Internet, Search Engine, Software, Travel, W3C — Tags: , , , , , , , — haritkothari @ 3:02 PM

QR Code requires special software installed on your mobile to interpret the matrix / image.

The content of mobile feed are encoded and represented in 2 dimensional image in a small area.

You can get suitable QR Reader for your mobile device from Kaywa Reader.  or search google for similar softwares.

This is a good option to store contents on mobile very quickly and use as offline read.

Older Posts »

Blog at WordPress.com.