Posts

Domain Not Propagating

Image
Isnt it frustrating sometimes, when for whatever reason, you had to update your DNS records for your domain and it takes forever to propagate. I had to go through this recently. One of the domains I manage expired, and we renewed after two days. Unfortunately, the registrar had parked the domain, pointing it to another location temporarily. This meant that after the renewal, we had to wait for 24 to 48 hours for the domain to fully propagate. I then had to do a fix that ensured that some other servers who talked to that domain could still access the server it pointed to, even though the domain was not fully propagated to them. It involves a simple fix for windows systems. Open notepad as administrator Open C:\Windows\System32\Drivers\etc\hosts (assuming that windows is installed on the C drive) Scroll to the end of file and add two new lines (press Enter twice) Enter the IP Address, leave a space then the domain name Do the same for necessary subdomains where needed, e.g

Resize or Crop Image before Upload Using HTML5 File API

Image
I've always loved how Whatsapp, Facebook, Twitter and all the major social network platforms maintained sanity of uploaded profile pictures through the use of instant resize at upload time. Of course not only profile pictures need to be made to conform to a specific dimension, if you find other scenarios during development when you need to ensure that your images are of a specific height and width, or aspect ratio then this article will help you do just that. You may also just want to give the user ability to resize before final upload, this article will help you do just that. Step 1: Download CropperJs Plugin There are lots of plugins that could help to achieve our objective, and I've tried a few. I find this one very robust and easier to use. Here's the github link Step 2: Import the CropperJs Plugin Using your script tag, import the downloaded plugin's Javascript file and link the CSS file too. Note, that for speedy loading, CSS files should be loaded in t

T-SQL: Prudent use of Select ... As

Every database developer using T-SQL will agree that the Select ... As feature allows one to easily grab values into a variable. However, after I got my fingers burnt recently, I had to share this to remind everyone how important it is to exercise prudence with its usage. Given the table below, assuming its an SQL table named Students. Id Name Age Class 1 Fade Ayomi 10 5 2 Oluwayomi Ojo 9 6 3 Kemi Mide 8 4 And given the SQL statements below which performs certain operations on the table given above declare @ StudentAge int ; select @ StudentAge = Age from Students where Id = 1 ; set @ StudentAge = Age * 2 ; select @ StudentAge = Age from Students where Id = 5 ; select @ StudentAge as AgeSelected; So what would AgeSelected resolve to according to the provided information? Ordinarily, one would expect AgeSelected to be NULL however, since @StudentAge carried a value initially, and the row described in the where clause do not exist in the table, @Stud

Determine Appropriate Font-Size for Text iTextSharp

Image
Background: I use CorelDraw a lot to lay out my reports before writing the iTextSharp code to generate them. It gives me a fair idea of how to position report elements and keeps me from doing guesses or trial and error. This was the case when I worked on the ID Card project for Delta State University: I had the ID card neatly laid out and the school loved the design. Issue: Now, everyone knows we normally have long names in Nigeria. My design template had a name that was 10 characters long and I used 28pt points for this text. What I wanted to achieve however is that, for names that will not be able to fit into the maximum space allowed for the name text at the 28pt used in the design template, the system should use the maximum font size that will permit the name to fit in the space available. Its a simple problem, but wasn't so easy to resolve. Solution: public Font GetSafeFont ( string DisplayText, Font FontToUse, float SafeLength, float StartingSize) {

Creatives for Beauty Sanctuary

Image
This is a creative set for Beauty Sanctuary beauty shop. I hope it gives you some inspiration too.

Implementing Token-based Authentication for Service-based Web Applications

Image
With the magical things developers can achieve with JavaScript these days, there is almost no reason to develop on the web without JavaScript. The drawbacks of the traditional web development approaches are just too unbearable. JavaScript introduces superb user experience with AJAX and developers can now update an element on a page without post back! Although JavaScript solves  most of the developer's head ache, it introduces its own issues. Foremost of these are security flaws of which we have the 3 giants: XSS, CSRF and SQL Injection. I remember implementing a solution for a leading financial company in Nigeria, and though I insisted on stringent security measures for the Web API, the guy in charge maintained that there was no need for it, and the project went ahead without it. Yes! there are lots of systems trusted by the public that are in use without adequate security. I'm afraid these are time bombs waiting to explode. The effect of not adequately securing a syste

Logo Design for Fashion Bags Store

Image
MWoB is a fashion bags store in Nigeria. This logo concept was created using deep Turquoise as the primary colour.