Categories

Archives

Shocking news! New Firefox 3.5 is out

Would like to congratulate Mozilla with the new release, as part of shock the world firefox release i would to say if your still using IE then your browser could officially not be classified as modern browser, congratulation. ahhahahahaha

Let us bring down the web with firefox 3.5

Mozilla is calling all firefox user to twit, share, email or tell your friends that firefox 3.5 will be release on july 2, 2:50 in hong kong time. The marketing site of this, shock the web about firefox 3.5 release, is at
http://www.spreadfirefox.com/shiretokoshock-campaign

Last year we brought down Mozilla’s server, now let’s bring down the web.

Importance of Internal Tools for Software Company

I lot of software company don’t see the importance of internal tools for their company, what they see is how the final product should look like and they don’t care how its build. Building one software or website from the ground up or using open source framework might be good especially for the programmers who wanted to learn stuff, but this will becomes a problem especially when a new project arrives and that project looks like the previous one but its quite unique in some sort of way. Ideally programmers must program with modules or no reinventing the wheel kind of code but most of the time, especially with online media company or small company, programmers are pressured by the dead line, their peers, the lack of help from other programmers, the team’s man count (total number of people working on the project) and the outcome of the project according to the their supervisor, other team and the client. Now with all of this to worry about, will the programmer even have the time to think of making the code usable for future uses or making it a generic code?

Internal tools or tools that only your company uses, provide and maintained are important not just for the developer but also for the company, i’m no expert at in-house based software but i do build tools that could help other programmer in my team, and in the context of that here are the reason why i think internal tools are important.

1) Internal tools provides a way for your company to be above other company – having your own tools which caters to the business requirements of your company shows what your company is all about meaning you can recognize a person with the tools that he/she always use. Imagine your company is a java based company, one of your programmer uses eclipse, other uses netbeans, and others who think they are hardcore java programmers uses notepad and ant. While this is okay, your company should enforce one IDE or atleast create a small plugin that will only work with one IDE thus unconsciously making them use that IDE (lol).

2) Internal tools limit the repetitive stuff that your programmers are doing thus making a better profit for your company – most of the time programmers will rather do the same stuff again and again then build something (or even try to build something or worst even think of building something) that could help them in the future. Classic example would be copying file from one directory to another, renaming it with accordance to the new project and then changing all of the class path/package path/import path. Believe me most of programmers are doing this since they think its a lot easier and they are used to doing it.

3) Internal tools could be one of your company’s assets in the future – in context of internal tools is internal software then example of these are google’s gmail, moderator and app engine. Internal tools starts relatively small with relatively small target output but as we all know software evolves so it evolves until the time that it could eventually be a product. There are a lot of products in the IT world that just started as internal tools for their company.

4) Internal tools keeps your programmers – programmers will be bound to the tools that you provide, while this is bad for them, its good for the company. Now there is a solution to this and that is to involve them with the creation of those internal tools, they will not only know the inner workings of your company’s tool but they will be trained as well, making them an asset to your company.

5) and Internal tools motivates your programmers to think of more important things than what they think is important – what? Example: On visual studio from Microsoft, if your company has the custom components (instead of writing from ground or copying from previous project) and your programmer is about to make a software that is base on that component. Now with that custom component panel (i dont know what its called) your programmers can just drag and drop that piece of stuff, this now points us to the meaning of the statement above. Programmer will now think of the importance of the component with regards to the business logic then thinking of how the component should work or even how to create a component like that.

To conclude, I like to think that programmers will change their mindset depending on which situation they are in, you provide them with tools they will think about the business logic, your dont provide them the tools they will think about building the software. Like fishing you provide them with a fishing rod, they will think of catching one fish at a time, you provide them with a net, they will think of catching a lot of fish at a time.

For those people who think cool now i can tell my boss to start doing internal tools for our company, please be warned that your boss or even your co-programmers will laugh or think that you are making fun with the whole thing. Especially when you tell them that you want to automate most of the stuff by building internal tools, they would listen but will not take you seriously. Been there, done that, and it just makes me sad that the stuff i created are just meant to help me and not other team members or at least some of them and it makes me sad too that the stuff i created is not maintained. But i learn, i gain and i see the importance of it.

Hope this helps

HTML 5 Audio Player

Away from android and created an HTML5 audio player. I created it coz i cannot sleep so thats like 3-4 hours, if you found bugs then you know why. lol

http://monmonja.com/html5audio/

And please support the artist that i used on the playlist. Thanks

Drawing with Canvas in Android

For list of android tutorial click here

If you had been reading previous post then you’ll know i’m not a java guy, i literally spend hours trying to figure out how canvas works perfectly on java. Then i remember that javascript/html5 has canvas too, so i revisited this one (haven’t visited it for almost half a year) https://developer.mozilla.org/en/drawing_graphics_with_canvas and see that i must use paths (2nd example, beginPath) rather than drawing point by point. So together with this article http://www.droidnova.com/playing-with-graphics-in-android-part-iv,182.html. I come up with a pretty descend drawing app.

To do this:
Copy the whole code from droidnova the replace the following.

On your Activity

private ArrayList _graphics = new ArrayList();
private Paint mPaint;
@Override
public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new DrawingPanel(this));
        mPaint = new Paint();
        mPaint.setDither(true);
        mPaint.setColor(0xFFFFFF00);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeJoin(Paint.Join.ROUND);
        mPaint.setStrokeCap(Paint.Cap.ROUND);
        mPaint.setStrokeWidth(3);
}

On your SurfaceView

@Override
public boolean onTouchEvent(MotionEvent event) {
	synchronized (_thread.getSurfaceHolder()) {
		if(event.getAction() == MotionEvent.ACTION_DOWN){
            		path = new Path();
            		path.moveTo(event.getX(), event.getY());
            		path.lineTo(event.getX(), event.getY());
            	}else if(event.getAction() == MotionEvent.ACTION_MOVE){
            		path.lineTo(event.getX(), event.getY());
            	}else if(event.getAction() == MotionEvent.ACTION_UP){
            		path.lineTo(event.getX(), event.getY());
            		_graphics.add(path);
            	}
            	return true;
	}
}
@Override
public void onDraw(Canvas canvas) {
	for (Path path : _graphics) {
		//canvas.drawPoint(graphic.x, graphic.y, mPaint);
		canvas.drawPath(path, mPaint);
	}
}

Explanation
We create a path and start that path when the MotionEvent is down, or when the user first touch the screen, then add a lineTo, the x and y when the user moves his fingers. Then stop and push the path we had build to our array of Paths.
public boolean onTouchEvent(MotionEvent event) { …. }

Then during the draw function we loop through the array and print them on our canvas.
public void onDraw(Canvas canvas) { … }

Sources
CanvasDrawing.java

References
http://www.droidnova.com/playing-with-graphics-in-android-part-iv,182.html
https://developer.mozilla.org/en/drawing_graphics_with_canvas
Android IRC – irc://freenode/android-dev

Implement GestureDetector in Android

For list of android tutorial click here

You want to implement Gesture on your Android, gladly android has a build in Simple GestureDetector for you. Here is how you use it

private GestureDetector mGestureDetector;
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGestureDetector = new GestureDetector(this, new LearnGestureListener());
}
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (mGestureDetector.onTouchEvent(event))
        return true;
    else
        return false;
}
class LearnGestureListener extends GestureDetector.SimpleOnGestureListener{
    @Override
    public boolean onSingleTapUp(MotionEvent ev) {
        Log.d("onSingleTapUp",ev.toString());
        return true;
    }
    @Override
    public void onShowPress(MotionEvent ev) {
        Log.d("onShowPress",ev.toString());
    }
    @Override
    public void onLongPress(MotionEvent ev) {
        Log.d("onLongPress",ev.toString());
    }
    @Override
    public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
        Log.d("onScroll",e1.toString());
        return true;
    }
    @Override
    public boolean onDown(MotionEvent ev) {
        Log.d("onDownd",ev.toString());
        return true;
    }
    @Override
    public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
        Log.d("d",e1.toString());
        Log.d("e2",e2.toString());
        return true;
    }
}

Explanation
First we create a GestureDetector instance
private GestureDetector mGestureDetector;

Then we create a GestureListener for us to listen
class LearnGestureListener extends GestureDetector.SimpleOnGestureListener{ …… }

After creating those 2, we bind our listener to our GestureDetector instance
mGestureDetector = new GestureDetector(this, new LearnGestureListener());

Lastly we need to know where the event listener will be trigger, that is where onTouchEvent comes in
public boolean onTouchEvent(MotionEvent event) {
if (mGestureDetector.onTouchEvent(event)) …..
}

** The function on our LearnGestureListener class have logical name except onFling which means on swipe.

Reference
Code Shogun
Calandar Android App

Trace your post data in server side using HttpPost in Android

By default you could trace your variables or your post data (or even get data) using breakpoints, but after that what happens between android and your server is a bit hard to trace specially if somewhere a long the way there’s an error on your post data. This piece of code is from my flash experiences where the firebug or httpwatch or even charles cannot see the flash requesting the server. This is done on php but it could be used on other server side languages since its just echo command from linux based or mac or unix based os.

exec("echo '". addslashes(print_r($_REQUEST,true)) . addslashes(print_r($_FILES,true)). "' > /Applications/xampp/htdocs/something.out");

Explanation
As you can see it will print the array and echo that array to something.out. You could open something.out with vi or any texteditor.

**NOTE
* There are some servers that cannot use exec, for this you have to call your System Administrator
* For java, take a look at Runtime, there is something like runtime.exec(”command”)