Thanks for visiting Daily Cup of Tech!
Here are a few things that you may want to do while you are visiting:

Hope you enjoy your stay!


Well, it took over a year, but we now have definitive proof that the Lost USB Drive application works! When I launched the Lost USB Drive Experiment in early June of last year, I wasn’t really sure what to expect. I had all but forgotten about the experiment.

So, imagine my surprise when I had this in my inbox this morning:

Dale,

I recently took over Costa Coffee Eastleigh and have found your USB Memory stick, I’m not sure how long it has been here but if you would like to pop in and collect it I will put it to one side.

Thanks

Matthew
Store Manager

Costa Coffee
27-29 Market Street
Eastleigh
SO50 5RG

To be honest, I was a little shocked! But, at the same time, this totally made my day! Just goes to prove that there are some honest people out there and that a little ingenuity can go a long way!

If any of you are in the area of Matthew’s store, go in, congratulate him on his honesty and integrity, and buy the biggest, most expensive coffee on the menu! Way to go, Matthew!

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


I am in the process of performing some analysis on the posts on Daily Cup of Tech. One of the things that I want to do is a word count and frequency analysis on the entire blog.Now, I could go with good ol’ pen and paper and start counting every single word on the blog. But, that would take me quite a mount of time, not to mention that I would not learn anything in the process.

So, I decided to export the contents of my mySQL database the runs behind the scenes at DCoT to a text file and then download a word and frequency counter. Do you think I could find a word counter that would count all of the words in the file and then count how many times each word appears? No luck.

But, my bad fortune is your lucky day. I decided that since I couldn’t find anything like this, I’d make it myself. So. today I present you with the Daily Cup of Tech Word Counter!

The application is a self contained program that is fully portable to USB devices. You can download the program and the source code if you are interested. The program is written in AutoIt.

Here is a screenshot of my new baby:

Most of the program is self explanatory. You can sort the output alphabetically or by how frequent each word appears. You can also sort in ascending or descending order. You can count the words that you type or paste into the edit box or use a text file.

The delete options may be the only confusion portion. When you are counting words, you need to clean up the rough text a bit. Delete some punctuation, get rid on non-printable letters, or scrub out the non-standard English words. Each of these options selects a different one of these options. Control characters are things like carriage returns and line spacing. Punctuation is your standard punctuation that you will find in most documents. Extended characters are characters that you usually do not see regularly and are often used in some non-English languages.

The Use Spaces option will replace all deleted characters with spaces rather than deleting them. This can modify your outcomes so feel free to experiment.

When you are done counting your words, a complete list of all the words and how often they appeared will be presented in the edit box.

Feel free to play around with this and let me know if you find it to be useful.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


I was doing some research the other day on getting your self out of a difficult situation when you don’t have access to some vital system resources because you are running as a normal user and you lost your local admin password.

I discovered that there is a way to reset your user interface and run interactively as the LOCAL SYSTEM account. This is important because the LOCAL SYSTEM account has a lot of privileges available to it. According to Microsoft:

The system account and the administrator account (Administrators group) have the same file privileges, but they have different functions. The system account is used by the operating system and by services that run under Windows. There are many services and processes within Windows that need the capability to log on internally (for example during a Windows installation). The system account was designed for that purpose; it is an internal account, does not show up in User Manager, cannot be added to any groups, and cannot have user rights assigned to it. On the other hand, the system account does show up on an NTFS volume in File Manager in the Permissions portion of the Security menu. By default, the system account is granted full control to all files on an NTFS volume. Here the system account has the same functional privileges as the administrator account.

A little while back, some enterprising individuals discovered a way to run the LOCAL SYSTEM account interactively. Here are the instructions according to one website:

  1. Start > Run > cmd.exe > type: at 12:03 /interactive “cmd.exe” (replace 12:03 with a time 2 mins from now). > close command prompt
  2. New command prompt will open, when it does > Hit CTRL+ALT+DEL > find explorer.exe and End Process.
  3. At command prompt type: cd.. > type: explorer.exe

This all words fine except that it is a bit confusing for someone who does not understand how all this works. So, I thought I would make it easier for those who do not have my background. I created a little program in AutoIt that completely automated the process. Simply run the program, wait for a couple of minutes, and you’re running as the LOCAL SYSTEM account.

You can download this program and play with it all you want.

WARNING: I have tested this program to the best of my abilities but this does not mean it is perfect. I did not have any problems with it but that does not mean you will not. If something goes wrong, don’t blame me! You’ve been warned.

For those of you who are interested, here is the source code for this little program I wrote. Feel free to hack around and make it do different things:

#include <Date.au3>
If $CmdLine[0] = 0 Then
;No command line options
;First run
$RunTime = _DateTimeFormat(_DateAdd(’n', 1, _NowCalc()),5)
$Command = @ComSpec & ” /c AT ” & $RunTime & ” /interactive “”" & @ScriptFullPath & “”" 2″
Run($Command)
Else
;Second run
$Command = @ComSpec & ” /c taskkill /IM explorer.exe /F & ” & @WindowsDir & “/explorer.exe”
Run($Command)
EndIf

Update: Someone asked in the comments how you get back to your normal account. Simply log out and then log back in as yourself. You should be back to normal.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


AutoItA new version (3.2.4.9) of AutoIt was released last Friday. If you are an avid AutoIt fan, make sure to update your version of AutoIt. You can download the new version of AutoIt and Scite4autoIt.

Here are the changes in this version from the last major version:

  • Added: StringCompare()
  • Fixed: Basic string comparisons were not working with locale as in previous versions.
  • Fixed: Errors with non-western codepages and ANSI format scripts.
  • Added: Aut2Exe options for forcing ANSI mode compilation (/ansi and /unicode)
  • Added: StringToBinary()
  • Added: Additional unicode related options for BinaryToString()
  • Fixed: StringReplace() and occurances parameter.
  • Added: BinaryToString() for binary buffer to ANSI string quick conversions.
  • Added: @Unicode macro to show if AutoIt is being run in Unicode or ANSI mode.
  • Changed: StringReplace() speeded up - a lot.
  • Changed: Au3Info is now resizable.
  • Fixed: Chr(0) now properly works with Binary()
  • Fixed: Chr(0) now acting more sensible (now acts in a similar way to VBScript).
  • Fixed: FileRead() not working properly with unicode files.
  • Changed: Au3Info graphical tweaks and Summary tab.
  • Fixed: FileReadLine() getting bad cached data when reading specific line numbers with file handles.
  • Fixed: Slight lag in GUIGetMsg() under certain circumstances.
  • Added: ChrW() and AscW() for unicode operations.
  • Fixed: Chr() and Asc() for character codes 128-255 in unicode mode.
  • Fixed: Unicode BOM was not being written in file append modes if the file was empty.
  • Fixed: Error in Include\GuiCombo.au3 and Include\IE.au3.
  • AutoIt is now compiled for Unicode! AutoIt3.exe is Unicode - AutoIt3A.exe is ANSI.
  • Au3Info tool rewritten.
  • Binary data functions completely rewritten - scripts using these functions will need to be changed.
  • Added: New modes for FileOpen() to force Unicode and binary operations.
  • Added: BinaryLen(), BinaryMid()
  • Added: Colored GUI buttons.
  • Added: DllStruct…() can reference elements by name rather than index.
  • Changed: Removed restrictions on the maximum number of #include directives.
  • Changed: Removed restrictions on the maximum number of DllOpen() handles.
  • Changed: Removed restrictions on the maximum number of open files.
  • Changed: Removed restrictions on the maximum number of hotkeys.
  • Changed: Performance improvements in StringStripWS().
  • Changed: Binary data in variants are now treated as a special type, separate from normal strings.
  • Changed: BinaryString() renamed to Binary()
  • Changed: IsBinaryString() renamed to IsBinary()
  • Changed: ControlClick() can now click a control at a certain position.
  • Changed: ControlClick() can now properly simulate double-clicks.
  • Changed: ControlClick() no longer forces the activation of the parent window (up to the user now).
  • Changed: ControlClick() related coordinates added to Au3Info.
  • Changed: Improved the searches that can be done for Windows/controls/instances.
  • Changed: From DEFAULT_QUALITY to PROOF_QUALITY for Change/Set Font functions.
  • Changed: x^y compatible with C99 standard.
  • Fixed: Possible crash when using StringStripWS(), flag 4 and empty strings.
  • Fixed: GUICtrlSetLimit() for UpDown controls wher min = max.
  • Fixed: GuiCtrlSetTip() not always working correctly.
  • Fixed: Slow GUI tab redrawing under Windows Vista fixed.
  • Fixed: HotKeySet bad notification.
  • Fixed: FileGetAttrib() on pagefile.sys.
  • Fixed: Invalid default parameter in GUICtrlSetData() not detected.
  • Fixed: Assign does return error on array element.
  • Fixed: FileOpen(”test.txt”, 2+8) returning error.
  • Fixed: Error detection in Enum statement.
  • Fixed: Opt(”WinTitleMatchMode”).
  • Fixed: Stack corruption resulting from improper use of DllCall() now gracefully aborts the script instead of hard crashing.
  • Fixed: Crash when reading empty REG_MULTI_SZ.
  • Fixed: Round() not returning an integer.
  • Fixed: ControlSend() to empty “” ctrl fixed for inactive window. Also shift state behavior.
  • Fixed : O^(-1).
  • Fixed: Non detection of illegal statement.
  • Fixed: HotKeySet(”^{PAUSE]”,… notification.
  • Fixed: {CTRLBREAK} ->{BREAK} as ctrl is user responsability.
  • Fixed: $var = Default passed as parameter to Com object.
  • Fixed: Edit control would always have focus the first time the GUI was displayed even if it shouldn’t. This behavior also ignored $GUI_FOCUS.
  • Fixed: range value for seed Number in SRandom().
  • Fixed: Fileread crash if no count in raw mode.
  • Fixed: Opt(”WinTitleMatchMode”, <0) really matching case insensitive.
  • Fixed: FileSetAttrib/FileSetTime wrong setting.
  • Fixed: Execute/Call recursive overflow display error message.
  • Fixed: Aut2exe warning message if icon not found.
  • Fixed: WinGetTitle() returns 1 on error.
  • Fixed: Memory leak on keyword variable deallocation.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


Source CodeA great big “Thank You!” to everyone who donated to the release of the source code for DCoT Menu. Because of your generosity, DCoT Menu is now available to everyone as open source code. Feel free to download the code and start making your own derivative branches of this application.

Here are the generous people who we all have to thank for this:

So, here is what you have all been waiting for, the DCoT Menu source code: Read the rest of the story…

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


AutoIt MySQLWhether we realize it or not, we are a civilization that runs on data. It controls every decision we make or don’t make. We spend countless hours reading it, analyzing it, massaging it, duplicating it, verifying it, summarizing it, and protecting it. It gives us power.

So, it is logical that we would come up with many different ways to store data electronically. When most people think of electronic information, they often think of files, or e-mails, or webpages. But, if we are going to look at storing some serious data, someone is very quickly going to utter the word…”database”.

According to Wikipedia, a database is:

…a structured collection of records or data that is stored in a computer so that a program can consult it to answer queries. The records retrieved in answer to queries become information that can be used to make decisions. The computer program used to manage and query a database is known as a database management system (DBMS). The properties and design of database systems are included in the study of information science.

One of the most popular database programs today is MySQL. It is an open source database program that lets you store and analyze data to your heart’s content. In fact, Daily Cup of Tech runs on a MySQL database.

But, what about getting to this data with AutoIt. Is there a way to do it? Especially when many MySQL systems run on Linux and AutoIt is definitely a Windows only application. Can the data residing on the Linux MySQL server be accessed from a Windows AutoIt applications. The answer is…definitely!

Read the rest of the story…

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


WeirdI have been working with Vista now for a couple of weeks and I an starting to get a feel for some of the odd quirks that are occurring to me. Many of these are because of how I have done things in the past and I will probably have to make some changes in how I do things in the future.

But, I thought that I would start documenting some of these odd things, what caused them, and how I have worked around them. Please keep in mind that I am writing this after only working with the system for a couple of weeks. I am no where even close to being an expert with this OS and I would greatly appreciate any (gentle) correction and addition that you can supply.

Too Far On the Secure Side

One of the things that I have discovered over time is that there is a sliding scale between a secure system and an easy to use system. Read the rest of the story…

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


AutoIt BuilderOK. I have to admit it. I got caught in a bit of a fib on Sunday. Actually, it was more of a case of bad proofreading than anything else. In my post Automatic Drive Mapping, I stated:

you can’t make a batch file into an executable

Well, wary DCoT reader D Steele caught me in my mistake and let me know that there are actually several ways that you can convert a batch file into an executable.

I had actually realized this when I was writing the previous post but promptly forgot about it before I submitted the post. So, apologies for the error.

In fact, it is really easy to do. Here is how I do it in AutoIt:

;Make batch executable
#include <File.au3>
 
Dim $TempBatchFile = _TempFile(@TempDir,"",".bat")
Dim $HideConsole = False
 
FileInstall("MyBatch.bat",$TempBatchFile)
 
If $HideConsole Then
	RunWait($TempBatchFile,@TempDir,@SW_HIDE)
Else
	RunWait($TempBatchFile,@TempDir)
EndIf
 
FileDelete($TempBatchFile)
 
MsgBox(64,"Done","Execution complete!")

Download this code: MyBatch.au3

A couple of little things about this script. It will not show the “DOS box” as it is written. If you want to see the console screen, simply change this line:

Dim $HideConsole = False

to:

Dim $HideConsole = True

The console should now appear.

Also, the line:

FileInstall(“MyBatch.bat”,$TempBatchFile)

is where you put in the full path and name of your batch file. Simply change MyBatch.bat to the name of your batch file. You cannot use a variable for this because of how AutoIt is designed.

Once you have all of these things set, all you need to do is compile your script and you are done! Instantly compiled batch file!

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


Hard DriveIn one of the comments on Providing User Feedback In AutoIt, Jim is wondering how you can map drives:

I was wondering though, can AutoIt make an executable that would setup a permanent drive map. Instead of a non-technical user mapping a drive, the executable file would setup a predefined mapped drive. That would be cool..
Thanks
Jim

Well, Jim, there are several different ways that you can map drives but two of the easiest are using a batch file or through AutoIt. Now I know that you can’t make a batch file into an executable but I thought that I would show you how todo this anyway.

Our Example

For this post, I want to use an example to help clarify these concepts. For our example, we would like to map drive letter T: to network share \\server\share.

Batch File

To map a drive in a batch file, simply use the net use command. So, for our example, we would use:

net use T: \\server\share

If you want the drive mapping to return each time you reboot, add the /persistent:yes option:

net use T: \\server\share /persistent:yes

AutoIt

In AutoIt, you use the DriveMapAdd command. Our example would look like this:

DriveMapAdd("T:","\\server\share")

To allow it to survive a reboot, add one more option:

DriveMapAdd("T:","\\server\share",8)

That’s all there is to it. You can then compile this into an executable and away you go!

Hope that answers your question, Jim

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?


PropertiesI recently read on Lifehacker about a system called ScrubIT which blocks pornography on your system. Here is what Lifehacker has to say:

All you do is configure your router to use ScrubIT’s DNS servers. Alternately, Windows 2000/XP users can download a utility that tweaks the networking settings accordingly.

I thought, “Very cool!” until I read this:

…there’s no uninstaller for the DNS utility, meaning once you’ve run it, your system will face “scrubbed” sites indefinitely. (I’m still working to extricate it from my PC; incredibly, the ScrubIT site offers no information on undoing the utility’s changes.) I’m hoping this rather startling oversight will be corrected soon, as it’s hard to recommend a service that won’t go away if you want it to.

So, I took it upon myself to investigate. I was surprised to see that the ScrubIT configuration utility was actually a compiles AutoIt script. After a bit of “playing” I was able to reverse engine the original script.

Essentially, all this configuration utility does is set the DNS settings on all of the network cards to their DNS settings; i.e. 67.138.54.100 and 207.225.209.66. In fact, it even uses the built in NETSH command to perform the DNS changes.

To remove the changes made by the configuration utility, all you need to do is the following:Open

  1. Open up the Control Panel
  2. Double click on Network Connections

Then for each network connection you see in this window, do the following:

  1. Right click on the network connection and click on Properties in the context menu
  2. Under, This connection uses the following items: click on Internet Protocol (TCP/IP)
  3. Click on the Properties button. This will open a new window
  4. At the bottom of the window, you will see a section selected that says Use the following DNS server addresses: and then it will have 67.138.54.100 and 207.225.209.66 in the list.
  5. If you use DHCP, then select Obtain DNS server address automatically. If you do not use DNS, change 67.138.54.100 and 207.225.209.66 to your DNS addresses.
  6. Close all Windows.

That should do it for you.

Just one other bit of warning. If you use this configuration utility in a networking environment such as Windows Active Directory, this can break your system. You may experience either extremely long log-on times or lose the ability to log on to the domain at all. It is best to put these DNS settings into the router or firewall.

Update

I have completed the UnScrubIT configuration utility.  This is only to be used if you are running DHCP on your network.

If you found this post useful, why don't you buy me a cup of coffee to show your gratitude?

Next Page »