Thursday, July 9, 2015

Cordova hurdles


Cordova setup steps (windows 7 + Android):

Pre-requisites
1. Download npm here  and setup. Its a package management tool to install cordova.
2. JDK 7
3. Android emulator or device. Ant might be required for older versions. newer version use gradle build system.

Setup cordova CLI (command line client)
1. From DOS prompt run >npm install -g cordova@x.x.x
Note: cordova specific version can be installed using x.x.x eg: 5.0.0 or remove it for default latest version.

Create Cordova project
  1. cordova create directoryName com.package AppName
  2. cd directoryName
  3. cordova platform add android@x.x.x
  4. cordova plugin add
  5. cordova build android/ios --release
  6. cordova run android/ios --device

Setup on eclipse
1. Follow blog
This is still work in progress... Will share once it is done.

Debug
Add Debug Console plugin to your project by running this command:
$ cordova plugin add org.apache.cordova.console
To see debug output adb logcat CordovaLog, but generates too much logs.

Or use remote debugging http://jsconsole.com/remote-debugging.html (way better logs)

Gotchas
  1. cordova build command first time downloads gradle. On cordova 5.1 had issue downloading it, the fix was as below :
    1. Stackoverflow link
    2. update ..\platforms\android\cordova\lib\build.js (search for .zip and replace to ../[].zip)
  2. Cordova plugin are downloaded from npm package (like maven). 
  3. aidl files failed to compile :  fix
aidl -I/Volumes/work/projects/java/android/cordova/hello/platforms/android/src -p/Volumes/work/projects/java/frameworks/android-sdk-mac_x86/platforms/android-22/framework.aidl IInAppBillingService.aidl

4. Android API 16+ requires JDK 7+ only. And mac Snow Leopard 32 bit doesnt support JDK 7 anymore (ridiculous). Mac is such a waste of time when it comes to backward compatibility.



5. I am yet to figure out how to run cordova(newer projects) from eclipse. Running from CLI is fine, but how can we debug like logcat in eclipse Juno?


6. The cordova.js ,cordova.jar and cordova_plugin.js are generated under \platforms\android\build\intermediates\assets\debug\www\cordova.js
Note the way plugins are included in later version of cordova is through JS.
7. To rename app : http://www.stefangordon.com/renaming-your-cordova-application/


Ionic

https://ionicframework.com/docs/intro/installation/ 1. npm install -g ionic cordova 2. ionic start letsgo-mobile blank 3. cd letsgo-mobile 4. ionic serve




Tuesday, August 19, 2014

Automation in agriculture/gardening - Drip irrigation


Given :
 Water is required by plants(roots only),
When :
 The traditional way of putting water using hose pipes
Then
  Water and energy(electricity) is wasted

Solution:
  Drip irrigate the plant roots like human circulatory system (network of pipes - remember to use T-bends at 90 degrees to avoid lag in flow).
  Reuse existing overhead tank to circulate the water into this system. (Overhead tank uses gravity. Fill this tank when sun shines using a solar powered water pump to make it self sustaining)
     -Also can add a rain water harvesting system
  Connect automatic timer on the tap to irrigate water on certain times of day/month/year
  Sow the seeds and enjoy self sustaining flower and fruit plants.
 
  Scale it to a farm!

Exceptions 
  Cost of building overhead tank (reuse existing tank or water tap)
  Clogging of pipes (needs maintenance)

Practicals
  This i will try and post in detail when in India.
 
Links:
  Drip irrigation timer only on Alibaba or ebay(buy pipes and connectors in local shop to save Rs.) :
 
 Pls leave a comment if you find it useful. That would keep me motivated :)

सर्वे भवन्तु सुखिनः
सर्वे सन्तु निरामयाः
सर्वे भद्राणि पश्यन्तु
मा कश्चिद्दुःखभाग्भवेत्
शान्तिः शान्तिः शान्तिः ॥  meaning

Wednesday, June 18, 2014

Preparing for a Solar adventure (Solar PV based systems)

"I am bored of software" Its all virtual in the mind, no concrete matter. Hmmn.. I am thinking of building a hardware system(solar PV based farm) :)
I aim to blog here my findings as i venture into the Solar adventure and open source all the knowledge gained in the due course.

With the solar energy based electricity production catching up in Germany and other western countries, I have been thinking for a while the best way to get into this space to contribute and monetize by setting up a self sustainable business as sun light is abundant in India.

Germany seems to be leading in the solar energy space (They call it Energiewende  or energy revolution). This revolution seems to be because of rising energy prices(as they were major importers of electricity), the Fukushima nuclear disaster and government policy to give good feed in rates for energy producers. 


Given
   India has temperature of  around 25-40 degrees around the year
   Solar PV panels cost have reduced drastically (0.4 to 0.7$/w)
   Indian Government has solar feed in tariff with net metering(in Karnataka) at subsidized rates
   Current goverment has backing for solar energy (considering Gujrath's model)
When
   Solar PV based system are setup as farms or on roof tops
Then
   Electricity can be generated and fed into existing grid. With two way net metering we can run the meter backwards. Carbon footprint can be reduced and a small profit made

Exceptions and unknowns
   Power companies like BESCOM might be unwilling to pay the rates and provide net metering(considering corruption in govt offices)
   Risks like fire disaster or grid tie cut off (when main grid is turned off, the unit should stop supplying power so the line man doesnt get electocuted etc ) need to be evaluated
   What if feed in tariff gets reduced drastically by government?
    Profit need to be computed:

Estimated Profits 
  Ingredients
    Solar panel  at say 0.5$/watt = Rs.25/watt a 10kwph system would cost : 2.5 lakhs
    Micro inverters (per panel inverter is better than one single inverter)
    Net meter , wires and other components
    Labour
    Land
    Permission from electricity board
 Profits
   Feed in tariff rate say Rs.12/kw . If a 10kw system runs say 10 hrs/day produces 100KW in a ideal scenario. So earning is around Rs.1200/day on a good day?? Roughly one can make Rs.30,000( $600) a month with 10kw unit (considering the feed in tariff rate is real)?? 10% returns
Note: these are rough calculations and might be wrong. will update once i get the system in place and start earning in real from these power companies.
 
Hmmm, so I need to buy the ingredients. The most important being solar panel. 2 options - Mono or poly crystalline. Mono is expensive and compact than Poly.

A Report on Design Estimation of 1MW Solar PV Plant (Utility Scale) with potential earnings is here 

The Government policies (in India)
  • Subsidy : The Ministry of New and Renewable Energy (MNRE) provides up to 30% capital subsidy for roof top systems (off-grid)
  •  Tax breaks  A company can claim 80% accelerated depreciation in the first year of installation under section 80 IC of the Indian Income Tax Code, leading to savings on income tax.
  • Renewable Purchase Obligations (RPOs) and Renewable Energy Certificates (RECs) - Under the REC mechanism, developers are eligible to receive one certificate for every 1,000 kWh of renewable electricity fed into the grid 
  • Net metering Until May 2014, four Indian states: Gujarat, Andhra Pradesh, Uttarakhand,
    Tamil Nadu and West Bengal have finalized the net metering policies. Another
    four states: Delhi, Kerala, Karnataka and Punjab have net metering policies
    in a draft stage. In Gujrath the roof top FiT price is Rs.11.21/kWh and Rs11.78/kWh


Solar PV companies in India:
  Solar panel supplier list  http://www.enfsolar.com/directory/panel/India
    http://www.evergreensolar.in/index.php  (Tamil nadu based)

Useful links
  1. BRIDGE TO INDIA is launching the INDIA SOLAR NAVIGATOR. This online, analytical tool is designed provide you with up-to-date, in-depth business insight on the Indian solar market.
  2.  Bridge to India - The India Solar handbook : download pdf

Thursday, June 12, 2014

When agile becomes Fragile

Its been a while I blogged, probably i got lazy or too busy with other things after getting married :).

Lately I was involved in a project where the so called scum master/monkey advocated and promoted Agile practices to his bosses overseas probably to get apprised, but wouldn't practice it in his own team. Probably his lack of enthusiasm, insecurity or his ways to get on top of the corporate ladder by pushing others down. God only knows. It did annoy me and can see clearly the team was getting disintegrated and drowned in misery.

There was no tester involved, no business analyst to communicate or document requirements/backlog(we had to produce the backlog and code and test and release and communicate to business and take the risk of getting something wrong as we were doing multiple roles). Just another Dev ops dude Y and me figuring out how to deal with things - digging legacy code/building the new messaging pipeline/ reverse engineer the data model/ liaise with teams and what not. This was not scrum. Just adhoc. The scrum monkey would as well shamelessly admit being a Hippocratic. It was absolute shambles - me and Y (who could spend only some time on this project as he was pulled into another project by the so called scrum monkey). I did mention him several times to get another resource and a tester, but he would simply brush it away. And with his crooked ways would ask for the build result without being involved in the design or build process and would like to take the credit when the boss would make an occasional visit? Also on the other side there was a tech ops/support team trying to coax me into dealing with their stuff applying Social engineering skills/Behavioral science/Jingoism. Well one needs to learn moral science  first and do their duty instead of troubling their colleague who is doing his job.

This was so unnatural and demotivating. Obviously good developers would run out of choice and  move on at this stage, so am I. I can see others following. One dirty fish seems to spoil the pond.

So as usual i asked Google god (our digital god who answers our prayers with search results), Why?

1. Basically we were ending up doing Cowboy coding with the boss only interested in the results - doesn't matter how you do it. And he would pull the resource to do other tasks than the main goal.  An undisciplined scrum master who doesn't care for his team but only the outcome by simply not pulling his weight.

Refer http://www.agilebuddha.com/agile/agile-is-not-ad-hoc/


2. Happiness Metric is something a scrum team should always consider along with retrospectives followed by its implementation. After all a motivated healthy and happy team will always produce good result. This does seem like the natural way of doing things.
Refer http://scrummethodology.com/happiness-metrics/



Digression
My miseries and rant apart. Let me think what was going wrong here.

Ongoing maintenance and build over legacy application is a challenging task especially with so many technologies involved built by several different minds over time. The tech ops team struggle to understand whats going inside when something breaks while the dev team struggle to build over legacy apps as there are no regression tests.
Both team need to co-exist to be an ideal Eco-system.

1. The tech stack builds up with many new technologies(Java and its loads of relatives, Mule, ESB, Oracle, Linux) and functionality while the older technologies(C, VB, websphere, messaging, Sybase, Solaris) and functionality haunt the developers. It is like renovating an old house, and the builders waste get expensive to be cleared and affects the new building blocks.

2. The old process and the new process need to match up. The bosses expect the migration to be done somehow.

3. The programming mindset - Stored procedural programming vs Object oriented programming mindset is hard to change IMHO. After years of PL/SQL programming ones brain gets hard wired to its style. As industry moves to OOP technologies like Java there needs a shift of ones thinking which has a hard learning curve involved.

4. As developers move out of team for grazing into greener pastures - there is a huge loss to the team. The new comers are left with no choice but to reverse engineer the code to understand the functionality as the docs might not exist or tend to get obsolete. Moreover the flat documentation can never be as complete as the relational application code. The code is the only source for latest functionality.

5. Working with the existing complex data model can get harder with time if no good process is followed.Also applications cross referencing database tables make them more tightly coupled

But there is no real process for that defined in Agile afaik for a moving target (for porting legacy apps along with ongoing maintenance ). From the bosses point of view Agile might mean getting things done fast with less resource so one can secure a bonus or promotion fast.

Hmmn thats how corporates work isn't it or am I being too pessimistic?

A similar pattern i could see in the past with another media company and could see stressed out developers and tech ops. Someone was not pulling his weight or there was no one to see the big picture and steer/guide the team(perhaps an Architects role) or was there a lack of process for this moving target?



More later...

Thursday, January 10, 2013

iPhone/Android source and monitization

Some websites to buy iphone/android app source or components from:



App monetization:
1. Interstitial Ad(full mobile): quite annoying for user, but better revenue than banner ads for authors
     Chartboost
     Revmob - earnings were good on first day only

2. Banner ads
   Adwhirl is best as a free mediation layer for many ad networks like below
   Admob - average eCpm(0.2 - 0.9). Fill rate 90%+
   iAd(ios only) - good eCpm . But fill rate is lower
   Millenial media - low eCpm (0.2). Fill rate is good.
   inMobi - good eCpm(0.7). Fill rate is 60%
   Leadbolt - low eCpm(0.2) so far

eCPM = effective $ earned per 1000 requests.   [ (earnings/impressions) *1000 ]

Mostly eCpm varies on country of Ad request, rating, etc.

3. Paid app (usually lite and a paid version should be released)
4. Free app with paid in-app purchase after some usage.

   

Monday, August 6, 2012

Hardware/Software stack:
 iPhone 3Gs having iOS 5.1.1(latest as of today). 

The Xcdode 4.2 failed to detect this iphone as it has support only till SDK 5.0..

[UPDATE]
 Follow this : http://stackoverflow.com/questions/9614918/xcode-4-2-snow-leopard-and-ios-5-1
Copy few ios 5.1 folders/version.plist/SDK and you are ready

The below steps will mostly not work. Too many to tackle.. Best go with the link above..tada
--------------

I had 2 choices for getting iPhone ready for development:

1. Upgrade Xcode to 4.4
       - This was not possible as Xcode 4.4 would only run on Lion or more (i have snow leopard which i thought is pretty new ,,but no you need the lion) . So had to drop this option as it was too much effort and setup for new OS..

2. Downgrade iPhone iOS 5.1 to 5.0 or less
        - Had to look around for jailbreaking iphone . But no luck using iFaith, redsn0w.
        - iFaith 1.4.2 runs on windows support SHSH extract till ios 5.0 only. But as i did not had shsh saved. I was literally screwed. Googled more, then found TinyUmbrella5.11.01 had support to extract SHSH from 5.1 . With a catch - in advanced tab uncheck Request SHSH from cydia - very important.
If you not uncheck you get the below error:
05/21/2012 17:10:21.796 CYDIA DOES NOT HAVE YOUR SHSH FOR iPhone3GS 4.3.5 (8L1) THERE IS NO WAY FOR YOU TO GET THEM. SORRY. YOU ARE JUST TOO LATE.

Then got the SHSH for 4.1 from TinyUmbrella. I had an SHSH for 4.1, using it i downloaded the IPSW (the iOS) file from iFaith --> Download from server..

So far so good, it is downloading IPSW for 4.1 SHSH file.  

Hope these steps saves time for someone stuck with iOS 5.1.1 as I spent almost 10 hrs figuring and downloading softwares. 

References:

Glossary:
SHSH blobs  -  Hash signature system (Signature HaSH blobs) to control manual software downgrades on iPhonesiPads, and iPod touches (using this we download IPSW file from iFaith)
IPSW file - iOS package i think
iFaith - Tool for downgrading iOs 5.1 to 5.0 or less
TinyUmbrella - Tool to extract SHSH (details below

Friday, June 29, 2012

iphone Game development - Game ON

To realize my dream of awesome game development(iphone for now), I am posting my learnings here so its easy for anyone interested to get started:

Tech stack for game development:
  - Mac laptop (running Snow leopard. Intel based only)
  - Xcode - IDE like eclipse
  - Cocos 2d : gaming engine library (built on top of C based open gl )
  - Box 2d : physics engine(optional)
  - Objective C : much like C++ progging language
  - Graphic designer (hire a freelancer)

Other:
  - App store account ($100/ year registration)
  - Provisioning profile (kind of license which should be there before deploying to app store)
  - Motivation : money, self satisfaction, something i can give to the world and keep my self engaged

Risks:
    - Initial learning curve. Best to follow some samples and get the basic stuff running to avoid disappointment
    - Game ideas can be copied. You will quickly loose revenue
    - Users may not like the game if its paid. (So release free with ads + paid)
    - Is it worth the time and money?
    - Stress, work life balance? (No pain no gain)

Learn Cocos2d
    Justin Dike tutorial (best material for starters)
    Sample game starter kit  (paid, but i think its worth it)

If you are here and have similar interests and want to join me in designing awesome games, please give me a shout. Group learning and coding is fun

Thursday, June 28, 2012

Ibastis mappings

Gotchas with Sybase
1. Getting error 'JZ0SM: Unsupported SQL type 0'

I've not seen Sybase require this, but DB2 needs the type for null

values.  In general it's a good idea for portability.  MySQL is a

little loose with what it accepts, for better or worse.

2.  If you are using jconn3. driver, ensure you set the sybase jdbc url with
    &DYNAMIC_PREPARE=true
Without this jdbc query may silently fail even with precision errors.

More http://old.nabble.com/ibatis---Sybase-String-problem-td22554502.html


Wednesday, June 13, 2012

jQuery - take 2

Its been a while i used jquery + javascript (mostly into boring GWT as it takes ages to convert java to script)

Lucky i got back into jquery work now. Will be posting more findings here. This post will be dedicated for all the good jquery plugins i evaluate

The good thing about jquery is its plugings which can be easily integrated. But the question is what is the best of the lot and its version compatibility (as some cease development or are hobby projects ):

Jquery tools: Tabs + validator + tooltip + date inputs (the usual requirements - all in one) - ceased development, but saves you from looking around for handling these features.

Blackbird : Debugging console for jquery. Look no more for debug tools as its the one. Its like log4j with console.





Tuesday, June 5, 2012

Mobile app mania - Phonegap vs Titanium

Sandeep: want platform independent Mobile apps?
Sandeep: Trouble trying to build interface for different mobile platforms
          - iOS - bitten by enigmatic xcode UI designer
          - Stuck with android complex xml for simple UI layout
?
God: Use HTML + css for frontend.. with phonegap plugin to call the native API.
Trade off: No native look and feel. but HTML +css should do most of the time

Choices: Phonegap or Titanium
Have used phonegap, but limitation is that it is browser based and only one web view so cant do cross domain site based apps. [edit: There is a child browser plugin for that]
yet to figure out how titanium works(though it sounds promising for native view)

Here is some comparison to start with:
http://developer.appcelerator.com/blog/2012/05/comparing-titanium-and-phonegap.html

And man started creating platform independent apps ...ha ha haah

Friday, April 27, 2012

Scotland scientists

So many amazing scientists were born here

Some I know
Alexander Fleming - Pencillin
James Watt - steam engine
Alexander Graham Bell - telephone
James maxwell - mathematician
John Napier - mathematician
Sean connery -sherlock holmes creator Conan Doyle


Monday, April 2, 2012

Mobile Ad Services (adwhirl)

Apps are the current market buzzword esp. with explosive smart phone sales.

A developer can earn some side income by releasing value add apps for free and integrating a small ad. A few learnings on ad revenue so far(more to come)

- You can generate better revenue if your ad request are filled (fill rate) and eCPM($ earned per thousand impression) will be improved.
      - Ad networks use some algorithm to decide if it has to serve the ad or not which impact the fill rate. 
      - I think if the click through is high, then that will impact the fill rate, etc
      - The aim should be to improve the fill rate

- To increase your fill rate, you would need to integrate with serveral ad networks (admob does it behind the scenes, millenial media does provide integration with just a few networks, but still their fill rate is quite low)
- Adwhirl can be a good option to increase fill rate and reduce dependency on one single ad provider.
      -Adwhirl is an opensource ad integration library which fills this gap of using multiple ad service networks for the  
        same banner. It is a one stop shop to integrate most of the ad networks. Moreover it is opensource, hence you
        can virtually implement any ad network.
      - % of ad to be served can be controlled in their site(this is retrieved using their free mediation server. How nice of them, it is all for free :) )

Gotchas:
1. Adwhirl needs other ad service provider libraries in the class path.
2. Adsense needs additional parameters like company name, app name etc.
3. A mediation server is run by adwhirl.com for free which provides configuration (about what % of ad service to use etc). You can optionally run your own server if required
4. Adwhirl is a loosely couple integration and relies on third party libraries, so have to test that the ad is served individually.



Friday, November 18, 2011

Logo

Logo do matter as it is the first impression created by your app

Couple of options:
Online logo generator: (Most claim to be freee, but they are not..pay $blah..)
1. Freelogoservices.com (have good collection of logos. but its paid service -  £29 for unlimited logos).

DIY:
Build an apple like logo using Gimp
http://wickedowl.blogspot.com/2006/07/creating-apples-shiny-table-effect.html
http://www.ehow.com/how_6896439_make-apple_like-3d-logo.html

Metallic text (using gimp):
http://penguinpetes.com/b2evo/index.php?p=351

Online image editor : www.sumopaint.com

Note:
Windows desktop icon should be 32x32 px.
Apple icons are 57x57px
Android icons are  96, 72, 48, or 36 pixels wide, depending on screen densit

Tuesday, October 25, 2011

Android apps

Some useful android apps:

1. Data on demand - shutsdown wifi/3g when screen goes off. Saving bandwith/power. Nice green app
2. 3g watchdog - watch and optionally disable 3g if quota limit is reached. Very useful to avoid surprise bills for 3g overuse.
3. Advanced task killer


The apps i have released on Android market are below(these are quite crappy but hope to improve them as i find time)
1. Radio hindi



2. Ship control game  - It still needs lot  of improvement. But hey its my first android game..so be easy on me :)


Friday, August 12, 2011

Online Code generators

A nice code generator for php:
http://www.phpscaffold.com/

Java Spring projects:
http://www.springfuse.com/

Planning to write my junit code generator using japa..


Thursday, July 7, 2011

Keyboard music

Coding for long time can leave you stressed.

So why not heal yourself as you code with some soothing music? This program plays random notes when you type a key. The idea is to create soothing music for coders or anyone who spends time typing in front of pc(instead of the boring keyboard noise).

Guitar and piano notes are included in the bundle, but user can add their own notes as mentioned in steps to run(wiki link below).

Also planning to include auto suggest with it sometime (so you dont have to type a long sentence or word again).

Its partly implemented, but disabled in code at the moment.

 

There is lot more work to be done, like better notes etc. (I am no music expert). The basic idea is built and can be improved easily.

If you wish to contribute for develoopment, please let me know. The project will always be open sourced.

 

For details please follow wiki notes here

The project is open sourced here

 

Disclaimer:1.  The code captures keystrokes provided by JNativeHook.jar and it should not be used for malicious intent. I will be in no way held responsible for any misuse.

               2. The code built so far is basic and not yet fully tested. There is a possibility of notes played loud,etc. Please beware of this.

 



Gods Debris By Scott Adams

For a change have been reading a novel called Gods Debris by Scott Adams(creator of Dilbert comics). 

It has no plot as such but an exchange of ideas/ a perspective about god/ belief system/universe/ etc. 

In short it expands your imagination .

Though some concepts are abstract and made up, I enjoyed Gods debris and have started with his next book The Religion war (futuristic novel about Christianity and Islam) .

 Update: read The religion war. Quite nice! I am a fan of Scott Adams (his blog)

Gods Debris ebook is free here

The Religion War ebook can be found here

 

 



Friday, July 1, 2011

When Windows+Eclipse+Firefox slow down

All big garbage collected programs have a problem on MS Windows where, if you iconify them, the OS drastically reduces the working set size, making its VM pages available to other processes. When you restore the program, then the first time it tries to do a garbage collect (which could be several times a second) it can suffer a long pause while it brings in almost its entire virtual memory footprint in order to chase references. I've seen it take as long as 200 seconds to do this, during which time the program is unusable.

Workaround : use windows key + D or show desktop buttton instead of minimize.
More details

For eclipse performance imporvement, update shortcut as below:
"C:\Program Files\eclipse\eclipse.exe" -vm c:\j2sdk1.4.2\jre\bin\javaw.exe -vmargs -Xms64m -Xmx384m -XX:CompileThreshold=5 -XX:+UseParallelGC
The flags are discussed on the following website: http://www.burnthacker.com/archives/000049.html.



Tuesday, June 28, 2011

SMTP email testing

 To run local integration test, install apache james mail server.
 1. Start the server by [james]\bin\run.bat
 2. Map the email host to you smtp server if required in hosts file
 3. Run the test and check [james]\apps\james\var\mail\outgoing for emails sent out

 To add a user in james :
  1. telnet localhost 4555
  2. login as root/root
  3. adduser [name] [pass]
Also refer : james-2.3.2\apps\james\SAR-INF\config.xml for default user/pass
Code to read email link

Simples



Friday, April 15, 2011

Drools - Java Rules engine

An implementation of JSR 94  spec.
More here