git error: error setting certificate verify locations


I am using Windows and msysgit. When I try to clone a git repo from Github I received a SSL related error.

>git clone https://someid@github.com/project/wisper.git
Password:
error: error setting certificate verify locations:
  CAfile: /bin/curl-ca-bundle.crt
  CApath: none
 while accessing https://someid@github.com/project/wisper.git

fatal: HTTP request failed

>git config -l
http.sslcainfo=/bin/curl-ca-bundle.crt

To fix the problem change the forward slashes to backward slashes.

>git config --system http.sslcainfo \bin\curl-ca-bundle.crt

>git config -l
http.sslcainfo=\bin\curl-ca-bundle.crt

Frequently Used Maven Commands

Frequently used Maven commands

# Command to Clean any previously build code
mvn clean

# Command to install
mvn install

# If you are behind a proxy then add this in the $USER_HOME/.me/settings.xml
<settings>
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>myproxyhost.com</host>
      <port>1234</port>
    </proxy>
  </proxies>
</settings>

# And for HTTPS traffic use this in the command line
mvn install -Dhttps.proxyHost="myproxyhost.com" -Dhttps.proxyPort="1234"

# For offline building (i.e. if you think you have all the required dependencies)
mvn –o install

# Command to install without executing unit tests
mvn install -Dmaven.test.skip=true

# Command to install but using a specific profile
mvn clean install -Ptomcat

# Command to use the Cargo Deploy plugin
mvn cargo:deploy

# Command to perform the release of a module
mvn -Dresume=false release:prepare release:perform

# Command to continue a release that stopped in the middile
mvn -Dresume=true release:prepare release:perform

# Command to do a Dryrun release
mvn release:prepare -DdryRun=true

# If SCM interactions are involved then below option can be used to provide a SCM Comment prefix
mvn -Dresume=false release:prepare release:perform -DscmCommentPrefix="Mvn Release 1.0:"

# Not all jar files are available in the Maven repository.
# Command to Upload a missing artifact jar into a local repository
mvn deploy:deploy-file -DgroupId=net.sf -DartifactId=jcsc -Dversion=0.98.1 -Dpackaging=jar -Dfile=JCSC.jar -DrepositoryId=thirdparty-jars -Durl=http://mavenrepo.comp.com/nexus/content/repositories/thirdparty-jars

# Command to create a maven project from an Artifact
mvn archetype:create -DgroupId=com.mycompany.myapp -DartifactId=basic-webapp -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DremoteRepositories=http://repo1.maven.org/maven2

# Command to check the version of maven plugin being used
mvn -Dplugin=install help:describe -Ddetail

# Command to Generate dependency tree
mvn dependency:tree -Doutput=dep-tree.txt

# List all dependencies of this project
mvn dependency:list

# Command to generate Site documentation
mvn site:site

# Commands to generate specific reports
mvn site:site -DgenerateReports=false -Dmaven.test.skip=true
mvn project-info-reports:summary -Dmaven.test.skip=true
mvn project-info-reports:scm project-info-reports:issue-tracking project-info-reports:index -Dmaven.test.skip=true

# Commands for various other reports
mvn taglist:taglist
mvn javancss:report
mvn dashboard:dashboard
mvn jdepend:generate
mvn changes:changes-report
mvn changes:jira-report

yum install MySQL - Remote Access

This post explains all the steps needed to install Mysql on Linux(RedHat, CentOS, Fedora) and configure it to access db from remote machines.

Install Mysql Client
$ yum install mysql

Install Mysql Server
$ yum install mysql-server

Upgrade Mysql Installation
$ mysql_upgrade

Login as root user
$ mysql -u root
mysql>

List the grants this user has
mysql> SHOW GRANTS;

Grant all privileges to login as root from any remote machine
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION


APSRTC Online Booking - comments

Finally APSRTC started Online Ticket Booking.

http://www.apsrtc.in/APSRTCOnline

Application's response is pretty fast (may be because there is no traffic?)
My observations:
* There is no SSL during login, hope their payment gateway is secure.
* Its a struts based Java app running on IBM Websphere
* Left the default apps running: http://www.apsrtc.in/hitcount
* Developers dont know the difference between HTML comments and JSP comments. View source of the home page shows lot of commented HTML code.
* Uses struts validator framework for validations on serverside and client side. Smart way to avoid load on the server and do all validations on client first.
* While searching for From and To location, just enter % and you get all locations.

Enhance Google Reader

Enhance/Customize the appearance of Google Reader with the below Firefox plugins.

http://userscripts.org/scripts/show/12917 (Need Grease Monkey plugin)
http://userscripts.org/scripts/show/26859 (Need Grease Monkey plugin)
https://addons.mozilla.org/en-US/firefox/addon/748 (Grease Monkey)
https://addons.mozilla.org/en-US/firefox/addon/6424/ (Better GReader)


Access Mercurial Hg via Proxy server

Accessing BitBucket Mercurial repository via Proxy server.

  • Create a ".hgrc" file in HOME directory.
  • Edit the file and add the proxy server details


Configuring Jetty in pom.xml

To instantly run your java webapp after compiling, configure Jetty in pom.xml. This doesn't need an installation of Jetty server.
Jetty will be automatically downloaded, and your app will be deployed and server starts.

How to configure Jetty?
For those who are wondering "then how do I configure my server", here is the option. Copy the "webDefaultXml" from the jetty jar and add it to your resources. Now pass the location of the "webDefaultXml" to Jetty plugin.

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
    </configuration>
</plugin>

What you can configure in webDefaultXml?
A sample of options that you can configure:
  • Directory Listing
  • gzip Compression
  • Memory mapped File buffer (updating this to false will fix your CSS and Image lock issue)
  • Cache Control
  • Servlet Mapping URL patterns (If you have a url that you want to be processed like *.jsp)

Using Bitbucket and Mercurial

Pre-requisites for this Tutorial
  • An Account in BitBucket.org
  • Install Mercurial from here

How to get the Code

Use the below command to get the source to your local.

$ hg clone https://USERID@bitbucket.org/REPOPATH/

How to make changes

Once you have the code on you local computer. You are free to make changes. And once in a while if you want to commit your changes then use the below command to commit to the local repository.

$ hg commit -m "comments" -u USERID

Remember: The above commit is local only. It will not be reflected in the bitbucket repository.
To publish you changes for everyone to see, use push command.

$ hg push

How to get changes from remote repo

To get changes made in Remote(bitbucket) to local repository.

$ hg pull
$ hg merge tip

For more detailed guide see here.

Have fun!

Gravatar - A Globally Recognized Avatar

A Globally Recognized Avatar

Gravatar is an image that follows you from site to site appearing beside your name when you do things like comment or post on a blog. Avatars help identify your posts on blogs and web forums, so why not on any site?

How it works

Url: http://www.gravatar.com/avatar/3b3be63a4c2a439b013787725dfce802?s=80

The URL always begins with http://www.gravatar.com/avatar/ and the next part is the hexadecimal MD5 hash of the requested user's lowercased email address with all whitespace trimmed. Hashing is done to prevent spambots from harvesting e-mail addresses.

Parameters:

  • Parameter "s" will fetch image of size 80x80 (example: s=80)
  • Parameter "g" will fetch image if it is rated G (example: r=g, r=pg)
  • Parameter "d" will fetch a default image if there is no gravatar associated with an email address (Example: d=wavatar, d=404)

Technology Details:

- Initially developed in Ruby on Rails now in PHP.
-
Uses nginx (fourth most popular) as Webserver
-
Photos are served from Amazon S3 Cloud

"The way that images were stored originally was: a complete image was made for all sizes between 1×1 and 80×80 pixels, a directory made for each rating, and a symlink placed from the rating to the appropriate image (either the users image or the default image in case the rating was too high.) So that's 80 images, 5 directories, and 240 symbolic links. The reason for this, I believe, was to attempt to serve the avatar content without any database interaction whatever. The files were then archived, uploaded to Amazon S3, and an entry added to Amazon SQS. Finally the SQS entry was retrieved by the serving server, the file downloaded, extracted, and placed on the filesystem. So this is why it took several minutes once you uploaded and cropped your image for you to be able to browse the rest of the site again. You can imagine how many files Gravatar was comprised of by the time we got a hold of it! We knew that this would simply NOT work for our new 512×512px avatar sizes. Lastly there were a couple of directories which had several hundred thousand entries (either files or other directories) which were nearly impossible to even get a listing inside of. So we had a list of things NOT to do. We just needed to figure out what TO do

So we decided that we would render all our avatars dynamically from the highest quality copy of the image we can manage… down. We would only store one version of the image, though we would store it in multiple places (a local file server for speed, and S3 for redundancy.) We would still rely heavily on caching. And we would asynchronize as much of the workload as was possible, so that you don't have to wait for things to happen after you finish cropping (to do this we employed various techniques and hacks best left for another day and another story.)

Gravatar now lives on about 20 servers: 2 Database servers, 1 File server, 2 Load balancers, 5 Caching servers, 9 Web servers, and 1 Development server. That combination of servers is handling an average of 7,214 of your requests every second of every day. That's a whopping 623,293,056 requests daily! 96% of all of those requests are served directly from cache. These days we get around 5,000 uploaded images every day."

Unique Avatar Icon Generators based on Email address

identicon wavatar monsterid


Gravatar Rocks.

"Unknown Source" in Stacktrace

When compiled java source with Ant any Exception thrown from these compiled classes doesnt show line numbers. This seems to be a default setting in Ant.
http://ant.apache.org/manual/CoreTasks/javac.html

BUILD FAILED
java.lang.NullPointerException
        at com.mycompany.myapp.MyClass.doSomething(Unknown Source)

To get back the line numbers in the Exception Stacktrace add the below options to the javac task.

debug="on"


Creating Web Applications from Scratch

Archy is a useful tool I came across which can be used to create blank web applications.

This tool becomes extremely handy as it includes all the necessary web.xml configuration and some sample code to start with.

And its very easy to use also. I recommend all starters to use this tool to create their application base.

Maven: See deprecated API usage warnings; commandline

Maven command line option to see the warnings for deprecated code usage.

mvn clean compile -Dmaven.compiler.showDeprecation=true

http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html