Tuesday, July 31, 2012

Blogger Challenge

Recently, I have been puzzled by one challenge: update my blogger with a new view. I have been put image as an indicator of the topic in my blog post for long time. What I would like is to place the icon image off the main column just beside my post title, so that it would be much easy to see the topic for each topic, instead of reading title text. It seems simple task, however, with the limitation of Blogger I just cannot make it happen.

Here are what I tried. Starting from blogger template. I found a place to add a div just right before my post title. The div  has a margin like this style:

....
marin:0 -150%;
....

It does show on the left side of my post title. However, within the div, I could not find a way to change image, the icon for my post.

The icon image is defined in my post. It seems that there is no way to set a reference to a blog post element, such as image's src attribute value. There is a variable in blogger's template, but the values are defined within the template.

I might be possible by using Javascript codes. The difficult point is that how I can define a unique DOM element so that I can retrieve element's attribute value? In addition to that, the Javascript codes have to be trigger on Windows load to update out-fly icon images  from posts.

By the time being, I still could not resolve this puzzle. Any suggestions?

Read More...

Sunday, July 15, 2012

Stackoverflow Flaire is added to my blog

Today I finally fulfill my promise to add SO flair to my blog. I found this promise when I searched my blog for "stackoverflow" to see my previous blog on this web service. I soon found my promise on Feb 18, 2011.

To add this section of HTML codes to my blog template should be easy. However, I spent about half hour to do it. For my record, here is what I did.

First open my blog template and edit it. The place I can add is at almost end of the template:

....
<div id='sidebar-wrapper'>
 <b:section class='sidebar' id='sidebar' preferred='yes'>
   <b:widget id='AdSense1' locked='false' title='' type='AdSense'/>
   ....
 </b:section>
 
 <!-- David Chu added this StackOverflow claire here -->
 <br/>
 <p/>
 <p>David Chu&#39;s programming Q&amp;A at stack<b>overflow</b>:</p>
 <a href='http://stackoverflow.com/users/62776/david-chu-ca'>
   <img alt='SO profile for David.Chu.ca'
   src='http://stackoverflow.com/users/flair/62776.png'
   title='SO profile for David.Chu.ca'
   width='208'/>
 </a>
</div>
....

Now the above section of HTML appears at the end of this blog.

By the way, my SO reached to 4k on July 6, 2012. Actually, I have done almost nothing in the past month. It is the time and effort I invested in the past years, the contribution which programmers recognized, to bring my SO this milestone. My reputation points continues to grow, up to 4054 at the time I am writing this blog.

Read More...

Sunday, July 08, 2012

Animation Views

Navigation and Tab Bar controls provide a way to change views. This kind of change looks like one view being completely replaced with another view, or with animation from one view to another view. Sometimes, you may want to both views visible, with one view in transparent mode on the top of another view. This can be done by using UIView animation methods.

Here are some experience when I tried to use technique.

The basic animation method I use is:

[UIView transitionFromView:fromView
                   toView:toView
                 duration:default_animation_duration
                  options:animationTransiationMode
               completion:completion];

I had one issue with this practice with storyboard (iOS 5.0). The view (toView) being on the top of fromView was positioned with an offset from the top.



The above example shows a gap between the navigation bar and the toView (fromView is on the background). As a result, the bottom bar buttons are not visible because it is out of the screen.

This problem can be easily resolved in storyboard. In the storyboard, select the View Controller first. From the right inspector panel, UNCHECK the property: Resize the view from NIB.



With this fix, the result view is displayed as expected.



Reference

Read More...

Monday, July 02, 2012

Reset SQL Server sa Password

Recently I had a request to reset SQl server sa password. The sa was set up long time ago, but it was not documented. SQL as log in was required to set up administration configurations. This kind of case is very common at work. The following are my notes about this experience.

I soon found a solution to resolve the issue. Basically, you need to restart SQL server in single mode first. Then log in to the server machine by using user with Administrative privilege. The steps are very straight forward, however, I was caught for a while with one mistake. You have to put "-m;" in start up parameter at the beginning with no space afterwards.

The following is the screen snapshot of the property page within SQL server configuration tool. By adding "-m;" right at the beginning line of Startup Parameters, the SQL server will be in single mode in the next start up.



Although I was able to reset sa password by using SQL management studio after  SQL server was restarted, I could not log in to SQL server by sa afterwards. It was interesting that the sa Log was set to blocked. I had to unblock it with single mode on second try.  The following was my snapshot of correct setting. Note: the check box of "Login is blocked out" was set when I reset sa password first time.



Reference


Read More...