Skip to main content

Posts

Showing posts with the label platform-web

Blogger Notable theme pop-up header issue fix (thanks to Gemini Pro)

I've made a few half hearted attempts over the years to to fix Blogger's Notable theme's rendering of the pop-up header that shows up when you scroll down the page a decent amount and then pull back to reveal that secondary header. On Chrome mobile I noticed a gray box that forms next to the magnifying glass icon. I never looked in detail on  Chrome desktop, but it had an issue as well which I'll detail below.  If you are looking for a solution and don't want all of the extra talk about how I was able to find it, here it is:  .centered-top-container .sticky .main_header_elements { overflow : hidden !important ; } I decided to try using Gemini Pro 2.5 to see if it was capable of finding the issue and giving me a fix. Turns out that it was able, but it took a bit of collaboration back and forth to find the actual problem.  Here is a modified article I asked it to give me based on our debugging chat (it was very colorful in the article which I scaled back a lot, ...

Javascript and HTML: Async Communication Prototype

In this article I go over an asynchronous communication prototype I had made in straight Javascript that you use to POST to a server script and pass along the response to a Javascript function specified by the initial call to the prototype. The main benefit here is that you don’t need a full page refresh, which is great for implementing web interfaces that have an application feel to them. It doesn’t use any bulky libraries and should work on all browsers. An ideal use case for this would be websites hosted in an internal network that you wanted to act like an application. Though, with extensive modification you could add security features or just run it through https with proper verification code in the PHP script. The example code is located on GitHub. In my example I have four files: example.html = the html page that gives the user two buttons that fire off asynchronous calls to a server side script. AsyncManager.js = The prototype (aka. class) that handles communication and respons...

Fixing Wordpress Database Collation for Foreign Fonts

I wanted to write Japanese in one of my wordpress blogs. The issue was that the encoding was in latin1. Here are the steps I used below. Keep in mind that this is a potentially dangerous modification where you could easily lose your data. Be careful and if you try this, you do it at your own risk! Make a complete backup of your site by whatever methods you normally use. Also make a backup of your wordpress site’s database. Login into CPanel and select phpMyAdmin. Click the SQL tab around the top of the page on the right panel. This is where you can execute SQL code. ALTER DATABASE dbname DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; (where dbname is the name of your database) That line fixes the existing database by changing the default encoding. In my case I had a latin1 variant. That step above is to avoid completely dropping and re-creating the database. Login into CPanel again and download a copy of the database using the backup wizard. This consists of a tar.gz (zip...

Securing Wordpress Continued...

I had written a basic securing wordpress article back in February of this year. Since then I’ve done a bit more research and came upon the idea of using Apache to help secure the administration directory and scripts, making it more difficult for intrusions to take place. It’s always a good idea to try and protect your sites as best you can. When dealing with open source software, the code is visible to the world, so any exploits that have been found can travel fast. Issues and security flaws get fixed on well known open source projects like WordPress, but it also leaves an un-upgraded system easily open to attack. One option to add a second layer of protection by using Apache server’s built-in directory password functionality. Thankfully, Askapache made a decent plug-in to save a good deal of time playing around with Apache .htaccess settings and researching the necessary code. While the plugin needs work, it functions with a bit finesse on your part. Download the Askapache Passw...

Solid Basic Javascript Input Validation

Here is a simple yet pretty powerful and easy to use way to do validation on HTML form text boxes and text areas and similar controls. It checks to make sure required form field have *something* in them before allowing processing to continue. It’s a good simple way to add some basic validation to prevent trusted individuals from forgetting to fill out required fields. This is generally useful for internal websites where you can assume the user isn’t trying to hack the site. First we have two global JS variables that define the default and error-ed state of text boxes in question. Below I have standard controls with black borders and error-ed controls with red borders. // Assign a default border color for all form controls var defaultControlBorderColor = '#000000'; // Use a special color to highlight trouble (such as if a control doesn't validate) var notificationControlBorderColor = '#ff0000'; Below I have the primary function that does the field validation. F...

Wordpress Visual Editor CRLF Quirk

Adding extra vertical space (eg. carriage return) to postings in WordPress can be a pain. While there might be a plugin to fix the issue, learned by searching around that using the code: <br class="blank" /> When in HTML mode will not be deleted by the visual mode processor. So if you flip back and forth between the two input modes, that code appears to be safe from being removed.

Securing a WordPress Blog

Please view this newer article for another method of securing the wp-admin directory from access. Here are a few tips to securing a wordpress based blog or site: Change the location of your wp-content directory. This is good for making your site’s source code less discernable as a wordpress blog. In the wp-config.php file: define('WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/wp-content'); define('WP_CONTENT_URL', 'http://example/wp-content'); Change “wp-content” to something else. Keep in mind that some plugins are not programmed correctly and have hard-coded links to the content directory as “wp-content”, so that could cause issues. If you notice your plugins not working, open the related source files and search for the phrase. ————————– Change the admin’s login name to something besides “admin” This can be done with something like phpMyAdmin to edit the database. The user_login varchar(60) field in the wp_users table is the value you wan...

EasyPHP, Wordpress, and Permalinks

I’m creating a website as a favor to a friend. To save effort, I’m just doing the development on my Windows computer. While doing that, I ran into a little issue with permalinks that seems to be unique to how EasyPHP is configured. While I won’t go into much detail on the subject, I re-affirmed the fact that WordPress is as close to as ideas as one can get when wanting to setup a basic website. I tried out probably 10 open source CMS systems and found them too complex (the admin back-ends) or too buggy to be used. Keep in mind that the website I am setting up requires only basic functionality (informational pages, a image gallery, good admin, stable code), which is what I am basing my opinion off of. What brings me to my post today is that I used EasyPHP  (a simple Apache, MySql installer and admin) to act as the local web server for testing. I was having issues with getting permalinks working. There was one gotcha that doesn’t apply to other webserver installers. What I did t...

Site Revamp Details

Here is a screen shot of the old site.  It served me well for the two years or so that I had it running on blogger.com.  The great thing about blogging is that I can save bits of important information in one place that I can later come back and utilize. The secondary benefit is that other people can also gain something from my writings as well. Now that I’ve taken the plunge to into the world of incorporation, I have had a strong desire to improve my web presence.  My first project being this website revamp. Here is a list of the steps necessary to get from blogger to a custom wordpress blog: – Install wordpress on my computer’s local server ( WAMP ).  This is quite easy if you have messed around with developing websites before.  The major steps to that are 1. create a database (wamp has phpMyAdmin preinstalled, so doing SQL stuff is easy) 2. create a new SQL user that has permissions on the new database.  Once the database is setup, extract the wordpress ...

Drupal: CMS Migration To A Server

I’ve been modifying Drupal (drupal.org) for a neighborhood organization website. It took a little research as, like most similar open-source projects, the documentation leaves something to be desired. I now have the site to a point where I want to put it up on the Internet. I have some hosting, so I got the domain… and bam, it’s on the web right? Well no. I feel it is necessary to make a general process overview as it took a good deal of research and tweaking to get it working: -I have “reseller hosting.” That means I can host multiple domains with the space/bandwidth that comes with the yearly fee. I bought the neighborhood domain, added a special hosting plan (defines storage, bandwidth, and other properties), and tried configuring the dns information -Seeing as I have not done too much with the whole domainname-dns-nameserver-whatever configuration process I had some trouble figuring it out. What I ended up doing was having my domain name registrar create 2 name servers from ...

Looking for faster development methods

Over the past week or two I’ve been researching ways to develop server-side web based applications as fast as possible (time is money, haha). I am in the initial stages of starting a little side business with a friend and one of our possible clients is looking for a large system to handle online ordering of their products. If you know anything about developing and programming a complex system, it takes a lot of planning as well as a good deal of time to actually create it. My “developer ideals” won’t allow my to create something of poor quality, so I’ve been reluctant to take on large things in the past. I’ve been pushing myself more lately to produce results the results I strive for with more speed. Well more like I’ve been trying to learn new methods and techniques where I can keep my quality level high, but just get things done faster. While I’ve programmed in PHP before, I know that I would need to create a large amount of generic functionality to handle an ordering system. T...

A few mishaps while getting the site ready

The ajax/json site is fully functional now. I had a few problems though that I’ll discuss here. First off, the simple hosting that is provided my my isp isn’t working correctly, so I had to look for an alternative host to do testing on. I found 50webs.com which provides 60mb of free bannerless hosting. They even allow you to use domain names with their free service, which is great. I got that setup and now my sister’s site (while slow) is on there and directly uses the domain name. Today I showed the site to a friend, who in turn said that it didn’t work. He was using IE7. I use Firefox usually and had not gotten around to trying the completed site on different browsers… Anyways I figured out the problem and the site now works on Firefox2/Opera9/IE6/IE7. What caused IE6 and 7 to not display the site? It seems that IE requires a new AJAX object for every request. I had it setup initially to define one AJAX object when the page loaded and reuse it. I...

No, but there is more...much more thanks to my new friend ajax.

As I mentioned in the previous post, I made a static website in html, css, javascript, and json. It works pretty good and that’s great. The problem is my sister is the one who should be adding/editing content because it is her site. So the question is, how can I make an easily update-able site that is on a server without any server-side coding functionality? I had figured out pretty much how I wanted it to work even before I finished coding the first version of the site. Sure, I could just write a client application that spits out html\css code and uploads it to the server, but no, that isn’t cool enough. I wanted to break up the site data and formatting. That way the client application would only need to create json files and upload them along with any new content. That means the json data needs to be removed from the html files and the html page now needs to allow fetching of the data whenever the person using the site needs it. What does this mean? It means that I now have a site th...