Skip to content

Ludo's LRT blog

just another Learning and Research Technologies weblog

If you’re using Windows for scripting, development, hackery or the like, you probably want to use the good old Windows command line now and then, or even quite frequently.

This tip allows you to create a portable shortcut that you can drag to any directory and it’ll automatically use the directory it’s in as its working directory.

  1. Create a new shortcut to cmd.exe
    (e.g. by right-clicking on the Desktop and picking ‘New > Shortcut…’).
  2. Right-click the shortcut and go to Properties.
  3. In the ‘Start In…’ field, type:
    %1
  4. Enter / OK everything.

You can now drag & drop or copy this shortcut to any directory and it will always open with the current directory as its working directory. This saves you having to type it in or always cd away from c:\windows\system32.

It’s also pretty handy if, like me, you have a shortcut to cmd.exe in a Dropbox folder that is synched between two different computers with the Dropbox folder in different places! In fact, it’s ideal!

Flash wouldn’t install for me in Mozilla Firefox or Microsoft Internet Explorer, no matter what I tried. However, it was available in Google Chrome by default, as it comes pre-installed into that browser.

Here’s how I cracked the problem, as posted by me at Adobe.com.

This post is password protected. To view it please enter your password below:

Here in the LRT team at MMU we would love to use AD (global security) groups to target SharePoint web parts.  We are using MOSS 2007.

Unfortunately, it doesn’t quite work, although it used to some time ago.

Here’s a pictorial guide to what happens when we try to create a new AD group and use it in SharePoint:

  1. Create a new global security group in AD.mmu.ac.uk.  Incidentally, inside our own LRT container. AD new group dialogue box
  2. Populate the group with a number of users who already have access to our test SharePoint web portal.add members to AD group
  3. Pick a shared web part, edit its properties, go to Advanced.trying to audience web part to AD group in SharePoint
  4. Under Target Audiences, try typing in the name of the new group and clicking the ‘tick’ icon to have it recognised.  It isn’t recognised, so SP underlines it in crinkly red and italicises it.
  5. That can’t be right!  The group is right there in the AD!  Just to check, let’s delete the group name, then click on the ‘book’ icon next to the text box and look in there.
  6. The ‘find audiences and groups’ dialogue box opens.  Select ‘Distribution / Security Groups’.  Try typing part of the name of your group and click on the magnifying glass.  The group is not found.
  7. OK, let’s try all the above again from step 3 onwards, but first we’ll go to the SSP and do a full profile import.
  8. Nope, still doesn’t work.

However, some groups that we have created do eventually appear in SharePoint, only with not as many members as they should have.  For instance, the group ‘hlss-election’ wasn’t appearing before.  Now it appears, with only one member.  It isn’t recognised in the ‘Target Audiences’ box if I type it in and click ‘Check Names’, but it is available using the ‘Browse’ feature (book icon).

adding group hlss-election

If we ‘Browse’ the book, we can see that hlss-election has one member.  However, in AD it has three members.

browsing hlss-election group in the 'Book'

One thing that might be of note is that I had added some text to the group’s Description field in AD Users & Computers before the last import.  This was suggested as being important in a blog post we found on the subject (look for Jason in the comments).

–Ends–

By default, the Shutdown button on the login screen of a Windows Server is disabled. This is to ensure that unauthorised users cannot walk up to the server and just switch it off from the login screen. Or worse, remote-desktop to it and just switch it off from the login screen!

But if you’re running Windows Server 2003 on a virtual machine on your desktop PC, this can be annoying. If, for example, your server suddenly decides not to log you on due to an ephemeral problem, as mine did today. Or in case you’ve booted it up, but decide you don’t want to log in after all.

To enable the Shutdown button, go into Local Security Policies (secpol.msc) or Group Policy (gpedit.msc), depending on which is more appropriate (I went with Local) – the setting should be accessible through either.

In the treeview on the left, you should have a root node of Security Settings. Under this go to Local Policies > Security Options. In the list of policies in the right pane, you should be able to see “Shutdown: Allow system to be shut down without having to log on”. This should be Disabled. Right-click to open Properties, then Enable the policy. Restart the computer.

un-grey shutdown btn

The following MS KB article pretty much describes the above procedure: http://support.microsoft.com/kb/313924/en-gb

NB: you can see what Group Policies (and local security policies?) are installed on your machine using the tool rsop.msc, which shows you the “Resultant Set of Policies”.

This post is password protected. To view it please enter your password below:

MMUnion web content snapshot

MMUnion web content snapshot

MMUnion contacted LRT to ask us to put some material relating to two MMUnion campaigns on the Welcome page of the student portal, myMMU.

Below is the resulting code I put on the portal’s Home page.  A picture of the web content as it appeared on myMMU is visible to the left.

 

<h2>Student Elections!</h2>
<div style="font-size:1.4em;">
<img alt="MMUnion eleXions - eXperience of a lifetime - nominations close 26 feb" src="https://my.mmu.ac.uk/PublishingImages/elections-image-s.jpg" style="float:left; margin-right: 10px; margin-bottom: 6px;">
<p>MMUnion are offering you the career opportunity of a lifetime!
Think you could represent and make decisions for over 34,000 students... and get paid for it? Then stand in the student elections now!</p>
<p>
We have <strong>6 paid positions</strong> available for full-time student officers for 2011/2012. Any student can run for election whether you are half way through your studies or graduating this year.
</p>
 
<p>
This is an opportunity you won't find anywhere else. You will become a trustee for a large charitable organisation, represent over 34,000 students and get the chance to make a real difference to the lives of MMU students.
</p><p>
With ONLY 6 positions available, what are you waiting for? Visit <b><a href="http://www.mmunion.co.uk/elections" target="blank">www.mmunion.co.uk/elections</a></b> to find out more about this unique role and to nominate yourself!
</p>
<p>
Nominations close Sunday 26th Feb.
</p>
</div>
 
<br/>
<br/>
<h2 style="clear:both;">MMUnion Teaching Awards</h2>
 
<div style="font-size:1.4em;">
<img alt="MMUnion teaching awards: girl with hands in heart shape: I love my lecturer logo" src="https://my.mmu.ac.uk/PublishingImages/teaching-award-image-s.jpg" style="float:right; margin-left: 10px; margin-bottom: 6px;"></img><p>
Vote now in the MMUnion Teaching Awards and reward someone who has made a difference to your learning!
</p>
<p>
The MMUnion Teaching Awards is your opportunity to recognise and reward individuals, courses or departments for excellence in teaching and a commitment to making your learning experience the best it can be.
</p>
<p>
Do you know a hard working course rep, an inspiring teacher or just simply love your course? If so, we want to hear about it.
There are <strong>9 awards up for grabs</strong> and it's up to <strong>you</strong> who wins them. Check out the full list of the categories and nominate at <b><a href="http://www.mmunion.co.uk/ilovemylecturer" target="blank">www.mmunion.co.uk/ilovemylecturer</a></b>. 
 
</p>
<p>
Those nominated will be judged by a set of criteria and shortlisted before a winner is decided at a high profile awards evening.
</p>
</div>

Since LRT includes two Gujarati speakers, i.e. about a third of the workforce, I thought I’d have a stab at learning it, seeing as I’m a fair hand at learning languages.
The main initial hurdle is picking up the alphabet, which shouldn’t be too much of a problem as I managed to pick up quite a lot of the Thai alphabet when I was there in 2004.  However, several of the letters (like in Thai actually) sound the same as each other, which could be a bit of a problem.  Or I could just not care about the difference for a bit.

Here is a list of useful and interesting Gujarati resources on the web:

GujaratiLexicon.com

Wikipedia on Gujarati language

Wikipedia on Gujarati script

Wikitravel Gujarati phrasebook

Gujarati Wikipedia (Gujarati to Gujarati)

Gujarati Wiktionary

* Deleted all the old SharePoint logs from last year in the web frontend servers’ 12 hive\LOGS\ in the folder beginning with a ’574′ or something number.  This saved up 6GB on one and 8GB on the other.
* Kieron moved the IIS logs from one of the web frontends onto our WD 1TB external disk.
* We moved the group and cluster on the SQL Server DB cluster from DB2 to DB1, which has appeared to be more reliable in the past (but should be identical).

This didn’t solve all our problems and we had terrible page load slowness on our whole SharePoint setup.  Event logs on our SharePoint servers were showing a lot of problems contacting the SQL server cluster.  So we:

* checked the DNS settings on all SP and DB servers and removed an old DC server’s IP that had been demoted from being a DC/DNS server (but which was still sitting around being pingable) and stuck its replacement’s IP in instead
* restarted both DB servers in the DB cluster, moving the SQL group and cluster group first (though it’s designed to failover automatically if the server goes down of course).

After the latter two actions our farm seemed to be functioning happily with very fast page loads and all web parts working correctly.

I got this error back from mscorlib while debugging a Perl script that was supposed to create a little file telling me how much disk space there is left on a database server and then email it to me.  I’d written a simple command line emailer app in C# which I was calling to send me the file.  (The file is made out of output from the CD command on the Windows command line, using Perl grep to pull back just the disk space free data out of that).

I kept getting the error whenever I ran the script, which ran the emailer at the end on the Windows command line.  I’d tried using exec(), system(), qx// and backticks to achieve this, but I always got the same error. However, if I ran the emailer command using cmd.exe, it worked fine, and the email would arrive seconds later.

I downloaded Process Explorer from Sysinternals, and tried searching for the file, to see which other process had it open.  But Process Explorer reported that no processes had it open!

Then I had a thought and looked through the Perl script…

Of course, I was writing to the file myself in the script, and had a filehandle open to it.  Of course, after the script finished executing, the filehandle would close.  So I was locking the file myself, wondering why, and then looking for what was locking it when it was no longer locked.

A simple close OUTFILE; before the exec() sorted things nicely.  

(I had actually bothered to explicity close the filehandle in an earlier version of the code, but subsequently removed the close command, considering it unnecessary. Duh!)