Wikipedia:Reference desk/Archives/Computing/2012 October 4

Computing desk
< October 3 << Sep | October | Nov >> October 5 >
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 4

edit

Computer failing to boot - Part 2

edit

(Continued from Sept. 27 thread)

I received the new power supply today, and took a close inventory of what happened on startup after I installed it. To wit:

  • Motherboard lights do not turn on.
  • The POST is ~30 beeps in very rapid succession.
  • There's no visible blackening, nor is there any burning component smell.

Any ideas? —Jeremy v^_^v Bori! 01:22, 4 October 2012 (UTC)[reply]

Here's a link to the first part of the discussion, for anyone trying to catch up: Wikipedia:Reference_desk/Archives/Computing/2012_September_27#Computer_will_not_start. StuRat (talk) 01:54, 4 October 2012 (UTC)[reply]
NM, this is moot. my rig is starting up as normal now. —Jeremy v^_^v Bori! 01:56, 4 October 2012 (UTC)[reply]
Good, let us know if it dies again. StuRat (talk) 01:59, 4 October 2012 (UTC)[reply]
  Resolved

transport layer protocol

edit

1: in Transport Layer Security, is the hole transport layer header encrypted? 2: if so, and your router uses port forwarding, how does it know your trying to establish a connection? (when you send a tcp-syn packet in tls.) 3: if i write my own transport layer protocol, and send a packet with it, is there any chance that a router somewhere along the way to the destination host would drop the packet? thank you, 70.114.254.43 (talk) 06:00, 4 October 2012 (UTC)[reply]

1) no, as the article explains, TLS runs on top of the transport layer. The TCP and IP headers are not encrypted. 2) The source and destination of traffic are not encrypted. If you need those to be kept confidential, you might want to investigate systems such as Tor (anonymity network). 3) theoretically yes, any router can drop a packet for any reason. If you're trying to create your own alternative for TCP, it's more likely that a firewall near the destination will drop it (not recognizing the protocol) than some router halfway the path. Unilynx (talk) 21:12, 4 October 2012 (UTC)[reply]
  1. the IP header and TCP header are not encrypted.
  2. a router or firewall will not be inspecting or making decisions on the encrypted content.
  3. Yes, if the queue for the next hop is full the packet can be discarded. If the IP time to live is exhausted it will be chucked out, and if the route disappears or a network node cannot be reached with an arp the packet will also be dropped. Hopefully in these last circumstances you would get an ICMP message to tell the sender about it. Graeme Bartlett (talk) 21:08, 4 October 2012 (UTC)[reply]
3) Writing a transport layer protocol is not exactly trivial and a firewall is very likely to drop packets for any protocol that it is not configured to permit. If you "hijack" an existing permitted protocol identifier, the firewall is likely to figure out that the header is not what is expected and drop the packet anyway. TOR may give you some amount of privacy but it does not withstand techniques available to significant opponents. Docdave (talk) 03:40, 8 October 2012 (UTC)[reply]

oracle array values

edit

I am using Oracle. I am storing data where about 99% of it has an ID and a value. The other 1% has an ID with two, three, or four values. I could make a table with ID, Value1, Value2, Value3, Value4. But, that means that every query to find an ID will require checking all four value columns. I know there is an array column type that is often used instead of separate joined tables. Can someone show me an example of the syntax to make a table like ID, Value[4]. Then, I want to be able to insert (ID, [value1, value2]) and then query select ID from my_table where value='something'. 128.23.113.249 (talk) 13:11, 4 October 2012 (UTC)[reply]

The normal way of doing this is simply to have multiple rows with the same ID, so you would insert [ID,value1], [ID,value2], [ID,value3] etc.--Phil Holmes (talk) 15:10, 4 October 2012 (UTC)[reply]
Agreed. You can also add a column with a name like INSTANCE:
ID   INSTANCE   VALUE
--   --------   -----
 A          1     TOM
 B          1    DICK
 B          2   HARRY
 B          3   LLOYD
 B          4    JOHN
 C          1   JERRY
The advantage to this method is that you can add as many instances as wanted, and identify each by the unique ID/INSTANCE key.
However, if you have other columns which only vary with the ID, not the INSTANCE, then you really do need to break it down to two tables, to avoid duplicating data:
ID_TABLE
========
ID   ID_ATTRIBUTE_1   ID_ATTRIBUTE_2
--   --------------   --------------   ...
 A          
 B          
 C         
INSTANCE_TABLE
==============
ID   INSTANCE   VALUE   INSTANCE_ATTRIBUTE_2   INSTANCE_ATTRIBUTE_3   
--   --------   -----   --------------------   --------------------   ...
 A          1     TOM
 B          1    DICK
 B          2   HARRY
 B          3   LLOYD
 B          4    JOHN
 C          1   JERRY
StuRat (talk) 15:50, 4 October 2012 (UTC)[reply]

C++ popen without buffer

edit

Hi,

I have a software a (unfortunately its closed source) which generates a lot of output (Terabytes per hour to STDOUT, for several weeks). I don't have the disk space to store all of it, so I wrote a small C++ program to analyze it and capture what I need. Under linux I can call it like this

./a inputfile | ./myprogram

and it works nicely. I still need to wait for a few weeks to get my results and have to hope that our admin doesn't decide that the compute needs to be rebooted in that time.

To solve this problem I just found a way to parallelize myprogram. So I start some threads using OpenMP, in each thread I call a on a subset of the inputfile and try to reads its STDOUT using popen. On small datasets, the new program works correctly. On large datasets popen returns NULL with errno==ENOMEM (Out of memory) after a while but before myprogram reads the first line of input. To me it seems like popen tries to read all input into a buffer before myprogram can start processing it. Is there a way around this problem? Can I tell popen (or a similar command) to give each line (or each 100MB) to myprogam and then forget it?

Many thanks, 46.223.66.196 (talk) 19:44, 4 October 2012 (UTC)[reply]

I have to run out so I can't check the source, but it's my understanding that popen calls pipe(2), which stores everything written to it in RAM (its man page says "Data written to the write end of the pipe is buffered by the kernel until it is read from the read end of the pipe."). pipe's behaviour is described in the pipe(7) manpage. It says "the pipe capacity is 65536 bytes"; assuming it's not been opened as non-blocking (I don't think popen would use that option) then if it gets full the writer should block until it gets read. So the most a pipe, and thus popen, should consume is 64kbytes. popen doesn't store huge chunks of data itself - that would be madness. So I don't think popen is to blame; it may be that someone else has wasted all the memory and popen just happens to be the call that fails. I confess I don't understand quite what you're passing to popen; if you don't want the writers to block, you should probably be writing generated data to real files and be reading from those. -- Finlay McWalterTalk 20:18, 4 October 2012 (UTC)[reply]
Writing the STDOUT of program a to a file would consume hundreds of Terabytes. I do not have that much space available. What I have verified: Program a gets started (by popen("./a part_of_inputfile", "r");) and is running, I can see its STDERR. Before any popen returns, my 512G Ram get filled in about a minute. When the Ram is full, popen returns NULL. --46.223.66.196 (talk) 20:45, 4 October 2012 (UTC)[reply]
I read your problem definition a few times, but I'm still not entirely certain that I've understood it. On the assumption that I've understood correctly, it's difficult to know if it is applicable without seeing the relevant code, but it sounds like you need some form of IPC between the two programs. — cdwn 20:55, 4 October 2012 (UTC)[reply]
Try running a memory profiler like valgrind which will report where the memory is going. -- Finlay McWalterTalk 21:21, 4 October 2012 (UTC)[reply]
One thing of note: popen spawns a /bin/sh, which runs as long as your command does. You could try not using popen (and thus that shell, whose complicated behaviour may be to blame). Instead you'd create a pipe yourself with pipe(2), fork a subprocess, twiddle the child process' file descriptors (as the pipe(2) man page shows) and then have it exec (thus doing a fork-exec). -- Finlay McWalterTalk 21:29, 4 October 2012 (UTC)[reply]
I'm blanking on any reason why this might be happening. It's worth rolling your own popen as Finlay McWalter suggested to see if anything changes. Here's some sample code (error handling omitted):
      int fd[2];
      pipe(fd);
      pid_t pid = fork();
      if (pid) {
          close(fd[0]);
          dup2(fd[1], 1);  // stdout -> write end of pipe
          close(fd[1]);
          execl("./a", "./a", "inputfile", 0);
      } else {
          close(fd[1]);
          // ... read from fd[0] ...
      }
-- BenRG (talk) 04:10, 5 October 2012 (UTC)[reply]
I think we are missing some important information here. This is a very special computer, if it can generate 10 gigabytes of output per second. What kind of computer is it? What OS is it running? Looie496 (talk) 04:39, 5 October 2012 (UTC)[reply]
Another possibility is that the program is not running out of memory, but out of file descriptors. How many threats are running at the same time? popen() does not reliably set errno, according to the BSD man pages on MacOS-X. Linux is a bit more circumspect ;-). --Stephan Schulz (talk) 06:52, 5 October 2012 (UTC)[reply]
I tried that, and when the process' limit of file descriptors (1024) is reached, popen returns NULL and sets errno to EMFILE ("too any files open"), as one would expect. -- Finlay McWalterTalk 09:58, 5 October 2012 (UTC)[reply]
Terabytes per hour is probably less than one gigabyte per second. It's not an unreasonable amount. If 512GB RAM fills in 60 seconds, that's evidence that the RAM isn't just being consumed by output from the program (at least not very efficiently). -- BenRG (talk) 15:02, 5 October 2012 (UTC)[reply]
OP here. It does work now. Creating my own pipe as shown above was the solution. Thanks a lot 46.223.66.196 (talk) 21:29, 8 October 2012 (UTC)[reply]
Great, I'll mark this Q resolved. StuRat (talk) 21:34, 8 October 2012 (UTC)[reply]
  Resolved

Java applets not loading

edit

It seems that I can no longer load any Java applets; after initially displaying the Java "loading" screen, the applet 'times out' with "Error. Click for details" and "ClassNameNotFoundException". This happens on all my browsers (IE, Firefox, Chrome), as well as any site that uses applets (including Java's test applet). I have the latest version of JRE and have already tried reinstalling it, to no avail. Any have any ideas how I can fix this? 142.157.42.181 (talk) 21:06, 4 October 2012 (UTC)[reply]

Do you have a firewall? Ruslik_Zero 19:14, 5 October 2012 (UTC)[reply]

Different time zones in Excel

edit

Hello. Is there a way to display a time in an Excel table as local time, yet sort the data by a common time zone? Let me give an example: Four events happening on the same day in New York, London, Tokyo and Los Angeles. If I list them all by UTC, they happen, in proper order, as TOK 06:00, LON 17:30, NYC 18:00, LAX 18:30. However, I want to display each as local time, so that people will know whether the event is a morning, afternoon or evening event. That listing would show LAX 11:30 (PDT), NYC 14:00 (EDT), TOK 15:00 (JST), LON 18:30 (BST), which is obviously out of sequence. So how do I get the listing to sort by UTC but display local time? I know I could put a UTC column in, but what do I put in the local time column to convert the UTC to local time? Thank you.    → Michael J    22:17, 4 October 2012 (UTC)[reply]

The only way I could think Excel could handle that natively is if it knew which time zone existed for each value you had in each row. I doubt that's built in. You could, however, put in two columns, one with UTC, and the one with UTC + appropriate offset. If the location didn't change, you could hardcode in the offset. If, however, you wanted the location to be adaptable too, you could create a table of locations and then offsets. Then use the HLOOKUP function to pull in the appropriate offset.
For example, you'd have an index that looked like this
G H I
London Tokyo Los Angeles
0 +9 -7
A B C
Tokyo Los Angeles Los Angeles
3:00 4:45 18:30
Then you'd use HLOOKUP (or VLOOKUP if you transpose it) to do something like HLOOKUP(A1,G1:I2,2). I'm not 100% sure the HLOOKUP syntax, I think that's close. Does that help any? Shadowjams (talk) 22:58, 5 October 2012 (UTC)[reply]
I see what you are saying, yes it helps very much. I could add a column for each city for its offset from UTC, then use that number multiplied by 3,600 as a factor on the UTC time (since Excel tracks stores times as seconds, even when they are displayed otherwise). Thanks so much!    → Michael J    02:22, 6 October 2012 (UTC)[reply]
  Resolved
Actually, Excel stores dates and times internally as amounts of days. If a is a time and b is a number of hours, use a+b/24 to add them. --Bavi H (talk) 18:44, 6 October 2012 (UTC)[reply]

router speed

edit

if i split a file into 100 parts and send each to another computer in a udp packet, do i need to limit the speed and witch the packets are sent to avoid overloading my router? and, if so, how do i limit the speed, and how do i know how much to limit the speed? (p.s.: i have some programing experience, including network programing (some). and sturat, are you a programer?) thanks, 70.114.254.43 (talk) 22:28, 4 October 2012 (UTC)[reply]

Your router shouldn't "overload" even when it is being completely saturated if it has been manufactured right. As a side note, you really don't want to be using UDP for file transfers. Use a protocol with reliability mechanisms in place, namely TCP. — cdwn 23:51, 4 October 2012 (UTC)[reply]
Actually, many will start to slow down if fully saturated. Lower-end (i.e., home) routers will often have a single ASIC for all their switch ports, whereas higher-end Cisco switches have one ASIC per two ports. Juniper switches come with powerful Intel CPUs running in excess of 2 GHz, which can handle full gigabit speeds on all their ports.—Best Dog Ever (talk) 01:11, 5 October 2012 (UTC)[reply]

by "overload" i mean sending sending more then 100 melon bits per second at it (being a 100 mbps router), exceeding the bandwidth, causing it to drop some of the packets. and i know i should use tcp, but it's just an example. 70.114.254.43 (talk) 00:40, 5 October 2012 (UTC)[reply]

If it's a 100 mbps router, the port will only send at 100 mbps and you'll have to upgrade to a gigabit model. But whether it slows down actually depends on the model of the router. Still, the only time I've seen routers become overloaded (i.e., slow down) is when you utilize multiple ports on them simultaneously to send over 50% of their rated speed. As a rule of thumb, if multiple people are using the router at the same time for large transfers, limit the speed to 50% of the maximum port rating (e.g., 50 mbps if it's a 100 mbps port). If it's just you who's using it, though, I wouldn't worry about it. But I would still ensure the room you're doing this in isn't really hot and that the vents in the router aren't obstructed by dust. Some higher-end switches have temperature sensors in them that can be read via DD-WRT or Cisco IOS. Many also come with dual-fans which ensure the device remains cool. If your router starts to choke on the data, consider upgrading to an enterprise class switch from Juniper, HP, or Cisco to handle LAN data transfers. This is assuming, of course, that your hard drive can actually handle transferring above 100 mbps. Lower-end mechanical drives can only do about 400 mbps: [1] if your drive isn't fragmented.
Also, I should mention that splitting up the file will slow down the transfer. Try copying a bunch of small files and then a large file and you'll see what I'm talking about.—Best Dog Ever (talk) 01:11, 5 October 2012 (UTC)[reply]
You have to do roughly what TCP does: have the recipient report received packets to the sender and dynamically adapt. There's some information at Transmission Control Protocol#Congestion control. It's not easy. -- BenRG (talk) 02:03, 5 October 2012 (UTC)[reply]
That's why he chose UDP, which does not require acknowledgement of receipt of the packets. But it's largely irrelevant because you simply cannot transfer at a speed greater than 100 mbps on a 100 mbps link. It is impossible because the coding scheme for converting the electrical signals to bits is different for each speed and because 100 mbps connections use 2 pairs and 1 gbps links use all 4 pairs. Gigabit ethernet uses all pairs for sending and receiving whereas 100 mbps connections use dedicated wires for each purpose. Both the computer and the router will automatically negotiate the speed to 100 mbps, even if you tell them it's a 1 gbps link. If, for some reason, they do not negotiate that speed, the link will not work at all. The sending computer will have to drop packets in order to continue sending data once its buffers are full. So, the only thing getting overloaded in this case is the sending computer.—Best Dog Ever (talk) 05:36, 5 October 2012 (UTC)[reply]
So he'll end up with missing bits of the file instead of slowing down! -- Q Chris (talk) 12:12, 5 October 2012 (UTC)[reply]
"That's why he chose UDP, which does not require acknowledgement of receipt of the packets" — what are you talking about? You're clearly answering a different question than I am. Even if you "merely" saturate the link from your computer to the router, the router may still drop a lot of packets, depending on the bandwidth and activity of its other links. Some other router beyond that one, about which you know nothing, may drop packets. Dealing with that without massive inefficiency is what TCP does, and it's hard. UDP is only suited for low-bandwidth communication unless you implement congestion control that's approximately as sophisticated as TCP's. To implement congestion control you need information about the rate of packet loss, which you can only get from the recipient. -- BenRG (talk) 15:41, 5 October 2012 (UTC)[reply]
Or of course situations where dropped packets don't matter! If I am sending a stream of GPS position coordinates to a server then UDP would be a good choice. -- Q Chris (talk) 16:43, 5 October 2012 (UTC)[reply]
I mentioned that he chose UDP because that's what he said in his initial question: "if i split a file into 100 parts and send each to another computer in a udp packet." UDP is actually perfect for video streaming (especially high-bandwidth streaming), and it's used quite often for that purpose. If your video is 30 frames per second and you drop a couple of frames a second, it's hard to notice, and even if you retransmitted the data, the retransmitted frames would be for action that has already been shown on the screen.—Best Dog Ever (talk) 19:30, 5 October 2012 (UTC)[reply]
Yes, I am a computer programmer, so I'll answer the part about how to delay a task, not the part about whether this is a good idea, in your case. Here are some approaches:
1) A big old loop that does nothing but count. Not very good, since the delay isn't constant, but rather depends on the CPU speed and your current share of that CPU time. I've noticed that the Microsoft Hearts card game uses this method, and, as a result, has become so fast that you can't even see the cards fly by on the slowest setting, because computers got much quicker since they originally set the timing.
2) Specify a delay in real time. In Fortran, for example, the SLEEP command lets you specify how long to wait. This is the easiest solution.
3) Wait until a specific time. This requires a bit more coding, as you need to calculate the time you want and compare the current time with that, keeping in mind that that you might have a change in minute, hour, AM/PM, or even date. It's also less efficient, as you're constantly doing the check.
4) Wait until a specific condition is met. In your case, you would check for the router load level dropping back down to a low level. Probably not easy.
5) Wait for user input, like "Hit any key to continue". Not a good choice for 100 parts. This is more useful if it needs to wait for something that only the user can identify. For example, I just added some code to a CG movie rendering program I wrote that says "Warning, this program will take up considerable resources on your computer, so you may want to use the Task Manager to lower the process priority, if you intend to use the computer for other tasks while this runs. Please do so now, then hit any key to continue." StuRat (talk) 16:33, 6 October 2012 (UTC)[reply]
1) I am going to avoid the TCP/UDP discussion because it is not relevant to the question of exceeding the available bandwidth. Your UDP packets eventually end up at the network interface card of your computer for transmission to the local router or switch. Each network card is a little different, but all of them have a finite number of buffers to hold outgoing and incoming packets. The operating system drivers interact with the card and can only provide a packet to the interface when there is an available buffer. This effectively slows down the rate of transmission so that it can't exceed the available bandwidth. Docdave (talk) 04:00, 8 October 2012 (UTC)[reply]

Urgent :Sony Viao Laptop Display problem

edit
Hi all ! 

I got a problem on my Sony viao laptop when boot up my laptop , every thing goes fine but the Desktop loads , there appear a white screen

just like when there is a internet problem on Internet Explorer and it says "The page cant be displayed , check your internet connection and things like that " and i cant access my desktop.

Could you guys please help me it is very urgent .

Thanks — Preceding unsigned comment added by 86.7.132.221 (talk) 23:29, 4 October 2012 (UTC)[reply]

Is there any text on the white screen? Do you receive any error messages at any point? You say the desktop loads, so at what point does the white screen occur? — cdwn 23:44, 4 October 2012 (UTC)[reply]

Hi Cdwn ! The white screen occurs just before the desktop loads and it is a very typical error like the webpage cant be access , check out your internet connection . It is the same error message you know we get when there is a problem in internet and Microsoft Internet Explorer displays .

Thanks for your help i am waiting for your reply. — Preceding unsigned comment added by 86.7.132.221 (talk) 23:52, 4 October 2012 (UTC)[reply]

Does this white screen say anything about "Active Desktop"? What happens if you press the Windows key, does the start menu appear? — cdwn 23:55, 4 October 2012 (UTC)[reply]

When i start Task Manager , it disappear at all. — Preceding unsigned comment added by 86.7.132.221 (talk) 00:16, 5 October 2012 (UTC)[reply]

Dear Cdwn , None of the key works but when i press ALT+CTCL+Delete then the Task Mgr start other wise no thing works . — Preceding unsigned comment added by 86.7.132.221 (talk) 00:08, 5 October 2012 (UTC)[reply]

What happens if you open the task manager, select "File", "New task", and then enter "explorer"? — cdwn 00:11, 5 October 2012 (UTC)[reply]

When i start the Task Manager , it disappears. — Preceding unsigned comment added by 86.7.132.221 (talk) 00:17, 5 October 2012 (UTC)[reply]

What disappears? - the task manager, the white screen, something else? Astronaut (talk) 12:26, 5 October 2012 (UTC)[reply]

emule

edit

i have emule (p2p app) running on a high numbered port. i closed it and ran a simple http server in python on the same port (the one in the python docs for "simplehttpserver"). when i try to connect with Firefox, Firefox says it can't find a server at "my private address". and the error text in the python console indicates that the other hosts emule was connected to are still sending me traffic. anyone know how to fix this? (i have windows 7, i,m behind a router with nat, the port emule uses is forwarded, and i type in Firefox: "my_private_address:port_python_is_serving_on".) thank you for your time, 70.114.254.43 (talk) 23:36, 4 October 2012 (UTC)[reply]

This is probably because SimpleHTTPServer is single threaded and is unable to serve you whilst it is still receiving connections. As your port is forwarded and you have a server running, anyone can connect to the server (even if they are sending totally wrong data, emule data to a HTTP server, for example). Either you need to wait for the other emule clients to realize that your client is not there any more (try not running anything on the port for a few minutes), or you need to disable the port forward. — cdwn 23:46, 4 October 2012 (UTC)[reply]

i waited half an hour for the other emule clients to realize that my client isn't there anymore, but they were still sending me data. also, i'm trying to serve on that port so the outside world can access the server, as it's the only forwarded port i have. (i don't have admin access to my home router.) 70.114.254.43 (talk) 00:49, 5 October 2012 (UTC)[reply]