getBetween

I know I published this a little while ago but since then I’ve been tinkering with David’s original code to come up with a fast more streamlined getBetween function.

function getBetween($front = null, $back = null, $within)
{
	if( is_null($front) && is_null($back) )
	{
		return $within;
	}
	else
	{
		if( is_null($front) ) { $within = '!!KEY!!' . $within; } else { $within = str_replace($front, '!!KEY!!', $within); }
		if( is_null($back) ) { $within .= '!!!KEY!!!'; } else { $within = str_replace($back, '!!!KEY!!!', $within); }
		$temp = explode('!!KEY!!', $within);
		$hope = explode('!!!KEY!!!', $temp[1]);
		$faith["got"] = $hope[0];
		extract($faith);
		settype($got, "string");
		return $got;
	}
}

I’ve got a completely restructured version of this somewhere in code - but I can’t seem to find it. This has been running in production environments for about two months now and has proven it’s worth to me.

Acid 3 is Green

Midori. Green in Japanese. Is my new Firefox replacement. For the past few weeks after installing linux on my work machine I have been having trouble with Firefox consistently crashing. To the point where I’m about to move back to Windows just because I can not consistently have this happen.

I’ve stumbled upon Midori - and although it is still in “Heavy Development” it has quickly convinced me that there is hope. A very light weight foot print and stripped down look - Midori has managed to place the options and features I really use in a nice small browser.

Although Midori is Webkit based (and I who has been using Gecko based browser for such a long time) it still seems to render most pages better then I have experienced with Safari. Midori is also the first browser I have considered using which passes the Acid 3 test. Sure there is Chrome from Google but the only way to use that on Linux is through a poor implementation of Wine - there is also Arora (KDE Based), Dillo (Didn’t impress me), and Epiphany which was okay, just to name a few - I’m hoping that Midori continues to flourish from Development onwards and truly becomes what I hope it can. My new web browser.

Cox Internet - Terrible

As many of you know I have a small server running on my local network, a media center for myself while I work on my laptop. Not a lot of space on a 40 GB hard drive - especially with Windows and Linux. I’ve considered moving a few of my websites on to this box and install Apache, etc. Seems fair enough. I’ve used Cox for over 4 years and I know for a fact that they block inbound port 80 traffic. I am well aware of this. I figured I would call into Cox tech support and ask what I could do to get this unblocked, essentially how much money I would have to shell out to achieve this.

The gentleman on the phone, “Ben” I believe starts trying to get all my contact information, just repeating it’s against policy to host a server on Cox connections, etc, etc. I’m aware of this already and no matter how much I try to instruct him that it is behind my firewall and not public (yet) he still insists.

In the end I have no idea how much I would have to pay - maybe a business line something along that line. Nothing. I’m convinced now that I’ll be canceling my Cox service A) Because I’m suspicious that they’ll be monitoring my service more closely, and B) They aren’t very good.

I now wish to purchase Verizon FiOS but atlas it isn’t available in our area yet! I’m stuck.

Ubuntu 8.10 Intrepid Ibex

After about two weeks of lazy fretfulness. My irrational fear of upgrading my Laptop to the latest Ubuntu since I rely heavily on it. Finally took the plunge this morning - and it wasn’t that bad. After starting the update manager and initiating the update sequence we were off.


Go Cox Internet Go!


Replace sendmail conf? Do I even used sendmail? psh, no.


3 Minutes. Sure what’s three minutes after the last 50 minutes of waiting…


Come on! Almost there…


Done! Reboot because everything will be perfect.

That ends the easy portion of the upgrade. After my reboot I was expecting a nice quick smooth restart. After the nice loading bar, I get the beloved output screen showing that sendmail (MTA Agent) is taking forever. Why? I don’t ever use mailsend. After about two minutes of waiting the new revised and updated login screen starts up - Intrepid is a “darker” release for some reason. A sudden change of pace from Hardy.

After logging in I’m pleasantly surprised that none of my Gnome appearance settings carried over, the Switch User prompt has been heavily changed, and the Gnome Network Manager isn’t running. What the hell? Okay so got nm-applet running, chose the default Ubuntu Apperance and went to modify the menu.lst for grub.

Surprise! It appears HAL now manages keyboard/inputs and not the xorg server anymore. So HAL did a GREAT job of importing my old keyboard layout and setup. I lost functionality of Insert, Home, Del, Pg Up-Dwn, Left, Down, and Right. It’s hard to nano into config files when none of those buttons work. Also it wasn’t until I got into xorg.conf that I find out about HAL managing the configuration. Running the following commands worked out quite well.

setxkbmap -model evdev -layout us

After that it was just a few ascetic updates and a menu.lst update for grub. Of course then there is the updating for all those lovely third party sources.

I spent about 2 hours updating and fixing all the configurations. 24 hours later I’m pretty pleased with everything. Re-setup compiz and employed some of their new features, Wine appears to run pretty smoothly still. Although I was anticipating better performance in this release, it appears that I’m running at around 4% CPU and 25-30% RAM so it’s a trade off from Hard. Where I was around 10% CPU but 13-20% RAM.


I’m happy with the results

DNS Woes and the Programming Forge

So for the past week I’ve been working on the iPhone app (named WidyaDidya?), working at InMotion and our awesome customers, and working on the new SeaCrow server. Bridging two servers without clustering them is a pain - but I think it should be very successful. Hopefully we can start moving clients and offering the new server by the end of the month. It’s been a pain to get everything working - but I finally thing that all the features we were looking for can be accomplished by the new server.

Speaking of which http://widyadidya.com Which should be starting up soon as the site design is done.

(10:26:03 PM) Marco Ceppi: http://downloads.sourceforge.net/cotvnc/cotvnc-20b4.dmg?modtime=1137590472&big_mirror=0 download that
(10:26:15 PM) Mason Shelby: what is it
(10:26:21 PM) Mason Shelby: im still on loaner laptop
(10:26:24 PM) Marco Ceppi: I want to see if you can connect to my desktop with via VNC
(10:26:50 PM) Mason Shelby: ok
(10:27:39 PM) Mason Shelby: ROFL chicken of the vnc
(10:34:16 PM) Marco Ceppi: is it asking you for a server or host name?
(10:34:25 PM) Mason Shelby: yeah kinda
(10:34:33 PM) Marco Ceppi: Just let me know what it asks you fort
(10:34:54 PM) Mason Shelby: ok
(10:34:57 PM) Mason Shelby: Host
(10:34:59 PM) Mason Shelby: Display
(10:35:02 PM) Mason Shelby: Password
(10:35:25 PM) Marco Ceppi: ##.###.##.##:5900 Password is blank
(10:36:09 PM) Mason Shelby: WTF!!!!!!!
(10:36:11 PM) Marco Ceppi: Welcome to my desktop
(10:36:14 PM) Mason Shelby: JESUS!!!!!!
(10:36:20 PM) Marco Ceppi: haha
(10:36:28 PM) Mason Shelby: this is so crazy
(10:36:32 PM) Mason Shelby: this is fucking ridiculous
(10:36:40 PM) Marco Ceppi: This is how I get to my desktop from work
(10:36:47 PM) Mason Shelby: holy crap
(10:36:49 PM) Marco Ceppi: haha
(10:37:40 PM) Marco Ceppi: get shit on
(10:37:51 PM) Mason Shelby: dude extreme
(10:37:58 PM) Marco Ceppi: pretty sweet, huh?
(10:38:12 PM) Mason Shelby: i can edit your shit
(10:38:19 PM) Marco Ceppi: Yeah, you have full control on my desktop

I’ve never really had a need for VNC before. I mean from time to time when working at Ferguson I would need to RDP into the SQL server or the internal webserver. But since I’ve been working at InMotion I’ve found a need to SSH and VNC into my home laptop, dev server, and file server. I’ve now started using it for demonstrations for things that are pretty hard to explain on the phone or chat.

iPhone Apps

I’ve begun working on a small side project with an Australian man who is trying to make an iPhone application. I’ll be providing the back end coding which will essentially be an API for access vBulletin forum software. This is his site http://www.myphoneappsforum.com/ eventually we will be producing something to the tune of this: http://www.myphoneappsforum.com/?styleid=4 Except as an iPhone application and not a web page.

I’ve done phpBB work for a few years, but I’ve never really dug into vB - from just what little hacking I did last night it is similar to phpBB but there are still many manny differences - mainly how the data is handled. From what I can tell it just stores everything in one giant vBulletin object. so vBulletin->db is the database object. Where as phpBB holds db as its own separate entity. Also all data from the page being run is stored in the vBulletin object making it difficult to just separate what I want. Whereas phpBB just uses the templating system to assign what it needs to the page, vB dumps it data into the template system and has it figure everything out.

Should be a fun project regardless. I’ll post updates and code snips later.

This is the last part of a Chat with a customer. It was a 30 min chat about Database and people hacking his account. So I went though a few options and this was the result of that conversation.

Customer (02:44:52 pm) : the uploading is the step I am not figuring out… Where in cPanel do I see this?
Marco C (02:45:15 pm) : Once you recreate the database, you’ll need to log into phpMyAdmin
Marco C (02:45:20 pm) : and import the database file
Customer (02:46:41 pm) : AH! where it says “IMport” above Log out on the bottom of the localhost collumn?
Customer (02:46:53 pm) : “Import” I meant
Customer (02:49:53 pm) : yes?
Marco C (02:50:06 pm) : Correct
Customer (02:50:43 pm) : Thanks! Thank you for alll your explanaations earlier as welll!
Customer (02:50:56 pm) : signing off - you’re brilliant

I love people who appreciate us at support

getBetween

This is a function someone at work gave me today. I’ve been working on a Virtual Terminal so I don’t constantly have to PuTTy or the NLH domain Tool.

function getBetween($front, $back, $within, $key = "KEY")
{
	$within = str_replace($front, '<' . $key . '>', $within);
	$within = str_replace($back, '', $within);
	$_temp = explode('<' . $key . '>', $within);
	$_temp = explode('', $_temp[1]);
	$array_out["got"] = $_temp[0];
	extract($faith);
	settype($got, "string");
	return $got;
}

I’ve cleaned to code up to my liking and naming convention, but the idea was his. Nothing fancy but pretty useful. Thanks David.

Alpha, Bravo, Charlie?

http://www.psvmsa.com/alpha.php

function mil_encode($input)
{
	global $alphabet;
	$total = strlen($input);
	$input_array = str_split($input);
	$current = 0;

	while( $current < $total )
	{
		$tmp = strtoupper($input_array[$current]);
		if( array_key_exists($tmp, $alphabet) )
		{
			$input_array[$current] = $alphabet[$tmp];
		}

		$current++;
	}

	return $input_array;
}

That’s the main bits. $alphabet is an array where each letter “A” => “Alpha”, etc. The rest is just to make the page work.

SSI?

Ever wanted to run server side includes on your web server?

AddType text/html .shtml .shtm .htm .html
AddHandler server-parsed .shtml .shtm .htm .html
Options Indexes FollowSymLinks Includes

Don’t like index.html?

DirectoryIndex newindex.html alternateindex.php backupalternateindex.asp

Came across these today at work. I’ve been using them a lot - thought I would reference them.