Archive

Posts Tagged ‘windows’

Quicktip: CMD symlink

28/01/2012 1 comment

If you want to preform a specific command always after opening the console, there is the possibility to create a symlink with command:

C:\Windows\System32\cmd.exe /K “COMMAND”

/K tells cmd that a command is going to follow and that the cmd window should stay open afterwards.

Cheers Chris

Categories: Quicktip Tags: , ,

PowerShell 2.0 – Binary Runtime measuring

24/06/2011 Leave a comment

How to measure runtimes for applications not in the program itself?

Therefore the PowerShell is a nice utility under windows. Sometimes there are reasons why it’s not possible to measure the runtime of a specific algorithm or program in itself. Means not in the native code of the program. Or you just want to measure different programs automated. Get the job done by the Windows PowerShell!

To be concrete:

#!msh
function Pause ($Message="Press any key to continue...")
{
Write-Host -NoNewLine $Message
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
Write-Host ""
}

function Benchmark($path)
{
write-host "Benchmark for "$path
$startTime = New-TimeSpan "01 January 1970 00:00:00" $(Get-Date)
$startTimeLong = [LONG] $startTime.TotalMilliseconds
write-host "Started @" $startTimeLong
Start-Process -wait $path
$endTime = New-TimeSpan "01 January 1970 00:00:00" $(Get-Date)
$endTimeLong = [LONG] $endTime.TotalMilliseconds
write-host "Ended @" $endTimeLong
$result = $endTimeLong - $startTimeLong
write-host "Time(Milliseconds):" $result
}

Benchmark("a.exe")
Benchmark("b.exe")
Benchmark("c.exe")
Benchmark("../pki3/d.exe")
Benchmark("../pki3/e.exe")
Pause

The function “Pause” I’ve taken from Windows Powershell Blog. The function “Benchmark” handles the measurments for the given program (program path).

For measuring the time while the program is running it first gets the date and saves it as a long (milliseconds since 01.01.1970) in $startTimeLong. Afterwards the external program is started, the parameter “-wait” lets the script pause until it terminates. After termination it the gets the date again and saves it as $endTimeLong. The result in milliseconds is the execution time.

Various usage of this function is thinkable.

Cheers Mavi

Categories: General Tags: , ,

The Shell with Power! PowerShell 2.0 [how to activate script execution]

23/06/2011 Leave a comment

Sick of *.bat – shell scripts? – Powershell (2.0)!

It’s not really something new, but I just did need it until now. So I’m surprised by the mighty of it. Additional it comes with a small IDE which makes developing and debugging very handy.

Before you enjoy the power of the shell you have to activate the script execution within your system. Therefore you have to set the execution policies:

Start the PowerShell as administrator

Get-ExecutionPolicy

Displays the current policy

Set-ExecutionPolicy RemoteSigned

This sets a policy. Valid values are:

  • Restricted -> Impossible to run any PS script (standart)
  • AllSigned -> Each script needs to be signed (check PS Blog for details). Possible choice but to unhandy for my taste.
  • RemoteSigned -> Each local script can run unsigned, scripts from the web need to be signed. My choice!
  • Unrestricted -> Each script runs! Way to insecure!!!

After changing the policy it’s possible to run your scripts. You can simply work with a text editor (eg. Notepad++) and save the script as *.ps1. If you’re doing so, you can start the script by double click in your file browser.

Even more comfortable is the PowerShell ISE. It comes with syntax highligthing, part execution and real debugging.

Finally I have an other scope: Using it as a calculator! Nice if you want to see your calculation and not just the final result. More…

Cheers Mavi

Galaxy S Driver for Android debugging with Eclipse

18/05/2011 6 comments

Don’t want to install Samsung Kies? Just want to debug your Android app at the Galaxy S? Here are the drivers!

Since I spent hours with searching for a simple driver to run my in Eclipse developed Android Application directly at the phone, I provide them here:

USB driver Galaxy S for win 32 bit (Has been tested with Win XP 32Bit)

USB driver Galaxy S for win 64 bit (Has been tested with Win 7 64Bit)

Just install the driver by running the corresponding *.exe file. Afterwards switch to debugging mode at your Galaxy: Settings -> Application -> Development; Tick the debugging mode! Finally you have to plug in the USB cable. Now “run” your application from Eclipse and it will automated chose your mobile as target!

Cheers, Mavi

Evolution of MS Windows

13/03/2011 Leave a comment

Upgrading OS from Win 1.0 to Win 7!

I found a nice piece in the web. A guy upgrading through all versions of Windows since 1.0 in a VM. Games from this early Version (1985) still work on Win 7 (2009) :-)



Enjoy, Mavi

Categories: General Tags: , ,

Hacking Windows Phone 7

25/01/2011 Leave a comment

Did you ever think about hacking a mobile operating system?

If you do so be carefully, Apple or Sony won’t laugh. They are going to discuss the legal aspect at a court ;-)

Microsoft has a different approach: The developer team ChevronWP7 jailbreaked a Windows Phone 7 and got a free T-Shirt (see here).

Furthermore they are going to have an open discussion with the community to make “home-brew” possible. We’ll see if it’s just a marketing strategy or if they going to follow a new approach…

Greets Mavi

Quick noisiness test for PC

16/08/2010 Leave a comment

How to test the noisiness of a notebook / PC?

Everybody wants to have a notebook which is as silent as possible but how to test that quickly while you are in the store? Mostly the CPU fan makes most noise in a computer. There is a very simple solution to set a CPU under full load with Windows XP.

Just open a calculator (win key + r; enter ‘calc’; [calculator opens] switch to scientific view; calculate the factorial for a big number > 10000;) Repeat that for every existing core and check with taskmanager the load.

–> The PC will be under full load for several minutes and the fan is going to speed up to maximum.

This trick doesn’t work with Win7 because the calculator has been improved. For Win7 and Linux I developed an small application to set the CPU under full load.

CPU Stressing Tool

MD5: 85eb640b41b0f13cbc33f43f37167179

Screenshot from CPU Stressing

Just choose the number of cores and click at “Stress!”

Greetz Mavi

Categories: General Tags: , , ,

Windows 7 mit mehreren Kernen booten

12/08/2010 Leave a comment

Mit wie vielen Kernen Bootet Windows 7? Wie kann man das ändern?

Ein Kommilitone von mir behauptet das Windows 7 standardmäßig mit nur einem Kern bootet. Da das einem Poweruser mit mindestens 4 echten Kernen nicht genügen kann, wird beschrieben wie (und wo) man dieses Detail ändern kann.

Allerdings scheint mir das alles Unsinn zu sein. Auf meinem Testsystem mit einem Core 2 Quad Q9500 habe ich diverse Einstellungen getestet (jeweils 2x) und kam zu folgenden (mit der Hand gestoppten) Messwerten:

Booten ohne gesetzten Harken:

48.5s, 49.0s

Booten mit 4 Kernen:

48.7s, 49.0s

Booten mit 1 Kern:

50.4s, 50.3s

Booten mit 2 Kernen:

51.8s, 52.0s

Daraus lässt sich ableiten das Windows 7 automatisch mit den meisten Kernen bootet, also keine Veränderung gegenüber der Einstellung “mit 4 Kernen booten” zu erkennen ist. Alle anderen Konfigurationen sind langsamer, warum ein Kern schneller ist als zwei (für einen Messfehler zu großer Unterschied) kann ich auch nicht erklären.

Greetz Mavi

Categories: General Tags: ,

Autoruns 10 from Sysinternals

17/06/2010 Leave a comment

Using the tool Autoruns to clean up autoruns!

I found a very nice tool to clean up autoruns, it’s even from Sysinternals again. Just download and start it, it’s not necessary to install it. So you can just take it with you on your USB device to help friends for example.

After starting the tool you can walk through the different tabs and see lists eg. services or logons. You can see the detail information about the keys and programs. It’s handy to clean up autoruns and find malware even though some knowledge of what you’re doing is required.

Greets Mavi

Categories: General Tags: , , , ,

How to move the pagefile.sys?

18/05/2010 1 comment

How to move the pagefile.sys from c:\ to an other destination?

I found one more solution for a to small C:\ partition. It’s possibe to move the pagefile.sys for logical adressing to an other drive.

For folks who using an english version of Win7 please just change in the registry ‘HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management’ the key ‘PagingFiles’.

For german version:

  1. Systemsteuerung -> System -> Erweiterte Systemeinstellungen
  2. Im Reiter ‘Erweitert’ in der ‘Leistung-Box’ auf ‘Einstellungen’
  3. Im Reiter ‘Erweitert’ auf ‘Ändern’
  4. Den Haken bei ‘Auslagerungsdateigröße für [...]‘ entfernen
  5. Den Radiobutton für C:\ auf ‘Keine Auslagerungsdatei’ ändern
  6. Für z.B. D:\ auf ‘Größe wird vom System [...]‘ setzen
  7. Alles mit OK bestätigen und das System neustarten.

German version users can edit the registry as well of course, but it’s maybe not as clear how to do that.

Greez Mavi

Categories: General Tags: , ,
Follow

Get every new post delivered to your Inbox.