Friday, 17 January 2014

Running C with GCC compiler in windows with Netbeans IDE

This pretty simple layman question, but still some tricky to install GCC compiler in windows, making functional with C or any thing else C++, Fortan etc.

Recently, i need to run program for OpenMP (For parallel programming  ), parrallel thread executed in order to complete my course syallabus as  a part of Advance computer architecture. So little time, it took to initially figure out how to install it, & work for it with GCC. Prior to it, it was never been with GCC, all we have is turbo C++ Blue screen, in college time. But now that was obsolete, say working to as similar as in early 90's. So need change there.  So here it goes.

Installing on window there is: MinGw( www.mingw.org/)  compiler system that seems fine. It give you the windows installation manager
package from where you can install all the required package one by one exactly as similar as linux way.



Download and Run MinGw installation manager.
We need to install following packages as mandatory for C/C++ .
1) MinGw-Developer tool
2) mingGW32-base [This is required for C]
3) mingGwGcc-G++ [This is for C++]4) msys-base  [It include core basic utility functions]


After installation of all those package, 
Create a new project in NetBeans
Select tab C/C++ Applications 


The general package structure will be created. 
Now you have some tricky task. Those are setting environmental variable that is [Path] variable for MinGw and msys in your 
windows maching (Right Click My Computer-->Properties->Advanced Properties-->Environment Variable)

You need to set the path variable upto the bin directory. For ex : If your MinGw is installed as C:\MinGw then
path will be C:\MinGW\bin , 
similarly for mySys it would be C:\MinGW\msys\1.0\bin    
Note that place semicolon(;)  before and after of these variable entries in path variable .

Next you need to set configuration in you netbeans. For that. 
Go to Tools -->Options-->C/C++ tab

There most probably, [Make command] tab will be not mentioned explicitly, you need to mention it ,
browse the button and select C:\MinGW\msys\1.0\bin\make.exe file of MySys. 

Check all associated variable as well , if they are set correctly. 
Finally build the project , if it is build successfully, Congratulations.. !! 
You are done. ..









Cheers.. !!
Happy Learning. !!!

Tuesday, 7 January 2014

How to fix this window is not genuine error in windows 7

Guys, the problem was, since so many months i was getting this error, i used to always cancel "windows not genuine message" & then run my computer.
Today, it was extreme !! Normally i don't care for desktop background & it was always black because of windows not genuine, As i changed at set the windows background wall, after some time, it automatically changed my background old nasty black background. So it was quite hectic. I thought , common get rid of this.

So here is the one step solution.

>> Run command line as "Administrator"
>>Then type "SLMGR -REARM" 

After some time you will get, command executed successfully message which ask you to restart the system.

Restart it , You will never get "Not genuine windows message" !!

Happy Learning
Cheers ..

Making a bootable windows 7 disk from file

Making a bootable windows 7  disk from the copied files from windows 7 disk:
-----------------------------------------------------------------------------------------

Guys, this was really a hectic task , if you are not aligned with the proper techniques to make bootalbe windows.  Last night, it wasted by whole night too. 

The problem was  my brother's OS get crashed, now I don't have bootable DVD, only all i have is , windows splitted copied files. 
So my first choice was Nero, I didn't have Nero too, downloaded Nero 14 trial for 15 days , tried to make bootable with it, but it sucked me, all it allowed was to allow burning maximum file size of 200MB. :( 

My Next try was Nero 7, Okey it was very difficult to get if from internet for free, finally got it, from some where, a cracked version, Installed and tried to make bootable DVD for windows 7 , again it sucked me, it only allowed me to make a bootable file that exceeds no more than 2GB, I was having 3.4GB of windows 7 raw file. :( What to do !!!

Wasted one night !!
Next I came up with the solution, found a very good developer tool known as Image burn (http://www.imgburn.com/) having a file size of just 3.3 MB, & was awesome. !!! Can not imagine, such a decent and best tool !! 

All you need to do is :
=> Click the ‘Write files/folders to disc’ button.
=>Insert a writable DVD disc [The message in  status bar should say ready]
=>Add the installation source folder and files 
=>On Boot tab,     Locate your Boot file for windows7 generally it is located inside /Boot folder with the name etfsboot.com
[Note: this is important don't  miss it.]
=>Enter ‘Microsoft Corporation’ in the ‘Developer ID’ field.
=>Enter ’07C0′ in the ‘Load Segment’ field.
=>Enter ‘8‘ in the ‘Sectors To Load‘ field.

You are done, finally click on Build Button. Yes !! 
Cheers.. !!  Your bootable CD is ready .. !! 











Saturday, 4 January 2014

Making USB Pendrive bootable for windows 7 set up

Got a quick sort of problem today, needed to make a bootable pen drive for windows 7 from the file stored in my computer !!


So here is what i did !!
1) Run as system Administration in command
2) Navigate to cd c:\windows\system32
3) Type:  DISKPART
4) Type: LIST DISK (All the drives including your USB will be listed)
5) Type : SELECT DISK yourDiskName  (Your usb disk name as it is show by list disk)

After selecting disk type following commands sequentially:

CLEAN
CREATE PARTITION PRIMARY
SELECT PARTITION 1
ACTIVE
FORMAT FS=NTFS QUICK  (quick will enable you to format faster)
(it may take a couple minutes, depending on the USB drive size)

Than type:
ASSIGN
EXIT



Now open a command prompt and go to the directory where BOOTSECT.EXE  file is located for your windows 7 file.

After navigating to the directory : type

BOOTSECT.EXE /NT60 H:  (Here h is the usb drive name)

If all thing are executed successfully, Congratulations your pen drive has become bootable now.  Now you can copy the windows files directly into your usb drive.


Friday, 22 November 2013

Jmeter for performance Testing

Running Soap services in Jmeter for performance testing:

Apache JMeter is an Apache project that can be used as a load testing tool for analyzing and measuring the performance of a variety of services, with a focus on web applications. 

Apache JMeter may be used to test performance both on static and dynamic resources (Files, Web dynamic languages - PHP, Java, ASP.NET, etc. -, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used to simulate a heavy load on a server, group of servers, network or object to test its strength or to analyze overall performance under different load types. You can use it to make a graphical analysis of performance or to test your server/script/object behavior under heavy concurrent load.

Apache JMeter features include:
Ability to load and performance test many different server/protocol types:
Web - HTTP, HTTPS
SOAP
FTP
Database via JDBC
LDAP
Message-oriented middleware (MOM) via JMS
Mail - SMTP(S), POP3(S) and IMAP(S)
Native commands or shell scripts
TCP



Adding thread user in test plan 
Add >>Thread >> Thread group

Step1:
>> Give thread group names
>> Number of threads [How many instances of the service file you wanted to run for performance testing]
>> Ramp up time [This is the time need to initialize all the threads in system]
Step2:
>>Right click on thread group >>Add >>Sampler >>Soap XML/RPC request
>>Give name to the service in [name] box .
>>Give full url of the service for ex- [http://localhost:8181/testService]
>>Copy wsdl file content into [soap/xml-RPC Data] field

>>Save it.  [You are done]. 

Step3:
>>Add a listener to view the performance of your service or program. There are varieties of listener. These 2 are good for analyzing the soap services performance. 
1) View Result tree 
2) Aggregate report 

You can add various types of result as : 
>>Right click on your newly added soap/ xml-rpc request >> add >> listener

Step4:
Run the project and view the result in listener.


Returning the the node value of xml service as a variable:
you can return the xml node value into a Jmeter variable & use it at other different places by various types of postProcessors. 
For returning simple node value into a variable you can use regular expression extractor as below.
>>Right click on Soap-xml/rpc request 
>>Add >>Post Processor >> Regular expression extractor
>>Give Reference name [this will act as your variable] for ex - myVar
>>In regular expression box type <nodeName>(.*?) </nodeName>
(.*?) is a regular expression which will return any value in between <nodeName> tag.
>> In template add $1$
>>Save it.
>>Now you can use myVar at any other place as ${myVar}


Happy Learning 
Cheers !!







Saturday, 9 November 2013

Using Regular expressions in notepad++

--Using Regular expressions  in a practical life --

Hey Guys, Today i was writing a post & come with a particular problem. The problem was , I was writing 108 names of God Surya. I wrote them one by one in every new line in notepad. Later I thought I forgot to add OM as a prefix to each name. Now what to do? I can not type  each name & add one by one.

So for that I thought to use techniques of regular expression & add them in intelligent way. So what I did was, I opened that file into Notepad++ .
Then pressed Ctrl+H to open find & replace box . At the search mode, i selected the option "Regular Expression" .

Now at "Find what" box - I typed "^"  ==>This indicates beginning of each line 
and at "Replace with box" - I typed  "OM ". Finally I clicked on Replace all. 

That's it.  In one shot, i did my whole changes.  Wow it was fantastic.

Similarly,  if you have text like
word1
word2
word3

and  you wanted to make  some thing like -
test: "word1"
test: "word2"
test: "word3"

All you need to do is 
Search = ^([a-Za-z0-9]+)$
Replace= test:"\1"


This is just a very simple example of using regular expression in notepad++. You can do much better things  related to matching & replacing various types of patterns by using regular expressions.

Happy Learning.. ..!!





Saturday, 14 September 2013

Setting up apache maven

Abstract: Apache Maven has been build to resolve your day to day problems for adding many dependencies that exists in project from various source. Basically, In java you have many dependency to be added to the system. So, It becomes very difficult to manage them by searching Jar files & adding manually to project.
For example - You may need Spring Jars in your project, than after some time you may need Struts Jar. To bring all them in common place in library in your project manually is very complicated & length task. The Maven helps you to add Jars for you making central repository.
All you need to do is add/Modify the POM.XML file.
Installation:
1) Download the latest version of apache maven 
http://maven.apache.org/download.cgi
currently the version is 3.1.0.
2) Extract the tar or zipped folder & Preferably place it at  
"C:\Program Files\Apache Software Foundation" location 

Now add M2_HOME an environmental variable , & set the path to where it is placed. 
If you are using windows 7, Follow
        Right click on Mycomputer--> Properties -->Advanced System Settings -->Environmental variables 
In User variables section
       
Click new ==>Set variable name to -->M2_HOME 
               SET variable value to -->
C:\Program Files\Apache Software Foundation\apache-maven-3.1.0

(Path of maven folder)

In the same dialog box -- Add new variable M2 
 SET PATH TO : %M2_HOME%\bin

Now add the same M2 varialle to the end of your path variable too. 


Make sure you have JAVA_HOME variable set to Java jdk path
 C:\Program Files\JAVA\jdk1.7.0_17 
SET THE PATH VARIBLE TO its   bin directory  as 
%JAVA_HOME%\bin 

Open a command terminal & type : 
mvn --version
 
It will show you the current version. That's all folks, you get Maven Installed.

In Next Post, I will show you how to create project through Maven add dependency to it. 

Stay tuned.
Happy Learning. :)