yip rug

Read this first

Super Cheap VPS

Linode , Digital Ocean , AWS ????

Screw them .. I have penny servers ..

Check out the following deals

1250 GB Storage

512 MB Ram

5000 GB Bandwidth

@ 30$ per month

https://backupsy.com/index.php ( coupon code 40PERCENT )


2GB vSwap

4 CPU cores

35GB disk space

3TB bandwidth

1Gbps uplink

@ 5$ per month



60GB disk space

4 vCPU cores

2TB bandwidth

1Gbps uplink

@ 7$/Month


3 vCores

40GB Disk


512MB vSwap

1TB Bandwidth

@ 6$/Month


Dropbox ?? Screw you , I can have a 500 GB personal dropbox using bittorrent sync at 7$ per month :) … ( Check out backupsy deal )

Continue reading →

Experiment with Embedded Solr in java and C

Solr is poster boy in search market . Generally it is used by running as HTTP server and making queries .
I was more interested in running it in embedded manner and getting results via JNI .

Following you will find the code for doing same and some problems you might face ( with solutions :) ) .

Getting the embedded solr working

    String solrDir = "/Users/TheRoot/Downloads/solr-4.7.0/example/solr/";
    container = new CoreContainer(solrDir);
    server = new EmbeddedSolrServer(container, "collection1");

This will get your basic EmbeddedSolr up and running .
Next if you want to make query and get response from the solr ; you can use the following function .

public static String query(String qstring){
    String output = null;
    ModifiableSolrParams solrParams = new ModifiableSolrParams();

Continue reading →

A generic datatype for C

    var a
    a = data(10);
    a = data("hello");
    a = data("hello","world");

The above doesnt look like a C code but will be fun to achieve .

The first problem in this case to recognize the number of inputs given to our “data” function , uhmmmmm .. but how ?? not possible in C right ? Lets see the following piece of code .

    #define NUM_ARGS( ...) NUM_ARGS_ ( __VA_ARGS__ , MAX_N())
    #define NUM_ARGS_(...) NUM_ARGS_N(__VA_ARGS__)
    #define NUM_ARGS_N(_1,_2,_3,[..],_61,_62,_63,N,...) N
    #define MAX_N() 63,62,61,60,[..],9,8,7,6,5,4,3,2,1,0

Let there be input !!



The above input need to fill _1,_2,_3…..,_61,_62,_63,N …

A is replaced at _1

B is replaced at _2

C is replaced at _3

63 is replaced at _4

62 is replaced at _5


4 is replaced at _63

Thus N will become 3 … Bingo !!

Now we need to manage our “data” . An...

Continue reading →