Jump to content

英文维基 | 中文维基 | 日文维基 | 草榴社区

Wikipedia:Reference desk/Archives/Computing/2012 January 9

From Wikipedia, the free encyclopedia
Computing desk
< January 8 << Dec | January | Feb >> January 10 >
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.


January 9

[edit]

Alternatives to texvc in MediaWiki

[edit]

I asked a little while back but didn't get any answers, so I'll ask again: Are there any known alternatives to the standard Math package for MediaWiki distributions? My webhost apparently doesn't support PHP commands like passthru() and exec(), and I'm guessing those are needed in order to parse the Latex markup. So... are there any alternatives or workarounds so I can get some good-looking math working on my wiki? Thanks very much. 216.221.63.30 (talk) 01:51, 9 January 2012 (UTC)[reply]

I couldn't find one. Category:Math_extensions. Why don't you just change hosts; or ask your webhost about the PHP commands you need? Von Restorff (talk) 12:52, 9 January 2012 (UTC)[reply]
The web-host's limitation is not simply that "exec" is unsupported. (That would be a silly limitation, in and of itself!) The web host is denying its users the ability to execute arbitrary programs - which is a form of sandboxing, for security-reasons. Every web-based implementation of TeX that I know of requires native executables.
Your options are, unfortunately, to switch web-hosts (look for any host who offers "shell access," which is shorthand for "you're free to run whatever user-space programs you need." Or, you can migrate yourself off of TeX to some other technology for rendering math. Nimur (talk) 19:30, 9 January 2012 (UTC)[reply]

facebook

[edit]

So, I created a facebook account a little while ago that I have done nothing with since then, but it seems it may now be useful, I am supposed to be working on my current university project with a bunch of people I have never met before, and one of them managed to find me on facebook and we exchanged a few messages. Only trouble is, now they want me to email them some stuff, but I don't know their email address. I have been led to believe it is possible to find such things on the site, hence why I was encouraged to get on there before, when something similar happened, but I cannot find where. So, how do I go about emailing some files to someone I know only from that site?

148.197.81.179 (talk) 11:41, 9 January 2012 (UTC)[reply]

You should be able to find their email address in the info tab on their profile page. If you can't find it, send them an e-mail on facebook itself and ask for their email. Mrlittleirish 11:48, 9 January 2012 (UTC)[reply]

(edit conflict)You can
  • upload the files you want to send somewhere (if you do not have and want a dropbox you can use something like filehosting.org) and then send them a message via Facebook asking them for their email address and explaining how they can download the files
  • enter their name in Google and look for their email address
Von Restorff (talk) 11:51, 9 January 2012 (UTC)[reply]
You can also attach files through the Facebook messaging service (click the little paperclip icon while writing a message)). Or you could, you know, just ask them for their e-mail address (sometimes the most obvious things are the best). --Mr.98 (talk) 12:49, 9 January 2012 (UTC)[reply]

Smartphones and apps that run everywhere

[edit]

Are mobile apps normally able to run on every main smartphone (BlackBerrys, Androids, iPhones, Windows Mobile)? Do Java or HTML5 (or other run-everywhere technology) make this possible? 88.9.214.197 (talk) 17:17, 9 January 2012 (UTC)[reply]

Mobile apps are limited by their execution environment (the OS), so one app has to be rewritten by the developers if they want to target a different platform (Obj-C for iPhone, Java for Android, C# for Windows Mobile). As for HTML the one that takes care of interpreting and rendering the code is the browser, so in theory that allows to serve the same code (say, HTML + CSS + JS) to every user regardless of their operating systems, as long as they have a browser that supports it. In practice, though, there are many things that browsers interpret differently, so making a "universal" application requires a good deal of extra development to make sure that it behaves coherently. See [1] [2] for feature availability tables. HTML5 is among other things an attempt to standardize web practices in order to minimize cross-browser conflicts, but it still has some ways to go — Frankie (talk) 19:29, 9 January 2012 (UTC)[reply]
Frankie is correct, though I think he's too generous when discussing Java and HTML 5. Native apps are not browser-based "apps", so the real answer to the original question is "no". Side note — Unity is an example of some middleware that runs on both Android and iOS, and I've talked to one engineer who got his Unity game, authored under iOS, running over on an Android phone in 20 minutes. Completing the entire port took a lot longer, of course, but at least he got it running right away. Comet Tuttle (talk) 19:54, 9 January 2012 (UTC)[reply]

Connecting an Atari standard joystick to a modern PC?

[edit]

Does anyone know if it's possible to connect an Atari standard joystick to a modern PC? I have got E-UAE and VICE running on my Fedora 14 system, but it's a bit awkward to use the numeric keypad as a joystick. On E-UAE, the host PC's mouse works as the Amiga's mouse, and the Commodore 64 doesn't even use a mouse as standard. But I would feel better using an actual joystick. I already have one, I just can't use it at the moment, as modern PCs lack an Atari standard connector. Is such a thing possible? JIP | Talk 19:20, 9 January 2012 (UTC)[reply]

ThinkGeek has sold USB versions of the standard Atari joysticks in the past. They appear to be out of stock right now. If your computer has a 9-pin serial port, you should be able to plug an old joystick in. Then, the issue isn't "can I plug it in?" The issue is "Will my program be smart enough to scan my serial port?" Struck previous - I never noticed that was a "game port" on my computer. -- kainaw 20:02, 9 January 2012 (UTC)[reply]
Atari 2600 joysticks didn't use the standard 9-pin serial port. Comet Tuttle (talk) 20:20, 9 January 2012 (UTC)[reply]
(ec)That won't work. An Atari joystick, while it uses a DB-9, isn't an RS-232(EIA-232) device. Instead it's a digital microswitched system which grounds various lines on the DB-9 when different directional switches are closed (the pinout is here). To make it work with an existing port, that port needs to have five lines of GPIO (well, GPI) for NSEW and one button, which a COM port won't do. A game port does (because it was always intended to connect analog and digital joysticks); the two aren't electrically compatible, so some circuitry between the two is necessary - this page has diagrams; I don't know if anyone sells these kind of things made already built (the forums for atari and c=64 emulators will know, as people there sometimes build and sell hardware to allow ancient peripherals to connect to modern PCs). It's another matter whether JIP's computer has a game port, and whether the emulators in question will support a digital joystick on a game port. -- Finlay McWalterTalk 20:20, 9 January 2012 (UTC)[reply]
Slight correction: it's a DE-9 not DB-9. -- Finlay McWalterTalk 20:43, 9 January 2012 (UTC)[reply]

Boosting WiFi with aluminum foil

[edit]

The wireless router in my house is located in the room with our two wired desktop computers, and unfortunately isn't near the center of the house. I've found several websites and videos that claim that folding aluminum foil into a parabolic shape and placing it behind the antennae can help reflect the signal and make it stronger in the rest of the house. Does this really cause a significant improvement in signal strength? Since the router is next to the wall, our encrypted WiFi signal isn't doing the neighbors any good, so if there is an easy mechanism to reflect the unusable area of the signal back centrally, that would be great for how our electronics are laid out. Buying a better set of antennae seems like the sure-fire way to solve the problem (or, of course, moving the router and maybe buying WiFi cards for the desktops), but it's not that important and I was hoping for a simple do-it-yourself solution, which is why the tin foil suggestion intrigued me. For reference, the router is a wireless Linksys of the WRT54 series with the proprietary firmware. Thanks!--el Aprel (facta-facienda) 22:46, 9 January 2012 (UTC)[reply]

A parabolic reflector will boost the router signal in one direction only, and if you have multiple receivers, this isn't necessarily going to help. if they are all more or less in a line, and you point it in the right direction, it might improve the signal - you'd have to experiment. AndyTheGrump (talk) 22:58, 9 January 2012 (UTC)[reply]
I suspect that adding external reflectors to a WiFi antenna will cause multipath interference. This may actually reduce the signal integrity, even if it increases the signal intensity. 802.11 WiFi is a sophisticated protocol, and unless you have access to the internals of the radio system (the amplifiers, the firmware, and so forth), your attempts are probably going to be futile. Nimur (talk) 23:22, 9 January 2012 (UTC)[reply]

It’s fairly simple to run wire (coax or ethernet) through the various outlet boxes of a house, if you’d like to relocate such a device (do disable the power at the breaker/fuse box first to avoid electrocution, however :p). You could also route a network connection from a single wired desktop to another over a USB cable… though a simple network switch box and a couple short cables shouldn't run you much, and would be (marginally) simpler to set up (via the OS). ¦ Reisio (talk) 01:12, 10 January 2012 (UTC)[reply]

However make sure to check if running cables in your house is actually legal. In Australia where I live you have to be licensed to perform such work, even just for data cables. Vespine (talk) 03:19, 10 January 2012 (UTC)[reply]
I'd also note that running data cables alongside the mains system may in itself possibly cause problems with crosstalk. Getting a home WiFi system to work optimally seems to be something more closely related to alchemy than science, and can be extremely frustrating. From personal experience, I'd recommend trying to move the router to a central location (if possible) as the best starting point. You might also want to try a WiFi scanner like InSSIDer out to see what channels nearby routers are using - some routers seem to be rather stupid in channel selection, and seemingly prefer to keep each other company on the same channel, rather than finding one with less usage... AndyTheGrump (talk) 03:55, 10 January 2012 (UTC)[reply]
YouTube about Linksys wifi improvement. Software and hardware solutions. fredgandt 04:16, 10 January 2012 (UTC)[reply]

I've had good experiences with extending the range of a USB Wifi dongle a bit by using a Cantenna made from a simple Pringles tin. So you can always experiment to see if it improves the signal. SpeakFree (talk)(contribs) 15:52, 12 January 2012 (UTC)[reply]

Issue with java and thread halting.....

[edit]

I am trying to halt a thread in java. Since thredName.stop() is deprecated and considered dangerous, i looked to see how i should do this. All sources that i have found showing a safe way to stop a thread are saying you should have a boolean value that is toggled from outside of the thread, and the run method checks this value every now and then.

See: http://www.exampledepot.com/egs/java.lang/StopThread.html http://stackoverflow.com/questions/3194545/how-to-stop-a-java-thread-gracefully

Its all the same stuff....

public void run() { //do stuff if (done) return; //more stuff }

lots of variants, but they all have the same problem... the thing i want to do inside the run method is a blocking statement, so its impossible to terminate it if one of these statements runs forever. The only thing i can think of is to make the call non blocking, but this is done by threading and we are at the same problem i started with.

How the heck do i stop a thread that might be running a statement that is blocking???? Thanks for any input, and if it is needed that i show my specific example i will do so.

172.162.110.233 (talk) 23:55, 9 January 2012 (UTC)[reply]

The appropriate technique is explained in the Java Thread Primitive Deprecation guide, How do I stop a thread that waits for long periods (e.g., for input)?. The bottom line is, use Thread.interrupt() to send an InterruptedException (which your thread should handle in a catch block). This will interrupt your thread in a safe way. In some cases, you can also cause the thread to interrupt in an application-specific way, such as asynchronously closing a socket (which will cause any thread waiting on socket IO to terminate and/or throw an IOException). Nimur (talk) 00:46, 10 January 2012 (UTC)[reply]

Im not sure i get how the thread should check it, but i have tried thread.interrupt() to no avail.... here is my code:

http://pastebin.com/chAzCMCT

172.162.110.233 (talk) 01:26, 10 January 2012 (UTC)[reply]

If you'll trim that down to a runnable example I'd be happy to take a look. --Sean 20:32, 10 January 2012 (UTC)[reply]
This is a known issue with the ScriptEngine API; it provides no mechanism for interrupting computation. The link suggests using Mozilla Rhino directly, or just using the unfortunate stop() (which really can ruin your day if the thread had something locked at the time). --Tardis (talk) 08:27, 12 January 2012 (UTC)[reply]