Tuesday, October 16, 2007

Mobile Calendar

A nice simple on today.

A neat little function of Google Calendar that I only noticed was available here (in Ireland ) recently is the Mobile notifications. Been using for the last couple of
weeks and its really made it invaluable, particularily when I don't get to check my
Gmail for a prolonged period of time , which does happen occasionally!


This is a doddle to set up. Go to Calendar Settings (top left corner of your Google
Calendar page) and click the Mobile Setup tab.




Once you enter your phone number and provider (chosen by country) ,you'll be
text (texted?) a verification code. Input it in the space provided, then just
select what you want notifications for. But choose wisely , if you have a busy calendar
you might not want notification of every single new event, acceptance,cancellation and reply!


p.s. just discovered scriptomatic a tool for creating WMI scripts, which comes with a bunch of examples to build on, amongst its tools are the ability to remotely update a windows registry, yipes!

Friday, September 28, 2007

Version Control Tip


Heres a problem I came across recently. The Unit tests for my current project are certified working on my desktop. But the build machine runs the test scripts and runs into a bunch of failures. Looking into it its become clear I haven't tagged something with the 'build' tag so the ant scripts aren't checking it out.

Now arguably we shouldn't need a build tag ("why would you check in code that you didn't want to build?") but to use one of my favorite pieces of office-speak 'we are where we are'.

So how do I track down the rogue untagged files? Do I try to recall which files I changed between builds? Sounds like a bit too time consuming and error prone for my liking.

Lest allow cvs do the work instead (in my case tortoise cvs my weapon of choice when dealing with CVS, its windows integrated so I don't have to switch contexts).


1. Simply Checkout a copy of your projects HEAD (or branch) into a sandbox ( or just the relevant package in your code if your codebase is to sprawling as to make checking everything out non-trivial).

2. Then Update your sandbox specifying the build tag.

3. As your cvs client performs the updates you will see a list of files which are being changed. these files will be the ones whose tags are not set to the latest on the HEAD/branch (i.e the ones you're looking for.

p.s. As you can see from the screenshot above, Tortoise has an option to simulate the update, so you can do it from within your workspace without fear of making any changes. I believe command line has the same option but a quick google isn't revealing it to me.

Friday, July 13, 2007

We all love Ping

really useful XP batch scripting resource.

I used it to put together the following.
for /L %%V in (1,1,255) do ping -n 1 -a  193.168.1.%%V >> c:\pingedMachines.txt


This pings every device in a given subdomain resolving the names as it does.
there are tools out there that will do this for you, but this will work on a vanilla XP machine. You could even parse the output to prettify it but if you need something
rough and ready this'll do.

really useful if that router isn't at the ip address you thought it was.

Ant tips





Depending on how your ant build is set up you may end up changing some properties more often than others. More often than not properties are fairly static so placing
them in a properties file is sufficent for most needs.

There are,however situations where you will change other properties more frequently,
say for example if you have a flag that controls whether you are performing a full build
(pull everything from cvs and start from scratch) or a partial build (where you
want to rebuild from source you've already pulled down with some minor change).

This is two tips relating to these frequently changing properties.

First of all to override a property in your properties file, set it on the command line
using the -D parameter.

e.g
 ant -DfullBuildPropertyName=true TaskName


This works because properties , once loaded in ant are immutable, so even if in your script
you load a properties file containing 'fullBuildPropertyName=false' it is ignored.


Secondly you can prompt the user to input a value when your script starts and set a property
based on that using the ant input tag.

for example:

<target name="getJavadocInput" unless="generate.javadoc" >
<input
message="Do you want to generate javadoc"
validargs="y,n"
addproperty="input.javadoc"
>
<condition property="generate.javadoc">
<equals arg1="y" arg2="${input.javadoc}"/>
</condition>
</target>

In this case the unless attribute in our target will not run if the property is already set
(in a property file or from the command line as per the last tip,
this means that we can run the script without user input if required (say for example
a scheduled build).

(incidentally the condition is not necessary, its simply a way of setting an 'empty'
property based on the value of the user entered property.)

Friday, June 29, 2007

Guest Tips 3: SQL Server reindex

And finally..

Tip #3

This neat litle bit of code rebuilds all indexes on all tables.
sp_MSforeachtable is a System Stored Procedure (as you can see from the sp_ prefix) that performs an action for every user table in the database.

exec sp_MSforeachtable 'dbcc dbreindex (''?'')'

Guest Tips 2:SQL Server row count

Tip #2

Here's a little bit of script to count all rows on all tables.
This uses two very useful features of SQL Server sp_MSforeachtable and temporary tables (designated with a #).
sp_MSforeachtable is a System Stored Procedure (as you can see from the sp_ prefix) that performs an action for every user table in the database.
Any table whose name begins with # is local and temporary. This means it is only visible to the current session and will be dropped when the session ends.

create table #temp_tables
(
nr_of_rows numeric (15,4),
table_name varchar(40),
)
go
exec sp_MSforeachtable 'insert into #temp_tables select count(*) as nr_of_rows, ''?'' as table_name from ?'
go
select * from #temp_tables
drop #temp_tables

Guest Tips 1: Outlook Extension blocking

A couple of Guest tips. 3 actually, these from a friend of mine, whose
Blog
can be found here.

So without further Ado
Tip #1
Here is a little registry hack to allow .exe and .zip attachments in Outlook
(if you really have to accept them, which the folks at Microsoft think
you don't...)

Please make sure you have backed up your registry first.
If you don't know how - please stop now!

Using regedit or regedit32, or some other tool to edit the registry, browse to
the following key:
HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Security\

Create a new String value called Level1remove and set the value = "exe;zip"

The reason this works:

Microsoft have built in two levels of attachment "protection" in Outlook.
Level 1 (these files cannot be received) which consists of a whole load of
dangerous file types; and Level 2 (these files must be downloaded to disk
before opening) which has no extensions by default and is user configurable.

Quite sensibly someone in Microsoft decided that to allow users to remove items
from Level 1 would be silly. Obviously users are "clickers" and want to be able
to receive everything and click on the virus payload if they so wish!

So, failsafes were built in:
Extensions on the Level 1 list will always be considered a threat
(no matter what action is taken by user or administrator).

Level 1 cannot be modified through the front end.

A system administrator can (if (s)he knows how) demote Level 1 "threats" to
Level 2 using the above registry key. This means that users will then be able to
receive the attachments but will still not be able to just "click" them open. The
file must be saved to disk first. Any user who will go to the trouble of saving
the attachment and opening it deserves what they get if it really is a threat.

You can include any extension in this string
(as long as it is on Microsoft's Level 1 restrict list obviously).

Wednesday, June 13, 2007

Gmail tip

Like most people I subscribe to a bunch of sites which send me email updates fairly regularly. For example I have several google alerts keyword searches and each one produces a separate email everyday. This is what I like to think of as 'background' mail, I don't NEED to check any of it.

So when I went on holidays for a couple of weeks recently, I had a lot of this 'background mail' built up of say 100 emails there is more than half of it I'm not interested in trawling through. I just want to mark them as read so only the items I really need to pay attention to are marked unread. "Why don't you just ignore them" you say? , leaving unread emails in my inbox would not sit well with me.

But all is not lost with a bit of forethought its easy to quickly mark all those messages as read.
Enter Gmail's filter functionality, you've probably seen it , its the filters tab under the settings menu, so without further ado, the details.

Create a new filter.

In the to: field enter the address from which the emails you wish to ignore orginate from. if you have more than one address you wish to ignore you need to use the OR operator (many useful gmail operators here)

you can also use partial addresses (if for example you wish to capture all emails from a particular domain just use @domainname)

a complete example here:







you can then hit "test search" to see what messages in your Inbox this pattern matches.
once your happy click next for the filter action

Filter Rule
A simple solution is to choose the filter so these messages skip the Inbox ( you can find them under 'All Mail' or by the label if it is given one, the messages are still marked as unread.

This isn't ideal for me; most of the time I do want to see those messages as they arrive in my inbox, so instead of applying this I simply apply a label such as 'Background Mail' (see image)









Cleaning Your Inbox

So now when I return from holidays and I see 100 emails. Instead of manually selecting the individual messages I'm not interested in reading (right now) and choosing the 'mark as read action'

I simply click the 'Background Mail' label from the labels list which shows all messages with that label (and only messages with the label).

I choose 'ALL' from the Select options .
Then in the Action drop down list I click mark as read.





now when I return to my inbox I can see exactly what needs reading!


Friday, May 25, 2007

Less is more

Very often when working on a project I deal with extremely large application log files which
poor old notepad.exe, or even trusty Ultraedit
just can't deal with.

Enter the windows port of the unix tool less,
which easily opens even the largest logfiles. The problem is
that running it in a command window makes copying text difficult, selecting a page at
a time and pasting it all back together into a file.

Which brings me to my useful tip. To copy any length of text from less to a file try the following.

navigate to the beginning (or end) of the piece of text you wish to copy, type
m
(for mark) and enter a marker letter of your choice at the prompt

navigate to the other end of the piece of text you wish to copy and press
|
(thats the pipe character, is the shifted value of the key '\' )
enter your marker letter at the prompt.
At the exclamation prompt enter

less -oC:\file.txt

where c:\file.txt is the name of the file you wish to write the data to.

This will open a new less session on your new file , you can hit Q to escape this
if you so wish.

Voila, text copied from less under windows.

p.s another quick tip , to make less behave like tail, simply press F while viewing the file.

Thursday, May 24, 2007

Froogle Friends

First post I'm going to go (relatively) old school with a simple
windows batch file. This tip is actually the one that inspired
me to create this blog I had actually forgotten about it
(my friends don't seem to have much interest in froogle!) but
I rediscovered it today and decided to share it here so others
can benefit (or at least I'm unlikely to forget it again!)

Everybody knows Froogle right?

good. Ok having had a browse and put some items I'm interested
in on my wishlist, I was curious to see if anyone else I knew
had done the same thing and Google being the forward thinking
people they are had provided the facility where you can put in
a friends email and see their wishlist (or a message saying they
don't have one)

Well being blessed with a large number of friends (or at least
other peoples email addresses) that looked like a lot of typing
and clicking that I would have to repeat to see if people had
updated or, indeed, created wishlists.

So I set about creating a batch file that would do the job for
me and here it is.

froogle.bat

FOR /F %%A IN (email.txt) DO (c:\progra~1\Mozill~1\firefox.exe
http://froogle.google.com/shoppinglist?action=FindOthersWishList^&email=%%A^&Find=Find)

(all the above is on one line!)

Notes:

  1. email.txt (in same directory as batch file) contains a list of email addresses on separate lines.
  2. I have firefox in there but you can use xp ( firefox will by default open these all in tabs, internet explorer of course will open separate windows, and interestingly will wait for you to close one before opening the next).
  3. this works on XP , changes may be required for older/newer versions of windows.
feel free to suggest a better way of doing this, I suspect yahoo pipes would be feasible and much cooler solution.