Loading... Born a day after the American Independence in Jalandhar, Punjab, India, I've spent most part of my life there. Studied till 5th standard in St. Joseph's Convent School, Jalandhar, and later had to join Apeejay School, Jalandhar as, perhaps, the former school decided boys could be troublesome in a girls' school after 5th. After completing schooling in APJ (till 12th), joined National Institute of Technology [NITJ] (again, in Jalandhar) as a Computer Science & Engineering student in 2005. During the worst period of downtime (recession), got an on-campus placement in Accenture in 2008. Graduating from college took another year after that, and finally joined Accenture in mid-2009. This is my story so far... Btw, you can find me on: google+ twitter last.fm github librarything granular steam
@AnuragBhandari twitter updates
Tech enthusiast, open source evangelist, book worm, software developer, sports fan, passionate gamer, movie buff.
Apr 18

So I’m playing around with opentaps these days. It runs pretty neatly in Linux. Simply executing a shell script it comes with autostarts a built-in Tomcat server and runs the darn thing without a hitch. opentaps under Windows is another animal!

Although opentaps comes with a similar batch script for Windows, the thing doesn’t run without errors. With JDK and all set all right, I was getting this error when visiting opentaps in browser:

HTTP Status 500 –

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
\
^
java.util.regex.Pattern.error(Pattern.java:1713)
java.util.regex.Pattern.compile(Pattern.java:1466)
java.util.regex.Pattern.(Pattern.java:1133)
java.util.regex.Pattern.compile(Pattern.java:823)
java.lang.String.split(String.java:2293)
java.lang.String.split(String.java:2335)
org.ofbiz.webapp.control.ConfigXMLReader.injectControllerIfNeeded(ConfigXMLReader.java:81)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:133)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.loadIncludes(ConfigXMLReader.java:351)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.(ConfigXMLReader.java:170)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:132)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.loadIncludes(ConfigXMLReader.java:351)
org.ofbiz.webapp.control.ConfigXMLReader$ControllerConfig.(ConfigXMLReader.java:170)
org.ofbiz.webapp.control.ConfigXMLReader.getControllerConfig(ConfigXMLReader.java:132)
org.ofbiz.webapp.control.RequestHandler.getControllerConfig(RequestHandler.java:97)
org.ofbiz.webapp.control.RequestHandler.getDefaultErrorPage(RequestHandler.java:647)
org.ofbiz.webapp.control.ControlServlet.doGet(ControlServlet.java:239)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.ofbiz.webapp.control.ContextFilter.doFilter(ContextFilter.java:270)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26 logs.
Apache Tomcat/6.0.26

It’s amazing that a simple hack posted by someone in 2011 worked for me! After modifying ConfigXMLReader.java as mentioned in the forum post, be sure to recompile opentaps by running the ant command. Don’t have ant installed? Read this.

Tagged with:
Dec 18
opensuse 13.2 Plasma 5.5

My current desktop: opensuse 13.2 Plasma 5.5

I have been away from developments in the larger Linux world since quite some time. I’m not a distrohopper any more. I’ve kinda settled down on my (childhood) favorite openSUSE. I’d installed version 13.1 about two years ago on my brand new laptop. A few days ago I decided to update my KDE 4 to Plasma 5. To be honest, the KDE Frameworks 5 fad hadn’t really caught my attention until only a week ago when I stumbled across KDE’s latest release announcement. I was bowled over by the screenshots! The looks, the elegance, the finesse… everything was perfect. So I instantly took the decision.

Sadly, there’s no officially supported way to install Plasma 5 in openSUSE 13.1. I tried, but ended up screwing my installation. So I did a full distro upgrade zypper dup. 2GB of package updates and a few hours later, I was on a 100% working openSUSE 13.2. Nothing broke during the upgrade and all my settings were preserved. Plasma 5 turned out to be as good as it had seemed in the screenshots.

I’ve been living happily ever after. True story.

P.S.: A bit off-topic: After months of inactivity, my Raspberry Pi is back on its legs after I finally fixed its SD card issue (caution: please seriously consider safely switching off your Pi every time). Now I’m working on a top secret IoT project using my Pi. Shhh…

Tagged with:
Dec 09

Here I am. With Arvixe. After 8 years with DreamHost, I made the move to save money. Shit loads of money. Hosting with DreamHost was a smooth and wonderful but expensive journey. Their support and technical expertise are unmatched, things that came in pretty handy while hosting a Linux distro (Granular, remember?).

In its heydays, Granular was a darling of experimental distro hoppers. I hope it was a worthwhile, pleasant experience for all its users. Coming January it will be 7 years since Granular’s last release. Plans for Granular 2 could not materialize for various reasons, chief among those being the decline of PC. People are going mobile. It’s not unusual for someone’s first device being a tablet or a smartphone. That translates to a huge decline in Linux userbase in an already highly saturated distro market. So I took the hard decision I to finally pull the plug on Granular, my dearest creation.

Anyway, coming back to topic. Arvixe has the most competitive prices of all quality US-based hosts. They even offer 1 domain free-for-life with all their plans. Sweet. It’s been only 5 days since the switch, but so far so good.

Something that DreamHost offers for $120/yr is available at Arvixe for just $48/yr (and they accept discount coupons :)). So paying that sort of money to DreamHost for hosting just one website (this one) didn’t make sense anymore.

Tagged with:
Apr 25

Ionic is based on Angular. Angular has views and controllers. A view’s controller is supposed to execute each time the view is opened or navigated to. In Ionic, that doesn’t happen.

Take for instance this setup: you’re building a social app that has a Login view. You’ve configured the routes such that the Home view is set to open by default. Each time the app is loaded from scratch: (i) Home view opens, (ii) login session check is performed, and (iii) user is redirected to Login view if session has expired.

Now because Home view has loaded once and its controller executed alongside, the following piece of code will NOT execute again once login is successful on Login view and user is redirected back to Home view, perhaps through $state.go.

.controller('HomeController', function ($scope) {
 
    // Read username from local storage
    $scope.userEmail = window.localStorage['app.user.email'];
 
});

So if the value stored in local storage was an empty string when HomeController ran, $scope.userEmail would still be empty string even after LoginController has updated the local storage value.

Until this very moment, I didn’t have a damning clue to this apparently illogical problem. My searches for angular controller runs only once, angular $state.go controller doesn't execute, and so on naturally went fruitless because I wasn’t searching it right! Apparently, people were not facing the same problem.

A developer on stackoverflow reported that an NG controller should actually run each time its view loads. On the same stackoverflow question, I found my answer.

As per Ionic’s official docs on ion-view:

Views are cached to improve performance. Views can be cached, which means controllers normally only load once, which may affect your controller logic. To know when a view has entered or left, events have been added that are emitted from the view’s scope.

So the problem of run-once controllers is very Ionic specific. And so is the solution. The way to go about the problem is to move your code, that’s supposed to be executed each time a view is shown, from the root of your controller to the view’s $ionicView.enter event handler.

.controller('HomeController', function ($scope) {
 
    $scope.$on('$ionicView.enter', function () {
        // All code in this function will execute each time Home view is shown
        $scope.userEmail = window.localStorage['app.user.email'];
    });
 
});

That’s it!

Tagged with:
Mar 23

I just realised that I completely forgot to cover my Brussels trip of last year. Shame on me! I had been meaning to do that since more than a year, but never really got myself to sit down and write [a lengthy post]. Before going any further, I promise that I’ll keep this one short. Mine was a short trip (just 3 days, aww shucks), but I have a lot to tell about all that I experienced in such a short while. Maybe some other time…

Visiting Brussels, Belgium, was my first foreign trip, something I absolutely enjoyed. It’s always exciting to go see, live and explore other places, cultures and people. Of course that’s not why I went there. My visit was two pronged: (a) joining my fellow folks at OpenMandriva’s stall at FOSDEM (b) delivering a lightening talk at the same event.

FOSDEM is a free event for software developers to meet, share ideas and collaborate.
Every year, thousands of developers of free and open source software from all over the world gather at the event in Brussels.

Continue reading »

Tagged with:
preload preload preload