Posts

Showing posts from April, 2013

Tech Mashup 2013

Image
28 April, Tech Mashup-2013 started right on time at 1700 hours at BabarMahal Revisited. The crowd seemed to be more than the number of expected visitors. Though program was scheduled to start from 1700hours, visitors were there by 1630 hours. And that was awesome. Though the event was not much like an official event. The event can be said to be gathering of techies around Kathmandu. The time was possibly one of the best time scheduled since most of the techies get leave by the time the program started. And that possibly could be the reason why the program was a great success. Though no conferences were there as planned but it was a great time for all the techies and enterpreneurs. Startups really had a good platform to interact with each other and get to know more. During the events various startups in kathmandu had their stalls around to interact. To list some of them: Karkhana Biruwa Ventures Wikimedia Google Developers Nepal Mozilla Nepal FOSS Nepal Robotics Assoc...

hack_me level 1

Image
Hey there, how you doing? Today I was on facebook and one of the a member in a group I have joined posted a hack_me file. And I thought it would be great to share with you guys too. The original author of this hack_me file is Bishnu Bidari . But I have made some modification to this file and uploaded to box for you guys to try. Its not a complex one to solve. But yeah for newbies to reverse engineering, definitely it will be a great one to solve. Once you solve this. You can comment in the comment box. And be ready for the next level. Very soon I will be posting level 2.

Emacs is also your hexeditor

Image
  Emacs is an extensible, customizable text editor. And one of a great choice for hackers. It is not just a text editor but a hackers tool too. Emacs can be used as hexeditor . There's a small trick to turn emacs into hexeditor. You just need to press alt+x. Then at the bottom of the editor you will see M-x and a cursor blinking. Now you just type hex-mode and hit ENTER. You emacs is now a hexeditor. Viola !!! and now you can edit you binary files in hex mode. 

Tech Mashup on 28th April 2013

Image
Tech Mashup 'A Speed Networking Event' is being organized by  Janaki Technology and Biruwa Venture on 28th April, 2013 at BabarMahal Revisited, Kathmandu . The program is scheduled to be started at 5PM and will end at 9PM on Sunday. The main objective of the event is to: bring technological enthusiasts together discussion and promotion of startup culture in Nepal  have a session for a talk by Silicon Valley Entrepreneur Bowei Gai Attendees will be able to: share knowledge and experiences getting introduced to startups ad tech communities in Nepal getting opportunities to contribute/ be part of tech communities interact with tech enthusiasts For more information and latest updates about the event you can check out : http://www.facebook.com/events/253977551414652/

Unit Testing with CodeIgniter

Image
Being a programmer at some point, you'll come to the situation of testing you code. However TDD is extreme programming way. Though most of the PHP programmers don't go the extreme programming. So Lets go through some unit testing . Here in this post, I am going to talk about CodeIgniter 's unit_testing library. Then manual page is at http://ellislab.com/codeigniter/user-guide/libraries/unit_testing.html . Here is a quick jump start code for unit testing: <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Tester extends CI_Controller {     public function index()     {         //Test 1         $this->load->library('unit_test');         $test = 1 + 1;         $expected_result = 2;         $test_name = 'Adds one plus one';         $this->uni...

New Theme

Image
Though I have not posting anything to this blog. I have now modified the theme of this blog. Now, it has a better look then the previous one. I have downloaded this theme from  blogtemplate4u.com/blogger-templates/blogger/  which is really a great repository of blogger themes. I have tweaked the theme and have made it to work for me. Very soon, I am planning to have articles on this blog too. So be waiting till then.

Checking if mod_rewrite module exists on apache

mod_rewrite is a great Apache modules that helps in rewriting URLs. It has been extensively used for pretty  URLs. So, before we get writing php project, its better to check if more_rewrite exists in the Apache Web Server we are running. To do this, here is a small snippet of php that can be used to check if mod_rewrite is enabled or not on your Apache server. <?php $mods= apache_get_modules(); if(in_array('mod_rewrite', apache_get_modules())==1){ echo "mod_rewrite exist "; }else{ echo "mode_rewrite module doesn't exist"; } ?>

Database Migration with South in Django

If you are a Django programmer and you have not come across 'South'  then you have been going through this problem of changing the fields in a model and you just can't run syncdb for that. The only you got is to delete the table schema or the database. If this is your case, you have come to the right place. There is this concept called migration and south does this very well i.e. you don't have to further delete your table schema or database. Lets get quick into it. I will be giving you the shortcut way for migration. For this you don't have to start a brand new project. You can start right away with your existing project. However in this example I will take you with a new project. First of you need to install south. That's pretty easy with our friendly pip command. So open terminal and hit pip install south To verify south is installed. Open interactive python console and try 'import south', if you don't get ImportError then you are ready to go al...

Writing to CSV file

In this post we are going to write some data to csv file. For this, you have to install csv module if its not installed. To check if its installed in python interpreter type import csv. If it gives error 'ImportError: No module named csv'. Then you have to install it. Your favorite installer pip can be a good way to go. try:     import csv except ImportError:     print "csv module not installed" a=[1,2,3,4,5] b=['Hulk','Iron Man','SpiderMan','Batman','Super Man'] f=open('superhero.csv','a+') writer=csv.writer(f) writer.writerow(['Id','Name']) for (ind,val) in zip(a,b):     writer.writerow([ind,val]) f.close() First four line does import csv module,if its not installed it prints the error 'csv module not installed'. Now a and b has the data we will be writing to csv file. For your case you may get the data from database. Now we have a new file superhero.csv file created in the fourth line. ...

Understanding Enumerate function in python

Here in this post, I am going to talk about enumerate, a python function. Okay, here's a scenario: We have a=['a','b','c','d'] and we want to print all the elements in a along with their index. Now what we do is: for i in xrange(len(a)):      print i,a[i] This can be done using enumerate as: for i,item in enumerate(a):      print i,item These both have the results as: 0 a 1 b 2 c 3 d  What if we want the index to start form 100? then we can do as: for i,item in enumerate(a,start=100):      print i,item Now the output becomes  100 a 101 b 102 c 103 d You can check python documentation too.

Argument Unpacking

Argument Unpacking is a very handy way of passing variables to functions.Since lists, tuples, dictionaries are used as containers in python. We can pass them to functions too.  Lets take an example of a function : import math def distance_from_origin(x,y):     return math.sqrt((x**2)+(y**2)) Now, we have a point p1(3,4) represented in python as p1=(3,4). Normally what we do is distance_from_origin(3,4).  But with argument unpacking we can use the above function as: distance_from_origin(*p1). The results for both distance_from_origin(3,4) and distance_from_origin(*p1) will be same where p1=(3,4). And now let consider another scenario where we represent the point p1 as p1={'x':3,'y':4}. Then we can use the above function as distance_from_origin(**p1). Which will return the result same. Note: Make sure the number of arguments taken by the function is equal to the number of the elements in the container. i.e. for the function distance_from_origin...

How to make an archive page

Image
While you are developing a website with posts or news articles. You need to have an archive page. The reason is as time passes the posts get higher in number and its difficult to display all the news in a single page. Besides the loading time takes long. Also finding out articles on a particular date becomes very hard. For the reason we need to write an archive page. Here in this post we will be writing an archive page. So lets get started. Random articles ->Archived articles First of all, lets structure the table schema that we are going to use for our articles. The table schema I use for a simple article is as follows: CREATE TABLE IF NOT EXISTS `post` (   `id` int(11) NOT NULL,   `title` varchar(200) NOT NULL,   `author` varchar(100) NOT NULL,   `content` text NOT NULL,   `tags` varchar(400) NOT NULL,   `posted_on` datetime NOT NULL,   `visibility` tinyint(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; From the table structure you should be ...