Wikipedia:Reference desk/Archives/Computing/2009 May 29

Computing desk
< May 28 << Apr | May | Jun >> May 30 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


May 29 edit

Right Align a Button edit

Hello. How do I right align a button in Java? I do not want it to occupy the whole right edge. Any leads are greatly appreciated. --Mayfare (talk) 02:00, 29 May 2009 (UTC)[reply]

Your question has two possible meanings: Do you want to align the button itself to the right side of the container it is in? Do you want to align the contents of the button to the right side of the button? -- kainaw 12:13, 29 May 2009 (UTC)[reply]
Here is a tutorial on this topic, assuming you're talking about Swing. --Sean 13:40, 29 May 2009 (UTC)[reply]

ISP keeping record of MSN Messenger Conversations edit

Does your ISP keep a history/record of your MSN Messenger conversations? Hence, if both parties choose for their Messenger to not keep a history of their conversations, is there anyway that their conversation can be retrieved? Acceptable (talk) 02:01, 29 May 2009 (UTC)[reply]

I think it's highly unlikely because of privacy issues, but you'd have to check their terms and conditions to be sure they don't have monitoring clause - The only exception would be if one of you is accessing the Internet via their work/VPN because it's quite possible they might have monitor clauses. If anything it'll be another node somewhere between yourself and the other person who's monitoring the communication but that's very unlikely - or at least it should be unlikely. I'd say the most likely problem would be someone recording their side (either intentionally or by accident) and that copy getting out. If you're really that worried about it then you may both wish to install something like SimpLite which will encrypt your conversation, it won't stop any local logging, but it'll stop any unauthorised snooping - Both sides have to have it running though! Hope this helps! ZX81 talk 02:36, 29 May 2009 (UTC)[reply]
But it is rather trivial to capture instant messages though. I have a plugin on my pfSense box that does exactly that. --antilivedT | C | G 04:04, 29 May 2009 (UTC)[reply]
It looks like you live in a relatively free country. In more oppressive places like the EU the government may keep track of your communications. 121.72.205.147 (talk) 06:27, 31 May 2009 (UTC)[reply]

it dont create it...if u live in a place lik that then u no it...an they watch u with ur webcam even if its off... —Preceding unsigned comment added by Ntower34 (talkcontribs) 08:27, 31 May 2009 (UTC)[reply]

Image help - trying to upload to commons edit

I am trying to upload an image to the Commons but I'm having file extension problems. I don't have much experience with image editing programs. I downloaded an image (digitized newspaper page) to my computer. There's no problem with the original image which is a .png. Needing to crop it, I tried various programs (paint, Wimdows image and fax viewer) but they don't have cropping tools. I then found PhotoPlus 6 on my computer and was able to crop it fine. However, when I saved it, it became a an .ssp image, whatever that is, which the commons doesn't recognize. The only other option the PhotoPlus program gives you in "save as type" is "all files (*.*). I tried that but that too the commons upload form refused. I then tried to open it with paint and windows image viewer to see if I could then resave it as a proper extension using them, but they wouldn't open it either. Long and short of it, I'm stuck. Any way to use this version of the image--to convert it? And if not, can anyone suggest a free image program I can download to crop again that will allow me to save the cropped image in a supported file extension format?--Fuhghettaboutit (talk) 03:58, 29 May 2009 (UTC)[reply]

Just use a proper image-editing software, like Paint.NET or GIMP. --antilivedT | C | G 04:05, 29 May 2009 (UTC)[reply]
Downloaded Paint.NET. Worked like a charm—cropped, saved, uploaded (here). Thanks.--Fuhghettaboutit (talk) 05:35, 29 May 2009 (UTC)[reply]

Java platforms edit

I am studyin java language on my own using a proffessional referance guide. It's actually a Java2 platform. My current PC is a windows XP so My commands and stuff and even the applications I write dont work! I even tried using source files from the net but my commands seem not to yield anything! Pls help me.... —Preceding unsigned comment added by 208.49.241.227 (talk) 08:01, 29 May 2009 (UTC)[reply]

You should tell what you have done so far. It's hard to help otherwise. --194.197.235.28 (talk) 08:45, 29 May 2009 (UTC)[reply]
Are you sure you have the Java Development Kit (compiler) installed, and is the directory on your path? Nimur (talk) 14:41, 29 May 2009 (UTC)[reply]

Need Software: Unique color counter edit

I'm looking for a software which can count the number of an unique color in a picture. For example, I want to know how many numbers of the color (20,167,99) in a picture. --百楽兎 11:15, 29 May 2009 (UTC)[reply]

The following (Python program) does that. It needs Python Imaging Library.
image_name = 'test.jpg'            # change as appropriate
desired_colour = (20,167,99)       # change as appropriate

import Image  # python imaging library

count=0
i = Image.open(image_name)
width,height = i.size
read_pixel_access = i.load() 

for x in range (0, width):
    for y in range(0, height):
        if read_pixel_access[x,y]==desired_colour:
            count += 1

print 'found', count, 'copies'
Let me know if you want it to find a unique colour, rather than just counting a specific one. 87.114.167.162 (talk) 11:55, 29 May 2009 (UTC)[reply]
Thank you but I can not run Python in this environment. Could you compile it to be an executable program for me? And actually, I have to count many colors' number, not only (20,167,99).--百楽兎 12:05, 29 May 2009 (UTC)[reply]
I have written you a Win32 executable. Please download [1]. If you use Linux, it will run under Wine. --Andreas Rejbrand (talk) 12:28, 29 May 2009 (UTC)[reply]
With all due respect to Andreas Rejbrand, the original poster should be aware that there is a security risk in running any untrusted executable on their computer. I'll bring this up on the RefDesk Talk Page in more detail. Nimur (talk) 16:25, 29 May 2009 (UTC)[reply]
I guess you mean a Windows executable - I'm afraid I don't have a Windows machine to hand to do that (but maybe someone who does will do a py2exe for you). Anyway, here's the code to count all the colours in the image and display them in descending popularity (most first) sort order:
image_name = 'test.jpg'

import Image  # python imaging library
d = {}
i = Image.open(image_name)
width,height = i.size
read_pixel_access = i.load() 

for x in range (0, width):
    for y in range(0, height):
        (r,g,b) = read_pixel_access[x,y]
        if d.has_key((r,g,b)):
            d[(r,g,b)] += 1
        else:
            d[(r,g,b)] = 1

for col,count in sorted(d.items(), key=lambda (k,v): (v,k), reverse=True):
    print col, '-->', count
Hope this helps. 87.114.167.162 (talk) 12:30, 29 May 2009 (UTC)[reply]
Yes, it is really helpful! Thanks very much to 87.114.167.162 and Andreas Rejbrand!
And by the way, (please see this screenshot first) what is the purpose of the question area? It's always blank.--百楽兎 14:00, 29 May 2009 (UTC)[reply]
I intended to show the bitmap there, but obviously I forgot to add the code for it! --Andreas Rejbrand (talk) 14:05, 29 May 2009 (UTC)[reply]
It's alright and not a problem, although showing the bitmap may be convenient to pick a color. And thank you for so kindly help again.--百楽兎 22:48, 29 May 2009 (UTC)[reply]

Computing history: personal computers today vs. supercomputers in the past edit

How far do you have to go back in time before a typical personal computer today (say one that retails for $1000) would qualify as supercomputer (perhaps just an entry-level one)? —Preceding unsigned comment added by 98.114.98.146 (talk) 12:19, 29 May 2009 (UTC)[reply]

The first machine in Supercomputer#Timeline_of_supercomputers is listed as doing 1 operation per second, which is vastly slower than even the first PC. If you don't want to count the Zuse V1 as a supercomputer, you'll have to come up with your own definition of the term, and then perhaps we could help answer the question in that context. --Sean 13:53, 29 May 2009 (UTC)[reply]

Then perhaps a better question would be...What is the 'newest' supercomputer that is slower than today's average computer (say retail $1,000)? (that's how I had read the above question anyways) 194.221.133.226 (talk) 13:58, 29 May 2009 (UTC)[reply]

This (http://setiathome.berkeley.edu/forum_thread.php?id=42332) discussion may be of interest to you. 194.221.133.226 (talk) 14:02, 29 May 2009 (UTC)[reply]

A lot of "super-computers" were optimized for a specific software setup and preferred program(s), before the ideology of general purpose computing really took off, driven by highly customizable software written in high-level programming languages. Comparing a modern machine to some of the early machines, which might have had special instructions for particular application domains, is not a fair comparison. Even if you count things like FLOPs and memory size, there are some bizarre architectures which don't fit well into the modern set of benchmarks. Nimur (talk) 14:46, 29 May 2009 (UTC)[reply]

To summarise - the late 1980's.77.86.10.194 (talk) 16:25, 29 May 2009 (UTC)[reply]

I agree. A modern PC is probably roughly the power of a Cray-2. Bubba73 (talk), 06:39, 2 June 2009 (UTC)[reply]

Business simulation games edit

I'm looking to buy some simulation games for my uncle. He's usually into some heavy duty stuff like Capitalism Plus. I checked out the articles for that game and Business simulation games but can't figure out which one would be good and not some silly approximation of a simulation game. Can I please get some suggestions for some relatively new business simulation/simulation games that could run on his Windows XP system? —Preceding unsigned comment added by 59.95.223.163 (talk) 14:28, 29 May 2009 (UTC)[reply]

I don't remember the name, but there was an old shipping business simulator that I rather liked. You ran a shipping company and had to move stuff around the world by boat. Your goal was to make profit, buy more boats, maintain those you have, get more contracts to ship stuff, etc... -- kainaw 15:01, 29 May 2009 (UTC)[reply]
That sounds a bit like Transport Tycoon, although it does ships, trains, and road transport. 87.114.167.162 (talk) 16:53, 29 May 2009 (UTC)[reply]
Ports of Call, perhaps? Surprisingly, we don't seem to have an article on this enduring classic, but you can still find it. -- Captain Disdain (talk) 00:08, 30 May 2009 (UTC)[reply]
Monopoly Tycoon was quite good too. It's not exactly new but I remember running it on XP. --antilivedT | C | G 02:55, 30 May 2009 (UTC)[reply]

Microsoft Office Outlook Connector - will it overfill my computer? edit

One of the bad things about web-based email, such as Hotmail, is that it is very laboreous to save copies of emails to one's hard drive. I am considering using Microsoft Office Outlook Connector with my Hotmail account, with the intention of downloading the emails via Outlook to my hard drive. I have several hundred, perhaps thousands, of Hotmail emails. If I use it, will my old computer be swamped by the thing trying to download gigabytes of stuff all at once? 84.13.52.104 (talk) 16:01, 29 May 2009 (UTC)[reply]

I doubt it, its unlikely to be in the gigabytes, I have around 5000 emails on my gmail account and its about 300mb.--Jac16888Talk 16:05, 29 May 2009 (UTC)[reply]
Actually, Windows Live Hotmail now supports POP3 access, so you can use any email client, not just Outlook. --grawity 16:14, 30 May 2009 (UTC)[reply]

Free text file / note organizer edit

Anyone know of any free programs which are similar to AlfaPad? Thanks —Preceding unsigned comment added by 82.44.54.169 (talk) 17:23, 29 May 2009 (UTC)[reply]

It appears to be a very simple application, that every (moderately talented) programmer could make in a few hours (a bit more if you need to create your own "Rich Edit" styled editing component)... --Andreas Rejbrand (talk) 17:28, 29 May 2009 (UTC)[reply]
Treepad has a free version. -- kainaw 17:31, 29 May 2009 (UTC)[reply]


Unfortunately I'm not a moderately talented programmer or anywhere near. Thank you Kainaw, I'll check that out —Preceding unsigned comment added by 82.44.54.169 (talk) 18:17, 29 May 2009 (UTC)[reply]

MSIE7 and Vista edit

I use MSIE7 in vista. My home page is D:\_www\INDEX.HTM on my hard disk. I use that as a sort of homebuilt favourites page. Any time I link to the outside world from that page or any time I click "Home" from an outside page MSIE/Vista insists on opening yet another tab in a different window. Is there anyway to make this work like it used to in XP where a click opens it in the current window/tab and a right click allows selection of a new tab or a new window? If so HOW! -- SGBailey (talk) 18:08, 29 May 2009 (UTC)[reply]

In Internet Options -> Security you'd need to make sure that "protected mode" is the same for the Internet zone and local Intranet (possibly Trusted sites too). You could disable Vista's User Account Control (not recommend), but the easiest thing would be to just tick all 3 as "Protected Mode = On" unless you have reasons not to. Otherwise you could upgrade to IE8 which works differently and doesn't mind opening different security zones in tabs and doesn't require a new window. Hope this helps! ZX81 talk 18:16, 29 May 2009 (UTC)[reply]
Thanks. I'll try one or other of those suggestions. -- SGBailey (talk) 16:53, 30 May 2009 (UTC)[reply]
I'm going to go ahead and be obnoxious here and suggest checking out Firefox or Opera browser, or at least upgrading to Internet Explorer 8. I'm fairly sure it even appears on Windows update and if you don't have it that means your PC might be behind on its patches. Gunrun (talk) 09:23, 2 June 2009 (UTC)[reply]

Interwiki bots edit

How do they match article titles in different languages? --PirateSmackKArrrr! 18:31, 29 May 2009 (UTC)[reply]

They probably use that list of interwiki links on the side of every page. At the bottom of the navigation area. [​flaminglawyer] 19:09, 29 May 2009 (UTC)[reply]
I mean before there are any interwiki links on the side of a page. The interwiki bots that add those interwiki links in the first place. PirateSmackKArrrr! 19:21, 29 May 2009 (UTC)[reply]
I'd guess they use some Google Translate-like translator to determine which names would be equivalent in different languages. But I haven't programmed any interwiki bots recently, so I'm not really sure :/ [​flaminglawyer] 23:17, 29 May 2009 (UTC)[reply]
I thought they simply added links that were in other languages. For example: Example on en.wiki may have an interwiki to fr:Example, but not de:Example. However, fr:Example does link to de:Example. The bot finds this, and adds de:Example to the Example page here. That's just speculation, though—I don't know if that's actually how it's done. Dendodge T\C 23:23, 29 May 2009 (UTC)[reply]
These bots may also be under human control, and simply accelerate the process by performing the repetitive parts. A human translator might provide the initial input, and let the bot do the rest. If you have a specific bot in mind, you can definitely write to its owner or leave a message at its talk page. Some bot owners will gladly discuss implementation details. Nimur (talk) 18:55, 30 May 2009 (UTC)[reply]

Bypass root password and /etc/fstab edit

  Resolved

What is the best way to bypass the root password for a program (on Linux)? I want to do that for some software I am working on (RUNZ). I need to do it because runz requires the "mount" command. What is the best option?

  1. use /etc/fstab - is it possible to make some whitelist on /etc/fstab to allow runz to mount any filetype at /tmp/random_name ?
  2. How about using the setuid thing? Is it worth it to create a binary that would run as root without password? And if the binary is just a launcher for the script, would it be compatible with all (at least recent) linux distros? (my guess is: no)
  3. How about using /etc/sudoers to whitelist runz? is that a good idea?

PS: FUSE does not seems to be a good option since it can't mount all filetypes supported by "mount".

Thanks __ Hacktolive (talk) 19:19, 29 May 2009 (UTC)[reply]

I'd suggest using 'sudo' to do this, but I'm not certain I understand what you'd want to do, even after reading the web page for "RUNZ". The danger is that someone could use it to mount something on /etc or /lib, which would be bad. Also, what are you trying to mount using 'mount'? I know you've rejected using FUSE already, but why wouldn't a plugin for FUSE be appropriate? -- JSBillings 19:37, 29 May 2009 (UTC)[reply]
Also, if a user can mount arbitrary filesystems, they can mount one that contains a setuid binary of their choice (such as a setuid shell). Then they can do anything. Tread carefully. -- Coneslayer (talk) 19:40, 29 May 2009 (UTC)[reply]
Thanks for the answers. I do not want to allow "mount" to run as root without the password prompt, but only the runz framework would run as root (without password question). I have taken several security measures (only mount files to /tmp and mount all files with -nosuid -nodev -r -- full security measures here) to ensure this is safe, so I think the security problems mentioned above do not apply. Regarding FUSE, I just can't find a UDF module for it. I have also considered mountlo, but it does not work very well... Hacktolive (talk) 20:07, 29 May 2009 (UTC)[reply]
(Sorry for being a miseryguts) I don't really understand what value-add you're getting from your mount-the-iso scheme, as opposed to a simple shar (or a self-extracting archive)? 87.114.167.162 (talk) 21:18, 29 May 2009 (UTC)[reply]
No problem, I am happy with (constructive) criticism. I also noted the Linux and Ubuntu comunities do not seem very interested in my project, but I do it mainly because:
  1. Running files should be easy! No need to mark as executable etc... (self-extracting files don't really work out-of-the-box for noobs)
  2. Being an ISO, it has many advantages, like being faster to open the files, reducing wear and tear on the HDD, etc... I think the design is just more simple and "elegant".

I really think this is a good idea, and I plan to include it in SP1 for Super OS 9.04... like I said, any opinions/criticism are wellcome __ Hacktolive (talk) 21:53, 29 May 2009 (UTC)[reply]

You can ask hal to mount things. Ask it over dbus. It's not really my area of expertise, so others might need to fill in the details, but could be something to think about? --h2g2bob (talk) 00:07, 30 May 2009 (UTC)[reply]
Thanks for the tip, however, I have no idea how to do that... Hacktolive (talk) 02:32, 30 May 2009 (UTC)[reply]
Does fuseiso meet your needs? Do you intend to use this loopback-mounted volume to permanently run apps, or just as a means to store installable packages? It's not clear from the web site. -- JSBillings 02:15, 30 May 2009 (UTC)[reply]
The problem is that fuseiso does not support UDF... and I really want to have support for large volumes... I am not sure what you mean... this method is just to run apps from the mounted file, the mounted file in unmounted once the user quits the app. Hacktolive (talk) 02:32, 30 May 2009 (UTC)[reply]
ISO 9660 supports volume sizes up to several terabytes at least. It's unlikely that you'd need UDF. -- BenRG (talk) 18:05, 30 May 2009 (UTC)[reply]
It might... but not without "hacks". Everytime I tried to burn big files (4GB+) to DVDs I always had problems with the ISO format, I had to use UDF. Anyway, I ended up using mountlo, and I know the proper solution for this might be a setuid wrapper. Thanks. ___Hacktolive (talk) 23:59, 4 June 2009 (UTC)[reply]