↓
 

A Pipe and a Keyboard

A sort of Linux scrapbook

  • Home
  • About
  • Software
  • List of posts

Category Archives: Tech stuff

Post navigation

<< 1 2 3 4 5 … 26 27 >>

Stylish

A Pipe and a Keyboard Posted on November 19, 2017 by RichardDecember 20, 2017

One of the greatest irritants (for me) on the Internet is the site that somehow thinks it is being trendy when it uses pale text on a white background.

Generally when I come across such a site I get out of it fast unless the information is important in which case I struggle on and curse the designers.

I use ManageWP to manage (!) several web sites. As this is a tool I use very frequently, the contrast is important, particularly such information as how many sites require updates. However, they are sadly being ‘trendy’ and feel obliged to display such information in light grey on a white background:

Grey text on white

Now apparently there is little I can do about this short of complaining to the crowd who run the site.

But then there is Stylish.

Basically Stylish allows you to apply CSS styles to any or all of the sites you visit. Naturally it only applies on my browser so it entirely a personal preference thing. Unfortunately (for some) it requires a fairly good knowledge of CSS and how to discover which selectors on a web page you want to modify, but there are a load of styles already to download for the most popular sites if you so wish.

I applied the following snippet of code to my ManageWP Stylish:

@namespace url(https://www.w3.org/1111/xhtml);
@-moz-document domain("orion.managewp.com") {}
body {
color: black !important;
}
.dashboard {
color: black !important;
}
span.filter-count.badge {
color: black !important;
}
.custom-checkbox {
border: 1px solid #999 !important;
}

This is applied automatically to the web page and this is the result:

Black text on white

There was also a problem with my WordPress editing pages which I have been trying to solve for some time. It was the same sort of problem – writing or editing text in the Post Editor was difficult as the text appeared grey on a white background. It took me a long time to realise that it wasn’t the font colour that was the problem but actually the font itself. Once I had worked that out, I thought about changing the font face on all the sites I edit but that would have been tedious, so I just applied a modification using Stylish.

body#tinymce.wp-editor,
.wp-editor-container textarea.wp-editor-area {
font-family: Arial, Helvetica, sans-serif;
}

Now any site that I edit will have a nice clear font.

Text samples

Click to enlarge

It’s a handy little gizmo!

Incidentally, this is not a sponsored post – I just thought it might be of some help….

 

Posted in General, Tech stuff | 2 Replies

Firefox 57 – moving those tabs

A Pipe and a Keyboard Posted on November 18, 2017 by RichardNovember 18, 2017

I recently upgraded to Firefox 57.

The first thing I noticed was that half my add-ons had disappeared and the layout and font had changed. The most irritating one was the tabs on top, and no way to move them down.

I eventually found a fix for the tabs.

Create a file called userChrome.css and paste in the following –

/* Puts tabs on the bottom */
#TabsToolbar {
-moz-box-ordinal-group: 2;
border-bottom: 1px solid #888 !important;
}
#nav-bar{ border-top-width: 0px !important; }

Find your Mozilla default ‘profile’ folder and move that file into a sub-folder ‘chrome’. If ‘chrome’ doesn’t exist, then create it first. Close and reopen Firefox and the tabs will appear below the other toolbars.

However that still didn’t resolve some other issues I had with the new release.

I discovered Waterfox!

I downloaded it and ran it. I was impressed to say the least.

It doesn’t interfere with Firefox and its settings and includes the options of importing all Firefox’s settings. When the browser opened after the import, there was the familiar screen and I had to check that I was in fact running Waterfox in the ‘Help -> About’ menu.

Not only was it exactly like Firefox but it had imported my theme, bookmarks, tabs, add-ons, passwords and all the rest. Even better, it had restored a load of add-ons that had become redundant in Firefox 57. The only strange anomaly was that the actual contents had reverted to the tabs and pages that existed on the 1st July, but that was no bother whatsoever.

I haven’t yet found any problems with Waterfox. It uses the same add-ons and themes repository as Firefox, but now virtually all are now compatible instead of the ‘chosen few’. I still have Firefox installed as an emergency backup but for the foreseeable future, Waterfox will be my default browser.

 

Posted in Tech stuff | 2 Replies

Prevent page caching on a development server

A Pipe and a Keyboard Posted on September 27, 2017 by RichardSeptember 27, 2017

I do a fair bit of PHP coding on my local machine here.

One of the most irritating aspects of that is when I change a bit of coding and run the browser, the modification fails to appear, as the browser shows the old cached version. This is particularly irritating if the code takes a length of time to run.

There is a very simple and effective fix.

Open php.ini and change the line opcache.enable=1 to opcache.enable=0

Problem solved.

I just wish I had found that years ago!

Posted in Tech stuff | Leave a reply

Rebuilding a WordPress site from nothing

A Pipe and a Keyboard Posted on September 19, 2017 by RichardSeptember 19, 2017

Some weeks ago I took on a project.

The project was to rebuild a major blog with next to nothing to start with. The blog had been running for years and had an enormous following. The author had been diagnosed with cancer some years ago but had continued her writings. Last December she decided to discontinue the site, as her health was seriously deteriorated at that stage. She erased the site. Not long after, she expressed a sincere regret that the site was gone, and it was one of her dying wishes that somehow the site be restored. Last August, she died without seeing that wish fulfilled.

I assumed there were some backups lying around and offered to restore the site to its former glory. Unfortunately my assumption was wrong. I contacted the company which had hosted the site. Sorry! We don’t keep backups that long. So the call went out to see if anyone had miraculously got a backup of their own.

The first to respond was the blogger’s husband who was as anxious to restore the site as his wife had been. He announced that there were backups on the author’s PC. I duly received 1,419 files (one per post) to find that they were all in MHT format. MHT contains all the information for an individual page including HTML, JS, CSS and images. However, MHT is not a universally recognised format so putting them on-line would only work in Internet Explorer (or in some other browsers with a specific add-on installed). I had to find a way of extracting them, each into its component parts.

After some searching, I came across MHT2HTM which happily extracts the required contents and works on Linux. I installed it and ran it. It worked perfectly.

So I now had 1,419 folders, each containing everything required to reconstruct the posts. However, files in folders – 59,337 files weighing 834Mb – are not very efficient as an archive. They are bulky in the extreme and aren’t searchable and can’t be listed by anything other than folder name. The answer was to extract the information from each folder, to move the image files to a central point and to populate a database with the correct information.

I set about writing a programme (in PHP). The programme was simple enough in concept – it had to cycle through each folder, reading the HTML file and extracting al the required information to place in the database. This meant stripping all the HTML off the file leaving just two parts – the post content and the comments. These two were added so that the comments became part of the post. That was moved to the database along with other information which had been extracted such as the author (there had been quite a few contributors to the site), the title, the name (slightly different to the title as far as the database is concerned) and the date of posting.

In the meantime I had taken over the domain name and had set up a server with a WordPress site. I uploaded the database I had created and the first generation of the archive was live.

Also in the meantime I had received a few (!) more files from others who had had the foresight to backup some of the original.

One batch of 1,462 files was also in MHT format. I ran that through MHT2HTM and I now had 1,462 folders. Unfortunately the two archives had been saved using slightly different parameters so I couldn’t compare the two directly. It would have to be done automatically.

I took my home-grown PHP setup and modified the code. It now had to make sure that the record didn’t exist already from the first run. This wasn’t quite so simple as because of the different parameters, there were some variations in post titles. I had to generate a unique key for each post (which meant running the first batch again) and compare keys. The key was simple enough – just strip all non-alpha-numeric characters from the title and replace spaces with dashes.

Next I had received some more copies of the site. A couple had used WGET to download the site and a couple had used HTTrack.. These of course gave me a load of files all with different layouts and small but important differences in the HTML coding.

Once again I rewrote my PHP programme and updated the database. I was now on a third and fourth generation of the site, each time adding a few more missing posts.

I had been dipping through the WayBack machine which had also sporadically taken copies of the site. Then I discovered wayback-machine-downloader. I downloaded and installed it and did a test run. It seemed to do the job so I did a live run. About eighteen hours later it finished.

Naturally, the downloader had dumped all its results into a series of folders with yet another layout. This time I tried a different approach – I used “locate” to find the index files and piped the result into a file. I discovered that if I created an array from that file using “explode” and “/” that the required files were to be found in all elements with a count of 12. This made the job easier. Once again, I used a modified version of the PHP programme to generate database entries.

I think I have gone as far as I can. There are still some small tweaks to be made to the site, including a few duplicate posts that somehow crept in. I still have to find some lost images as well, and maybe sort out additions to the various categories.

The result of all this effort can be found here:

The Anna Raccoon Archive.

 

Posted in Blogging, Linux, Tech stuff | 2 Replies

PhpMyAdmin Settings

A Pipe and a Keyboard Posted on July 2, 2017 by RichardJuly 11, 2017

I have a LAMP server running on my local machine. The version I use is Bitnami.

I use this server quite extensively for testing code, site layout and various tests, and therefore use PhpMyAdmin a lot. There are two things that bug me constantly though – the first is the limit on file size to import data and the other is the timeout. While the need for these on a live production platform is obvious, they are just an irritation on a local device.

To change the timeout, open the file apps/phpmyadmin/htdocs/config.inc.php The location may depend on your variant of LAMP but a quick search should find it.

Change the setting $cfg[‘LoginCookieValidityDisableWarning’] to ‘true’.

Next find the line containing $cfg[‘LoginCookieValidity’] and change the value to the required timeout.

To change the maximum upload filesize, open the file apps/phpmyadmin/conf/httpd-app.conf Again, your location of this file may be different.

Change php_value upload_max_filesize and php_value post_max_size to the required value

Posted in Tech stuff | Leave a reply

Post navigation

<< 1 2 3 4 5 … 26 27 >>

Recent Posts

  • Failed to mount Windows share
  • Dell Inspiron 3000 intermittent boot problem
  • Installing Linux Mint 20
  • To kill or not to kill
  • Weaver Extreme Info Bar Spacing

Categories

  • Blogging
  • General
  • Linux
  • Media
  • Tech stuff
  • Writing

Blogroll

  • Head Rambles
  • Kirk M's Just Thinkin'
  • Wordpress Beginner
  • Wordpress Development

Blogroll

  • Head Rambles
  • Kirk M's Just Thinkin'
  • Wordpress Beginner
  • Wordpress Development

Recent Posts

  • Failed to mount Windows share
  • Dell Inspiron 3000 intermittent boot problem
  • Installing Linux Mint 20
  • To kill or not to kill
  • Weaver Extreme Info Bar Spacing

Archives

©2022 - A Pipe and a Keyboard - Weaver Xtreme Theme
↑