Wikipedia:Reference desk/Archives/Computing/2008 July 13
Computing desk | ||
---|---|---|
< July 12 | << Jun | July | Aug >> | July 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. |
July 13
[edit]Editing SVG files
[edit]I run a PC with XP. I have both Paint Shop Pro X and have downloaded Inkscape. Both programs when I endeavour to edit Image:Gamma plot.svg omit the red lines. Why? What can be done about it? -- SGBailey (talk) 00:04, 13 July 2008 (UTC)
- Inkscape doesn't seem to like the stroke style used to draw the red lines. Here's how to edit everything - open the diagram in inkscape, edit>selectAll, then set the stroke-style to flat colour. That zaps the colour info, but does make all the lines visible (and restoring the colour info shouldn't be much work). -- Finlay McWalter | Talk 00:15, 13 July 2008 (UTC)
- On looking at it, the affected objects have
stroke:currentcolor
definitions, and this Inkscape bug suggests Inkscape doesn't render that correctly. Indeed some of those reporting on that bug complain they get it with SVGs generated by GNUplot, which generated this particular plot. -- Finlay McWalter | Talk 00:21, 13 July 2008 (UTC)
- On looking at it, the affected objects have
- Yeah, doing a replace-All (in emacs) of "currentcolor" with "red" (just as an example) fixes the problem (there's a few too many red things, but that's easy fixed). __ Finlay McWalter | Talk 00:25, 13 July 2008 (UTC)
Thanks -- SGBailey (talk) 11:22, 13 July 2008 (UTC)
Admin. Password win. XP
[edit]on a visit to my Grandpa's (a rare ocassion) i found that his pc was not working properly, when i turned it on a HP invent logo popped up for a long time and than after a long time it would say something like boot disc failure... well anyways after mch trouble i managed to find out that the harddrive was the problem, so i ran over to circuit city and bought a new one real quick and then plugged everything back in and ran te system recovery discs (took a ver long time cuz there are 8 discs and all of them take around 20 minutes)
- Well anyways now everything looks great although when turned on it goes to a login screen, the only acount being the adminstrator's, ive tried a TON of different things including just leaving it blank but nothing will work...
This computer happens to be my uncle's who passed away recently so there is no way to ask him what he had the password set as, even though i do not think that would be the problem cause i switched out the harddrive Any suggestions on what i am supposed to do, everything will be much appreciated, please excuse my formating errors —Preceding unsigned comment added by 67.190.43.252 (talk) 03:33, 13 July 2008 (UTC)
- There are quite a lot of utilities that will help you with this. Try http://home.eunet.no/~pnordahl/ntpasswd/. Basically this (and all the others like it) have you boot to a floppy disk which runs a flavour of Linux, and mounts your NTFS hard disk. It then has a utility which lets you set the Administrator password for Windows. Of course it gives you call kinds of scary warnings, but I've used it several times on systems where the user has disappeared or forgotten their local admin password, and it's always worked reliably for me. Hope this helps. KiwiBiggles (talk) 03:44, 13 July 2008 (UTC)
Merging iTunes Playlists
[edit]How would I go about merging 2 iTunes playlists? I have been ripping my music at the highest bitrate for several weeks now... and the 320gig external HDD I assumed would be large enough just topped out. So I am going to move that file to one of the teraboxes I have, but none of them atm has enough room itself for the folder, so I would like to continue ripping my music from CD's to another external hard drive, and later when I get the space issues all figured out, merge them into one folder, and one playlist. so my question is, how do I go about doing that? Is it even possible?
Sorry if this has been gone over before, I searched and searched but couldn't find anything in the archives. Dureo (talk) 03:53, 13 July 2008 (UTC)
- There are options to import/export songs in the File menu, but I'm not sure if this is what you're looking for. Do you want your whole library or a custom playlist? --Russoc4 (talk) 19:12, 13 July 2008 (UTC)
- I just want to continue burning to an addt ext hdd, and once I get another larger ext hdd, merge it all into one big music folder. Dureo (talk) 20:00, 13 July 2008 (UTC)
- I really don't think you can have your iTunes library in several locations across several hard drives -- at least not with vanilla iTunes. This is the kind of a thing some user might well have created a modification for, of course, but iTunes itself does not appear to have this kind of functionality. At least no user-adjustable setting seems to have anything like this. -- Captain Disdain (talk) 23:46, 13 July 2008 (UTC)
Reshuffling the directory structure of a website
[edit]I've inherited several fairly large chunks of a much larger website, and the maintenance of the former (all conveniently mirrored on my hard drive and in a USB memory thingie). Let's say that the former chunks are
- www.domain.tld/business/........
- www.domain.tld/this/is/a/long/path/personal/........
- www.domain.tld/css/........
- www.domain.tld/image/........
with subdirectories aplenty. All the links among these are relative, and there are plenty of links between the first two. (There are few links from elsewhere in the larger site to "my" chunks.) I now want to change the first two to, say
- www.domain.tld/main/business/........
- www.domain.tld/main/personal/........
Of course I'd do this to the image on my hard drive, check all the links, add redirects from the old addresses, and then uplod the lot.
There are so many links to change that doing this would be rather tedious but tolerable. There aren't so many links to change that I'd want to be bothered to learn perl (?) or awk (?) in order to automate the job. I wonder, however, if some obliging person might have written some software that presents a form asking for information about where things are now relative to the root, and where you want them relative to the root, and that then edits the files accordingly.
Half the files are in Shift-JIS, half in UTF-8; half are in HTML, half in XHTML. I have access to computers that run Kubuntu, Mac OS 10.5, and Windows Vista. -- Hoary (talk) 07:40, 13 July 2008 (UTC)
- Cook links don't change, but you could alias it to provide access from the long and short versions. The advantages of this would be the ability to use short links while not needing to worry that you haven't caught every link that needs to be changed. You can set up an alias in whatever your website config files are (eg: Apache.conf).
- To change the urls, I'd back up all the files, then use the following script:
for A in $(find . -name '*.html' -print);
do
echo "Will update $A";
# sed --in-place -re 's/\/this\/is\/a\/long\/path\//\/this\/is\/a\/short\/path/g' "$A";
done;
- Run it once to list the files which will be changed (all the *.html files in this case), then run it with the sed line uncommented to actually do it. You should edit the 's/.../.../g' part to have the old path in the first bit and the new path in the second bit, with the slashes escaped with a backslash (ie / becomes \/). This is a regular expression, so avoid the special regexp characters. --h2g2bob (talk) 15:46, 13 July 2008 (UTC)
- Thank you. I do like this "software tools" approach. Of course I'd back up all the files -- actually they all add up to very little compared with even your bog standard 1GB USB memory device, so I can have multiple mirrors and only ftp one of these when I'm sure I've got it right. -- Hoary (talk) 23:52, 13 July 2008 (UTC)
- I use Adobe Dreamweaver at work, and it can do this very neatly, moving the files and updating the linked references. Check Category:Web development software, especially Category:Content management systems for other applications. --—— Gadget850 (Ed) talk - 15:27, 13 July 2008 (UTC)
- Moving the files is of course trivial, it's updating the links that's irritating. I believe that Dreamweaver costs real money: OK if I had reason to use it later, but not otherwise. As for Category:Content management systems, they're described in opaquely abstract terms ("a system used to organize and facilitate collaborative content creation" etc etc) so I'm lost. Category:Open source content management systems is a bit more promising, but somehow I think that using sed will take less time than even locating the right CMS tool for the job. Still, thank you for trying to help, and I may yet have a follow-up question. -- Hoary (talk) 23:52, 13 July 2008 (UTC)
Technology behind the PS3's on/off switch
[edit]What is the technology behind the PS3's on/off switch (the one at the front of the console). I can't see any mention of it in the PS3 article. Thanks PSIII (talk) 08:36, 13 July 2008 (UTC)
I don't know exactly. I'm pretty sure it's checking for conductivity across the two metal pieces. Try putting a screwdriver across them. It works fine, but if you use a plastic piece it won't work. APL (talk) 14:50, 13 July 2008 (UTC)
I don't know this switch but I'm quite familiar with switch technology - do you have to press it/just touch it/just let your finger go near it without touching?87.102.86.73 (talk) 15:28, 13 July 2008 (UTC)
I'm guessing that it's a 'hi-tech' switch so maybe Touch switch will be useful.87.102.86.73 (talk) 15:33, 13 July 2008 (UTC)
- Looking at that article I'll bet it's a "Resistance touch switch". The two electrodes double as the icon indicating the switch. APL (talk) 17:38, 13 July 2008 (UTC)
- Warning: Original Research! Experimentation by poking it (and the eject button) in different ways suggest it's a capacitance switch. Neıl ☄ 15:09, 14 July 2008 (UTC)
Fun fact: The PS3 reads you mind. There is not spo..button. --mboverload@ 20:13, 14 July 2008 (UTC)
Getting rid of 3dsps.x3d trojans.
[edit]Sorry if this question has been asked many times before, but at this point I'm really worried. I have Norton Internet Security and AntiVir installed on my computer; last night, when Norton was scanning the computer, it found three trojan horses {3dsps.x3d type, which I found out to be known also as Win32.TrojanSpy.Peed}. Basically, Norton detected them, but stated not to be able to delete/put them into quarantine; therefore, I started looking for possible solutions on the web, only suceeding in downloading programs which were not compatible with Vista{which I have} or scanned my computer and then needed to be purchased in order to destroy the adware/malware and such, which I can't afford at the moment. Weird thing, not all of these programs {like Avast} detected the trojans; anyway, I thought I had solved the problem when I downloaded SUPERantispyware, which I had seen rated well on different sites; point is, when I scan my computer with it, it finds only cookies. Norton meanwhile keeps telling me I have those three trojans; it tells me where they should be, it's a file I downloaded from the Net, but when I scan it with other programs {SUPERantispyware included} it founds nothing but cookies; I would prefer to avoid deleting those file alltogether, because I really need it. Is Norton going crazy? If not, how do I get rid of those 3dsps.x3d trojans, possibly without deleting all the file I downloaded but only the infected part? I will really be grateful if you could help me with this and I apologize it was such a long post. —Preceding unsigned comment added by 79.26.93.138 (talk) 15:17, 13 July 2008 (UTC)
- Try booting into safe mode (press F8 repeatedly while your PC is booting up, and select "safe mode" from the menu which appears) and then scanning with Norton, you may have better luck cleaning the files. — QuantumEleven 11:56, 15 July 2008 (UTC)
Alternative firmware for Nokia 3220
[edit]Is alternative firmware available for my Nokia 3220 phone? If so, what benefits would it confer? NeonMerlin 15:50, 13 July 2008 (UTC)
DVD drive
[edit]I'm thinking about getting an IDE CD/DVD-combo-drive-thingy for my comp. When I hook it up: 1) Would I have to use an 80-wire cord, or could I use a 40-wire, 2) Would I need some special software, or could I just immediately play DVDs on Windows Media Player? Thanks, flaminglawyerc 18:37, 13 July 2008 (UTC)
I believe you are asking if you need to hook your drive to the IDE or Floppy connector. It must connect to IDE. You should have two IDE connectors on the motherboard (having only one is rare - except in new computers where there are two SATA and no IDE connectors).If you already have something plugged into both IDE connectors, note that you can connect two devices on each connector. Some IDE cables only have two plugs (one for the board and one for the drive). Most have three, one for the board, one in the middle for one drive and one on the end for another drive. You will probably need to install drivers for the drive if it has burning capability, but most drives come with a driver disk to make installation easy. -- kainaw™ 19:29, 13 July 2008 (UTC)
- If you want to successfully use any of the faster transfer modes, you want the 80 wire cable. Really, nowadays, there's no reason to use the 40 wire cable; the 80-wire is much better at carrying fast signals.
- (striking comment above) I see. I didn't realize he was asking about an ungrounded IDE or grounded IDE cable. The grounded one (with 80 wires) is required for successful DMA. -- kainaw™ 11:57, 14 July 2008 (UTC)
- On the IDE/ATA bus, DMA is only indirectly related with transfer modes/rates. Whether the transfer is done using programmed I/O or direct memory access is actually a function of what's going on inside the IDE bus interface chip; nothing different happens on the IDE bus cable. You could program your IDE bus controller to use DMA transfers even at the slowest IDE transfer rates and for these, the older 40-wire cable would suffice. Most people wouldn't do that, of course; they're out for speed so the tendency is to use the fastest supportable IDE bus transfer rate and DMA transfers to/from host memory. And to do those fastest IDE bus transfers, you do need the 80-wire cable. (I once wrote IDE/ATA/ATAPI device drivers for a living.)
LCD display commands
[edit]Hi all,
I have one of these alphanumerical LCDs attached at a C-Control. As most of these LCDs are standardized (or at least I hope so)... where can I find out a list of commands I can send to them?
Thanks,HardDisk (talk) 18:44, 13 July 2008 (UTC)
- PS: Yeah, I have googled, but I found only documents which state how to utilize the D0-7 pins, but I need the hexadecimal stuff (for example 01h=CLS). HardDisk (talk) 18:53, 13 July 2008 (UTC)
- Manufacturer data sheets are the way to go. A quick google search for "DEM16217" (the code on the example illustrated to the right) brought up this PDF datasheet which seems pretty comprehensive. Astronaut (talk) 22:52, 13 July 2008 (UTC)
Two television questions
[edit]I've got two questions:
- On my very old (>10 years) TV, the the picture has shifted to the right a bit, just enough to obscure the last number of CNN's stock display. Is this a sign I need to get a new TV?
- Does aluminum foil actually improve TV reception? If not, are there any other tips? I have a small battery powered TV and am going to be in Fulton County, Pennsylvania, which is pretty much a dead spot when it comes to over-the-air TV reception.
Thanks, Xenon54 18:52, 13 July 2008 (UTC)
- If you are skilled and not afraid of extremely high voltages, open the housing and clean the boards from dust. This helped my dad's old CRT. HardDisk (talk) 18:54, 13 July 2008 (UTC)
- And for what the aluminium foil? Better get an active-amplified antenna or satellite dish.HardDisk (talk) 18:55, 13 July 2008 (UTC)
- I'm talking about a two-inch TV (for the second one), so it would be a bit hard to hook up a satellite dish. Xenon54 19:03, 13 July 2008 (UTC)
- You take the satellite reciever's antenna output, take some copper wire and connect the antenna output signal pin to the antenna of the mini tv. HardDisk (talk) 19:07, 13 July 2008 (UTC)
- Would this be possible with a regular antenna as well? Xenon54 20:57, 13 July 2008 (UTC)
- You take the satellite reciever's antenna output, take some copper wire and connect the antenna output signal pin to the antenna of the mini tv. HardDisk (talk) 19:07, 13 July 2008 (UTC)
- I'm talking about a two-inch TV (for the second one), so it would be a bit hard to hook up a satellite dish. Xenon54 19:03, 13 July 2008 (UTC)
Question 1
- you can adjust this horizontal shift, on old tv s there is often a hole at the back where you insert a (electrically insulated) screwdriver, and turn a variable capacitor/inductor - if you can find the hole, (it should be marked h.shift or h-something) you can adjust it yourself.
- alternatively a TV technician can take the tv apart and do this for you. It shoudn't require any new parts and is easily changable.
- Obviously don't poke around in the back of the tv unless you know what you are doing.87.102.86.73 (talk) 19:23, 13 July 2008 (UTC)
- OR you could get a new tv.. 87.102.86.73 (talk) 19:48, 13 July 2008 (UTC)
- I doubt adjusting hshift will work if the thing is dusted...HardDisk (talk) 20:14, 13 July 2008 (UTC)
- If it has spontaneously shifted to the right, that probably does indicate there's something wrong with the TV. The adjustment mentioned above may, or may not, fix it. It might last this way for years, though, so, if you can live with it, you can just keep it until it dies completely. I've had many TVs have serious problems that I've learned to live with. I had one which had the volume go to maximum on it's own, so I disabled the internal speakers and used external speakers with a volume control instead. I had another that went to a single horizontal line for a half hour until it warmed up, so I just left it on with no input to the RCA jacks to keep it warm. StuRat (talk) 22:52, 13 July 2008 (UTC)
- Aluminum foil can slightly improve reception if you put two balls on the ends of rabbit ears. However, repositioning and/or rotating the antenna is likely to have even more of an effect, so try that first. StuRat (talk) 22:56, 13 July 2008 (UTC)
Java colorisation question
[edit]I am implementing a colorisation program in Java Swing. The actual colorisation of black-and-white images is done at the moment with this code:
private void floodFill(int x, int y, int originalRgb, boolean[][] visited) {
if (x<0 || x>=160 || y<0 || y>=120) {
return;
}
if (visited[x][y]) {
return;
}
int offset = x + image.getWidth() * y;
int rgb = pixels[offset] & 0xFFFFFF;
visited[x][y] = true;
if (Math.abs(value(rgb)-value(originalRgb)) > 0xF) {
return;
}
//pixels[offset] = (0xFF << 24) | rgb;
pixels[offset] = tint(colours[currentColour].getRGB(), value(rgb));
floodFill(x-1, y, rgb, visited);
floodFill(x, y-1, rgb, visited);
floodFill(x+1, y, rgb, visited);
floodFill(x, y+1, rgb, visited);
}
private int value(int rgb) {
int r = (rgb >> 16) & 0xFF;
int g = (rgb >> 8) & 0xFF;
int b = rgb & 0xFF;
return Math.max(r, Math.max(g, b));
}
private int tint(int rgb, int value) {
int r = (rgb >> 16) & 0xFF;
int g = (rgb >> 8) & 0xFF;
int b = rgb & 0xFF;
int r2 = (int)(r * (value / (double)0xFF));
int g2 = (int)(g * (value / (double)0xFF));
int b2 = (int)(b * (value / (double)0xFF));
return (0xFF << 24) | (r2 << 16) | (g2 << 8) | b2;
}
The idea is that calling floodFill() on a pixel that the user has clicked on causes a recursive flood fill of all nearby pixels whose HSV value component is similar enough, using the current colour. The colours cycle per click through red, yellow, green, cyan, blue and magenta. The only problem I have is this: Clicking on a part of the image that has already been coloured red causes it to be coloured solid black. This happens only on red parts - clicking on parts that have not been coloured yet, or on parts that have been coloured any other colour, works fine. I can't figure out what is causing this. Can anyone help? JIP | Talk 19:06, 13 July 2008 (UTC)
- I haven't read the whole thing, but the rgb = pixels[offset] & 0xFFFF looks fishy. It's only using 16 bits, while the rest of the code is oriented toward 32-bit color (8 bits red, 8 bits green, 8 bits blue, 8 bits alpha?) --tcsetattr (talk / contribs) 20:01, 13 July 2008 (UTC)
- I removed the & 0xFFFF operation, but it still doesn't work. Now, an area coloured red stays red forever. Uncoloured areas, or areas coloured any other colour, work fine. What is so damned special about the colour red? JIP | Talk 20:14, 13 July 2008 (UTC)
- Hard to say. Still sounds like a plain bug, as in a typo or a logic error somewhere. Can you replace the code above with the exact version you've got now? Also, I see some oddities in your code: for example, it seems you should either pass
originalRgb
instead ofrgb
when callingfloodFill()
recursively, or (depending on which effect you want) you should move thevisited[x][y] = true
line below theMath.abs(value(rgb)-value(originalRgb)) > 0xF
check. The way you have it currently, your flood fill has a directional bias. Anyway, if it'soriginalRgb
you want to compare each pixel against, why not simply computevalue(originalRgb)
once and pass that around instead of recomputing it each time? —Ilmari Karonen (talk) 13:47, 14 July 2008 (UTC)- I checked it again and found the problem. I had fixed the 0xFFFF bit at the wrong place. The above version is what I have now, and it's working. As for your suggestions, the first one would actually make it worse - I want the value check to happen dynamically: as the flood fill progresses, it's supposed to check for value differences against the current pixel, not against the original one. This way it can find hard edges more effectively. Using the original value will only colour part of the "flat" areas between hard edges. I know, I just tried it. Your second suggestion, though, improves the algorithm, it's now colouring the "flat" areas more thoroughly. Thanks for your suggestions. JIP | Talk 17:13, 14 July 2008 (UTC)
- Hard to say. Still sounds like a plain bug, as in a typo or a logic error somewhere. Can you replace the code above with the exact version you've got now? Also, I see some oddities in your code: for example, it seems you should either pass
- I removed the & 0xFFFF operation, but it still doesn't work. Now, an area coloured red stays red forever. Uncoloured areas, or areas coloured any other colour, work fine. What is so damned special about the colour red? JIP | Talk 20:14, 13 July 2008 (UTC)
How do I fix a broken link?
[edit]The article resulting from searching for the word "Blog" has an external link that is broken. Here is the click-on text of the link in the article's External Link section:
Computer Law and Security Report Volume 22 Issue 2, pages 127-136, "Blogs, Lies and the Doocing" by Syliva Kierkegaard.
70.224.39.60 (talk) 19:35, 13 July 2008 (UTC)
- I have no idea how to add or fix one of those references, which is probably a good indication that they are too damn complicated for the average editor to use. However, note that the link to that book under "External Links" at the bottom of the article does work, although it only gives you the abstract and table of contents for free. They want $31.50 to read the full article. That's probably why the ref fails, it's trying to go directly to a section of the article and that's not allowed until you fork over cash. I have reservations about linking to pay sites like this, as it's bound to cause frustration (how many people are willing to pay that much money to verify a source for a Wikipedia article ?). StuRat (talk) 22:15, 13 July 2008 (UTC)
- Here's our article: blog.
- Here's the broken ref: "In Singapore, two ethnic Chinese were imprisoned under the country’s anti-sedition law for posting anti-Muslim remarks in their weblogs.[1]"
- Here's the section with the broken ref: Blog#Political_dangers.
- Here's the good link: "* Computer Law and Security Report Volume 22 Issue 2, Pages 127-136blogs, Lies and the Doocing by Sylvia Kierkegaard (2006)"
- Here's the location of the good link: Blog#External_links. StuRat (talk) 22:23, 13 July 2008 (UTC)
- ...now the "good link" seems to be failing, too. Perhaps it's using a temporary web address that goes away in short order. StuRat (talk) 22:26, 13 July 2008 (UTC)
- I just went to that site and found the abstract again, now let's see if this link breaks after a few minutes: [1]. StuRat (talk) 22:35, 13 July 2008 (UTC)
Wireless network security
[edit]My nephew has been bugging me about letting his DS get on the wireless network here at home. However, I'm a bit skittish because the DS doesn't support anything other than WEP. I already do MAC address filtering, but is there anything else I can do to secure the network if I decide to give in? Thanks. 24.8.206.126 (talk) 20:28, 13 July 2008 (UTC)
- Everything is hackable when you use WEP. Get some cheap AP and set it up in a way it provides WEP WLAN when your nephew is at home; set it up in a way it can only access the Internet. (and switch it off when your nephew isn't at home so your neighbours can't abuse your connection) HardDisk (talk) 21:18, 13 July 2008 (UTC)
- (ec)The only thing I can suggest is to buy (2nd hand) second (a WEP compatible) gateway and run it in the DMZ of you main gateway. That way if someone gets into the WEP (which isn't much of a challenge to a savvy script-kiddie) all he'll get is a free internet connection rather than access to your home network (and so he'll just get you convicted for warez/kiddieporn crimez) - you can always turn that gateway on only when nephew is visiting. Incidentally MAC filtering is essentially useless as a security measure, as WEP/WPA/WPA2 sends the MAC in the unencrypted part of the packet, so it's not very hard for Mr Kiddie to spoof the MAC of a legitimate client. -- Finlay McWalter | Talk 21:25, 13 July 2008 (UTC)
- Come off it, how likely that your home network will be seriously compromised during your nephew's brief visit? Set up his MAC address, set up WEP and turn off your PC. Go back to the regular settings when he's gone. Astronaut (talk) 23:02, 13 July 2008 (UTC)
24.8.206.126, if you are technical you can run DD-WRT on your router. You can run WPA and WEP at the same time. Keep in mind that it is well known how to hack a WEP network. It has been done in around 3 minutes at Defcon. However, I don't think anyone cares about your network that much. --mboverload@ 23:05, 13 July 2008 (UTC)
optimise
[edit]Somebody asked a question about program efficiency above see Wikipedia:Reference_desk/Archives/Computing/2008_July_10#Efficient_Programming - there were some issues about stacks and recursion etc.. I took a permutation algorthym and tried to remove the recursive calls.. (The aim was to generate all the permutations of 123456789 eg swapping the digits)
I came up with (eventually)
- dim a(9) an array holding the digits to be permuted
- dim c(9) an array holding the equivalents of the pointers in 9 for/next loops
- for x=1 to 9 : a(x)=x : c(x)=x: next x initiate both arrays - they happen to be the same
- p=1 this points to the current depth of traversal
- LOOP1 : swap ( a( c(p) ) , a( p ) )
- increment p
- if p<10 the goto LOOP1
- print the ouput number formed by a() ie print a(1)*10^9+a(2)*10^8 ..etc
- LOOP2 : decrement p
- if p=0 then stop
- swap ( a( c(p) ) , a( p ) )
- increment c(p)
- if c(p)<10 then goto LOOP1 equivalent to a "next c() instruction"
- c(p)=p this effectively re-initialises a for/next loop
- goto LOOP2
As a general method - can anyone recommend improvements? eg for compiled speed?87.102.86.73 (talk) 21:59, 13 July 2008 (UTC)
- Can you write up some actual code (FORTRAN, if possible), so I can compare performance with the two methods I've tried already (see previous section) ? StuRat (talk) 03:34, 14 July 2008 (UTC)
- Actually I don't know fortan syntax that well.. the dim a(9) I guess is the same as a make_array "a" size 9.
- swap a(c(p)),a(p)) can be replaced with z=a(c(p)) : a(c(p))=a(p) : a(p)=z
- increment and decrement if not supported is the same as x=x+1 or x=x-1
- The 'if's can all be terminated with 'else'
- This is the most simple/readable pseudo-code I can make if you want to try translating it:
- 10 INTEGER_SMALL : x,p,z
- 12 INTEGER_LARGE : t
- 20 INTEGER_ARRAY_OF_SMALL : a(9),c(9)
- 22 INTEGER_ARRAY_OF_LONG : n(362880)
- 25 t=1
- 30 for x=1 to 9
- 40 a(x)=x
- 50 c(x)=x
- 60 next x
- 70 p=1
- 100 z=a(c(p))
- 102 a(c(p))=a(p)
- 104 a(p)=z
- 110 p=p+1
- 120 if (p<=9) then goto 100 else continue
- 150 n(t)=100000000*a(9) + 10000000*a(8) + 1000000*a(7) + 100000*a(6) + 10000*a(5) + 1000*a(4) + 100*a(3) + 10*a(2)+ a(1)
- 160 t=t+1
- 170 goto 200 ! delete this if printing is required
- 180 print n(t-1)
- 200 p=p-1
- 210 if (p=0) then stop/end program else continue
- 220 z=a(c(p))
- 222 a(c(p))=a(p)
- 224 a(p)=z
- 230 c(p)=c(p)+1
- 240 if (c(p)<=9) then goto 100 else continue
- 250 c(p)=p
- 260 goto 200
- (one minor correction made)
That's really BASIC which is pretty much "Fortran-lite" - capitalise everything and I imagine it would work..? 87.102.86.73 (talk) 10:43, 14 July 2008 (UTC) (The method does work by the way in basic)
- Actually, FORTRAN hasn't required all caps for decades (since 1966 ?), although I sometimes still use them to make it easier to read when displaying many lines at small resolution. I'll convert your program to FORTRAN and give it a try... StuRat (talk) 12:58, 14 July 2008 (UTC)
- OK, I convereted to FORTRAN and added some benchmarking code: ([2]). It runs in 0.20 second, so it's about 40% quicker than my fastest method of 0.33 second ... good job ! I do prefer my sorted output in general, however, even though it wasn't a requirement, in this case. PS: I changed the link at the top of this question to a permalink, which will work even after this is all archived. StuRat (talk) 14:49, 14 July 2008 (UTC)
- ! I am actually suprised it runs faster - I was expecting similar results: there's not much overhead in the other methods.
- By the way I think if you replace
- 150 n(t)=100000000*a(9) + 10000000*a(8) + 1000000*a(7) + 100000*a(6) + 10000*a(5) + 1000*a(4) + 100*a(3) + 10*a(2)+ a(1)
- with
- 150 n(t)=100000000*a(1) + 10000000*a(2) + 1000000*a(3) + 100000*a(4) + 10000*a(5) + 1000*a(6) + 100*a(7) + 10*a(8)+ a(9)
- 150 n(t)=100000000*a(9) + 10000000*a(8) + 1000000*a(7) + 100000*a(6) + 10000*a(5) + 1000*a(4) + 100*a(3) + 10*a(2)+ a(1)
- then the output is in order (my mistake again)..
- It was immensly confusing making a recursive function non-recursive.. Usually I'd stick with simple - it's easier to de-bug etc..87.102.86.73 (talk) 16:38, 14 July 2008 (UTC)
- I thought of that change myself and gave it a try, and it makes it closer to numeric order, but not quite. The last value found is 912345678 now. It should be 987654321 to be in numeric order. As for going with the simplest code when the performance difference is trivial, as in this case between 0.20 seconds and 0.33 seconds, I completely agree. Still, it's good to know the more efficient methods, in case they are ever needed for an app where time is critical. StuRat (talk) 20:23, 14 July 2008 (UTC)
- You beat me to it, I just spotted that too.. probably could be fixed with a bubble sort (starting at position P) after each 'up pseudo-recursion level P' loop (or something); which would most likely add .13 (or more) seconds to the time and back where we started.
- Even so the method does have one advantage in that it's extensible or contractable to any length (replace all instances of the number 9 with K and begin with a let K=whatever)
- I'd probably go with the if/then/do or DIY simple recursion ie use the stack myself (if that's supported) - (it compiles to the same thing - meaning the recursive and self implemented stack using loop and the self made version is likely to be either less complex or the same... : an example of which has been discussed at Wikipedia:Reference_desk/Computing#Implementing a flood fill more efficiently87.102.86.73 (talk) 21:08, 14 July 2008 (UTC)
- I'd avoid using a bubble sort for sorting anything more than a dozen items. But, even a far more efficient sort (such as a pointer-based radix sort, in this case) is still likely to increase the elapsed time by more than 0.13 seconds, as you said. StuRat (talk) 23:53, 14 July 2008 (UTC)
I've read the solutions everyone else proposed but did anyone said anything about backtracking, one of the most obvious ones? Sorry if someone did already. Anyway it's quite fast and it also generates the numbers in order. —Preceding unsigned comment added by Ovi 1 (talk • contribs) 08:58, 16 July 2008 (UTC)
- I'm not sure, can you describe this method ? StuRat (talk) 14:04, 17 July 2008 (UTC)
Kaspersky conflicts with my game
[edit]OK, so I installed the Philippine edition of FreeStyle Street Basketball, and what bothers me is that Kaspersky thinks it's a keylogger. I already added the FS binaries to the whitelist, but still the antivirus is warning me of an unknown keylogger, which I think is the game. Any suggestions? Blake Gripling (talk) 23:15, 13 July 2008 (UTC)
- ...And where did you get this Philippine version of FreeStyle...?--mboverload@ 01:30, 14 July 2008 (UTC)
- From the publisher's website. I think my SiS graphics chip is causing the graphics glitches; I played Grand Theft Auto: Vice City there and polygon glitches sometimes occurs. Blake Gripling (talk) 12:43, 15 July 2008 (UTC)
Team Fortress 2 crashes
[edit]My copy of Team Fortress 2 was working perfectly fine before, all of a sudden, it would go to the begining loading screen and freeze. My game was fine one day, the next, hnaging at startup. Please help fix this. I tried reinstalling, everything steam said to do. None of that worked! --69.127.64.22 (talk) 23:26, 13 July 2008 (UTC)
- ^ Kierkegaard, Sylvia (2006). "Blogs, lies and the doocing: The next hotbed of litigation?". Computer Law & Security Report. 22: 127. doi:10.1016/j.clsr.2006.01.002.