Add User to SQL Server Database

Add User Using Windows Authentication

-- Create user windows Authentication
-- Now add user to database
USE YourDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN [YourDomainNameJohnJacobs];
-- If adding to a second database, do so below:
USE YourSecondDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN [YourDomainNameJohnJacobs];

Add User Using SQL Authentication

-- Create user for SQL Authentication
CREATE LOGIN JohnJacobs WITH PASSWORD = 'JinGleHeimerSchmidt'
,DEFAULT_DATABASE = [YourDatabaseHere]
-- Now add user to database
USE YourDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN JohnJacobs;
-- If adding to a second database, do so below:
USE YourSecondDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN JohnJacobs;

Retina Display Media Query

For including high-res graphics, but only for screens that can make us of them. “Retina” being “2x”:

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { /* Retina-specific stuff here */ }

Add “first” and “last” CSS classes to dynamic sidebar widgets.

* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.)
function widget_first_last_classes($params) {

global $my_widget_num; // Global a counter array
$this_id = $params[0][‘id’]; // Get the id for the current sidebar we’re processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets

if(!$my_widget_num) {// If the counter array doesn’t exist, create it
$my_widget_num = array();

if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { // Check if the current sidebar has no widgets
return $params; // No widgets in this sidebar… bail early.

if(isset($my_widget_num[$this_id])) { // See if the counter array has an entry for this sidebar
$my_widget_num[$this_id] ++;
} else { // If not, create it starting with 1
$my_widget_num[$this_id] = 1;

$class = ‘class=”widget-‘ . $my_widget_num[$this_id] . ‘ ‘; // Add a widget number class for additional styling options

if($my_widget_num[$this_id] == 1) { // If this is the first widget
$class .= ‘widget-first ‘;
} elseif($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { // If this is the last widget
$class .= ‘widget-last ‘;

$params[0][‘before_widget’] = preg_replace(‘/class=\”/’, “$class”, $params[0][‘before_widget’], 1);

return $params;


Custom WordPress RSS Feeds

<?php if(function_exists('fetch_feed')) {
include_once(ABSPATH . WPINC . '/feed.php'); // the file to rss feed generator
$feed = fetch_feed(''); // specify the rss feed
$limit = $feed->get_item_quantity(7); // specify number of items
$items = $feed->get_items(0, $limit); // create an array of items
if ($limit == 0) echo '<div>The feed is either empty or unavailable.</div>';
else foreach ($items as $item) : ?>
// The actual output
<h1><a href="<?php echo $item->get_permalink(); ?>" alt="<?php echo $item->get_title(); ?>"><?php echo $item->get_title(); ?></a></h1>
<p><?php echo $item->get_date('j F Y @ g:i a'); ?></p>
<p><?php echo substr($item->get_description(), 0, 200); ?> ...</p>
<?php endforeach; ?>

Upgrade Iphone 4S to iOS 6 successfully

Today I successfully upgrade my iphone 4s to IOS 6. The things you need to do is:

  1. Upgrade your iTunes to iTunes 10.7 (or the latest iTunes).
  2. For safety purposes, backup your iPhone to iTunes.
  3. Connect your iPhone to your computer, when you are prompted to update your iphone, choose download only. Don’t update directly. Just download the iOS 6 to your iTunes first.
  4. You need to connect to Internet DIRECTLY!!! This is really important. When you connect to internet through a router, you most probably will get error 3014 (which I get earlier with all other iphone lover).
  5. Wait about 20 minutes and you can enjoy your iOS 6. 🙂

The first things I tried is the new apple maps (that is complained by most of the user). For me its quite accurate showing my current location :).

Hope this help.

IE Table fixed width

This thing with IE almost get me bold. I cannot set the width of a table property for example:

table td { width:50px; }

This won’t work only in IE7. Finally I found this blog post that give the property needed by IE7 to set the width of the table property

table-layout: fixed;

It works like a charm for me.

note: to all IE user, please use other browsers.

Tiada Ternilai

Di hati-Mu terukir namaku
Di mata-Mu terlukis wajahku
Bukan kar’na kuat gagahku
Namun hanya kar’na kemurahan-Mu

Meski terkadang aku terjatuh
Tak pernah lelah Kau hampiriku
Memelukku dengan cinta-Mu
Betapa besar mulia kasih-Mu

Bagi-Mu Tuhan
S’gala Pujian
Hormat Kemuliaan
Tiada Ternilai
Salib-Mu Tuhan
Sungguh Berharga Engkau…Yesus