January 06 2010
Recursive Linux “Find Files Containing”
find . -name "*.ext" -exec grep -i -H -n "texttofind" {} \;
My name is Aleksey Maksimov. I am Software Architect with many years of IT experience and architecture experience. I work for a global IT consulting company and live in the United Kingdom.
This is my software rants blog. I also have blog about my life happenings, in Russian. I also registered in almost all social networks, usually as ctpeko3a, sometimes as lechat and rarely as drunkenfly. Here is my FriendFeed and
.
find . -name "*.ext" -exec grep -i -H -n "texttofind" {} \;
I am installing Postfix on my unmanaged VPS hosting machine and I am doing it first time ever. I followed the installation manual on Ubuntu site and everything looks all right except one tiny thing: I can’t send email using Telnet. Here is the response:
421 4.3.0 collect: Cannot write ./dfnBA9gfVO030273 (bfcommit, uid=0, gid=111): No such file or directory
I googled for an answer, but nothing useful came up so I tried to debug the problem myself. By looking into mail logs (/var/log/mail.log, found by examining /etc/syslog.conf) I found following strange response:
start postfix/master[15758]: fatal: bind 0.0.0.0 port 25: Address already in use
That means only one thing: there is another process listening on this port. Hmm, what could it be? Sendmail, perhaps. I uninstalled it, according to guides I was using, but it was still running.
It’s time to stop it and start postfix!
sudo service sendmail stop sudo service postfix restart
Problem solved!
Moved my blog to a cheaper VPS. Also now this blog is served by Lighttpd instead of Apache. Everything seems to be a bit faster!
This is most frustrating thing that I experience when I encounter Solaris bash prompt: the Home, End and Delete keyboard keys will not work because for some reason Solaris doesn’t understand them as useful keys. But there is the way to enable those keys!
Add following lines to your ~/.bashrc file:
# home key
bind ‘"\e[1~":beginning-of-line’
# del key
bind ‘"\e[3~":delete-char’
# end key
bind ‘"\e[4~":end-of-line’
# pgup key
bind ‘"\e[5~":history-search-forward’
# pgdn key
bind ‘"\e[6~":history-search-backward’
Save and source file. Now keys will work as they should.
I use VMWare to run a bunch of different Linux VMs on my home PC, which is running Vista SP1. Today I encountered strange thing: Linux VM won’t get an IP address from VMWare DHCP. I’ve opened VMWare Virtual Networks management console (as Administrator, of course, or it won’t let you make and save any changes) just to find out that DHCP service is not started. I tried to start it from there, but it failed to do so.
So I went to Vista Services console and tried to start “VMWare DHCP service from there”. Again, failed to start with no explanation, even cryptic one. So I went to Windows Events viewer and there, under Windows Logs-System, I found a lot of messages from VMNetDHCP:
The description for Event ID 2 from source VMnetDHCP cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer. If the event originated on another computer, the display information had to be saved with the event. The following information was included with the event: Can’t open C:\ProgramData\VMware\vmnetdhcp.conf: Access is denied. / The data is invalid the message resource is present but the message is not found in the string/message table Though the message says that the message is not found, it has enough information to fix the problem. So, I’ve taken a look at the security properties for C:\ProgramData\VMWare folder and found that SYSTEM account somehow is not in a list of permitted users. The only account, who was permitted to access that folder, was my Windows user account. So I added SYSTEM account with all permissions to this folder, waited when Windows propagated my change to all files and tried to start VMWare DHCP service again. It worked!
Then I simply restarted network within Linux VM (sudo /etc/init.d/networking restart) and got back to work.
I created sample JBOSS Seam project in Eclipse and decided to generate entity code from existing database. It worked fine, but when I try to run it, it shows me that Hibernade is not able to map entity beans to the corresponding tables. The error message is like this:
org.hibernate.hql.ast.QuerySyntaxException: <your table> is not mapped
I spent around three hours trying to read all available information on it, but most of it just useless – it looks like people don’t know whats happening, so they recommend bizarre tricks. Like, for example, having empry seam.settings file in each folder, meh.
Finally, I found the solution in Seam Jira: https://jira.jboss.org/jira/browse/JBSEAM-3821
They rocemmend to to force Hibernate to use Seam’s EntityManager by changing two files:
1. components.xml
<persistence:entity-manager-factory name="bookingDatabase" installed="false"/>
<!– If Seam loads the persistence unit (JBoss 4.x), the EntityManagerFactory will be resolved from #{bookingDatabase}.
On JBoss AS 5, the EntityManagerFactory is retrieved from JNDI (the binding occurs during application deployment). –>
<persistence:managed-persistence-context name="em" auto-create="true"
entity-manager-factory="#{bookingDatabase}" persistence-unit-jndi-name="java:/bookingEntityManagerFactory"/>
2. persistence.xml
<!– Binds the EntityManagerFactory to JNDI where Seam can look it up.
This is only relevant when the container automatically loads the persistence unit, as is the case in JBoss AS 5. –>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/bookingEntityManagerFactory"/>
Hope that Google will find that page and the proper solution would be much more easily found!
After yesterday’s success in installation of Team Concert, I went through the “Do and Learn” tutorial. The amount of new information and, especially, new views in IDE, is overwhelming! Though the tutorial tries its best to guide through sample project, it would take my time to digest the information. So far, I managed to get through it, but have been stuck on building my HelloWorld application.
The problem is that freshly created build engine, named “HelloWorldEngine”, telling me that Jazz Build Engine is not yet connected to repository. But in another window jbe.exe process is connected and waiting for builds.
I restarted jbe with –verbose parameter to see what it does, but this resulted in only one additional line to be displayed: “2008-10-28 12:16:42 [Jazz build engine] Not using a proxy to reach https://localhost:9443/jazz/” I would expect it to be more verbose that that. Perhaps it needs to tell me something more about which build engine id it tries to use…
And build engine id is exactly my problem here. By default jbe is going to use “default” build engine, not my “HelloWorldEngine”. There is parameter, which is not mentioned in tutorial, but mentioned if you try to run jbe.exe:
-engineId <engine id> (engine id of a build engine defined in the Jazz repository, default is "default")
Once I started jbe with proper parameter – my build was fired off.
And first one was a failure:
com.ibm.team.build.internal.engine.InvalidPropertyValueException: CRRTC3512E: The location "C:\java\jazz\buildsystem\buildengine\eclipse\fetched\ScrumProject\build.xml" referenced by property "com.ibm.team.build.ant.buildFile" does not exist.
This is because I named Team Concert project “ScrumProject”, but in Java perspective I followed HelloWorld cue card and named my Java project “HelloWorld”. The build system was puzzled to find it. Team Concert Tutorial says this:
13. In the Build file field, type the following path: fetched/projectname/build.xml, where projectname is the name of your Jazz project.
This is not exactly the truth. This should have the name of my Java project.
So I went and fixed the project name in Ant tab. Requested the build and, voila, it builds!
Now its time to create new project, which will do something bigger, than printing “Hello, World!”
Image via CrunchBase
After rave reviews from my coworkers, who seen the IBM presentation, I decided to give it a try on my local machine. As it usually happens with IBM beta software, the expectancy of it working is close to zero. Let’s give it a try this time, could it be better?
First, I headed to http://jazz.net/ to download software. The server, obviously, managed by IBM marketing department, requires to register. Usual IBM ID is not supported, so I had to give IBM my email once again.
Since I only need a software for basic trial, I decided not to download version, which supports DB2 and Oracle databases. There is no support for MySQL either, but at least they promise to include Derby in setup package. So I pointed that I want Windows installation and found that download size is about 400Mb, and there is no IBM Download Manager (which I hate) to be seen.
So I downloaded and unpacked everything to my hard drive. I am on Windows and Windows users are used to find setup.exe, which does installation of the software for you. There is no such thing here: only install_express_c.html file, which describes step by step installation procedure for both Windows and Linux. Why Linux if I specifically stated that I want Windows installation?
First step says that I have to navigate to Tomcat’s folder and then run server.startup.bat file. There is no such file! The actual file named startup.bat. So I executed it, new command line window popped out and it is full of exceptions. Something about IbmX509 KeyStoreManager is nowhere to be found. Of course it can not be found because I am not running IBM JVM! What kind of assumption is to expect that everybody in the world are on IBM JVM, huh? I had to dig into Tomcat’s server.xml to set it to use Sun’s X509 keymanager (simply open tomcat/conf/server.xml, find IbmX509 and replace it with SunX509).
After quick restart Tomcat is happy and I can open, according to instructions, Jazz setup screen, which is a web application running within Tomcat. The setup has two options: “Fast Path” and “Custom setup”. I’ve chosen Fast Path because I am happy with the defaults, whatever they are. Click on “Fast Path” gets me to “Setup User Registry” screen, which has “A problem occurred while loading User Registry settings.” error message displayed. Hmm… Let’s head back to installation guide:
The default user name and password are case-sensitive:
- The user name is ADMIN.
- The password is ADMIN.
If you configured the LDAP directory Web container, log in with a JazzAdmin user that is defined in your LDAP directory.
What? I have to configure LDAP directory Web container first? This is first time it mentioned in this “guide”! How do I do that? There is no answer.
Ok, Fast Path is broken, so let’s try Custom setup. Click. “Loading Database Connection settings…” No progress here as well. Nothing about such problems in tomcat logs, nothing in server troubleshooting section of installation guide.
So there is no Rational Team Concert for me for now. Would I recommend it for use on my next project?
Update: Decided to dig around filesystem, looking for something useful like logs and other batch files. Found some logs in Tomcat cache folders (tomcat/work/Catalina/localhost) with the ClassNotFound messages. Found jars, containing missing class and added it to CLASSPATH. No help.
Then found mentioned above server.startup.bat and tried to run it. Now it complained about SunX509 KeyManager, so I returned the IbmX509 KeyManager back. Still no help progressing with Jazz Setup…
And then I decided to run repotools.bat – just in case the repository got corrupted or something. Execited it with parameter –createTables, it done something with something.
Tried Jass Setup page again and now it worked! Whoa!
Use Ant!
<delete includeemptydirs="true" >
<fileset dir="${checkout.dir}" defaultexcludes="false" >
<include name="**/.svn/" />
</fileset>
</delete>
There is all so common situation when you have to go to once a week to a website, and you have to login to it and your browsers is not asking you about remembering that password. So you have to remember that password and its getting out of your head and you have to spend some time trying to get it into your head again.
If you are using Firefox you are lucky. There is a way to let your browser to remember the password and even reveal what you have typed correct password.
Here are the steps for a freedom:
Perhaps you want to bookmark this page before the required Firefox restart, so you could easily return to this small guide. Press Ctrl-D to do that.
You don’t have to restart Firefox, to get Greasemonkey scripts working. If the script is not working – just refresh the page (Press F5).
Now you all set. Your form data will be remembered and you could verify that you are typing correct password.
You could get many more additional scripts here: http://userscripts.org/