Wikipedia:Reference desk/Archives/Computing/2009 August 28
Computing desk | ||
---|---|---|
< August 27 | << Jul | August | Sep >> | August 29 > |
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. |
August 28
editmySQL game dbase question from a few days ago expanded!
editOk, I'm back! Here's a more or less accurate breakdown of what my dbase will need to offer.
Category | Input Method | Search Method | Est, Choices |
---|---|---|---|
Games Required | Select all that apply | Select all that apply | 40 |
Scenario Code | manual entry, unique ID | hidden | 1500+ |
Date | Select all that apply | Select all that apply | 16 |
Nations | Select all that apply | Select all that apply | 20 |
Maps | Select all that apply | Select all that apply | 35 |
Battle Type | Choose 1 from a list | Choose 1 from a list | 10 |
Turns | manual entry | enter maximum desired | n/a |
Day/Night/Both | Choose 1 from a list | Choose 1 from a list | 3 |
VCs | Select all that apply | Select all that apply | 10 |
SSRs | yes/no | yes/no | 2 |
Hidden Units | yes/no | yes/no | 2 |
OBA | yes/no | yes/no | 2 |
Morale | Choose 1 from a list | Choose 1 from a list | 5 |
Infantry Units | Select all that apply | Select all that apply | 20+ |
AFV Units | Select all that apply | Select all that apply | 100+ |
Naval Units | Select all that apply | Select all that apply | 10+ |
Misc Units | Select all that apply | Select all that apply | 20 |
Fortifications | Select all that apply | Select all that apply | 5 |
Total Choices | 300+ |
Required Features:
Admin Access - omnipotent
Contributor Access - can use backend data submission page, can review flagged entries for errors & edit as necessary
Visitor Access - can search and sort dbase, no write priviledges
Simple searching. A scenario must have all checked options in order to return as a result. It may additional details, but may not have less than those marked.
Database must be expandable, as it chronicles an ongoing game series with frequent new releases.
Database search results must be sortable. (ex: fewest maps to most maps, fewest turns to most turns, etc.)
Database core unit will be a scenario entry with unique scenario ID.
Search results must return a list of matching scenarios, linking to each scenario's page.
Each scenario page must be flaggable for errors by visitors.
Flaggable pages must be findable by Contributors/Admins for examination.
I think that's the long and short of it.
I realize this is a big project, but it's part hobby/ part labor of love and the only thing stopping me from doing it so far has been lack of the requisite programming knowledge.
Any suggestions as to structure and composition, as well as general criticism, would be greatly appreciated.
218.25.32.210 (talk) 01:15, 28 August 2009 (UTC)
- Well, each of those "categories" gets to be its own table. Think about what fields they would have in them (like it was a spreadsheet in Excel—what are the column titles?). Again, the database part of it is pretty straightforward—setting up the tables with something like phpMyadmin will take almost no time at all. Setting up a PHP interface to edit and search it will take longer, but it's doable. Once you get it working for one table—pick a juicy one—the others are basically identical with small tweaks. --68.50.54.144 (talk) 01:51, 28 August 2009 (UTC)
- Thank you for the speedy reply, but I don't quite follow the "each is a table" part. That data would be as presented as listed above. For example, in the Games category it would just be a list of ~40 titles. That's it. So the table would be:
ID Code Full Name XXX Game1 XX2 Game2
- yes? 218.25.32.210 (talk) 02:05, 28 August 2009 (UTC)
- Hi, you need to research master-detail or parent-child relationships between tables. You can do your tables in two ways. The first way, if your master table contains a simple category id and multiple items per category, then you can store all in one master table, linking the category id to a child table with the names of the categories. The other way will be done if for example you want to store more fields of information per category. Then you have the scenario that 68 was talking about - each category would have its own table with a variable number of fields. These tables would link back to the master table by foreign key, with category id in each table. So if you delete a record in the child table, the master gets updated. That sort of thing. Good luck! Sandman30s (talk) 20:51, 29 August 2009 (UTC)
- OP again. Thank you Sandman - crystal clear and informative! 61.189.63.152 (talk) 12:40, 30 August 2009 (UTC)
- Hi, you need to research master-detail or parent-child relationships between tables. You can do your tables in two ways. The first way, if your master table contains a simple category id and multiple items per category, then you can store all in one master table, linking the category id to a child table with the names of the categories. The other way will be done if for example you want to store more fields of information per category. Then you have the scenario that 68 was talking about - each category would have its own table with a variable number of fields. These tables would link back to the master table by foreign key, with category id in each table. So if you delete a record in the child table, the master gets updated. That sort of thing. Good luck! Sandman30s (talk) 20:51, 29 August 2009 (UTC)
- yes? 218.25.32.210 (talk) 02:05, 28 August 2009 (UTC)
Horrible time with javax.sound.sampled
editHello! I'm working on a very, very basic "voice recognition" program with Java. The program will execute a block of code when I speak loudly into my laptop's microphone. I just need to use the javax.sound.sampled package to recognize a loud sound in the microphone (instead of quiet background noise) and run the code block. I found the Dataline.getLevel() method, which I think would do the job, but I've been reading through the API for the past 3 hours and still have no idea how to use it. Any help on continuously measuring the system microphone's volume much appreciated. Thank you!--el Aprel (facta-facienda) 02:33, 28 August 2009 (UTC)
- First of all, you might want be aware that Java's sampled sound system has crummy latency (I measured it worse than 600ms on Windows, and not much better on Linux, even with ALSA). As far as how to use the API, you might try Java Sound Demo, which has code that runs. Also, the official Java Sound tutorial is pretty helpful. I did find, however, that depending on your operating system and driver, some API functions behave "strangely". In any case, it is helpful to read through the "What is sampled sound" tutorial, because it explains the Java object model for the various components of your audio system. The representation of the system into Sound Providers, Mixers, Devices, and Channels, is either "convenient" or "over-complicated". If you've ever worked with a lower-level audio API, you are probably expecting a place to just read a buffer out and get the numeric values of the audio samples - to do that with Java Sound, you need to initialize a Mixer/request the mixer from the operating system; then get the default device; and then open a line from it. The Line object will be able to give you raw read-access to the numeric buffer, but it (and everything it depends on) needs to be properly initialized. Once you have access to the samples buffer, you can run a simple moving average on it to estimate the line level based on whatever smoothing parameters you like. (I believe that the getLineLevel() function actually requires hardware-support, and it has undetermined behavior if your audio card/driver doesn't implement this). Nimur (talk) 05:44, 28 August 2009 (UTC)
- Thanks again for the help, Nimur!--el Aprel (facta-facienda) 20:42, 28 August 2009 (UTC)
Berkeley sockets
editIs there a limit to the amount of data that can be received by a single recv() call? If not, how can buffer overflows be prevented? 70.26.154.147 (talk) 03:45, 28 August 2009 (UTC)
- Because you limited your question to Berkeley sockets, yes. There is a limit. The length is given in the form of an int. Depending on the architecture, I believe it is a normal int (not an unsigned int) - so it isn't extremely large. The maximum size possible is limited by the maximum value of an int. There is a catch though when you are talking about buffer overflows. It is not unusual for a programmer to be lazy. I make a buffer of, say, 128 bytes. I recv a message and the size is clearly 200 bytes. But, I don't have my code handle the overflow. I just send all 200 bytes into my 128 byte buffer. The prevention is clear. I, as the programmer, must handle overflow properly. I can ignore long messages. I can truncate them. I can parse them as two messages (splitting them). I can expand my buffer. There is a lot that I can do. Unfortunately, many programmers don't do anything. -- kainaw™ 04:00, 28 August 2009 (UTC),
- The OP may also be using the term "berkeley socket" to refer to internet sockets in general. Many higher-level sockets APIs will transparently buffer and protect against buffer-overflow. Java Sockets, which are similar in structure to Berkeley sockets, are merely an API; the actual buffering depends on your Java provider's SocketImpl class (which may choose to buffer or not). Nimur (talk) 05:53, 28 August 2009 (UTC)
- I am using a higher level API (which is why I forgot that the buffer length is passed to recv), but calls to recv still cause buffer overflows. Why could this happen and how could I detect it beforehand? 70.27.196.200 (talk) 16:22, 28 August 2009 (UTC)
- This question needs some help from Wikipedia:Reference desk/How to ask a software question. What language, what higher-level API? Can you post a code-fragment (preferably, the fewest number of lines that replicates your bug? It's impossible to diagnose your buffer overflow without a little more effort on your part to narrow down the root cause. As Kainaw has elaborated above, most often, the buffer-overflow is "programmer error" but we can't help you identify where in the code that error is unless you are a bit more descriptive about what you are doing. Nimur (talk) 18:03, 28 August 2009 (UTC)
- I am using a higher level API (which is why I forgot that the buffer length is passed to recv), but calls to recv still cause buffer overflows. Why could this happen and how could I detect it beforehand? 70.27.196.200 (talk) 16:22, 28 August 2009 (UTC)
- The OP may also be using the term "berkeley socket" to refer to internet sockets in general. Many higher-level sockets APIs will transparently buffer and protect against buffer-overflow. Java Sockets, which are similar in structure to Berkeley sockets, are merely an API; the actual buffering depends on your Java provider's SocketImpl class (which may choose to buffer or not). Nimur (talk) 05:53, 28 August 2009 (UTC)
What's Thunderbird up to?
editIt keeps quietly downloading data in chunks of just over 300k from various places around the world. So far I've had an IP address that resolves to somewhere in Sweden, and then kyoto-mz-dl.sinet.ad.jp, sagres.c3sl.ufpr.br, and my81-91-196-39.mynow.co.uk. What's up with that? Is this how it updates itself, perhaps? 213.122.66.56 (talk) 14:51, 28 August 2009 (UTC)
- That sounds very suspicious. Do you have any plugins, add-ons, or extensions in Thunderbird? How are you certain Thunderbird is responsible for those data transfers? Nimur (talk) 14:59, 28 August 2009 (UTC)
- My firewall, which has an activity page, told me so. And, actually, I just opened Thunderbird again and this time instead of downloading any data it installed an update. This always happens straight away, hence my suspicion that it sneakily collates the update data in little chunks beforehand during quiet moments. It's quite a sensible scheme (if that's what it's doing), but I wish it would display some kind of "downloading update data" message to stop me getting paranoid. No, I don't have any plug-ins, etc. 213.122.66.56 (talk) 15:18, 28 August 2009 (UTC)
- I think you mean anxious, you can't get paranoid if there is a rational cause.
- My firewall, which has an activity page, told me so. And, actually, I just opened Thunderbird again and this time instead of downloading any data it installed an update. This always happens straight away, hence my suspicion that it sneakily collates the update data in little chunks beforehand during quiet moments. It's quite a sensible scheme (if that's what it's doing), but I wish it would display some kind of "downloading update data" message to stop me getting paranoid. No, I don't have any plug-ins, etc. 213.122.66.56 (talk) 15:18, 28 August 2009 (UTC)
Strange new quirk in Lycos email
editFor composing an email Lycos now has these two pairs of arrows with the blue rectangle that moves from top to bottom. Where I am typing the arrows are at the top and bottom on the right but there is no blue rectangle because I haven't filled up the box. Why do they need two pairs of arrows with blue rectangles? That makes it so complicated to move up and down when I want to keep the individual components in order.
But with Lycos I send myself very long emails to print out. Lycos is almost ideal because when I can figure it out it gives me the most text on the page when it is printed out, not just when I send the final email but also when I send an email TO Lycos to put in the very long email that gets printed out. I don't like Yahoo or Gmail for sending or receiving because each leaves a lot of white space on the right. And that brings up another question: why can't I get the full screen when I simply copied and pasted? I didn't put in anything that would give me all that whitespace on the right.
To answer another question some might have: I didn't have my own computer until a year ago, but I didn't want to print out every newspaper article at once as I read it. At 10 cents a page, that gets expensive. But if I copy and paste the article and send it to myself in an email, I can combine it with others and print out all of them at once later.Vchimpanzee · talk · contributions · 17:15, 28 August 2009 (UTC)
- Are you asking about the scrollbar? There is probably a scrollbar provided for the page; and a second, separate scrollbar provided by the textarea (which is the editable-text HTML component). Some web applications use Javascript or some other technique to change the default scrollbar behavior; others allow your browser to decide how to split the screen up. See layout engine for some technical details on how this process works. Sometimes, hidden HTML formatting is preserved when you copy/paste; this can cause unintuitive formatting behavior in your "plain text" box (especially if a "semi-intelligent" layout script doesn't know how to handle that formatting). You might consider saving the text in a plain-text file first, and email it as an attachment. Nimur (talk) 18:08, 28 August 2009 (UTC)
- Yeah, there are two scrollbars just in the email. So if I see those I don't want to use that, because some very strange things happen when all I want is the plain text. I don't even know where the thing came from, because I thought I was creating a plain text email.
- When I have a place to save my text, I try to do it with plain text. I don't even think Hotmail has plain text emails any more, but I send from Hotmail to Lycos after formatting in the Excite box. I like Excite's pop-up plain text boxes. AOL doesn't have them, but they do have pop-up, which is convenient. The advantage to pop-up boxes, aside from the fact that I'm on Firefox at the library where I use those and Firefox doesn't tend to let you use rectangles at the bottom of the screen, is that you can't hit a back button and lose your work.Vchimpanzee · talk · contributions · 18:20, 28 August 2009 (UTC)
Monitor magic
editSomething truly mind-boggling happened to my laptop's monitor. About a week ago, when I turned the computer on in the morning, the display was all buggy. The monitor displayed about 70% to 80% of the total horizontal area, and about 85% to 90% of the vertical area. The display shrunk to fit these new dimensions. Also, there was a thin bar on the right side of the screen, past the border of the normal working part of the screen, that re-displayed part of the working screen. Ergo, if the cursor was within a certain part of the right side of the screen, it could be seen on both the working part of the display and within that thin bar. On the lower border of the screen, anything that touched that border was...repeated along the bottom. So the Windows Vista start button left a stream of button-bottoms, and...well, to say the least, things weren't working right.
However, when I restarted the computer today, it reactivated with a fully functional screen, albeit at a lower resolution. Before I had even completely signed in, it had switched to the proper resolution.
Now, what could have happened over this week? Why would the screen suddenly shrink, only to later regain what it lost? Oh, and I'm pretty sure this is a monitor problem rather than some sort of graphics card / video card problem; I took my computer to Staples look into replacement costs, and we hooked up a separate monitor to it, on which everything displayed fine.
Any ideas?--The Ninth Bright Shiner 22:18, 28 August 2009 (UTC)
- I've seen this in improperly configured video drivers. The RAMDAC is being filled at a resolution which does not match the vsync and hsync clock frequencies (usually due to a video driver error). That means you get a miniature screen, and memory address aliases the screen data to appear somewhere else on the monitor. The result is a beautifully catastrophic example (one of the few!) of a broken digital system that is "half-functional" (usually it's all or nothing with digital hardware!) This glitch often happens when the system is woken from hibernate (if it went to sleep at a non-standard resolution); or if you are experience graphics controller hardware or driver problems. It's almost impossible to be sure what is causing the trouble in your particular system though. Nimur (talk) 22:49, 28 August 2009 (UTC)
- Well, upon next start-up, the problem returned. And just when I had gotten used to a relatively wide screen. Sigh...so there's basically no way for me to figure out what's wrong? Not even some sort of hardware haxor could figure this out? This just came out of the blue after three years of perfect functioning. :-( --The Ninth Bright Shiner 17:44, 29 August 2009 (UTC)
Commons?
editWhy does http://www.wikimediacommons.org lead to the main page? Intelligentsium 23:26, 28 August 2009 (UTC)
- You should probably ask dns-admin at wikimedia.org that question. --Tagishsimon (talk) 23:32, 28 August 2009 (UTC)
- http://www.wikimedia.org produces an interproject dab. Intelligentsium 01:24, 29 August 2009 (UTC)
- That is a little weird, seems like a mistake. I would definitely email dns-admin. — neuro(talk) 01:41, 29 August 2009 (UTC)
- http://www.wikimedia.org produces an interproject dab. Intelligentsium 01:24, 29 August 2009 (UTC)
- You might also try clearing your cache, or trying a different browser on the same computer to verify the problem is on wikimedia's end. Indeterminate (talk) 04:32, 29 August 2009 (UTC)
- I get the same results, and I've never seen either of those pages before. Nyttend (talk) 19:49, 29 August 2009 (UTC)
- I was able to reproduce the problem as well, so I reported this issue as Bug 20445. Titoxd(?!? - cool stuff) 19:08, 30 August 2009 (UTC)
- You might also try clearing your cache, or trying a different browser on the same computer to verify the problem is on wikimedia's end. Indeterminate (talk) 04:32, 29 August 2009 (UTC)