Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.
Seriously, though, a quick google for "php parse url" returns parse_url, which splits a URL into its component parts (scheme, hostname, etc). Try feeding https://www.example.com into that and find out if it returns a blank scheme, defaults to "http" or chokes. Then the correct way to do this (in fact, the correct thing to do even if you hadn't noticed a specific problem) is to use that function to split the url's into parts and then rebuild them into a canonical form.

JoeNotCharles fucked around with this message at 23:52 on Oct 29, 2008

Adbot
ADBOT LOVES YOU

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

Savings Clown posted:

I'm trying to use the CFileDialog::GetFolderPath() function in C++ to return a string value containing a folder path (eg "C:/Documents") instead of a single file (eg "C:/Documents/results.csv").

code:
void CFileReadDlg::OnPath() 
{
	CFileDialog cFileDlg(TRUE, "*.csv", NULL, OFN_EXPLORER, NULL);	
	int nRet = cFileDlg.DoModal();
	//strFolder = cFileDlg.GetPathName();
	strFolder = cFileDlg.GetFolderPath();
}
The above code works fine for the commented-out GetPathName for choosing individual files, but the assertion for ASSERT(::IsWindow(m_hWnd)) comes back null for GetFolderPath().

What assert? I don't see any assert there, or any m_hWnd. Did you forget to paste half your sample code, or did you ask the wrong question?

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

N.Z.'s Champion posted:

This is probably a moronic question but there's someone I know who wants to migrate a REALBASIC project to something more modern (because they're having problems finding developers, libraries, community). Rather than starting from scratch I guess they should modularise their code as a library, perhaps exposing interfaces in COM or .Net?

Trying to expose interfaces through COM directly will be more of a headache than just porting the whole thing, unless it was designed that way from the start.

If Realbasic can target .NET, modularising to expose .NET interfaces and then do new development in Visual Basic is probably the way to go. Otherwise, I think you'll have to bite the bullet and port the whole thing to Visual Basic.

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

floWenoL posted:

In particular, the most parsimonious way to do this would be to use a producer-consumer queue with a threadpool. If you need strict FIFO behavior, then you simply have 1 thread in your threadpool.

Ok, before involving threads and poo poo, step back and think about what you NEED. Yes, this function will take a while to run could fail in the middle for a variety of outside reasons. Does this matter? Is this to be run from a command-line utility? If so, just copy each file as it's given to you, abort with an error code (or throw an exception) if it fails, and die with an error message if any of them happen. Is this to be run from a GUI that needs to not freeze while the copy is happening? If so, you're going to need to use a thread (or fork off a subprocess) to do the copying. Now decide how much error handling you need (if you can pop open a progress bar, you just need "still going" or "it failed", otherwise you have to worry about the user triggering other actions while your file copy is going on in the background.)

But there's no point in trying to design a complex threaded architecture to handle every possible case if you're not going to need it.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply