Dailycode.info

Short solution for short problems

Microsoft Update Standalone Package wont run.

I was installing a standalone package as preparation for a SharePoint installation. But it kept giving the error that the service was not started.

I found out that I had to start the windows update service in order to get this working.

After the installation was done, I disabled the windows update again.


Windows Experience index on Windows 8

There are a lot of posts about this, this one is just very basic how to run the test and get the result with a lot of screen shots.

First run command prompt, make sure you're logged in as admin, then enter "winsat prepop" and press enter:

The test will run fir a while, have patience. At the end you will return to the prompt:

Now to analyse these results we need to open powershell, you can find this here:

 

In the powershell prompt, enter following command:"Get-WmiObject -Class Win32_WinSAT". The system will now show your scores:

The demo was done in windows 7, the commands are also existing there.


How to get a user controls parent form. (Windows forms)

I wanted to pass the owner form to all my ShowDialog calls. But lots of times I call this method from a user control. So I found a good solution on stackoverflow (it’s a recursive function that will loop over all parents and check if it’s a windows form): http://stackoverflow.com/questions/371464/get-components-parent-form

I changed it a little to fit my needs, also this project was VB.Net:

   

''' <summary>
    ''' Returns the parent System.Windows.form of the control
    ''' </summary>
    ''' <param name="parent"></param>
    ''' <returns>First parent form or null if no parent found</returns>
    ''' <remarks></remarks>
    Public Shared Function GetParentForm(ByVal parent As Control) As Form
        Dim form As Form = TryCast(parent, Form)
        If form IsNot Nothing Then
            Return form
        End If
        If parent IsNot Nothing Then
            ' Walk up the control hierarchy
            Return GetParentForm(parent.Parent)
        End If
        Return Nothing
        ' Control is not on a Form
    End Function

 

 

I just call this method new on all windows and user controls where I have a show dialog call:

 

frm.ShowDialog(GP_Global.GlobalFunctions.GetParentForm(Me))

 


Get rid of the 'Annoying Thumbs.db' file

A. Windows Professional: (not in home edition)

1. Go to Run your start menu

2. Type gpedit.msc

3. Click OK and the Group Policy will open

4. Go to User Configuration/Administrative Template/Windows Components/Windows Explorer

5. Scroll down to the bottom of the long list of stuff that now shows up in the menu on the right. Double-Click on Turn off caching of thumbnail pictures.

6. Click on Enable then Apply, Ok. And now you no longer have this annoying problem.

//Mind you that you also get rid of the thumb images.


How to kill a process on an other machine?

Found a good solution that does the trick! It takes only 9 line of code!

private void btnKillProcess_Click(object sender, EventArgs e)

{

ManagementScope scope = new ManagementScope(@"\\MyPCName\root\cimv2");

scope.Connect();

ObjectQuery query = new ObjectQuery("SELECT * FROM Win32_Process WHERE Name = process.exe'");

ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query);

ManagementObjectCollection objectCollection = searcher.Get();

foreach(ManagementObject managementObject in objectCollection)

{

managementObject.InvokeMethod("Terminate", null);

}

}

Source: http://weblogs.asp.net/stanleygu/archive/2010/03/31/tip-13-kill-a-process-from-local-to-remote.aspx


Ctrl-Alt-Del in remote desktop

This is one of these simple posts that serve as a reminder for myself.

I use Remote Desktop a lot to log in to the servers and development environment. So when I want to hit Ctrl-Alt-Del the menu of my pc pops up. So the solution is to choose Ctrl-Alt-End.

That's it.


USB storage device not found

Ever had this problem?

You plug in an USB memory stick and nothing happens. Windows does not ask you to install software or doesn't tell you that a new device is connected. Strange...

You might want to check the device manager, because in my case Windows try to give a drive name to the usb device that was already mapped. So it will not work properly.

Just assign a free drive letter to the USB memory stick and immediately a window will pop up showing it's contents.


Windows reboot shutdown command

When I'm working with remote desktop it's not always permitted to reboot the computer via the windows inferface. These options are available:

The first time I had to reboot, I tried some dos commands like: reboot or restart, but hat didn't worked. So I used a detour: I opened msconfig and modified something, just clicking on and off again and when I pressed OK the system asked me to reboot the computer. What can I say, I had no time to google...

After I looked for the command to reboot or shutdown a computer. SHUTDOWN was the command and it has some nice parameters:

-r : restart

-s : shutdown

-t : add some time to the shutdown in seconds

-a : cancel the shutdown.

\? will list all the possible parameters.

Here's an example:

Then I wanted to try the cancel command. I ran a shutdown command with 30 seconds delay:

Quickly opened the command prompt and ran this command:

And the shutdown was cancelled.

And another nice option of the shutdown command is the -i. This opens a dailog where you can choose a pc to shutdown, you can even shutdown multiple pc at the same time. If you are in a secured network, be sure to test this. In public places like schools etc. this command is often still enabled. You can shutdown computers remotely. You can imagine the possibilities in a classroom. ;-) Don't abuse it, just use it to point out the security leuks though ;-) Here's an image of the interface:

 


/3GB option in the Boot.ini (cannot open large files)

I installed WSS 3.0 on a windows 2003 server. Everything looked OK. I was thrilled to get the installation so easy and correct in the first try. But when I start using Sharepoint, I noticed that some files opened and other didn't. What was going on here? After digging for hours in the WSS administration, I couldn't find the problem. Then I started to google for a solution, but I can tell you, it was not easy. After testing a little while I noticed that files larger then 200Kb didn't open, smaller files did. So There was some kind of limitation on the server. I noticed that the files where correctly in the DB. So I concluded that it was not a Sharepoint problem. When I finally hit the correct search words in google I came up with this solution:

The Windows Server 2003 /3GB switch is not supported in Windows SharePoint Services 2.0 or in later versions or in SharePoint Portal Server 2003 SP2 or in later versions.

Look for more here: http://support.microsoft.com/kb/933560

So when I removed the /3GB part in the boot.ini file and rebooted the server, everything works fine. What a relief. I hope you didn't had to google as long as I did to find this solution!

//Added on 11/08/2008 by Mark Deraeve

I had the same error working woth word documents. But the error messages can be very misleading. Here are some examples of error messages:

or:

If you are having this kind of errors or even an error like: locked of checked out by ... and it doesn't make sense, then try firdt opening a small or empty document. If that works, you know it is this problem and you know the solution.

http://support.microsoft.com/kb/933560