All kinds of Programming.
Optimise your database design for speed and efficiency – Part 1
Database schemas Databases are present in almost all kinds of application that need to store information in some form or the other. Web applications like blogs, cms, social networking sites or business applications etc all have a database along with the code. The database design or schema determines how the tables and their relationships are constructed. Database design is a crucial component in the overall efficiency of a database application. In this series of posts, [...]
Disable output buffering on stdout in c
Like other languages output buffering takes place even in C. Output buffering will cause output of a program to appear in chunks after long intervals, instead of each line appearing the moment it is output. To disable output buffering a very strange piece of code has to be written which looks like this Or call the fflush after every output The above is for Linux. Last Updated On : 28th March 2013
Git quick tip : How to revert a pull that got conflicts
So lets say that you finished your work and did a commit and then pulled from the remote/server repo to get yourself uptodate. But the pull resulted in conflicts in some files and now you wish to just reverse the pull process. The command is $ git merge –abort The above command will abort the merge and get back to your last/latest commit. Last Updated On : 24th March 2013
Get google adsense earnings from api in python
Adsense Management API The google adsense management api can be used to fetch adsense reports inside a web or desktop application. In this article we are going to see how to use the api in python to fetch the earnings. The documentation is available here. The code shown here is build using the samples. Setup Client ID at google api console Your python application that will try to fetch the adsense reports for some account [...]
Export table to csv in mysql
It is possible to export the contents of a table directly to csv format from within mysql. It is useful when migrating large tables. CSV export import is much faster for large tables compared to mysqldump/mysql command. To generate csv from the table use the following command Make sure that the path to the output file is writable by mysql. If the output file already exists, it would say ERROR 1086 (HY000): File ‘/tmp/result.csv’ already [...]
Ajax based streaming without polling
Streaming Streaming means to send content part by part at some intervals in the same request. Or in other words, the client is able to process the response part by part, instead of waiting for the whole transfer to complete. The best tool for streaming over the http protocol is SSE or Server Sent Events. But SSE is not available IE 10 so far. While looking for a clean solution (that is one without much [...]
Monitor progress of long running php scripts with html5 server sent events
Server sent events When running a long serverside task inside a web application it becomes very useful, if not necessary to report the progress of that task in realtime to the clientside, that is the browser. Earlier there was no easy way to do this and hacks had to be constructed to achieve such a realtime notification. Classical solutions include ajax polling, loading in a iframe with raw output, or even flash. But html5 brings [...]
Websockets with php – tutorial on basics
Websockets Websockets is a new feature available in browsers as a part of the Html5 specs that allows javascript clients to open bi directional socket connections to a server. Currently all major desktop browsers support the api. Websocket is not an independant socket protocol, but is based on the TCP protocol just like HTTP. Therefore websocket connections are basically tcp socket connections that following the websocket rules to communicate. The protocol is is documented at [...]
Revolute joint in box2d in javascript
Revolute Joint Revolute joint is a useful joint in box2d that allows 2 bodies to be pinned together at a point without restricting rotation. Lets take an example Please upgrade your browser The joint can be made between 2 dynamic bodies or between a static and dynamic body. The pendulum on left is a static circle joined to dynamic rectangle. Whereas the cart with 2 wheels is made of dynamic bodies. The joint can even [...]
Weld joint in box2d in javascript
Weld joint in box2d The weld joint can be used to join to bodies tightly at a common point. Here is an example Please upgrade your browser A weld joint is created like this The joint definition needs to know the bodies to connect and the coordinates on each of them where the weld is to be done. It also has a referenceAngle parameter that defines the angle between the 2 bodies after being welded. [...]