Wikipedia:Reference desk/Archives/Computing/2015 June 27
Computing desk | ||
---|---|---|
< June 26 | << May | June | Jul >> | June 28 > |
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. |
June 27
[edit]fetching data from database using ajax
[edit]i have a php page in which i have written one mysql query for fetching result and displaying on the page, there are various buttons on the page on click on each button i want to make a ajax request and pass the value of variable to mysql query and base on that variable i want to fetch result from database, without reloading the page.09:23, 27 June 2015 (UTC)106.51.131.180 (talk)
- Typically would have an additional url served by your php (called something like
http://example.com/myapp/mydata
). That runs the SQL query, but instead of emitting HTML with the result, it encodes the result in a readily parsible format like JSON or XML. JavaScript on your page requests that url (with XMLHttpRequest, which despite its name can get JSON or text or whatever too), parses the data and generates the corresponding DOM elements. Depending on the structure of your site, you might keep the same base url for the html and json data, and have the client communicate which you want using options in the query string - so http://example.com/myapp gets yields html, but http://example.com/myapp?format=json yields json data instead. -- Finlay McWalterᚠTalk 12:57, 27 June 2015 (UTC)
Can a program generate a grammar from a series of texts?
[edit]Can a program generate a grammar from a series of texts? — Preceding unsigned comment added by Scicurious (talk • contribs) 15:53, 27 June 2015 (UTC)
- Do you mean text in a natural language. Ruslik_Zero 17:36, 27 June 2015 (UTC)
- Yes, an example of such a program for a natural language would be an interesting answer. However, I wonder whether a program can generate a grammar for any formal language, if it gets enough samples. --Scicurious (talk) 18:24, 27 June 2015 (UTC)
- Grammar induction is the article. -- BenRG (talk) 19:35, 27 June 2015 (UTC)
- Anything that a human can do can in principle be done by a sufficiently sophisticated program. So as a question of principle, the answer is yes. At a practical level, the answer is that it depends on the complexity of the grammar and the nature of the sample. Looie496 (talk) 11:46, 28 June 2015 (UTC)
- In computer science a Formal grammar is a definition that allows recognition of a language. Grammars deduced from examples have the problems of false positives and false negatives. You can generate a grammar for your sample that has no false positives when given an example not in the sample you based the grammar, but it will accept no sentences that aren't in the sample, which is kind of useless. You could also make a grammar that will accept anything, having no false negatives by rejecting strings you would want, but since it accepts anything it is also pretty useless. If you try a grammar somewhere in between it will likely have BOTH false positives and negatives as it rejects some things you'd want to include and accepts some things you don't want. Unless you have a sample containing every valid string in the language you'd be unable to make a perfect grammar. In practice, you might be able to get close to the right grammar, but you wouldn't be able to prove it was right without either a complete list of correct strings in the language or a correct grammar. (So, can't say it wouldn't be useful in practice, but no guarantees.) RJFJR (talk) 14:33, 28 June 2015 (UTC)
Why HD audio have higher sample rate?
[edit]My teacher said that using a sample rate of 44.1Khz for audio recording is enough as 44.1Khz > 2*20Khz. 20Khz is the high the frequency that we can hear, so according to Nyquist–Shannon sampling theorem nothing is lost. So why HD audio use a sample rate up to 2.8224 MHz? — Preceding unsigned comment added by Hunsu (talk • contribs) 17:50, 27 June 2015 (UTC)
- Intel High Definition Audio, which is what a lot of people call "HD Audio", goes up to 192 kHz; Direct Stream Digital samples at 2.8224 MHz, but that's only 1 bit per sample, whereas CD-DA is 16 bits per sample (and IHDA can go to 32 bit). This article goes into some length discussing the diminishing returns of higher data rates beyond CD-DA's. -- Finlay McWalterᚠTalk 18:27, 27 June 2015 (UTC)
- That article is quite good.
- 2 × 20 kHz is enough only if the waveform is infinitely long and you interpolate with a sinc filter, which would take forever (literally). With the more practical filtering of actual audio hardware, you need a somewhat higher sampling rate (like 44.1 kHz). -- BenRG (talk) 20:03, 27 June 2015 (UTC)
- Audio fanatics will very often claim to be able to hear frequencies up above the 20kHz range and use this as a reason to reject modern digital music. The problem is that these people are notoriously bad at doing double-blind testing of their claimed abilities. However, since those are generally the people doing the reviewing of audio equipment, it's possible that manufacturers and standards organizations would push the specification up above the true limits of human hearing just to get better reviews. Higher frequency audio bandwidths are childishly easy to reproduce these days - so pushing the specification even higher above the human range is a very low cost thing to do.
- As I've said here several times in the past, the world of audio enthusiasts has become a very sad and unscientific place. Note the $10,000 USB and Ethernet cables sold to exceedingly stupid/gullible people on grounds that they'd improve digital sound quality - and reviewers of said cables enthusiastically proclaiming better "presence" or "ambiance" (whatever the heck that is!) in the resulting sounds...even though it is quite clearly impossible for that to be the case when these cables are transferring purely digital data. SteveBaker (talk) 16:09, 28 June 2015 (UTC)
- But the 1's and 0's are so much fatter and deeper when using platinum plated gold connector cables with diamond inlay! 209.149.113.185 (talk) 17:49, 29 June 2015 (UTC)
Printing text
[edit]Dear Sirs..
When typing a letter ( black) are you using any ink from the color cartridge?
In other words ,can I just reload all black?. Hewlett PackardPSC 1100/1200 Thankyou ```` 2602:306:B861:2A0:AD53:9520:D678:4F32 (talk) 20:19, 27 June 2015 (UTC)
- See the section of this document called "Some color ink may be used when printing black text-or-graphics". It says that IPH (integrated print head) printers can print without color ink, but IIC (individual ink cartridge) printers can't. I don't know which category the PSC 1100/1200 are in. -- BenRG (talk) 22:06, 27 June 2015 (UTC)
- I have a PSC 1200, and it has a color cartridge and a black ink cartridge, if that helps. StuRat (talk) 22:08, 29 June 2015 (UTC)
- Note, ink printers need to clean the print heads. When moving the print heads off from parking position, the ink beginns to dry. This requires to flush the ink heads by time. --Hans Haase (有问题吗) 20:17, 30 June 2015 (UTC)