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).