Random Shite

Category: Development (Page 1 of 2)

Another rant about designers

I have a love/hate relationship with designers, and I can say with absolute predictability, that it’s mostly been hate.

Past experience of a designers sending a web site design done Adobe InDesign or a spec so concise it could fit on a fucking stamp, really didn’t make life easy. Of course, that’s presuming you get a specification at all, hearing the words “do what you want” always filled me with dread as I knew with certainty that I’d end up doing 17 revisions of same fucking thing over and over again because the vague phrase “clean looking” means jack shit.

I love that some prick just out of university with a degree in design can be paid an exorbitant amount of money to piss around in Adobe Photoshop, fucking around with every combination of RGB values until it looks “nice and clean.”   No, sorry, I forget they can also draw boxes and use type tool to put “So and so goes here.”

And heaven forbid if a developer, like me, doesn’t make it an exact copy of their ever so precious piece of design. Yes, that one pixel difference ruins it huh?  Twat.

In the past it has caused more stress than anything else. It’s their “baby” and their intransigence to any slight modification of MY design” beggars belief.

It’s actually quite refreshing that the UI/UX designer I work with is… well… a laugh to work with and actually flexible. He’ll sit next to me and suggest changes to his work, and he always asks me for my input. Who would of thought it was possible 🙂

I like to keep up to date with design trends, and so you can imagine my reaction when I read my design feeds, and some pretentious hipster prick is banging on about him being a design wizard/ninja/god/etc.

facepalm-description

I was reading an article the other day, and I forgot to bookmark it, where some cock was going on about a design he was working on, and how he had to, and I remembered this part in particular, “ninjitsu” something it to work.

Sorry? What the fuck is “ninjitsu”? But then I remembered I was reading an article by a pretentious prick, and from what I can gather, it what developers refer to as a bodge/hack/workaround. Developers don’t have an ego the size of fucking Jupiter, so we don’t “ninjitsu” anything, nor do we have an over inflated sense of self-importance to call ourselves “rock stars.”

Designers, learn to be just a little more pragmatic about things. Developers don’t try to be awkward for the sake of it, we don’t go out of our way to fuck up your precious designs.

 

Ooooo new feature… what can we do with it? Oh.

It’s amazing what you can do with technology these days, and it’s equally amazing on how little amuses the innocent and what goes through the minds of development teams when a new feature is added.

An example today is a new version of a mobile app the company is developing, and they’ve just added electronic signatures to the app, anyone who has tried to get your signature to look anything resembling reality with post deliveries will know how painful this is.

So after 30 seconds of trying signatures out, the development team decide to get creative. And draw stick men, and then of course the obligatory cock and balls.

Is your WordPress site running slow on an IIS server?

I’ve been working on an internal IT support board and after moving it from the local test server to a remote live server sending the URL out for test, we noticed how damn slow it was, for example, it was taking 10 seconds on every page to connect to a clicked link.

As it was Active Directory secured, changing it to the local AD controller to the server didn’t speed it up as much as I had hoped.

Someone then suggested changing the DB_HOST in the wp-config.php to 127.0.0.1 instead of localhost.

facepalm-single

Much to my amazement, the 10 second delay disappeared in an instant. So there you go, a quick fix to the problem and another reminded why I hate using IIS!

Change the ‘Howdy’ in WordPress admin bar

“Howdy, Mark Hall!” Oh please WordPress.

I changed it to ‘Hi, Mark Hall’ on the corporate web site, while looking through the functions.php for the IT Support Board, I decided to enhance it a little. What about a random selection?

[code]
/**
* Replace ‘Howdy’ with a random welcome message… because I can 😉
*/
function replace_howdy( $wp_admin_bar ) {
$my_account = $wp_admin_bar->get_node(‘my-account’);
$welcome_text = array(
‘Hi ‘, // So boring!
‘Well hellooooo there ‘, // too creepy
‘Ding dong! Hellooooo ‘, // Leslie Thomas
‘Another visitor, stay awhile. Stay FOREVER! ‘, // Impossible Mission
‘Howdy-doodly-do ‘, // Talkie Toaster
‘LTNS! HRU ‘, // chat room b*llocks
‘Uh oh, here’s trouble ‘, // no reason
‘Ah I’ve been expecting you ‘, // thanks Mark 🙂
‘Hello! is it me you’re looking for? ‘, // Lionel
‘You say goodbye, and I say Hello, hello hello ‘, // Hello goodbye
‘Sorry I can’t do that… Daisy, Daisy… ‘, // HAL
);
// could use array_rand(), but that would be too easy
$welcome_message = $welcome_text[mt_rand( 0, count($welcome_text) – 1 )];
$newtitle = str_replace( ‘Howdy,’, $welcome_message, $my_account->title );
$wp_admin_bar->add_node(
array(
‘id’ => ‘my-account’,
‘title’ => $newtitle,
)
);
}
add_filter( ‘admin_bar_menu’, ‘replace_howdy’,25 );
[/code]

Well that killed a couple minutes of working day 😉

Adding custom fields to your WordPress RSS feed

Our website uses the WP Job Manager plugin to manage the recruitment side of the web site, and after much hacking of the template, we’ve got it nailed now for the different job types in different job categories.

When asked to submit an RSS feed to AllTheTopBananas.com it came back as a fail as they need the salary and location fields. Hmmm, ok no problem. Add an action to put those custom fields into the RSS like this.

add_action('rss2_item', 'add_salary_location_to_job_rss');
function add_salary_location_to_job_rss() {
	// if the post_type is a job_listing...
	if (get_post_type()=='job_listing') {
		// add these custom fields with the XML namespace
		$fields = array( 
			'_job_salary'	=>	'salary', 
			'_job_location'	=>	'location',
		);
		$post_id = get_the_ID();
		foreach($fields as $field => $xml_key) {
			if ($value = get_post_meta($post_id, $field, true)) {
				echo "" . $value . "n";
			}
		}
	}
}

What could possibly go wrong?

Hmmmm guess who forgot how picky XML validation is and forgot to encode the $value.  Schoolboy error, so wrap the string with wptexturize():

echo "" . wptexturize($value) . "n";

And bingo. Validation finally. Maybe I should have checked with the W3C XML Validator first before sending it off again.

How to check if user is an admin in WordPress

I’m writing a custom filter in WordPress today for an internal support board powered by AD and WordPress user roles/capabilities.

The logic in the spec (such as it is) is along the lines of Is user posting isn’t an admin, find the admin of the user group (business support, technical support or integration) and send them an email to publish the article.

It’s taken hardly anytime to do this, but Googling for it before I started, I came across some misinformation from uninformed tossers on WordPress.org who looked at the codex and saw is_admin() function and assumed that’ll do the trick.

According to these idiots:

if (is_admin()) {
	echo "Hello administrator";
} else {
	echo "Hello lesser mortal";
}

is the solution to the problem of finding out if the logged in user is an administrator.

No it doesn’t you cretin. Quote WordPress Codex:

is_admin() is not intended to be used for security checks. It will return true whenever the current URL is for a page on the admin side of WordPress. It does not check if the user is logged in, nor if the user even has access to the page being requested. It is a convenience function for plugins and themes to use for various purposes, but it is not suitable for validating secured requests.

And if don’t understand what that means, it translates as a check to see if you are in the admin SCREEN!

This is why the internet is full of crap WordPress themes and crap WordPress plugins, because people believe shit like this posted on the forums without double checking first.

If you want to find out if the user is an administrator, try this:

# guess what? this gets the current user information
$current_user = wp_get_current_user();
# is 'administrator' in this users roles?
if (in_array('administrator', $currentUser->roles)) {
	echo "Hello administrator";
} else {
	echo "Hello lesser mortal";
}

 

The pond life known as ‘web designers’

Just having a conversation with a network administrator, and as he started to mock me as a web developer, I happened to mention that at least I’m not a web designer, they are after all, and I quote “lower the down the evolutionary ladder than an lobotomised amoeba.”

5a494044ca95aa678665b443a486506269af2c168414ffdde3f351cf1917b198

Was I too harsh? Not a fucking bit.

I’m sure web designers are very good at sitting in front of Photoshop or Fireworks all day, dreaming up what passes for “design” with this week’s current trends.

Just don’t think you can interfere with the development process once your job is done.
That’s when I start to lose my temper, and any respect, if there was any to start with.

Web development is a pain in the arse at the best of times, but then having to deal with the convoluted HTML that some WYSIWYG editor has spat out with hundreds of tiny image because “it’s the best use of bandwidth” that some cock has ‘designed’ is really the icing on the cake.

If you want to know how to deflate these fuckers ego’s, just show them how their pride and joy web site, hot of the press, is going to look on a mobile device and ask them to fuck off back under the rock they came from and don’t come back until they’ve got a plan for it.

Web designers have ego’s? Hell yes. There’s an annoying trend at the moment for those designers who thing they’re the dog’s bollocks and are trend setters, not trend followers. This trend is to call themselves a “ninja” or “rockstar” designer. Really?

 

idiot-nerd-girl-meme-generator-uses-bgsould-blink-and-marquee-tags-i-m-a-web-designer-c741a7

To me, it’s like someone who can program in BASIC telling an assembler or C++ coder how to write a program.They have a simplistic view of development through the eyes of HTML and jQuery, which somehow entitles them to start telling me how to do PHP and MySQL.

No, you can fuck right off.

web-designers-vs-developers

« Older posts