Skip to main content

Posts

Fix ssh -Y with other Macs OSX 10.8 Mountain Lion

You may have realised that when you try use ssh -Y on another Mac from Mountain Lion you get the following error : Warning: No xauth data; using fake authentication data for X11 forwarding.X11 forwarding request failed on channel 0 Fixing this error only takes some simple configuration. All you have to do is add these lines to the following files on both machines: /etc/sshd_config X11Forwarding yes XauthLocation /opt/X11/bin/xauth XauthLocation /usr/X11R6/bin/xauth /etc/ssh_config XauthLocation /opt/X11/bin/xauth XauthLocation /usr/X11R6/bin/xauth That should be all you need to get rid of the authentication error. Hope this was helpful.

Mountain Lion's hidden feature , weeding out bad journalism.

Like normal , when something new comes out that I want , I read up about it (a lot) and the release of Mountain Lion was no different. However I was shocked to see how heavily opinionated and therefore unprofessional a lot of the reviews are , the particular one that shocked me was the review by G izmodo  . It's not exactly a new thing for journalists to be completely biased,sensationalist scoundrels but to me , this kind of thing is crazy for a tech review.  The general consensus is that you should give your opinion but not let it set the tone for your entire review and keep in mind that different users have different preferences. A key example of this idea being violated is the general opinion from journalists that the textured OSX apps like iCal(now Calender) , Notes,Reminders etc Look stupid and gimmicky. I on the other hand , like the look of the textured apps, so when I read a review that insults them ,I feel like the writer is insulting my preferences ....

Bringing back apache(Web Sharing) after Mountain Lion install

If you were a user of Web Sharing in OSX then you may have realised that the option for web sharing in Preferences is now gone in Mountain Lion. However the apache2 background is still there ,but all of your configs have been reset(you may find the old backed up ones lying around somewhere) and you will need to bring them back before starting up apache from the terminal. First things first though, I use php for my web stuff so I want to bring that back first. So I need to edit the file /etc/apache2/httpd.conf and uncomment the line that loads the php module:   LoadModule php5_module libexec/apache2/libphp5.so Save the file and we should be done(remember we need root permission to save changes to this file). Next I want to set up my php.ini. Go to /etc in the terminal and sudo cp php.ini.default php.ini Now edit the php.ini (don't forget the root permissions) to your preferences , I wont provide details on this because it depends whether you are using this machine for the...

Save the Mountain Lion

So I have Mountain Lion running one Mac , and I have already learnt something the hard way. Once you download , BACK UP the installer somewhere , after installing ,the Mountain Lion installer disappears without a trace so if you own more than one mac you are going to have to do the download again. Thats a pain I am sitting through right now. However , thanks to the existence of the new OS on one Mac I can still give some first Impression Opinions. I have only had the OS for a couple of hours and on first look you notice that the dock has changed , In my opinion for the better , the dock no longer has a glossy reflective finish that creates an annoying center line across the entire thing when a window is   maximized. The reduced reflections make it appear   a lot less cluttered and it just seems newer and fresher. The indicator light for open applications has become more subtle though and can be harder to detect when your brightness is turned up to the max...

Removing NSLogs from release build

NSLogs are great when debugging to see exactly what is going on but the downside is that they impact heavily on performance (I speak from experience on that one). Luckily there is a way to "disable" them on release builds of your application and still have them in your debug builds. we do this by simply adding the following macro to the prefix .pch file in your project or anywhere before the entry point to your application. #ifdef DEBUG #define NSLog(...) NSLog(__VA_ARGS__) #else #define NSLog(...) {} #endif If you want an explanation here it is. When you build a Debug version of an application DEBUG is defined , if its a release build , DEBUG is not defined.This macro checks if DEBUG is defined , if it is it sets NSLog to what it should be , if DEBUG is not defined then NSLog is defined as an empty code block that as you should know will do nothing , thus saving on performance.

Color status bar on iPhone

This is just a quick tip with some basic logic on how to get a colored status bar on an iphone app ,here i will be assuming that the app does not rotate so i will be placing all the code in appdelegate in the - ( BOOL )application:( UIApplication  *)application didFinishLaunchingWithOptions:( NSDictionary  *)launchOptions So the secret is really that there is no secret ,apples framework does not allow you to choose the color of the status bar so instead we set the status bar to the translucent  predefined style of  UIStatusBarStyleBlackTranslucent  and then we draw a colored view behind it to make it appear as though the color of the bar has changed. Here is a sample where i "tinted" the statusbar cyan in the app delegate : - ( BOOL )application:( UIApplication  *)application didFinishLaunchingWithOptions:( NSDictionary  *)launchOptions {         [[ UIApplication   ...

Using delegates in Objective-C

Why use delegation? Well when writing Objective-C programs in Xcode we are encouraged to use the MVC(Model View Controller) structure.In MVC a model cannot send messages directly to a specific controller.This can become a problem if data in your model changes independantly and you need to update this information in your view via the controller(The model must never communicate directly with the view).This is where a delegate comes in,it allows messages to be sent from the model to a controller that is not specified in the model but is rather specified by the controller,in other words the controller specifies itself. If you dont really understand what im talking about so far ,don't worry.I didn't understand delegates either until I needed one,but hopefully by the end of this tutorial you will understand not only how to use a delegate ,but the reason you would want to use one. Program breakdown For this tutorial we will write a program that has a model that will change an...