Skip to main content

Posts

Showing posts from May, 2017

c# : Getting time in specific zone

> Reference: - https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).aspx [TestMethod] public void TestMethod1() {     // Reference : https://msdn.microsoft.com/en-us/library/ms912391(v=winembedded.11).asp     DateTime date1 = DateTime.UtcNow;     Console.WriteLine(date1);     DateTime MyTimeInWesternCentralAmerica = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date1, "Central America Standard Time");     DateTime MyTimeInWesternEurope = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date1, "W. Europe Standard Time");     DateTime MyTimeInManila = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date1, "Singapore Standard Time");     DateTime MyTimeInNorway = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date1, "Central European Standard Time");         Console.WriteLine("MyTimeInWesternEurope: {0}", MyTimeInWesternEurope);     Console.WriteLine("MyTimeInManila: {0}", MyTimeInManila);     Console.WriteLine("MyTimeInNorw

BizTalk - Whole message as parameter input of a MS Sql store procedure

// Extract Filename: varFilename =  MsgExcelFileRequest(FILE.ReceivedFileName); // Using variables to alter values: varXmlTemp = MsgExcelFileRequest.xml; varInnerText  = varXmlTemp.InnerXml; varInnerText =  varXmlTemp.InnerXml.Replace("<", "&#60;"); varInnerText = varInnerText.Replace(">", "&#62;"); // Create xml from the altered values: varXml.LoadXml(System.String.Format("<ns0:usp_Logic_Entries_Insert xmlns:ns0=\" http://schemas.microsoft.com/Sql/2008/05/TypedProcedures/dbo\ "><ns0:XmlFilename>{0}</ns0:XmlFilename><ns0:XmlData>{1}</ns0:XmlData></ns0:usp_Logic_Entries_Insert>", varFilename, varInnerText)); // Assigned created xml to the input message: MsgUspLogicEntriesInsertInput.xml = varXml; // Trace logs: System.Diagnostics.EventLog.WriteEntry("Logic - Step103_01 - SaveExcelFileRecordsToDb.odx", System.String.Format("Saving ExcelFile \"{0}\"."

Ubuntu 16.04 LTS - Installing GIMP

Add GIMP PPA: $ sudo add-apt-repository ppa:otto-kesselgulasch/gimp Update and Install: $ sudo apt-get update $ sudo apt-get install gimp Terminal: mccrazy@Lenovo-N22:~$ sudo add-apt-repository ppa:otto-kesselgulasch/gimp [sudo] password for mccrazy:  This PPA is for Ubuntu >=12.04 and Linux Mint >=13 Installing: open a terminal and type: sudo add-apt-repository ppa:otto-kesselgulasch/gimp sudo apt-get update sudo apt-get install gimp Removing: open a terminal and type: sudo apt-get install ppa-purge sudo ppa-purge ppa:otto-kesselgulasch/gimp Many thanks to David TschumperlĂ© for his masterpiece called G'MIC. http://gmic.eu/ Look for the gmic packages! We should not forget the Gimp crew! http://www.gimp.org/ And many, many thanks to http://siduction.org . They helped me on my first steps making the Gimp packages. I promise as long as I live this PPA will never die and the most recent packages will for ever be. ;-) Regards Otto Meier If you had a really problem: Skype: thorsten

Ubuntu 16.04 LTS - Install rar and unrar

Command: $ sudo apt-get update $ sudo apt-get install rar unrar Terminal: mccrazy@Lenovo-N22:~$ sudo apt-get update [sudo] password for mccrazy:  Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]      Hit:3 http://ppa.launchpad.net/canonical-chromium-builds/stage/ubuntu xenial InRelease Hit:4 http://us.archive.ubuntu.com/ubuntu xenial InRelease                      Get:5 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]     Hit:6 http://ppa.launchpad.net/nemh/systemback/ubuntu xenial InRelease          Hit:1 http://screenshots.getdeb.net xenial-getdeb InRelease                     Hit:7 http://ppa.launchpad.net/wine/wine-builds/ubuntu xenial InRelease         Ign:8 https://cli-assets.heroku.com/branches/stable/apt ./ InRelease            Get:9 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB] Hit:10 https://cli-assets.heroku.com/branches/stable/apt ./ Release Get:11 http://us.archive.ubuntu.com/ubuntu xenial-

T SQL : Replace First or Last occurance of a string to a new one

DECLARE @Name VarChar(MAX) DECLARE @StringToReplace VarChar(MAX) DECLARE @NewString VarChar(MAX) SET @StringToReplace = SPACE(1) SET @NewString = ',' SET @Name = 'MARIJUN P. MASCARINASO' SET @Name = 'MA. BEVELYN D DABILAU' SET @Name = 'SHEERWINE JOEL QUARTIRU' SELECT     [Name] = @Name     ,[First Instance of space] = STUFF(@Name, CHARINDEX(@StringToReplace, @Name), LEN(@StringToReplace), @NewString)     ,[Last Instance of space] = STUFF(@Name, LEN(@Name) - CHARINDEX(@StringToReplace, REVERSE(@Name)) + 1, LEN(@StringToReplace), @NewString)

Ubuntu 16.04 LT - Installing Chromium browser

> Type these commands about this PPA : $ sudo add-apt-repository ppa:canonical-chromium-builds/stage $ sudo apt-get update $ sudo apt-get install chromium-browser > Terminal: mccrazy@Lenovo-N22:~$ sudo add-apt-repository ppa:canonical-chromium-builds/stage [sudo] password for mccrazy:  Testing site just before upload to Ubuntu main. Things here are either broken and not ready to use, or landing in the distro anyway very soon. You shouldn't use this.  More info: https://launchpad.net/~canonical-chromium-builds/+archive/ubuntu/stage Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmp6cfppy_r/secring.gpg' created gpg: keyring `/tmp/tmp6cfppy_r/pubring.gpg' created gpg: requesting key 5B393194 from hkp server keyserver.ubuntu.com gpg: /tmp/tmp6cfppy_r/trustdb.gpg: trustdb created gpg: key 5B393194: public key "Launchpad PPA for Canonical Chromium Build Team" imported gpg: Total number processed: 1 gpg:               imported: 1  (RSA

Fresh Ubuntu 16.04 LTS - Installing ruby developer tools

> Update ubunut software thru terminal $ sudo apt-get update > Install git $ sudo apt install git > Set user config $ git config --global user.email " you@example.com " $ git config --global user.name "Your Name" * Install Ruby Language thru RVM > Install curl $ sudo apt-get install curl > Install RVM $ gpg2 --keyserver hkp:// keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 $ \curl -L https://get.rvm.io | bash -s stable --ruby > Update RVM to the latest version $ rvm get stable --autolibs=enable > Install specific ruby version for me is ruby-2.2.6 for my alter-ego developer that uses Windows 10 - rvm install 2.2.6 > Integrating RVM to Ubuntu 16.04 terminal - Go to https://rvm.io/integration/gnome-terminal > Setup default ruby version to use $ rvm --default use ruby-2.2.6 > Creating a RVM file $ cd projects\ruby\test-project $ rvm use --create --rvmrc 2.2.6@test-project

Push ruby sinatra project to heroku with rake db:migration

>Terminal: mccrazy@Lenovo-N22:~$ cd Documents/crazynote mccrazy@Lenovo-N22:~/Documents/proyekto/r226$ rake db:create_migration NAME=create_doctors db/migrate/20170506042338_create_doctors.rb mccrazy@Lenovo-N22:~/Documents/proyekto/r226$ rake db:migrate == 20170506042338 CreateDoctors: migrating ==================================== -- adapter_name()    -> 0.0000s -- adapter_name()    -> 0.0000s -- create_table(:doctors, {:id=>:integer})    -> 0.0034s == 20170506042338 CreateDoctors: migrated (0.0041s) =========================== mccrazy@Lenovo-N22:~/Documents/proyekto/r226$ git add . mccrazy@Lenovo-N22:~/Documents/proyekto/r226$ git commit -am "initial project up to db:migrate" [master (root-commit) 3e86239] initial project up to db:migrate  9 files changed, 220 insertions(+)  create mode 100644 .rvmrc  create mode 100644 Gemfile  create mode 100644 Gemfile.lock  create mode 100644 Rakefile  create mode 100644 config/database-config.rb  create mode 100644 db/Dev

Testing RVM setup with Sinatra sample app r226 (with gem install pg problem and solution)

> Terminal: mccrazy@Lenovo-N22:~$ cd Documents/ mccrazy@Lenovo-N22:~/Documents$ cd proyekto/ mccrazy@Lenovo-N22:~/Documents/proyekto$ ls r226 mccrazy@Lenovo-N22:~/Documents/proyekto$ cd r226/ You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version' or ignore this warning with 'rvm rvmrc warning ignore /home/mccrazy/Documents/proyekto/r226/.rvmrc', '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'. ******************************************************************************** * NOTICE                                                                       * ******************************************************************************** * RVM has encountered a new or modified .rvmrc file in the current directory,  * *

T SQL : Getting first and last day of the month

> The Script: DECLARE @Today DateTime SET @Today = GETDATE() -- First day of the month: SELECT [First day of the month] = DATEADD(D, -1, DATEADD(MM, DATEDIFF(m, 0, @Today), 1 )) -- Last day of the month: SELECT [Last day of the month] = DATEADD(S, -1, DATEADD(MM, DATEDIFF(m, 0, @Today) + 1, 0))

Ubuntu 16.04 LTS - Installing heroku toolbelt

> Installing Heroku Toolbelt: $ sudo apt-get install software-properties-common # debian only $ sudo add-apt-repository "deb https://cli-assets.heroku.com/ branches/stable/apt ./" $ curl -L https://cli-assets.heroku.com/ apt/release.key | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install heroku > Terminal: mccrazy@Lenovo-N22:~$ subl Documents/crazynotes/MyUbuntuNotes.txt mccrazy@Lenovo-N22:~$ sudo apt-get install software-properties-common [sudo] password for mccrazy: Reading package lists... Done Building dependency tree       Reading state information... Done The following additional packages will be installed:   python3-software-properties software-properties-gtk The following packages will be upgraded:   python3-software-properties software-properties-common   software-properties-gtk 3 upgraded, 0 newly installed, 0 to remove and 154 not upgraded. Need to get 76.7 kB of archives. After this operation, 1,024 B of additional disk space will be used. Do