Sunday, 16 March 2008
Looking Through The Eyes of Love - chords
Thursday, 13 March 2008
Activating root account in OS X to enable sudo
trawling the net for information, so I'll put it here.
If installing ruby gems, you need to do it as root or to do 'sudo gem
install [gem name]'
But you can't sudo if there's no root account!
So....
1. Enable root
In OS X 10.5 - you do it using the Directory Utility application. Log
in on an Admin account, run Directory Utility, and in the Edit menu,
select 'Activate Root account' (or a menu item similarly named). You
then enter the root password and verify.
2. Add your normal account to sudoers file.
Run visudo - a command-line util to edit the sudoers file in
/etc/sudoers, which contains the users or group that are allowed to
su-su-sudio.. er, ahem.. run sudo. :P
Using visudo is better than editing sudoers file directly because it
prevents any changes being saved if there are any incorrect entries.
Incorrect entries are BAD news for sudoers, since it prevents you from
doing sudo, and you have to call sudo to edit it or run visudo!
(chicken or egg!)
Under the section "# User privilege specification" - add a similar
entry with your username, like:
[username] ALL=(ALL) ALL
In this case, the username is the unix user, not the long Mac user
name you see when you log in.
3. Log out of the Admin account, then try doing something with sudo, like
sudo gem install mechanize
to see the results of your handiwork.
Gurus, please send corrections if any of the above is not exactly correct!
Saturday, 8 March 2008
Maven settings.xml that uses Artifactory, and restricts snapshot repository use
projects but have to use other libraries and Maven plugins that are
still in the pre-release stage.
We are using Artifactory at work as a local repository proxy for Maven.
We also have a project that makes use of some snapshot libraries for
the CXF project, which is currently under incubation in Apache.
Previously, we were just using a <mirrors> but this resulted in Maven
getting its metadata settings both from the central repository and the
snapshot locations. We ended up getting snapshots of Maven plugins
that we never really wanted, as Maven would get plugin metadata from
both the repository types, and of course, the latest version would be
the snapshot ones.
To remedy this, we had to change settings.xml so that the only time
the Apache snapshot plugin repositories are used is in the projects
that require the CXF plugin and associated dependencies. The important
thing is to make sure the id element in the repository settings match
the repository setting id in the project pom.xml. The pom.xml settings
can still point to the live, non-proxied repository, but Maven will
first look at the id in that pom file and see if there is an entry
with the same id in the settings.xml
<settings>
<!-- uncomment this section and comment out the profiles section if
the Artifactory (local maven repository) is broken -->
<!--
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>company.proxy</host>
<port>8080</port>
</proxy>
</proxies>
-->
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>http://internal.company.proxy:7070/artifactory/repo1
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://internal.company.proxy:7070/artifactory/snapshots-only
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>everything-else</id>
<url>http://internal.company.proxy:7070/artifactory/releases
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<repository>
<id>apache.org</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-snapshots
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<repository>
<id>apache.incubating.releases</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-incubating
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://internal.company.proxy:7070/artifactory/repo1
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://internal.company.proxy:7070/artifactory/snapshots-only
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<!-- used by SomeWebService/pom.xml The id here
*must* match what's in the pom file -->
<pluginRepository>
<id>apache-plugin-incubating</id>
<url>http://internal.company.proxy:7070/artifactory/apache-m2-incubating
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Wednesday, 5 March 2008
Maven reporting plugins - useful for generated reports in the Maven-generated project site
have more documentation on various aspects of each project. Adding
these settings to a Maven projects pom.xml would generate a lot of
useful information that would cover our needs.
<reporting>
<plugins>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<!--
<plugin>
This plug-in provides functionality for accessing FindBugs
from Maven.
<artifactId>maven-findbugs-plugin</artifactId>
</plugin>
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<!--
The JXR plugin produces a cross-reference of the project's sources.
The generated reports make it easier for the user to
reference or find
specific lines of code. It is also handy when used with
the PMD plugin
for referencing errors found in the code.
for multi-module projects, see:
http://maven.apache.org/plugins/maven-jxr-plugin/examples/aggregate.html
-->
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
<plugin>
<!--
The PMD plugin allows you to automatically run the PMD
code analysis tool on your
project's source code and generate a site report with its
results. It also supports
the separate Copy/Paste Detector tool (or CPD) distributed
with PMD.
-->
<artifactId>maven-pmd-plugin</artifactId>
<configuration>
<linkXref>true</linkXref>
<targetJdk>1.5</targetJdk>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<!--
This plugin is used to inform your users of the changes
that have occured
between different releases of your project. The plugin can
extract these changes,
either from a changes.xml file or from the JIRA issue
management system,
and present them as a report.
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
===================
Updated 6 March 2008: Commented out the Findbugs plugin entry because I can't get it to work yet. The settings above are actually for Maven1. To use the Maven2 plugin it should be like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
We are using Artifactory, but for some reason I get this Maven error:
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Unable to build project for plugin 'org.codehaus.mojo:findbugs-maven-plugin': POM 'org.codehaus.mojo:findbugs-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.codehaus.mojo:findbugs-maven-plugin:pom:1.1.1
from the specified remote repositories:
everything-else (http://192.168.1.1:7070/artifactory/releases),
snapshots (http://192.168.1.1:7070/artifactory/snapshots-only),
central (http://192.168.1.1:7070/artifactory/repo1)
However, when I got to repo1.maven.org (which is in my proxy configs), the Findbugs plugin is there at:
http://repo1.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/
So why is Maven (or Artifactory) unable to retrieve this plugin?
Again, what is going on here?
I guess I should test this first by removing Artifactory from the picture, removing the proxy settings from my settings.xml. If it fails, then it's a Maven issue. If it works, maybe it's Artifactory.
========================
Update:
Removed the Artifactory settings and Maven was able to download the plugin correctly. Maybe I should expire some caches and see if it is able to get the plugin?
Wednesday, 27 February 2008
Maven updates its plugin metadata then says it can't find the plugin - WTF?
Then I got an error:
mvn idea:idea
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'idea'.
[INFO] artifact org.apache.maven.plugins:maven-idea-plugin: checking
for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-idea-plugin
Reason: Error getting POM for
'org.apache.maven.plugins:maven-idea-plugin' from the repository:
Failed to resolve artifact, possibly due to a repository list that is
not appropriately equipped for this artifact's metadata.
org.apache.maven.plugins:maven-idea-plugin:pom:2.2-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Now I look in my Maven repository, in the maven-idea-plugin directory, in
\.m2\repository\org\apache\maven\plugins\maven-idea-plugin
and I find the maven-metadata-central.xml which has this:
<?xml version="1.0"?><metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<versioning>
<latest>2.2-SNAPSHOT</latest>
<release>2.1</release>
<versions>
<version>2.0-beta-1</version>
<version>2.0</version>
<version>2.1</version>
<version>2.0-beta-2-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</versions>
<lastUpdated>20070716221242</lastUpdated>
</versioning>
</metadata>
But when I look in the location:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-idea-plugin/
And get the maven-metadata.xml, it has:
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<versioning>
<latest>2.1</latest>
<release>2.1</release>
<versions>
<version>2.0-beta-1</version>
<version>2.0</version>
<version>2.1</version>
</versions>
<lastUpdated>20070604220104</lastUpdated>
</versioning>
</metadata>
The only possible reason I can think of for this happening is that
Maven is getting the metadata from somewhere else. We are using
Artifactory and one of the repositories we have set up is an entry
pointing to http://people.apache.org/repo/m2-incubating-repository.
The artifactory.config.xml contains this:
<remoteRepository>
<key>apache-m2-incubating</key>
<handleReleases>true</handleReleases>
<handleSnapshots>true</handleSnapshots>
<excludesPattern>org/artifactory/**,org/jfrog/**,au/com/company/**</excludesPattern>
<url>http://people.apache.org/repo/m2-incubating-repository
<proxyRef>work-proxy</proxyRef>
</remoteRepository>
Now in this repository, there is a directory for maven-idea plugin, at
http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-idea-plugin/
and there is a file
http://people.apache.org/repo/m2-snapshot-repository/org/apache/maven/plugins/maven-idea-plugin/maven-metadata.xml
that contains:
−
<metadata>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-idea-plugin</artifactId>
<version>2.0-beta-2-SNAPSHOT</version>
<versioning>
<latest>2.2-SNAPSHOT</latest>
<versions>
<version>2.0-beta-2-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<version>2.1-SNAPSHOT</version>
<version>2.2-SNAPSHOT</version>
</versions>
<lastUpdated>20070716221242</lastUpdated>
</versioning>
</metadata>
Now the strange thing is that this info is not exactly the same as
what's in my local repository. So it looks like the
maven-metadata-central.xml I have for maven-idea-plugin did *not* come
from this location. So where did it come from? I should probably add
to the exclusion list for the above repository so it doesn't try and
get maven plugins from there. But from the error message I got, it
looks like it only goes to the central repository at repo1.maven.org
for plugin updates. If that's the case, why does it seem to go
somewhere else for it's plugin updates?
What the hell is Maven actually doing?
Thursday, 21 February 2008
Maven woes # 2923928923829: Maven metadata not reflecting what's on maven repository
Alternate longer title: What the hell is wrong with Maven and why do
they push out these SNAPSHOT plugins with releases to other SNAPSHOT
jars that don't even exist? As a matter of principle, should you
really be forcing non-release, snapshot software upon your users?
Here's what I was getting:
Error: Reason: Error getting POM for
'org.apache.maven.plugins:maven-archetype-plugin'
Unable to run Maven archetype because it is trying to download a
plugin that it can't get from the central Maven repository.
Turns out it's because of an inconsistency between the settings it has
in the location
\[username]\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-central.xml
and what is actually on
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/
C:\dev>mvn archetype:create -DgroupId=au.com.company.myapp -DartifactId=my-app
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[INFO] artifact org.apache.maven.plugins:maven-archetype-plugin:
checking for updates from central
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.apache.maven.plugins:maven-archetype-plugin
Reason: Error getting POM for
'org.apache.maven.plugins:maven-archetype-plugin' from the repository:
Failed to resolve
artifact, possibly due to a repository list that is not appropriately
equipped for this artifact's metadata.
org.apache.maven.plugins:maven-archetype-plugin:pom:2.0-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
for project org.apache.maven.plugins:maven-archetype-plugin
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Feb 20 17:35:46 EST 2008
[INFO] Final Memory: 1M/254M
[INFO] ------------------------------------------------------------------------
Solution:
1. Go into
\[user]\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin\maven-metadata-central.xml
rename this file or delete it.
2. Get the file
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
Download it to .m2\repository\org\apache\maven\plugins\maven-archetype-plugin\
and save it as maven-metadata-central.xml
3. Rerun the above process
mvn archetype:create -DgroupId=au.com.mydomain.myapp -DartifactId=my-app
now maven metadata is pointing to files that actually exist on the repository.
But the big questions here are:
Why is there a discrepancy at all? What other repositories could the
maven-metadata-central.xml be talking about if not the main
http://repo1.maven.org? Where did the maven-metadata-central.xml come
from anyway?
As a matter of design, why do I end up receiving - without my asking
for it - bleeding edge snapshot plugins? Shouldn't the policy be to
only use release versions?
Okay, maybe this argument is not really valid in this instance because
we are talking about the archetype-plugin. From the looks of what's on
the repository, it went out as 1.0-alpha-3 then to 1.0-alpha-5, then
1.0-alpha-7 - and now it's at 2.0-alpha-1. Good god, is this thing
*ever* going to get to an actual release number, one that doesn't have
greek letters after the .0?
Update on 6 Oct 2011:
NOTE: As commenters below have pointed out, the mixup normally occurs when you are - probably unknowingly - getting artifacts from both release and snapshot repositories.
The thing to remember is to make a distinction between release and snapshot repositories. The fact that you are pointing to a public repository is not enough. A repository obviously has to be public so that other people can access it. The question is: what types of artifacts are the repository providing? They may actually have both types.
Friday, 15 February 2008
iPhoto alternative found! Photo Mechanic - retains your directory structure, doesn't have its ownf format for your photos, allows editing of EXIF metadata
of whether or not to use iPhoto is.. uh, pretty vexing. I've heard
iPhoto stores all of its photos in pretty much one database file, and
I've got about 50Gb of photos accumulated over the past 5 years, so I
want to be sure that 1) it won't slow down to a crawl and try to load
all my photos every time it runs; 2) will retain any EXIF information
I have in them and allow edits to them as well.
I found this blog entry about a program called PhotoMechanic that
seems to fit the bill and do a lot that I've gotten used to in Picasa
on the PC. It retains all the photos in their own directories,
according to how I've organised them, it allows editing of a *lot* of
EXIF metadata (which on the PC i perform using the excellent utility
Exifr), and it doesn't force you to add them to its database of
photos.
It doesn't allow photo editing, and is not as good at slideshows, but
I don't do much of the latter anyway. I hope I find a clean way of
integrating the photo editing into my photo workflow.
http://www.comatosed.ca/writing/writing/reviews/exif_iphoto_vs_photomechanic1.html
I'll download it and see if it's a better fit with the way I use my photos.
<2 minutes later>
Oh great. They don't sell it online.
"We do not have web sales setup yet. To place an order for the
products above, please contact Camera Bits, Inc. directly. We accept
Visa, Mastercard, and American Express credit cards for payment."
Haven't these people heard of Kagi? (http://www.kagi.com/index.php)
Shareware vendors have been using this for years!
Where is my Picasa for OS X? Pleeeease, Google-matrix-skynet, out with
it already! But put in a plug-in architecture so that people can
develop Flickr uploaders. I know you have your Picasa Web Albums but
it's not in the same league, not even the same country, not even the
same planet as Flickr.
Thursday, 14 February 2008
I've never been to me
balance is NEGATIVE, which kinda threw shit on my plans to have a
romantic Valentine's dinner with my wife at the local Vietnamese
place.
Now when I find myself in times of trouble, I turn to the classics. In
this case, the nearest one on hand was Charlene's "Never Been To Me".
I'd never listened to it closely before, but I worked out the part
where she's doing the narration, and I didn't realise it's actually a
bit of a cynical song.
"Hey, you know what paradise is? It's a lie, a fantasy we create about
people and places as we want them to be.
But you know what truth is? It's that little baby you're holding. It's
that man you fought with this morning, the same one you're going to
make love with tonight.
That's truth. That's love."
D'ya hear that people?
PARADISE IS A LIE! A FANTASY WE CREATE ABOUT PEOPLE AND PLACES AS WE
WANT THEM TO BE!!!
Now if that ain't fodder for your next up-and-coming emo band, I don't
know what is. Come on kids, work on those Charlene samples and get
'em into those anthemic choruses! I believe in you! Yizzgaarnoff,
maaaate!
That's the truth. That's love.
Wednesday, 13 February 2008
Configuring Subversion authentication using Windows Active Directory and Basic Auth from a file - problems encountered and workaround
Windows authentication. This keeps everyone's SVN logins updated
whenever their network logins change. All well and good, but then we
had to set up a build server using Cruisecontrol, and we are not able
to get a Windows network username for that. So we had to create a user
set up in a config file, and use Basic Auth for that.
WHAT DIDN'T WORK:
The first attempt at configuring Apache's httpd.conf, which was the
example show in other blogs and forum posts was something like:
# Location of our Subversion repository
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthName "Subversion repositories"
AuthType SSPI
SSPIAuth On
SSPIAuthoritative Off
SSPIDomain NEWS
SSPIOfferBasic On
# need to set this up so only select users/ group can have chk-in access.
# might want to restrict who can read as well.
# make sure this file is outside the SVNParentPath
AuthzSVNAccessFile "D:\repository\svnaccessfile.txt"
AuthType Basic
# make sure this file is outside the SVNParentPath
AuthUserFile "D:\repository\svn-httpasswd.txt"
AuthBasicAuthoritative Off
Require valid-user
</Location>
The problem was it never worked. The Basic Authentication never
worked. Only the Windows Authentication allowed me to get in.
WHAT WORKED:
So I ended up creating another Apache <Location> for use solely by
CruiseControl. And this has worked fine without any problems.
# Location of our Subversion repository
<Location /svn>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthType SSPI
AuthName "Subversion repositories - Active Directory authentication"
SSPIAuth On
SSPIAuthoritative On
SSPIDomain NEWS
SSPIOfferBasic On
# need to set this up so only select users/ group can have chk-in access.
# might want to restrict who can read as well.
# make sure this file is outside the SVNParentPath
AuthzSVNAccessFile "D:\repository\svnaccessfile.txt"
Require valid-user
</Location>
# we were unable to get the /svn working to use BOTH Active Directory
and Basic Auth from a file,
# so we have to set up another one.
# Location of our Subversion repository used only by CruiseControl
# all others should use the standard /svn URL defined above
<Location /cruisecontrol>
DAV svn
SVNListParentPath on
SVNParentPath "D:\repository\svn"
AuthName "Cruisecontrol Subversion repositories"
AuthType Basic
# make sure this file is outside the SVNParentPath
AuthUserFile "D:\repository\svn-httpasswd.txt"
Require user cruisecontrol
</Location>
Tuesday, 12 February 2008
GTD - toread
lists, not checking them enough, and haven't implemented enough task
breakdowns and specific, more physical "Next Actions". Actually, I
only have a big to-do list, not broken down into Projects (with more
than one action) and simple To Do list. And I don't have that Someday/
Maybe list.
I mentioned it to a friend and he sent me a link:
http://lifehacker.com/software/feature/practicing-simplified-gtd-335269.php
Then all these links got added, as the article links to these, etc etc.
http://lifehacker.com/software/geek-to-live/the-art-of-the-doable-to+do-list-270404.php
http://www.43folders.com/2007/06/19/buffington-igtd-01
http://www.43folders.com/2005/09/12/building-a-smarter-to-do-list-part-i
http://www.43folders.com/2005/09/13/building-a-smarter-to-do-list-part-ii
http://www.macworld.com/article/51703/2006/07/augworkingmac.html
http://lifehacker.com/software/getting-things-done/getting-into-the-weekly-review-habit-278118.php
http://lifehacker.com/software/top/geek-to-live--empty-your-inbox-with-the-trusted-trio-182318.php
http://jonathanstoolbar.blogspot.com/2007/02/12-to-do-find-to-do-list-manager.html
Then found software that looks perfect for GTD (and it's free):
Sunday, 3 February 2008
Email to Flickr about Microsoft bid for Yahoo + Flick reply
"I am terribly depressed about the news of the Microsoft bid for
Yahoo. Would there be any way on earth of ensuring that MS keep their
fists of ham away from Flickr, thus keeping it as the world's best
photo sharing site? Somehow, I think the answer is no. The very least
they would do is re-brand this sucka, which I can live with. But
almost certainly they won't leave it at that. That would be too
different from past behaviour.
I can't imagine that this mass acquisition of web properties won't tie
into their grand scheme of "fixing this platform independent internet
problem". Of course they'd use this to extend their hold on the
desktop. A Flickr uploader that requires Vista *and* Silverlight?
Start boning up on your .Net, guys... And maybe they'll get some of
those ad dollars going to Google... ads and IE-only pages on Flickr,
even for paid users... coming soon.
Good thing I don't keep stuff on Yahoo Mail, or I'd be in utter torment. "
--------------
(updated)
And last night got a reply from Flickr:
"Hello,
Thank you for contacting Flickr Customer Care.
On January 31, 2008, Yahoo! received an unsolicited proposal from Microsoft to acquire the Company. The Company's Board of Directors will evaluate this proposal carefully and promptly in the context of Yahoo!'s strategic plans and pursue the best course of action to maximize long-term value for shareholders.
We remain committed to you and to continue to provide you with industry-leading products and service.
Thank you again for contacting us. If you have any other questions, please feel free to reply to this email.
Regards,
Maria
Flickr Customer Care"
Saturday, 2 February 2008
Unix tips: count total number of lines in a directory tree of files
find monthly_reports/ -iname '*.csv' \
| xargs -n 1 wc -l \
| cut -d' ' -f1 \
| (SUM=0; while read NUM; do SUM=$(($SUM+$NUM)); done; echo $SUM)
PROBLEM: this has trouble if file names have spaces in them.
To find out how many lines in total are contained in a subdirectory of
files, there is the "Wc" command, which is a recursive version of "wc"
Wc -l monthly_reports/*/*.csv
-l specifies count the lines
Tuesday, 15 January 2008
Problems connecting to WiFi from 24" aluminum iMac
My wireless setup was:
Channel 6
WPA-PSK
Encryption: AES
Now all along I was thinking it was one of these reasons:
1. the Airport card was faulty
2. it was an OS X config problem - WPA2 encryption-related
3. it was a Leopard problem
Now I was really hoping it wasn't #1, because it would have been a royal pain in the ass to try and send back a 9kg computer in the mail. It didn't seem likely because I was able to connect to my neighbour's wifi network without problem. Which leads us to #2 - well, no way was I going to leave my connection unsecured, but just to test out this theory, I turned off the wifi security for a while. And for a couple of times it worked - I could connect to the network and use a browser, etc. Until it stopped doing it.
The last one was #3, and I was all ready to update to 10.5.1 - but I remembered that when I first set up my wireless connection I was using Channel 1. I moved to Channel 6 because I was getting some trouble connecting from the Powerbook downstairs. So I hooked up the iMac to the router, changed to Channel 1, unplugged from the router - voila! all working!
I later found a forum posting (http://discussions.apple.com/thread.jspa?messageID=1822533#1822533) which claimed that Apple engineers had mentioned a conflict between Bluetooth and Channel 6 on wifi. Looks like that was the problem I was having. Bluetooth is on by default, so I turned it off. But I haven't changed the router back to Channel 6. I figure it's better to leave things alone once they work!
Solution to Problem:
4. change wireless channel from channel 6 to channel 1. In some cases Channel 6 conflicts with Bluetooth. So either turn off Bluetooth or stop using Channel 6.
Thursday, 10 January 2008
To get listing of directories use ls -d */
different directories so i can compare their contents. The usual 'ls'
returns too much info. Finally got it working with:
ls -d */
- gets listing of directories ending in /
- will not get the '.' entry
Wednesday, 9 January 2008
Problems installing mysql gem on Centos? Try installing the mysql development headers first
> gem install mysql
Updating metadata for 6 gems from http://gems.rubyforge.org
......
complete
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby
--with-mysql-config
--without-mysql-config
--with-mysql-dir
--without-mysql-dir
--with-mysql-include
--without-mysql-include=${mysql-dir}/include
--with-mysql-lib
--without-mysql-lib=${mysql-dir}/lib
--with-mysqlclientlib
--without-mysqlclientlib
--with-mlib
--without-mlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-zlib
--without-zlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-socketlib
--without-socketlib
--with-mysqlclientlib
--without-mysqlclientlib
--with-nsllib
--without-nsllib
--with-mysqlclientlib
--without-mysqlclientlib
Gem files will remain installed in /usr/lib64/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/lib64/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
I managed to fix it by installing the mysql development headers first. We had already downloaded it onto the server, so instead of using yum, we used rpm -i to install it. Yum wouldn't have worked anyway, because we were using Mysql 5.1.22, which is not yet on the yum repository (only 5.0.45 is there).
rpm -i MySQL-devel-community-5.1.22-0.rhel5.x86_64.rpm
[root@cr1sescl01 mysql]# gem install mysql
Updating metadata for 32 gems from http://gems.rubyforge.org
................................
complete
Building native extensions. This could take a while...
Successfully installed mysql-2.7
1 gem installed
Friday, 28 December 2007
Guitar Hero III - The Fall of Gondor
video games. This was just made clear and stark to me during my
attempts at playing Guitar Hero III on the Wii. I will just have to
admit defeat and shout it out loud to the world - I SUCK at this.
Whether this is reflective of my lack of musical ability, or just lack
of hand eye coordination in general is beside the point. I wanted to
kick ass, and instead got the can of whup ass poured and spread all
over me like that time in Thailand when we were on that deserted
island, and this girl... oops...
I tried, Ma, I really tried. I haven't even gone past Easy level.
I've played Hit Me With Your Best Shot and Slow Ride umpteen times,
but I still can't get 100% note coverage. I played Cherub Rock, one of
my ultimate ever rock anthems, over and over and over again, and
eventually managed to get around 48,000. Then my 17-yr. old brother
comes along, who's never heard the song before, plays it for the first
time and gets 42,000. It's just not fair.
I absolutely love these songs on Guitar Hero III: Cherub Rock,
Paranoid, Kool Thing, Cult of Personality, Welcome to the Jungle,
Bulls on Parade. These alone are worth the price of admission. But
they don't seem to love me back. Shouldn't you get extra points if
the guitar controller detects your enormous, all-enveloping,
tingling-through-every-fiber-of-your-being worship of these songs?
Shouldn't a score multiplier apply when it sees that you've had them
on repeat in Winamp for like, forever? That you've annoyed countless
friends (okay, all three of them) when you sang along in the car and
you also *sing the guitar solos*? What, they didn't install that
feature?
It's pre-midlife crisis therapy for those of us who can't afford the
Harley or Ferrari. Pretending to be a golden god, struggling with your
own limitations in the harsh face of anonymity. Maybe you've already
missed the fucking bus. Maybe it's too late to be somebody significant
to anyone but your immediate kin. All you can do is pick up the
plastic Les Paul, shake your hips doing the Axl Rose snake dance, and
get the led out using Star Power.
Wednesday, 26 December 2007
This revolution will be text messaged
By Marguerite Reardon
Filipinos have been masters of using text messages to rally political
protesters. So what happened during last month's failed coup d'etat?
http://www.news.com/This-revolution-will-be-text-messaged/2100-1039_3-6222963.html
Monday, 17 December 2007
Nintendo shortages for the 2nd year in a row
by now. Or is there really a phenomenal spike in demand that have
caught them unaware? Christmas 2007 already and the shops *still*
don't have enough stock of the Nintendo Wii? Surely they wouldn't be
manufacturing these shortages to fuck with us salivating consumers!
Thursday, 13 December 2007
Today is the first day of the rest of your Gmail life - taking the zero inbox plunge
Selected the 3000+ messages wallowing in my Gmail inbox for the last 2
years and archived all of them.
Obviously, it's not as radical as it should be, since they're really
*still there* - just not in your face. So if I ever need to remember
that so-and-so sent me a link to their photo album on such a date, I
can possibly look it up. Possibly. All this hinges on the assumption
that I can search for old items if I ever really need to. If the
search terms in my head don't match anything in the message, then it's
effectively disappeared, but taking up precious inbox space.
I held off for such a long time. Kept saying "I'll go through the
unread ones, and read them and tag them." Nah, it was just all too
much. For me, trying to delete old emails is at times like trying to
decide which photos of my baby I should delete. Silly, I know, since
their value is way down on the sliding scale compared to pics of my
first child. I don't know. Maybe it's just my pack rat mentality gone
digital.
Here's to clean inboxes!
Maybe I should start learning those Gmail keyboard shortcuts, while
I'm at it. But would these work cross-browser? Firefox *and* Opera
*and* Safari *and* Camino. (yes, camino is using firefox engine, but
UI is native OSX, so maybe they handle things differently)
<drift />
<meander />
Oh boy, we have an official fun day at work tomorrow. Bowling in the
morning then lunch then watching the premier of Darjeeling Limited.
The title just prepares me to be bored. Darjeeling - tea, hmmm...
Could this be another "English Patient" experience? Good grief. Then
early mark and work party in the city from 7 to 11pm. Moulin Rouge
theme. Hope the hotties in marketing and sales all dress up like the
Green Fairy. Or some such sexy variant. The invite suggested at least
wearing black and/or red. Woohoo. My White Stripes tee will be
purfect. Too bad I don't have any black pants though. Maybe I should
wear green and orange, just to be contrarian.
Oh well, time to go.