Wikipedia:Reference desk/Archives/Computing/2011 November 4

From Wikipedia, the free encyclopedia
Computing desk
< November 3 << Oct | November | Dec >> November 5 >
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.


November 4[edit]

Python 2.7 doesn't support xattr[edit]

I was trying to use an applescript basically identical to the script in this post on macworld. The script removes the "Where From" metadata on files (any kind of file.) The script uses "xattr" which apparently is a python program that allows viewing and editing of "extended attributes." However, when I tried manually going through the commands, I realized that when I try to run xattr, I get the following error:

python version 2.7.2 can't run /usr/bin/xattr. Try the alternative(s):
/usr/bin/xattr-2.5 (uses python 2.5)
/usr/bin/xattr-2.6 (uses python 2.6)
Run "man python" for more information about multiple version support in
Mac OS X.

Now I made the mistake of uninstalling the apple-supplied python, and I reinstalled python 2.7.2. So I don't have 2.5 or 2.6. I'm wondering: is there way of getting 2.7.2 to support xattr? Or is there a different command that will do the same thing? Or is there ANY way I can get it to work without installing the old versions of python?

Thanks. Inasilentway (talk) 00:57, 4 November 2011 (UTC)[reply]

Well, I'd suggest reinstalling the old versions of python Apple bundles. There is no reason you can't be simultaneously running the 2.6 version they provide, alongside pre 1.0 versions and release candidates towards 3.3. Just keep every version on there that you really need. Nevard (talk) 04:08, 4 November 2011 (UTC)[reply]

1.5 TB WD MyBook won't show up on 2009 iMac[edit]

I am trying to access my Western Digital 1.5 TB MyBook on my iMac but it won't register. --Melab±1 01:21, 4 November 2011 (UTC)[reply]

Never mind. --Melab±1 02:31, 4 November 2011 (UTC)[reply]
Resolved

Data remanence on an SD card[edit]

Is the possibility of recovering data from data remanence the same as that of a solid state drive considering they use the same technology? --Melab±1 10:44, 4 November 2011 (UTC)[reply]

Let me rephrase. I have a few SD cards that have been overwritten. Recently, some solid-state drives have shown to retain some data after being overwritten (data remanence). I assume that both SD cards and SSDs use the same technology, so is possible to recover some of my overwritten data on the SD cards in the same way that some data can be recovered from a solid-state drive? --Melab±1 18:40, 4 November 2011 (UTC)[reply]

Looking at Data remanence#Inaccessible_media_areas and #Data_on_solid-state_drives, my guess would be no they're not the same. A proper drive will come with a controller and an SD card is just a card, it would all come down to the software drivers. ¦ Reisio (talk) 22:16, 4 November 2011 (UTC)[reply]

Now I am looking for a program to repair corrupted JPEG files. --Melab±1 23:00, 4 November 2011 (UTC)[reply]
SD cards also contains a controller (AFAIK only XD cards does not contain a controller). Directly accessing flash chips probably will be difficult, though (require disassembly). -Yyy (talk) 09:33, 7 November 2011 (UTC)[reply]

My computer display and computer takes too much time to do somethiing.[edit]

When I click on the computer to turn on, the pc hardware and fan, start to run, but only after 7-11 seconds later the pc start. Before those 7-11 seconds the computer monitor is doenst show any image on it like if the pc was turned off (the power button of the monitor even blinks), then after those 7-11 the pc start and monitor start to show stuff. What can be the problem? 201.78.162.193 (talk) 19:55, 4 November 2011 (UTC)[reply]

This doesn't sound terribly slow to me. It sounds typical for the Power-on self-test that occurs when you turn on a PC. Did your PC used to start more quickly? Comet Tuttle (talk) 18:27, 4 November 2011 (UTC)[reply]
I am not talking that it takes 7-11 seconds to windows start. But to computer turn on. When I click on power button on pc the pc fan adn the other stuff start to run, but pc doenst start, the computer monitor doenst show anything like if the computer was turned off, then after 7-11 the monitor turns on and at the same time "the pc turns on", starting with the post. 201.78.162.193 (talk) 19:55, 4 November 2011 (UTC)[reply]
Many BIOS settings now default to no display or some idiotic logo during the rudimentary self test, which takes place BEFORE the post screen. So, you get a few seconds of nothing until everything is checked. It is taking longer and longer for self test because computers have more and more to test. Just consider memory - it used to be a breeze to check 256KB memory. Now, it has to check 4 or 8GB of memory. -- kainaw 19:58, 4 November 2011 (UTC)[reply]
Agreed, we've got some servers at work that take nearly over a minute to complete their checks before they even start to load Windows. It's possible that you can go into your BIOS and perhaps turn on a quick check option or skip memory check option, but if it's always been this long I wouldn't worry about it as it sounds just fine and you're best not really skipping any checks unless it's essential.  ZX81  talk 20:15, 4 November 2011 (UTC)[reply]

Emulating joystick input in Linux[edit]

Hi! Is it possible to make a Linux program that creates a joystick device file and sends some joystick events into it? I have found that it's possible to create simulated mouse and keyboard events with uinput, but I don't know how to simulate joystick events. 88.148.251.200 (talk) 14:46, 4 November 2011 (UTC)[reply]

If you want to do it on a low level, a joystick will have a dev file like /dev/js0. That will will contain text indicating signals from the joystick. You can read that file directly like any other text file. So, you can have your program ask which dev file to use. Pick on in your tmp directory or something. Then, have a program send the text to the fake joystick file for your program to read. The big problem here is that you aren't using any of the easier human interface control libraries that remove you from reading and parsing the dev file. -- kainaw 14:57, 4 November 2011 (UTC)[reply]
It should be possible to simulate a joystick using uinput -- see this page. You'll have to delve into the innards of uinput and joystick event protocols to figure out how to do it, though. Looie496 (talk) 15:38, 4 November 2011 (UTC)[reply]
From uinput's perspective, a relative (REL) device is a mouse (and is assigned a /dev/input/mouseN name); an absolute (ABS) device is a joystick (and is assigned a /dev/input/jsN name). So when you create the uinput device, configure it thus:
    ioctl(fd, UI_SET_EVBIT, EV_ABS);
    ioctl(fd, UI_SET_ABSBIT, ABS_X);
    ioctl(fd, UI_SET_ABSBIT, ABS_Y);
And the events that you then inject have a type of EV_ABS, a code of ABS_X or ABS_Y, and a value is a "a signed integer between -32767 and +32767" where 0 is (in theory) centred. I have a working example if you need one, but if you've got mouse working then the changes above will make a joystick. -- Finlay McWalterTalk 18:24, 4 November 2011 (UTC)[reply]
What if I want to have buttons or more than 2 axes? 88.148.251.200 (talk) 13:55, 5 November 2011 (UTC)[reply]
How would a joystick with more than 2 axes even work? It might somehow be possible to design a joystick with 3 axes, but beyond that, the entire concept becomes difficult to imagine. JIP | Talk 22:38, 5 November 2011 (UTC)[reply]
Well, for example, gamepads can have even 6 axes. But I've solved that problem. Now I have a few other problems: my program creates a device named /dev/input/eventX, but it doesn't create a device named /dev/input/jsX. And when I try to use the jstest command, it says: "jstest is not fully compatible with your kernel. Unable to retrieve button map!". 88.148.251.200 (talk) 12:00, 6 November 2011 (UTC)[reply]
Yes, an axis is just a range of analog inputs attached to a single device. So my old Dual Shock controller generates six axes (2 from the left stick, 2 from the right stick, and two from the arrow keys (these are really digital, but appear as analog devices from the input subsystem's perspective). There's no real way of knowing (from our perspective) whether ABS_X, ABS_X+1, ABS_X+2 etc. related to the same input or to different inputs on the same controller. -- Finlay McWalterTalk 13:09, 6 November 2011 (UTC)[reply]
And once you consider that this interface (as with most HID interfaces) lumps into "joystick" a miscellaneous bunch of analogy-controls that aren't very stick-y, more degrees of freedom isn't unreasonable. One could envisage a Wii-like control that had X,Y, and Z position axes, and roll, pitch, and yaw rotation axes. Add to that a squeeze-pressure axis and you have seven, all on the same device. Armed with that you could probably make some nice games and simulations of difficult 3d tasks (say Jenga or repair-the-space-telescope). -- Finlay McWalterTalk 15:40, 7 November 2011 (UTC)[reply]
It sounds like you've figured it out, but for the record you can just register more axes: they're named in /usr/include/linux/input.h, but really they're just ABS_X, ABS_X+1, ABS_X+2, etc. It also sounds like you've got buttons to work - buttons are just keys, and your simulated device can declare that it's also going to sent key events. I think BTN_0, BTN_1, etc. are the usual buttons that are sent (but I don't have a range of joysticks to verify what real joystick drivers actually send, given the plurality of control configurations they have). -- Finlay McWalterTalk 13:09, 6 November 2011 (UTC)[reply]

OK, I've solved all my problems now. Thanks for advice! 88.148.251.200 (talk) 12:56, 6 November 2011 (UTC)[reply]

This is all a very poorly documented area. I'd be interested to see your code. My own is here (I can't post it in Wikipedia, as it's derived from Gregory Thiemonge's example). It works okay, in that my own SDL input tester, and jstest, see the events I'm sending. I don't really have any Linux games to see if actual games like it. It does differ from what a real joystick (a Dual Shock) sends - the Dual Shock sends "initial state" events when it's opened, which I think show the number and range of each axis; my uinput code doesn't (and I've no real idea how to make it do so). -- Finlay McWalterTalk 13:13, 6 November 2011 (UTC)[reply]

I wish to limit my upload bandwidth and am looking for a free program[edit]

I've done a preliminary search on Google but all I could come up with are programs you have to buy.

The issue is that I live in a house with other people, and if for instance I want to upload a video to YouTube, it chokes the connection for everyone and I have to stop. Is there a free program I can use that allows me to adjust my maximum upload rate so that I don't have this problem? Thanks. Vranak (talk) 17:10, 4 November 2011 (UTC)[reply]

You can use squid, and proxy your web browser through the squid only when you want to throttle your bandwidth. Here's a How-To guide for bandwidth throttling. See also, how to set up Firefox to use a proxy. Nimur (talk) 17:25, 4 November 2011 (UTC)[reply]

http://www.brothersoft.com/firefox-throttle-393035.html http://www.netlimiter.com/download.php In Unixland you can use the program trickle ¦ Reisio (talk) 22:19, 4 November 2011 (UTC)[reply]

Virtual drive[edit]

hello,

how do I "deactivate" virtual drive during start. With Daemon Tools Lite. I have Vista. Thanks.--♫GoP♫TCN 17:23, 4 November 2011 (UTC)[reply]

If you can't right click on the daemon tools icon in the tray and disable it with a preference, try hitting Windowskey+r, type msconfig and check startup; also the startup folder in the Start > Programs folder. ¦ Reisio (talk) 22:21, 4 November 2011 (UTC)[reply]
No, you don't understand me. Everytime I start my computer, the drive run by itself; I already did the same as you said. Even if Daemon Tools is off, and I delete the drive, it still runs automatically.--♫GoP♫TCN 11:18, 5 November 2011 (UTC)[reply]

Folder renames by itself, part 2[edit]

hello,

please read the thread [1]. It now renames not only the ZZ Top folder, but also other folders. He recently renamed "Woody Guthrie" into "L". It needs to be fixed, because it really sucks! Thanks.--♫GoP♫TCN 17:26, 4 November 2011 (UTC)[reply]

The answer is still the same. If you let iTunes manage your folders, which it does by default, it will read the metadata on the song files. If the song file has "C" for the artist, it will rename the folder to be "C". If it has "L" as the artist, it will rename the folder to be "L". So, this is all based on *IF* you let iTunes manage your folders. It appears that you should be looking into how to stop iTunes from managing your folders (which is in the preferences inside the iTunes program). -- kainaw 17:31, 4 November 2011 (UTC)[reply]
It is actually a useful feature. In the past I managed the folders myself, but it is really annoying to do that, as you need to change file and id3tag in iTunes. For example, if you rename the title of the song in iTunes, it won't update the file if I remove the tick at preferences. Can you explain why it does it anyway? I hadn't such problems in the past; maybe it is the latest update... I remember how Windows was updated, and you don't know how much I spent to fix the error...--♫GoP♫TCN 17:46, 4 November 2011 (UTC)[reply]
In iTunes, check the song's info - all songs in the folder. It appears that one of them has an invalid name. Edit the name and save. -- kainaw 18:41, 4 November 2011 (UTC)[reply]
I checked every songs by ZZ Top, but they were all correct. Anyway, thanks for your help.--♫GoP♫TCN 11:20, 5 November 2011 (UTC)[reply]

GUI for CentOS Server[edit]

  Hi.

  I'm trying to set up a web server. I installed CentOS Server using the graphical installer on a computer, but after the installation finished and the system was rebooted, only the command-line interface is available. Is there a way to use CentOS Server via a GUI, or if there is no built-in GUI, is there any third-party GUI that is compatble with CentOS Server? (Once I get a GUI on the server, I'll proceed to install Apache Derby and MySQL.) Thanks, Vickreman.Chettiar 21:40, 4 November 2011 (UTC)[reply]

I'd expect there to be a GUI already, unless you deselected it during installation. Try logging in as root and issue "init 5" to switch to to run level 5 (which is GUI on most Linuxes). If that does not work, the easiest is probably to reinstall the system and when asked for the software selection be sure to include X11 (and GNOME or KDE). --Stephan Schulz (talk) 22:27, 4 November 2011 (UTC)[reply]
On some systems, you can use the command startx or xinit to initialize the X server and the graphic interface. Our article is xinit. You may have to check the specific documentation for your installed version of CentOS - try typing man startx on the command-line. Nimur (talk) 22:58, 4 November 2011 (UTC)[reply]

Android's kernel[edit]

Hi, I would like to ask you few question about the android opreation system. 1)Is there a diffrence between the kernels of each company which sells its device with the system? 2)What the program Odin does, and how it does it without making the Android callapse? I mean,if it switches the kernel, what respones to it? Exx8 (talk) —Preceding undated comment added 22:24, 4 November 2011 (UTC).[reply]

Officially, Android uses the Linux kernel. Unofficially, each telephone manufacturer has their own version of the kernel, including proprietary hardware drivers for their device. If you peruse the Android Developer website, you will find very little information about the actual details of how Android works. If you are interested in Android internals, you should take a look at Dalvik, which is the common runtime environment across all devices. If you want to play at the kernel level on Android, you must have a specific type of telephone, the "Crespo" and you must use this specific version of Android source-code, which is not the same as the source-code used to build commercially-released binary distributions. You can patch your kernel by applying binary-distributed packages for certain development hardware, resulting in an operating system that is quite similar to, say, the Ginger-Bread released version.
The program "odin" is a utility that updates some of the firmware for certain telephones: that is, it modifies parts of the code that were released via such binary distributions, and not as part of the open Android source-code project. I don't know who makes odin, nor whether it is reliable, trustworthy, or safe to use. It is not part of any official, public Android development toolkit. Nimur (talk) 23:08, 4 November 2011 (UTC)[reply]

I'm a little bit cofused. What download mode does? what is the diffrence between firmware to the opreation system? Did Samsung release its own version to the 2.3.6 firmware(or there is one global)? Exx8 (talk)

It can be quite confusing! In fact, there is a shortage of good documentation - I was quite disappointed, as I had been under the impression that Android was a totally open, free-software system. In reality, only certain parts of Android are open and free software. Most devices are actually proprietary platforms.
Conceptually, what you need to know is this: most modern computers, especially computers shaped like telephones, are NUMA architecture multiprocessors. This often means that the platform has many different pieces of code running on many independent processors. In the case of Android, you have, for example, a firmware piece to run a small computer that operates the screen. That software is not part of "Android." You can think of it as a "driver," but it is actually more complicated: it is a totally separate computer packaged inside the same box as your Android computer. The code to make that screen and its controlling computer work is called "firmware." It is actually completely independent from the Android layer, and communicates via a variety of protocols... pseudo- device files, in some cases. It may, or may not, share addressable memory with Android kernel, depending on the hardware.
Modern computer processors are complicated so it's even more mind-boggling than mere device-abstraction. For instance, you may have a hardware-accelerated TCP/IP stack - or memory controller - in other words, your device may require firmware in order to properly run certain operations that most programmers think of as "pure software operations" - things like malloc or fopen. Android is a little bit fuzzy about how much it actually does - which is why their SDK always starts with the assumption that you, as a programmer, stay at the DALVIK layer or above (So when you nead heap memory, you don't care if it comes from kernel, or from a hardware memory manager, or from the Dalvik runtime - you just have "heap memory" addressable by your program). If you try to compile the Android kernel, you may find, for example, that you do not have a functioning C standard library - because your standard library is hardware-accelerated, and that code is not part of Android's kernel.
If you are a classically trained systems programmer, you quickly recognize this scenario as "just another proprietary kernel implementation," (and you can probably learn to live with the constraints); but if this is your first time dealing with kernel code, it can be quite complicated to juggle the complexity of system design and the added complexity of opaque functionality from firmware you don't have access to. Nimur (talk) 17:21, 5 November 2011 (UTC)[reply]
Very little of what you wrote above makes sense to me. How exactly is Android different from Linux on desktop machines? What is a "hardware accelerated" C standard library? Do you think that malloc() and fopen() couldn't be implemented in the Linux/Android kernel? -- BenRG (talk) 20:00, 5 November 2011 (UTC)[reply]
Sorry that my explanation was unclear. Android's kernel is different from Linux's kernel, in that the source distribution for Android does not include all the files needed to build Android for most platforms. This is because many parts of the Android kernel are not free software; they are distributed as binary packages (firmware - without sourcecode). The conventional explanation is that such binaries interface directly with the various devices' hardware. In general, the standard library is separate from the kernel; but key functionality, like memory management, must be provided by a kernel. Android, as you obtain it from source.android.com, does not contain everything necessary to support (e.g.) the gcc binutils and the GNU standard C library, because critical features are not implemented by Android's kernel (such features require device-specific firmware). This is why you rarely see programmers distributing C code intended to run on Android devices: it is unlikely that two different Android devices can both run a program compiled from the same C code. You can read some more about this issue in our article.
Without getting too convoluted, I will add that the Linux kernel does not export the C standard library either; but it does offer a consistent set of sysctl and ioctl on all platforms. On Android devices, the equivalent to a standard Linux ioctl" will often require a call into a non-free, non-public, proprietary firmware API. Nimur (talk) 22:46, 6 November 2011 (UTC)[reply]