Posts

Showing posts with the label windows

Deleting a file with a . (period) in the end

This one had me baffled for a complete day. I was downloading this file and the filename was myfile.mp4. . Since the file was not completely downloaded I tried deleting it but I got the error. Cannot delete file: Cannot read from the source file or disk. I tried renaming it and I got an even weirder error. The system cannot find the specified file I figured it would be easier to remove it from the command line so I tried del "myfile.mp4." but to my surprise even that did not work out. After almost giving up I tried Google and it came up with these solutions on support.microsoft.com . Even that did not help out. After spending a few more minutes searching online I realized that the problem was in the way windows treats filenames. Since each file has two names one the 8.3 format and the other name which we normally use. To see a list of files in 8.3 use the command on the command line. dir/x Try this in the directory and see the 8.3 name for that file. Now try and delete it ...

Moving from Basic Auth -> OAuth -> xAuth

Twitter will remove the option to use Basic Auth from June onwards and the only option left is OAuth. But the problem with OAuth is that its a UX nightmare to implement in a Desktop application. After trying to figure out how to use OAuth all day long I finally figured out that I was looking for xAuth all along. Cutting a long story short I found a blogpost which helped me get a hang of it. Using xAuth, an alternate OAuth from Twitter . Also found a little bit of help on the twitter wiki on using xAuth . Its quite simple to use once you get a hang of it. But since it mentions headers in most of the places I assumed HTTP headers but you need to provide all the parameters when you POST it to twitter. I have sent out a mail to enable xAuth on my account lets see how long that takes and I can finally start using xAuth instead of the cumbersome OAuth to log into twitter.

Dynamic GUI and console windows application

Running the same executable as a GUI as well as console application. This is one problem I had come across a few years back. But I soon realized that its decided while linking if an executable will be GUI or console application. But given the amount of time its been I thought of searching online and I came across this article " How do I write a program that can be run either as a console or a GUI application? ". It kinda had a solution but in the end its still better to have two separate executables. One for GUI apps and the other for console apps. After all these years Java also has two executables. java.exe for console apps and javaw.exe for GUI apps. There are two bytes in the executable file which tell the OS if the file is Console or GUI app. Change those bytes and you can run it as a console or GUI application. For more information about the PE format visit http://wotsit.org . Hopefully this is the first in the series and hopefully I will be writing more about it soon...