Friday, 27 May 2011

A Painful Safari - Crashes, stalls?


Ever had one of those days, where everything just seems to be going wrong? Over the last 6 hours, I’ve been trying to debug why Safari, Mail.app, iTunes and Adium crash without ANY explanation, after any of said applications tried to load a webpage.
It started randomly (haven’t made major changes in the last few days), so I assumed it was something corrupted. The only hint was that after Safari, Mail, iTunes or Adium crashed, PubSubAgent would use 100% CPU time. So, I fire up Instruments and look at the trace for PubSubAgent. It seems to be calling CFHTTPCookieStorageFlushCookieStores many times, which is odd, because a quick Google doesn’t return anything useful about this system call, obviously related to CFHTTP.
Fast forward 4 hours later when I’ve cleared caches, nuked my Safari config, tried removing PubSubAgent (which just made it worse). The fix? Removing ~/Library/Cookies/Cookies.plist.

Oddly enough, it has a companion – ~/Library/Cookies/Cookies.plist – corrupt.
So, just a recap; somewhere the system knew my Cookies file was corrupted. But instead of spitting this out to the Console, throwing a Dialog, or ANY form of useful information, I had to trudge through my Library looking for something which could be causing the problem, and manually removing it. It was by chance that I noticed the Cookies folder, which is strangely not in the Safari folder where one would normally expect it.
And just to make matters worse; Safari’s “Reset Safari” did nothing to solve the problem. That’s right, checking the “Remove all cookies” checkbox did NOT remove the cookies!

Tuesday, 24 May 2011

Creating Linux (Centos) Live CD image on a USB Flash Driv


Then follow these steps:
  • Type : diskutil list in the Terminal and hit Enter
  • Plug in your USB flash disk and repeat step 1
  • Compare the result and you’ll have the device node assigned to your flash media. Usually something like "/dev/disk2" (sans quote)
  • Type : diskutil unmountDisk /dev/diskN in the Terminal and hit Enter. You’ll have to replace the /dev/diskN with the device node that you got from step 3. From the picture above you can see that the device node assigned for my USB flash drive is "/dev/disk1" (sans quote)
  • Type : sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m in the Terminal and hit Enter. But there are several things that you have to change here before you hit Enter:
    - first the /path/to/downloaded.img is the location of the downloaded UNR installer file. As we’ve already taken care of this before, all you’ve got to do is to change the string into/unr.img
    - second, the /dev/diskN is the device node which is the same as step 4
    - and the last, if you see the error line:
     dd: Invalid number ’1m’ 
    then you need to change thebs=1m into bs=1M (notice the capital ‘M’)
  • Write your password, hit enter, and wait until the process is finished. Please be warned that all the data in the USB drive will be lost.
  • Type : diskutil eject /dev/diskN in the Terminal and hit Enter.
  • Unplug your USB drive.

Friday, 18 February 2011

Change open_basedir in Plesk

This tutorial will show you how to change the open_basedir option on a Linux server with Plesk control panel.

Almost all the custom changes that can be made in Plesk but not through the GUI, must be set in vhost.conf file for each domain.

The location of this file is under $DOMAIN$/conf/

$DOMAIN$ should be replaced with a real path to domain home. For example it could be/var/www/vhosts/domain.com/ (on Fedora with Plesk) or/usr/local/psa/home/vhosts/domain.com (on FreeBSD with Plesk). As you can see this location may vary depending on Plesk version and OS. To find where the vhosts home is look into /etc/psa/psa.conf for HTTPD_VHOSTS_D variable set.

Inside $DOMAIN$/conf/vhost.conf you can change the options with the appropriate apache format. Here is an example about how to set open_basedir with 'none' option:



<Directory /var/www/vhosts/somedomain.com/httpdocs>
php_admin_flag engine on
php_admin_value open_basedir none
</Directory>

In case you want to do the same for SSL, just create a file 'vhost_ssl.conf'
Then put the settings inside to be for the secured document root folder :

<Directory $DOMAIN$/httpdocs>
php_admin_value open_basedir "$DOMAIN$/httpdocs:/tmp:/ADD_PATH"
</Directory>

There is one thing you have to do for appropriate using of $DOMAIN$/conf/vhost.conf . You must include this file into $DOMAIN$/conf/httpd.include like in the example bellow.



Just run the command below to make this happen:


/usr/local/psa/admin/sbin/websrvmng -v -a

Saturday, 29 January 2011

Wow, who would have thought - Multi Region Samsung

I've found this hack somewhere on the internet, it works for my R2 player. 

1) Turn on the player with no disc in the tray 
2) Press the Open/Close button to open the tray 
3) Press the info button, the firmware version shows up (mine was 080220.13.B.1080PXKEG) 
4) After the version info disappears, close the tray again by pressing the Open/Close button 
5) At this point, it will show "no disc" at the top. Press the Info button again, and this will disappear. 
6) Now type the code that applies for your region (R2 is 57538). A '2' will briefly show up at the top left corner 
7) Now press 9, and 9 will show up in the top left corner 
8) Power off the player, and turn it on again. You'll have a multi region player 

I've found the following codes at the 1080P7 hack: 
R1 - 29334 
R2 - 57538 
R3 - 56732 
R4 - 76884 
R5 - 53814 
R6 - 24462 

Not sure if all are correct, but it worked for R2.

Thursday, 13 January 2011

Top find - Remotely switch on Remote Desktop Client

How to Remotely Turn On (and off) OS X Screen Sharing


This procedure keeps security in mind.  The idea is to turn on screen sharing while you need it, and then turn it off when you’re done.  Also, the write-ups of Tim Boland and Chris Brewer were very helpful in figuring this out.


1)  SSH into your remote OS X machine with an administrator’s log in and password.
2) Enable Remote Desktop (a.k.a. Screen Sharing, a.k.a. VNC) with this command:


sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw mypasswd -restart -agent -privs -all


3) Login using a VNC client.
As I mentioned, TightVNC worked for me; for some reason, RealVNC and UltraVNC didn’t.  Your password is “mypasswd” (see the -vncpw flag in the above command;  you can — and should — change this).


4) When you are done, turn of screen sharing using your SSH session:
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -configure -access -off

Friday, 26 November 2010

Finally - embed yoube clips with valid HTML

Its easy, bot my invention or discovery, but I can no longer ind the source.

Anyway, this is how you do it:

< object type="application/x-shockwave-flash" data="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" width="400" height="326">
< param name="movie" value="[INSERT VIDEO URL FROM EMBED CODE PROVIDED HERE]" />
< param name="FlashVars" value="playerMode=embedded" />
< /object >


That's all there is to putting a video or slideshow from www.youtube.com into your pwn valid html.

Wednesday, 24 November 2010

Forms not submitting from an iframe (IE8, IE7)

So, we had a login system that was written in PHP.

The parent site got moved and so for reasons we can't remember, the site got a new URL. We then ended up putting the login system in an iframe...

... and the login stopped working in IE7 and IE8.

The solution is a simple header line at the top of the page inside the iframe:

<?PHP
header(‘P3P: CP=”CAO PSA OUR”‘);
?>

What this does is let IE retain the cookie/session information rather than start a new one each for each page.