All posts in Coding

What is a Kext?

A common misconception seen on a lot of places is that a .kext file is some sort of driver for the Mac OS. That is not entirely true – the kext resembles a driver but does a lot more than just act as a driver!

Definition

kext stands for Kernel Extension and is an extension used by special files in the Mac operating system (OS). These files are often pretty small and act as an interface between the core of the OS and hardware (such as WiFi-cards, Bluetooth-cards, trackpads, graphic cards), filesystems and other items central to the OS’s operation. They can be written and compiled in different programs, but many people use XCode because of the compability and ease of compiling. When working with osx86-installations or hackintosh-related systems, one often needs to write modified kext’s to enable the OS to recognize certain hardware – without them a “hacked” Mac OS would not be possible.

Where are the kext’s located?

In the Mac operating system, most, if not all, kext’s are located in the same place – the /System/Library/Extensions folder. At boot, all the kext’s needed are cached into a file called Extensions.mkext prior to being loaded. To clear the extension cache after installing a new kext, simply delete this file and it will be re-created (resulting in a slightly slower boot speed). If you’re looking to start coding your own extension, you might want to check out Apple’s Dev Center’s kext section – it includes examples and tutorials to get you started.

How do I install a kext?

The simplest and most straight-forward method of installing and applying a kext is to use the Kext Helper application. Simply install it, run it, choose the kext you wish to apply and enter your password – it will do the job for you, backing up any kext’s you overwrite and even optionally showing you what it’s doing. Upon completion, restart your computer and your new kext will be applied!
If you’re looking for a more advanced way of applying a kext, you can follow the following steps:

#1
Rename the kext you will be updating – doing this will ensure you have a backup of your old kext in case any problems arise.
cd /System/Library/Extensions
mv KextName.kext KextName.old

#2
Copy the kext to the main kext-folder.
cd /path/to/new/kext (put your downloaded kext path here)
cp -R KextName.kext /System/Library/Extensions

#3
Next, you must alter the permissions of the file in order to allow the system to execute it (make it an executable).
cd /System/Library/Extensions
chmod -R 755 KextName.kext
chown -R 0:0 KextName.kext (this will set the ownership on the file to you)
rm /System/Library/Extensions.mkext (removing the kext cache in order to update the kexts)

Hope this cleared up some of the questions that often arise! Good luck with your modding!

Sources
http://forums.macnn.com/79/developer-center/81624/what-is-a-kext-file/
http://www.ihackintosh.com/2009/02/what-is-kextwhere-is-kext-how-to-install-kext/

Considering Switching – ExpressionEngine versus WordPress

In one of my new projects, Thy Old XBOX, I have used WordPress and had a chance to look at its numerous blogging-friendly features. That, and EllisLab’s rather horrid way of handling ExpressionEngine 2.0’s release and the fuss around it, has got me thinking. I am in all honestly wondering whether WordPress would suit me better than ExpressionEngine does. However, I still strongly believe ExpressionEngine is the way to go, and I still love it and everything about it. So what has suddenly arisen my thoughts about WordPress? I’ll try to outline a few points.

Advantages with WordPress

  • Blogger-friendliness – feature-wise, WordPress beats ExpressionEngine when it comes to catering bloggers. The ease of instaling plug-ins, the ability to save drafts, the simple way to add tags and categories, the robust way to incorporate images into posts – all this makes WordPress stand out.
  • Style and styling – face it – WordPress is very sleek. Everything about it is very Web2.0, shiny, simple and stylish. That alone, and the broad range of themes available to further make it sleeker puts WordPress ahead of many platforms; especially ExpressionEngine as it has very few downloadable themes.
  • Price and license – WordPress is free and open-source. ExpressionEngine is also free if a personal license is used, but it’s not open-source. Open-source not only usually produce great software, but it also conveys a message of trustworthiness to the users – increasing WordPress’s popularity.
  • Add-on functionality – this is a big one. WordPress is more popular and wide-spread than ExpressionEngine and this shows; plug-ins, scripts, tutorials, articles and other material related to WordPress is much easier to find and is so vast that as a regular blogger one will never face a problem without a solution or lack of functionality.

There is still a lot of things holding me back, though. ExpressionEngine is a wonderful engine for people who build and maintain websites for many reasons – here are a few.

Advantages with ExpressionEngine

  • The Template-way of building a site – the way ExpressionEngine handles templates is absolutely wonderful. It is incredibly straight-forward and requires no tutoring before-hand – the basics structure and function is so easy and logic to understand that even a novice, regular blogger might be attracted!
  • Control – what I mean by this is the extensive control ExpressionEngine gives you when building a site. You know exactly what you display and how much resources this takes – and as you’re the one writing the code that displays you know exactly what you’re looking at. WordPress, being very simple and easy-to-use, gives you a complete and ready-to-use template and you’re never really sure how many database requests are made, how much resources are allocated and what scripts are loaded – and if you’re in need of control you’ll have to go through every bit of code by yourself. Now this doesn’t apply to most regular bloggers, which are those WordPress caters to, but it is nonetheless an issue that ExpressionEngine overcomes.
  • Userbase – as ExpressionEngine is used by numerous professional website-agencies and consultants, its community forums is frequented by people who know what they’re talking about – people who give the right advice at the right time. Not only with coding issues but with general questions concerning websites and everything around it. WordPress has an amazing userbase too, and of course numerous web agencies use their engine too – but you’ll never get the closeness and the same warm helping hand as you get with ExpressionEngine.

That covers only three advantages, yes, but they are three major advantages and do actually outweigh WordPress’s. I love the way ExpressionEngine works and it just plain suits me, that’s why I will stick with it in the future too. Here’s a little comment I wrote on Joshua Wood’s site Distance to Here.

I’m considering switching to WordPress too, mainly because (as you mentioned) the blogging features outrun ExpressionEngine completely. I love ExpressionEngine too, I love everything about it – the templates system and overall the simplicity and the closeness to how one would develop a site completely in PHP…
Is WordPress easy to skin? Is the template engine as straight-forward as ExpressionEngine’s?

Oh and I read you were talking about EE2.0 and its release coming up soon. With all due respect, EE2.0 has had a scheduled release the past 1.5 years (although it seems to have a final release-date set now, actually), and I think a lot of people (including me) have waited way too long for it and are getting tired.

Hopefully EE2.0 brings some blogger-friendly features along – otherwise I doubt EE can keep attracting customers other than purely developers and/or consultants. What are your ideas?

Should we give Legacy Users less Features?

Found this interesting read over at ExpressionEngine.com and their forums. It’s about legacy browsers and how to compensate for the time it takes to develop sites for them.

Working with Legacy Browsers and Reduced Functionality

I also had my own little say in the argument.

I don’t fully agree with you, after reading the whole post (a very interesting read, nonetheless). Giving legacy users less functionality just because they are using an old browser (which could be due to lower privileges) just does not sound right in my ears. If there was such a thing as “browser racism” I believe it would fall into that category.

Fixing IE-bugs is annoying, but in the end it does almost always pay off. The perfect site is a site where you (as a developer) avoid building two different sites (one legacy and one regular). The perfect site is a site where all features are available to all users, regardless of browser or operating system.

In my opinion, of course =) !

After some more argumenting:

I think the difference between “less features for old browsers” and “more features for newer browsers” is very much the same thing. It all narrows down to not giving older browsers better goods because of either laziness or lack of time. Most often, also, removing the bells and whistles is the same as removing a good reason to like a certain site.

I just want to say that I would rather develop a site thoroughly and add features that risk bugging out in a step-by-step manner, making sure everything works in the end. It is a lot of work, but it is rewarding!

Agreed, but when developing smart features for say, an e-shop website, and not sharing these with IE users will leave them frustrated.

New Design (again?)

What a relief! Just finished off the new design, added all the tidbits and copied it over from localhost.
This baby had me working for days, and I’m still not a 100% satisfied. But hey, at least it’s better than the old one? As you can see from the bottom menu, I’ve used some jQuery to get the slide-effect in place.
I’m still working on adding the RSS feed and creating the contact-form. I’ve also decided to skip the whole ability to post comments, as for now at least.

Soon you will be able to comment again, by contacting me =) !

Serious Work on the Gallery has begun

I shall from now on spend more time on designing, and updating the gallery than I have before. You will soon see a much smoother interface and a big load of new photos.
I shall also hoover the Interwebs for design inspiration for the gallery as well as the blog itself. You might happen to see a new UI in the coming few weeks, although school is taking most of my time at the moment.
Anyhow, stay tuned, as I like to say!

Working on a PHP Poll

The past few days I’ve begun working on a homebrew poll application written in PHP.
It utilizes the latest PHP features such as custom classes, objects and functions, working hand-in-hand with AJAX scripts giving it the best performance and functionality available.

I’ve only yet started on it, and I have still a dozen or so features left to code, but it’s starting to take shape very nicely.
I’ll keep you posted on the progress!

Sitemaps? Why?

Why would you want to keep an ugly XML file with references to all your links? How is that necessary in any way? How do you generate it?
I’ll try and answer those questions in an orderly manner, but first I will give you a brief introduction on XML.

Basically, XML (Extensive Markup Language) is a code-language designed to be as easy as possible to read and interpret, for both browsers and search-engine spiders. It uses easy to read tags which, unlike HTML, can be named after anything. <quiz>, <game>, <lol>, etc.
XML files are known to have a very clean structure and they are optimal to use when interacting with search-engines, as they only look at your code and nothing else.

A sitemap is an one-page XML directory consisting of all the various pages within a site. Within each <url> tag is information about the URL of the page, the last modified date, the priority and a host of other things.
How does this help the search engine, then? If you’re coding your homepage in fancy AJAX Javascript, or in other ways have links to pages that aren’t easy for the spider to find, a sitemap is an easy way of getting those pages indexed as well.

Now, writing a sitemap yourself can be a pain, especially if you have hundreds of pages to keep track of. Nowadays, most CMS’s (Content Management Systems) have sitemap-generation included in some form, whether it’s built in or can be added through a modification. If you’re using your own CMS, or you’re manually coding every page by itself you might want to consider checking out Sitemap-generators (search on Google for that). Information on how a sitemap is supposed to look can be found here.

I hope you’ve gotten a clearer picture of what a sitemap is. If you have any more questions feel free to either comment here or contact me.