Every once in a while I get to thinking "hmmm... what shall I write in my blog? I don't have any muse right now, but I want to write about something". To my surprise, each time that happens, I accidentally find an interesting topic, which is derived from things I stumble upon while surfing the internet.
Last week I've been configuring my not-very-powerful laptop, so it'll be able to remotely connect both my Windows and my Ubuntu. The Ubuntu connection is done via freenx server, while the Windows connection is done through Terminal Services. Actually, I'm writing these lines from a TS session. Most of the time I'm quite happy with this setup. I have full access to my desktop, I can work concurrently with my girlfriend (which is using the desktop, and which I taught the magic ways of using Ubuntu), and I can sit wherever I want, as the data is being encrypted over SSH over my wireless network.
Not all went clear, and both freenx and Terminal Services has some major bugs. The freenx bugs were solved after a short google search, and after hitting the "connect" button enough times (so the Ubuntu realized I'm serious about my intentions to connect). Terminal Services gave me a much harder time. It appears that if you own a powerful nvidia or ATI graphics card, and you work with high-res, TS won't work. This can be solved with some tweaking of the Windows registry, and messing with kernel parameters (what the hell does this have to do with being able to use TS?).
Now, I have a new syndrom: every once in a while Windows decides this is a good time to reboot after a DCOM server crash occurs. This is quite annoying, and I haven't found a good solution for that, yet. In the mean while, I type quickly 'shutdown -a' to abort the annoying reboots, afterwards I restart the DCOM service and the TS service, and everything is back to normal. Awkward.
Me saying I don't have a good solution is only partially true, as I found this web page describing my problem. For some reason, it exists only in the google-cache (I don't know how much longer it'll be there), so I'll quote the solution part:
"
I have put Ubuntu on a second partition and that solved my problem for
now. I still can access my files from the first partition and it
doesn't reboot randomly.
Thanks for all your help!
"
Interesting! Installing Ubuntu solved the reboot issues. How come I didn't think about it.
Wednesday, August 13, 2008
Tuesday, August 5, 2008
Acquiring System privileges under Windows
At some occasions, while using a relatively recent version of Microsoft Windows (I'll refer XP and above, but 2000 might also work), it is required to acquire System privileges (aka LocalSystem). This might happen for malicious purposes, but also legitimate reasons exist, such as finding a bug in a service which runs under LocalSystem. At such occasions, one would like to get a terminal (cmd) that runs as LocalSystem.
Of course, one cannot login using LocalSystem, since it is not meant to be logged-in with. But this is not a reason to despair. Actually, opening a cmd under LocalSystem is quite easy:
open a cmd (using the currently logged-on user) and type:
at 00:00 /interactive "cmd"
This will create a new scheduled task, which will never run, and would open a new cmd using LocalSystem. Now, all you have to do is: Start->Run->tasks and run the newly created task (usually "At1"). The cmd window that just got opened allow you to run everything as if you were the System account.
Of course, one cannot login using LocalSystem, since it is not meant to be logged-in with. But this is not a reason to despair. Actually, opening a cmd under LocalSystem is quite easy:
open a cmd (using the currently logged-on user) and type:
at 00:00 /interactive "cmd"
This will create a new scheduled task, which will never run, and would open a new cmd using LocalSystem. Now, all you have to do is: Start->Run->tasks and run the newly created task (usually "At1"). The cmd window that just got opened allow you to run everything as if you were the System account.
Wednesday, July 30, 2008
Improving bubble sort
Most people believe that using Quick Sort or Merge Sort, would achieve the best sorting performance over a standard array. Even though this might be true in most (or at least some) cases, there are real world situations where a better solution can be applied.
Let's assume there's a big chance we are trying to sort an already sorted array, or almost-sorted array. What is an almost-sorted array? This is an array which is sorted beginning from some element which is not far from the first element.
Now, let's try to recall what bubble sort looks like:
for i = 1 to length(A)
for j = length(A) downto i+1
if A[j] < A[j-1] then
swap A[j] with A[j-1]
This is a very simple implementation, but would cost O(n^2) even when we deal with an already sorted array. How could this be improved? Let's add a flag:
for i = 1 to length(A)
swapped = false
for j = length(A) downto i+1
if A[j] < A[j-1] then
swap A[j] with A[j-1]
swapped = true
if swapped = false then
break
As you can probably see, once there's a full iteration in which no elements were swapped, the algorithm finishes. For an already sorted array, performance are now O(n). For an almost-sorted array (beginning item c), performance are O(cn). Not bad...
Let's assume there's a big chance we are trying to sort an already sorted array, or almost-sorted array. What is an almost-sorted array? This is an array which is sorted beginning from some element which is not far from the first element.
Now, let's try to recall what bubble sort looks like:
for i = 1 to length(A)
for j = length(A) downto i+1
if A[j] < A[j-1] then
swap A[j] with A[j-1]
This is a very simple implementation, but would cost O(n^2) even when we deal with an already sorted array. How could this be improved? Let's add a flag:
for i = 1 to length(A)
swapped = false
for j = length(A) downto i+1
if A[j] < A[j-1] then
swap A[j] with A[j-1]
swapped = true
if swapped = false then
break
As you can probably see, once there's a full iteration in which no elements were swapped, the algorithm finishes. For an already sorted array, performance are now O(n). For an almost-sorted array (beginning item c), performance are O(cn). Not bad...
Monday, July 7, 2008
Dar the mailman
In the past few days, I've been working really hard on my final project. As mentioned before, it has something to do with e-mail and spam. The project requires me (actually us, I have a partner) to act both as a mail sender, and as a mail receiver. This is have to support any modern mail server, and also work with every major web mail providers (where most spam is usually met).
For some years I've known how to telnet to a SMTP server, and use it to send mail (which should be accounted as spam). When it comes to authorized mail servers, this is a bit trickier, as log-in mechanisms are required. Most use SSL or TLS, over semi-standard ports. So, I managed to write a python script to use gmail's SMTP server, using my gmail account (TODO: publish code). This made me happy, because I thought to myself it's gonna be easy. Well, not quite.
As it seems, the other major providers (hotmail, yahoo) would allow you to make telnet connection to their SMTP servers, but the log-in would fail. After a little research I found out that yahoo wants money for SMTP, and hotmail would simply not allow it altogether. Not good.
My next attempt was trying to use the mail provider's APIs. Google offers GData, while yahoo offers some other API. Microsoft offers only undocumented HTTPMail (webdav?) protocol. Once again, only the Google solution worked. Yahoo wants you to register your application, and your domain (hadn't bought one yet for the project) in order for the API to work. As for hotmail, well...
So, where does this leave us? It seems our last option is the one I've been trying to avoid: writing a parser (Perl or Python) for the web pages of the popular web mail providers, and normal SMTP and POP3/IMAP for other mail servers. Very cumbersome, error prone, hard labor and a waste of time.
For some years I've known how to telnet to a SMTP server, and use it to send mail (which should be accounted as spam). When it comes to authorized mail servers, this is a bit trickier, as log-in mechanisms are required. Most use SSL or TLS, over semi-standard ports. So, I managed to write a python script to use gmail's SMTP server, using my gmail account (TODO: publish code). This made me happy, because I thought to myself it's gonna be easy. Well, not quite.
As it seems, the other major providers (hotmail, yahoo) would allow you to make telnet connection to their SMTP servers, but the log-in would fail. After a little research I found out that yahoo wants money for SMTP, and hotmail would simply not allow it altogether. Not good.
My next attempt was trying to use the mail provider's APIs. Google offers GData, while yahoo offers some other API. Microsoft offers only undocumented HTTPMail (webdav?) protocol. Once again, only the Google solution worked. Yahoo wants you to register your application, and your domain (hadn't bought one yet for the project) in order for the API to work. As for hotmail, well...
So, where does this leave us? It seems our last option is the one I've been trying to avoid: writing a parser (Perl or Python) for the web pages of the popular web mail providers, and normal SMTP and POP3/IMAP for other mail servers. Very cumbersome, error prone, hard labor and a waste of time.
Friday, June 20, 2008
Standards are Standards
We all know what standards in the software industry are worth. Some people sit in a room (could be virtual, but most of the time it's a real room), and decide how something should behave. Then, each software company takes the standard spec (or RFC or whatever) and implements it, and then some.
Recently, in the hardware industry, there is a large debate, with accusations and flame-throwing about who should be part of the design of the next USB 3.0 standard. Intel claims that by developing the standard all alone, it actually has a chance to become a standard. Just like the previous USBs. This is my interpretation of things, and you should read about it yourself. We all know what monopolies in the computer industries can cause, if they're wrong, and the standard that's on the topic is closed (that is, only one company controls the spec) or badly designed.
Lets compare it with other industries: Last week we've purchased new curtains for our living room. The "technician" that came to deliver the curtains, said that the bar (or pole) that holds the curtains is too thin, and we need a thicker one. A thicker bar, means a different hooks, which would be able to hold it. We didn't want to replace the hooks, cause we didn't want to drill extra holes in the wall. But when the "technician" realized that this is what is bothering us, he said "what? you don't have to drill new holes, the new hooks uses exactly the same holes as the old ones". This means that the screws would be in exactly the same distance as they were before, and no drilling was required, even though the new bar seems a little bit heavier.
So, now we have new curtains, with new hooks, and I wonder, when and where did the "curtain hanging guild" sat to decide how should the hooks be designed, and how comes they all agreed on the standard. In our (software-) world, that would have never happened.
Recently, in the hardware industry, there is a large debate, with accusations and flame-throwing about who should be part of the design of the next USB 3.0 standard. Intel claims that by developing the standard all alone, it actually has a chance to become a standard. Just like the previous USBs. This is my interpretation of things, and you should read about it yourself. We all know what monopolies in the computer industries can cause, if they're wrong, and the standard that's on the topic is closed (that is, only one company controls the spec) or badly designed.
Lets compare it with other industries: Last week we've purchased new curtains for our living room. The "technician" that came to deliver the curtains, said that the bar (or pole) that holds the curtains is too thin, and we need a thicker one. A thicker bar, means a different hooks, which would be able to hold it. We didn't want to replace the hooks, cause we didn't want to drill extra holes in the wall. But when the "technician" realized that this is what is bothering us, he said "what? you don't have to drill new holes, the new hooks uses exactly the same holes as the old ones". This means that the screws would be in exactly the same distance as they were before, and no drilling was required, even though the new bar seems a little bit heavier.
So, now we have new curtains, with new hooks, and I wonder, when and where did the "curtain hanging guild" sat to decide how should the hooks be designed, and how comes they all agreed on the standard. In our (software-) world, that would have never happened.
Same game, different name
Each time there's a soccer tournament, I feel the urge to kicks some virtual balls into virtual goals. Now it's the time of UEFA EURO 2008, so I decided it's time to try EA's FIFA 08 (I just can't seem to like PES over FIFA). FYI, the game sells for 99 NIS in Israel, I guess it has something to do with the fact they're having hard time selling that game, and that it cost them 0$ (or some other small amount of money) to produce.
Why would I say such a thing? Because it's actually FIFA 07, packed in a different box, carrying a different name. The rest of the game is exactly the same. Same graphics, same engine, same sounds, same everything. It's a brave move from EA to release such a game, especially when a competition such as PES exists.
From what I read, the Xbox and PlayStation versions, include a better graphics engine, and better physics. If I stumble upon a PS3 with FIFA 08, I'll give it a try. In the meanwhile, I'm so disappointed. Though I still prefer it over PES.
Why would I say such a thing? Because it's actually FIFA 07, packed in a different box, carrying a different name. The rest of the game is exactly the same. Same graphics, same engine, same sounds, same everything. It's a brave move from EA to release such a game, especially when a competition such as PES exists.
From what I read, the Xbox and PlayStation versions, include a better graphics engine, and better physics. If I stumble upon a PS3 with FIFA 08, I'll give it a try. In the meanwhile, I'm so disappointed. Though I still prefer it over PES.
Friday, June 13, 2008
"Buying" users, for free. Genius
Most people been in the academy, knows the nice trick of major software companies: the "student edition" or "express edition" (sufficient for students requirements) is given for free or a small fee. Later, when the student will be looking for a job, he'll be looking the tools he already knowns. So, if for the entire degree the students uses Visual Studio Express and Office Student Edition, this is what will be written in the resume, and this what the student will be looking for.
This week, something similar (not exactly the same) happened in my university. The university opened "for free" email account for every student (still in pilot, but will eventually cover thousand of students) at live.com. Actually, this is live., but login is done through live.com. Now, since I was chosen to the pilot, I'm a happy owner of Windows Live Hotmail account. Not sure what am I supposed to do with it, but the university promised it'll work under Firefox and Safari under any OS, so no complaints here. The thing with this account is the fact that it is not limited to the period of time I'll be a student. It's for a life-time, only that after I'll finish my degree, the account would start display ads (which it currently doesn't). So, next year, I'll become a regular live.com user, that sees ads and everything, which makes me a source of income to MS. So thanks to the university, MS could make more money. Just like giving Visual Studio for free, only easier. Come to think about it, only one word comes in mind: Genius.
This week, something similar (not exactly the same) happened in my university. The university opened "for free" email account for every student (still in pilot, but will eventually cover thousand of students) at live.com. Actually, this is live.
Subscribe to:
Comments (Atom)