# Category Archives: Technical

07 Aug

As soon as I got a pc I start looking at Configuration, Connectivity [;)] and Installations. As for humans Food, Air, Water are basic necessities; for my computer I always make sure I do have perticular softwares installed. In this post I will list my 7 most used free softwares for general usage.

WordWeb:

Of-course my English vocabulary is not that strong and I constantly need to find meanings and all. Hence I always make sure I have WordWeb. It is a one-click English thesaurus and dictionary for Windows that can look up words in almost any program.
It can also look up words in web references such as the Wikipedia encyclopedia.
To find meanings and search word: Select a word and press Ctrl+Alt+W OR simply Ctrl+Right click the word

EditPlus:

This editor comes with a lot of features especially my favorites RegExp capabilities. It is a text editor, HTML editor, PHP editor, Java editor and Hex Viewer for Windows.
EditPlus also offers: Syntax highlighting for HTML, PHP, Java, C/C++, CSS, ASP, Perl and Seamless Web browser for previewing HTML pages and Uploading local files to FTP server and and more.

EPIC:

I barely use Internet Explorer. I believe Internet is not meant to be used by Internet-Explorer and vice versa. 🙂
My choice of browsers were Firefox and then I used Google Chrome a lot. But recently I’ve been using Epic Browser and I’m quite satisfied with the browsing experiance.

VLC Player:

For whom Music is ( / part of) life, a good player is very important. Winamp no doubt the best choice for playing mp3s. But you should have VLC Player as “It plays everything!”.

And what is more it can even play back the file or media if it is damaged! Missing or broken pieces are no stop to VLC, it plays all the video and audio information that’s still intact. You can also broadcast through it.

DAEMON Tools:

Computer games is something I cannot resist. My friends better know how much important it is to have a Virtual Drive in computer.
I choose DAEMON Tools, an advanced application for multiprotection emulation. It emulates max. 4 DVD-ROM drives and works with CD/DVD images created by many burning programs.
It supports:
cue/bin,iso,ccd (CloneCD),bwt (Blindwrite),mds (Media Descriptor File),cdi (Discjuggler),nrg (Nero),pdi (Instant CD/DVD),b5t(BlindWrite 5),b6t,isz.

Thanks Daemon you supported me for my NFS, FIFA, SOF, EOA, MUMMY, MAXPAINE… virtual disks 🙂

DoPdf:

PDF Converter is a software which I use many of the times. DOPdf is the free PDF converter for both commercial and personal use which I use. It’s installed as a Virtual Printer which generates PDF when given a print. To create a PDF we just have to open document / image > choose Print > Select doPDF as printer and Specify file location for PDF.

TeamViewer
Are you away from your home? I have something very important there and you need it? You need to guide some one or give a demo of something? Ay work related to Remote Access and Support over the Internet I choose TeamViewer.

TeamViewer connects to any PC or server around the world within a few seconds. You can remote control your partner’s PC as if you were sitting right in front of it.I mainly used it for downloads and guiding my parents using computer.

04 Aug

I have a Mathe-crap-matical friend. Who keeps digging into graves of dead formulas and equations and all possible Math related stuffs.
Since I started understanding Mathematics (that it’s not my cup of tea), I tried to stay away from it.

Now, that enthu creature mailed me his requirement. He says he “eat mathematics”, I prefer to stay away from such guys. But as a good friend I read his mails.

His requirement was to create a program. His requirements are:

N is a natural number falling in range [1 – 999999]
X is a number given by user with range [6000 – 20000]

You have to write a program such that you find a number N whose square root or cube root is such that the first digit of X comes in the Xth decimal place and second digit of X comes in the (X+1)th decimal place and so on…

e.g. user enters 12…
then the number N would be such that CubeRoot(N) or SqRoot(N) = dddd.ddddddddddd12

You may write program in any language.

Check screen shot to understand what it does [note the name]:

maths program

Alright, I understood the dooms day is closing in… Did you notice the decimal places correction he was asking? 6000!! Damn…

Any ways, I chose perl and accomplished the task. I’m not sure how and why he need this thing but still I hope it rested his soul. 🙂

This post is for people like me who have such math-e-manic friends.

print "Enter X:";
my $X = <STDIN>;$X=trim($X); my$N=1;
while ($N < 100) {$SQRT_VAL=$N**(1/2);$CUBERT_VAL=$N**(1/3);$PosAfterDesimal=index ($SQRT_VAL,'.');$PosOfXInSQRT =index ($SQRT_VAL,$X,$PosAfterDesimal);$PosOfXInSQRT = $PosOfXInSQRT -1;$PosAfterDesimal=index ($CUBERT_VAL,'.');$PosOfXInCUBERT =index ($CUBERT_VAL,$X, $PosAfterDesimal);$PosOfXInCUBERT= $PosOfXInCUBERT -1; # print$N . "->" . $SQRT_VAL . "->" .$X . "->> " .trim($PosOfXInSQRT). "\n"; if (trim($PosOfXInSQRT) == $X) { print$X. " matched SQRT of " . $N . " at " .$X . "th Position \n" ;
print "\t Where, N=" . $N . ", SQRT VAL=" .$SQRT_VAL . ", X=" . $X . "\n"; exit; } elsif (trim($PosOfXInCUBERT) == $X) { print$X. " matched Cube Root of " . $N . " at " .$X . "th Position \n";
print "\t Where, N=" . $N . ", CUBEROOT VAL=" .$CUBERT_VAL . ", X=" . $X . "\n"; exit; }$N++;
}
sub trim($) { my$string = shift;

if ( $string eq undef ||$string eq "" )
{
return "";
}
$string =~ s/^\s+//;$string =~ s/\s+$//; return$string;
}#trim Ends
24 May
Prologue:
Long back there were golden days of post graduation in the “great” DDIT (Now Dharamsinh Desai University), Nadiad.
Assignments, termwork and journals or everything similar was in demand – I attempted a java code as my termwork on Monday, October 03, 2005. [That’s created date of .java file, I don’t remember anything.]
A “variable check” became very famous, notorious actually, for some unmentionable reasons. It was recently mentioned by Utkarsh AKA Bapu.
Later I decided to scan each bit of my harddisk and get that 8582 code.
So here is that java code and it was working 5 years back.
I don’t remember / have termwork’s definition but code is here. Seems a simple java program to connect DB and do regular activities.

Now,
This post is a remembrance for my colleagues and the great 8582 check.

For the rest go ahead and test Java-Access-Database connectivity code.

Epilogue:
I’m no more working with Java, I understand logic and nothing else. So if atall you face any errors, go through it – you can solve it, post it here too.
Enjoy.
05 Apr

I’m hearing a lot of “NoSQL” these days. To really understand how (and) does it works, I decided to give a try on MongoDB.

MongoDB (hu*mongo*us) is an open source, scalable, high-performance, schema-free, document-oriented database written in the C++ programming language.

MongoDB is not a Relational Database Management System. The database manages collections of JSON (JavaScript Object Notation)-like documents which are stored in a binary format referred to as BSON (Binary JSON).

This post will surely get you started with the MongoDB-NoSQL.

# Installing MongoDB:

• Extract binaries
• Create data directory – default for windows C:\data\db
• Install service: Full\path\to\mongod.exe –install

If you want to change default data directory location:
Full\path\to\mongod.exe –dbpath=”\”full\path\to\”” –install

Troubleshooting Mongodb Installtion Error:
I faced while installing, if you get error like:
dbexit:
shutdown: going to close listening sockets.
shutdown: going to flush oplog…
shutdown: going to close sockets…
shutdown: waiting for fs preallocator…
shutdown: closing all files…
closeAllFiles() finished
dbexit: really exiting now

Go to: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/
Check for MongoDB
Verify the value of ImagePath is proper

This seems to be caused by not giving full-path while installing.

Okay, now we’re all set to checkout the MongoDB-NoSQL world.

There is a GUI Admin tool available phpmoadmin to simplify the MongoDB Operations.
Extract in ext directory of WAMP & Restart.

In case of error you may install Microsoft Visual C++ 2008 SP1 Redistributable Package (x86) [www.microsoft.com/downloads/details.aspx?familyid=A5C84275-3B97-4AB7-A40D-3802B2AF5FC2&displaylang=en]

# MySQL to MongoDB Database Migration:

Create CSV from MySQL:
mysql> select * into outfile “c:/TABLENAME.csv” FIELDS TERMINATED BY ‘,’ OPTIONALLY ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ from TABLENAME;
Query OK, 293911 rows affected (1 min 8.17 sec)

Import CSV to mongodb using mongoimport:
C:\>mongoimport -d DATABASENAME -c TABLENAME –file “c:\TABLENAME.csv” –type csv -f FIELD1,FIELD2…

# Using MongoDB on Windows:

On Command Prompt:
C:\MongoDB\mongodb-win32-i386-1.4.0\bin>mongo.exe
MongoDB shell version: 1.4.0
url: test
connecting to: test
type “exit” to exit
type “help” for help

By default it’s connecting to test database.
Default mongodb port is 9999.

Basic Commands

• show dbs : show database names
• show collections : show collections in current database
• show users : show users in current database
• show profile : show most recent system.profile entries with time >= 1ms
• use : set curent database to
• db.help() : help on DB methods
• db.foo.help() : help on collection methods
• db.foo.find() : list objects in collection foo
• db.foo.find( { a : 1 } ) : list objects in foo where a == 1 it result of the last line evaluated; use to further iterate

# Simple Queries with MongoDB:

Set Current Database:
>use DATABASENAME

See Present Database:
> db
DATABASENAME

View collections (tables) under present db:
> db.getCollectionNames()
[ “TABLENAME”, “system.indexes” ]

SQL>Select count(*) from TABLENAME:
NoSQL> db.TABLENAME.count()
238735

SQL>select * from TABLENAME where field1 regexp ‘enrique’:
NoSQL>db.TABLENAME.find( { field1 : /enriqu/i} );

For simple find:
NoSQL>db.TABLENAME.find( { field1 : “value” } );

SQL>Select field1 from table where field2=”%search%”:
NoSQL>db.TABLENAME.find( { field2 : /search/i} , {field1 : 1 } );

SQL>Select All but one (field1) column:
NoSQL>db.TABLENAME.find( { field2 : /search/i} , {field1 : 0 } );

SQL>Select with sort order ascending and descending (1,-1):
NoSQL>db.TABLENAME.find( { ar_name : /enrique/i }, {field1 : 1 } ).sort({ field1 : -1})

MongoDB now seems easy to follow, but I’m still having hard time in taking on the Map/Reduce.
More in the next post; ofcourse documentation home is a good place, else you may export the pdf / html / xml documentation here.

20 Mar
Editplus is a lot better than the regular text editor, Notepad.
From all it’s features I like RegExp Support the most, and than comes the block select feature.
Here are the quick lines to carry out regular tasks using regular expression in Editplus. It’s kinda downloadable cheetsheet list.

## Remove all empty lines:

Find: “^\n” (Ignore double-quotes in all find/replace)
Replace: “”
Where,
^ – Beginning of the line
\n – New Line

## Remove Multiple Spaces convert into single space:

Find: ” +”
Replace: ” “
Where,
+ – find one or more occurance of space character.

## Comment multiple line of code:

Find: “^”
Replace: “#” or “//”
You may optionally use: Edit Menu > Format > Line Comment.
Generate Comma Separated List from new line delimited list:

Find: “\n”
Replace: “, “
This helps in even joining some of lines of code instead of replacing by comma you may replace it with “”.

## Manipulate columns display order / punctuation:

Find: “([0-9]+)\t([a-zA-Z]+)”
Replace: “\2\t\1”
Where,
[0-9]+ – Finds one or more digits
[a-zA-Z]+ – Finds one or more characters
() – mark the block or capture the group
\2 – 2nd mark expression
Eg:
123 abc
345 cde
567 efg
Becomes:
abc 123
cde 345
efg 567
The Other Way:
– Press Alt+C
– Drag you mouse to select respective column and click
– Copy / Cut as required

Find: “\n”
Replace: “;\n”

Find: “\n”
Replace: “‘\n'”

Find: “^.*STRING.*$” Replace: “” ## Remove lines not containing a given STRING: I don’t know how to do this!! 🙂 ## Convert tab separated file into insert statements: TSV: abcd de4 iirn 34399 SQL: INSERT INTO TABLENAME VALUES (“abcd”, “de4”, “iirn”,”34399″); Find: “(.*)\t(.*)\t(.*)\t(.*)” Replace: “INSERT INTO TABLENAME VALUES (“\1”, “\2”, “\3″,”\4″);” ## Format the telephone number: Find: “([0-9][0-9][0-9])([0-9][0-9][0-9])([0-9].*)” Replace: “\1-\2-\3” Eg.: Original: 1231231231 Formatted-1: 123-123-1231 ## Remove Brackets: Find: “$$|$$” Replace: “” Where, \( – Match (. \ is required to escape marking the expression. | – or ## Replace 1st occurrence of character: Find: ” (.*)” Replace: “-\1” Where, (.*) – matches everything and marks the block ** Make sure you ignore double-quotes(“) while writing in find / replace boxes. ## EditPlus supports following regular expressions in Find, Replace and Find in Files command. Expression – Description • \t – Tab character. • \n – New line. • . – Matches any character. • | – Either expression on its left and right side matches the target string. • [] – Any of the enclosed characters may match the target character. • [^] – None of the enclosed characters may match the target character. • * – Character to the left of asterisk in the expression should match 0 or more times. • + – Character to the left of plus sign in the expression should match 1 or more times. • ? – Character to the left of question mark in the expression should match 0 or 1 time. • ^ – Expression to the right of ^ matches only when it is at the beginning of line. •$ – Expression to the left of \$ matches only when it is at the end of line.
• () – Affects evaluation order of expression and also used for tagged expression.
• \ – Escape character. If you want to use character “\” itself, you should use “\\”.

## Notable Features of Editplus are :

• Spell checking
• Regex-based find & replace
• Encoding conversion
• Newline conversion
• Syntax highlighting
• Multiple undo/redo
• Rectangular block selection
• Auto indentation
• Code folding (Text folding)