A Quest For Ruby & Gems

ruby-logo

The last couple of weeks, I’ve taken upon myself to hunker down and study Ruby. In my free time, I like to brush on on languages and exercise my brain. I completed a few Ruby courses over the summer, but in the last few weeks I needed “reference material.”

On my quest for reference material, I stumbled upon the legendary _why’s Poignant Guide To Ruby on Github! I opted for the PDF version and uploaded it to my Play Books!

dev-1

Thumbing through _why’s entertaining book, I started looking at other books to quicky kick start Ruby. Many Ruby books I’ve attempted to read through have always turned me off due to their strange lexicon, dry and unclear explanations, etc. Being that I have a background in HTML, Javascript, and PHP, the analogies in most Ruby books/documentation confused me and I often found myself frustrated. All I wanted was simple reference material to explain the Ruby class, examples of syntax, and a comparison to a language I understood.

While I was reading through random online documentation, I found a blog called “Juixe Techknow” which outlined and explained the Ruby class. After reading the first 2 paragraphs, I suddenly got overwhelmed in excitement. A combination of my Woods Coffee kicking in, and sheer enlightenment, Juixe made a great comparison of Ruby class to Java in this blog post. His explanation clicked as I recall working with Android SDK! Now that everything clicked and I was able to bang out a class file with the methods I needed, I was ready to invest $$$.

I’ve always been a fan of Larry Ullman, in fact him and Elizabeth Castro are the two authors of my favorite books. At a young age, I was turned off my “fluff” types of books, such as Dummies series. “I DON’T WANT TO READ A BOOK THAT COMPARES JAVASCRIPT TO BAKING COOKIES, AND TELLING ME A STORY ABOUT HOW A FAMILY NEEDS TO SOLVE FOR (B) WHILE TRAIN TRAVELS AT x” – seriously, Visual Quick Start Guides enabled me to just “Play” with the code, then think creatively.

visual_ruby

If you need reference material to quickly pick up Ruby, I’d encourage purchasing Larry Ullman’s Visual Start Guide to Ruby. Whether your a beginner or advanced user needing to look up syntax, I have nothing negative to say for this book. I picked it up on my Nexus, although I do prefer paperback books, it still is good to skim through.

In the long run, I plan on continuing down this path and picking up Ruby On Rails. Right now, my main goal to Ruby is just to work on a client side project. I would soon like to apply this skill set on an AWS Ruby on Rails instance in the near future! I’m sure my friend @eminkel will enjoy collaborating on a side project!

https://soundcloud.com/nickraymondg/lorde-royals-lazerdisk-remix

Read More

Transferring WIX Domain To Another Registrar

sad-wix

Googling around, I found this to be buried in random forum posts. I figured I’d document this for future reference.

To transfer your Wix domain from Wix:
1. From your Domain Manager, under My Domains, next to your Wix domain, click Manage.
2. Under Domain Summary, click the Advanced tab.
3. Next to Transfer Away from Wix, click Transfer.

wix-domain-transfer-1

4. In the Transfer window, click Send.

wix-domain-transfer-2

5. An email with a code will be sent to you. Forward this code to your new domain registrar.
You may not receive the email immediately, but you can expect to receive it on the same day.

Source: Dana from WIX Support, Screen Caps: myself.

At this point, you will have to go to a new registrar, such as Namecheap.com and create an account. On the registrar side, you can initiate the domain transfer. Note: Be sure to jot down all DNS Zone information in the WIX Domain Manager panel. Be sure to update the new registrar with DNS information.

Read More

How To Push To Github And WordPress.org

I think this is really important and not many people are aware of this. Evan Solomon deved a tool called Scatter. There are a lot of us that favor utilizing Git > SVN, I feel like SVN is stepping backwards in time. Everyone that is current on Git or started out primarily on git may be turned off by SVN. Welp, kick it in the nuts.

http://evansolomon.me/notes/git-wordpress-plugins-and-a-bit-of-sanity-scatter/

Read More

ƱZ Feat PAZ – Shit I Ain’t Got!

UZ-in-the-studio

I really enjoy PAZ’s new “Shit I Ain’t Got” – very Anti-New Money. This song suddenly started bumping on my Soundcloud and I wasn’t sure who it was. When I noticed it was under “WhoIsPaz” I was like, “WHHAAT? It’s been a grip!”

I was hoping to get PAZ out to Round 1 Formula Drift Streets of Long Beach.

ƱZ Feat PAZ – Shit I Ain’t Got Lyrics

[Hook]
Panamera models, Maserati crib
Lamborghini ceilings in the building where we live
Aston Martin bitches, snitches on Houdini
Fuck it man cause I don’t even own a Lamborghini

[Verse 1]
I ain’t got a Murci, I ain’t got a car
I don’t fuck with thousand dollar bottles at the bar
I ain’t got a Lotus, I can’t drive a stick
I ain’t got a Kardashian ridin on my dick
I ain’t got a Maybach, barely got a paycheck
Stripper told me make it rain
I said I’ll take a rain-check
I ain’t been to Paris, no one trynna fly me
Don’t know how to ball, and ain’t nobody trynna find me
I ain’t got a Rose, I ain’t got a Miller
I ain’t got a deal owe a hundred to my dealer
All I want is Jays, but all I got is Filas
They coppin red bottoms but my bottoms all vanilla
Can’t be jockin blades, can’t be jockin dubs
Asked for Ace of Spades but they brought me Two of Clubs
Got no one to fuck, might as well go home
Cause everybody in this club is fucking with their phones

[Hook]

[Verse 2]
I ain’t got that gliss, I ain’t got that shine
Your girl got a wrist, you be paying all the time
Pears and lemon lime, all that shit is borin
Only grill I got cosigned by George Foreman
I ain’t got that Bentley, I ain’t got a Benz
All I got is homies, can’t afford fugazi friends
Dump them groupie tens, all them bitches fickle
Fuck them fancy dimes, I be fucking two nickles
Say ‘Ye, Say ‘Ye, ain’t this muhfucking crazy?
All we got is pain, and they bathin in champa-zay
They be coppin rays, and we be coppin shady
Who the fuck is flyin all these hoes to San Trope-zay
I ain’t got that Louis, I ain’t got that Kors
I ain’t got that Gucci, I ain’t welcome in their stores
Fuck a label whore, I ain’t got the skrill
So when I die, bury me up in the Taco Bell

[Hook]

[Interlude]
That’s that shit, that shit
That shit I ain’t got
That’s that shit I ain’t got

[Hook]

Source: Rap Genius

Read More

Varnish HTTP Accelerator Presentation Notes

varnish-cache-image

Poul-Henning Kamp discusses Varnish HTTP Cache at TYPO3 2010 in Frankfurt. In this post, I will provide detailed notes of his presentation. This is for learning purposes and may contain inconsistencies. I will do my best to keep it sharp.

Varnish HTTP Accelerator Presentation Slides

Notes From Varnish HTTP Cache @ TYPO3 w. Poul-Henning Kamp

Content creation can be automated, you have a master copy and you want to distributed it as much as possible. You really want it to be faster than the Linotype, and a step beyond the Heidelberg Print Machine. Varnish’s Elevator Pitch, “Varnish delivers content faster & reliably, reduces the load on your CMS database, cheap hardware does 100+ kreq/s, can assist in content composition, can fixx stupid mistakes, fast, is Free & Open Source Software, has commercial support.”

After 15 years contributing to the FreeBSD project, Poul-Henning Kamp was approached by VG.no to write a web server. VG.no utilizes a slow CMS which needed a caching system that speeds up the HTTP accelerators. With Varnish, Kamp was able to reduce the use of 12 Squid cache services to a mere 3 Varnish cache servers and greatly reducing the response times.

Poul-Henning Kamp’s goals for Varnish started out simple

  • Varnish is only a HTTP Accelerator.
  • Better configuration.
  • Much Faster
  • Content Management Focused Feature Set

“We don’t do FTP, we do HTTP and we do it damn well,” Kamps continues “This is not a cache to put on the client side, this is a cache to put on the server side. It’s important to understand one thing here, the controlling standard for HTTP is still RFC2616, and if you read it real carefully you will find one place where it mentions a cache on the server side,” “then they realize, actually a cache on the serverside is just another web server.”

Cache on the client size has constraints, you cannot cache per user, private cache, crypto, etc. Varnish as a web server can cache anything we want server side, including crypto!

Understanding Varnish and VCL

Varnish aims to make the configuration process simple in VCL or C language. It’s important to understand the operations of Varnish according to the diagram below.

varnish-state-machine

An example of receive VCL code below.

sub vcl_recv {
if(req.url ~ “\.\.|\.exe”) {
error(999, “Bugger off.”);
}
if(client.ip ~ editor_ip) {
set req.http.x-cms = “no stats”;
return(pass);
}
if(req.url ~ “\.(jpg|png|gif|css)$”) {
unset req.http.cookie;
unset req.http.authenticate;
set req.backend = static_backend;
}
if(req.url == “hotstory.hmtl”) {
set.url = “hotstory.html”);
}
}

Understanding Why Varnish Cache Language Is Epic

  • Compiled to binary/shlib via C-code
    • Runs full speed
  • You can have multiple VCL’s loaded at the same time
    • Switch between them without restart
    • Instantaneous
  • Allows you to do anything you might fancy
    • Inline-C code, ’nuff said.
    • Modules/shlib will make it easier (3.0 feature)

Wikia has broken the 4000+ lines of VCL code and is available online via SVN for all to study.

An example of how Wikia’s VCL code utilizing multiple varnish servers. In this example there are two Varnish servers, one in Germany and one in England. The client is located in Germany attempted to access a server in the US. The client hits the Germany varnish server first, but the German Varnish server tells the client to connect to England Varnish than to the US because England’s pipe to the United States is bigger. This speeds up the load times since Germany’s direct tube to the US is clogged. You can’t just dump stuff on it, it’s a truck.

sub vcl_recv {
if (client.ip == “varnish1”) {
set req.backend = usa;
} else {
set req.backend = england;
}
}

Managing Varnish

Varnish is a daemon process on your computer and utilizing Command Line Interface for real-time control. The Management/Working process split. The manager allows (re)start the worker proc. Allows privilege separation. It also contains multithreading to worker process.

varnish_architecture_shah_anand

Image Source: shah-anand.com (thx bro).

Looking over the Varnish architecture we have one binary program that contains two processes, the Managing Process and Cacher process. The managing process will take your VCL code, send it to the C-compiler, and off to shared object for the Cacher process loads. Varnish Cache also has a cluster control concept that can control 10 different instances of Varnish is separate geolocations. The cluster control is still a concept and is not built out.

One thing to note: Varnish does not write .lock files – it has a shared memory segment, it places lock information and statistics in there and other applications will pull from the shared memory.

Brief CLI Management

Example of CLI Management below (I am a bit lost on this because on param.show I get an error on my instance.

$ telnet localhost 80
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’
param.show
200 675
default_ttl 120 [seconds]
thread_pools 5 [pools]
thread_pool_max 1500 [threads]
thread_pool_min 1 [threads]
thread_pool_timeout 120 [seconds]
overflow_max 100 [%]
http_workspace 8192 [bytes]
sess_timeout 5 [seconds]
pipe_timeout 60 [seconds]
send_timeout 600 [seconds]
auto_restart on [bool]
[…]

Performance & Speed

Programmed for performance since day one. They wanted to make sure they were aiming for wire speed. Performance is not something you do after the fact, you do it from day one and don’t add things that will bog it down. Writing the code for Varnish aims for today’s complex hardware. This isn’t designed for your dad’s computer anymore!

Use modern features:

  • Virtual Memory
  • sendfile(2), accept_filters(2), kqueue(2)
  • and ever other trick in the book

Performance price list has changed, we can execute 100,000,000+/s per cpu. Disk I/O is behind on response time, stored memory is instead placed in virtual page memory (RAM). Classical logging is horribly expensive. (Examples in slides).

Where does my traffic come from?

Below are a few commands that you can use to access information on a live Varnish instance.

$ varnishtop -i Rxheader
$ varnishtop -i Rxurl
$ varnishhist

Varnishhist is real-time histogram that shows the cache-miss (#) / cache-hit (|) on an x & y axis.
$ varnishstat

Varnishstat pulls real-time statistics from shared memory

Content Management Features

  • Instant action purges/bans (regex or exact match)
  • TTL/Caching policy control in VCL
  • Load/Situation mitigation in VCL
  • Header washing
  • Vary
  • Edge-side-includes (ESI)

27:14

Read More

BitTorrent SyncApp Alpha Testing

syncapp

Today, I received my invitation to alpha test BitTorrent SyncApp. I can only imagine the implications this will open up. Although Dropbox is safe, secure, and redundant, how safe is your files? SyncApp is interest, I generate a secret key and designate my “SyncApp” folder. I fire it up my laptop and install SyncApp.exe and punch in my secret key. Immediately, over 2,800+ files in my WordPress localhost is synced to my laptop. This afternoon, it’s synced to a 3rd box. I am interested in taking this to the next step and placing my files on a Linux server in California… with all my private git repositories. I wonder how well git will behave with SyncApp?

I think the most fascinating implication of SyncApp that I can brew in my mind is utilizing it over a Meshnet. Think of tying several Meshnet nodes in Bellingham and giving end users the “secret key” – madness. I wonder if there’s anyone in Bellingham that has already thrown up Meshnet nodes?

The next plan of actions with alpha testing BitTorrent SyncApp will be to tie all of my company files (.psd, .ai, .eps) between 3 computers and potentially a 4th. Perhaps my personal dedicated server down in California? Or maybe I should throw up an experimental Amazon EC2 with block storage? D: OMFG, way to excited.

Read More