Closed HimeWorks closed 10 years ago
You're having a fun night... :)
I just realized if I do a re-import I'd have to delete all posts/pages/etc. and then import it
Doing a count of dropbox.com/sh
occurrences in the XML showed 176, so...maybe I'll just manually do them...
I know so little about database, php, html, etc... that its still intimidating for me to think about.
If I had made it so that each page was just an HTML file I could probably have just done a regex find-and-replace across all documents.
I had considered doing a find-and-replace in the database, but then I realized regex wasn't something that was supported...
When I initially started to teach myself about Regex, ruby seemed one of the most supported languages for it. Maybe its just the bias of my experience, but back when I was learning Java and C#, I hadn't a clue what Regex were.
I think unless you're doing something like searching/parsing, you probably wouldn't come across regex very much in real-world applications.
When was the last time you needed regex outside of...string parsing?
Granted, I've written applications for business users where they type in regex as input, but that's mainly cause the tools they're using are parsers/searchers/matchers which naturally lends itself to these kinds of input.
Page 6 out of 14...which means I only have 160 links left. There are likely a dozen or so scripts roaming around that isn't on my blog. They are mostly unsupported, which is why they don't have blog posts.
I probably won't be fixing those...
Why did I write so many scripts lol At least I learned that I don't know how to maintain a blog.
lol
There are scripts I don't even remember writing
Sometimes I think the same thing, and I am not even close to as prolific a script writer. ;)
I've started making personal notes as to why the hell I did things now.
http://www.himeworks.com/2013/08/29/skill-type-groups/
This thing's pretty cool.
Halfway through the edits, I realize that I should have first written some sort of redirect page that takes a string, looks up a table for the correct URL, and then redirects the user to that. That redirect page could have different uses as well, such as advertising.
Then I would never have to actually update my posts; if my link changes, I just need to update the table...
Necessity is the mother of invention. :)
Oh well might as well just fix the rest of the links...
Actually what the heck PHP isn't hard to learn might as well put together something.
Done. Simple redirect page.
http://himeworks.com/redirect.php?type=script&name=enemy_gold_formulas
Granted, there may be security holes that I'm unaware of.
<?php
$scripts = array(
"enemy_gold_formulas" => "http://himeworks.com/files/rpgmaker/scripts/Enemy_Gold_Formulas.txt"
);
function redirect($url, $permanent = false)
{
header('Location: ' . $url, true, $permanent ? 301 : 302);
exit();
}
$redirectType = $_GET["type"];
$name = strtolower($_GET["name"]);
if ($redirectType == "script") {
$url = $scripts[$name];
if (strlen($url) > 0) {
redirect($url);
}
else {
echo "Unknown Script";
}
}
?>
See that is something that I hope I am able to do one day... Just throw things together at the drop of a hat. You make it look easy.
For the most part if you know what your goal is and you can break it down into pieces, you should be able to find the relevant details anywhere on the internet.
I literally googled "how to redirect in PHP" and "how to get URL parameters in PHP" and "PHP hash map"
It may not be perfect or even aesthetically appealing for that matter but the details can be refined afterwards.
Knowing what to look for is often 3/4ths of the challenge. At least in my experience. Ignorance compounds difficulty exponentially it seems.
I find that now that I have a fair knowledge of ruby and rgss3 and RMVXA my productivity has skyrocketed.
That's true. That's usually when people just randomly go on a forum and throw out a broad question like "I want to do this. How to do it?" and then someone gives you an answer and it's like "OHHHHHHHH that was pretty simple if I knew what to type into the search engine"
I find Stack Overflow to be highly useful when i have random code quandaries. (I use it much less these days) And luckily you for ruby and rgss. :)
Hmm now I'm wondering whether the redirect API is enough.
I plan to use it for libraries, demos, and scripts, so the type
argument is provided.
Then there's the name
of the file.
Frankly it took half the time to update each post after getting the redirect page since my file naming was rather consistent and it was easy to use regex to put together all of the links in a hash map.
Ok so I finished the latter half. Will go and update the first half to use the new shiny redirect page. All links on the blog should be working now.
Manually updating links is just too tedious, since I realized I have over 300 scripts. Going to do an XML dump and then just regex the thing and import everything...
But will need to test that it doesn't break permalinks.