Posts

Showing posts from March, 2018

How do you interpolate strings in Elixir?

How do you interpolate strings in Elixir?

You use #{} in strings to add in elixir  iex> IO.puts "Hello #{:world}"

What are booleans in Elixir?

What are booleans in Elixir?

Booleans are actually Elixir atoms

What are boolean values in Elixir?

What are boolean values in Elixir?

The two boolean values are:

iex> true
true
iex> false
false

How many ways can I write numbers in Elixir?

How many ways can I write numbers in Elixir?

You can write them in:

DecimalBinaryOctalHexadecimal iex> 1.0 1.0 iex> 10 10 iex> 0b1010 10 iex> 0o777 511 iex> 0x1F 31

Where can I ask questions about Elixir?

Where can I ask questions about Elixir?

You can ask on:

IRC: #elixir-lang at freenode IRCSlack: https://elixir-slackin.herokuapp.com/Elixir Forum: https://elixirforum.com/Stackoverflow: https://stackoverflow.com/questions/tagged/elixir

How do I run a elixir script?

How do I run a elixir script?

Type in a file:
IO.puts "Hello World!"
Then execute:
$ elixir simple.exs

How do I print output in Elixir?

How do I print output in Elixir?
IO.puts "Hello World!"

What types does elixir have?

Elixir data types:

iex> 1 # integeriex> 1.0 # floatiex> true # booleaniex> :atom # atom / symboliex> "elixir" # stringiex> [1, 2, 3] # listiex> {1, 2, 3} # tupleiex> sum=fn(a,b)->a+bend # tupleiex> kw_list = [{:one, 1}, {:two, 2}] # keyword listiex> map = %{:a => 1, 2 => :b} # map

How do you get UTF-8 in Elixir?

How do you get UTF-8 in Elixir?

All the strings in Elixir are already UTF-8

How do I find the version of elixir is installed?

How do I find the version of elixir is installed?

Type:
$ elixir -v

How do I install Elixir on a Mac?

How do I install Elixir on a Mac?

The easiest was is to use brew

$ brew install elixir 
Reference: https://elixir-lang.org/install.html#mac-os-x

How do I start Elixir?

type:

$ iex

Rsync - a great tool

If you haven't used rsync yet you should. It's a great tool for mirroring

http://www.samba.org/rsync/

Vi paging up and paging down

In vi to page up and down type
Ctrl-b aka (^b)
Ctrl-f aka (^f)

End of line characters

How do I type the end of file character

The end of file character is different on different operating systems so the end of line aka eof is:
Control-D on Unix
Control-Z on Windows

How do I get UTC time in seconds in oracle sql

Timestamps can be confusing and difficult to work with in oracle. It
took me a little time to figure out but the following SQL will give
you SELECT (CAST(SYS_EXTRACT_UTC(systimestamp) AS DATE) -
TO_DATE('19700101', 'YYYYMMDD')) * 86400 seconds , current_timestamp
FROM dual the UTC time in seconds from the epoch, as a floating point number. 60 * 60 * 24 for 60 seconds * 60 minutes * 24 hours = 86400

Perl loop through days code

Here is some code for looping through days
http://datetime.perl.org/index.cgi?FAQSampleCalculations
http://datetime.perl.org/index.cgi?FAQBasicUsage

#!/bin/env perl
use DateTime;
my $start_dt = DateTime->new(year => 2009, month => 4, day => 27);
my $end_dt = DateTime->new(year => 2009, month => 5, day => 18);

my $weeks = 0;
for (my $dt = $start_dt->clone();
$dt <= $end_dt;
$dt->add(days => 1) ) {
print $dt->date('')."\n";
$weeks++;
}

Vi paging up and paging down

In vi to page up and down type
Ctrl-b (^b)
Ctrl-f (^f)

How to escape single quotes bash

Just use my web page that I setup to escape single quotes in bash

http://www.stevemorin.com/utils/bashEscape.html

sbcl lisp access command line arguments

$ sbcl --eval '(progn (print *posix-argv*)(quit))' two three