Ubuntu – Archiving a directory and Encrypting the File using 7zip and OpenSSL

First archive the directory using 7zip.

7z a filename.7z targetdirectory

Next, encrypt the file using OpenSSL. Executing the command will ask the user for a password

openssl aes-256-cbc -in filename.7z -out file.enc

You can decrypt the file using the following command. Executing the command will ask the user for a password.

openssl aes-256-cbc -d -in file.enc -out filename.7z

 Reference

SQL Server – Finding Resource Intesive or Expensive Queries

It’s suggested you use SQL Profiler trace data ove layed against system information found in the performance monitor. However, to get a quick look at what queries may be slowing down performance , run the following -

select ss.sum_execution_count
    , t.text
    , ss.sum_total_elapsed_time
    ,ss.sum_total_worker_time
    , ss.sum_total_logical_reads
    , ss.sum_total_logical_writes
    from 
        (Select s.plan_handle
        , sum(s.execution_count) sum_execution_count
        , sum(s.total_elapsed_time) sum_total_elapsed_time
        , sum(s.total_worker_time) sum_total_worker_time
        , sum(s.total_logical_reads) sum_total_logical_reads
        , sum(s.total_logical_writes) sum_total_logical_writes
        from sys.dm_exec_query_stats s
        group by s.plan_handle
        ) as ss
        cross apply sys.dm_exec_sql_text(ss.plan_handle) t
        order by sum_total_logical_reads DESC

ASP.NET Parts of Absolute Path

// Gets the base url in the following format: 
// "http(s)://domain(:port)/AppPath"
HttpContext.Current.Request.Url.Scheme+"://"
+HttpContext.Current.Request.Url.Authority
+HttpContext.Current.Request.ApplicationPath;

Source

Ubuntu Change Boot Order for a Service

Use the update-rc.d command.

First remove the link fron the /etc/init.d directory to the rc.d directories

sudo update-rc.d -f my_old_script remove

Then change the boot order. The following updates the scripts boot order to 98.

sudo update-rc.d my_script defaults 98

This command can also be used to remove or add a service during boot.
Source