Wednesday, 30 May 2018

Word Count examples

In applying for some jobs, rather than sending in a CV, some posts require you to fill out an Evidence Questionnaire as a demonstration of your skills. Typically, each question could require you to use up to 100 words.

I searched the Internet to look web sites which give examples of what N words look like. For example, what 50, 100, 150 words etc look like. One site I came across was Word Count examples.

It's certainly useful to see what these amount of words (say 100) look like before putting pen to paper or keyboard to word processor.



Keywords: word count exmaples


Saturday, 26 May 2018

Posting code

The web site at the following URL can be used to format code suitable for posting in this blog.

http://codeformatter.blogspot.co.uk/



Keywords: posting code java powershell

List files for a specific date

There often comes a time when I'd like to list (select) files for a specific date. For example, if I'm looking for log files for a particular date.

The following PowerShell code can be used for this purpose.


1:  $path = 'C:\Family\powershell';
2:  $targetDate = '2018-04-09';
3:
4:  Get-ChildItem -Path $path -File |
5:    Where-Object {$_.LastWriteTime.ToString("yyyy-MM-dd") -eq $targetDate}
6:
7:  Write-Host 'All done now';
8:


In this example, I'm looking for files with a LastWriteTime of 2018-04-09. All other files will be ignored.


Keywords: powershell files lastwritetime target date

PowerShell about_Scopes

The following published Microsoft article explains the concept of scope in Windows PowerShell and shows how to set and change the scope of elements.

PowerShell Scopes

  • Global:
  • Local:
  • Script:
  • Private:
  • Numbered Scopes:


Click here to read the full article.



Keywords: powershell scopes


Wednesday, 11 April 2018

Open data search engines

If you're looking for datasets for the purpose of research, statistics, etc, one way to find the data is to use the following search term in a search engine:

open data search engine

This will give you a few items to be going on with. Worth trying.


Sunday, 8 April 2018

Ancient software

I was looking on the Internet today looking for PowerShell related information for a scriptblock I was writing when I came across this comment on one of the stackoverflow.com pages.

I don't work for a software company either. But that doesn't mean that your corporate computing environment gets a free pass on being stuck on ancient software. Staying current on your software is part of the cost of doing business today and if they're not willing to invest there, they're probably not investing in their people or other things that are important to keeping operations running.

On reading this, it certainly struck home for a number of reasons. How very true this comment is.


Tuesday, 11 July 2017

Using PowerShell to grep

PowerShell is not Unix of course, but nevertheless, it does have a useful cmdlet to emulate the very useful Unix grep command. This is achieved by the Select-String (finds text in strings and files) cmdlet.

In order to learn more about PowerShell and grep, have a read of Grep, the PowerShell way. It's an excellent article on a comparison between the two. When you read the article, you'll see reference to sls. This is just an alias for Select-String which saves you having to type out the cmdlet name in full.



PS> Get-Alias sls

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           sls -> Select-String
 
I use Select-String myself from time to time but never seem to remember the best way of using it. This article serves as an aide-memoire.


See also


Grep, the PowerShell way
https://communary.net/2014/11/10/grep-the-powershell-way/

Select-String (finds text in strings and files)
https://msdn.microsoft.com/en-us/powershell/reference/5.0/microsoft.powershell.utility/select-string



Keywords: unix grep sls select-string search text file