Spiral Dance Radio

If you like to focus on the positive aspects of life, then I would like to recommend this radio and website to you. Enjoy listening!

 

 

 

Technorati Tags: ,,,
Advertisements

Abu Wins Award of Distinction

We all went with the cousins as well to accompany Abu to collect some musical certificates and were surprised to find out that Abu had actually won an Award of Distinction from Trinity Guildhall (part of the Trinity College of London) for achieving the highest score on the drums in all of 2008 at his level in this region!

Abu

It started to rain as I started the car to fetch Abu and Maryam. It poured down hard the moment I stepped out of the car to get them. It stopped raining a few minutes later. And just after Abu collected his medal, Enya’s “May It Be” played in the auditorium.

In one of the darkest days of my life, a bright light shines unexpectedly, with all the accompanying signs.

SQL Server Timestamp – Implementing Optimistic Concurrency

A .Net hair puller.

Question – how do you convert a TimeStamp column rom SQL Server to a .Net application and back again?

Answer – hold it in a byte array ie byte[], for example

<code>    public bool UpdateProduct(string productName, int? supplierID, int? categoryID, string quantityPerUnit,<br />                              decimal? unitPrice, short? unitsInStock, short? unitsOnOrder, short? reorderLevel,<br />                              bool discontinued, int productID, <span class="highlight">byte [] timestamp</span>)</code>

Got it from this excellent and detailed article with screenshots to prove its working.

Details (a bit only) –

  • add a TimeStamp column to your table. The timestamp column is guaranteed to be unique and it auto-updates on every INSERT and UPDATE.
  • include reading the timestamp value in SELECT statements
  • create stored procedures for INSERTs and UPDATEs accepting the timestamp as an input parameter. Use the timestamp in a WHERE clause within the stored procedures to implement optimistic concurrency

I’ve tried this before, using the same thing (byte array) but it did not work. My situation makes it a bit more complex – the DataTime value has to be persisted across postbacks, so I convert the byte array to a string and back again during postback. The sequence goes like this –

  1. Extract String from byte array
  2. Store extracted string in ViewState
  3. Postback occurs
  4. Restore ViewState
  5. Recreate byte array from String

Guess I have to check some details there.

Powered by ScribeFire.

WordPress – Comment Seting

This is a puzzling bit. I’ll have to keep an eye on this until I resolve it.

Question –

  • Checkbox #1 forces all comments to be moderated
  • Checkbox #2 comments from authors with previously approved comment will be posted

If both checkboxes are chosen, will all comments be moderated or can comments from authors with previously moderated comments bpass the moderation?

Answer – I don’t have it yet. Must try it out.

More reference from the WordPress documentation.

Powered by ScribeFire.

WordPress Roles In A Nutshell

Here’s something I keep forgetting as well. A summary of WordPress roles from their documentation pages

  • Administrator – Somebody who has access to all the administration features
  • Editor – Somebody who can publish posts, manage posts as well as manage other people’s posts, etc.
  • Author – Somebody who can publish and manage their own posts
  • Contributor – Somebody who can write and manage their posts but not publish posts
  • Subscriber – Somebody who can read comments/comment/receive news letters, etc.

Powered by ScribeFire.

SQL Server – @@IDENTITY, SCOPE_IDENTITY, and IDENT_CURRENT

Here’s a quick note and reference point for programmers who are forgetful, like me.

All the Transact-SQL system functions @@IDENTITY, SCOPE_IDENTITY (which has no @@) and IDENT_CURRENT (also no @@) return the last auto-generated row identity  value. What’s the difference?

1. @@IDENTITY returns the last identity column value generated for any table during the current session regardless of whether the number was generated within the scope of the current stored procedure or not – Any table, current session, any scope

2. SCOPE_IDENTITY() returns the last identity column value generated for any table during the current session and within the current scope only – Any table, current session, current scope

3. IDENT_CURRENT(‘tablename’) returns the last identity column value auto-generated only for the current table regardless of session and scope – Current table, any session, any scope

I use SCOPE_IDENTITY to return identity values due to the following explanation from SQL Server 2008 Book Online

“For example, there are two tables, T1 and T2, and an INSERT trigger is defined on T1. When a row is inserted to T1, the trigger fires and inserts a row in T2. This scenario illustrates two scopes: the insert on T1, and the insert on T2 by the trigger.

Assuming that both T1 and T2 have identity columns, @@IDENTITY and SCOPE_IDENTITY will return different values at the end of an INSERT statement on T1. @@IDENTITY will return the last identity column value inserted across any scope in the current session. This is the value inserted in T2. SCOPE_IDENTITY() will return the IDENTITY value inserted in T1. This was the last insert that occurred in the same scope. The SCOPE_IDENTITY() function will return the null value if the function is invoked before any INSERT statements into an identity column occur in the scope.”

Books Online further cautions that the value returned by these functions may be untrue if the INSERT operation has ended with an error –

“Failed statements and transactions can change the current identity for a table and create gaps in the identity column values. The identity value is never rolled back even though the transaction that tried to insert the value into the table is not committed. For example, if an INSERT statement fails because of an IGNORE_DUP_KEY violation, the current identity value for the table is still incremented. “

The Meaning of Reiki

Conventionally, the meaning of Reiki is often translated as Universal (‘Rei’) Energy (‘Ki’). Wikipedia provides a number of explanations on how various (albeit vaguely similar) meanings of the word was derived. Possibly due to the more pictorial nature of Chinese and Japanese words, in translating the term, the Wikipedia article also makes reference to ‘beautiful mountains’ and ‘spiritual influence of mountains’.

James Deacon’s Reki Pages provide a fuller coverage of the subject.

However, here are a couple of novel and interesting meanings from recent posts to the Reiki_on group at Yahoogroups:

“Reiki is a connection to our Primordial Consciousness”

“The term Reiki refers to the meeting of heaven and earth at the point of conception, and the purity and great potential in that moment.”

My first attunement to Reiki was via long distance. I was staying in a cheap hotel on a mountain and that night I communicated with a Reiki Master from the other half of the world through the Internet. When he agreed to perform the long distance attunement (for free), I rushed back to the hotel to prepare for it. In photographs of the hotel room taken that night, many orbs were observed.

Very early the next day, I went up to the foot of the highest peak on the mountain. The mist was lifting from the mountain peak, and as I watched the cloud of mist rising into the sky, I thought to myself, “at this moment, this is where The Earth meets The Sky.”

How coincidential then, now 5 years forward into the future, for me to learn that, amongst others, Reiki refers to the meeting point between The Heaven and The Earth. The beauty of the moment remains etched in my mind, and amongst other highlights of my life, it was one precious moment I was happy to have lived through.

Technorati Tags: