Wikipedia:Reference desk/Archives/Computing/2009 July 20

Computing desk
< July 19 << Jun | July | Aug >> July 21 >
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 20

edit

IT certifications

edit

I am looking for a somewhat complete list of certification courses that one can take in the IT field. Is there such a list? Cutno (talk) 00:41, 20 July 2009 (UTC)[reply]

Here's an article to get you started: Professional_certification_(Computer_technology). Taggart.BBS (talk) 08:34, 20 July 2009 (UTC)[reply]

How to merge or update two large folders

edit

I have a Documents folder copied from my previous "old" computer that I want to merge with the Documents folder on my current "new" computer. Both folders are large and complex, with many sub-folders, some nested three or four folders deep, and many files within the folders.

The proceedure I want to follow is: if the old folder has the same name as a new folder then copy the contents of the old folder into the new folder. If the folder names are different then simply copy the old folder. If file names are the same then append "old" to the old file name when copying. This needs to apply to sub-fiolders as well. Ideally I'd also like to be able to check somehow that everything has been copied, with nothing left out.

What would be the best way to do this please? Is there some script language I could use, or a program? I am not very familiar with scripting, and perhaps it needs some sort of "stack" to cope with the sub-folders. I'm using Windows XP. Thanks. 78.146.249.124 (talk) 10:22, 20 July 2009 (UTC)[reply]

Any scripting language should be able to handle this. The logic of the function needs to be such that it can call itself (it needs to be recursive). That way, each iteration of the function will look for more folders to run itself on. It's a good programming task if you want to get to know a new language (filesystem routines and recursiveness are both nice things to play with); just make sure you make a backup first when testing out new things that involve copying files! --98.217.14.211 (talk) 15:37, 20 July 2009 (UTC)[reply]

Thanks. Is there a list anywhere of recursive languages please? Are for example Python, Autoit, or Basic4GL recursive? 78.149.162.38 (talk) 17:46, 20 July 2009 (UTC)[reply]

Stick with Visual Basic since you already know Basic - yes it's 'recursive' - any language worth its salt has recursion capabilities; this is something natural to the workings of a computer along with stacks, registers and linked lists. BTW you should investigate a copy tool called TeraCopy - this might be powerful enough to do your merge with all your rules. Sandman30s (talk) 18:57, 20 July 2009 (UTC)[reply]
Any language that lets you call a function with the same function is recursive. So what you want is a function with a name like SearchAndCopy() that, if it finds a subfolder, runs SearchAndCopy() on it. It'll drill down to every possible subfolder that way. --98.217.14.211 (talk) 19:48, 20 July 2009 (UTC)[reply]


Here, I wrote it for you. It's in C++, but it would be roughly the same in any common language. I added some logic to use "_old2", "_old3" etc if "_old" exists so that the merge can never fail (unless your pathnames exceed MAX_PATH = 260 characters or you have more than 232 similarly-named files in the same directory, in which case the program will hang forever trying filenames). It will never overwrite a file. You'll have to run it from the command prompt and specify the directories as arguments (old first, new second), unless someone feels like adding a directory chooser to it. No warranty. -- BenRG (talk) 20:15, 20 July 2009 (UTC)[reply]

Thanks very much. I've never used C, let alone C++. Do I just find a C++ compiler and compile it, or is there more to it than that? 89.240.51.22 (talk) 08:47, 21 July 2009 (UTC)[reply]

I tried translating it into VB here http://code2code.net/ , which may be more basic-like, but it does not like the include string part at the begining. When I edited out the include lines, it gave about a fourteen line response which seems suspiciously brief. 89.240.51.22 (talk) 09:41, 21 July 2009 (UTC)[reply]

Actually, I think all I want to do is to use the normal Windows XP copying thing, which merges same-name folders for you as standard, *except* that instead of the two options offered when the file names are the same, of either over-writing or not copying, I want to rename. Does anyone have any ideas how this could be done? Perhaps I should move instead of copy, rename everything that was not moved, and then move these. Thanks 78.146.215.136 (talk) 12:14, 21 July 2009 (UTC)[reply]


Source code
#include <stdio.h>
#include <windows.h>
#include <string>
using namespace std;


wstring add_old_extension(wstring s, int n)
{
	if (n != 0) {
		WCHAR suffix[30];
		wsprintfW(suffix, (n == 1) ? L"_old" : L"_old%d", n);
		size_t pos = s.rfind('.');
		if (pos == wstring::npos)
			s.append(suffix);
		else
			s.insert(pos, suffix);
	}
	return s;
}


void copy_file(wstring from, wstring to)
{
	for (int n = 0; ; ++n) {
		if (CopyFileW(from.c_str(), add_old_extension(to, n).c_str(), TRUE))
			break;
	}
}


void copy_dir(wstring from, wstring to)
{
	CreateDirectoryW(to.c_str(), NULL);
	WIN32_FIND_DATAW wfd;
	HANDLE h = FindFirstFileW((from + L"\\*").c_str(), &wfd);
	if (h != INVALID_HANDLE_VALUE) {
		do {
			wstring name = wfd.cFileName;
			if (name == L"." || name == L"..")
				continue;

			wstring from_name = from + L'\\' + name;
			wstring to_name   = to   + L'\\' + name;

			DWORD to_attr = GetFileAttributesW(to_name.c_str());
			bool from_file = !(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
			bool to_file   = !(to_attr & FILE_ATTRIBUTE_DIRECTORY);
			bool to_exists = to_attr != INVALID_FILE_ATTRIBUTES;

			if (to_exists && from_file != to_file) {
				// one is a file, the other is a directory
				for (int n = 1; ; ++n) {
					wstring to_name_old = add_old_extension(to_name, n);
					if (GetFileAttributesW(to_name_old.c_str()) == INVALID_FILE_ATTRIBUTES) {
						to_name = to_name_old;
						break;
					}
				}
			}

			if (from_file) {
				copy_file(from_name, to_name);
			} else {
				copy_dir(from_name, to_name);
			}
		} while (FindNextFileW(h, &wfd));
		FindClose(h);
	}
}


int main() {
	int argc = 0;
	WCHAR** argv = CommandLineToArgvW(GetCommandLineW(), &argc);
	if (argc != 3) {
		printf("usage: %S <old-directory> <new-directory>\n", argv[0]);
	} else {
		copy_dir(argv[1], argv[2]);
	}
}

Indexing and Dictionary based compression

edit

Is it possible to combine "Dictionary based compression" and "Indexing", so that indexing algorithm can use dictionary (hash table) created by compression algorithm ? Is it possible to combine indexing and compression this way ? are there any system already doing like this? is it possible to do it in apache lucene? -V4vijayakumar (talk) 11:21, 20 July 2009 (UTC)[reply]

See Lempel–Ziv–Welch for instance where a dictionary is built up automatically and the text is encoded using it. The usual compression for http is gzip and I'd stick with that though some others are allowed. I've never looked at lucene. Dmcq (talk) 15:07, 20 July 2009 (UTC)[reply]

Which easy-to-use languages allow file copying, folder creation, and altering file names?

edit

Further to my question above about merging two Documents folders, what easy-to-use languages would allow these? I'm most familiar with GWBasic, so I'm looking for Basic like languages or scripts, or perhaps I now have a reason to learn Python if it can do these things. Thanks. 78.146.249.124 (talk) 11:57, 20 July 2009 (UTC)[reply]

Any (real) language can do that. Also, if you only need to cop files, create folders and rename files, you could do with a simple .bat file. --Andreas Rejbrand (talk) 13:28, 20 July 2009 (UTC)[reply]
mmm, the specific operations desired above requires a bit more logical handling than a "simple" .bat file, and even an expert .bat file writer might find it to be something of a chore to write (if it can be done at all). But yes, any language should be able to do this... hopefully one will pick something a bit more flexible than the batch scripting, though! --98.217.14.211 (talk) 15:33, 20 July 2009 (UTC)[reply]

Another thing it would need to do would be to read a file directory. 78.149.162.38 (talk) 17:48, 20 July 2009 (UTC)[reply]

I personally would stick with a scripting language (Python or others like PHP, Perl, or Ruby). It doesn't seem like you need to compile an executable. -- kainaw 18:01, 20 July 2009 (UTC)[reply]
If you're most familar with GWBasic, why not just stick with Visual Basic or VB scripting at least? Sandman30s (talk) 18:52, 20 July 2009 (UTC)[reply]

I used VB Scripting once and it was very difficult - perhaps because it is object orientated which I am not comfortable with. And I understand that Visual Basic has little in common with the old-fashioned basics such as GWBasic. 78.149.162.38 (talk) 19:59, 20 July 2009 (UTC)[reply]

You don't need to be a master in object orientation to learn VB. When you create a new form, VB generates the OO structures for you, and within these structures you can insert all your 'old school' variables and procedures etc. Then when you create new forms that interact with each other and the main form, then you can define objects as global or local to forms. Eventually the OO aspect is almost non-noticeable unless you delve into advanced programming. With simple folder/file programming that you want to achieve, this won't be the case. You can get by with just one form and a few buttons/procedures. With the form designer, you drag a button onto the form and it generates the OO structure for you. This is the same with any other windows component. All visual/GUI languages work like this, including Delphi which is my favourite. I can't speak for web development but I know java is not quite as straight-forward in terms of code generation, without loading third party frameworks. Sandman30s (talk) 14:35, 21 July 2009 (UTC)[reply]
I'd say learn python - it should be a doddle to learn if you already know basic (more so than perl or horrible PHP), though ruby might be a good choice - it has/that flexibility/ease of entry feel that a lot of BASIC old timers like. Ruby should also have a low barrier to entry for basic programmers. (Python and Ruby are easy and 'fun' - I think that's the case)
There are some basic programs out there - as I remember freeBASIC is supposed to be Qbasic like - so you might want to look at it, it has an IDE, though I never got round to actually trying it.83.100.250.79 (talk) 21:58, 20 July 2009 (UTC)[reply]
Actually I too can recommend the .bat file method - as I've done it myself - using a very simple basic you can create and write out text files to be your bat files, then run them from the basic using a sys command or whatever. All the basic is for is to automate the production of text files - you can write basic programs to analsys the output of commands eg "dir > aaa.txt" - it's all simple string manipulation, and you don't need to learn a new language (though obviously you need to know the commandline commands) - for a really simple implementation yabasic on windows does it, there probably are other basics outthere.83.100.250.79 (talk) 22:56, 20 July 2009 (UTC)[reply]
(Oh almost forgot - on windows you could consider Powershell which is like the commnand line (cmd.exe) but with scripting stuff. Unfortunately to use it you have to download the .NET framework, which is like 100GB or something.. Still it is supposed to be quite good ie as good as UNIX)83.100.250.79 (talk) 23:29, 20 July 2009 (UTC)[reply]

I have been looking at various languages and scripts. Python it seems requires several lines of code to copy a file, as does Basic4GL, wheres a .bat file just uses a command like "copy pathA pathB". Autoit also has a simple file copy command. I would use a bat file, but I have to parse a file list. These scripts http://www.microsoft.com/technet/scriptcenter/scripts/storage/files/default.mspx?mfr=true appear concise, but the object-orientation is confusing to me. Although I very much appreciate the effort above, I have never used C or C++ before. So AutoIt it is. 89.240.51.22 (talk) 09:12, 21 July 2009 (UTC)[reply]

If you've used C/C++, why not look at PHP? It is very close to a C syntax. You can use object orientation or ignore object orientation as much as you like. Copying a file is: copy("source.file", "copy.file"); -- kainaw 13:24, 22 July 2009 (UTC)[reply]
Please read the above paragraph again. 89.240.43.72 (talk) 21:59, 22 July 2009 (UTC)[reply]

2-way merging of music libraries?

edit

Hi all,

I have two computers that between them hold all my music in iTunes directories. They share about 90% of the same files, and then there are a few hundred songs on each computer which are not shared with the other computer.

What program would you recommend for merging the two libraries together?

There were a few programs I looked at that we essentially for doing backups onto different computers. The biggest problem with these is that they try to move over the newest versions of files if both computers share the same files. The problem with this is that iTunes updates the file every time it is played in order to change the "last played" field. So the programs want to move over a bunch of songs that are on both computers but look a little different.

Can anyone recommend any good (free) software? Thanks! — Sam 15:39, 20 July 2009 (UTC)

iTunes allows you to input all songs - it will happily allow duplicates, and then you choose an option to 'show duplicates'. You can then delete the half you don't require. (Last version I tried this on rather unhelpfully shows both duplicates in the list so you had to painstakingly select every-other song to delete the duplicates). Have you tried that way? ny156uk (talk) 17:08, 20 July 2009 (UTC)[reply]

If the files are actually the same - if they have the same filenames and folder structure on both computers - then you can just try copying the contents of one folder over into the other. In Vista at least, it'll ask if you want to Merge or Skip. Say Merge whenever possible, but say "Skip" and check the box for All whenever it asks about overwriting specific files. In XP the process is similar. Say yes to copying the folders, but skip overwriting files. That way it'll just copy files that don't already exist.
Once that's finished, you can turn around and copy the contents of the second directory back to the first, again telling it to skip overwriting any files. When it's done the two folders will be sync'ed. Indeterminate (talk) 22:27, 20 July 2009 (UTC)[reply]

TI-Nspire and Mirage OS

edit

I have loaded Mirage OS onto my TI-Nspire (non-CAS) under the TI-84 keypad. When I tried to run it, the calculator crashed. Why did this happen? Is there any way around this? --72.197.202.36 (talk) 17:20, 20 July 2009 (UTC)[reply]

There's a bit of a bug in the TI-Nspire's TI-84 Plus emulation. You can try this fix to try and solve the problem. Vic93 (t/c) 15:15, 21 July 2009 (UTC)[reply]

It works! Thanks! --72.197.202.36 (talk) 20:41, 22 July 2009 (UTC)[reply]

CD Key in old Setup

edit

When I was ~13 years, I wrote my first software application, called Easy Writer. A few days ago, I bought an external USB 3.5" FDD and found the installation files for the application. However, I am unable to install it, because I was childish enough to protect the setup with a CD key! (I guess that I wanted to mimic the security features of the "big" applications.) I guess that it is not too hard to crack the installer, for it is old, and the setup utility was not very professional (SamLogic Visual Installer 3.06). The setup is not a single-file executable, but a setup.exe executable and a set of data files and settings for the installer. I have tried to change CDKeyDlg=1 to CDKeyDlg=0 under [DialogBoxes] in visetup.inf, and indeed, the installer didn't show any CD key dialog, but the app would not install anyway. I guess that one could extract the correct CD key from the line

CorrectCDKey=ECx00-7KNpSnKYNI=!hR&?O3UgQz95;294Ec]H8Ni%Y(6jMuD+

in the very same file, if one only knows the decoding algorithm used by the software. Unfortunately, I do remember that I did not use a (e.g. English) word as password, but a set of numbers, possible using the prefix "ew". How can I install my old app (or even extract the main executable from the installer's data files)? --Andreas Rejbrand (talk) 19:37, 20 July 2009 (UTC)[reply]

I more or less accidentally stumbled upon the CD key... ew-6483-2651. --Andreas Rejbrand (talk) 19:52, 20 July 2009 (UTC)[reply]
You accidentally typed the correct 8 numbers? Sir, I have a lottery I need to play today and I need you to pick the numbers for me. Tempshill (talk) 20:13, 20 July 2009 (UTC)[reply]
No, I found an old readme.txt file with the key... :) --Andreas Rejbrand (talk) 21:39, 20 July 2009 (UTC)[reply]
  Resolved

Duplicate Network Connection

edit

I have a problem with my LAN internet connection. I have 2 networks on there. My first network is my default and trusted network on my account and is a private network. There is however a second network called network 2 that is on there as well. Every time i log in the set up internet connection page comes up and asks weather its a home work or public location. I cancel that out but network 2 is still on there even resetting the router does nothing. I have a fear that this may be a spy network of some sort because even after using the merge or delete networks box on windows vista the network automatically comes right back up after its deleted. I could use some tips on how to fix this up or temporarily be able to block networks. This is a linksys router.--logger (talk) 22:13, 20 July 2009 (UTC)[reply]