Is there a simple way to change multiple image sources at once? - html

I have dozens of HTML files hosted on a platform that is soon being shutdown. 90% of the images within each HTML file are hosted on the dying platform and thus need to be re-hosted.
Is there a simple tool or method I can use to bulk download all the
images within an HTML file, so I can re-upload them to the new
platform
Is there a simple tool or method I can then use to rename all the references to Images in the HTML to reflect the new file path?

I am just going over my head here I am assuming following;
you have same domain but changing host servers assumption is you have control over code base. In this case then its simply code over the code and directory structure as its using ftp -> download from one -> ftp upload onto another. hypothetically things should work.
you are changing domain so it becomes a programmable issue i.e domain-a.com/someimage.jpg is now domain-b.com/someimage.jpg and it is being fetched by the browser on to which you have no control over.
if for any reason domain were to be the same and directory structure were to change all you had to do run bit of configuration on ht-access or virtual host or what ever and reroute things internally. ht-access example below
RewriteEngine on
RewriteRule ^somefolder/(.*) otherfolder1/$1
server would identify the URI if it matches the condition then it internally forwards it to otherfolder and /$1 appends what ever was after the matching condition e.g. domain.com/somefolder/myimage.jpg now becomes domain.com/otherfolder/myimage.jpg
BUT domain has to be the same because browser has to send it to the server where htaccess is residing. If its on some other server which is dying then solution is of no use.
Which means we have client side issue. Massive overkill hack so I wont even begin going down that track.
Easy but takes bit of time and in longer run helps a lot.
install vs code - if you haven't used this IDE its about time you should it helps you make better progammingly.
make copy of the folder you have where all your code is.
run VScode and go to file menu -> open folder
on left hand side you see files and structure of the folder meaning folder is successfully opened.
once again file menu -> Save Workspace as... prompt will pop up just gave project name or what ever honky doory you like to be. VScode now will configure things for you.
should be something like this
if it does not show then simple click the double file icon side pan will toggle.
now that we are done with this lest do the magic
6) click on search icon something similar to this will appear
little arrow on left gives other options such replace etc
shortcut Ctrl + Shift + F for search Ctrl + Shift + H for search and replace.
What it does it does not just search in a file it searches in all the files in given folder including sub directories and obviously you can replace them.
So you need quick dirty way of doing it which is more smarter than actually going over each file one by one then above would suffice.
Other than installing depending upon number of files it should take few second to a minute.
Ps I have quirky way of naming things probably have dozens of temp strings here and there and at times need to change them everywhere. This is what I do.

Related

how to look for live index.html in ftp

We are using FileZilla as out FTP. At the moment, I want to insert a script in the live index.html. Unfortunately, there is more than 1 index.html files on the ftp.
I was wondering how to pinpoint the exact one?
Is there a way to trace it back using just the Google Chrome Inspect Element?
Thank you in advance!
By "live", I presume you mean the one displayed when you visit a particular URL; and by multiple index.html files existing, you presumably mean that there are multiple folders on the FTP server, and you don't know which one maps to the URL in question.
The short answer is no: the mapping from URL to directory structure can be configured however the administrator of the server wants, and is completely invisible to web browsers, so there is no general rule to find out.
Barring luck in finding some clue, you have two ways to attack the problem:
Firstly, you can search for distinctive content: take a copy of all the folders you think might be relevant, then do a "find in files" for some text you know is in the target file but unlikely to be elsewhere. At worst, you might narrow down the list of possibilities before trying the next approach.
Secondly, you can use trial and error: make a list of candidate files, then edit each in turn to add an innocuous but visible piece of text. Then load the target URL and see if it changed; if not, revert the file and try the next.

threepenny-gui - opening files

Dear Haskell community I have written my first gui application and decided to use
threepenny-gui to do so.
The task is the following search the files in a given folder for matches and provide links to open those files. In addition I made nice parse and render function as the files (mostly) have a special formatting.
But now I have stumbled upon a problem - most browsers prohibit links to local files by href="file://localhost/home/user/folder/file.pdf" being opened, for security reasons, which I do understand and find completely sensible.
I tried to use href="./file.pdf" when the program and the file are in the same folder, which also doesn't seem to work.
The code of the whole application is available at github/epsilonhalbe, I run it in a folder and access it via a browser at localhost:100000
The HTTP server provided by threepenny-gui will serve up static content from the directory you specify in tpStatic. Put your files in that directory, and make your links' paths be relative to it, and you'll be good to go!
As of threepenny-gui-0.4.*, there are also two functions loadFile and loadDirectory that can be used to serve a local file or directory at an automatically generated URL. This can be useful if the tpStatic field is not enough.

How can I find my working directory?

You'll have to bear with my slightly on this, but please ask if I have left out any pertinent information. I have just taken over a project to create a dashboard for my team. This dashboard has been made using a niche third-party tool that nobody here will have used before. The third party tool auto-generates some code to display "markers" on a webpage. "Markers" being some proprietary code to query a database/apply custom styling etc.
I am trying to display a webpage within the page that has been generated, and I’d like to point this to a local webpage (ie on my C drive). If I pass it an absolute path, then this results in a warning in IE9 as I am mixing data sources - a https website pointing to a http web page. It will display after ignoring the warning, but my userbase is not comfortable enough with computers to ask them to do this.
I believe if I pass it a relative path then it should work, but I can’t find out what directory to base this path off and it doesn’t appear to be anywhere obvious. So, in my current page I have an image with the web address of : https://website:8443/websitereport/images/buttons/locked.gif. What I need to know is where the “websitereport/images” folder is stored so that I can put my webpage in there to give the webpage a relative path. The HTML for this image is :
<img id="dvp_locationbar_lock" class="dvp_imagebutton" style="" dvp_title="ui.tip.lock-page" dvp_image="locationBarPageUnlockedImage" src="/websitereport/images/buttons/unlocked.gif" title="Lock this page">
What are my options for discovering where this folder is stored locally? I am running Apache Tomcat 7.0. It is not displaying if I use the path based off
C:\Program Files (x86)\Apache Software Foundation\Tomcat 7.0\work\Catalina\websitereport
of
\websitereport\page.html
And I cannot find it anywhere obvious in the Apache folder. I have tried :
Searching - no results.
Using PHP to print the current working directory - cannot find out
where to edit the webpage.
Looking at images/information on the existing webpage. They all point
to folders I cannot find.
Inspecting with firebug.
In short, you can't rely on the files being on disk at all - they might be just contained in a *.war file, containing the whole application. Or they might be generated on-the-fly, despite the name sounding like an actual file.
Also, you should not arbitrarily write within a directory even if you find it (my closest guess would be tomcat's webapps/websitereport/ directory if it exists) because nobody will know that something changed during the time since last deployment. So, on the next update of the application, you'll end up overwriting all of your changes again. You typically change the underlying application and redeploy.
You might also find a few references in tomcat's conf/localhost/ directory or even in conf/server.xml, but it all depends on how your server was administered

web-development: how do you usually handle the "under costruction" page"?

I was wondering what's the best way to switch a website to a temporary "under costruction" page and switch it back to the new version.
For example, in a website, my customer decided to switch from Joomla to Drupal and I had to create a subfolder for the new CMS, and then move all the content to the root folder.
1) Moving all the content back to the root folder always create some problems with file permissions, links, etc...
2) Creating a rewrite rule in .htaccess or forward with php is not a solution because another url is shown including the top folder.
3) Many host services do not allow to change the root directory, so this is not an option since I don't have access to apache config file.
Thanks
Update: I can maybe forward only the domain (i.e. www.example.com) and leave the ip on the root folder (i.e. 123.24.214.22), so the access is finally different for me and other people? Can I do this in .htaccess file ?
One thing to consider is you don't want search engines to cache your under construction page - and you also don't want them to drop your homepage from the search index either (Hence just adding a "noindex" meta tag isn't the perfect solution).
A good way to deal with this is do a 302 redirect (temporarily moved) from your homepage to your under construction page - that way the search engine does not cache your homepage as an under construction page, does not index your under construction page (assuming it has a NOINDEX meta tag), and does not drop your homepage from the search index either.
One way would be the use of an include on your template page.
When you want the construction page to show, you set a redirect in the include to take all traffic to the construction page.
When you are done your remove the redirect.
What about hijacking your index.php file?
Something simple, along the lines of
<?php
if (SITE_OFFLINE)
include 'under_construction.html';
else
//normal content of your index page
?>
where you would naturally define SITE_OFFLINE in an appropriate place for your needs.
What I did when I used PHP for websites was to configure Apache to direct all requests to a front controller. You then would have full access to all requests no matter where they are pointing to. Then in your front controller (PHP file, static html file, etc.), you would do whatever you need to do there.
I believe you need to configure pathinfo in Apache and some other settings, it has been about 3 years since I have used that approach. But, this approach is also good for developing your own CMS or application so that you have full control over security.
You have to do something similar to this:
http://www.phpwact.org/pattern/front_controller
I am looking for more details, I know my configuration had more to it than that.
This is part of what I'm looking for too:
http://httpd.apache.org/docs/2.0/mod/core.html
Enabling path_info passes path information to the script, so all requests now go through a single point of entry. Let me find my configuration, I know vaguely how this works, but I'm sure it looks like a lot of hand waving.
Also, keep in mind that because all requests are going through this single PHP file, you are responsible for serving images, JavaScript, CSS, etc. So, if a requests is coming in for /css/default.css, that will go through your php script (index.php, most likely), then you'll need to determine how to handle the request. Serving static files is trivial, but it is a little more work.
If you don't want to go that route, you could possibly do something with mod_rewrite so that it only looks for .html, .htm pages or however you have your site configured. For me, I don't do extensions, so that made my regex a little more difficult. I also wanted to secure access to all files. The path_info was the solution for me, but if you don't need that granularity, then writing a front controller might be a bit too much work.
Walter

Help me fix my website - which used to rotate homepage images on underlying image map

Title: Rotate Homepage Image (for website)- No longer works.
I am a physicist/wildlife artist with a website (I created in 2002) to display & market my artwork. I have set it up with an underlying (homepage) image map - having links to: "tigers", "leopards", "birds", artist info, etc., with the overlying image changing (swapping out) every time the user navigates to/from homepage. The links for each homepage have the same numerical coordinates and do not change locations from page to page, just the image changes. You can see my blank-page site at www.querryart.com. Note links below DO work.
The website was fabulous until last year. At that time my former webhost went out of business, and I changed to Jumpline.com. Since then, the commands which call canned subroutines do not work.
The routine which swaps out the image is named pid.cgi (stored in the cgi-bin).
Another one-line page-counter cgi routine I used at the end of each page called a canned program "count.cgi" which counted visitors to that page, incremented "hits" per page, and stored them in a table displayed only to me. This was a way I could determine the popularity of various images. This cgi routine also does not now work - giving me an error message on each page.
Anyway, I am lost without these routines (particularly the first one to swap out images). Is it progress that my Cadillac website has turned into an empty wagon? Hope someone can help. I'm not a programmer.
My first guess is that you may need to change the line(s) at the top of your CGI file in order for the server to process them. For example, if using Perl, #!/usr/bin/perl is a common directory, and so is #!/usr/local/bin/perl.
Oh, and have you set the permissions to 755?
For starters: http://www.querryart.com/cgi-bin/pid.cgi does not exist. You might want to make sure the file is uploaded to the correct place.
Make sure that your host supports CGI scripts.
Make sure, your CGI scripts are uploaded at the correct location according to the info from your host regarding the installation of CGI scripts.
Make sure the scripts are executable (chmod 755)
Make sure, that the scripts are calling the correct interpreter (as pointed out by Steve).
From a quick check at your web site, it looks like the scripts are not in the right place because the webserver gives a 404 - not found. when I try to get /cgi-bin/pid.cgi
Furthermore, the fact that the script takes an absolute path as a parameter (cfile=/home/querryar/httpdocs/cgi-bin/dicont.cnf) looks like a glaring security problem allowing access to any files in your account. You should really consider a different solution