End of Google’s Translate API.

June 1st, 2011 by Slav

Last week Adam Feldman Google’s APIs Product manager announced on the official Google Code blog that they are announcing some new apis but more importantly shutting down some old ones.
Among them a very popular Translate API.

This decision came as a big surprise to many developers, myself included. I have used this api in an CMS Flex App caled SiteManager.  SiteManager has a copy module and it’s used as a copy source for multilingual flash campaign websites. I used it to quickly generate non english copy for other versions of the site, to have a good idea how the multilingual labels and text would sit within the website whether there are any space or alignment problems etc.. It was just a great way to preview site in other languages before the officialy translated copy arrived from the client.

Now this is gone and while there are other alternatives (I recommend checking out the Microsoft Translator V2 ) this decision raises some questions about Google as a company and their relationship to developers.

I personally like(d) Google a lot, they were an example of a great open and innovative company, with a real love for developers. This love wasn’t just proclaimed but proved by many free APIs they provided for us developers.

But after this how can you trust Google API ever again ? What if this project I am working on and my customers will depend on it will be no longer working in half a year when Google decides to shut down a particular API the project uses? How am I supposed to explain that to my customers. What am I to do if they all demand their money back?

And what about their motto : “DO NO EVIL” ? Shutting down translate is clearly hurting many developers and many project, some of them non profit and designed to help other people from different countries. How is that NOT evil ?

And what’s next.. Google Maps ?!

The sad thing is , they have other alternatives like limiting the amount of queries per couple hundred a day for a free version and licencing projects that need more traffic.  Or to simply find a way to prevent an abuse. Shutting down this API is simply uncharacteristic of Google, very sudden and unkind decision. I’d expect it from Facebook but not from them. What’s going on with Google?

Posted in AS3, flash, Flex, Personal | 7 Comments »

Problem with CS5 / Flex 4.5 : Installer has detected that a machine restart is pending (solved!)

October 26th, 2010 by Slav

Few days ago , Flex 4.5 Burrito and SDK Hero was again  available for download so I went and downloaded the whole half a gig enchilada.  After running the installer there was a warning : installer has detected that system restart was pending but that could be ingnored so I went on fit the install.

Install failed miserably about the time it tried to install some microsoft libraries. Oh joy. Well , at least ALL it’s needed was a machine restart, and all would be jolly good right ?. Or so I naively thought. I couldn’t be more wrong.

No joy. The same error message. The same install fail :(

After unsucesfull googling and restarting couple of times I gave up and went to bed as it was well after my usual bedtime (1 am)..

Evening of day two…

More googling. Finding out many more people have the exactly the sameproblem with other CS5 installers , but none of them had actually any luck in resolving the issue (or bothered to write about it).

Official Adobe solution to this problem is :

a. Choose Start, type regedit in the Search box, and press Enter.

b. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager.

c. Delete the InProgress key

as stated at : http://kb2.adobe.com/cps/828/cpsid_82829.html

Now that would be awesome, if there was actually any “InProgress” key in my registry. If you read comments, that was mostly the case with most users so this advice was pretty useless.

OK. to make a long story short, I did find somebody suggesting to erase : “PendingFileRenameOperations” from registry from a certain location.

I did not find any keys in that particular location, but searching troughout the entire  registry for “PendingFileRenameOperations” revealed couple of instances.

I deleted them all and voilà ! the installer ran like a charm!

So if you have the same problem with the CS5 installer, try it, might help you as well.

Word of caution . Make sure your registry key has a NAME that matches “PendingFileRenameOperations” as there might be some keys that have this string as a data/value.

in my case it was :  HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\BackupRestore\KeysNotToRestore” key which value/data contained string “PendingFileRenameOperations” .

Do not delete those :)

Posted in Flex, Personal | 26 Comments »

My Flash on the Beach 2010 Schedule

September 15th, 2010 by Slav

Couple of people have posted their FOTB 2010 schedules on their blogs so here goes mine as well :

Sunday:

  • Workshop 5 :  Julian Dolce – Mobile Development With Flash

Monday :

  • Keynote : Andrew Shorten • Thibault Imbert • Richard Galvan • Doug Winnie
  • Conrad Winchester : Robotlegs And Signals – A Match Made In Heaven?
  • Rich Shupe : Meet Loadermax
  • Mario Klingemann : So Long, And Thanks For All The Flash
  • Stacey Mulcahy : Developing For The Social Media Douchebag – An Intro To Social Api’s
  • Robert Hodgin : Practice Makes Perfect, So What Are You Practicing?
  • Stefan Sagmeister : Design And Happiness

Tuesday

  • The Elevator Pitch
  • Jon Howard : Where In The World? Intercontinental Ballistic Flash
  • Joa Ebert : 1 1 7 11 21
  • Seb Lee-Delisle : What The Flux!?
  • Mind Candy : Managing A Monster Flash Project
  • Nando Costa : The Other Side
  • Brendan Dawes : Makers Of Things

Wednesday

  • 6 Of The Best – 10 Mins Each
  • Iain Lobb : Zero To Game Designer In 60 Minutes
  • Ralph Hauwert : Unitzeroone :: The Discontinuity
  • Frank Reitberger : Triangle Affairs
  • Peter Elst : Big Boys And Their Litl Toys
  • Jared Tarbell : The Computational Artifact
Really looking forward to the sessions of Mario, Ralph , Joa, Seb and Robert Hodgin..
See you there!

Posted in AIR, flash, Flex, Personal | Comments Off on My Flash on the Beach 2010 Schedule

Images Converter Flex Air App

September 13th, 2010 by Slav

In the previous post I introduced an air app that can parse photoshop layers and save it out as pngs or jpges. In this post I thought I upped the game a bit to make the app hopefully even more useful. I remembered the times I just needed quickly convert dozen or so icons (in ico format) to transparent pngs and there was really no elegant and quick solution. Well.. That’s thing of the past now. Enter Images Converter!

Image Converter Screenshot

Features  :

  • support for additional cca 40 image formats (via ZaaIL library) , see below full list of supported image formats.
  • support for saving individual Photoshop layers
  • support for dragging multiple files (including dragging multiple PSD files)
  • images preview
  • conversion progress feedback
  • user preferences and the window position and remembered
  • some bugs were fixed in the psd parser , so should be a bit more stable now…

The following image formats are supported : bmp, blp, cut, cur, dicom, dcm, dcx, dds, exr, ftx, fits, gif, hdr, hdp, icns, ico, icon, iff, ilbm, iwi, lif, mdl, mp3, pbm, pgm, pcx, pcd, pic, pix, png, pnm, psd, psp, pxr, raw, rot, sgi, bw, rgb, rgba, sun, texture, tga, tpl, utx, vtf, wad, wal, wbmp, wdp, xpm, jpg, jpeg, jpe, jp2

The source code can be downloaded here and the app itself here.

Enjoy!

Posted in AIR, AS3, flash, Flex, Flex 4 | 8 Comments »

Photoshop file format importer / parser in flash AS3

August 11th, 2010 by Slav

For a recent Flex CMS project I needed PSD importer so I went googling in a hope for a decent PSD parser.  I found only one somewhat usable project which was essenialy a Java port of this parser that imported psd files into flash..

The problem with this parser was in supported only very, basic, plain psd files, and adding anything (like a folder group for example ) would break it. So I decided to write my own one instead.

As you might have heard psd isn’t exactly the easiest format to parse, so rather then starting from the scratch I  based a portion of the code on the Munegon’s parser, also referenced Yet another PSD parser by Jonas Beckeman written in java. Quite helfull was this Python PSD parser and of course an official PSd file format specifications document from Adobe.It was still lot of trial and error, as even official CS format specification docs aren’t complete and contains errors. But at the end I got this :

and this is the same file in Photoshop :

What is currently supported :

PSD FILE :
  • Parsing  canvas width x height
  • parsing file color information (number of color channels, color depth, color mode)
  • parsing file’s composite bitmap snapshot
  • parsing all layers and layer folders
Layers :
  • parsing layer bitmap data
  • parsing layers bounds and position
  • parsing layer name
  • parsing layer ID
  • parsing layer blend mode
  • parsing layer colour channels
  • parsing layer alpha
  • parsing layer filters
  • parsing layer extra  properties such as : isLocked, isVisible, clipping applied
  • parsing layer type (normal, folder)
What is  not supported but planned for the future :
  • layer  masks
  • layer paths
  • layer vector shapes
  • parsing text layers as formatted string
  • parsing layers with zip (with or without prediction) compression
As photshop != flash, there are , and will be some necessary incompatibilities. Although I tried to support all the crossover features, not everything will look the same  after import
here are some gotchas :
  • Layer alpha in flash is layer opacity in Photoshop..Layer Fill values are ignored.
  • Incompatible photoshop layer blend modes are interpreted as Normal blend mode
  • Only 4 filters / layer effects are currently supported (drop shadow , inner drop shadow , glow, inner glow) but even these need to have to be applied with normal blend mode, as flash doesn’t support a filters with a different blend mode as the display object they are applied to. For example it’s perfectly possible to have an photoshop layer in screen mode with drop shadow applied in multiply mode, but it flash you don’t have a blend mode settings for a filter..
  • only layers with RAW or RLE compression are being parsed at the moment.. So if you don’t see the layer bitmap data it’s probably compressed with zip compression.
Note on the layer folders / layer groups :
Layer groups are being parsed and they are also PSDLayer class type.

To identify them you need to check for the layer type:

There are 4 layer types :LayerType_FOLDER_OPEN, LayerType_FOLDER_CLOSED , LayerType_HIDDEN and LayerType_NORMAL.

Layer folder hidden is marker for the end of the layer group. So if you want to parse the folder structure, check where the layer type folder starts and then every layer that follows is inside of that folder, until you reach layer type hidden.

How to use this parser

Very simple.  You just create instance of PSDParser (it is Singleton) and then call “parse” method , passing the content of your psd file in byte array format.

The parsing is synchronous so after that line, you will already have all the file/layers info available..

I’ve made 2 apps that should help you get started.

PSD Viewer is a simple flex app that allows you to load and view psd files and reads the supported layers, while showing their blend modes, visibility , lock, alpha , layer effect etc, in “Photoshop-esque” style. View source is enabled so you can get the source code from here. (If you don’t have the psd file to test use the “testPSD1.psd” file from flex project’s “assets” subfolder).

Simple example is a basic single class as3 app that just loads the psd file and then on click cycles through the layers, bringing the one in the back to the top.

Enjoy!

PS:  As this is still early beta, some PSD files may/will break the parser (especially those with unsupported features (see above) or those not saved in compatibility mode…

Posted in AS3, flash, Flex, Flex 4 | 32 Comments »

Flex case file nu 261.. “The mysterious case of disapearing type”

June 11th, 2010 by Slav

sample

This example is taken straight from Flex 4 Cookbook. It demonstrates how you can search inside of data grid.

Works fine, that not the problem.

The problem is , once you select any cell in data grid an return the the textfield.. you are unable to type anything! Tried different flex 4 sdks tried testing in IE, FF, Chrome .. no luck.

I had it happening in a different project, where I am working with much more complex data grid with custom item renderers and editors, so I chose Flex 4 cookbook example to test if it’s happening in a very simple scenario as well. Also that book was written by Flex experts, so I wanted to confirm it’s not me using the Flex  in the wrong way..

 EDIT: It seems it’s not happening on all computers? On my colleague’s machine this works fine it seems.Does anybody have the same problem as me ?

EDIT2: Solution found!This weird behaviour was down to the flash plugin/active X..

it wasn’t working correctly in version 10,1,50,426 .. but when I upgraded to 10,1,53,64  all works as expected! Must have been some glitch in the plugin.

anyway, I’ll leave this post here, in case somebody will have similar problem.

Posted in AS3, flash, Flex, Flex 4, Personal | 9 Comments »

Programmatic datagrid itemEditors in Flash Builder / Flex 4

June 3rd, 2010 by Slav

While building a multilingual copy editor module for Flex 4 CMS system, I’ve encountered a following problem:
I have a editable datagrid with variable heights.The problem is, default itemEditor for a datagrid is an input textfield which is a single line , but I need a multiline editor such as text area.

Solution is simple of course, you just assign a editor=”mx.controls.TextArea” in the datagrid ‘s column definition.

That might work , if you are creating a columns in mxml.

I however create columns dynamically..It turns out you can’t assign TextArea to a columns editor directly:

dataGridCol.itemEditor =  "mx.controls.TextArea"
will not work as the itemEditor must implement IFactory , which TextArea (or other similar components)  do not!

So what can you do in this case ? Well, you could build a custom class component that does implement IFactory and give’s you a newInstance method that returns the component you need..

or..

there’s much simpler solution.You put your component definition in the  fx:declarations block like this :

<fx:Declarations>
<fx:Component id="inlineEditor">
<mx:TextArea />
</fx:Component>
</fx:Declarations>

and then in your code define itemEditor refering to the id attribute of fx:Component :

datagridCol.itemEditor = inlineEditor;

Simple, isn’t it.

Posted in AS3, flash, Flex, Flex 4 | 10 Comments »

Experimenting with new Adobe Social service library

November 3rd, 2009 by Slav

Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 81 bytes) in /nfs/c02/h05/mnt/22224/domains/durej.com/html/wp-includes/class-wp-post.php on line 240