Installing git and git-daemon on CentOS

July 12th, 2012

I spent a few days trying to figure out this error and since there were no immediate answers online, I thought it would be a good thing to have on here.
The error I would get when trying to install git or git-daemon on CentOS using the command “yum install git git-daemon” was:
Public key for perl-Git-1.7.4.1-1.el5.x86_64.rpm is not installed

it could actually be any version of perl-Git where the public key isn’t found. When I tried to install it directly by downloading the various RPMs from http://pkgs.repoforge.org/git/ I would get the ridiculous error of git having a dependency on perl-Git and perl-Git having a dependency on git. So it was impossible to install directly.

Eventually I found this page How can I install packages from the EPEL software repository the command they have is:
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'

That did not work for me because I would get the following error:
rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
error: skipping http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm - transfer failed - Unknown or unexpected error
warning: u 0x6b58ef0 ctrl 0x6b5a220 nrefs != 0 (download.fedoraproject.org http)

I didn’t even try to figure out that problem, instead (using sudo to run as root) I just did the following:
wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

this installed the epel software repository on the system and then I could simply run:
yum install git git-daemon

Apartment Name FAIL!

January 8th, 2011

Saw this apartment building with a name FAIL in Culver City today:

Name FAIL!

Name FAIL!

If you want to see the actual image on google maps, here’s the link.

Zend Framework Documentation Errors

December 10th, 2010

I’m using Zend framework in my project for the first time and I’ve heard at how good the zend framework online documentation is and how easily I can pick it up by reading their docs at http://framework.zend.com/docs/overview

I was setting up a simple user authentication and session using the page:
http://framework.zend.com/manual/en/learning.multiuser.authentication.html

but the code just wouldn’t work. I spent quite a bit of time trying to figure out the problems and it all boiled down to the document writers on Zend framework not proofreading or maybe not even running their own snippets of code because the code itself had either typos or methods used incorrectly.

One of the errors had to do with lines 7 to 10:

$loginForm = new Default_Form_Auth_Login($_POST);

if ($loginForm->isValid()) {

This doesn’t work because the “isValid” method expects an array. Cracking open the source for the Zend_Form class, I can clearly see that the isValid method is expecting the request array.

I had to change the code in the following way to get it to work:
$loginForm = new Default_Form_Auth_Login();

if ($loginForm->isValid($_POST)) {

Next was the line 27:
$this->redirect(’/');

redirect doesn’t even exist as a method. I had to call the following:

$this->_redirect(’/');

I posted the above text as a comment on that page and am writing this post about it hoping this helps save other time, it took me a few hours trying to figure out these issues thinking I was doing something wrong (because of my relative inexperience at this time with Zend). On the bright side, if I end up having to actually read Zend framework source code to figure out silly errors like this I’ll soon be an expert in Zend.

XFire, Maven and Spring Error: Cannot create mapping for collection “unspecified component type”

November 30th, 2010

I have been dealing with an error with our XFire services. Whenever we use any collection such as java.util.List, java.util.Set or any other collection we would encounter an error message like so:
Caused by: org.codehaus.xfire.XFireRuntimeException: Cannot create mapping for java.util.List, unspecified component type for parameter 0 of method insertUsers in interface com.xyz.webapp.service.IUserService

My Xfire is set up exactly as described in the Spring In Action book chapter 8.5 “Exporting beans as a web service using XFire”.

XFire has a great page describing how to map collections:
http://xfire.codehaus.org/Mapping+collections

Their recommendation is if you are using java 5 to use Generics for your collection like so:
public void insertUsers(List);

the only problem is I am using Java 6 and generics all over my code. Actually I don’t have a single collection that isn’t using generics. After searching for 2 days and only seeing people either suggesting using generics (which I already am) or using the CLASSNAME.aegis.xml file to specify type (which I tried and it didn’t work either) I finally phrased my google search term in a different way which led me to the answer. unfortunately I can’t find he link again but the answer was pretty simple:
Use xfire-java5

My maven pom file has the following dependency:

org.codehaus.xfire
xfire-spring
1.2.6
compile

All I had to do was to also add xfire-java5 to my dependency like so:


org.codehaus.xfire
xfire-spring
1.2.6
compile


org.codehaus.xfire
xfire-java5
1.2.6
compile

That did the trick. Hope you didn’t have to search 2 days to get to that answer.

Running Oracle Stored Procedure With “Out Parameters” using Hibernate and Maven

November 24th, 2010

On a recent project I needed to run an Oracle stored procedure through hibernate. Just a little background as to what I was using because it played a big role in running the stored procedure:
For Build: Maven 2.2.1
For ORM: Hibernate 3.2.7.ga, hibernate-annotations and hibernate-commons-annotations 3.3.0.ga
maven hibernate dependency:

org.hibernate
hibernate
3.2.7.ga


org.hibernate
hibernate-commons-annotations
3.3.0.ga


org.hibernate
hibernate-annotations
3.3.0.ga


I’m also using Spring and Spring-hibernate3:


org.springframework
spring-hibernate3
2.0.8


DBMS: Oracle 10g
Stored Procedure: the stored procedure unfortunately did not use a ref cursor and instead uses out parameters. Out parameters in Oracle are like passing an argument by reference. You create a variable, pass it in and when the procedure is done, that variable will have the value. For the purposes of this post let’s assume there are 2 in and 2 out parameters in our stored proc like so:
call myStoredProc(’in param 1′, 123, outParam1, outParam2);
where outParam1 is a String and outParam2 is a number.

I tried using NamedNativeQuery annotation on my model class and running it through hibernate but that didn’t work and apparently hibernate doesn’t like out parameter stored procedures but instead would like the stored procedure to return or set the first parameter to an out ref cursos. The only way to call our stored procedure is to get to the jdbc connection directly.

To do this I could have used my hibernate session’s connection (this.getSession().connection ) but that is marked as deprecated so I didn’t want to go that route. Instead I found the new 3.3+ hibernate versions have a “doWork” method on the session class. With that in place you could run a CallableStatement to the stored procedure. One issue, I have to upgrade Hibernate from 3.2.X to 3.3.X which wasn’t a simple task, here’s why:
1. Hibernate has decided to change their naming schema from artifactId of hibernate to hibernate-core
2. Any project that used to depend on older hibernate in maven should be told to exclude it or else it won’t know hibernate-core is the new version of hibernate and it will re-download the old version and cause java to get confused and not see the “doWork” method.
3. the new version of hibernate now needs javassist (whoever came up with that project name should never be allowed to name anything. Javassist sounds like Java has cysts) added or else it will crash and burn.

So with that in mind here’s finally how to run an out parameter Oracle stored procedure:
1. Upgrade Hibernate from 3.2.x to 3.3.X
- change your hibernate dependencies to:

org.hibernate
hibernate-core
3.3.2.GA


org.hibernate
hibernate-commons-annotations
3.3.0.ga


org.hibernate
hibernate-annotations
3.4.0.GA


- add javassist to your dependencies


javassist
javassist
3.8.0.GA


2. Find any other dependencies you are using that still use older hibernate and exclude them. In my case that was my spring-hibernate3:


org.springframework
spring-hibernate3
2.0.8


hibernate
org.hibernate




3. In your DAO run the stored proc with a similar method (if for example my stored proc returned an integer and a String and I wanted to just return the integer to the calling method):
public long runMyProc(final String input1, final Long input2) {
final long returnResult = 0;
this.getSession().doWork( new Work() {
public void execute(Connection conn) throws SQLException {
CallableStatement st = conn.prepareCall(”{ call myStoredProc(?, ?, ?, ?) }”);
// call the setDATATYPE with the first var being the index of the arg (index starts at 1)
st.setString(1, input1);
st.setLong(2, input2);
// now set the out parameter and it’s type
st.registerOutParameter(3, OracleTypes.VARCHAR);
st.registerOutParameter(4, OracleTypes.NUMBER);
st.execute();

// now set the return result var so higher level method can see/read it
returnResult = st.getLong(4);
}
});
return returnResult;
}

I have a running example that is working for me but I rewrote the code for this post so the above code may not even compile and you will probably have to change the code to fit your needs but this gives you an idea of how to do it.

The Adsense Experiment: Restarting with a current topic, Halloween

October 5th, 2010

I’m restarting the adsense experiment.

First I needed to clear all wordpress posts because they were no longer relevant. Wordpress did not have an easy way to delete all posts so I manually did this in MySQL by running the following queries:

delete from wp_posts;
delete from wp_postmeta;
delete from wp_comments;
delete from wp_commentmeta;

This will clear all the posts in wordpress but won’t change any of the settings you’ve made already. Then I picked a current topic to immediately try and get traffic for, Halloween.
I know I may be late to get indexed by search engines in time to get any type of traffic on halloween related searches but this is why it’s an experiment. One thing I learned from my initial tests was to find good blogs that have backlinking in their comments section when you post an article with a link to them, that generates immediate traffic. Unfortunately what I don’t have time for is writing my own posts on funny costumes because the challenge is to generate revenue without spending too much time.

Engineering Resume Mistakes: The Red Flag Warnings That Stick Out When Reading Resumes

August 18th, 2010

UPDATE: This will be an ongoing post to which I’ll add more points as I go along
I know it’s tough to write your resume. How can you put all your wealth of knowledge and years of experience in a short and concise way, which is what resumes should be:


      1. Resumes that go on for pages and pages:

      If you’re a software Engineer, even a senior software engineer, your resume should not be more than 2 pages, you’d be pushing it at 3. I’ve seen a few that come in and they are 7 or 8 pages long. You lose the interest of the reviewer at about page 2. Don’t include every little thing you have ever done. No one really cares that you once spent 5 days back in 99 to make a perl script that adds blink tags to h1 content. Unless you have been at a company for 10 years and have a drastic switch in job responsibilities, you should keep the description of that position to a single entry. I’ve seen many resumes that come in with 5 entries for a single job with some being as little as a timespan of a week. Make sure you just point out your major responsibility in that position and name a few of the major projects you worked on. If you started as a junior and are now a team lead then put that in the heading and focus the description of job responsibilities to being a team lead (assuming you’re not looking at junior positions again, your junior experience doesn’t matter). Having a long resume just tells me you’re trying to pump up your resume, speaking of which…
      2. Don’t just write down every single technology buzzword you’ve ever heard of in your experience section:

      I’ve seen software engineers with an experience section that spans half a page. It’s tough to fill up half a page of names or acronyms but they still do it because they fill it up with anything they can think of. This is pumping up your resume to the fullest but it tells me the candidate probably doesn’t know anything and so they are trying to seem like they know a lot. You should never list “tcp/ip” in your experience section if you can’t even name the seven layers of tcp/ip and you haven’t developed hardware or software that interprets packets. Just because you once connected to the internet by specifying a static IP number doesn’t make you an expert in tcp/ip. Don’t write down that you have experience in Perl 3, Perl 4, Perl 5 and Perl 5.8. You should say you know Perl, that’s it, no one cares, and I’m sure you don’t even remember, anything that is Perl 3 specific. This also goes for putting down Java 1, Java 1.2, Java 2, J2SE and so on. The worst offenders of pumping up their resume though are the software engineers with computer science degrees who put down such technologies as putty, winSCP, FTP, Microsoft Office. Yes folks, you read that right, I have seen a resume of a 9+ years of experience senior software engineer who listed Putty in their experience tech stack. After reading that I could not take anything that candidate listed seriously and he went to the bottom of the pile. You have to keep in mind that, even though the first pair of eyes to look at your resume might be HR who don’t really know technology, your resume will eventually be looked at by experienced software engineers who don’t consider “knowing” how to use putty a skill to be proud of and commit to in your resume. I’ll summarize the extent of knowledge you need to know putty. 1, double click icon. 2, input the hostname or IP address of the server you are trying to connect to. 3, click “connect”. 4. you are done. Also if you’re applying for a software engineering position (junior, senior, team lead or even manager), I don’t care that you know how to use Microsoft Office (unless the job is about writing macros for Office and you are describing your skills in coding macros), this skill does not matter in the decision process.

Google Admits to Mistakes in Releasing Buzz

February 18th, 2010

On a previous post I commented on how to disable Google’s Buzz in gmail. I was very annoyed at how Google introduced this “feature” to gmail users (felt more like shoved it down gmail user throat’s) with so many privacy issues and horror stories coming out of this.

In a BBC article Google product manager in charge of Buzz admitted to mistakes and apologized to users. You can read all about how they bypassed normal procedure which is blaming the process instead of the real people who made the decision to bypass procedure. This was a major product release and was not a simple decision to bypass but rather a calculated decision by management. And they say that the algorithm picked people you converse with the most but I was automatically forced to follow people I had one or two correspondence with on a mailbox I’ve had since 2004.

The biggest gripe I have though is that they forced this feature on gmail users who may or may not be interested in it. I love gmail and use it as my primary email address mainly because it reduces spam and noise so much better than other email services. Here comes a tool to add on top of a great anti spam technology that adds a sort of “friend spamming” to gmail. I was definitely not interested in it and think it would have been better off if they just launched it as a different service. Apparently they thought of this too:

Another idea, said Mr Jackson, was to create a separate service that was not part of Gmail.
“We think that integration with Gmail was absolutely the right way to go - we wanted to make Buzz easily accessible to people,” he said.

That is very wrong Mr. Jackson, launching this within gmail was the absolute wrong thing to do which is why there’s so much backlash on this issue. If this were a service launched on it’s own that people would register for (like many of the other services google provides) then you would not be apologizing in a BBC article.

The only reason they would launch this within gmail would be to boost membership in the Buzz program as fast as possible. Which seems to have been their goal because of how deceptive their whole opt in process was. I had a message in my gmail header about the service, I thought I was clicking OK to just get rid of this annoying message because I didn’t really want to read it. Instead I had clicked to opt-in. Yes, it is my mistake for not reading the full message but it still stinks of deception because they know many people won’t read.

If google releases even a useless service, just the fact that they are releasing it generates enough interest in the media that they get publicity and hoards of users registering to try it out. They didn’t need to do this, or maybe they did. Typing “failure of goo” in google search brings up the most popular suggestion of “failure of google wave” as the search term, which itself returns 3,860,000 results. Maybe they were afraid of Buzz turning out to be another failure and forcing it on gmail users would be the best way to make it a success.

Disabling Google Buzz

February 11th, 2010

This is going to be a short one. I didn’t want to have google buzz enabled in my gmail account (at least not yet) but just by checking it out it was. My first instinct was to disable it in the setting menu but there was nothing. I eventually found it, hidden ALL the way at the bottom of the page as a link called “turn off buzz”. I guess they wanted to make it as hard as possible to find.

The Adsense Experiment: On Hold

February 1st, 2010

I’ve put the adsense experiment on hold for a while until a major release I’m working on is resolved. Things will be hectic in my schedule until Feb 11th when this release will happen. The success of the release is dependent on me right now because I started consulting with the company 3 months ago and my portion of the project was scheduled to be done and I would bow out. I finished that portion within 2 months but the company had a shakeup that concluded with 4 main developers and 1 top product designer leaving (all of which had been working at the same place for 7+ years). With them a lot of the “tribal” knowledge was gone and the only dev left is a consultant who has been there for only 3 months (me). Once the release is a success, I will be back blogging about the progress of the adsense experiment.