Wikipedia:Reference desk/Archives/Computing/2010 May 14

From Wikipedia, the free encyclopedia
Computing desk
< May 13 << Apr | May | Jun >> May 15 >
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 14[edit]

Automated Photo Mosaic Maker for Mac OS X[edit]

I am looking for a photo mosaic maker that can automatically assemble a specific selection of photos into a mosaic.--153.20.24.67 (talk) 01:56, 14 May 2010 (UTC)[reply]

Picasa does mosaics. F (talk) 10:32, 15 May 2010 (UTC)[reply]
That'd be a great program to use. It's created by Google and it's completely free! Chevymontecarlo. 11:16, 15 May 2010 (UTC)[reply]

Scam Website[edit]

Hi, I came across a website claiming to be an authorized Mobile devices seller in Europe. After dealing with them I knew they are fraud! My question is who should I be reporting this to? Thanks - Kim —Preceding unsigned comment added by 88.201.1.220 (talk) 08:29, 14 May 2010 (UTC)[reply]

This could be quite difficult if you ordered from Bahrain. What country in Europe was the website hosted in? For the UK, Trading standards would be the first point of contact.
(By the way, Kim, I'm not suggesting that you are responsible, but could you help us by discouraging others at your school from vandalising Wikipedia?) Dbfirs 11:11, 14 May 2010 (UTC)[reply]
Also reporting the website as phisihing via the controls in the browser will also help other people. For IE8 go to tools-->SmartScreen Filter-->Report Website. If you are using the norton software, click the "NOrton" logo on your toolbar and then click report site. --Tyw7  (☎ Contact me! • Contributions)   Changing the world one edit at a time! 05:29, 19 May 2010 (UTC)[reply]

Integer division rounding up[edit]

I'm a very new programmer (VB.NET) trying to write a program for a vending machine for a school assignment. I've got it to return the specific coins given as change but it won't give me the right number sometimes because integer division rounds up if the remainder is above 0.5 (at least, that seems to be what the problem is, if not then I've got no idea). How do I get it to always round down? 212.219.39.146 (talk) 09:01, 14 May 2010 (UTC)[reply]

Hmm. In nearly all programming languages, integer division does always truncate ("round down"), at least for positive operands. Are you sure that your data types are integers (not just the values?). If one of the operands is of type float (or whatever the language uses), the calculation will usually be performed using floating point arithmetic, and possibly rounded if assigned to an integer. Given that the numbers involved are small, why not just iterate (i.e. start with an empty set, add one of the largest coin until you would overpay, go to the next smallest coin, repeat. That also easily adapts to the case that you are out of certain kinds of coins). --Stephan Schulz (talk) 09:39, 14 May 2010 (UTC)[reply]
Because we've not been taught loops yet. (That would require some kind of loop, right?) You might be right about the data types, I'll check when I get chance. Thanks! 212.219.39.146 (talk) 09:53, 14 May 2010 (UTC)[reply]
Mmm...that didn't work. 212.219.39.146 (talk) 09:59, 14 May 2010 (UTC)[reply]
If converting from float to integer always rounds to nearest integer, then you can force rounding down by subtracting 0.5 from the floating point result before converting to an integer (I am assuming that 0.5 rounds up here). Gandalf61 (talk) 10:25, 14 May 2010 (UTC)[reply]
It does indeed. Cheers, that should work. I'd considered it before but it seemed...inelegant. Ah well. Cheers! 212.219.39.146 (talk) 10:33, 14 May 2010 (UTC)[reply]
I've often done it that way and I also find it inelegant. You should be able to use the more elegant Math.Truncate(). --Phil Holmes (talk) 10:53, 14 May 2010 (UTC)[reply]
I would triple check that all of my variables were integer variables. Try to assign one something like 2.5; it should fail. vb.net has an "integer division" operator, the backslash ("\"); that one will give you a truncated division operation. For your homework problem, you also want to look at the "mod" function; it gives you the remainder of an integer division operation. I'll leave you to look up details as part of your learning process, and feel free to post questions back here.
Also, I think your instincts about the "inelegance" of the "subtract .5" solution were right on.
Ralphcook (talk) 00:39, 15 May 2010 (UTC)[reply]

gunzip from string in perl[edit]

I have a http response in a perl program. But the response encoding is gzip. How do I deflate it? Searching in the net I can only find how to unzip from a file. 59.93.209.146 (talk) 14:23, 14 May 2010 (UTC)[reply]

I'm more of a python than perl person myself, but it seems like perl follows the same nomencature - gzip handles the full .gz compressed file format, using the zlib compression library. I think you need to use zlib yourself, as you're dealing with a simple compressed stream not a formatted file. Perl's zlib documentation is here; that, and not gzip/gunzip, seems to be what you need. -- Finlay McWalterTalk 14:47, 14 May 2010 (UTC)[reply]
I am trying to use IO::Uncompress::AnyUncompress. I have this code
$input= $response->content();
$in= \$input;
$output= "bingo";
$out= \$output;
print $$out;
anyuncompress $in => $out;

anyuncompress expects a reference but all I get is an error: Can't call method "anyuncompress" on unblessed reference What do I do ?59.93.209.146 (talk) 15:30, 14 May 2010 (UTC)[reply]

You forgot the "use IO::Uncompress::AnyUncompress qw(anyuncompress);" line. --Sean 15:50, 14 May 2010 (UTC)[reply]
Thanks, any ideas on how to extract text between the html tags ? 59.93.209.146 (talk) 16:17, 14 May 2010 (UTC)[reply]
HTML::Parser. —Sean 16:47, 14 May 2010 (UTC)[reply]
It'd be much easier to just call "gzip -c -d" from the sys function, or if you need to capture the output, from within backticks. This sacrifices some portability and elegance, but is much easier. Shadowjams (talk) 03:39, 16 May 2010 (UTC)[reply]
I think that's a bad idea in this case. Two-way communication with a subprocess over pipes is likely to deadlock unless you use select/poll IO, which is a lot more complicated than using the Perl deflate library (which is very simple, the OP's problem notwithstanding). Also, there are three different wrapper formats for deflate data (RFC 1950, RFC 1951 and RFC 1952) and some inconsistency in what gets delivered in practice, so AnyUncompress's automatic format detection is probably desirable. Gzip only understands RFC 1952, and there aren't any standard command-line tools that accept the others (to my knowledge). -- BenRG (talk) 03:04, 17 May 2010 (UTC)[reply]

Software for my retail shop[edit]

Hello! I am starting a new retail shop where I sell assorted items. Is there a free and simple software that I can use for printing receipts for my customers? I have windows and linux. Would prefer an open source solution, if that is possible. Thank you for your suggestions.--117.196.129.155 (talk) 20:19, 14 May 2010 (UTC)[reply]

Hmm, that's an interesting question. I had a look around our articles, and I found Comparison of accounting software - there are a few open source packages listed as having point of sale features which I think are appropriate. Business software also looks useful. If I find anything else, I'll post again. CaptainVindaloo t c e 21:40, 14 May 2010 (UTC)[reply]
OpenERP looks promising, as does Apache OFBiz, especially as the Apache Foundation is generally well regarded. Need third opinions on quality and suitability at this point, as I'm a little outside my specialism now. CaptainVindaloo t c e 22:00, 14 May 2010 (UTC)[reply]

Thank you! I'll check those up. Couldnt get anything much on googling earlier. So much appreciate the links. Will get back to you. --117.196.129.155 (talk) 22:20, 14 May 2010 (UTC)[reply]

I would see if there is a trial version available of QuickBooks, which I assume is used by 98% of American businesses. If it suits your needs, buy it. Comet Tuttle (talk) 03:40, 15 May 2010 (UTC)[reply]

Windows XP DHCP problems[edit]

My computer won't connect to the network. I think it is a DHCP problem and hope somebody can help.

I've been trying to set up an old computer with its original Windows XP Pro installation. The idea was to get it online, then run Windows Update an infinite number of times to get it ready for use. Hence, I now have a fresh WinXP installation on it that came from a CD that was at least five years old. The problem is getting it on the network. I've tried both with a long LAN cable (the access point is some distance away) and the PCI WLAN card (Ralink 2500-something), for which I downloaded drivers on a different computer and transferred them via a USB stick. As far as I can tell the problems are similar for the two types of connection (I have not had them on at the same time). I've disabled all WEP/WPA on my Linksys WL500G router (which I have now tried to restart several times). The computer has worked with the router before. The router is servicing two other computers and a cellphone just fine.

The problem seems to be that I cannot renew my IP address. ipconfig shows a 164.* address that I believe to be a default for unconnected computers (my home network is 192.168.1.*). Ipconfig/release works fine. Ipconfig/renew shows an error about not being able to connect to DHCP server (or something to that effect; I'm translating from a non-English installation). I've tried to write "netsh int ip reset log.txt" and it didn't help. I can ping localhost and get a reply. The wireless connection shows as "connected", sends data packets, but never receive any. Pinging 192.168.1.1 (the address of the router) gives no reply (it works from other computers on the network). Googling for this is a bit tricky because a lot of things can go wrong with a network, but I've tried (that's where I got the netsh command from, for example). So do anyone have any ideas? I know 2005-ish WinXP is old and outdated but the idea was, as I said, to get it updated. I'm not willing to pay for a newer licence. I considered Ubuntu or some other Linux flavor but there's a lot of various PCI stuff connected to this computer and I know they've all worked under XP before while I've had problems with Linux. Thanks for any help! Jørgen (talk) 20:49, 14 May 2010 (UTC)[reply]

Is there any MAC filtering on the router?
Do you have any remaining IP addresses on your router? (sometimes the range is intentionally shrunk to limit the number of connections to it, although this is not a good 'security' feature in reality anyway--neither is MAC filtering)
Is your SSID hidden? This can cause issues with some wireless adapters. (also a poor security feature)
Are your TCP/IP settings (Network Connections->Adapter Properties) pre-defined or set to automatically configure? (automatic is usually best)
Have you verified your ethernet cable is good?
I noticed you mentioned you have a lot of PCI devices installed on this computer. Are there any possible conflicts? Run devmgmt.msc to see if Windows has detected any.
Just a few ideas and things to try out if you haven't already. Be sure you check doubly that your drivers are the correct ones as well. -Amordea (talk) 01:19, 15 May 2010 (UTC)[reply]
Thank you for your advice - I think I have all those covered. I haven't verified the Ethernet cable but as I said I have similar problems with wifi. Also, most of the PCI stuff is disabled now as I haven't installed drivers yet. Maybe I'll have another look at the network drivers, but as I connect to the network somehow, I'm feeling that is not the problem... we'll see. Thanks anyway! Jørgen (talk) 07:44, 15 May 2010 (UTC)[reply]
If it is just DHCP, you could set a usable address manually. Control Panel, Network Properties, right click and select Properties, Internet Protocol.. Properties, Use the Following Address, 192.168.1.2 --Phil Holmes (talk) 09:28, 15 May 2010 (UTC)[reply]
I would never have even attempted a wireless connection until everything was updated, for fear of unsolvable driver problems costing me infinite time to track down. I'd have done it wired - and in your case, I guess advising a replacement cable is the first thing I'd try. Sorry to sound lame, but I actually had a bad brand-new cable frustrate my net setup just last month. Comet Tuttle (talk) 16:26, 15 May 2010 (UTC)[reply]
Thanks to both of you. (Tried DCHP, didn't help (but I liked the idea), and couldn't find another 10m cable). I finally bit the bullet (is that an expression?) and installed some bloated WLAN interface made by the wlan chipset manufacturer. And voila, it worked! Apparently it installed something called an AEGIS protocol in addition to the TCP-IP (and likely a lot of other stuff, but I can always try uninstalling it again when all updates are in). It also allowed me to keep my wlan encryption on. So this is written using Internet Explorer 6 while downloading Service Pack 2. A nice weekend to you all! Jørgen (talk) 19:23, 15 May 2010 (UTC)[reply]

Help me choose a language[edit]

I wish to create a closed source program that I will be selling. I would like the program to work across platforms. Which language would you recommend me to code in? Is Java used for desktop applications now-a-days? (can't seem to recollect any java application except those on mobiles). I googled around a bit and found Qt (under LGPL) and Mono as other options. So what do u suggest? Java/Qt/Mono/Qyoto/Jambi? Or something else? Thank you!--117.196.129.155 (talk) 21:39, 14 May 2010 (UTC)[reply]

I think you need to explain more before we can give an educated answer. Some questions I have:
  • What is your level of programming proficiency?
  • What languages do you already know? Which is your favorite, and why?
  • Is this a large program or a small one? What is the type of application?
  • What is the importance of performance?
Without answers to these questions, I think an answer is premature. Comet Tuttle (talk) 03:39, 15 May 2010 (UTC)[reply]
I really don't want to trigger a debate, but you should consider whether using a cross-platform approach is right at all. In his seminal book About Face, Alan Cooper contends that using these cross-platform toolkits, you end up with a program that looks and more importantly works non-Windows on Windows and non-Mac on Mac, ultimately pleasing no one. He suggest focusing on the primary (i.e. most profitable) platform first. (I find Cooper an unsympathetic guy with a Jupiter-sized ego, but that doesn't mean he is wrong.) If for you that is Windows, I suggest using the standard Platform SDK from C++ or even C, which are boring and old-fashioned, but fast and reliable. Of course, whether that matters will depend on the type of application. For example, picking Java for a high-end engineering application like AutoCad or Design Compiler is a huge gamble performance-wise. Finally, and don't take this as an insult, but you appear to be leaning towards the hip buzzwords of the day. Ultimately, your customers will not care what it's written in, just how well it works. I could go on all day, but as Tuttle said, we need more details to be able to narrow it down. 83.81.60.11 (talk) 07:56, 15 May 2010 (UTC)[reply]
Java is certainly used for desktop apps; OpenOffice.org, Vuze, LimeWire and NASA World Wind being some of the more well known ones. See Category:Java platform software for more. F (talk) 10:30, 15 May 2010 (UTC)[reply]
With all due respect to Alan Cooper (I have never read his works), I think he must have missed the Look and Feel chapter of the Introduction to JFC/Swing tutorial. It's nearly trivial to make your program look like the Windows GUI; it is the programmer's preference to follow Windows style and nomenclature guidelines for any particular platform. Nimur (talk) 14:26, 15 May 2010 (UTC)[reply]
I don't think we need to know these things. The question isn't *that* complicated.
The OP doesn't tell us why he wants cross-platform capability, so questioning that he wants it is a bit presumptive. I do agree that there are lots of other considerations that are likely to drive the choice of language, but this is what the OP is interested in, let's try to answer that.
The only language I know of that had cross-platform capability as a design goal and is generally popular these days is Java. Yes, desktop applications are written in it, even large ones. I don't know about ones with specific CPU requirements, but I do know Java got a bad rap for performance when it was introduced 15 years ago, and has never quite shaken it. If you really need top performance, that requirement will fight with your desire for cross-platform capability. And do be aware that there is such a thing as "fast enough"; if your program spends most of its time waiting for the user to click a button, it doesn't matter in the least how efficiently it does that. Between clicking button(s) and getting desired results (assuming you HAVE a point-and-click UI, which you haven't said either), there is a level of performance that is necessary, and a slightly higher one that is nice to have. Spending any programming time and effort being faster than that is wasted effort.
There are claims to writing C code in a cross-platform manner, and it is possible, but I also think it's a lot more work than a higher-level language. C was developed as a "high-level assembler", not really in the same league with other high-level languages even at the time it was developed. It allows you to get as close to the machine as possible and still require something called a compiler instead of an interpreter. It will likely run a little faster than an equivalent Java program, given similar program design and programmer competence, but you will spend a lot more of your effort avoiding constructs that are machine or OS specific than if you write in Java.
I don't agree with Mr. Cooper's point, either. You can create a Java program that conforms just as well to Windows and/or Mac and/or whatever OS you want as many "native" programs on that platform (especially Windows). —Preceding unsigned comment added by Ralphcook (talkcontribs) 17:57, 15 May 2010 (UTC)[reply]

FROM OP:Thank you everyone for the comments. I'd like to clarify. I'm making a GUI application that is of medium size and complexity. It is an internet enabled software (with a lot of clicking) that will be constantly communicating with my servers. I am a pretty good coder and am familiar with C/C++ and Java. I also know a few scripting languages. So I do not expect to face much trouble in learning up a new language if required. I have a personal preference for OOP languages, which lead me to consider Java, C#/Mono. Performance of the application will be important, because I want the end application to run on 128-256 MB RAM. Performance is my major turn off with Java, which is otherwise a language I love to program in. So what should I do? Should I heed Cooper, or go ahead with Qt/Mono? I do not have the time frame to develop for multiple platforms, and I'd like to roll them out all together.--117.196.133.44 (talk) 22:00, 15 May 2010 (UTC)[reply]

Well, I think this is an illustration of why one of the original answerers (OAs?) was asking for more information. You say "Performance ... will be important, because I want the end application to run on 128-256 MB RAM." When someone talks about performance, they usually mean how quickly it runs, not how little memory it uses. You've also now introduced something of a development time constraint ("do not have the time frame to develop for multiple platforms"), and expressed a language type preference for OOP. All of these things are factors.
I personally don't think much of those pronouncements of Cooper's with which I am familiar, including the one quoted above. The logic he gives to explain his reasoning often seems to have large (or huge) holes in it.
I don't know why you have a "performance" objection to Java. You have not yet told us anything about the CPU requirements of your application, only that it should run in a small amount of memory. Java is quite a champ in the memory use of its run-time environment, given that you have room for a virtual machine in the first place (which you do). The size of the code you get with Java is much smaller than equivalent natively compiled languages, assuming similar programming skill and style. If you love to program in Java, go for it; I don't see anything contraindicating doing so yet.
rc (talk) 23:13, 16 May 2010 (UTC)[reply]