Wednesday, February 6, 2013

Install applications without admin permission on windows machine


Off late I am living under processes and restriction world. Got confused correct? I am consulting at a place where I don't have any permission on my own laptop. I am not complaining about installing stuff but coping under certain directory and changing the environment varibales are restricted too.
Being a developer I live in code and wants full access to environment where I am living.  I found out that if you don't have Admin access to your machine you can still do things like administrator.
Create a "Temp" directory under c:\ drive. create a wintv directory under it and copy the cmd.exe underneath it. Boom now you can do anything on your machine. Copy any exe here and you can run them, install them. To change the environment variable just open the command prompt from c:\Temp\wintv directory and open Windows\System32\sysdm.cpl file. BOOM BOOM!!
You are unstoppable again :) Manisha

"." to open the home directory in windowns


Yesterday I was tweaking with my setting.xml which resides under ~\.m2\conf directory.

I was opening my explorer and then was making hundreds of click to reach there :O. A friend (Sachin) who was standing next to me showed me a nice shortcut to open home directory with one click.
Start -> Run -> Type just "." and hit enter.. Tadaaaa it will open your home directory. Thank you for showing Sachin.   I will remember, it now. Manisha

Maven: Could not calculate build plan: Failure to transfer

Last day a very simple thing took little while for us to resolve. I was trying to setup a new project on a machine and did not have all my environment variables setup properly.


I was trying both the command line and eclipse options interchangibly. Initially I had the wrong repository settins in settings.xml so it could not download any jars and I ended up having *.lastUpdated files all over.

Eclipse maven plugin seems to stop downloading the dependencies if it seems *.lastUpdated files. I had to remove the all the *.lastUpdated file and plugin starts to work agian.
I read same clean up can be done using mvn -U clean too.   happy reading Manisha

Thursday, August 2, 2012

Mysql's THE GROUP_CONCAT() function

I must have written multiple custom code in Java to aggregate my results from a table. i.e. Assume a table like below.

Table A
-----------
name
-----------
Manisha
Nilanjan
Nima

To display (Manisha, Nilanjan, Nima ) I always use to aggregate all the values, using some sort of loop. With mysql group_concat function it can be done very easily.

SELECT GROUP_CONCAT(name) As Name FROM A;

Then the output will be:
name
----
Manisha, Nilanjan, Nima

We can also use some format of GROUP_CONCAT(). Like

SELECT GROUP_CONCAT( Language SEPARATOR ‘-’)-> It will use ‘-’ instead of ‘,’
SELECT GROUP_CONCAT( Language ORDER BY Language DESC ) -> To change the order and shorting output

Another thing to remember that GROUP_CONCAT() ignores NULL values. Group_Concat function can be used in join scenarios too. i.e.

Employee_TYPE Table
--------------------
Id | Desc
1        |  1 | FT  
2        |  2 | PT  


Employee table
---------------
ID | Name
1  | Manisha
1  | Nilanjan
2  | Nima

And to display something like below group_concat can be used too.
ID   | Desc | Name
   1 |  FT  |  Manisha, Nilanjan
   2 |  PT  |  Nima 

SELECT Employee_Type.*, (
    SELECT GROUP_CONCAT(Name SEPARATOR ',')
    FROM Employee
    WHERE Employee_Type.id = Employee.person_id
) as employee
FROM Employee_Type
   
Cool isn't it. 
Manisha 

Tuesday, July 31, 2012

Snippet to generate lines for TestSuite

I wanted to generate the TestSuite for all my classes and was not ready to click on all 200 test classes to generate from eclipse So wrote a small testcase which printed the lines for me to add into my TestSuite. Here is the code snippet.



    @Test
    public void testShouldPrintAllTheNameOfTestClasses() throws Exception {
        File dir = new File("/Project/DIF/dif_parent");
        LinkedList files = (LinkedList)FileUtils.listFiles(
                  dir,
                  new RegexFileFilter("^.*[tT]est(-\\d+)?\\.java$"),
                  DirectoryFileFilter.DIRECTORY
                );
        for (File file: files) {
          System.out.println("suite.addTestSuite(" + file.getName().replace("java","class" ) + ");");
        }
    }



Thanks
Manisha

Wednesday, July 25, 2012

Attaching Source code with Maven

Initially I use to download the source jars and then use to attach them to project. Then started adding source jar as dependencies to pom for dev profile. Recently I found a maven command which does i it seamlessly for us.

I ran below commands to download and attach the source code of all the projects in Eclipse for me.

mvn dependency:sources

mvn eclipse:eclipse -DdownloadSources=true 

Boom! refresh all project in Eclipse and the source code must be attached to your project.                    
Enjoy looking into source
Manisha

Tuesday, July 24, 2012

JMeter is not good tool for finding Request per second

I played around with performance tools a lot in my last project and this was one blog which I never got to finish. My goal was to come with a tool which is best for benchmarking an application on Tomcat. While working with JMeters all the numbers compare to AB tool were low, I suspected Tomcat and started reading the tomcat performance tuning book and found below lines.

(Page 136 - Chapter 4 - Tomcat Performance Tuning ) - JMeter's HTTP client is slower than that of AB or siege. You can use JMeter to  find out if a change to your webapp, your tomcat installation or your JVM, accelerated or slows the response times of the webpage however you cannot use JMeter to determine the server's maximum number of requests per second that it can successfully serve because of JMeter's HTTP client appears to be slower than Tomcat's server code.


http://books.google.com/books?id=vJttHyVF0SUC&pg=PA136&lpg=PA136&dq=%22maximum+number+of+requests+per+second%22++jmeter&source=bl&ots=i-5yv-tLh0&sig=0JnmfPtq2PwKWdEDkfSamUQMBEg&hl=en&sa=X&ei=6L0QT-3DGc6lsQKmio2LBA&ved=0CDIQ6AEwAg#v=onepage&q=%22maximum%20number%20of%20requests%20per%20second%22%20%20jmeter&f=false

I thought it was really valuable find :)
Manisha