Tags » Code Snippet

SQL Server : Combine two rows based on the values of one column

I came across a requirement to combine rows based on the values of a column. This is an interesting query so thought of sharing it with a simple example online. 155 more words

XML

Access Your MySQL Server Remotely Over SSH

When working on a client’s site, I usually have the privilege of having access to something like cPanel. From cPanel I then can access things like phpmyadmin and file manager. 560 more words

Web Development

C / C++ - Fast add nanoseconds to timespec structure

C나 C++ 프로그램에서 나노세컨트 단위의 시간을 처리해야 하는 경우가 간혹 있는데 이 경우에는 timespec 구조체를 사용하는 것이 적당하다.

만약 timespec을 사용하다가 특정 시점에서 몇 나노 세컨드 이후의 timespec이 필요한 경우에는 아래의 Snippet을 활용하면 된다. 140 more words

C

A Horrible Abuse of Gradients in the Name of Fancy Buttons

Here’s a demo of a button style I’ve been playing with lately.

I could perhaps be done in an easier way, but I’m using four CSS gradients in the background to simulate four bevelled corners. 25 more words

ViewModelBase code snippet in WPF


public class ViewModelBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual bool SetFields<T>(T value, ref T field,  string propertyName = null)
    {
        var hasChanged = Equals(value, field);

        if (hasChanged)
        {
            Notify(propertyName);
        }
        return hasChanged;
    }

    protected virtual void Notify( string propertyName = null)
    {
        var handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
General

LIST/VIEW March 4th, 2015

Here is what was discussed in class (as I remember it).

We worked in three separate documents today: our config file, demo_list, and demo_view files. Our config file added a couple new functions. 195 more words

More Beers! 03/02/2015

We continued work on the Beer Database and rehashed some of the same information.

Working in our Adminer, the information can be exported and imported into a Docs folder. 128 more words