AUTHORBut they still claim to have the Copyright. Funny maybe the original author didn't approve with this.
Written by FIXME unknown.
GNU coreutils funny
Just had a look at the basename man page and found this:
Importance of dates
When browsing the web I don't want to look at old data, so when reading I try to find out when the page was last updated. Now blogging and wikis have become so popular there is normally a date associated with the post but otherwise you are normally left to guess based on version numbers of programs people used.
So if you are a web developer please never forget the date something was created.Further I was looking for a tool which detects changes and dispays the last changed date. Google somtimes can display this but for about 80% of the pages this information is not available. Why has nobody written a tool that wgets pages and md5sums them to see it they have changed and displays this date. I know it is not always that easy, but a tool like that would be soo usefull. Maybe a firefox plugin could help.
A useful little bashrc addition
I really like checking if commands have executed successfully. This is something quite important if you are administering a machine. Normally I just
This will make the prompt green if everything went OK and red if the process didn't return 0. Nice little helper :)
echo $?
but now I have added a new line to my .bashrc that will show me this in colour.
export PS1='\[\033[0;32m\]\u@\h \[\033[0;33m\]\w\[\033[${?/[^0]/31}m\]\$ \[\033[0;38m\]'
This will make the prompt green if everything went OK and red if the process didn't return 0. Nice little helper :)
CentOS help
Something people have asked me about is what to do when yum gives you the error
Finished ;) Just a little cleanup of the completed transactions file
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.This is very simple
$ yum install yum-utils
$ /usr/sbin/yum-complete-transaction
Finished ;) Just a little cleanup of the completed transactions file
Howto reset your Windows Vista password
On my laptop I had forgotten my password because I always use the finger print reader. And I never really needed it because windows, once you are logged in, never really prompts you for it. But today I needed it and I didn't know it. So what do you do? Here are some simple steps.
- Create another user account with Admin rights
- Log in as that user
- Change your `real` user password
- Log in as your `real` user and delete the other account
detex for CentOS
So another little porting effort. This time it is detex
Quite a useful little tool. When I get time I might rewrite it in perl to make it more portable.
Download the [RPM]
[SRPM] and spec file:
You will also need the little patch file
DeTeX is a filter program that removes the LaTeX (or TeX) control sequences from the input so that the real content can be passed to a spell or diction checker.I am using this for my dissertation to count the words used
detex dissertation.tex | wc
Quite a useful little tool. When I get time I might rewrite it in perl to make it more portable.
Download the [RPM]
[SRPM] and spec file:
Summary: Strips Tex and LaTex commands from a file
Name: detex
Version: 2.8
Release: 1
License: BSD
Group: Applications/Text
URL: http://www.cs.purdue.edu/homes/trinkle/detex/
Source: http://www.cs.purdue.edu/homes/trinkle/detex/%{name}-%{version}.tar
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
Patch0: mallocandtroff.patch
BuildRequires: flex
BuildRequires: groff
%description
DeTeX is a filter program that removes the LaTeX (or TeX)
control sequences from the input so that the real content can be
passed to a spell or diction checker
%prep
%setup
%patch -p0
%build
%{__make} detex man-page prefix="%{_prefix}" CFLAGS="%{optflags} -DNO_MALLOC_DECL"
%install
%{__rm} -rf %{buildroot}
#%{__make} install DESTDIR="%{buildroot}"
%{__install} -Dp -m0755 detex %{buildroot}%{_bindir}/detex
%{__install} -Dp -m0644 detex.1 %{buildroot}%{_mandir}/man1/detex.1
%clean
%{__rm} -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
%doc %{_mandir}/man1/detex.1*
%{_bindir}/detex
%changelog
* Tue Apr 21 2009 Hoffmann Geerd-Dietger- 2.8-1
- Initial package.
You will also need the little patch file
--- Makefile.orig 2009-04-21 01:50:44.735919044 +0100
+++ Makefile 2009-04-21 01:51:18.237692007 +0100
@@ -49,7 +49,7 @@
# Compile time flags, just uncomment the necessary lines
# Some say GNU make does not correctly handle += -- you may have to use :=
#
-DEFS =
+DEFS += -DNO_MALLOC_DECL
#
# Add -traditional for GNU cc on ISC 386/ix system and possibly others
# (reported by pinard@iro.umontreal.ca)
@@ -116,7 +116,7 @@
mv detex.c lexout.c
man-page:
- troff -man detex.1l
+ nroff -man detex.1l > detex.1
# If you want detex available as delatex, uncomment the last two lines of
# this target
My word was accepted
When talking about c (as in programming) you normally hear happyland for undefined memory. So I decided to submit one of my favorite terms to the urban dictionary.
Some people claim I came up with this term. Patent pending ;)
Using eval to use a string as comparison
I am just writing a little compiler and interpreter and I have a method to check if 2 values are equal, not equal greater and so on. My code looked something like this
But this was quite inflexible and I didn't like all the returns. As the type of the comparison was already checked by the parser I came up with a simpler method
if typeOfCompare == "==":
return firstVal == secondVal
elif typeOfCompare == "!=":
return firstVal != secondVal
elif typeOfCompare == "<=":
return firstVal <= secondVal
....
return eval(str(firstVal) + typeOfCompare + str(secondVal))This might be a performance hit and not as clear but its easier to code and more extensible. You got to love python enabling something like this using a string as comparison operator.
Some research into what other people have done
So I thought I might have a look at what other people on my course have done in previous years as a final year project and how they structured it. So I though quite a few people must have put their projects online as a pdf. So I wrote a little scrip that would query the online list and then Google search for the topic. Here is the script
And off I went to look at Google. But only one guy had put his dissertation online. Some people would conclude some stuff about Bournemouth uni students but I will restrain from this. But I still think the projects should be uploaded to somewhere. I know other Universities print books with all the projects in them so their students get publications.
On anther note: I really like the hpricot library, makes parsing HTML really easy. Even if you are not a big fan of ruby you might want to have a look at it.
:
#!/usr/bin/ruby
require "open-uri"
require 'rubygems'
require 'hpricot'
page = open("cit0708.html")
doc = Hpricot.parse(page)
(doc/"table.body_showcase").each do |link|
a = (link/"p")
puts "firefox \'http://www.google.co.uk/search?q=\"" + a.first.inner_html + "\"\'"
end
And off I went to look at Google. But only one guy had put his dissertation online. Some people would conclude some stuff about Bournemouth uni students but I will restrain from this. But I still think the projects should be uploaded to somewhere. I know other Universities print books with all the projects in them so their students get publications.
On anther note: I really like the hpricot library, makes parsing HTML really easy. Even if you are not a big fan of ruby you might want to have a look at it.
Subscribe to:
Posts (Atom)