Wikipedia:Reference desk/Archives/Computing/2008 November 28

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


November 28[edit]

SQL query from win32 command line[edit]

Does anyone know of a free self contained program that can run on winxp, which can be controlled from the command line, which allows of sending of basic queries to an SQL server and outputs the results of the query?--Dacium (talk) 02:16, 28 November 2008 (UTC)[reply]

MySQL and PostgreSQL both have a command-line client. --Sean 12:37, 28 November 2008 (UTC)[reply]
Microsoft SQL Server Express includes sqlcmd, a command-line tool. You type sqlcmd inside cmd.exe and a shell is spawned.--Rjnt (talk) 13:04, 28 November 2008 (UTC)[reply]

AND, OR Gates[edit]

How can I represent AND, and OR gates as decimal equations, can include if loops. Like these

NOT=MAX-1-Input1
XOR=(Input1+Input2)%MAX
Max equals a power of 2 like 2^8 for a byte

--Melab±1 02:39, 28 November 2008 (UTC)[reply]

If you can get each bit first it makes it easy:
bit8input1 = input1%(MAX/2)
bit7input1 = (intput1 - (bit8input1 * (MAX/2)) % (MAX/4)
bit6input1 = (input1 - (bit8input1 * (MAX/2) - (bit7input1 * (MAX/4)) % (MAX/8)
and so on and so on (use loops and more temp values to make this easy)

When you have bit for each input then its easy to do AND:
bit8Anded = (bit8input1 + bit8input2)/2

OR would be:
bit8Ored = bit8input1 * bit8input2

Then reconstruct again:
AndOutput = (bit8Anded * (MAX/2)) + (bit7Anded * (MAX/4) + ... etc. etc.

--Dacium (talk) 03:03, 28 November 2008 (UTC)[reply]

Without breaking it into bits. That's what I'm trying to overcome. If you can' t get an AND gate but you get it for a NAND gate tht's fine too.
$XOR=($A+$Z)%$MAX
XOR=(5+12)%16=1
$NOT=$MAX-1-$A
NOT=16-1-7=8
LIKE That

--Melab±1 04:12, 28 November 2008 (UTC)[reply]

What are you doing exactaly? Your XOR seems to be wrong, eg. 15 + 51 = 66, but XOR it should be 60.--Dacium (talk) 04:26, 28 November 2008 (UTC)[reply]
This:
function XOR (A, B, MAX){
if (A==B){
XOR=0
}
if (A!=B){
XOR=(A+B)%MAX
}
return XOR

Or something like that. --Melab±1 19:36, 28 November 2008 (UTC)[reply]

Interactive Website[edit]

I am competent in Visual Basic, Delphi, C and C++ but have only basic internet/website skills. I want to run a visual basic 6.0 program with special hardware, which will try to predict in advance which of two form buttons are about to be pressed by another person across the Atlantic, and show both him and myself the score and percentage (which my stand-alone program already does.) I am on a slow dial-up connection. What would be the easiest way to do this, for example using e-mail and two separate vb6 programs each end to communicate, or some sort of web client- server? And what language, ie vbscript ect, would be best? I would prefer to use vb6 from my end as I do not wish to spend time rewriting my program. Keep it simple. p.s. Also Tesconet's email seems to mess up SendEmail programs-how do you set outlook express as the default? —Preceding unsigned comment added by Trevor Loughlin (talkcontribs) 03:00, 28 November 2008 (UTC)Trevor Loughlin (talk) 03:03, 28 November 2008 (UTC)[reply]

If it were me I'd write a small script in another language (like PHP) and host it on a server, and have my VB6 programs communicate with that via HTTP GET requests. It would be a lot easier than futzing around with e-mail (which is really added about three extra layers to it) and it'll let you do almost everything in VB6 (the script just has to take commands, record states, and give responses when queried). --98.217.8.46 (talk) 06:50, 28 November 2008 (UTC)[reply]
If you wanted to build a web interface, you'd actually use ASP (not ASP.NET). It's pretty easy to use -- a lot easier than learning an entirely new language like PHP. It uses VBScript code embedded in HTML to communicate with the server (i.e., your computer?). You can also use C++ via ASP.NET. In that case, you'd have a standalone file containing the C++ code, referenced from the HTML page. You can also send e-mail using Visual Basic, and you can create an app to connect to your friend's computer using C++ or Visual Basic. All of the methods above would probably be hard to code, though.--Rjnt (talk) 08:31, 28 November 2008 (UTC)[reply]
I agree that ASP is potentially easier for someone with VBscript knowledge to learn but it's not all that smooth a ride, and it requires having a server that can host ASP. Personally I think learning just enough PHP for the job would not be that hard—look into how PHP handles form variables and then learn how to make VB send form variables. If you know C and C++ you should find PHP a relatively simple thing, easier than trying to put a skin on e-mail (which requires all sorts of mucking around) or establishing direct connections with a dial-up. --98.217.8.46 (talk) 01:41, 29 November 2008 (UTC)[reply]

TV Question[edit]

I'm sitting here looking at TVs and I'm a little confused. I've been looking at this Samsung LCD HDTV monitor model T200HD (http://www.samsung.com/us/consumer/detail/features.do?group=computersperipherals&type=monitors&subtype=lcd&model_cd=LS20TDNSUV/ZA Hope that link works) and I don't know if I can watch over the air TV with it unless I have some sort of other antenna or not. Any help would be really appreciated.

RedStateV (talk) 04:41, 28 November 2008 (UTC)[reply]

Depending on where you live, you might be able to get channels with just rabbit ears. However, there was no mention of any antenna included, so I'd assume you need to supply that yourself. The same rabbit ears from an old TV should work with the new (with the possible need for a TV balun). There were a few other things which concerned me:
1) The TV claims to have a digital tuner, but not an analog tuner. If that's really the case, that means you won't be able to get analog stations.
2) It claims to support 1080p resolution, which is 1920×1080, but then lists the resolution as only 1680×1050. Something's not right there.
Also, what they listed as "specs" was pathetic. I'd look for the same model at a better site to get better info on it. StuRat (talk) 06:28, 28 November 2008 (UTC)[reply]
This site seems to give better specs: [1]. As near as I can tell, it has a 1080p digital tuner, but then downconverts the 1920×1080 frames to 1680×1050. StuRat (talk) 06:38, 28 November 2008 (UTC)[reply]

Website Development[edit]

Dear Sir, I want know about Website Development .. If i want to be a Web developer what should i study and how should i do?? Actually i know about computer basic concepts and some basic programming languages like C++ and C#. But i need to know what to study for website precisely. Please answer to me . Yours truly, Thaw Thaw —Preceding unsigned comment added by 203.81.72.200 (talk) 04:59, 28 November 2008 (UTC)[reply]

What precisely are you wanting to develop? Language-wise you might want any of: XHTML, HTML, Javascript, CSS, PHP, Perl, Ruby, Java, ASP, ASP.NET, SQL, ActionScript, and... others. Plus, for just about anything you'll want at least basic relational database knowledge. 24.76.161.28 (talk) 06:25, 28 November 2008 (UTC)[reply]
An abbreviated start is HTML for markup, CSS to make things pretty, Javascript for dynamic pages, PHP for server-side scripting, SQL for database queries. These days I would wager most people who call themselves "web developers" know those at a bare minimum. It sounds like a lot but HTML is super simple, CSS is just a matter of learning a few basic things, and PHP and Javascript are very simple scripting languages, so it's not that bad. SQL is just for database queries and for most of them it is nothing much at all to worry about. Once you know a handful of these sorts of things, you can start to do very rich applications. It's not any one technology that makes it work, it's how they work in concert. --98.217.8.46 (talk) 06:58, 28 November 2008 (UTC)[reply]
Great suggestions. I would also take a look at http://www.w3schools.com/default.asp if I were you. You're going to have to start small at first. Make a dynamic web page, then make a page with a login, etc. and build it up as you go along. --Rajah (talk) 20:01, 28 November 2008 (UTC)[reply]

Is Yahoo down?[edit]

I haven't been able to access any of their sites in a day or two, but I also can't find anything online about it being down, so I'm worried it's my computer. Thanks, Bleeding Blue 11:30, 28 November 2008 (UTC)[reply]

It's you: http://downforeveryoneorjustme.com/ --Sean 12:39, 28 November 2008 (UTC)[reply]
Thanks, any idea what would cause this or how to fix it? All other sites are fine and my laptop is having the same problem (though they both use the same router). Bleeding Blue 13:01, 28 November 2008 (UTC)[reply]
Try pinging it. See if it is able to find the site's IP (looks like it should be 68.180.206.184 or 206.190.60.37), and if you're able to communicate with the site. How exactly you go about that depends on the OS, but it should be ping yahoo.com from a terminal or 'command prompt' window. If you get the wrong IP address, you might have an odd entry in your hosts file or in your DNS cache; if you get the right IP but can't ping it, then someone funky is happening, somewhere. In the latter case, try tracert yahoo.com or traceroute yahoo.com, see where the communication stops. -- Consumed Crustacean (talk) 14:53, 28 November 2008 (UTC)[reply]

grep a file with lines from another file[edit]

I have two text files. I would like to grep the first file by looking for the string that is on the first line of the second file. And then grep the first file by looking for the string on the 2nd line of the second file, etc. e.g. target file, target.txt, is:

A bunch of lines
Of everything
etc. etc.
blah blah

the 2nd file is:

the
of
something
green
apple
etc.

I'd like to $grep the target.txt, $grep of target.txt, etc. Does anyone know how to do that easily from the command line? Like a one liner or sh script? (I'm using bash on linux.) Thanks, --Rajah (talk) 18:02, 28 November 2008 (UTC)[reply]

I have three ideas for you, a for loop, brace expansion, pipe the second file to read in a loop, convert 2nd file to grep commands and execute it
for i in `cat file2`; do grep $i 1stfile; done
for i in `<file2`; do grep $i 1stfile; done
sed -e "s/^/grep /" -e "s/$/ file1/" file2|bash
while read i;do grep $i file1;done <file2

Graeme Bartlett (talk) 20:59, 28 November 2008 (UTC)[reply]

Awesome, that worked perfectly. Thanks so much! --Rajah (talk) 00:15, 29 November 2008 (UTC)[reply]
Graeme, just for my own edification, wouldn't the third option (sed) need some contortions for the case where file1 contained text of the form "-x" and "$x" (and ">>", etc. etc.)? Or would:
sed -e "s/^/grep '/" -e "s/$/' file1/" file2|bash
do the job easily enough? Thanks! Franamax (talk) 00:37, 29 November 2008 (UTC)[reply]
Most of my suggestions will have similar problems things that mean special things to the shell. with Your idea about including the single quote is a good one, but whatever we do there is probably an extra complication, such as what if the search text had a single quote in it? And by the way I could not get the brace expansion to work, command execution and brace expansion occurred in the wrong order. Graeme Bartlett (talk) 20:24, 29 November 2008 (UTC)[reply]
Yeah, now that I look at it, my way might just pass an invariant '/" -e "s/$/ to the shell. Not to mention the possibility of passing backquote-arr-emm-minus-arr-dot-dot-slash-star-backquote, which could produce "unexpected" results. Franamax (talk) 01:36, 30 November 2008 (UTC)[reply]

Scanning in UK[edit]

I would like to buy a scanner in UK, to scan numerous A4 printed pages, my main requirement being speed. Any recommendations please? Kittybrewster 19:29, 28 November 2008 (UTC)[reply]

It sounds like you need one with a stacking sheet feeder. You can get networked scanners with ethernet ports, or you can buy a box that connects a USB scanner to a network, This has the advantage that you can scan collections of documents and have them available as files to copy, in an asynchronous mode. When scanning I often find that the most time is spent operating the scanning software. Graeme Bartlett (talk) 20:28, 28 November 2008 (UTC)[reply]
Is this a one-time job or a long-term thing? In the US you can usually find photocopiers that have scanning hardware, so you put it on the auto feeder and zing, all the files have been e-mailed as one big TIF or PDF to your home address. Then you just chop them into individual files. But the actual photocopiers are very expensive, so it is easier to find a place that has one (like an office supply store) and just use theirs. My understanding is that the document feeders for home scanners often suffer from jamming, but maybe that has changed since I looked into it. The fastest option though is the photocopier one I mentioned—you can scan loose papers at the rate of one every couple seconds or so without paying it much if any attention. You can scan a whole book (turning the pages manually) in about an hour or so. --98.217.8.46 (talk) 17:52, 29 November 2008 (UTC)[reply]

Default font list for Ubuntu / Kubuntu Linux (+OpenOffice)[edit]

I'm looking for a list of the default fonts present in the basic installs of Ubuntu Linux and Kubuntu Linux (if different). I would also like to know if OpenOffice installs any additional fonts. I would imagine a simple list of fonts would be up on Ubuntulinux.org, but none found so far; Google and Ubuntuforums.org aren't leading me well either. / edg 20:21, 28 November 2008 (UTC)[reply]

There's this thread, but I guess you can only do that if you already have Ubuntu installed and not have added any extra fonts. Belisarius (talk) 12:45, 2 December 2008 (UTC)[reply]
Correct, and I was hoping to find this out without doing a new install. But thanks for answering. / edg 17:38, 3 December 2008 (UTC)[reply]

Speeding up and slowing down audio[edit]

Is there any simple freeware out there that can easily speed up and slow down songs? Windows Media Player can do this, but I'm looking for...erm, a different kind of speed change. What WMP does when slowing down a song is give a really digitized sound, as it extends the amount of time each "second" of audio is played. When speeding up, it's almost as if the tempo is increased. The higher the song is sped up, the more gaps there are in playback (at 8x, only every 3 or 4 seconds of audio were played back).

The kind of speed change I'm looking for seemingly changes the tone along with the speed, so that when sped up, the song sounds "chipmunked," and when slowed down, the song sounds (as I've heard it put once) like its being sung by "ogres in tuxedos." Any programs that can do that? Forgive my lack of knowledge.--The Ninth Bright Shiner 22:50, 28 November 2008 (UTC)[reply]

You might have difficulty finding that, as most software would probably carefully avoid the pitch change, since many people find that to be an unwanted side-effect of the speed change. Perhaps there's a "special effects" option to do what you want. Or, you may need to change the speed in one step and change the pitch in another. StuRat (talk) 23:57, 28 November 2008 (UTC)[reply]
You should use a real audio editor for things like this. Audacity is freeware and easy to use, generally speaking, and can easily do speed and pitch changes. You can even change the pitch without changing the speed, wahooo. --98.217.8.46 (talk) 00:56, 29 November 2008 (UTC)[reply]
I'd just like to second 98.217.8.46's recommendation of Audacity for this job. It is the best tool that I'm aware of for speeding up or slowing down audio, and I've tried several audio editors for doing this. I've used it a lot -- you enter the tempo (beats per minute) of your audio recording as it is before the transformation, and the tempo that you want to transform it to. I've used it mainly for transforming songs to 180 bpm (I listen to this when running), but also for slowing down music to figure out exactly what is being played (used it for the guitar intro of The Boxer). Excellent results when transforming music in the range of 155 to 210 to 180 bmp, no annoying artifacts. The pitch is preserved, no chipmunking. --NorwegianBlue talk 01:30, 29 November 2008 (UTC)[reply]
As I understand it, they actually want the chipmunking effect. StuRat (talk) 14:22, 29 November 2008 (UTC)[reply]
Ok, Audacity has three options:
  • Effect|Change pitch: Pitch is changed, leading to chipmunking or "ogres in tuxedos", without changing tempo.
  • Effect|Change tempo: Tempo is changed, pitch is preserved. This is the one I referred to.
  • Effect|Change speed: Both tempo and pitch are changed, i.e. when you speed a song up, it gets chipmunked at the same time.
--NorwegianBlue talk 17:19, 29 November 2008 (UTC)[reply]
Woo-hoo! Now if only I could work around my ever-incompatible file types...thanks, everyone!!!--The Ninth Bright Shiner 04:56, 30 November 2008 (UTC)[reply]
Oh, but wait...when changing tempo (like what NorwegianBlue was talking about), how do I figure out the song's original tempo?--The Ninth Bright Shiner 05:00, 30 November 2008 (UTC)[reply]
Neevermind! I found a wonderful program to do it. Thank you!--The Ninth Bright Shiner 03:08, 1 December 2008 (UTC)[reply]
Ok, have fun (are you working on a "Very Chipmunk Christmas" or a sequel to "Muskrat Love" ?). StuRat (talk) 03:16, 2 December 2008 (UTC)[reply]