Jourdein

I code, I experienced, I blog and I share my enthusiasm

RSS
people

Cross browser styling for inline-block

IE does support inline-block css styling but to which the elements are natively inline. Apply inline-block styling to strong, spans and ems.

But there’s another thing. If hasLayout is triggered on a block element, and then set that element to display inline, it will automagically become an inline-block in IE. However, you must do a *property hack to hide the display:inline from non-IE browser.

display: inline-block;
zoom: 1;
*display: inline;
No Comments | Tags: , , ,

I tried Git

images-1.jpgCurrently, I hosted my repositories with XP-Dev that utilize Subversion as it’s source code management system (SCM). Hearing a lot of hypes about the Git, I did try setting up a git account at Project Locker.

images-3.jpgYep, it seems that Git is really is an advance SCM. It has a lot of features. What differentiate it from Subversion is it’s decentralize repository system. Rather than recreate the post, you can read it at Why you should switch form Subversion to Git.

images-2.jpgOn Mac, if you’re using git, there an open source Git UI called GitX. It trying to utilize the advance features in Git producing such an interface. You have a history graph which I’ve never seen in Subversion UI yet. After you commit, you can see which file and which line has been merges/changes rather than executing command diff.

When you first checkout, you are cloning form the main repository. Thus, when you are in offline mode, you can still commit or revert to previous revision. When you online, push it the server and it will merge with other repo.

Frankly, I would love to convert to Git but project-wise, Subversion can still do what Git can do since my project is not so big and with small team. Moreover, Git is complex because of features it has while in Subversion, I just need to commit or update and does not worry about commit, push and branch merging etc.

No Comments | Tags: , ,

ForkLift 1.7 crashed on Snow Leopard

forklift.pngI’ve install ForkLift 1.7 and suddenly, it crashed. Examining the report that is supposed to be sent to Apple, I found that, ForkLift is trying to access some of the files that aren’t there.

Googled and found that the files has been placed under a different folder in Snow Leopard. Logical thinking, the files are there but ForkLift doesn’t know where they are.

Found a fix that restore those file references by creating symlinks:

sudo ln -s /System/Library/Frameworks/AppleShareClientCore.framework /System/Library/Frameworks/AppleShareClient.framework
sudo ln -s /System/Library/Frameworks/AppleShareClientCore.framework/Versions/A/AppleShareClientCore /System/Library/Frameworks/AppleShareClientCore.framework/Versions/A/AppleShareClient
sudo ln -s /System/Library/Frameworks/QuickLook.framework /System/Library/PrivateFrameworks/QuickLookUI.framework
sudo ln -s /System/Library/Frameworks/QuickLook.framework/QuickLook /System/Library/Frameworks/QuickLook.framework/QuickLookUI
sudo ln -s /System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLook /System/Library/Frameworks/QuickLook.framework/Versions/A/QuickLookUI

Run the above commands in terminal. If you have problem copying and pasting, download it here. Execute the file from terminal either by

$ ./fixsymlinks

or

$ source fixsymlinks

From whom did I get the solution… Zolntanb (thanks mate)

No Comments | Tags: , , , ,

Hosting server migrated

legal-bytes.com was down and at the time of posting, it’s still down. I’ve just waiting for the domain changes to take effect.

I thought, it was the problem related to the server and that I just need wait until it is fixed. It was down for 3 days (approximately) that I took the liberty to send a support ticket to Exabytes‘ support engineer. Immediately (not hour or even half an hour), they replied with the explanation:

For your information, the server 210.48.145.6 already migrate to the new data center and we have update the IP to 110.4.45.29

legal-bytes.com didn’t use their DNS records but just pointing the A record to the shared IP address associated with our hosting package. For that matter, I think, the update of the IP didn’t automatically configured to the domain and thus need the domain administrator to change it manually.

I was very very happy with Exabytes for the services they’ve given. Recommended if you are finding one.

Updates
Did asked if the old DNS still applied and the answer is “not anymore”. It has changed to

Old

ns67.mschosting.com 210.48.145.7
ns68.mschosting.com 210.48.145.8

New

ns101.mschosting.com 110.4.45.4
ns102.mschosting.com 72.18.132.245

No Comments | Tags: , ,

Working after hours

This in one the events that takes place in 2009 about giving power to MACC (Malaysia Anti-Corruption Commission) to detain suspect after office hours. I at first, without reading more, believes that the agency should be given this power to detain after office hours…because crimes happen also after office hours.

Today, I realized, I’m too shallow in knowledge. Found this comment in chedet blog. I took this one from many others as it simply summarized all the points.

By S..Tan on December 28, 2009 11:22 PM

………………CONSTITUTIONAL FREEDOM

The constitution entrusts the police force with security, law enforcement, power of detention. MACC does not exist when constitution written and is not envisaged to hold such powers.

The High Court judge is right, the constitution should not allow too many bodies power over civil liberties. Similarly the constitution does not grant prosecution powers to other bodies except Attorney General.

The judge is looking at civil liberty and freedom. Detention without trial or charge (24hrs interrogation) is violation of basic freedoms and should not be granted freely.

……………..ROLE OF MACC

MACC is a post crime investigation agency, not pre crime prevention body. With investigative not security or preventive powers (from its actions so far) there is no need to give this agency 24hrs detention authority without charge or trial.

Power of detention should be given to only security and safety agencies, not agencies investigating political parties, councilors purchase of stationery etc.

…………….CIVIL RIGHTS ABUSE

It will lead to civil rights abuse which such powers over civil liberties is prone. Already the police (one agency granted such powers) sometimes act out of control.

Since the crime already committed and no security risk involved why need 24hr powers? Anyway if MACC require such power they can refer police.

……………..REDUCING CRIME

Giving MACC 24 hrs detention powers will not reduce crime, as it only acts after the crime has taken place. But dissolving Umno is guaranteed to reduce crime by 900 cases (Tun’s quote on Umno corruption reports)

I do not need to summarize again. The above quote says it all.

Investigation can be done outside working hours but detention of suspect is done during office hours. Call police if requires detention after office hours.

No Comments | Tags: , ,

Google Chrome for Mac

mac-os-x-developer-release.jpegFinally it’s here…

But not quite here yet because currently, the Google Chrome for Mac is for developer preview only. You can download but the thing is not stable here and there.

I’ve downloaded and I like it very much. During this 2 hours using it, I found no problem what-so-ever yet. The clean interface and larger viewing area are the thing that pleased me when browsing site using Google Chrome.

Visit the developer channel for more info

No Comments | Tags: , ,

Wordpress Cheat Sheet

There’re so many functions in Wordpress. You couldn’t catch up all of them. Here a Cheat Sheet I found at Ekin Ertac.

No Comments | Tags:

Re-Enable Edge toggle on iPhone

any_cellular_data_configuration

Last time, my bill goes up over the roof and into the pond.. :p because the iPhone was intelligent enough to figure out the setting for the Edge APN,Username, etc. I found somewhere on the internet to stop this by entering any incorrect information in it.

However, a couple of days ago, I accidentally accept an update on iPhone carrier setting which removed the configuration page. (the page reside under Settings > General > Network > Cellular Data Network). The removal of the config page allow me to to have an internet connection, which I don’t want because I haven’t subscribe to any package, thus the rate would be insane. (I think, this carrier update is applied to Maxis subscriber only since Maxis has launch its iPhone 3G).

I found a way to revert back to re-appear the config page:

  1. SSH to /User/Library/Carrier Bundle.bundle
  2. Sort list by “latest modified” and selecting it will bring you to another folder.
  3. Find MAXIS_my.bundle and delete it (advised if you backup first in case something happen)
  4. Reboot iPhone

Reference:

No Comments | Tags: , ,

Reset Leopard to its initial state

leopard-welcome

Reset or some called it “revirginize” is putting the Leopard to state where it’s first bought/installed, where you would see welcome screen/video and setup/customize your Mac OS X Leopard installation.

1. Enter “Single User Mode” – (press Command-S during startup)
2. Check file system:

$ /sbin/fsck -fy

3. Mount root partition as writable:

$ /sbin/mount -uw /

4. Remove file .AppleSetupDone (hidden file):

$ rm /var/db/.AppleSetupDone

5. Remove user(s)

$ launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
$ dscl . -delete /Users/{username}

6. Remove user(s) Home directories:

$ rm -rf /Users/{username}

7. Reboot

I think the option 4 is the key procedure here that make the installation reset to its initial state.

Sources:

No Comments | Tags: , , , ,

Sliding UITextFields visible when keyboard appear

When keyboard visibleBefore keyboard visible



I thought there was an easy way such as enabling it in IB but seem I had to go to Google to find out how. For those who want to know how, here’s the original source.

Mainly, the codes involve on delegate functions:

- (void)textFieldDidBeginEditing:(UITextField *)textField
- (void)textFieldDidEndEditing:(UITextField *)textField

So, here’s the codes

1
2
3
4
5
static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3;
static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2;
static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8;
static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216;
static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 140;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
- (void)textFieldDidBeginEditing:(UITextField *)textField {
   [UIView beginAnimations:nil context:NULL];
   [UIView setAnimationBeginsFromCurrentState:YES];
   // the setAnimationBeginsFromCurrentState allow smooth transition
   // to new text field if the user taps on another
   [UIView setAnimationDuration:0.3];
 
   CGRect textFieldRect = [self.view.window convertRect:textField.bounds
                                               fromView:textField];
   CGRect viewRect = [self.view.window convertRect:self.view.bounds
                                               fromView:self.view];
 
   CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
   // find the midline of textfield
   CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION
                       * viewRect.size.height;
   CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION)
                       * viewRect.size.height;
   CGFloat heightFraction = numerator / denominator;
 
   if (heightFraction < 0.0) { heightFraction = 0.0; }
   else if (heightFraction > 1.0) { heightFraction = 1.0; }
 
   animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT*heightFraction);
   self.view.frame = CGRectMake(self.view.frame.origin.x,
   self.view.frame.origin.y-animatedDistance,
   self.view.frame.size.width,
   self.view.frame.size.height);
   [UIView commitAnimations];
}
1
2
3
4
5
6
7
8
9
10
11
12
13
- (void)textFieldDidEndEditing:(UITextField *)textField
{
    CGRect viewFrame = self.view.frame;
    viewFrame.origin.y += animatedDistance;
 
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationBeginsFromCurrentState:YES];
    [UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];
 
    [self.view setFrame:viewFrame];
 
    [UIView commitAnimations];
}

However, you could also refer to UICatalog example which also has example quite similar to this one but I prefer this one.

No Comments | Tags: , , , ,