journal
all all entries rss SoML excited dreams runes YRUU ultimate KTRU skate sleepy nihongo
Rob is 20,117 days old today.
prev day next day printable version

Entries this day: PHP_function_trim_middle Wiki_wiki_wiki natsukashi_doesn't_begin_to_mean_what_I_mean

PHP function trim middle

1:42pm JST Monday 5 November 2007 (day 13739)

I've found need for a trim_middle function in PHP. Basically I'm printing URLs, and if they are something like

http://super.really.long.urls/so/long/they/cannot/really_fit_in_one/field,then

I'd like to reduce the middle of the URL to "[...]"

http://super.really.long.urls[...]/really_fit_in_one/field,then

the field will look a bit nicer and still have useful information.

So far, the code I have is:

<?php
/***********************************************/
//     echo trim_middle("this is a long string", 10);
//     thi[...]ng
/***********************************************/
function trim_middle($string, $len = 33, $center = "[...]")
{

	if(strlen($string) <= $len)
	{
		return($string);
	}
	else
	{
		return "too long";
	}
}
?>

Okay, now the code I have is here: PHP Function: trim_middle

permalink

Wiki wiki wiki

10:29pm JST Monday 5 November 2007 (day 13739)

Big fun on my wiki today; I learned how to add categories and created Programming with PHP code and Perl code as sub categories. I added the Digg.php extension (which, like the Flickr extension was also written by Ed Simpson), and I might add an extension called Categories as Tags, which allows people with edit permission to easily add categories to documents.

For work, I wrote a PHP function that trims the middle of a string, which I used on a page I worked on today (basically finished), and put the source code under PHP code on my wiki. Actually I put it under PHP functions, thinking I'd have enough PHP code to require a second category, but... for now at least, I don't need two PHP categories.

I dugg the Smugmug extension for MediaWiki using the Digg.php code, and was glad to see no other Smugmug extensions for MediaWiki. Is it a first? Is it going to be enjoyed by at least a few people?

I put the code for rob_updates.pl in the Perl category, and got a warning by MediaWiki: the page is "too big," and I should consider trimming it. Hmmmm. I think if it's not too big for me, it shouldn't be too big for my wiki.

Oh, and I finished "importing" email addresses into my Rob Updates list. I should check that off my todo list from yesterday

permalink

natsukashi doesn't begin to mean what I mean

8:19pm JST Monday 5 November 2007 (day 13739)

The most beautiful moments of my life so far were while on TSS The Topaz, sailing around the world with PB.

I chatted with Kristen in Calgary today. I had(?) a big crush on her, and am especially impressed now with her creating a new company called Grass Routes Travel, which will lead bicycle tours around different cool places.

I sent a comment to Eri in Toyama. She's and I meditated many mornings on the ship; I'm still not over my crush on her and her lovely smile. I still wonder if my reaction to Hitomi's impersonation of Eri broke the chances of seeing Eri again. Damn.

I've got two videos to watch: http://www.facebook.com/video/video.php?v=25645990200&auth_token=c298125d275baf367d84db0144e0f19e&installed=1 (perhaps you have to be her friend to see it), and http://f.flvmaker.com/mc.php?id=AwrFdggS2olEKcM8_4XfDOR8jt7q4yjap4Fo.D_ATHLWL_bQqEQGqpg7dI/zc/k/JpXPN8cbkiagS4jZjdg1_ti6 I'm not sure who made the second one. But they're both from the my 2nd PB voyage. My god was that awesome.

permalink
prev day next day