Cyprich.com

Occasionally Relevant Insights from a Software Builder

By

Setting Permissions to Run PowerShell Scripts

When PowerShell is installed, it sets the default execution policy to Restricted which allows commands to be executed, not scripts. I don’t think this is the best approach for the application since the scripting is the main reason why people would install and use PowerShell.

You can determine what the execution policy is with this command:

Get-ExecutionPolicy

There are 4 options for execution policy: Restricted, AllSigned, RemoteSigned, and Unrestricted. The last 3 options allow scripts to be run in the shell. I prefer using the RemoteSigned policy over AllSigned because it doesn’t require a digital signature from a trusted publisher to run scripts.

You can set the execution policy for running scripts with the following command:

Set-ExecutionPolicy RemoteSigned

By

Unlocker

<sarcasm>Everyone enjoys seeing Windows messages like the following:</sarcasm>

image

You can’t delete files in Windows when their file handle is still open in the operating system. This can still occur even after you closed the document and the application that was used to display it.

One solution is to reboot the computer which may release the file handles, but this doesn’t always work. Unlocker is a system tray application for Windows that can force file handles to close and delete processes. Unfortunately, it won’t delete locks over networks, but there are other ways to do it manually.

The application is free and it uses very little memory when running. You don’t need to run it all the time, though. I just use it when I have file problems and then close the application afterwards. This is a must have application for Windows users.

By

Fixing E-mail Problems in DFS

DFS 2.8.1.25 is the latest version of Adenium System’s online planroom software and many changes were made from earlier versions. One of the changes is the way user account information is handled. With the new version, it may be not be possible to make changes to an e-mail address since the Library Manager now limits what you can do through it.

*** Before editing the DFS database directly, make a backup of the database if you’re not already doing this on a regular basis. ***

Possible problems with e-mail is trying to change a user’s account to a new address, or one that I came across recently where a user could not login to his account because there was a space character directly after the e-mail, i.e. “a@b.com “. DFS does not allow you remove the trailing space character in the Library Manager. The only way to make this change is to edit the record directly in the Entities table in the DFS database.

You can edit a table in DFS by running the SQL Server Management Studio (for MSSQL 2005 or 2008) or Enterprise Manager (for MSSQL 2000 or earlier).

1. Open the DFS database and scroll down to the Entities table. In MSSQL 2005+ it will be called dbo.Entities.

clip_image002

2. Right click on the table and select Open Table. In MSSQL 2000 you would select Open Table, and then Return All Rows.

3. Now you need to open a SQL query window to search for a user. The SQL button is found in the upper right corner of the program.

clip_image004

4. In SQL pane, you should see the following command:

SELECT *
FROM Entities

This command lists all records in the Entities table. A good way to find a user is to search for their last name or e-mail address. This is done by the following SQL command:

SELECT *
FROM Entities
WHERE Last_Name=’Smith’

If you want to search by e-mail, use

WHERE Email_Adddress=’a@b.com’

Note that the search item must be in between a ‘ character.

5. To execute the search query, press the ! button:

clip_image006

6. The records that you have searched for will then be displayed. Now you can make corrections to the e-mail address once you locate the correct user account.

By

Quickly Deleting Files on Linux

Once in a while I need to delete all of the files and folders on my Linux hosting account. This is usually due to updating an application, installing a new web application, or more often installing a clean application in my testing folder.

I would normally use WinSCP, but the problem with deleting files through this is that when there are thousands and files and folders, the process could take a long time. Deleting a Joomla installation, for example, takes more than 30 minutes to do.

A faster way to delete files is to go into your shell account (assuming your web host allows you to have one), and from the root directory, enter the following command:

rm –r folder

This will recursively delete all items in the folder and then delete the folder itself. If the folder is a subdomain, then recreate it using the rmdir command. This process takes seconds as opposed to the method used in WinSCP.

Banner

By

Free eBook: Illustrated C# 2008

 

You can learn C# for free with a free eBook from redgate. They are offering Illustrated C# 2008 for download on their web site. Amazon sells the book for $29.69 so its a great value if you don’t mind reading electronic books.

Illustrated C# 2008 takes a different approach to teaching programming. There are many visual examples which accelerate the learning process. Its a good system for people who don’t like learning by reading lots of text.

The book is good for beginning programmers and also people who would like to learn a new language. Existing C# programmers could also benefit by learning a few new things here, especially those who are updating their knowledge from an earlier C# version.

If you find the book useful, order a printed version from Amazon or download it for the Kindle.