Wikipedia:Reference desk/Archives/Computing/2014 October 7
Computing desk | ||
---|---|---|
< October 6 | << Sep | October | Nov >> | October 8 > |
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. |
October 7
[edit]Who can identify this application?
[edit]Could anyone tell me what application does this screenshot seem to be captured from? I have to find out the JDK version information in a bunch of computers with Windows or RHEL Linux installed. Need some clue to figure it out. - Justin545 (talk) 02:04, 7 October 2014 (UTC)
- The "back to top" part suggests it's a webpage, rather than an application. Something like this. InedibleHulk (talk) 02:32, 7 October 2014 (UTC)
- Now I realize why the guy sent me this image, thank you! - Justin545 (talk) 03:25, 7 October 2014 (UTC)
Windows 8 Encryption VBS Error
[edit]I'm trying to make an encryption program with VBS and notepad, but all the video tutorials on how to do so is for windows 7, and I have windows 8. The code I used was:
set x = WScript/CreateObject ("WScript.Shell")
mySecret = inputbox("enter text to be encoded")
mySecret = StrReverse(mySecret)
x.Run "%windir%\notepad"
wscript.sleep 1000
x.sendkeys encode(mySecret)
function encode(s)
For i = 1 To Len(s)
newtxt = Mid(s, i, 1)
newtxt = Chr(Asc(newtxt)+5)
coded = coded & newtxt
Next
encode = coded
End Function
When running the vbs script, it just pulls up an error message saying "object doesnt support this property or method" in the Error section in Line 1, Char 1. Can anyone more experienced with vbscripting than me show me the code for this to work in Windows 8? 199.102.55.225 (talk) 12:52, 7 October 2014 (UTC)ThaChompyLeader
- I've formatted your code so it's easier for others to read. -- Finlay McWalterᚠTalk 13:44, 7 October 2014 (UTC)
- My first thought (since you're accessing the shell) is that you have a permissions conflict, i.e. Windows 8 is stricter about who can use shell commands than Windows 7. OldTimeNESter (talk) 20:28, 7 October 2014 (UTC)
If I granted permission to use shell commands for my regular account, would that fix the problem? 199.102.55.225 (talk) 21:54, 7 October 2014 (UTC)ThaChompyLeader
- Change the first line from to
set x = WScript/CreateObject ("WScript.Shell")
79.237.86.85 (talk) 03:45, 8 October 2014 (UTC)set x = WScript.CreateObject ("WScript.Shell")
Thanks! It's working now! 199.102.55.225 (talk) 12:37, 8 October 2014 (UTC)ThaChompyLeader
sound before start up
[edit]Hi there,
Each time I open my computer, I hear a sound.
It is before the Windows 7 loading bar.
I got Samsung Intel computer.
I want to disable it, how can I?
In other computers you hear instead a beep.
Exx8 (talk) 14:33, 7 October 2014 (UTC)
- Start > Control Panel > Hardware and Sound > Sound : Change system sounds
- Scroll to 'Windows logon' and deselect. —71.20.250.51 (talk) 17:01, 7 October 2014 (UTC)
- It is not that, I checked.
- I believe it is related to the BIOS.Exx8 (talk) 18:01, 7 October 2014 (UTC)
- I'm not familiar with Samsung Intel, but I wouldn't expect a sound (other than "beep") from BIOS unless it was an event notification. You could check the BIOS setup (usually: 'F12' on startup -need to be quick on the button). If it is an event notification, you could check the log in 'Event viewer' (Control Panel > System and Security > Admin tools : 'View event logs'). —71.20.250.51 (talk) 18:55, 7 October 2014 (UTC) —— However, (on second thought) the BIOS might not be capable of logging events; you might need to watch startup carefully to see error message -probably flashes by rather quickly. — Note: in addition to selecting (none) for 'Windows logon', you need to uncheck box for "Play Windows Startup sound". 71.20.250.51 (talk) 22:13, 7 October 2014 (UTC)
- It is not that, I checked.
Building a Raspberry Pi Door Sensor
[edit]I want to use a Raspberry Pi to detect the position of a door.
The door I am talking about is frequently blown open by the wind. So I want to build something to check out its current status and maybe calculate its opening speed.
- I'll attach a cable between the top of the door and the wall.
- One end of the cable is attached to the door.
- The other is attached to a spring on the wall.
- The cable is then kept close to the wall by a pulley.
- When the door is opened, the cable drives the pulley.
- When the door is closed, the spring pulls back the cable.
- I'll then attach a modified computer mouse and use its scroll wheel to detect the pulley's rotation.
- The computer mouse must have a very soft rubber scroll wheel that can be driven by the pulley by frictional force.
I plan to use a computer mouse because it's very inexpensive. There are probably some other electronic parts that does the same thing. However, a computer mouse is easy to get and very affordable. I don't need to solder anything to get the job done.
How do I write the Python program so the Raspberry Pi can access the mouse wheel event?
Do I need to use Tkinter? -- Toytoy (talk) 15:20, 7 October 2014 (UTC)
- You can use PyGame (which is a Python wrapper over Simple Directmedia Layer) to receive mouse wheel events. But note that a mouse wheel isn't an analog position sensor - it sends MOUSEBUTTONUP and MOUSEBUTTONDOWN events - they're much like arrow keys on the keyboard. If you want a genuine analog input, the easiest way is again PyGame, but using a joystick, which sends a JOYAXISMOTION event when a joystick is moved. You'd probably bypass the potentiometer in a cheap USB controller pad and instead wire that to an external potentiometer rigged up to your pulley system. You'd presumably need some gearing to make sure the range of the door mapped down to a workable range for the throw of the potentiometer you use. -- Finlay McWalterᚠTalk 15:59, 7 October 2014 (UTC)
- Python is a great language for many tasks, but it is not well-known for its great mouse APIs! You can do many things:
- Choose another programming environment. A couple lines of C code - or even Java code - will get you mouse events, while a whole lot of messier python code would be required.
- Use a Python library - like Python's Tk binding (it seems you've already found this), or Finlay's suggestion, PyGame. But you'll have to disentangle your program from the Raspberry Pi's Linux windowing system, who might only send you mouse events when you're running "full screen" or your program has GUI focus! pygame.mouse.get_focused tells you about this problem, but doesn't give you a lot of solution options! (Pretty much, "run full screen" - but what if your computer is headless, how will that behave?)
- Use python to call an external command-line tool or native library to interact with mouse events.
- So, before you go farther, how would you like to proceed?
- Nimur (talk) 16:04, 7 October 2014 (UTC)
- The HUGE problem with this is that the mouse wheel isn't a position sensor - it's a motion sensor (and a pretty crude one at that). It can tell you when the door is moving, and very roughly, how fast - but it can't tell you whether the door is open, closed, half-open, etc. I'd also argue that a Raspberry Pi is a poor choice for this kind of application. I'd use an Arduino...they are cheaper - but there are a VAST number of hardware options for this kind of thing.
- I'd actually be quite surprised if your contraption with wire and spring and pulley would actually work. It just seems too mechanically complex.
- I would do this with a rotary potentiometer, attached to the wall with the shaft vertically over the top of the door hinge. You can then fix an arm to the potentiometer and fix it to the front face of the door. Think of the potentiometer like the volume control on an old-fashioned radio. When the door opens, it turns the knob in one direction and when you close it, it turns the other way.
- Now, as the door is opened and closed, the resistance of the potentiometer will tell you its absolute position...and by sampling the position at intervals, you can calculate the speed. It's much less intrusive than cables and springs and things - and in these kinds of situation, simpler is way, *WAY* better! With a decent potentiometer you should be able to measure the angle of the door accurate to a few degrees. The trouble is that (as I said) the Raspberry Pi is a poor choice for this kind of thing...particularly, it doesn't have an analog input port. If you use an Arduino, you can connect the potentiometer directly to the computer with no other hardware. The Arduino can send signals via USB to a nearby PC - or to a Raspberry Pi if you really need your door to run Linux!
- With an Arduino, you need a 10k ohm potentiometer and a 1k ohm fixed resistor - you can twist the wires together with electrical tape if you don't want to solder. The Arduino will return a number between about 90 and 1020 from it's analog port depending on the angle of the door - but it's not a linear result - so you'll need to do a bit of math to get the angle of the door in degrees. However, you should be able to read the door position to within a few degrees without problems.
- I use a little board called the "ProMicro" - which works like the Arduino (same software, etc) but can act like a USB peripheral - so your PC (or Raspberry Pi) will think it's a keyboard or a mouse or something...I bought one a while back for $9 - but I forget where from. http://www.karlssonrobotics.com/cart/pro-micro-5v16mhz/ has them for $20.
- Come to think of it - you might want to consider the BeagleBone computer. It's comparable to the Raspberry Pi - it runs Linux, etc, etc - but it has an analog port like the Arduino - so you could read the potentiometer directly and post the door position on the ethernet. On the BeagleBone, you don't even need software to read the door position, you can just do something like "cat /sys/devices/platform/tsc/ain1" in a shell script! Using Python with the "bottle" web server, you could easily give the door it's own web page! SteveBaker (talk) 16:43, 7 October 2014 (UTC)
- If you're going to all the trouble of having a cable and pulley, why not simply put a weight on the cable so that the door automatically closes -- that way you don't need to measure anything. —71.20.250.51 (talk) 17:37, 7 October 2014 (UTC)
- Ha Ha Ha! There won't be Rube Goldberg machines anymore if people solve their problems logically. There's a Raspberry Pi seller with lots of motors and boards and amplifiers and relays and else just one mile away from my home. That's why I decide to use this U.K.-made itsy bitsy computer. If this project fails, at least I still have a very low-end e-mail computer.
- I opened a computer mouse and noticed there's a wheel with slots and a set of IR emitter and receiver. At first I thought the mouse wheel can send number of slots to the computer, then I can use it to determine the number of rotations .... -- Toytoy (talk) 02:40, 8 October 2014 (UTC)
- Yes, so if there are 10 slots in the wheel, it can count ten off/on's pulses and know that the wheel rotated 360 degrees over the time it counted them...so it knows the speed that the wheel is rotating. If it starts off with the door known to be closed, then counting the number of pulses will theoretically tell it where the wheel is now - five pulses means 180 degrees.
- BUT, to be reliable, it would have to count those pulses PERFECTLY, never missing a single one of them. If it misses one (or counts an extra one somehow), then the position it thinks the wheel is at is 36 degrees off from the true position. If it misses another one, it'll be 72 degrees off...and so on. When you use the wheel in a mouse, the computer NEVER cares where the wheel actually is - only how much you moved it by. So if you're scrolling through a document with it, and it misses a step, it doesn't matter because the human-in-the-loop will just turn it another click to get to where (s)he wants to be in the document.
- So the mouse doesn't need to count those clicks with 100% perfect accuracy - and because it's made on the cheap - it doesn't. The device is actually more complicated than you think - it uses TWO optical sensors, slightly offset, in order to figure out which direction the wheel is turning - and at the point where the wheel changes direction, it will typically either lose or gain a step because it can't tell whether you abruptly changed speed, or changed direction. Also, if you rotate the wheel too fast, it'll miss a bunch of steps or get confused as to which direction the wheel is moving. When you use it for scrolling through a document, this doesn't matter a damn - so you never know that the mouse isn't reporting the wheel position perfectly. (And this assumes that the mouse wheel never, ever slips even the slightest bit against the pulley...and I'm sure it will!)
- In your door application, you'd spend a bunch of time, think you got it working, it would seem to be measuring the door position OK, then after 20 minutes of actual use, it would be wrong by (say) 10 degrees - then after an hour, 30 degrees - and after a day, it would be telling you that the door is closed, when it's actually wide open. Also, if you reset the machine on with the door already opened, it'll have no idea, and everything will be totally screwed up too - which isn't very user-friendly.
- So what you need (*NEED*) is an absolute measurement of position, not a device that measures relative position...which is what the mouse wheel does. Hence my suggestion to use a potentiometer. The potentiometer is not 100% accurate - it'll only know the position accurate to a few degrees - but because it's directly measuring the angle, and not inferring it from the speed - the error won't build up over time...and that's what you need here. There are other kinds of Rotary encoder that can also do the job - but a 10k ohm potentiometer is 10 times cheaper than any of them.
- Choosing a Raspberry Pi, just because there is a place that sells them nearby is a terrible way to do engineering. You have the Internet at your fingertips - and a BeagleBone or an Arduino is just a mouse click away...and they are both much better at doing this job than the Raspberry Pi because they have analog sensors. Sure, you could make something work with the Raspberry Pi, but you'd need to either wire up an external A-to-D converter, or build/buy and interface a digital Rotary encoder. Since you don't want to do any soldering - and I'm guessing you're doing this on a budget - you're not going to do well with either of those tasks. So you need to buy a computer that can do the job directly...and the Raspberry Pi ain't it.
- Incidentally, if you have a PC nearby, you can probably use the audio output and microphone input to measure the voltage across a potentiometer...but that requires some electrical engineering skills that you probably don't have if you're asking this question!
- But I'm telling you - with 100% certainty - and as someone who has spent a lifetime making gadgets of various kinds with computers and sensors (including using hacked-up mice) - what you're doing doesn't stand a snowball's chance in hell of measuring the position of that door - BECAUSE the mouse wheel is a relative position sensor, and you need absolute position.