menu

Monday, April 3, 2017

Resolving fetchMock issues when testing isomorphic-fetch [Reactjs]

Hi peeps,

This is a quickie, and the content is totally reactjs.
If you are using fetchMock to simulate your API requests and you happend to use isomorphic-fetch for better support of fetch in browsers, you might have noticed that how fetchMock doesn't work. The solution is that you have to change the isomorphic-fetch import as below

import fetch from isomorphic-fetch

should be changed to

import isomorphic-fetch

This is highlighted in the fetchMock documentation.


Wednesday, February 15, 2017

Using Google Clound Platform SDK installer behind a proxy

Hi,

In the latest version of Google App Engine SDK, the SDK comes as a part of the Google Cloud Platform SDK. (There's an option to select between that or the legacy SDK). But since new is always better, I tried out the new SDK installer.

Here's the python 2.7 installer for 64bit systems link :

Then I simply followed the instructions, which is to extract the files to *anywhere* and then simply run the install.sh script. This script basically adds aliases to the bashrc and downloads some components from the google servers. The issue is that I was behind a proxy and there was no instruction available on how to configure the installer script to use the proxy. So here's how.

Run the following commands replacing the proxy settings as necessary

Wednesday, November 23, 2016

Developing a 2D Board game with Python / Pygame : Part 2

Hi all,

Please check Part 1 before continuing to this section
In the last section, we covered board generation, leaving the actual network connectivity creation to this section.

Part 2 : Connecting to the server

Step 1 : Configure the game server

The given server (included in the github link), is made in C# as a Visual Studio Solution. Thus to run it
1) Download and extract the source
2) Install Visual Studio
3) Open lk.ac.mrt.cse.pc11/Tanks_server.sln
4) Once done, run the solution to open up the UI and the CLI

NOTE: IF you need to access the server from another machine, you need to make it listen to an interface IP. For that open up App.config and change the IP Address to something you get from ipconfig command.

Now with some analysis of the code and structure of the game server, the following can be seen.

Tuesday, November 22, 2016

Developing a 2D Board game with Python / Pygame : Part 1

Hi all,
Quick introduction is the game is called Tanks and more details about the game will follow later since right now is time critical.
But just to begin,
1) The board is a 20x20 grid
2) 5 players play at the same time
3) There are 4 different times of terrain - Ground, Brick wall, Water, Stone wall
5) Other sprites include coins and health packs
6) Multiplayer, it communicated through a central socket-server

What you need

1) python 2.7 installed
2) pygame library installed

Friday, August 12, 2016

Writing integration tests for Apache CXF REST API that supports XML and JSON

Hey folks,

This comes up as a part of my ongoing GSoC project. The task as described in an earlier post was simple. To convert a SOAP service to REST. Yet the individual issues that comes up along the way sums up to writing those separate blog posts about them.

So this is the last phase of the project that I'm currently carrying out, that is to write integration tests for the now available REST web service. Now have the following assumptions before we go through the procedure

1) The service is implemented with Apache CXF and JAX-RS
2) It can consume and produce both XML and JSON based requests and responses
3) Service is up and running and accessible at https://localhost:5000/rest
4) Service has a one service method called getResponse that accepts XML or JSON requests (in a predefined way) and outputs according to the headers given.

Friday, August 5, 2016

[GSoC 2016] REST implementation for WSO2 IS Entitlement Service

Hi all,

This post is to document the process followed, decisions taken and implementations done in implementing the REST service for WSO2 Identity Server's Entitlement Service. This was done as a GSoC project. If you are nto familiar with the WSO2 Identity Server, please first refer to my previous post which would answer most your questions.

Abbreviations

IS                      -  Identity Server
XACML           -  eXtensible Access Control Markup Language
REST                -  Representational state transfer
JSON                -  JavaScript Object Notation

Thursday, July 14, 2016

phpmyadmin not found on LAMP install in Ubuntu 16.04+

Hey folks,

Just another quick one. Recently I installed Ubuntu 16.04 and Ubuntu 16.10 both uses the shinny new php7.0. And some newer version of apache as well. And both times when I installed phpmyadmin, and go to http://127.0.0.1/phpmyadmin or http://127.0.0.1/phpmyadmin
it gives me a simple, annoying 404!

Well there's a lot of solutions for this in Q&A threads, but for me the only working solution is that, you need to Include the phpmyadmin configuration at the end of the apache2 configuration, so that apache knows that phpmyadmin exists. Here's how

1) Open up apache configurations

sudo nano /etc/apache2/apache2.conf

2) Add the following to the very end

Include /etc/phpmyadmin/apache.conf

3) Save and exist and then restart the apache server

sudo service apache2 restart

4) Browse http://127.0.0.1/phpmyadmin

WORKS GREAT!!

Saturday, May 21, 2016

Tomcat error when deploying web app : addFilter, addServlet NoSuchMethodException

Hey peeps,

Just a quick update on something i found today. I was hacking things with a tomcat server (wso2 IS). My need was to duplicate a webapp and make some changes as I like. But when I changed those 'stuff' in the webapp source I had to specifically mention some dependency versions (build tool was maven) rather than obtaining them from the parent pom.

And when I generated the war and deployed it in the server I got the following error



Solution

It turns out that the reason for this error has nothing to do with the actual content of the web.xml
But a dependency mismatch
That is some libraries in your WEB-INF\lib directory of the war file is conflicting with some libraries already loaded. So the fix was for me to delete the lib directory completely and deploy which worked!

But according to some stackoverflow answers, deleting just tomcat-catalina.jar and/or all tomcat-*.jars will fix it

Happy Deploying! :D

Monday, April 11, 2016

Laravel 5 : Getting started for collaborative development

Hey folks,

Laravel, for those who aren't familiar is a php framework that is widely gaining popularity these days. This came into my attention when I had to implement an HR system in PHP. Usually I would have gone with Symfony, which I know has a larger support base. But the issue is that Symfony has a huge learning curve and I have to work with a team. Laravel on the hand has a less difficult learning procedure and it can be used to start implementation rapidly.

But Laravel it self is really confusing sometimes. Mostly if you are not familiar to tools like composer and git (for collaborative development). So here's a quick tutorial in which I mention steps I took to setup Laravel and a git repo for development.

Friday, March 25, 2016

WSO2 Identity Server : Understanding XACML 3.0 policies, implementing them in IS and testing with SoapUI

Hi folks,

This is a weird way to resume a blog that was silent for a long time. But I guess this will do. The reason for this post is mainly GSoC 16' which is currently happening. And in selecting a project for it, I came up with WSO2 which has middleware based products. And with time constraints, I was forced to study a system overnight and thought that documenting what I found would be beneficial for those who try to do the same later.

So the question here is what exactly WSO2 Identity Server does?

Saturday, August 1, 2015

Explained: Finding the Longest Increasing Subsequence using Segment Tree

Hey guys,

Well this is just random but i found out that for my most disappointment that the tutorials on the above topic arent really useful for the novice. Most tutorials just give the procedure in english or the code but not both. Hence I'm trying to write something human-understandable in the simplest english i know :D

Problem

Find the length of the longest increasing subsequence in a given array of integers
For the context of the tutorial we assume all integers are positive hence 0 will be our minimum.
Read more about in the wikipedia article

Wednesday, July 1, 2015

Things I wish someone told me when doing Haskell

Hey people,

Long time not posts, yeah i know. Stuck with useless stuff. Finally got some time for a post. This would really be a bundle of snippets mainly for the beginner haskell coders that will soon be frustrated with all the functional elements. I'll try to keep this updated with every new frustration i get :D

IO

Doing IO was the worst thing i had to go through in haskell. As you know that haskell wont allow usual IO in a function, you have to explicitly use do to use a IO command

StdIn as a String


StdIn as an integer/double


Using a function inside a do block with IO

Friday, January 9, 2015

Function to generate a list of floating point numbers with defined precision in a given range in haskell

Well the top says it all
I'll just put the code here :)

n -  no of precisions
st - starting limit
en - ending limit



Tuesday, December 30, 2014

ExceptionInInitializerError when AsyncTask is used inside a Timer

Hey people,

A quick one here, I was working on a late project and got this weird bug. Tested my android app on 4.2 working all fine but suddenly it crashed on everything below it. Here's the code cause the error

See the problem here is that according to Android Dev, the Async Task MUST run in the UI thread. But the Timer is having it's own seperate thread. So, with the help of Stackoverflow :D I managed a solution where the Timer contains a Handler which would be running in the UI thread. Modified code

Refer http://stackoverflow.com/questions/17049516/android-gingerbread-cant-create-handler-inside-thread-that-has-not-called-loop for more references

Cya People

Thursday, December 25, 2014

Easily adding animations when Android layout is changed

Hey people,

You wont believe that I spent 1.30 hours on this
Just because i wanted to do some simple animations, like sliding/swiping when a listview of mine is updated :|
If you ever wanted to do something like, pushing list items downwards when adding a new items or pulling the rest of the layout upwards when visibility of some widget changes

just DONT, DO NOT write your own custom animations. Just add the simple property to your activity layout xml file :D yeaah that is all you have to do

Add this to your xml

android:animateLayoutChanges="true"

Thank me Later

Tuesday, December 23, 2014

Error running meteor : Unexpected mongo exit code 1. Restarting.

hey peopple,

yup the title says it, if you have searched for this specific error and came here
i know the feeling bro, FRUSTATED

here's a little background of the issue

* you installed the latest meteor version
* you created a new app
* when you try to run it

Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.

3 times in your face

DONT WORRY i got the solution

as i found out on a internet forum, this can be solved by updating your c/c++ compilers uptodate. For some stupid reason mongodb wants it that way. So lets do it.
i am assuming ubuntu environment


  1. sudo add-apt-repository ppa:ubuntu-toolchain-r/test
  2. sudo apt-get update
  3. sudo apt-get install gcc-4.6
  4. sudo apt-get install g++-4.6


and then run the meteor as usual
VIOLA!! :D


PS: there's another version of this problem

Unexpected mongo exit code 100. Restarting.

see the error code is 100 not 1
this isnt your error, this error is something related to access violation stuff and you can probably find it in internet everywhere

Happy Meteoring 

Sunday, December 21, 2014

The sidebar and content alignment problem

Spent a fortune of time figuring this out.
You have a sidebar, more like a drawer and you want the rest of the content of site to take full width of the remaining space of the page. Tried float:left float right? NOPE, here's how to do it

Getting VB.NET to work in MonoDevelop [tested in Ubuntu]

Hey follks,

Kinda strange to crash with something totally new to the blog but wth :D. Okay some background first, I recently had to go FULL time ubuntu [not by choice], but because i screwed up my Windows partition. Any how after much more blaaaaas , i wanted to develop C#, VB and ASP stuff for .net framework 4 in UBUNTU.
Strange things i know, but believe me a lot of ppl want to do those. So just like everyone else i searched google, Mono was promising and installed it. [ubuntu 11.10].

When i started Mono, I was really impressed, hell they almost ported VS2010 to ubuntu, the C# features worked great but got dissapointed when i came to the VB.NET section.

Issue

When i try to compile the VB.NET code, i get 1 error and 8 warning
8 warnings : the Assemblies not available for some bla
                    cannot find the import GTK
1 error :       Cannot find the 'Windo' class


So there i was searching the internet again and again

Solutions that i found on internet but did not work for me

1) Changing the project type for VS2008 from VS2008
Goto Edit->Preferences->Load/Save
Select VisualStudio 2008 from the dropdown
And recreate a VB.NET project

Well some said it worked but not for me :/

2) Changing the .Net framewrok type
Double click the Porject from Solution Explorer
Build -> General
Runtime Version : Mono / .Net 2.0

Again did not work for me.

And I noticed that the references of the project are all marked red, unlike when i opened a C# project, so after some seriously wasting for time i finally found this.

Solution

1) Double click References. You get Edit references dialog
2) Goto .Net Assembly tab
3) Now we are going to add all the DLL files added as references already [but not working] manually again
4) Goto /usr/lib/mono/gac [this is where all the assemblies are]
5) First we'll add the atk-sharp library
     Select atk-sharp->some-directory-with-numbres->atk-sharp.dll
     a reference will be added
6) Repeat the above for other references as well

atk-sharp
gdk-sharp
glade-sharp
glib-sharp
gtk-sharp
pango-sharp

Now try to compile the project. =VIOLA= :D
working like a baby.
I dont know why those happend but it's working finally, and its really enough for mt

Ill update for any further errors

Cyah all

Saturday, December 20, 2014

Meteor : call javascript function when there's new data on server


I was soo tired just searching about this, believe me I literally read all posts on stackoverflow regarding those keywords
What I wanna do?

Simple, there's this javascript function on client side that adds some elements to the DOM
It get the data from a data source at the server. But I want this data source to be reactive, so that when ever someother user make a change that data source, all the clients connected should feel that change through the said javascript function.

Here's the code


Make jQuery Mobile form submit using the 'Go' button in the keyboard


Some tiring problemo i got

Since i'm soo into making hybrid apps for android, i always ended up in corners like this where the native and hybrid features donot exactly match

one such place is getting that tiny 'Go' button you get in the keyboard in a form to carry out the form submission as in a native app

like this one


here's how, you just need to specify ALL you inputs in a form and make your submit button of type 'submit'


DONE ! :D