Wikipedia:Reference desk/Archives/Computing/2010 November 6

= November 6 =

Batch file to control network settings
My friends and I often get together and play games via LAN, but to do so, we always have to change our network settings considerably. First, we disable Windows Firewall. Then, we open 'Network Connections' and disable 'Wireless Internet Connection'. I don't see how those two steps are necessary, but some of our games seem to take issue if we don't do them. :\ Then we right-click on 'Local Area Connection', select 'Properties', then 'Internet Protocol (TCP/IP)', then 'Properties', select 'Use the following IP address', and type one in. I think that's called setting up a static IP? Anyway, then we go back to 'Network Connections' and do the same for '1394 Connection 13'. Is there were a way to create a batch file that would automate this? And hopefully one that would reverse it too. KyuubiSeal (talk) 01:12, 6 November 2010 (UTC)


 * The netsh command is used to manipulate most of the Windows IP stack parameters from the command line. here is an example. 87.115.152.166 (talk) 01:54, 6 November 2010 (UTC)


 * It sets the 'Local Area Connection' correctly, but nothing else. At least that's a third done though. KyuubiSeal (talk) 03:31, 6 November 2010 (UTC)


 * netsh interface set interface "Local Area Connection" DISABLE
 * netsh interface set interface "Local Area Connection" ENABLE
 * 87.115.152.166 (talk) 03:39, 6 November 2010 (UTC)


 * I can get it to set the static IPs correctly, but I can't disable Windows Firewall and the wireless network. When I try swapping in 'Wireless Network' for 'Local Area Connection' in the above lines, it gives me this error:

One or more essential parameters not specified The syntax supplied for this command is not valid. Check help for the correct syntax.

Usage set interface [name = ] IfName [ [admin = ] ENABLED|DISABLED [connect = ] CONNECTED|DISCONNECTED [newname = ] NewName ]

Sets interface parameters.

IfName - the name of the interface admin  - whether the interface should be enabled (non-LAN only). connect - whether to connect the interface (non-LAN only). newname - new name for the interface (LAN only).

Notes: - At least one option other than the name must be specified. - If connect = CONNECTED is specified, then the interface is automatically enabled even if the admin = DISABLED option is specified. —Preceding unsigned comment added by KyuubiSeal (talk • contribs) 00:07, 7 November 2010 (UTC)

Is there a way to get a "wikitable sortable" table to correctly sort by "year"?
I am specifically working with the table at The 100 Best Books of All Time, the entries of which have been altered and provided below as an example: See what happens when you sort by the "Year" column.

I started with template:Sort (eg. " 9th century " which should sort by "850" and display "9th century", right...?).

Template:Dts seems to work well enough, but does not permit an "alternate text".

Template:Dtsh-with-text-following-it just doesn't seem to work.

Is there some way to deal with this -- ie., to get that "Year" column with entries of the kind shown above to sort correctly -- that I am just not seeing? Wiki Dao &#9775;  (talk)  01:45, 6 November 2010 (UTC)


 * I would have thought ntsh would work, but for some reason it doesn't like those -ve values:


 * 87.115.152.166 (talk) 03:30, 6 November 2010 (UTC)
 * Yes I had tried ntsh too, forgot to mention that. Wiki Dao  &#9775;  (talk)  12:36, 6 November 2010 (UTC)


 * Ah, which Nts explains. You could hack it by having a search index that you manually order (e.g. 3 -417BC). 87.115.152.166 (talk) 03:35, 6 November 2010 (UTC)
 * Yes I tried that as mentioned in question. Wiki Dao  &#9775;  (talk)  12:36, 6 November 2010 (UTC)


 * Have you read Help:Sorting? ---— Gadget850 (Ed)  talk 03:39, 6 November 2010 (UTC)
 * Yes, the problem is that the information there doesn't seem to help with my specific set of difficulties. nts says "Negative numbers do not sort correctly with this template" but doesn't really say why, or how to get them to do so instead.
 * I have also tried using just html, for example: " -1750 18th or 17th century BC ". Haven't got that sort of thing to work yet either; still working on that.
 * The primary problem seems to be with sorting "negative" or "BCE" dates along with "positive" or "CE" dates in the same column. Because none of what I would have thought to be the applicable templates seem to treat negative numbers numerically.   Wiki Dao  &#9775;  (talk)  12:36, 6 November 2010 (UTC)

Windows 7 file permissions
I have recently installed Win 7 Professional 64-bit. Upon trying to copy over my personal Apache setup, I was stumped by my inability to save a configuration file change. At first I thought the file(s) might be locked, but this issue is system-wide: I simply can't modify a file outside of my User directory. I've reviewed the web and can see that many users have had similar issues, but can't find anything that fully addresses this.

My account is an administrator and if I review the "effective permissions" for a particular file, it says that I have full control of the file. Yet I can't save a modification to it. The only broad solution to date is to completely turn off User Account Control. Here are two additional clues: explicitly making my account name the "owner" by itself does not change anything, but if I then add my account to the main Permissions area, then I can edit the file. Granting "full control" to the Users group also fixes the problem, but this is not an appropriate solution.

This situation is, to put it mildly, absurd. Is there actually a robust solution to this, one that does not require messing with permissions to accomplish simple tasks? I thought Win7 was supposed to be a panacea from Vista, and I encounter an even stranger problem right from the start, setting me back hours. I've about had it with MSFT.

Thanks, Riggr Mortis (talk) 06:40, 6 November 2010 (UTC)


 * I don't understand. Preventing modification of files outside the user directory is kind of the point of UAC, and you seem to want to keep UAC turned on, but you say the behavior you observe is absurd. What behavior do you want? You can right-click a program and select "run as administrator" to run it without UAC restrictions.


 * The "improvement" in Windows 7 was that Microsoft exempted its bundled software, such as Explorer, from UAC at the default notification level. That makes UAC nearly useless, since some of the exempt programs can be coerced into executing arbitrary code, but people think it's better because they see fewer annoying prompts. -- BenRG (talk) 08:26, 6 November 2010 (UTC)


 * Actually I'm more mystified then that. AFAIK, programs running without UAC can modify most files outside the user directory. The root, program files directory, Windows directory and other system directories are protected against modification for obvious reasons. If you are trying to save a config file to a program directory, while that's usually considered a bad idea in most OSes nowadays AFAIK (even if it was common in some Windows in the past) except for portable apps (which shouldn't be in the program files directory) you can do so by putting that program outside the program files directory. Nil Einne (talk) 10:33, 6 November 2010 (UTC)

Regarding config files, of course... but Apache defaults to \Program Files\ for its entire install, and since I do one thing with Apache I'm not getting fancy.

What behavior do I want? Well, my account is marked Administrator, and I would expect that fact to be sufficient to edit a bloody text file anywhere on the drive, all other things being equal. Are you suggesting it's not odd that the system tells me I have effective "full control" permissions over, say, "C:\Program Files (x86)\Apache\README.txt", yet I don't? Riggr Mortis (talk) 21:09, 6 November 2010 (UTC)

BenRG: it's not that I want to keep UAC on. I will probably end up leaving it off entirely. I did on Vista, but at the same time I don't remember UAC being that intrusive on Vista. If someone simply said "UAC and administrative permissions logically conflict on Win 7", well that would answer my question, I suppose. Riggr Mortis (talk) 21:20, 6 November 2010 (UTC)


 * The idea of UAC is that your user account has administrative privileges but most processes are started with only some of those privileges, so yes, this is expected behavior. It's somewhat more like the Java applet security model than the traditional Unix model. I don't know the details well enough to respond to Nil Einne above. -- BenRG (talk) 23:23, 6 November 2010 (UTC)


 * AFAIK Vista has the same behaviour. See which mentions similar issues. However virtualisation is available on some versions as a stopgap measure, see . User Account Control mentions this as well. Of course another option would be if Apache really wants to put the config files in program files directory would be for it to be better designed to utilise UAC and raise a prompt when it wants to modify the config. As BenRG has said, Windows's UAC is sort of a way of limiting privilages to apps even if you are technically running as administrator. Partially because very few people were actually using limited accounts as has been recommended for a long time, partially because many Windows programs are shoddily designed and do expect full administrator privilages and UAC was fairly effective in convincing developers to design their programs better I would say. If you genuinely want full adminstrative priviliges all the time and for all programs then turn it off. Of course this isn't recommended in any common OS I know of (and in fact some like Ubuntu actively try to stop people running as root/superuser all the time).  Nil Einne (talk) 01:41, 7 November 2010 (UTC)

urls
I have 700 html files, and I need to extract all urls from them which contain "/example123/". I'm on Windows 7. How could this be done, preferably with free software? 82.44.55.25 (talk) 10:30, 6 November 2010 (UTC)


 * You can get grep for free for Windows and then grep for "http[^'\"]*/example123/[^'\"]*". The exact syntax of the grep may depend on the implementation of grep in Windows. -- k a i n a w &trade; 14:31, 6 November 2010 (UTC)
 * I found a windows gui version for it, which has worked quite well. Thanks 82.44.55.25 (talk) 14:59, 6 November 2010 (UTC)
 * Grep is good. I also wrote a short vbscript for this in 07. Maybe it will be of use to somebody.Smallman12q (talk) 15:25, 6 November 2010 (UTC)

My graphics card; not good enough?
I have a ATI mobility radeon HD 4530 graphic card/processor.

I suspect it might not be enough for a program I will soon run on my computer. The program's sytem rquirements: Minimum requirements:    ATI Radeon 7200 Recommended requirements: ATI Radeon X1600

is my graphic card outdated, is it absolutely necessary that I upgrade or get a new graphic card altogether if I am to be able to run the program? Or is my current graphic card good enough to match the minimum requirements? I know it's more to it than only graphics card but it seems to me this is probably where my computer's weakness lies. It's a laptop, so maybe it's not so surprising if the graphic card isn't among the best.

Is it possible to upgrade or get new graphics cards like the ATI Radeon 7200 or ATI Radeon X1600 on the internet, or do I have to go to a software store?

Krikkert7 (talk) 12:02, 6 November 2010 (UTC)


 * It is not outdated, at least for these requirements. 7200 is very old (from year ~2001 or 2002) and x1600 is newer, but still older than 4530 (x1600 is from 2006). 4530 might be quite low end device, but it still should be comparable to x1600. -Yyy (talk) 12:28, 6 November 2010 (UTC)

hm.. that's good news I would say, but quite different than what I read earlier. But that's the good thing I guess about asking around, getting several opinions. Krikkert7 (talk) 13:00, 6 November 2010 (UTC)

is it possible to distribute a large database as many ways as you want?
or, in general, no? 84.153.222.232 (talk) 13:25, 6 November 2010 (UTC)


 * You need to define "distribute". If you mean "send the data to another location", the answer is "yes".  You can send it over the web.  You can remote connect through an ODBC interface.  You can SFTP CSV files.  You can put it on a CD, duct-tape it to a monkey, and send him overseas on a freighter.  If you intend "distribute" to mean "show the data to users", you are referring to what most people call a "view".  You can set up as many views as you like. --  k a i n a w &trade; 14:29, 6 November 2010 (UTC)


 * If you mean, can you have the database exist in different chunks on different machines, you could, but it would present certain practical difficulties. --Mr.98 (talk) 14:46, 6 November 2010 (UTC)


 * I think the OP means federating the database - distributing its data across many servers. This is possible, but is a feature that is significantly easier on commercial database platforms (like IBM DB2), as compared to, say, MySQL.  Here's a technical-series from IBM called Data Federation and Data Interoperability.  Here, for comparison, is the same concept in MySQL.  Oracle calls this "clustering" although it has fewer features and capabilities; they have a white paper comparing federation to clustered distribution: Database Architecture: Federated vs. Clustered.  Nimur (talk) 15:02, 6 November 2010 (UTC)

Whole Disk Encryption
Does whole disk encryption cause extra stress on a hard drive, such as for re-reading the keys and so forth? I'm specifically thinking of an SSD drive, and whether whole disk encryption will shorten its useful life due to lots of extra read/writes. —Preceding unsigned comment added by 75.75.29.90 (talk) 14:49, 6 November 2010 (UTC)
 * No, it doesn't cause any significant extra stress for the hard drive. The keys (or key files) are relatively small, ussually less than 1MB so there's no extra stress there (The keys are read once on boot and stored in ram). The only increase in read/write will come from the actual extra space the encrypted form takes...though this ussually isn't significant (depends on algorithm). The actual encryption may stress the CPU a bit though...unless the encryption is performed by a dedicated chip on the hard-drive. But overall, the answer is no...disk encryption doesn't stress/reduce the life of the hd.Smallman12q (talk) 17:07, 6 November 2010 (UTC)
 * When using popular full-disk encryption products like TrueCrypt and BitLocker, the encrypted data doesn't take up any more space. There are no extra disk accesses whatsoever except at boot time. Well, technically, since the encryption code takes up a small amount of RAM, there might be a little bit more virtual memory paging, but I doubt you'd notice the difference. -- BenRG (talk) 23:13, 6 November 2010 (UTC)

smallest, most compact and self-contained C++ compiler for Windows
so, my favorite editor is notepad2, which is TINY, and totally self-contained. Really just an .exe and maybe an .ini to go with it. I realize, due to at least standard libraries, that I do not have much of a hope of finding a similar Windows c++ compiler. Still, I dare hope.

'''what is the smallest, most compact and self-contained, C++ programming environment for Windows? We're talking something that you could run on a netbook and is not a messy, huge environment, but just a compact set of files. thank you!''' 84.153.207.135 (talk) 17:56, 6 November 2010 (UTC)


 * Dev-C++ is pretty self-contained. It is a complete IDE, including a text-editor and build system; it uses MinGW (gcc) as its compiler. Alternately, you can download gcc, packaged for Windows as mingw ("Minimalistic GCC for Windows), if you only want a command-line compiler.  Microsoft Visual Studio Express is pretty light-weight as well.  Nimur (talk) 18:03, 6 November 2010 (UTC)


 * Microsoft's C++ compiler runs from the command line and is configured with environment variables, very much like gcc (though all of the command line switches have different names). I haven't compared their sizes, but I suppose they're similar if you only keep the headers and libraries that you plan to use. Microsoft's compiler is quite a bit faster than gcc, which might matter if you want to do a lot of big builds on battery power. It also optimizes somewhat better for x86. Other than that, you could go either way. -- BenRG (talk) 23:38, 6 November 2010 (UTC)

how does this work?
how does http://www0.us.ioccc.org/years.html#1988 "westley" here work? (1988). I mean, could someone write a 300-word paragraph describing in excrutiating detail how the pseudocode would look if it were written in nearly formal English? I am just having too much trouble following it... What the program does: SPOILER:. it's supposed to calculate pi by looking at its own area. strikeout for spoiler. /SPOILER84.153.207.135 (talk) 18:22, 6 November 2010 (UTC)


 * Did you read the hint? It's important that you either make the adjustment in the hint, or use a really old compiler that does dumb preprocessing. I'll assume you're interested in the original version, with the dumb preprocessing.
 * The first line of F_OO is 4 instances of the "_" macro separated by 3 minuses. Here's how it looks after preprocessing:

-F<00||--F-OO--;--F<00||--F-OO--;--F<00||--F-OO--;--F<00||--F-OO--;
 * It has become a sequence of 4 statements. The first one is different from the others, because it didn't have a minus before it. Each statement is a pair of clauses separated by "||", the short-circuit operator which evaluates the expression on the right only if the expression on the left was false. The result of the "||" operator is not used. So the statements are equivalent to

if(!(-F<00)) --F-OO--; if(!(--F<00)) --F-OO--;
 * The double 0 isn't important, it's just a zero that helps put more "foo"-looking things in the code. -F<0 is true if F>0, which will never happen in this program because F starts at 0 and decreases from there. So in the first if statement, the condition is true and the --F-OO-- gets executed. --F-OO-- is equivalent to (--F)-(OO--) meaning F is decremented, and OO is decremented, and the old value of OO is subtracted from the new value of F, but that last part doesn't matter since the result of the subtraction is not used. From their initial values of 0, F and OO have both become -1.
 * In the second statement, --F<00 causes F to first be decremented again, then its new value (-2) is compared to 0. -2<0 is true so the --F-OO-- is not evaluated. The third and fourth statements act likewise, bringing F down to -4 while OO stays at -1.
 * The following lines are similar. For each line, the number of times F is decremented is the number of "_" expansions in the line, while OO is decremented only once per line. At the end, OO is the count of lines, corresponding to the diameter of the circle, and F is the total count of "_" expansions, corresponding to the area of the circle. They're both negative, but that's fixed in the printf statement. 4*area/diameter/diameter is printed. 67.162.90.113 (talk) 21:48, 6 November 2010 (UTC)
 * There's an article at International_Obfuscated_C_Code_Contest...though its scant on details.Smallman12q (talk) 01:30, 7 November 2010 (UTC)

bandwidth
Approximately how much bandwidth is used when a program, such as a web browser or crawler, asks the remote server how new a file is? 82.44.55.25 (talk) 21:22, 6 November 2010 (UTC)


 * OK so here's my browser asking Wikimedia about the file http://bits.wikimedia.org/skins-1.5/vector/images/arrow-down-icon.png?1


 * My browser sends:

GET /skins-1.5/vector/images/arrow-down-icon.png?1 HTTP/1.1 Host: bits.wikimedia.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US;rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 (.NET CLR 3.5.30729) Accept: image/png,image/*;q=0.8,*/*;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 115 Connection: keep-alive Referer: http://bits.wikimedia.org/ skins-1.5/vector/main-ltr.css?283-5 If-Modified-Since: Wed, 05 May 2010 19:06:38 GMT If-None-Match: "bc-485dd86856b80" Cache-Control: max-age=0
 * And the server replies the file was modified in May:

HTTP/1.1 304 Not Modified Date: Sun, 07 Nov 2010 08:35:46 GMT Via: 1.1 varnish X-Varnish: 1179536182 Last-Modified: Wed, 05 May 2010 19:06:38 GMT Cache-Control: max-age=2592000 Etag: "bc-485dd86856b80" Expires: Tue, 23 Nov 2010 14:42:06 GMT Connection: keep-alive
 * That's 830 bytes, but most of the stuff the browser sends are not necessary, so you can make it less than half a K. F (talk) 08:45, 7 November 2010 (UTC)


 * It's also gzip encoded (Look at the Accept-Encoding line), so it's smaller. However there is the TCP/IP overhead, which could easily make up for what the compression gains. Shadowjams (talk) 04:19, 8 November 2010 (UTC)