Wikipedia:Reference desk/Archives/Computing/2009 May 13

From Wikipedia, the free encyclopedia
Computing desk
< May 12 << Apr | May | Jun >> May 14 >
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.


May 13[edit]

TCP sockets, do they have two socket addresses...?[edit]

From our article, Internet socket:

"As seen in the discussion below, in the TCP case, each unique socket pair 4-tuple is assigned a socket number, while in the UDP case, each unique local socket address is assigned a socket number."

May someone, please, provide a reference for that statement? --Taraborn (talk) 00:29, 13 May 2009 (UTC)[reply]

I don't have a reference, but I can explain it (which might help to assuage doubt or find a reference): it refers (at least) to a server's sockets, which will all share the local address and port but have different remote addresses and/or ports. --Tardis (talk) 14:56, 13 May 2009 (UTC)[reply]
Thanks. I understand what it says, and it seems reasonable to me, but I wanted to be completely sure that it is true since I've been unable to find a different source that states the same (that TCP sockets need 2 socket addresses unlike "normal" sockets (like UDP's) that only have one). --Taraborn (talk) 17:31, 13 May 2009 (UTC)[reply]
I think you'll have to wade through RFC's if you want to find a reference for that statement, but be careful, the "sockets" and "socket numbers" discussed in the article are not the same as "sockets" and "socket descriptors" as programmers know them. If you are trying to improve the article the only advice i can give you is to remember that socket objects or socket descriptors in APIs and programming texts are different animals from the sockets and socket numbers of RFC 147. If instead you're trying to understand network programming then ignore the Internet socket article.
Is it true that TCP sockets have two addresses while UDP sockets have only one? Yes and no, depends on how you look at it i guess. Both types are bound to a local ip and port. Connection oriented TCP sockets listen and accept incoming connections (on the server side) or connect to a remote ip/port (on the client side). Connectionless UDP sockets send and receive datagrams to and from remote ip/ports.
Using TCP from the client side you first request a socket object/descriptor, then bind it to a local ip/port. You have now associated two parts of the 4-tuple with the socket, but you're not yet ready to send any data, first you must connect to a remote ip/port. Now you have the full 4-tuple associated with the TCP socket and can go ahead and read and write to the socket.
Using the connectionless UDP you start out the same way: request the socket, then bind the local ip/port. The difference is that the UDP socket does not connect to a remote ip/port, after binding the socket you're ready to send and receive datagrams. But now you have to fill in the remote ip/port part of the 4-tuple each time you send a datagram, and the socket implementation will tell you the remote ip/port each time you receive a datagram. See sendto() and recvfrom() in the Berkeley sockets API.
You always need the full 4-tuple in order to transfer any data using TCP or UDP. Sockets are bound to the local ip/port which fills in two parts of the 4-tuple. TCP sockets are connected to a remote socket which fills in the other two. UDP sockets are never connected, the 4-tuple is filled in for each datagram (which can be a different ip/port each time). It's probably true that somewhere within the socket implementation a "socket number" is assigned to a UDP socket after it is bound (two parts of the 4-tuple) but only after a TCP socket is connected (all four parts of the 4-tuple). So what? Who cares? Only the programmer who writes the socket implementation, and the unlucky editor looking for a citation for the Wikipedia article.—eric 08:35, 14 May 2009 (UTC)[reply]
To add to the confusion, you can indeed call connect() on a UDP/SOCK_DGRAM socket, but all it does is say "use this address when I use send() rather than sendto()". --Sean 14:18, 14 May 2009 (UTC)[reply]
On some platforms, connecting UDP socket is needed to be able to receive ICMP messages that your outgoing packets generated (eg Port unreachable) Unilynx (talk) 18:24, 16 May 2009 (UTC)[reply]

WAV Sound in Java[edit]

Hello. The Web was unhelpful to me. When I want to play a .wav audio clip in my applet, the console displays "java.io.FileNotFoundException: <File Name Here> (The system cannot find the file specified)". The .wav file is in the same folder as my source. I tried other alternatives on the Internet, which led me to a wide variety of other errors. How do I debug this? Thanks in advance. --Mayfare (talk) 01:42, 13 May 2009 (UTC)[reply]

Post a minimal complete program demonstrating the problem. --Sean 13:34, 13 May 2009 (UTC)[reply]

I fixed it! Now, I have a NullPointerException error.

AudioClip wht = getAudioClip (getCodeBase, "L:/Reversi/1000 Hz.wav");
if (turn)
{
     ...
     wht.play ();
}

--Mayfare (talk) 01:47, 14 May 2009 (UTC)[reply]

Post a minimal complete program demonstrating the problem. Something tells me you'll fix it again! --Sean 14:19, 14 May 2009 (UTC)[reply]
I believe this should do it: AudioClip wht = getAudioClip (getCodeBase(), "1000 Hz.wav");
What was happening: getCodeBase() was already getting the path. You need to use the relative path (in this case, just the filename, since it is in the same directory) for the second parameter, so far as I can tell. Applet JavadocWashii (talk) 23:29, 16 May 2009 (UTC)[reply]

Still no sound. --Mayfare (talk) 22:29, 17 May 2009 (UTC)[reply]

Perhaps this will help. --Sean 13:28, 18 May 2009 (UTC)[reply]

Phone numbers when registering domains[edit]

I resent having to publish my phone number when I register a domain. I don't want to get any phone calls, and I don't want anybody to get my phone number from running a whois. I am under the impression that I can lose my domain name registration for not keeping the phone number updated and current (as I know you can get the name challenged, and lose the domain, for having an e-mail contact address that bounces). I assume this is a relic of the late 1970s that never got changed. Is there any way around having to have a phone number in the whois record, other than paying the registrar $20 a year for the privacy service? Tempshill (talk) 02:52, 13 May 2009 (UTC)[reply]

Theoretically - you should provide that data. However, I don't think anyone would ever come after you if you put garbage there. But - should you ever need to prove that you own the domain - or defend your ownership of it in the face of some heavy-hitter who claims your infringing their business name or something - then having fake data there would be bad - which is why there is a concern. Most domain registration services now offer the possibility to put their address/phone number in those fields and have them keep your data privately in case it's actually needed. I think it's called "ID Protect" or something. See this [1] for example. $8 per year...ouch! SteveBaker (talk) 03:05, 13 May 2009 (UTC)[reply]
I've had a lot of domains for a long time and I can only think of one or two times when anyone has called the phone number. I do get occasional pieces of snail mail spam to the mailing address. There is a ton of email spam but it is filtered by the registrar. I agree the requirement is obnoxious. There are various ways you can get around it, but they involve paying extra, so bleh. 207.241.239.70 (talk) 08:50, 21 May 2009 (UTC)[reply]

Zoom concept in computer / Computer Graphics[edit]

If I zoom the image(both vector and raster) what will be the geometric pattern of the pixels or dots?. Whats are the operation and algorithim of zoom —Preceding unsigned comment added by Indranilzee (talkcontribs) 04:27, 13 May 2009 (UTC)[reply]

For scaling of raster (bitmap) images, see Image scaling. For vector images, take a look at Vector graphics. Both are limited by the available detail in the starting image. While raster images may become [Pixelation|pixelated] without interpolation or appear blury with interpolation, vector graphics retain their crispness. However, the accuracy and realism of the scaled image is dependent on how accurately the image represented is encoded. Well defined geometry, such as shapes and fonts will continue to look good, but images such as maps and terrain will reveal that they do not have unlimited accuracy as you zoom in on them. Also, subtleties such as texture is difficult to accurately represent in vector graphics, but can be simulated using texture maps. -- Tcncv (talk) 07:20, 13 May 2009 (UTC)[reply]
Using Fractal compression you can zoom things like terrain and it can look quite reasonable, but it is generating detail that doesn't exist in the original and strange things can appear. Dmcq (talk) 17:25, 13 May 2009 (UTC)[reply]
A zoom of a 2D image is quite different from 3D. In 2D, you are just making the image larger or smaller - where in 3D you are changing the relative sizes of things closer and further away by different amounts. In either case, when you make the image smaller, you have to remove information - when you make it larger, you need to add information. Generally, both of those things are difficult. When you shrink something, you have to take care not to cause aliasing - when you grow it, the absence of additional information will either make it come out pixellated or blurry.
In 3D, we convert the 3D position of an object out there in the world into 2D using the effects of perspective:
  x' = x * s / z
  y' = y * s / z

...where (x,y,z) is the position of the object in 3D and (x',y') is the corresponding position in 2D space. The constant 's' relates to the amount of zoom. Changing that number causes the display to zoom in or out. SteveBaker (talk) 20:16, 13 May 2009 (UTC)[reply]

MICROPROCESSOR[edit]

Write a program to multiply two 16-bit unsigned numbers stored in the memory and store the result in the memory? —Preceding unsigned comment added by Abhi8 (talkcontribs) 06:42, 13 May 2009 (UTC)[reply]

Please see the top of this page for our policy regarding homework. And please do not post the same question to multiple forums. -- Tcncv (talk) 07:01, 13 May 2009 (UTC)[reply]

Looking for a particular tech review site I can't find[edit]

Hi, I'm looking to build a new computer, and I remember an article on CNET/ZDNET/whateverNET, in a blog called Hardware 2.0, about CPUs, motherboards, etc... It's quite recent, but I can't find it. Thanks in advance! 144.138.21.201 (talk) 07:37, 13 May 2009 (UTC)[reply]

ZDnet: Very Best Kit List Taggart.BBS (talk) 19:35, 13 May 2009 (UTC)[reply]

Thanks!144.138.21.132 (talk) 10:28, 14 May 2009 (UTC)[reply]

MS word - replacing commas with dots in numbers[edit]

Does anyone know a good way to replace only the commas in numbers in a word document. I had an old script for a search string that replaced only the commas in numbers with a special character and you could then go and replace that character with the dot. But last time I tried I couldn't get it to work anymore. I think they might have changed something in "search and replace" or there's a box hidden somewhere that needs to be ticked or unticked - as usual :-( Any clues would be highly appreciated. 71.236.24.129 (talk) 08:56, 13 May 2009 (UTC)[reply]

Look for a "regular expressions" search and replace feature. You would want to search for (this will depend a little on the regular expression flavor they use) "([0-9]),([0-9])", and replace it with "\1.\2". Or something. --Sean 13:37, 13 May 2009 (UTC)[reply]
The problem with Word's method is that you can find by wildcards but not replace by them. So it is easy to find all of the commas surrounded by "Any digit" (^#), but you can't replace them without obliterating the digits in question. --140.247.252.198 (talk) 17:58, 13 May 2009 (UTC)[reply]
In Word, you can do 10 global replaces ("0," -> "0#!", "1," -> "1#!", etc.); do a search for "#!" and put back any that should not be replaced (a long process if there are lots of them); finally replace all "#!" with ".".
Alternatively, move the entire text into an editor that supports regular expressions and allows you to record short macro sequences. When done the whole lot can be moved back into word, but you will have to fix up any headers, bold, itaic, etc. Astronaut (talk) 18:40, 13 May 2009 (UTC)[reply]
Thanks. Exporting isn't an option I just spent a fun-filled night extracting the text from a locked .pdf file and putting the formatting back in. Could one use MS word's crappy macro editor to cook s.th. up? I know using the recorder won't work so I guess I'll have to look into what commands they offer. (Sigh. Assembler used to be sooo easy. It took ages, but you knew what the box was doing.) For this file I guess I'll have to go with the manual wildcard search and destroy, ahem, replace.71.236.24.129 (talk) 08:07, 14 May 2009 (UTC)[reply]
try using the macro below:
The Macro

Sub Macro1()
   Selection.Find.ClearFormatting
   Selection.Find.Replacement.ClearFormatting
   With Selection.Find
       .Text = ",0"
       .Replacement.Text = ".0"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",1"
       .Replacement.Text = ".1"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",2"
       .Replacement.Text = ".2"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",3"
       .Replacement.Text = ".3"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",4"
       .Replacement.Text = ".4"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",5"
       .Replacement.Text = ".5"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",6"
       .Replacement.Text = ".6"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",7"
       .Replacement.Text = ".7"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",8"
       .Replacement.Text = ".8"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
   With Selection.Find
       .Text = ",9"
       .Replacement.Text = ".9"
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute Replace:=wdReplaceAll
 End Sub

Thank you, thank you! (Redo 1000000 times) 71.236.24.129 (talk) 09:39, 19 May 2009 (UTC)[reply]

MICROPROCESSOR[edit]

Program to multiply two 16-bit unsigned numbers stored in the memory and store the result in the memory?--Abhi8 (talk) 09:14, 13 May 2009 (UTC)[reply]

This is the fifth time you've posted this question today, I asked you on your talk page to stop. If you continue to keep posting it, rather than wait for a reply in the original post, I will report you for disruptive behavior.
Since your textbook aparently doesn't help. here are a couple of pages that might help you with your homework assignment: Microprocessor (and links from that aricle) Computer program Assembly language Instruction set Machine code Multiplication algorithm Signedness Processor register Computer memory. Please note that our articles are not written to specifically deal with your problem, so referring to your class notes or textbook is likely to be much faster. You should also try to remember what your instructor may have mentioned regarding the relationship between adding and multiplying numbers. Lots of luck. 71.236.24.129 (talk) 09:41, 13 May 2009 (UTC)[reply]

Open Source Bubble?[edit]

I fear that the next tech bubble is among companies like Sun Microsystems and Novell, who have made the decision to give away their products for free. In an effort to "compete" with Linux, Sun decided to give away Solaris. They also give away their Java IDE (NetBeans), their database program (MySQL), and their office suite (OpenOffice). They "sell" an identical suite (StarOffice). But why would someone buy StarOffice when they can download OpenOffice? I have no idea. What were they thinking? Did they want to make Sun into some sort of non-profit organization like Goodwill? If so, they more-or-less deceived the people who gave them their savings -- their investors. If I had been unfortunate enough to loan Sun money (via bonds or stock) then I'd be pretty angry right now. Giving your product away sends the message that it's worth nothing. The whole business-friendly open source theory is just that -- a theory that is looking more and more fanciful as time wears on.--24.8.183.197 (talk) 10:00, 13 May 2009 (UTC)[reply]

You're in the wrong place. Rant elsewhere. Shadowjams (talk) 10:16, 13 May 2009 (UTC)[reply]
So, you must be the owner of the encyclopedia that anyone can edit, huh? I actually think that you are in the wrong place.--24.8.183.197 (talk) 10:18, 13 May 2009 (UTC)[reply]
You're not really asking a question, though, you're just soapboxing. A suggestion you take that elsewhere is valid, as this isn't the place to promote your own views. You're already starting from a personal assumption ("Giving your product away sends the message that it's worth nothing") which does not apply to everyone.
Perhaps he's confused us with the Free Encyclopedia That Anyone Can Edit With Whatever the Heck They Want. APL (talk) 02:16, 14 May 2009 (UTC)[reply]
That said, many companies are seeking to transition to a service based revenue model, ie. give the product away for free but charge for the support service. Think of it as the disposable razor model of business. — The Hand That Feeds You:Bite 13:33, 13 May 2009 (UTC)[reply]
There is a question above. "why would someone buy StarOffice when they can download OpenOffice? I have no idea." I have no idea either. Why would someone do that? Anyway, regarding the rest, all I can say that it seems like a viable business model. Services and more valuable than products and these companies are earning millions and millions selling their services. The products serve for attracting clients--Mr.K. (talk) 10:24, 13 May 2009 (UTC)[reply]
Whether it seems like a viable business model is no longer relevant. It has been proven nonviable. Sun never made enough money off of these services. And they gave them away permanently by licensing their source code under the LGPL. This left them without an exit strategy. I find it telling that Sun is being bought by Oracle -- a company known for pricing their products high.--24.8.183.197 (talk) 02:47, 14 May 2009 (UTC)[reply]
"why would someone buy StarOffice...?" It's probably for the same reason that someone would purchase an operating system. Clearly, there are dozens of free, free operating systems. To some extent, they provide "equivalent functionality" to non-free, non-free systems. However, in the assessment of most end-users, these systems are decidedly not equivalent, and there is some feature worth paying for in Windows, Mac OS X, or one of the licensed Linux or Unix systems. Why do most people continue paying for something that they could replace with a free alternative? Maybe because they see added value, where you see no added value. A free market allows for various opinions to interact with the price-point of any given product or service - but it's a statistical process. (If you decided that wheat had no value because it was useless to you, that would not change the market price of wheat - but if most of the major grain distributors agreed with your assessment, then... ) Equivalently, if you decide that OpenOffice does have a monetary value, you are more than welcome to find someone and pay them for it - but that won't change the market price. Nimur (talk) 13:53, 13 May 2009 (UTC)[reply]
Price is determined by supply and demand. For the price of something to reach $0 on the open market, there would need to be zero people willing to buy the product. I find it very unlikely for that to be the case with StarOffice/OpenOffice. The executives at Sun decided to price their products at $0, thus ignoring the law of supply and demand. Many companies price their products higher than this law projects as part of a prestige-pricing strategy. Sun, on the other hand, decided to market to the cheapest people in the business. That makes absolutely no sense to me. They tried to make money off of people who refuse to pay for software. Wow. Maybe they never asked who their "customers" were, and if they didn't, Sun executives need to give their pay back.
Speaking of supply and demand, you can always just lower the price of your product if you want more customers. If you want to attract more users, just lower the price. Giving it away for free is the equivalent of throwing in the towel.--24.8.183.197 (talk) 02:47, 14 May 2009 (UTC)[reply]
What you don't get is that Sun isn't a core office or netbeans company. What the point of giving away packages for free is is to create added value for customers to use their other services, even if it means sacrificing revenue streams from products that they no longer consider their specialty. Maybe no one is buying Staroffice. But it wasn't like people were all buying Staroffice before Openoffice came around - Microsoft had pretty much cornered the market. They've turned Staroffice from a pointless weight around their necks that cost them money to maintain which could barely be recouped from pathetic sales into free advertising and a source of lucrative support monies. That's good business sense. You might as well ask yourself this: why don't videogame companies charge for game demos?--129.67.117.76 (talk) 13:36, 14 May 2009 (UTC)[reply]
You are indeed soapboxing, but one possible answer for the scattered question: Maybe you get some technical support when purchasing a StarOffice license? Tempshill (talk) 15:48, 13 May 2009 (UTC)[reply]
Note that you can't have a bubble unless people are speculating something up. I'm not sure that's happening here. Whether open source is or is not a good business model will depend on a lot of conditions within the companies. But it is clear that they are engaging in a realistic and well-thought out business model: use open source to build up geek cred and brand-name recognition, but provide high-cost services to companies who can't or aren't willing to afford leaving everything up to a bunch of hackers. It's not the disposable razor model, whereby everyone pays some regular, small amount over the long term. It's a model where you get a lot of little (economically insignificant) people to use your product as a gateway to the big-money corporate investments that come with having a good reputation. Will it work out in the end better than a fully-proprietary system? That's the key question. They obviously think it will, or at least won't do worse. But you can be 100% sure that it is not an ad hoc decision they made based on being charitable. Real companies don't work that way. --140.247.252.198 (talk) 18:14, 13 May 2009 (UTC)[reply]
Sun's main bread-and-butter was hardware and ding-ding-ding support! StarOffice specifically. It's sub-$100/seat last I checked, and that money pays for support. NetBeans was free to help distribute Java as a language (NetBeans is a pretty good IDE. Rival Eclipse is free as well, and is probably much better. Hmm). Novell sells support with SuSE, as does Red Hat, and they make a killing at it with RHEL (Yahoo! comes to mind...). And I would have been perfectly happy to invest in Sun. Plus, some of those investors just got a nice payoff with the Oracle buy-out (boo...) Washii (talk) 23:37, 16 May 2009 (UTC)[reply]
Also, I forgot: A lot of the work in Solaris is based off OpenSolaris now. So, that free OS giveaway with many users helping to improve it? Funnels right back into their paid product. Washii (talk) 23:40, 16 May 2009 (UTC)[reply]

MICROPROCESSOR-Sequence of instructions[edit]

Sequence of instructions to reverse a two digit hexadecimal number available in the register AX using shift and rotate instructions.--Abhi8 (talk) 10:50, 13 May 2009 (UTC)[reply]

Please see the top of the page about homework questions. Tempshill (talk) 15:49, 13 May 2009 (UTC)[reply]

Musical Software[edit]

I am using Cakewalk's SONAR to write music using a Yamaha S03 synthesizer. Even though it is easy to use, has its limitations. I was wondering if there is any other software to do the same job, but with more audial flexability but still having a easy-to-ues interface. Any help appreciated. --DJ Bogan (talk) 01:33, 15 May 2009 (UTC)[reply]

How to arrive at MTBF for an STB?[edit]

Hi, different vendors quote different figures for MTBF and have different methods to calculate. Is there any standard way of arriving at MTBF for STB? ThanksDearkundan (talk) 11:38, 13 May 2009 (UTC)[reply]

Usually a HALT test is used. This process subjects many units to high temperature and constant use, and applies an empircal formula to convert failure rates to failure-rates under normal conditions. If there is a standard, ISO or some other more specific industry consortium would probably publish its methodology - but these sorts of technical standards reports tend to be proprietary and expensive (sort of a "certification fee"). Also, it's not guaranteed that all vendors follow the same system. Nimur (talk) 14:26, 13 May 2009 (UTC)[reply]

MICROPROCESSOR-Word equal to 0000H[edit]

Word placed in register AX equal to 0000H without MOV or AND instructions.----Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

Be good if you specified the microprocessor but the simplest way I can think of doing this is to turn off the power. Then again that might make it all 1s or undefined so maybe I better think more. Hmm, perhaps I better shift the contents out, but then where do all the 1's disappear to? That's very worrying. I could of course subtract it from itself or exclusive or it with itself but that seems incestuous. Anyway once I've got it set to zero how do I keep it zero? You really need a write once register, I think best is to use an electron microscope and electron gun to zap the bits of the register so they can never be one again. Dmcq (talk) 12:29, 13 May 2009 (UTC)[reply]

MICROPROCESSOR-2's complement of the word[edit]

2's complement of the word in register AX without NEG instruction.--Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

Quote from the terms of the reference desk:
"If your question is homework, show that you have attempted an answer first, and we will try to help you past the stuck point. If you don't show an effort, you probably won't get help. The reference desk will not do your homework for you."
I see no evidence of any effort. Do you understand the question?, what have you read in wiki about it?, have you examples of code you tried but didn't work? Even then you probably won't be given 'the answer' but pointers so you understand the problem and how to solve it. Dmcq (talk) 17:08, 13 May 2009 (UTC)[reply]
Have you read 2s complement? Graeme Bartlett (talk) 10:38, 14 May 2009 (UTC)[reply]

MICROPROCESSOR-Number of logic 1's of the word[edit]

Number of logic 1's of the word available in the register AX using rotate and other instructions.--Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

This can be either a very boring question or quite an interesting bit twiddling exercise. See Hamming weight for the more interesting side. I'd guess though they expect you to just shift the word a bit at a time, and accumulate the count going round however many times there are bits in the register. As a confirmed bit twiddler I hold my hands up in horror. With a good modern 64 bit machine and the way memory is going down in price one could simply have a 4GB array with all the answers and look it up for 32 bit registers. Actually for a number of results this would almost certainly be slower nowadays than working it out with a good algorithm because he whole 4Gb wouldn't be in the cache. For more complex calculations though sticking everything on a big SIM card might be quite a good idea. Dmcq (talk) 07:57, 15 May 2009 (UTC)[reply]
Of course you could shift and mask smaller segments. For example a 32 bit register could be split into four 8-bit values, which could then be looked up in a 256 byte array and the results for the four look-ups added together. You can decide what trade-off between memory and speed you want, for example 8 four bit pieces or two 16-bit pieces could be used. -- Q Chris (talk) 08:19, 15 May 2009 (UTC)[reply]

MICROPROCESSOR-Instruction sequence to exchange two register contents[edit]

Sequence of instructions to exchange two register contents using stack.--Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

Why use the stack when wiki has a whole article on XOR swap algorithm. Using the search box at the top left is a good idea. Using a search engine is also a very good idea. Actually one can use add and subtract instead to make it less esoteric but xor was good for graphics. Dmcq (talk) 08:56, 15 May 2009 (UTC)[reply]
By the way it's not a good idea to use xor for swapping variables when writing a high level language, not only will it make the code obscure but the compiler can do a better job of optimizing if you just use a temporary variable. Does the OP really have to program in a low level language? - it should be left to people who like that sort of thing and will put in the effort to learn the various gotchas practically any microprocessor has. Dmcq (talk) 09:53, 15 May 2009 (UTC)[reply]

MICROPROCESSOR-Instruction sequence to check whether a byte stored in register AL is present in array of 10 bytes[edit]

Instruction sequence using string instructions to check whether a byte stored in register AL is present in an array of 10 bytes stored in the memory and to store the number of occurrences of the byte in register AH.--Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

MICROPROCESSOR-Code segment to find the square of a byte[edit]

A code segment to find the square of a byte available in register AL using XLAT instruction.--Abhi8 (talk) 08:12, 14 May 2009 (UTC)[reply]

Evidently these questions are homework. We will not do your homework for you. Do you have a conceptual question? Nimur (talk) 13:07, 13 May 2009 (UTC)[reply]
Please don't remove other people's messages. I've restored Nimur's response. — Matt Eason (Talk &#149; Contribs) 17:07, 13 May 2009 (UTC)[reply]
Please do your own homework.
Welcome to Wikipedia. Your question appears to be a homework question. I apologize if this is a misinterpretation, but it is our aim here not to do people's homework for them, but to merely aid them in doing it themselves. Letting someone else do your homework does not help you learn nearly as much as doing it yourself. Please attempt to solve the problem or answer the question yourself first. If you need help with a specific part of your homework, feel free to tell us where you are stuck and ask for help. If you need help grasping the concept of a problem, by all means let us know. SteveBaker (talk) 20:02, 13 May 2009 (UTC)[reply]
To repeat Matt Eason; Please don't remove other people's messages. I've restored my own, Niumur's and SteveBaker's responses. Dmcq (talk) 09:19, 14 May 2009 (UTC)[reply]

itunes space[edit]

I have been trying to add some songs to my itunes library but it keeps telling me there's not enough space so I deleted some stuff and yet the storage space available doesn't increase... Any light shed on this issue would be appreciated 79.153.197.238 (talk) 15:27, 13 May 2009 (UTC)[reply]

Try emptying your recycle bin.  GARDEN  15:33, 13 May 2009 (UTC)[reply]

Google map problem[edit]

I am having trouble locating the address of 72 rue Charles Michel in Paris. I can find nearby addresses and Google maps seems to do a virtual tour of the area - however not any high numbers anywhere near 72 on the rue Charles Michel. I can find only the low numbers of single digit and teens and twenties. I know the address exist because of this reference which I find in various other books as well. The address exists, however Google maps apparently does not show it even though it shows streets with similar numbers in the neighborhood. Perhaps the name changed when it got near that number. Clues? -Doug Coldwell talk 17:09, 13 May 2009 (UTC)[reply]

According to my streetmap of Paris (Plan de Paris par Arrondissement) bought when I lived there several years ago, there is no rue Charles Michel within the 20 Arrondissements, the Bois de Boulogne, or the Bois de Vincennes. There is however a place Charles Michels in the 15th Arr. at the intersection of av. Emile Zola, r. Linois and r. des Entrepreneurs (and above the Charles Michels metro station). Astronaut (talk) 18:03, 13 May 2009 (UTC)[reply]
I just noticed your reference was from over 150 years ago, and specifically mentions St. Denis - not Paris. The r. Charles Michel in St. Denis is numbered up to 50 in Google maps. Where numbers higher than 50 would be, there is a modern industrial estate. However, using Google's "Street View" (with surprisingly high resolution in France), I can see number 68 and next door is a Cafe/Restaurant/Hotel called "Le Relais" (48°55′51.9″N 2°20′32.5″E / 48.931083°N 2.342361°E / 48.931083; 2.342361). The building you are looking for is either "Le Relais" or the large derelict building on its own plot to the left of "Le Relais" (as you look from the street), or maybe it was between these building and has been demolished. Astronaut (talk) 18:25, 13 May 2009 (UTC)[reply]
Yikes!!! You are a little more sophisticated on these maps than I am. Can you give me a link that shows "number 68 and next door is a Cafe/Restaurant/Hotel called "Le Relais". A link using the Google's "Street View" so I could see the buildings there. I know the building is a four story building, probably the derelict one. Would like to see a picture of the derelict building. Thanks.--Doug Coldwell talk 19:40, 13 May 2009 (UTC)[reply]
Unfortunately, I cannot work out how to get a link to jump straight into Street View. However, the GeoHack mapping thingy is quite easy to use - click on the location I provided, scroll down to Google Maps, click on the map link, scroll in as far as you can. Then, to enter street view, you can drag the little yellow man (at the top of the zoom scale) to the marker on the map. You click and drag on the photo to turn the view around, or click on one of the white arrows to move up & down the street. Exit street view by zooming out again. You will easily get the hang of things.
Anyway, as a shortcut, here are two Panoramio photos of the buildings in question - photo 1 is number 68 (the tall building) and "Le Relais" half in the frame on the left; photo 2 is the large derelict building. Astronaut (talk) 19:53, 13 May 2009 (UTC)[reply]
Looking on Street View, I've just noticed "72" painted in the wall next to the gates to the derelict building (unusual, because a small blue plaque is usually how the house number is indicated). I'm pretty sure the derelict is the one you want.
Looking at the satellite view from above, I guess the original plot extended down to the River Seine, before the N14 (bvd de la Libération) and concrete embankments were built.No, there was a towpath along the riverbank. Astronaut (talk) 20:09, 13 May 2009 (UTC)[reply]
Yes, I do believe you got it. Thanks. In this reference it shows the architectial design of 1853. Looks like the same building to me! It is a building by Francois Coignet, a biography article I am working on in a sandbox. It is unique in that it is the first reinforced concrete building. The architecial drawing I probably can use in Commons because of its age. Now if I can just figure out how to get a modern picture of it that can be used in Commons. Any ideas?--Doug Coldwell talk 20:55, 13 May 2009 (UTC)[reply]
P.S. The plaque below the "72" on the top line I think says "Francois Coignet". --Doug Coldwell talk 20:59, 13 May 2009 (UTC)[reply]
At first I didn't think it was the same building, but if you look carefully (Google Street View again - this time from bvd de la Libération), the front view in the reference is the side that overlooks the River Seine. It has the correct number of windows and you can still see the small gate from the garden onto the riverbank towpath (Chemin de halage), now the bvd de la Libération. As for modern pictures, you could pay it a visit and probably take all the photos you want. Alternatively, you could try contacting the photographer of both the photos I linked above (and this third) and see if they'll release it under GFDL. Astronaut (talk) 21:53, 13 May 2009 (UTC)[reply]
... or this photo looks familiar. Astronaut (talk) 22:08, 13 May 2009 (UTC)[reply]
Thanks for all your help on this.--Doug Coldwell talk 22:57, 13 May 2009 (UTC)[reply]
I hope you'll spell it François when you make it a real article. —Tamfang (talk) 05:11, 14 May 2009 (UTC)[reply]
I just gotta say that this is a GREAT thread. The RefDesk denizens are an amazing resource! --Scray (talk) 03:04, 14 May 2009 (UTC)[reply]

Copying a LOT of files in Linux[edit]

Hi,

Just a slight problem i have. I need to move ~90gigs of files to backup hard drive, but doing

mv * /mnt/myexthd

it complains that 'the argument list is too long' (which I do understand... each file is only about 3.8MB)...

Is there a way that I can copy everything in just one go?

TIA PrinzPH (talk) 20:11, 13 May 2009 (UTC)[reply]

Try moving the parent directory. For example, if you have a gajillion files inside of /home/me/music, then use mv /home/me/music /my/backup. However, that MOVES the files, not copies them. If you want to copy, use cp -R /home/me/music /my/backup/ -- kainaw 20:14, 13 May 2009 (UTC)[reply]
Resolved

Thanks Kainaw! Worked perfectly! PrinzPH (talk) 21:06, 13 May 2009 (UTC)[reply]


(EC) In cases where you don't want to move the parent directory you can use xargs, which is designed for exactly this issue. For example, to move all the files ending in .mp3 to /mnt/myexthd, do:
find -name '*.mp3' -maxdepth 1 -print0 | xargs -0 mv -t /mnt/myexthd
Who said the command line wasn't user friendly! --Sean 21:11, 13 May 2009 (UTC)[reply]
You can just use the shell:
for t in *.mp3; do mv $t /mnt/myexthd; done
If the individual commands are very fast, this may be slower than the find method, but it's easier to type and to remember. --Tardis (talk) 16:47, 14 May 2009 (UTC)[reply]
Or just use rsync --h2g2bob (talk) 02:02, 16 May 2009 (UTC)[reply]

Selling a used Laptop[edit]

What precautions should I take when selling a used laptop? I would imagine that there is a lot of personal/private data on my laptop right? What are the steps I need to take in order to erase these data when selling my laptop? Acceptable (talk) 21:12, 13 May 2009 (UTC)[reply]

How I would do it: First, go through it thoroughly and backup any data you want to save. Then download a linux distribution (either puppy linux or ubuntu) and run it as a live cd on the laptop. While booted into this live cd (which makes no changes to your hard drive) go through your folders once again to make sure there isn't anything you want to save. If you are really paranoid or had very sensitive data on the laptop, run the dd command to zero out the hard drive (it overwrites every bit on the computer with a zero.) Then install an operating system on the laptop (either from the live cd, or your original operating system disks if they came with the computer.) If you are a non-technical user, you'll have to use google extensively to find out how to implement each of these steps (especially the dd command.) Taggart.BBS (talk) 21:35, 13 May 2009 (UTC)[reply]
I do it the way Taggart.BBS said. A possibly easier way for a person unfamiliar with Linux would be to boot from an external USB hard disk and use a disk shredder program on the internal drive. Tempshill (talk) 23:23, 13 May 2009 (UTC)[reply]
Also consider using Disk encryption on your next laptop. —Preceding unsigned comment added by 84.187.92.42 (talk) 00:05, 14 May 2009 (UTC)[reply]
You could use disk encryption to wipe your hard drive instead of a live CD. If you use Windows then install TrueCrypt, set it to encrypt your boot drive with an impossible-to-guess passphrase, and when it's finished encrypting, sell the computer and forget the passphrase. -- BenRG (talk) 01:27, 14 May 2009 (UTC)[reply]
Why do that when you can simply wipe it? --antilivedT | C | G 09:20, 14 May 2009 (UTC)[reply]
If you use a boot CD there's an hour or two of down time while the drive is wiped, and you have to schedule it at the very end when you're otherwise finished with the machine. TrueCrypt encrypts the drive on the fly while the system is running, and of course you can keep using it afterwards. Also, you don't have to burn the boot CD, which means one less piece of plastic in your life. -- BenRG (talk) 12:47, 14 May 2009 (UTC)[reply]
If it were my laptop that i was selling i would use the True crypt way. First i'd choose a 64 character key, Manly composed of my email address, home address.. maybe my mouse S/N, just what ever i can find. Then after i write that down i'd use that to encrypt the hard drive with 7 passes. That will most likely take all night. Once done I'd format the hard drive. :) Hope this helps. – Elliott(Talk|Cont)  15:40, 14 May 2009 (UTC)[reply]