Category Archives: dev

Everything dev related!

Paris Air Quality app (v 1.0)

Paris Air Quality app and Widget is now available on Google-Play!
Paris Air Quality app and Widget is now available on Google-Play!

Paris Air Quality is an app I developed in two weeks.
It simply shows you the current status of air quality in percentage (It is the French standard so don’t ask me what would mean a 100% polluted air!) for Paris and Île-de-France region.

But the cool thing about this app is that first of all it works! (in contrary to the AirParif app with 10m$ budget!! -will write more about that later!-) and secondly the fact that it is based on good UX design, It has a Widget that you can put in your Android home-screen and it will update itself every once in a while without using too much of your cellphone battery! and aesthetically it is very pleasant!

Paris Air Quality app and Widget is now available on Google-Play!
Paris Air Quality app and Widget icon (app available on Google-Play)

Other features:

  • Native Android app (not web-view based like AirParif).
  • Has a beautiful and battery-efficient widget.
  • beautiful widget designed for your home-screen.
  • resizable widget with different layouts for different widget sizes.
  • It is completely free.
  • It is completely ad-free (No advertising at all).
  • Independent development.
  • No permissions required except of internet connection! (very secure)
  • Available on Google Play, Amazon and other Android Markets.
  • Easy to use (Just drop the widget on home-screen and that’s it!).
  • Open-Source.

So if you live in mentioned area (Paris and Île-de-France) go check this useful (and honestly must to have!) application on Google-market right away!

If you live in US, Canada or Mexico you can use this app (Air Quality USA) instead (an update for this is scheduled).

Air US, real-time Air quality monitoring app for USA, Canada & Mexico!

 

Air US
Air US is an application that helps you to monitor (in real time) the Air Quality Index of your area.

Long time, no post, but that was because I was super busy with different projects which I will talk about later, bu today I want to present an application I worked on during last week and is published in Google play and will be published soon in Windows phone app store as well:

Air US (Air quality in US, Canada and Mexico) <– Android

And On WP8 and up!

It’s both free and ad-free so go check it out if you live in these areas, it’s pretty useful and (to be honest) kind of addictive (it was at least for me)

It shows you AQI (Air Quality Index) in real time for up to 5 different important components (depending on the availability of data in your area).

Knowing the air quality will help you be healthier by adapting your physical activities and your preparation for the matter. Just check it out!

PS: I’ll let you know when the WP8 version is ready.  It is ready–> Air US on WP8 store!

mim,

BaaS (Backend as a service) review – 2014

MBaaS (Mobile Backend as a Service)
MBaaS (Mobile Backend as a Service)

For my projects I was studying some of the services available today and to keep track of the results in future and also to share them with anyone who would be interested I’ll put a list of services I found promising here:

Have a good day!
mim, 😉

Using Objects like Arrays in JavaScript.

In some situations, there can be a lot of advantages of using Objects instead of Arrays in JavaScript.
But some of programmers just don’t like objects! Here I don’t want to enter this debate about why or what! I just want to show you how to use a JavaScript Object like an Array!

So one of the very useful methods of Arrays (in JavaScript! otherwise it’s just the opposite side let’s say in Java for example!) is that you can get and set the length of any array any-time you want! then you can iterate between items inside the array and do literally any thing you want (you can do this because you know the length!).

And you can do the exact (well in pragmatic point of view) same thing in new versions of JavaScript with Objects too! using the Keys function:

Object.keys(obj);

But you should know that: first of all this wasn’t there in older versions of JavaScript (So your code wouldn’t function properly in old IE browsers for instance) and secondary, in proprietary / customized versions of JavaScript that aren’t that fast to get up to date with the advances of JavaScript, you won’t probably have it even in the future! (for example in Adobe products they are still using VERY old versions of JS in their VERY modern products), so what can you do about it?

Here is the solution!
If your problem is old browsers / IE, you can use sophisticated Amazon solution which will make the functionality available in most of the older browsers /IE:

Please note that you can use this function in other environments as well, but it would be a little bit over-kill since in embedded systems for example you may know most of the times the version of JavaScript and if it’s available or not so you don’t need to and probably shouldn’t check it!

And for the environments, where you know that uses an older version of JavaScript and/or this function doesn’t exist, you can write a very simple function yourself that will tell you the length of the object properties and the key values (since knowing only the length won’t help you, since you can’t access properties by index!) like so:


Here by passing an object to this function you will get back an array of Object property keys and of-course you can get the length from it like a simple array as well!

As you see it is a super simple and very short function!

See you later, mim, 😉

An Icon set for my InDesign plugin!

An Icon-set for my InDesign plugin!
An Icon-set for my InDesign plugin!

Here is the Icon-set I designed for my InDesign plugin! I guess I like the last one on the right in the second row more! what you think?!

Also I am still thinking about the name of the plugin but sofar I guess I’ll stick with the one I picked from the beginning! “InDesign ToolKit!” 😉

PS: Ah! And I designed a title logo as well! I’ll post it later! I didn’t need to design this many logos and icons, but I like to! :))

How to change app Icon in Processing (for Windows)

Processing 2 logo (Processing.org)
Processing 2 logo (Processing.org)

For one of my projects I was looking up to see how and if I can change the exported application Icon from Processing and surprisingly found nothing!
In-fact looks like that you can change Icons easily in Mac OS:

by using “Show Package Contents” and editing Info.plist or replacing sketch.icns with something more exciting.

But you are out of luck in Windows! although you can change the title bar’s icon using frame object like:

Although even that doesn’t work perfectly since you are limited to a 16×16 px icon which looks horrible (when you use alt-tab for instance in Windows, etc.) But anyway I didn’t find anything explaining how to change the application icon itself (that means even before running it), then I tried a few resource hacker/ editor tool-kits, like Resource Editor by Anders Melander, XN Resource Editor by Colin Wilson, to edit embedded icons later-on (after exporting the app) which kind of work (you’ll be able to just edit a few icon resolutions and your pretty much limited to the tools you have access to in the toolkit, and you have to repeat the task every-time you want to rebuild the app!), hmm! yeah but not very convenient! so I started digging in processing source files and found out you have a better chance if you edit and build it yourself but then I found even an easier way to do it!

Solution:

1. Create your Multi-page / multi-resolution Icon file (I did a lot of research to find a way to do this too! and only “good” options available (to my knowledge) are 1. using ImageMagick command line tool, and  2. awesome free GIMP (Even Adobe CS doesn’t have this options!) (you need: 16×16, 32×32, 48×48, 64×64, 128×128, 256×256 px versions of it in one file with color depth of 32)

2. Duplicate your *.ico file and change the extension of one of them to *.icns then rename both of them to “sketch” ( sketch.icns and sketch.ico )

3. In your processing folder (where you installed/copied the software) navigate to these two address:
(processing-2.2.x)\modes\java\application
and:
(processing-2.2.x)\modes\java\application\template.app\Contents\Resources

4. make a back-up of sketch.ico and sketch.icns files and replace the original ones with your new files (please be aware that it will change the icons in all the exported apps forever and not just for the current sketch -if there is any!-  (as far as you don’t restore your backed-up icon files))

5. That’s it! now if you export your app it will have the new icons (the file icon viewable from the explorer) and of-course to change the title-bar icon you should still use the code mentioned above.

– Alright! Please let me know if you had any questions or if it didn’t work for you, 😉
,mim

Hard at work on an InDesign plugin! (wait for beta testing release!)

In-Design plugin preview (one of the few dialogs of the UI)
In-Design plugin preview (one of the few dialogs of the UI)

Once I said:

Developing software is like panning for gold, you may find something that shines to you, but before getting it to market you just don’t know if it is real!!

I’m hard at work on my first InDesign plugin! and that’s why I’m not that active for the moment here! It’s been more than two weeks already that I started working on it and it’s going very well so far!

So I think I’ll be able to announce a pre-release beta testing call for it in few days (or weeks perhaps!), I worked really hard on it and the plugin with all its options won’t be available for free ( will be free during beta testing) but I will release a free version as well for folks just like myself who can’t afford paying for these kind of stuff! After all I hope to be able to sell a few of it after all these nights staying awake and writing codes till morning!

Please let me know if you are interested in the beta release.
Also I have to pick a name for my plugin! so please let me know if you have an idea about it! :))

Ok, back to work! 😉 have a good day!

manage paths in Adobe Extend-Script

Adobe Exten-Script (source: internet)
Adobe Exten-Script (source: internet)

Managing paths obtained from Adobe Extend-Script, Specially when you want to share these paths with an external 3th application (to do things which aren’t possible with just ExtendScript) is kind of difficult!
For instance let’s say we want to get the Path of an In-Design file being opened (and in front) in in-Design, we may simply do:


And get:

alert(app.activeDocument.filePath);
alert(app.activeDocument.filePath);

But there is obviously 3 (+1 not obvious here!) possible problems with this path (even if you can transfer that variable as easily as shout it out in an alert! look at #3):

  1. the Tilde (~) character at the beginning, an environment variable meaning “Home Directory“, which is not a recognizable standard character in all the different programing environments (for instance it’d be %~dp0 in Batch scripting and user.home, (more or less!) in Java) although it is supposed to be the absolute path using above code!
  2. existence of Slash characters (/) in the path instead of Backslash (\), making it hard (not so much tho!) to send it through a JSON package for example (or save it in a batch file -again- for instance), be-cause in most environments it’d be considered as a escape character and not a path level separator.
  3. It is an object and not a string (apparently!) and you can send, save or sometimes even use the myPath variable for instance directly! (it will give you an [object] instead of the path, which I guess should be the parent File object itself)
  4. in addition if our file wasn’t in our Desktop folder and was in a disk drive instead, we would have this problem too:
    alert(app.activeDocument.filePath);
    alert(app.activeDocument.filePath);

    as you can see, an additional Slash character (/) before the Drive letter (c)! which is incomprehensible to me why it is!! but it seems that Extend-Script itself doesn’t have any problem with it, but as I said when you want o communicate with 3th party apps it will become a problem immediately!

  5.     So as you may guess there is a lot of solutions for any and each of mentioned problems, but here I just wanted to suggest the most convenient one I figured out after trying a lot of different shenanigan techniques!
    Here we used Regular Expression Patterns to Replace() all (by using the g pseudo) the Slashes with Backslashes and by using fsName instead of filePath eliminating other problems (like getting “relative paths” (or fake absolutes!) instead of absolutes and the beginning slash character)
    And the result:

    alert(app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/');
    alert(app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, ‘/’);

    Awesome! 😀
    Please let me know if you have a better idea to this or if you see a problem or something, I appreciate it 😉
    mim,

working with measurement units in adobe extendScript

measurement_units (img from internet)
measurement_units (img from internet)

While working with Adobe ExtendScript to extend Adobe CS features (through scripts and/or plugins), there is a good chance you need to get or set an elements dimensions (document dimensions for instance).
When you ask the Software about the dimensions, it will give you back a number, but this number could be in a lot of different units (Points, Picas, Inches, Inches Decimal, Millimeters, Centimeters, Ciceros, Agates, Pixels, etc.) and it’s gonna be the same when you set a number as well.
There is a lot of different ways to handle this issue, like getting the unit as well and trying to convert them etc. but it may add a huge overload on your code, your time and a lot of unnecessary complexity which can make your code harder to debug as-well.

Here I’ll put a simple solution I use in my own codes which may come helpful to you too (This code is written for In-design but should work less or more for the whole CS collection -maybe with a bit of tweaking- ):

I just get the current document units (for both Vertical and Horizontal measurement units in In-Design), keep them in a (pair of) variable(s) (I check to see if the variable is defined before and set it if it isn’t defined already, doing this we can be sure that even if we forgot to remove the vars later on, we don’t set them to our newly defined units again), change the units (for the whole document) and run my code and then when I was done with it change it back to original units and remove the created variables.
I found this technique to be the easiest, cleanest, fastest and the most performant way to handle the units issue in extend-script.

Here is the simple code I use; two functions, one to run before the main script and one when the script was done to set everything back to what they were before we run the script:

Note: here I use the very front document but you can easily pass desired document to the function through an argument as well.