Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Loïc Faugeron:
Short Identifier
Jun 22, 2018 @ 18:12:21

Loïc Faugeron has a post on his site covering the concept of short identifiers and covering some of the common types along with some of the downsides of the use of each.

Sometimes resources can be identified by one of their attributes (a name, title, slug) and sometimes they can't (no name, or confidential name). In the later case, an ID needs to be artificially crafted.

Two of the popular strategies is to use either an auto incremental one or a universally unique one, however when it comes to share them publicly, both strategies present some drawbacks

He lists several different types including:

  • Auto Incremental IDs
  • Short IDs
  • Hashes
  • Alphabetical representation

In the end, the method he recommends is hashing the ID value and using the first few characters (much the way you can refer to commit hashes in the Git version control tool).

tagged: short identifier list tutorial hash autoincrement shorten

Link: https://gnugat.github.io/2018/06/15/short-identifier.html

That Podcast:
Episode 7.5: The Short One in London
Sep 29, 2014 @ 18:52:09

That Podcast has posted their latest episode today, a shorter add-on to their previous episode (#7): Episode 7.5, "The Short One in London".

Beau and Dave recap SymfonyLive London 2014 in their first live in person recording.

Topics mentioned in this episode include Mybuilder.com, Behat, Drupal and Game of Thrones (along with several members of the community). You can listen to this latest episode either through the in-page player or by downloading the mp3 of the show. If you enjoy the show, check out others in their list and be sure to subscribe to their feed for the latest as they're released.

tagged: thatpodcast ep7.5 short one london symfonylive live recording

Link: http://thatpodcast.io/episodes/episode-7-5-the-short-one-in-london/

Freek Lijten's Blog:
Currently on PHP's internals...
Jun 16, 2011 @ 13:57:16

Freek Lijten has a recent post looking at some of the types of discussions that happen on the php-internals mailing list.

The internals list is the place to be to hear about the current state of PHP. It is one of PHP's many mailing lists, but this is the one where (core) developers discuss new features, current bugs and wild ideas. If you want to keep up with things it is a good idea to sign up, it is not an extremely high volume list and if you ignore the noise it is quite informative. In this article I would like to share examples of stuff typically discussed on the list.

He mentions feature requests in general and, more specifically things like traits support (multiple inheritance), array dereferencing, callable arrays and the debate over the short array syntax.

tagged: phpinternals mailing list traits array dereference callable short syntax

Link:

Derick Rethans' Blog:
Short URLs
Feb 22, 2011 @ 15:44:13

Derick Rethans has shared a method he's created for making short, descriptive URLs with the help of his translit PHP extension that translates non-latin characters into latin ones.

The URLs for my articles are automatically generated from the title. There is a little function that uses translit's transliterate() function to ASCII-ify the titles. [...] However, [this] is hardly a short URL. What we want is something short and descriptive. First of all, I thought it would work to generate short URLs automatically.

In hindsight, though, he decided it would just be better to come up with his own short URLs but he still wanted a way to use them. Registering a short domain helped and, along with some <link> tags, made it easier for the right information to be automatically found.

tagged: short url shortener translit tutorial

Link:

Richard Thomas' Blog:
Solar Framework Shorts - Using Jquery with Solar
Dec 08, 2009 @ 15:45:02

Richard Thomas has another Solar Framework Short posted today looking at how to integrate the jQuery Javascript library directly into your Solar application.

When it comes to Jquery integration you have 2 main uses. Calling a php function from a website or calling Jquery functions from php both are done through an XMLHttpRequest.

By extending a jQuery-related controller, you gain some special automatic abilities like automatic json-ification of output data and being able to push out transformations directly back to the browser from a standard javascript call. Check out the post for the complete source code for his example.

tagged: solar short jquery integration

Link:

Richard Thomas' Blog:
Solar Framework Shorts - Deleting Caches
Sep 28, 2009 @ 16:11:57

Richard Thomas has posted a new "short" for users of the Solar Framework to delete cached data.

This one is simple but sweet, In your Models directory you define your Models and the basic rules they follow but do you know you can also make changes at the record level. Solar is smart and if it sees a Test/Record.php when creating records for the Test model it will load that class, this allows you to do all kinds of magic.

His example shows how the script can automatically check, on pre-save, to see if the data is different than that in the cache and remove it if so. This cached data is replaced the next time through with the latest information.

tagged: solar framework short delete cache automatic

Link:

Joshua Eichorn's Blog:
Adding Supr urls to your site
Jul 01, 2009 @ 14:22:41

In this new post to his blog Joshua Eichorn talks about a an automatic URL shortening service he has worked up, Su.pr, and how you can use their API to create shortened URLs for you own site.

Last week we launched our API which lets you integrate shorten and post functionality into any site or application. Today we are adding the ability to use your own domain for shortening. This lets you have urls like http://joshuaeichorn.com/9OPL so your readers can know what domain they are going too before they click on the link.

Using the API lets you set up, via a mod_rewrite (or any other URL rewriting tool) to match requests on your domain for a shortening code and make the call back to get the original URL as stored on the Su.pr service. You can find more details at this page on the StumbleUpon site.

tagged: stumbleupon api url short supr

Link:

Kevin van Zonneveld's Blog:
Kevin van Zonneveld
Jun 11, 2009 @ 12:57:21

On his blog today Kevin van Zonneveld shows how to create short URLs for your content and store them in a MySQL database.

IDs are often numbers. Unfortunately there are only 10 digits to work with, so if you have a lot of records, IDs tend to get very large. For computers that's OK. But human beings like their IDs as short as possible. So how can we make IDs shorter? Well, we could borrow characters from the alphabet as have them pose as additional numbers.... Alphabet to the rescue!

He includes some sample code that takes the shortened code and converts it back down to the correct ID and returns it out of the function. The trick compresses values down into shorter alpha-numeric strings that can make for simpler links (and smaller messages for things like twitter).

tagged: mysql tutorial url short

Link:

Jonathan Snook's Blog:
Building a URL Shortener (with CakePHP)
Apr 27, 2009 @ 17:06:23

With recent discussions about URL shortners, Jonathan Snook decided to work up his own quick version using some of the built-in routing of the CakePHP framework.

With all the talk of URL shortening services, I decided to add a quick service into Snook.ca, which is run on CakePHP, to redirect a short URL to a post. Because my static content already has short URLs and all I have are posts, creating a short URL handler for it was very easy.

His shortener is used on his posts for his blog to redirect the smaller URLs back to the post they reference. The result is a route that connects something like "/s/id_number" over to the correct post (as seen here). He also offers a suggestion for a "super-compressed" URL tat converts it down to a three-character shortened version that can then be easily converted back down to the decimal equivalent.

tagged: cakephp framework url shortener short route custom

Link:

Brian Moon's Blog:
Short Array Syntax for PHP
May 29, 2008 @ 16:13:00

There's been some talk floating around about a proposed additional syntax for creating arrays in PHP. Brian Moon sums it up nicely in a new post to his blog.

So, I was asked in IRC today about the proposed short array syntax for PHP. For those that don't know, I mean the same syntax that other languages (javascript, perl, python, ruby) all have. [...] It just feels like a good addition to the language. It is common among web languages and therefore users coming into PHP from other languages may find it more comfortable.

He compares it with other data type creation in PHP (you don't call int() to make an integer, so why call array() to make an array). However, according to a post from the internals mailing list, we might not be seeing this any time soon.

tagged: short syntax array function integer string language construct

Link:


Trending Topics: