Category Archives: Uncategorized

Exporting results of a query from Postgres as a CSV

Through the psql client, you can use the following syntax to export to a CSV formatted file on the local filesystem:

\copy (SELECT * FROM table WHERE 1) TO '/tmp/foo.csv' With CSV HEADER

This results in a CSV being written to /tmp/foo.csv and uses the table field names as headers. If you don’t want headers, omit the HEADER part of the above query.

Documentation on Postgres COPY command:

https://www.postgresql.org/docs/9.2/sql-copy.html

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Git Blame inside Sublime Text

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

TLS Performance Checklist

From High Performance Browser Networking by Ilya Grigorik:

  • Upgrade TLS libraries to latest release, and (re)build servers against them.
  • Enable and configure session caching and stateless resumption.
  • Monitor your session caching hit rates and adjust configuration accordingly.
  • Configure forward secrecy ciphers to enable TLS False Start.
  • Terminate TLS sessions closer to the user to minimize roundtrip latencies.
  • Use dynamic TLS record sizing to optimize latency and throughput.
  • Ensure that your certificate chain does not overflow the initial congestion window.
  • Remove unnecessary certificates from your chain; minimize the depth.
  • Configure OCSP stapling on your server.
  • Disable TLS compression on your server.
  • Configure SNI support on your server.
  • Append HTTP Strict Transport Security header.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Composing Simple HTML Mails in MailChimp

MailChimp is a great tool, but it has an over-reliance on fancy templates. When sending emails, I’ve found that simpler text-based e-mails are more effective as they look more like a personal e-mail. However, getting this simple look with MailChimp is not immediately obvious. In this guide, I’ll show you how you can compose a mail so it looks like a regular Gmail message.

Here’s what an example mail looks like using this simple method:

html-email-gmail

To do this, you need to use MailChimps Code Your Own option when it comes to the design stage. You then need to select the Paste in code option.

This gives you a text box into which you can compose your e-mail, marking it up with simple HTML tags. Here is the HTML that I used for the mail shown above:

<h1>This is a header</h1>
<h2>A smaller header</h2>
<p>Use p tags for the paragraphs of your e-mail.  You can also link to URL's with the a tag : <a href="http://google.com/">Google</a></p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut egestas a neque sit amet luctus. In eget justo a felis tempor gravida. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Curabitur sed feugiat enim, et semper nisl. Sed tempus arcu id magna mollis, ut viverra tellus rutrum. Nullam dui massa, ullamcorper id neque non, elementum lobortis nisl. Duis venenatis diam vel vehicula suscipit.</p>
<p>Vestibulum sit amet arcu felis. Maecenas dictum lobortis tempus. Praesent in eleifend velit. Sed facilisis diam non iaculis iaculis. Donec sit amet nisi metus. Mauris auctor erat non sollicitudin ultrices. Vestibulum gravida ullamcorper augue, ac placerat sapien consectetur nec.</p>
<p>Using lists:</p>
<ul>
<li>Unordered list item 1</li>
<li>Unordered list item 2</li>
</ul>

<ol>
<li>Ordered list item 1</li>
<li>Ordered list item 2</li>
</ol>
<p>You can apply <strong>bold</strong> or <em>italics</em> too!</p>
<p>Use br tags to create more space between paragraphs</p>
<br>
<br>
<p>That's it!</p>
<p><a href="http://www.glenscott.co.uk/">Glen Scott</a> - <a href="http://yellowsquare.info">Yellow Square</a></p>
<p><a href="*|UNSUB|*">Unsubscribe from this list </a></p>
*|REWARDS|*

Note: You only need to include the *|REWARDS|* tag if you are on the free MailChimp plan, otherwise you can omit it.

That’s it! I hope you found this guide useful.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Follow the bright spots

Chip and Dan Heath make a great point in their book about changing behaviour that you need to follow the bright spots:

Investigate what’s working and clone it

It’s something that I’ve realised is really important when you are running an online service like FreelanceDevLeads.

Since I launched at the beginning of the year, I’ve been focussing on finding out:

  • Why people are signing up for the free examples, and not paying for the full service
  • Why people are signing up and then cancelling after a month
  • Why people are visiting my landing page and not signing up at all

All of these issues are related to people that are not necessarily a great fit for my service.

The fact is, my service is not for everybody.

I should be focusing on the customers who are getting value from the service and have been quite happily using the service for months. These are the people that will give me the greatest insight on how to grow and improve the service.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

How to avoid time wasters when selling on eBay

I recently tried to sell my old MacBook on eBay, but the winning bidder had zero feedback and subsequently refused to pay. This was annoying, and it was only after this happened that I discovered eBay has some mechanisms to stop this kind of thing happening — but they are disabled by default.

So, you really should enable these options if you want to prevent time wasters and scammers from bidding on your items. You can access the options, called “Buyer Requirements”, by doing the following:

  • Login to eBay
  • Go to your Account Settings page
  • Click on Site Preferences in the left-hand menu
  • Under “Buyer requirements” click “Show” and then “Edit”

Here are the options I recommend:

  1. Block buyers who don’t have a PayPal account.
  2. Block bidders and buyers who have 2 unpaid item(s) recorded on their accounts within 1 month(s)
  3. Block buyers whose primary delivery address is in a location I don’t post to.
  4. Block buyers who have 4 breach of policy report(s) within 1 month(s)
  5. Block buyers who have a Feedback score of -1 or lower
  6. Block buyers who do not have a credit card on file. (Only apply this block to buyers who have a Feedback score of or lower.)
  7. Don’t allow blocked buyers to contact me.

Buyer requirements recommended settings for eBay sellers

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

404 Not Found

404 Not Found by hey mr glen

notfound.org provide a way of showing missing people on your 404 page.

I’ve just installed this on my blog using the WordPress plugin.

You can see it in action by visiting a non-existent page.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Are you running a WordPress site?

If so, you may be interested in a new service that gives you more insurance about your WordPress powered site.

It’s called WordPress Peace of Mind, and includes backups, security scanning and system updates. Above all it allows you to focus on the interesting parts of WordPress, without having to worry about the boring bits.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn

Visualise your Facebook Friends Network

I’ve got my Facebook app into a usable state, and would love to get some feedback from you all!

The idea was that I would spend no more than 10 hours work on it, so it’s a little rough around the edges. If you could spare a few minutes, please check out the following:

https://dry-river-5252.herokuapp.com

Facebook friends vis

It will examine your Facebook friends, and start to link them together. This process will take a while if you have many friends! After the linking process has been complete, the visualiation will re-arrange itself to show you clusters of friends.

You can zoom in and out, and scroll the visualization. Hovering over nodes also reveals the name of the friend.

Anyway, let me know what you think — most importantly, does it even work for you?!

I’ll add another post at a later date detailing the technical aspects of how I put this together.

Glen Scott

I’m a freelance software developer with 18 years’ professional experience in web development. I specialise in creating tailor-made, web-based systems that can help your business run like clockwork. I am the Managing Director of Yellow Square Development.

More Posts

Follow Me:
TwitterFacebookLinkedIn