Logo

Who is talking?

Archive

Zen and the Art of Blowing Things Up

6 days ago | Daniel Higginbotham: Flying Machine Studios

The Dark Knight came out at the same time that I was becoming intensely interested in Buddhism, and the movie struck me as a kind of extended Buddhist parable, with Bruce Wayne as an icon of the suffering that results from clinging and the Joker as a very fucked up enlightened being. Here are some of my main reasons: (warning: spoilers!) Suffering and Impermanence Buddhism teaches that suffering comes from constantly scrambling for stability in an unstable world. Nothing is permanent, but we strive mightily to hold on to the illusion of permanence, only to suffer when reality once again asserts itself. In the scene where Batman is in the interrogation room beating the stuffing out of the Joker, the Joker just laughs and says, "You have nothing! Nothing to threaten me with. Nothing to do with all your strength." And that cuts to the heart of who the Batman is: a person whose reaction to the first shock of impermanence (his parents dying) was to dedicate his life to developing his strength so that he would never experience that pain again. The Batman's entire being is an exercise in doing just one... more... thing... to establish control. I mean, who would want to live that life? And here's the Joker, ready with the Zen slap: he tells Batman where to find Harvey and his girlfriend Rachel, giving him the illusion of control over who to save. And we know how that turned out: the Joker lied to the caped crusader, telling him Rachel was at one address, but actually Harvey was there. Batman races to save Rachel, only to find find Harvey instead. Nothing to do with all that strength. This really hit home for me because, at the time, I was in a relationship with someone that had a chronic illness. I could try to do everything to make her life less painful and more enjoyable, but there was only so much I or anyone could do. Natural Metaphors and Endless Desire At one point, the Joker says, "I'm just a dog chasing cars, I wouldn't know what to do if I caught one." Or something like that. This is a double whammy: "a dog chasing cars" is totally something a zen master would say, but besides that it expresses our human tendency to constantly strive for the next thing. We're all just dog chasing cars, not knowing what to do when catch one. You get a job: now you want a better job. You get a house: now you want a bigger house. Better to just say fuck it, put on some makeup, and start blowing up hospitals. No Self The Buddhist idea of "no self" is actually somewhat nuanced and I'm purposefully misrepresenting it here, but it would be difficult to argue that the Joker clings to any notion of self in the way that most of us non-enlightened psychopaths do. He gives multiple stories for how he got his scars, revealing the Buddhist truth that our sense of self is just a story we tell ourselves and that no one story is better than any other. He gives up his name and identity to become a fucking clown. And people really hate clowns! Interconnectedness One Buddhist teaching is the idea of interconnectedness: that we are all one, but not in the wavy-gravy way your high uncle used to ramble about. My take on the idea is that it's related to no self: you cannot point to a "you" that is separate from the world you exist in. It's a fallacy to believe your "you" is somehow different from the collection of experiences of the world, so that you are inextricably intertwined with the world. You can't point to one thing outside yourself and say "I am not this," because you are pointing at it you moron, and so in that moment who you are is a guy pointing at that thing, and life is the accumulation of such experiences of things outside of "you." ANYWAY I am totally not your high uncle, OK? Point is, the idea of interconnectedness is meant to foster a sense of compassion. You can see that at the end of the movie when the Joker plays his hilarious "blow up the other boat" gag. Two boats full of strangers become enlightened, refusing to do harm to people they haven't even met. The Dark Knight remains one of my favorite movies of all time, and it inspired a Batman obsession that took years to subside. (Ironically, obsession is a fairly un-Bhuddist behavior.) If you're a Batman fan too, check out Batman Community Picks for the best Batman books and movies. Or if you're interested in Buddhism, check out Buddhism Community Picks for the excellent books.

Get up and running with OpenShift on AWS

about 2 months ago | Dave Kerr: dwmkerr.com

Setting up your own OpenShift cluster can be a little complex, but in this article I'll show you how to make it fairly painless.

WFFM: Save to Database

2 months ago | Sumit Bajaj: Sumit Bajaj's Blogs

Web Forms For Marketers has become one of the essential component of Sitecore. Almost every website is using forms to capture the inputs from users and it is very common scenario to get the data stored in Database for reporting purpose. Here are few easy steps which can help you storing the form's data in SQL database.Download the WFFM - SQL Provider(Save To Database) and install it in Sitecore using Installation wizard. All physical files and Sitecore items will be stored in respective location.Once installed, you will notice that it has created a new Action under System-> Modules -> Web Forms for Marketers -> Settings -> Actions -> Save ActionsNow, we have to add connection string in configuration file which will help us storing the data in that database. You have to keep the name of connectionstring to 'wfm' only as same name is referred in WFFM module code.< add connectionstring="user id=your_db_user_id;password=your_db_password;Data Source=your_db_server;Database=your_db_name" name="wfm" >You are done.Now add the 'Save to Database' action on any WFFM form and start using it. Also validate the database and data should start getting stored in it.Furthermore, this module provides the capability of exporting the saved data in CSV format. We can do customization on it to export the data from different servers(CMS or CD) which I will explain in next article.Please don't hesitate to contact me at 'email.bajaj@gmail.com' for any Sitecore related query/scenario.

Pointers in C and x86 Assembly Language

2 months ago | Pat Shaughnessy: Pat Shaughnessy

16GB of DDR random access memory my son used in his new gaming PC Recently I’ve been trying to learn how to read x86 assembly language. In http://patshaughnessy.net/2016/11/26/learning-to-read-x86-assembly-lang

Creating a Resilient Consul Cluster for Docker Microservice Discovery with Terraform and AWS

2 months ago | Dave Kerr: dwmkerr.com

In this article I'm going to show you how to create a resilient Consul cluster, using Terraform and AWS. We can use this cluster for microservice discovery and management. No prior knowledge of the technologies or patterns is required! The final code is at github.com/dwmkerr/terraform-consul-cluster. Note that

Learning to Read x86 Assembly Language

4 months ago | Pat Shaughnessy: Pat Shaughnessy

A 16-bit Intel 8086 microprocessor from 1978 (source: RodolfoNeres via Wikimedia Commons) Writing assembly language is

Using Slack for Server Development

4 months ago | Dave Kerr: dwmkerr.com

I recently found a surprisingly helpful approach for server-side development which uses Slack in a creative way.

Docker Registry with AWS & Let's Encrypt

4 months ago | Rocky Jaiswal: Still Learning

With pretty much all new projects moving to Docker and Docker managers like Kubernetes, the Docker Registry becomes the first piece of infrastructure that a team needs to setup. Sure there are public and private registries availa ...

Simple Continuous Integration for Docker Images

5 months ago | Dave Kerr: dwmkerr.com

In this article I'm going to demonstrate a few tips and tricks which can make your life easier when you are building or maintaining Dockerfiles. The need for a Build Pipeline Do we really need any kind of continuous integration or build pipeline for Dockerfiles? There will be cases when

Run Amazon DynamoDB locally with Docker

5 months ago | Dave Kerr: dwmkerr.com

tl;dr: Run DynamoDB locally using Docker: docker run -d -p 8000:8000 dwmkerr/dynamodb Try it out by opening the shell, localhost:8000/shell: DynamoDB Shell That's all there is to it! DynamoDB Amazon DynamoDB is a NoSQL database-as-a-service, which provides a flexible and convenient repository for your services. Building applications

Need a Second Opinion on Your Ruby Code? Ask Crystal

6 months ago | Pat Shaughnessy: Pat Shaughnessy

Running the Crystal compiler on your Ruby codeis like asking a second doctor for their opinion. When it comes to your health, you don’t hesitate to get a second opinion. Doctors don’t always agree, and a second doctor’s app

Hello Kubernetes

6 months ago | Rocky Jaiswal: Still Learning

Introduction Pretty much everyone in the technology world has heard about Kubernetes by now. But before we dive into it, let's try and understand the problems it solves - Back when I started programming, servers were usually considered out of reach for us developer ...

Effective Node.js Debugging

7 months ago | Dave Kerr: dwmkerr.com

If you are interested in improving your Node.js debugging skills, then check out my talk at the recent JSChannel 2016 conference in Bangalore: Comments and observations are always welcome!

My Writing Process

7 months ago | Daniel Higginbotham: Flying Machine Studios

The letter below is a response to an email from a Twitter friend. For context: I've written some instructional material that's enjoyed success online, including Clojure for the Brave and True and Clean Up Your Mess: A Guide to Visual Design for Everyone. Robert asked me a few questions about my process. Hi Robert! You're in the unfortunate position of being my permission to write at length about my creative process without seeming completely self indulgent: someone's actually interested in listening to me describe the chaos between my ears! Be prepared to read way more than you asked for. How do you decide who you are writing for? This one’s key for me. When I’ve written in the past, I’ve struggled with knowing how much or how little to say. I’m curious to learn how you deal with that. First: I've found it useful to follow the standard advice and pick an individual or two and write for them. The argument goes that you'll find it much easier to choose words and have a consistent tone, and that's proven true for me. When I wrote Clean Up Your Mess, I was one of three programmers working in an office full of charming people who did business analysis for management consultants, and I wrote the guide for a couple of them that I had become friends with. These analysts produced powerpoint decks by the barrel, and every single one was ugly. Similarly, Clojure for the Brave and True started as a guide for a couple coworkers that I was mentoring. However, picking your audience is only half the process. The other half is picking who the author is. I'm going to go on a bit of a tangent to explain this. When I started writing Clean Up Your Mess, my personal life was a mess. In hopes of making it less messy I had been spending most of my free time reading Buddhist literature and listening to lectures by Thich Nhat Hanh and Pema Chodron (in fact, my site opens with a Thich Nhat Hanh quote). I was spending a great deal of time meditating and reflecting. (You're interested in Buddhism too, right?) One of the ideas that really grabbed me was that our self-conceptions are just stories we tell ourselves with no reality to them. I won't belabor the point here; suffice to say that I found it useful and powerful to be able to perceive my identity as a construct as ephemeral as smoke. Around the same time, I started taking improv comedy classes, where I would spend two hours a week constantly coming up with new, unique characters and living in them for a few minutes at a time. When you're sold on the idea that your day-to-day you is itself just a character, improv becomes way easier and more fun. It's also fun to do this in real life - like, recently my wife and I were at the grocery store and I decided my character was "Super Excited About Carrots Guy", and I started shouting "OH MY GAWD JESS CARROTS! THEY HAVE CARROTS JESS! CARROTS!" Everyone was laughing as they escorted me out! Anyway, during this time of buddhism and improv I was writing Clean Up Your Mess and when I sat down to write I got to play with new identities, new characters, and see which was the most fun. It became much easier to find words and keep a consistent tone when I decided on the author's character. So, you mentioned not knowing how much or how little to write. Knowing your character helps. In Clojure for the Brave and True, one of my editors would sometimes whittle down sentences to the bone, leaving only pure information; I would undo those edits with gusto, adding back the shape and texture of the author's voice. There's another aspect of writing instructional material, which is that 95% of the time you can take more time to explain something. Even if you're writing for experienced audiences, at least take the time to explain acronyms and jargon. How often and how much do you write? Not enough and not enough! Writing was easiest, however, when I had a consistent schedule of writing at least one hour every single day. Let me tell you about my garage. My garage is a living f*cking nightmare. It's like Cthulhu and the dread of the dark you had as a child made disgusting love and produced a horde of horrors that died in giant filthy clumps all over. At the beginning of the year I suppressed my gag reflex long enough to clean it out with the goal of setting up a photo studio, which I did, only to let it sit for three months. So three months later I go in there to actually take photos and guess what: it's a complete horror show, again! If I had only spent time every day or even every week maintaining it, I'm sure it would have been much easier to keep clean. If I had cleaned it out, all those tiny insect monsters wouldn't have been able to breed, there wouldn't have been two dozen spider egg sacs, etc. When I don't write consistently it's like that. I have to crawl into the nest of no one cares what you write and this time everyone's going to hate it called my mind and clear it all out before I can actually start writing. When I write consistently, on the other hand, it's actually quite pleasant! One more note: much of the writing process is research. Every time I find myself struggling to explain something, it's because I don't understand it well enough. When that happens I put down the keyboard and pull out the pen and notebook. I try to articulate the questions that will lead me to understand what I want to explain. I read and I draw diagrams and play with words until I feel like I understand the concept. Becoming aware that, for me, writer's block is a lack of understanding, has helped me be much more productive. Collaboration Who does your drawings? My wife! She's pretty great. Do you have someone who edits for you? I did when I worked with No Starch. They were awesome! Clojure for the Brave and True is much, much better because they kept pushing me to write more clearly and explain things more fully. For other projects, I'll ask friends to look at drafts. How much does it cost? I paid my wife in carrots. OH MY GAWD JESS THEY HAVE CARROTS! No Starch gets 85% of hard copy sales and 77.5% of ebook sales (or something like that). I hope this was helpful!

Understanding Recursion

8 months ago | Daniel Higginbotham: Flying Machine Studios

During my Clojure training I've found that recursion routinely trips people up. It definitely tripped me up for a long time. I've tried to develop an explanation that's clear and intuitive, so if you're still scratching your head about recursion, read on! A classic recursion example is calculating n factorial, which is n multiplied by every natural number before n; 3 factorial is 6 (3 times 2 times 1), 4 factorial is 24, 5 factorial is 120. The code snippet that follows is a typical implementation of factorial; if you're reading this, then presumably it's confusing - which is great! It means that I haven't written this article for nothing. function factorial(n) { if (n == 1) { return n; } else { return n * factorial(n - 1); } } What makes this function recursive is that factorial calls itself. That's also what makes the function tricky; the function calls itself!? We're used to functions calling other functions to get work done. For example, this function uppercases a string and prepends "Yo, " to it: function yoShout(str){ return "Yo, " + str.toUpperCase(); } yoShout("gimme a donut"); // "Yo, GIMME A DONUT" In this tiny example, yoShout does its work by using the toUpperCase function. It's easier to understand than a recursive function because yoShout treats toUpperCase as a black-box abstraction. You don't have to tax your brain by loading toUpperCase's implementation details into your short-term memory. Let's re-write factorial to use function calls this way, with function's body calling another function in order to get its work done. To calculate 3 factorial, you could write a series of functions, factorial_1, factorial_2, and factorial_3, like this: function factorial_1() { return 1; } function factorial_2() { return 2 * factorial_1(); } function factorial_3() { return 3 * factorial_2(); } These functions feel safe and comfy. factorial_3 calls factorial_2, something we're completely familiar with, and likewise factorial_2 calls factorial_1. factorial_3 also does not care how factorial_2, just like in the string example. Unfortunately, these functions are also completely impractical; can you imagine writing factorial_1000? The recursive implementation doesn't have this problem. My suggestion is to try seeing the recursive implementation from the same perspective as the nonrecursive imiplementation. Here's the code again: function factorial(n) { if (n == 1) { return n; } else { return n * factorial(n - 1); } } You can look at this and say, "Oh, if n isn't 1, then this function does its work by calling some black-box function named factorial with the argument n - 1." You can look at the call to factorial(n - 1) as a call to a completely different function - one that just happens to have the same name and algorithm. That's it! I hope it helps. If you've been confused by recursion, I'd love to hear your feedback!

Pi Calculation with Elixir

9 months ago | Rocky Jaiswal: Still Learning

As a programmer one is always searching for better tools, practices and programming languages. For example, working with Clojure makes me a better programmer, it provides me the ability to write functional, succinct code that runs fast and works on the well-tuned and battle-tested JVM. Looking at ...

F#: Disabling SSL Certificate validation

10 months ago | Kristof Mattei: Kristof's blog

Yesterday I wanted to download some content off a website with F#, however unfortunately the certificate of the website was expired. let result = try let request = "https://somewebsite/with/expired/ssl/certificate/data.json?paramx=1&paramy=2" |> WebRequest.Create let response = request.GetResponse () // parse data let parsed = "..." Ok parsed with | ex -> Error ex If we execute this, … Continue reading "F#: Disabling SSL Certificate validation" The post F#: Disabling SSL Certificate validation appeared first on Kristof's blog.

F#: Disabling SSL Certificate validation

10 months ago | Kristof Mattei: Kristof's blog

Yesterday I wanted to download some content off a website with F#, however unfortunately the certificate of the website was expired. let result = try let request = "https://somewebsite/with/expired/ssl/certificate/data.json?paramx=1&paramy=2" |> WebRequest.Create let response = request.GetResponse () // parse data let parsed = "..." Ok parsed with | ex -> Error ex If we execute this, … Continue reading "F#: Disabling SSL Certificate validation" The post F#: Disabling SSL Certificate validation appeared first on Kristof's blog.

HTTP Compression and Performance tuning

10 months ago | Sumit Bajaj: Sumit Bajaj's Blogs

With the advancement of technology and exceeding expectations of users, one has to be very careful designing a website. Performance is one of the key elements for success of an application. Even if, you have designed the application with uttermost care and rock solid architecture, there are few key areas in which you have to be really vigilant. HTTP Compression is one of those pivotal spaces.HTTP compression is the technique to compress static and dynamic content which improves the transfer speed and performance of a website.Steps to keep the compression ON for a website. Here the demonstration is given for IIS based website.1. Open IIS (inetmgr)2. Goto website. Right side will show all components of that website3. Click on 'Compression' module and verify that both the checkboxes are checked if you need static and dynamic content to be compressed.4. Click 'Mime Types' and check 'application/x-javascript' is added in the existing mime types. If not, add it.5. Reset IIS, browse website and verify that JS is getting compressed now.Web.Config SettingsHere are all the mime types and gzip information which should exist for a website if compression needed, either in IIS settings or in web.config.Note: Include it in web.config if configuration file also get deployed with every build.Section to include in <system.webserver></system.webserver><system.webServer><httpCompression> <staticTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="image/jpeg" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> <dynamicTypes> <add mimeType="text/*" enabled="true" /> <add mimeType="message/*" enabled="true" /> <add mimeType="application/javascript" enabled="true" /> <add mimeType="application/x-javascript" enabled="true" /> <add mimeType="image/jpeg" enabled="true" /> <add mimeType="*/*" enabled="false" /> </dynamicTypes> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="4" /> </httpCompression></system.webServer>After compression is ON:Response header of a JS file being loaded in website. 'Content-Encoding: gzip' shows that it is compressed.Useful toolsThere are several webistes which can help you detect, if your website/CSS/JS is compressed or not. You should check css/js or website seperately to make sure that all static medias are compressed. One of the examples website is given here.Check CompressionFor further detail, you can contact me www.bajajsumit.com. Please share your feedback if you find the article useful.

Testing the Docker for Mac Beta

10 months ago | Dave Kerr: dwmkerr.com

I've finally had a chance to install the new Docker for Mac Beta and give it a whirl, here are my experience so far!

Is it worth persevering with Golang?

10 months ago | Dave Kerr: dwmkerr.com

After perhaps 10-20 hours of learning, coding and messing around, I'm wondering - is it worth persevering with Golang?

What's your Vim Name?

10 months ago | Dave Kerr: dwmkerr.com

I'm a few weeks into moving to Vim as my main editor, I've stopped crying and shaking mostly (at least about my editing ability). Now I'm wondering: what's your Vim name? And who's got the best one? As far as I can work out, my Vim name is: Replace everything

Quick Tip: Sending Newlines with cURL

11 months ago | Dave Kerr: dwmkerr.com

Yikes, this took far too long to figure out! I have a service which takes plain text multiline input and outputs an object for each line, something like this: Input Line 1 Line 2 Line 3 Output [ {line: "Line 1"}, {line: "Line 2"}, {line: "Line 3"} ] There's a bit more

Classes and patterns in Node.js

11 months ago | Rocky Jaiswal: Still Learning

This week we had the awesome Node.js 6.0.0 release! With the 6.0.0 release Node.js has 93% of the ES6 features implemented. In this short post we will look at few particularly interesting features including "classes in JavaScript", ...

Moving from React + Redux to Angular 2

11 months ago | Dave Kerr: dwmkerr.com

I'm going to share my experiences of experimenting in Angular 2, as someone who needs a pretty compelling reason to move away from React/Redux!

Learn Docker by building a Microservice

11 months ago | Dave Kerr: dwmkerr.com

If you are looking to get your hands dirty and learn all about Docker, then look no further!

Running dotnet on Linux

11 months ago | Sumit Bajaj: Sumit Bajaj's Blogs

Server: Linux, version SUSE 12To run dotnet code on Linux, the first and foremost task is to "Install Mono package on linux".Note: Mono is an open implementation of Microsoft's .Net framework, including compilers. It uses the same development libraries on Linux which are being used on Windows. Therefore, if you code and compiled some mono code on Linux,  it will work for Windows as well.      zypper is a package installation tool which is used in this scenario. If zypper is not available, check which package manager tool is installed on server. Furthermore, to verify if zypper is installed or not, type zypper on command line which will show all options if zypper is available on server else it will show 'command not found'.zypper ar -r http://download.opensuse.org/repositories/Mono/SLE_11_SP2/Mono.repoThe above command will download from mentioned URL in a new repository. Here 'ar' stands for 'add repo'.After adding it to repository, type 'zypper refresh' command, it will ask to install packages. Type the appropriate option and install the Mono packages.Once successful installation,       we are all set to run dotnet on linux server.Running first dotnet codeCreate a new test.cs file by typing following command.$cat>test.csNow open the file using any available editor. In this case it is 'vi' editor.vi test.csStarting writing the first dotnet code as shown below.      Information about 'vi' editor:Type 'i' to change it to insert mode.Type 'esc' to come out of insert mode.Type ':w' to write the file and save.Type ':q' to quit and come back to command line tool.       NOTE: If any exception appears like '!' is required to override the file. Type ":w!" to override the existing file and write the new text. OR Type ":q!" to override the existing file with new text and quit.C# code for 'test.cs':using System;namespace Test1{class Test1{static void Main(string[] args){Console.WriteLine("Hello World!!");}}}Once you have saved the file, its time to compile it. 'mcs' is command which is used for compiling the code.dev-server-linux-suse12:~ # mcs test.csAfter compilation is successfully completed, its time to run the application. As it is console project, '.exe' file will be created as output. 'mono' is the command used for running the test project.dev-server-linux-suse12:~ # mono test.exeHello World!!You are all set to run dotnet on Linux. Provide your valuable comments/suggestions.

Two Dumb Ruby Mistakes

12 months ago | Pat Shaughnessy: Pat Shaughnessy

Coding is like climbing: You need equipment that will catch you when you make a mistake. (source: Elke Wetzig via Wikimedia Commons)

Packer, Ansible and Docker

12 months ago | Rocky Jaiswal: Still Learning

A little while back we looked at an operational setup that can get us up and running with any simple application by using Docker and capistrano. What was missing was the setup of the machine itself, we do not want to ...

Timeless Programming Tools

about 1 year ago | Daniel Higginbotham: Flying Machine Studios

I've been programming professionally for a dozen years. Some of what I've learned is best forgotten (oh god, Cold Fusion), but there have been many tools, techniques, and concepts that continue to be useful every day. Here are mine; I'd love to hear what yours are so I can experience both the joy of discovery and regret for not learning about the tool earlier. Relational Algebra / SQL I feel lucky that, during my fourteenth summer, I apparently had no friends and so had nothing better to do than try and slog through a book on MySQL and the now-defunct mSQL. You can see from the reviews that the book "is sketchy, incomplete, and almost totally useless." But, it did introduce me to SQL and databases. Soon after, I learned relational algebra (the theory underlying RDBMSs) and that investment has been one of the best of my life. I can't count the number of times a LEFT OUTER JOIN has saved my bacon. Friends be damned! Learning relational algebra provided the foundation I needed to move easily from MySQL to Oracle and MS SQL Server when I joined EnterpriseCo, and in general knowing how to interact with databases without a framework or ORM helped me quickly advance career-wise. It's why, at 20, I was able to land a contract building a custom site for the city of Santa Fe, New Mexico, instead of just cobbling together Wordpress and Drupal plugins. If you come from Rails or some other framework that handles all the database interaction for you, one of the best things you can do for your career is to learn relational theory and SQL. Read a book by C. J. Date. The Unix Process Model Understanding Unix processes helped me understand what's actually happening when I run a program. It's also helped me understand what exactly a web server is and what I'm doing when I write a web application. The book Advanced Linux Programming has a chapter on processes for free online. Actually, the whole book is free. When you don't know about processes, programming is much harder and more mysterious. It's harder to understand performance, and it's harder to understand how programs interact with each other. If you ever feel a vague sense that you don't really get what's going when you run the apps you write, learning the process model will go a long way toward clearing things up. Regular Expressions Yeah, yeah, we've all heard the joke: "something something regular expressions, then you have two problems." Personally, I don't get it, because regular expressions are seriously badass. I remember going through O'Reilly's big fat regex book while I worked from 11pm till 7am as a night auditor at a hotel when I was 18, and being blown away at how powerful they are. To say that we programmers deal with text all the time is so obvious, it's not even worth saying. Regular expressions are an essential tool, and here's where you can learn to use them. Finite State Machines Regular expressions are built as finite state machines. Here's a great tutorial on FSMs showing how to actually build a regular expression. It's extremely cool! I think FSMs are covered in computer science 101, but since I only went to college for a year and even then I studied works written a couple millennia before before the computer revolution, I didn't actually learn about them until about six years ago. My colleagues and I were having trouble with a mobile app - we needed the initialization process to happen in a particular way, and the logic for ensuring that was getting pretty tangled. Once we took the time to learn about FSMs, though, it was easy to express the process as a series of states and transitions. I've since found that most tricky UI code can be improved this way. Just a couple months ago I was having trouble building a typeahead element from scratch with hoplon. Once I identified that the difficulty was in keeping track of all the possible states, it only took a few minutes drawing a state machine diagram and I was back on track. Emotion Management In my personal life I'm constantly learning about and practicing ways to manage emotions. This stems from both my personal aspiration to improve the lives of others and from the completely selfish reason that it helps me do good work. Emotion management is probably the most important meta-skill you can develop. I mean, emotions are at the core of who you are as a human being. The book Non-Violent Communication is an excellent resource for dealing with emotions. Also, my friend Alex Harms recently wrote a book specifically for technical people. Those are my programming power tools - I hope you find them useful!

Cannot alter the login 'sa', because it does not exist or you do not have permission.

about 1 year ago | Sumit Bajaj: Sumit Bajaj's Blogs

Working on projects, it can happen that 'sa' account gets locked. If it is on local machine OR development boxes, onus would be on you to fix it. If scripts and SQL steps are not working, this might help you fixing the issue.Steps to unlock 'sa' account and resetting the password.1. Open SQL Server Configuration Manager2. Select SQL Server Services -> 'SQL Server' service.3. Right click on 'SQL Server' service and click on "Startup Parameters". For 2008, server "Startup Parameters" are inside Advanced tab. 4. Add '-m' in startup parameters as shown above and click on 'Add'. This will put SQL server into 'Single User Mode' and local admin will have 'Super User' rights. For 2008, server you have to add ':-m' in the last of the existing query.5. Save the settings and Restart the service.6. Now open the SQL Server Management Studio and connect to database using 'Windows Authentication'.7. Goto Security -> sa -> Right click and open properties.8. Unlock the 'sa' account and reset the password.YOU ARE DONE!!**Important: Now to switch back to 'Mixed User Mode' where you can access the database using 'sa' account, remove the '-m' from 'Startup Parameters' which we added in above steps.

Brave Clojure: Become a Better Programmer

about 1 year ago | Daniel Higginbotham: Flying Machine Studios

Next week week I'm re-launching www.braveclojure.com as Brave Clojure. The site will continue featuring Clojure for the Brave and True, but I'm expanding its scope a bit. Instead of just housing the book, the purpose of the site will be to help you and the people you cherish become better programmers. Like many other Clojurists, I fell in love with the language because learning it made me a better programmer. I started learning it because I was a bit bored and burnt out on the languages and tools I had been using. Ruby, Javascript, Objective-C weren't radically different from each other, and after using them for many years I felt like I was stagnating. But Clojure, with its radically different approach to computation (and those exotic parentheses) drew me out of my programming funk and made it fun to code again. It gave me new tools for thinking about software, and a concomitant feeling that I had an unfair advantage over my colleagues. So of course the subtitle of Clojure for the Brave and True is learn the ultimate language and become a better programmer. And, four years since I first encountered Rich Hickey's fractal hair, I still find Clojure to be an exceptional tool for becoming a better programmer. This is because Clojure is a fantastic tool for exploring programming concepts, and the talented community has created exceptional libraries for such diverse approaches as forward-chaining rules engines and constraint programming and logic programming, just to name a few. By learning a variety of programming concepts, you become a better programmer because you're better able to recognize what kind of problem you're working on and apply the right tools. To give just one example: when I'm working on complex UI widgets my work is always made easier if I model the widget using a finite state machine (FSM) - but I had to actually spend time learning what FSMs are and how to use them (those of you with comp sci degrees are probably chuckling at this). You may have started learning Clojure because you heard that functional programming, Lisp, and immutability can make your life easier, but the fun doesn't stop there! At Brave Clojure, I hope you'll continue using the ultimate language to explore the vast and infinitely fascinating world of computer programming with me. The first topic we'll explore is parallel programming. Here's the beginning of an ebook on the topic that I'm nearly finished with: Yes, it would be fair for you to describe my startup as the Google of palm reading. I don't know if you know this, but the fortune telling industry has no quality control standards. There is no Six Sigma of fortune telling. Sometimes it seems like these people are just making things up! We can do better. Did I say we? Yes! I want to you to embark on this startup journey with me. Lucky you! My - our - plan is to disrupt the field with an app that lets a user position their phone so that the camera faces their palm and takes a picture, then predicts the future. I call it: iFacePalm. And, uh, there's parallel programming in it. While I plan on spending most of my time helping you and all of your closest friends, enemies, and even frenemies become better programmers by writing about these big ideas, I'm also going to spend time covering practical Clojure topics like deployment and debugging. To make this happen, I'm working a (great) job only two days a week and spending the rest of the time on Brave Clojure, so I'll need to find a way to derive income from the site. I'm not sure yet what will be free and what won't. My dream is to make all the content available online for free. That's what gives me joy, and I think it's the best way to have a positive impact. Ideally, I would be supported in this endeavor through monthly donations, but I'll likely try different approaches over time. Finally, I've been putting together two sites to help you up your game: Open Source Clojure Projects, a directory of active projects, and Clojure Work, the first Clojure-only job board. The latter is still in beta, and I'm going to officially release it and move it to https://jobs.braveclojure.com next week. The best way to get better at Clojure is to actually write Clojure, and working on real projects (and even getting paid to do so) is a great way to do that. Companies who buy job board ads will also be supporting me in making more content - hooray! If you get excited about learning more programming ideas, or learning to develop Clojure programs better, or getting paid cold hard cash to write your favorite language, then I cordially invite you to consider signing up for my newsletter, where I'll announce every release: Writing Clojure for the Brave and True was one of the most rewarding experiences of my life in large part because I got to interact with so many kind, thoughtful, intelligent people. I look forward to your company as I embark on this new chapter of my journey!

A Directory of Open Source Clojure Projects

about 1 year ago | Daniel Higginbotham: Flying Machine Studios

Every now and again I'll come across a post where someone asks about getting involved in open source clojure projects. Because every question deserves a single-page app dedicated to its answer, I made Open Source Clojure Projects, a directory of active projects welcoming new contributors. Each project has (or should have) clear instructions on: Developing the project locally Running tests if there are tests Contributing code (pull request? tests required?) Contacting other devs - slack, mailing list, IRC, etc Also, there's a "beginner-friendly" flag so that new Clojurists can easily find projects with tasks that are appropriate for their skill level. So far, 22 projects have been added, which is awesome. A random sampling: milestones, which generates the best possible schedule from a set of tasks reverie, a CMS for power users Scheje, a little Scheme on Top of Clojure (!!!) system, a friendly layer on top of Stuart Sierra's component library If you have an open source project and want people to contribute, please add it! The Stack A few folks have asked me about what tools I used to create the site. I'll explain more below but briefly: The backend is a weird, unholy mess of fantastic classic libraries and sideshow code that I keep transplanting from one project to another so that I can answer the question what kind of abomination will this morph into this time?. The backend uses Github as a database, though, and that's pretty neat. The frontend uses re-frame and includes some form handling code that I'm proud of and that's actually worth stealing. Finally, there's also some code for deploying with Ansible that's worth stealing. In the time-honored fashion of technical blog posts everywhere, I'll now "dive in" and elaborate on each of those bullet points. Backend For the backend, the site uses ring, compojure, liberator, http-kit, and the weird set of tools that have accreted in my projects over the years. Even though the code footprint for the backend is pretty small, it's pretty idiosyncratic, containing handfuls of half-formed ideas I keep noodling around with. Hopefully someday soon I'll be able to really nail down my approach to backend dev and share it, because it does allow me to write apps quickly. One cool part of the site is that it uses a Github repo, Open Source Projects, as its database. Browse the projects directory and you can see every project that's listed on the site stored as an EDN file. When the backend starts up it reads from Github, and whenever someone posts or edits a listing it writes the EDN file using Github's API. The nice thing about this approach is that I didn't have to worry about standing up a server or keeping backups. And it was just fun to code. Here's the source for using Github as a db - I definitely see potential in reusing this approach for similar lightweight directory sites. Frontend re-frame has a delightful README that gracefully introduces you to reactive programming. If you haven't read it then stop reading this article and read that instead; I am 100% confident that it's a better use of your time. re-frame is a joy to use, and it's become my go-to tool for frontend projects. I've written a fair amount of code for working with forms and submitting values. This code forms a kind of nano-framework on top of re-frame, and it's allowed me to speed up the development process from project to project. Here's an example form which uses the form helpers. If you'd like for me to write a detailed explanation of this code, please leave a comment letting me know :) Boot deserves a special mention because it makes it so easy to develop ClojureScript apps. With Boot you get live reload (every time you change your frontend files, the changes are automatically injected into the browser), giving you a near-instantaneous feedback cycle that makes development much more enjoyable. It's also easy to incorporate Sass compilation - and your Sass files also get the live reload treatment. If you're not using Boot to build your ClojureScript app then chances are you're causing yourself undue suffering. And hey, maybe you're into that? No judgment. But if you're not, then take the time to learn it - it's a great investment in yourself as a Clojure developer. Deployment The infrastructure directory contains scripts for provisioning and deploying to a server with Ansible. It also has a Vagrantfile so that you can stand up a test server locally; just run vagrant up to both create the virtual machine and provision it. To deploy, cd into the infrastructure directory and run ./build.sh && ./deploy-dev.sh. Those two shell scripts are extemely simple, so take a look at them to see what's involved in deployment. The Ansible configuration is almost completely reusable. You can check it out in infrastructure/ansible. The roles directory in particular has Ansible tasks for creating an nginx server that can run Clojure app. It also includes an Upstart script for controlling startup/shutdown of your Clojure app (assuming you use Ubuntu). The Future Eventually, I'd like to add more tools for project discovery and for showing project stats. @yogthos, for example, suggested incorporating a project's stats from github so that users can see how active and popular each project is, information that can help them decide which project to contribute to. Also, I'm in the process of revamping braveclojure.com to include more resources for Clojure programmers. The site hovers around 3rd or 4th Google result for "Clojure", just below clojure.org and the Wikipedia entry. So, it's kind of popular I guess. My hope is that by featuring Open Source Clojure Projects, I'll help more new developers get involved and also help project maintainers squash some tickets.

hapi.js, JWT and CORS

about 1 year ago | Rocky Jaiswal: Still Learning

In the last post we setup a React based authentication workflow for a sample application. In this short post we will look at a hapi.js backend that can handle authentication using http://jw ...

Authentication workflow with React

about 1 year ago | Rocky Jaiswal: Still Learning

Having worked with a few frontend frameworks, I definitely find React to be a very good choice. For me, it delivers on the promise of creating clean frontend components that can be used across projects while being easily extensible and flexible. On t ...

Not a Superpredator

about 1 year ago | Daniel Higginbotham: Flying Machine Studios

I'm the son of a Vietnamese emigrant. I grew up in the South, where I experienced and witnessed racism. I have black step-siblings and my wife is black (naturally, so are my in-laws). As such, I try to educate myself about race issues in America. I don't share my thoughts much publicly but do want to write more on the subject. In the mean time, here's a (slight edited) exchange I had with a friend on Facebook about a recent event, Ashley Williams's protest during a Hillary Clinton speech. Me: A room full of white people at a $500/person Hillary Clinton event tells young black woman she's being rude and inappropriate for demanding Hillary Clinton explain why she supported the system that destroyed countless black and latino lives. I think that accurately sums up the prevailing attitude toward race in America: black people, please don't cause me mild discomfort by bringing my attention to our society's racial caste system. It's impolite. Friend: Wow. This thing seems like... a really, really huge distortion. She [Hillary] actually said: "You’re the first person to do that, **and I’m happy to address it."** She offered to talk about it. But the demonstrator wasn't there to talk, and wasn't in listening mode. Second, what she said, 20 years ago, is that she thought 'SuperPredators' exist and should be dealt with. It was a popular idea at the time. She did not say that they were one color or another: just that they exist and should be contained. WTF ??? It's indisputable that America needs to deal with the legacy of excessive force and excessive incarceration against people of color. But if we make it sound like any talk about incarcerating anybody, ever, must be inherently racist... we've already lost the battle to have serious conversations about what non-racially-biased policing would look like. Me: Hey man! Thanks for sharing your thoughts. Here are more of mine, and I hope they don't come across as combative - I really appreciate getting to talk about this stuff with someone as thoughtful as you. I wasn't actually commenting on Hillary's reaction, but the reactions of those in the (almost entirely white) room with her: people hissing at her and telling her she's being rude and inappropriate. That's what I'm referring to when I say the video reflects the prevailing attitude toward race. To me, it's as if the message toward the BLM activist [note: I've since learned she actually isn't with Black Lives Matter] is, "Excuse me, but you're interrupting the event we paid $500 to see. Please take your complaints about the racial caste system, which doesn't negatively affect me, elsewhere." And it is always "rude" or "inappropriate" or "inconvenient" for those topics to be discussed. When Beyonce dances at the Super Bowl, people lose their minds: they're just trying to enjoy football, they don't want to have to think about the lives of people who aren't like them! When another black man or woman gets murdered by police and people take to the streets demanding change, they're somehow offensive and ungrateful for criticizing law enforcement. Most often, the reaction is to denounce the method and ignore the message. Last year, Bernie Sanders visited Liberty University, and David Nasser, a university VP, got some of the biggest applause of the event for saying that the problem with the criminal justice system is a "sin issue, not a skin issue" - meaning that it was not a political issue, but one better addressed by encouraging people to be better or something. Same message: stop speaking up, black people. So that's what I was meaning to communicate originally. Here are my thoughts on Hillary. I'm not sure if you're familiar with "dog-whistle" politics, using coded language to court the racist vote. At the time, the Democratic party was trying to win back the vote of poor, Southern whites who'd switched to the Republican party thanks to the republicans' Southern Strategy, an effort to win those votes by appealing to racist fears and biases. Anyway, Democrats had the idea, "hey maybe if we also play on those racial fears, we'll get those votes back!" And that's what they did. When Hillary and other political/media figures talked about "superpredators", it was generally understood to mean "urban" people, and that was generally understood to mean black people. So when the demonstrator brings this up, she's not saying that "any talk about incarcerating anybody, ever" is inherently racist. She had reasons for singling out that phrase and using it to call attention to Hillary's record. Some might disagree, but I think her reasons were good ones. And even if "superpredator" wasn't meant that way, the result was still the crushingly unjust system we have today - and Hillary's support helped build that system. Using terms like "superpredator" and "bring them to heel" to accidentally perpetuate a racial caste system might even be worse. Michelle Alexander, author of The New Jim Crow, writes about it persuasively. The New Jim Crow goes into even greater detail about how mass incarceration and the criminal justice system are tools for racial control, even if many of the actors in the system (police, lawyers) aren't racist. I'm a Bernie fan, and I don't have rabid Hillary hatred. If it comes down to Hillary versus whichever clown the Republican party decides on, I will vote for Hillary. I respect her vast experience and think she would do a decent job at pushing for progress. When it comes to racial justice, though, I think Bernie has a much better record. Most of all, I'm an Ashley Williams fan. It takes courage to do what she did. Maybe she wasn't in listening mode (it's hard for me to really articulate my thoughts on this. She did give a good pause so that HC could speak. And anyway the power was so asymetrical that I don't know how to think about it. How do you really try to talk when you're being carted off by security?). But I'm glad she did it - it brought attention to an under-reported problem, and Hillary did in fact end up apologizing. And no damage was done, except perhaps to the sense of propriety of a few stuffy rich people.

Setting up web server and continuous integration

about 1 year ago | Sumit Bajaj: Sumit Bajaj's Blogs

Apart from creating website & app-pool in IIS, there are several steps which need to be performed when setting a new website on server.Setup Web ServerThere are few activities which you have to perform on Web Server:1. Install Web Deploy [Download]2. Install URL Rewrite [Download]3. Make Sure .Net Framework feature is ON in Windows features4. Create a standard user which could be used to deploy files to web server after successful build5. Open "services.msc" and check that 'Web Deployment Agent Service' is running with the standard user credentials created in Step 4.6. Run App pool and website with same standard user which is created in Step 47. Reset IIS ServerContinuous IntegrationThere are several tools which are being used for continuous integration but they perform same functions when we discuss about build and deployment. In this example, we are referring Jenkins [Download].If msdeploy or any relevant command is being used to deploy files on web server, same standard user credentials should be used to copy the content else it will throw unauthorized exception.Common ExceptionsAn item with the same key has already been added.Solution: It can be resolved by checking Mime types. There is a probability that same Mime type is being added by web.config which is there in IIS already. In IIS 8, there is not need to add Mime types manually.Website is appearing but css/font is not loading.Solution: Open dev tools(if its chrome browser, press F12 key) and check if in console you are getting errors like 404, 500 etc. Check if css/font files are present in the right folder. If gulp or grunt is being used, make sure it is compiling the files without exception.If any CMS is being used then there might be CMS related errors.Sitecore has no necessary permissions for reading/creating counters. OR Sitecore publishing screen is showing 'Initializing' but not publishing anything.Solution: Application pool user should be member of 'Performance Monitor User' group. Add user to this group and restart IIS. Even after this, if it does not work sitecore counter can be disabled by setting counter value to false. For example: <setting name"counters.enabled" value-"false"/>Let me know if you still get any exception. Have a nice day!!

Is Your Postgres Query Starved for Memory?

about 1 year ago | Pat Shaughnessy: Pat Shaughnessy

Like a patient with low blood pressure, a slow SQL query might not be getting the memory it needs. For years or even decades, I’ve heard about how important it is to optimize my SQL statements and database schema.

Get all Items inheriting another template

about 1 year ago | Sumit Bajaj: Sumit Bajaj's Blogs

Working on different templates and Sitecore items, its very common requirement to knowhow many items are created with a specific templatehow many template are inheriting a base template or another templateSitecore provide this feature out of box however you need to write query to fetch the required items.Open Sitecore IDE (http://localhost/sitecore/shell/default.aspx?xmlcontrol=IDE)Goto Tools -> XPath BuilderWrite XPath Expression:/sitecore/templates//*[contains(@__Base template,'{1FE1328B-375B-4548-A53E-344FA61ACC90}')]In result section, it should show all templates which are inheriting base template with ID {1FE1328B-375B-4548-A53E-344FA61ACC90}.Similarly, query /sitecore/content//*[@@templatename='Promotional Page'] should show all pages (under content) created with 'Promotional Page' template.On top of results, it shows the count of items and time taken to fetch the items.We can use fast query as well instead of query.Note: The above queries are example of specific requirement. Query can be modified to get required items according to project need.URL: Sitecore Query and Fast Query

Weather with Reagent

about 1 year ago | Rocky Jaiswal: Still Learning

In my last blog I talked a bit about React and ClojureScript. In this post we will look at a simple Reagent app that fetches the weather using the http://openweathermap. ...

React Router Comparison

about 1 year ago | Rocky Jaiswal: Still Learning

React and Redux are game changing technologies. The architecture principles they are based on seem to be sensible and rock solid. Redux architecture revolves around a strict unidirectional data flow, with a central ...

Announcing Job Search Sanity

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

One of the least fun experiences in my life was getting fired twice in three months back in 2008 when the economy decided to go all YOLO and drive off a cliff with its middle finger waving out the window. The first time, I was a wreck. I was in a relationship with someone who had a chronic medical condition and the attendant medical bills. As the sole money earner, I was pretty bummed! Every day I felt dread and panic as I pored over job listings. I made many stress-induced mistakes like emailing the same contact twice or forgetting phone interviews. But somehow I found a job at a startup pretty quickly, only to be regrettably let go a couple months later because they were running out of money. This time, I did things differently. I took a Getting Things Done inspired approach to the job search. Approaching the search in an organized, methodical way made me feel in control. It also gave me confidence that I was making real progress on finding a job because I could actually see all the steps I was taking. At the end of the day I knew I had done what I could to move forward. Today I'm releasing a free web application, Job Search Sanity, to help others do the same. It helps you keep track of each job opportunity and the next actions you need to do to move forward. It also keeps cover letters and interview remindres in place. And one of its best features is that it lets you save your job searches on the site so you can keep them all in one place instead of visiting dozens of sites every day. If you're looking for a job and feel overwhelmed, then please give it a try! If you know someone who's looking for a job, please send them a link! Personal Notes The main thing that motivated me to create this site was seeing my brother struggle with finding employment after graduating with a Pharm.D. (doctor of pharmacy) degree last year. After spending a decade putting himself through school, he had the modest expectation of finding decent-paying, stable work. Instead, he found that the pharmacy market had radically changed while he was getting his degree, and jobs were scarce. I can only imagine how crushing it would feel to commit so much of your life (and accumulating large student loan debts) to learning profession, only to find that the rules had changed and there was actually little demand for your skills. To find that the future you've been working toward for so long has vanished, replaced with utter uncertainty. It was a rough time for him, but thankfully he did eventually find a job as a pharmacist. While he was looking, he came to live with me, and I was so glad that I was able to help in some way (and that I got to spend so much time with him), but part of me wished I could have done more. Cut to the present day, where my wife has been looking for a better job for a while, and I can see the stress affecting her in similar ways (though to a much lesser degree, thankfully). All of which is to say - I know that looking for a job can be incredibly stressful, and I hope that by providing this free app I can help people in similar situations. I kind of need to make something that I actually accept payments for soon, but for this site I didn't want their to be any barriers to signing up and using it. Perhaps I'll figure out way to monetize it, but for now I'm proud of the site and I'll count it a success if it helps even a dozen people as they find a job. Development Notes Job Search Sanity was built using: The Boot build tool. Boot made it easy to integrate a Clojure backend, ClojureScript frontend, and Sass compilation Liberator, to structure the handling of back-end API calls Datomic for the database re-frame as the lightweight front-end structure imposed on reagent I absolutely loved working on the site because the tools made it so much fun. One of my personal goals was to stretch myself design- and UX-wise, and the above programming tools made that possible by making it so simple and easy to implement the basic functionality. ClojureScript has come incredibly far in the past couple years. A year or two ago I looked at it but stuck with Coffeescript because cljs looked like a pain in the ass to use, but that isn't the case any longer. The only downside here is that, once again, Clojure has spoiled me, and I never want to go back to my previous tools.

A Look at How Postgres Executes a Tiny Join

over 1 year ago | Pat Shaughnessy: Pat Shaughnessy

Reading the Postgres source code is like attending a free Computer Science lecture, complete with working examples. Aside from saving and retrieving data, the primary feature of a relational database is the ability

Pi Calculation with Clojure

over 1 year ago | Rocky Jaiswal: Still Learning

A while back I wrote a post on using Akka with JRuby to calculate the value of pi. Since I am learning Clojure these days I thought it would a good idea to implement the same pi calculation algorithm using Clojure and core.async. The i ...

Rejection Sampling

over 1 year ago | Pranav Modi: pranavmodi.com

Continuing the exploration of simple sampling methods from the last post. Unlike the Normal or the Uniform distribution, arbirary p.d.f's cannot be sampled directly. If we need to calculate the expectation of \( f(x) = e^x \) and p(x) looks like this – Here we cannot use Simple Monte Carlo, as there is no direct … Continue reading Rejection Sampling →

Be careful with npm shrinkwrap

over 1 year ago | Kristof Mattei: Kristof's blog

Recently we had the issue that we used version x of an npm package. However in the course of time this package was updated by the author and contained a critical bug, which broke our AWS deployments. Locally this was no issue because we had a version installed that satisfied the version requirements. In order … Continue reading "Be careful with npm shrinkwrap" The post Be careful with npm shrinkwrap appeared first on Kristof's blog.

Be careful with npm shrinkwrap

over 1 year ago | Kristof Mattei: Kristof's blog

Recently we had the issue that we used version x of an npm package. However in the course of time this package was updated by the author and contained a critical bug, which broke our AWS deployments. Locally this was no issue because we had a version installed that satisfied the version requirements. In order … Continue reading "Be careful with npm shrinkwrap" The post Be careful with npm shrinkwrap appeared first on Kristof's blog.

Why Clojure's a Great Next Language for Rubyists

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

HAVE frothing at the mouth YOU flailing arms CONSIDERED eyes are unfocused and mad LISP flipping furniture over — @ra If you're a Rubyist itching to learn a new language, then I want to convince you (using only a minimum of mouth frothing and chair flipping) that Clojure's a great pick for you. Please excuse me if this article reeks of the glassy-eyed fanaticism of the true believer, but the fact is that I think Clojure is crazy stupid fun to use, and intellectually rewarding to boot. I fell in love with Ruby back in 2005, and since then only Clojure has been able to elicit the same level of affection. I think this is because Clojure has the same fundamental attributes that make Ruby so appealing: it's simple, it's powerful, and above all, it's fun. The rest of this love letter cough I mean, blog article, is about how Ruby and Clojure exhibit these attributes in very different ways, and how Clojure's different approach to computation makes it fascinating and rewarding to learn. My first exposure to Ruby was DHH's whoops-laden Ruby on Rails demo. That video saved me from the Lovecraftian horror that was PHP circa 2005. You may have had a similar experience, with Ruby rescuing you from C++ or Java or COBOL or whatever. It's a vast understatement to say that, compared to PHP, Ruby is elegant. Whereas PHP seemed almost to strive for inconsistency, Ruby employs only a few, simple ideas: everything is an object, you advance your program by sending messagse to objects, and message dispatch is governed by a couple easily-understood rules. Clojure is also a very simple language. It wouldn't be a stretch to say that simplicity is one of the core tenets of the Clojure philosophy; its creator, Rich Hickey, has given a number of talks elaborating on what it means for something to be simple, including Simple Made Easy and Clojure, Made Simple. Clojure's simplicity, however, takes a radically different form. In Clojure, you primarily care about two things: data and functions. You pass data to functions and get new data back. Yes, there's other interesting stuff like state management constructs and macros, just as there are other interesting aspects of Ruby like modules and blocks. But the heart of Clojure is so simple any eighth grade algebra student can understand it: hand some value to a function, and it hands you a new value back. "But wait a minute," you might be thinking, "You can't just pass data around like that. Haven't you read POODR? What about encapsulation? What if those functions mutate your data?" In Clojure, data is immutable. You can't change existing data, you can only derive new data; when you add 3 and 4, you don't change 3 or 4 to make 7, you derive 7. If this sounds crazypants and impossible to work with, all I can do is assure you that it does work (and point you to this book I wrote available free online, Clojure for the Brave and True which explains how) and hope that your intellectual curiosity will motivate you to explore this crazypants paradigm that lots of people seem to love. Here's a teaser: many of the problems addressed by object-oriented design simply aren't problems in Clojure. You don't have to care about inheritance vs. composition because behavior isn't chained to data. You don't have to care about data hiding because there's no risk that some object somewhere will silently change it. As a Rubyist, you know that simplicity buys you power, where power is defined as the ability to express computational ideas concisely. For example, Ruby's blocks allow you to write anonymous algorithms, something that's impossible in C. Another example: Ruby's simple method dispatch scheme makes it easy for you to reason about and design robust programs. It lets you easily extend code and buys you reuse through multiple inheritance. Most enticingly, it lets you do metaprogramming. Clojure's simplicity also buys you power. As a Lisp, Clojure employs a syntax which just so happens to mirror the internal abstract syntax trees that represent Clojure code. I'm going to wave my hands a bit here and say that this lets you use macros, the most powerful metaprogramming tool available to any language. In the Ruby community, we like to talk about code that writes code; macros take this idea to a whole different level. It's not an exaggeration to say that Ruby's metaprogramming system provides only a subset of the capability provided by Lisp macros. Super duper hand wavy, I know, but the point is: if you like how powerful Ruby is, you will lose your flipping mind over how powerful Clojure is. Macros let you easily implement ideas from all corners of computer science. It's not an accident that Clojure has so many libraries that let you use different paradigms. There's core.logic for logic programming, instaparse for building parser generators, core.typed for haskell-ish typed programming, and much more. And macros aren't even the coolest part. I'll let you in on a secret: macros are the flashy, shiny bait that wild-eyed Clojurists lay out to ensnare curious programmers. Nay, even more powerful is Clojure's design of programming to abstractions. This design makes it incredibly easy to reuse your code and extend existing code. Of course I can't tell you how in the short space afforded by this digital outburst, but you'll grow as a programmer if you learn about it. These last two paragraphs also hint at what makes Clojure so dadgum fun. First, by learning Clojure you get introduced to one of the most loved and respected computational traditions, Lisp and the lambda calculus. It also has a clear philosophy, articulated by Rich Hickey, that will make you a better programmer. Not only that, other programming vistas become more readily accessible. Second, Clojure is a joy to write. Here's a quote from Matz (Ruby's creator) on his design philosophy: By using Ruby, I want to concentrate the things I do, not the magical rules of the language, like starting with public void something something something to say, "print hello world." I just want to say, "print this!" I don't want all the surrounding magic keywords. I just want to concentrate on the task. That's the basic idea. So I have tried to make Ruby code concise and succinct. Clojure, likewise, is concise. It lets you focus on solving the problem at hand rather than figuring out the magic whatever. People are falling in love with Clojure, spending their nights and weekends learning it hacking with it, because the experience is its own reward. If you're looking to stretch yourself and explore more of what the world of programming has to offer, then I recommend Clojure to you with all of my crazed heart. Here are some resources for getting started: Clojure Distilled, a very short overview of the language Clojure for the Brave and True, my own full-length crazypants introductory book Living Clojure, an excellent introductory book by Carin Meier, someone who BUILDS ROBOTS LispCasts for those of you who prefer video The Rich Hickey FanClub lists all his talks Now go out there and start learning some Clojure!

Simple Monte Carlo

over 1 year ago | Pranav Modi: pranavmodi.com

Often in Machine learning and Statistics, we are required to sample from a density function p(x). One of the the most commonly encountered scenarios is when the expectation of f(x) needs to be calculated. $$ \mathbb{E}[f(x)] = \int_{-\infty}^\infty f(x) p(x) dx $$ If this integral is not computable analytically then approximate inference methods are the … Continue reading Simple Monte Carlo →

Looking for Beta Testers

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

Over the last couple months I've been working on a web site that helps job seekers reduce stress by following a structured, methodical process, and the site's ready for some beta testing. If you'd like to help out, please sign up for the beta test! This isn't a unicorn-disrupting once-a-generation app, just a simple site to help people during a stressful process. For the beta test, I'm just looking for feedback on what's broken, what's confusing, and what could be useful but isn't implemented. Thanks! P.S. in case you're wondering, the site's all Clojure, with compojure/liberator/datomic on the backend and reagent and re-frame on the frontend.

Get started with Compojure & ClojureScript

over 1 year ago | Rocky Jaiswal: Still Learning

Clojure is probably the programming language that has fascinated and intimidated me for the longest time. I tried to pick it up many times and gave up an equal number of times. However, it was getting harder and harder to ignore ClojureScript's rising popularity and its awesome integration with Re ...

Why I wrote Clojure for the Brave and True

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

It seems weird to say that I'm almost painfully filled with gratitude for all the good shit in my life, and that that was what motivated me to start writing a free programming book, but that's the truth. Before I started writing Clojure for the Brave and True back in 2013, I had been deliberately trying to figure out what I could do to improve other people's lives even just a smidge. By that point I had been doing a gratitude practice (just spending a few minutes to think of three things I was grateful for) regularly for a year and a half, and felt that my life was so full with good shit that I felt almost obligated to do something for others so that they'd have more good shit in their lives. "Obligation" might seem strange here, and it's not 100% what I mean. It's hard to accurately put the feeling into words. Someday I'd like to take the time to do a good job writing about it, but for now - My life experiences have instilled in me a belief that kindness and generosity are obligations. To take just one experience: for years, I witnessed firsthand the kind of suffering that chronic illness can inflict on someone. That was just nature doing it's thang, cruel, impersonal, implacable. But it was compounded by the constant minor (and sometimes major) abuses delivered by people. Life is painful enough without humans heaping additional indignities on each other. Beyond this baseline of "don't be an asshole" (incidentally, that's the central tenet of my personal ethics), I think it's imperative to learn to live with kindness, love, and generosity. The bleak perspective on this is that the ship is going down for all of us, and the only thing we have to hold on to is each other. The not-bleak perspective is that we are social creatures, wired to find fulfillment in contributing to each others' happiness; that our greatest joys are found in human connection. Which is why I wrote a programming book featuring hobbit violence, man-eating trolls, and mopey teenage vampires! Really, though, programming is a huge part of why my life is so full of good shit. I grew up living in poverty, and now I make a very comfortable living doing an activity that I genuinely enjoy. I have great coworkers, good health insurance, I live in a good house and have a decent car, and I'm confident I can provide for my family. I even have enough free time for hobbies and friends. So, I wanted to provide something free to the world to help others improve their lives. Learning Clojure has personally made me a much better programmer, and I think others can benefit from it just as much. In learning Clojure, you learn a new way of thinking about programming. It's intellectually rewarding and it has immense practical value; it makes your life as a programmer a lot easier. Plus, there's something romantic about learning a language that carries on a 60-year legacy. Like you're engaging in a tradition that extends far beyond you. And it's fun! Clojure feels like something you'd want to use in your spare time, for fun, but what's better is that you can actually get paid to use it. The other main reason I wrote the book was that I needed some way to tell the world about the were-Simmons. The danger is real! Wake up, sheeple! were-Simmons

Brave and New

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

Clojure for the Brave and True is now available in print! You can use the coupon code ZOMBIEHUGS to get 30% off at No Starch (plus you'll get a free sticker), or buy it from Amazon. The web site has been updated, too! (Don't forget to force refresh.) One of the reasons I went with No Starch as a publisher was that they supported the idea of keeping the entire book available for free online. It makes me super happy to release the professionally-edited, even better book for free. I hope it makes you laugh, cry, and give up on object-oriented programming forever. Writing this book was one of the most ambitious projects of my life, and I appreciate all the support I've gotten from friends, family, and readers like you. Thank you from the bottom of my crusty heart! Is that it, then? Is the journey over? No! It's not! In fact, back in April I quit my job in part so that I'd have more time for writing. I have some new Clojure articles on reducers and transducers in the works, plus I plan to write about web development again and dive into fun libraries like core.logic, clara, and much more. There's just so much cool stuff to learn about! If you'd like me to let you know when they're published then follow me on twitter @nonrecursive or join the 1600+ member mailing list: Lastly, to celebrate the book release, my wife (the book's illustrator) put together a t-shirt and mug store! The gear features the dwarf and warpig combo on the book cover :) This run only lasts one week - future runs will feature other illustrations from the book or from new projects. The money from that will help me continue avoiding full-time employment so that I can keep creating fun, high-quality Clojure content! Thank you, and have fun Clojuring! Brave and True [Update] I got asked for a list of the major differences. Here they are: Illustrations! Almost every chapter now has exercises The first macro chapter, Read and Eval, is massively improved. I'm hoping this will gives readers an excellent conceptual foundation for working with macros There's now a joke about melting faces There used to be two Emacs chapters (basic emacs and using Emacs for Clojure dev), now there's just one The concurrency chapter got split into two chapters Appendices on Leiningen and Boot were added The "Do Things" chapter is much friendlier I spend a lot more time explaining some of the more obscure topics, like lazy sequences. Many of the chapters got massive overhauls. The functional programming chapter, for example, was turned completely inside out, and the result is that it's much, much clearer Overall, everything should be clearer

Review of Clojure Applied

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

A while back, Clojure community czar and all around good guy Alex Miller asked me to review a beta version of his nearly complete book Clojure Applied, co-authored with Ben Vandgrift. This was great news for me because I was planning on buying it, but this way I would get it for free. Delighted, I downloaded my free copy, added a "review book" item to my todo list, then merrily ignored it until a couple weeks ago when I saw Alex in person. "Sorry I haven't gotten around to reviewing your book. I'm super excited about it!" I gushed at him guiltily. "What's the final release date?" Very politely, he responded, "It's already released." It turns out, the resulting dose of healthy embarrassment was all I needed to actually get off my ass and read and review the book! And I am glad I did, because it's a good one. Clojure Applied is aimed at people who know Clojure basics and want to learn how to write idiomatic code and create production applications, and if this describes you, then you should get it. In case you need more convincing, the rest of this post goes on about how good the book is. What I like most about Clojure Applied is that it's concise and fast-paced. It doesn't hold your hand, blathering on about basic details that you learned months ago. At the same time, it's very approachable, using straightforward and brisk language. It even has a few fun moments (two words: spaghetti tacos). To use a cliche that offends my vegetarian sensibilities, it's all meat and no filler, which is perfect for programmers who are... uh... hungry for knowledge. The most valuable parts of the book are the sections on building a system and testing. Decomposing a your program into a system of interacting components that manage their own state isn't a topic covered by beginner books, and it's very helpful. It's easy to write programs whose architectures go against Clojure's grain of functional programming, immutability, and state management, but Clojure Applied shows you how to do it right. On the testing front, Clojure Applied is nice because it covers some of the latest additions to the testing ecosystem, like test.check. Another nice aspect of the book is that it introduces you to a cornucopia of useful standard library and Java functions and constructs, like the juxt function, the reduced function, persistent queues, thread pools with the executor service, etc etc etc. All in all, it's a good book. If you're looking for a good second book on Clojure, then Clojure Applied is an excellent choice!

What Do Perl and Go Have in Common?

over 1 year ago | Pat Shaughnessy: Pat Shaughnessy

TL/DR: Both Perl and Go only partially implement object oriented programming, in a confusing way. Using either language you can create structures equivalent to objects but without using keywords such as class or new. Converting a Go function into a method by adding a receiver reminds me of “blessing” a Perl has

Gaussian Cookies

over 1 year ago | Sidhant Godiwala: Sidhant Godiwala's Blog

You’ll probably get more out of this post if you read this one first Continuing from where I left off, I now want to use a normal distribution (i.e. gaussian) to calculate my cookie box distributions. Unlike the poisson distribution I used earlier, with just the mean as a parameter, the normal distribution is described by both a mean and a standard deviation. Chocolate Chip Likelihood The probability that a box was generated by a normal distribution with mean ($\mu$) and standard deviation ($\sigma$) is given by $$ \prod_{i=1}^{10} \textrm{normal}(\mu, \sigma)\textrm{.pdf}(\textrm{cookie_box}(i))$$ where pdf is the probability density function and cookie_box(i) is the number of chocolate chips on cookie i. 1 2 3 4 5 6 7 # Likelihood for the heavenly_bites box at mu = 8 and mu = 16 with sigma = 1 np.product(stats.norm(8, 1).pdf(heavenly_bites)) # => 5.35e-26 np.product(stats.norm(16, 1).pdf(heavenly_bites)) # => 1.29e-213 Since my parameter space is 2 dimensional ($\mu$, $\sigma$), I get to use these neat (but not as clear) 3D graphs to show the likelihood plots for the different cookie boxes. Cookie Posteriors Each step in this process is almost exactly the same as in the 1 parameter poisson case, except now with an additional dimension. The cookie prior is now the plane, pdf($\mu$, $\sigma$) = 1. Calculating the posterior is way more computationally expensive in this case. To get the same point density as the poisson model, I’d need to update the prior at $ 20,000 \times 20,000 $, i.e. $400,000,000$ points. What’s worse, most of those posterior values in this space are ~0. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Thanks to numpy arrays, this part of the code doesn't change at all. # heavenly_bites_likelihood and cookie_prior are both numpy arrays with dimensions (20000, 10000). # They contain y values for each function, for mu from [0, 20] and sigma [0, 10] # in increments of 0.001 # The unnormalized posterior, the numerator in Bayes' Rule heavenly_bites_un_posterior = np.multiply(heavenly_bites_likelihood, cookie_prior) # Approximating the integral in the denominator normalising_factor = np.sum(heavenly_bites_un_posterior) # Applying Bayes' Rule heavenly_bites_posterior = np.divide(heavenly_bites_un_posterior, normalising_factor) Calculating the credible interval is a little trickier here but the core idea is the same (gist) Cookie Box (0.95) $\mu$ $\sigma$ Heavenly Bites (3.72, 9.56) (1.72, 6.06) Hobbes’ Nobbs (9.95, 17.19) (2.12, 7.38) Kant Touch This (10.85, 18.69) (2.42, 8.18) Results A poisson distribution with mean $\lambda$ can be approximated by a normal distribution with mean and variance both $\lambda$, its not a great approximation at $\lambda < 1000$ but it does help me test my results. Cookie Box (0.95) actual $\lambda$ expected $\mu$ expected $\sigma$ Heavenly Bites 8 8 2.83 Hobbes’ Nobbs 12 12 3.46 Kant Touch This 16 16 4.00 Excellent! The actual values are within the predicted ranges, the model works. Issues The main problem is the cost to calculate, every additional dimension or an increase in the range can make the model prohibitively expensive. Fortunately for us, Monte Carlo methods like the Metropolis algorithm generate useful results far more efficiently. More about these in a later post. In the meantime, take a look at Chris’ post on the subject

Getting Started with React & ES6

over 1 year ago | Dave Kerr: dwmkerr.com

Feeling like having a go with Facebook's hugely popular React framework but not sure where to start? In this post I'm going to build a simple React application from scratch - using ECMAScript 6. We'll put together the bare minimum skeleton of a site and keep the folder structure free

Docker + Capistrano = Warp Speed

over 1 year ago | Rocky Jaiswal: Still Learning

Needless to say that Docker is pretty awesome. This blog itself is now powered by Docker + Capistrano and I can deploy a new post simply by doing bundle exec cap deploy. What's more with Docker, I can move to any hosting provider and setup everything in 10 minutes. Also, gone are ...

Clojure for the Brave and True Is Off to the Printers!

over 1 year ago | Daniel Higginbotham: Flying Machine Studios

Today, my fantastic production editor at No Starch reached out and pressed the basketball-sized "RELEASE IT!" button at No Starch headquarters, encasing Clojure for the Brave and True cucumber-infused amber and sending it on its way to the bookeries of Melrose Park, Illinois. At least, I'm pretty sure that's what happend. Either way, the book is off to the printers! It's done! After two years of working on it, it's actually done! Aaaaaah! It'll be available at the beginning of September, and you can preorder it from No Starch (free ebook included with print book) or Amazon. (Leanpubbers, you'll be getting the fully-updated ebook by the time the book is published.) The main work (writing a book) is done, but there's actually still more stuff to do. I need to finish rebuilding the website to include all the updated content and to make it easier to add more content. What?!, you ask, more content?! Yes indeedy! The book may be finished, but there's still so much more to write about! Expect a Sidequests series by the end of the year. Thanks for all the pull requests, emails, comments, and other feedback. And I don't want to spoil the Acknowledgements section, but I want to give my Special Thanks to Jess Higginbotham, Alan Dipert, Bridget Hillyer, Joe Jackson, Pat Shaughnessy, Alex Rothenberg, Thomas Newton, Jalil Fanaian, Chris Parker, Christian Lilley, and Mark Daggett. I hope you're having a great day. I am! Now if you'll excuse me, I'm going to go rediscover what it feels like to have free time. Sock Gnome

Sitecore - Moving items from web to master

over 1 year ago | Sumit Bajaj: Sumit Bajaj's Blogs

In most of the cases, generally you create items in master database and publish to web/production data. However, sometimes few items are in web database and not in master. Reason can be anything, like you might have deleted it in master but did not publish the parent item or due to some other reason.If you are thinking, you will create package from web and deploy it in master, that will not work. :-) When you create package from master, it installs the items in master only and same is the case with web.Right and easy way to do is Transfer the item. Yes, you read it right. There is a provision in Sitecore to transfer the items from one database to another.Select the item which you want to transfer from one database to another. Right click on it and then select Copying. Click on Transfer. see screenshotOnce you click on Transfer, it opens up a popup box. Click 'Next'. see screenshotAfter clicking on next, you have to choose the database where you would like to transfer the item. In this case,master database is selected. see screenshotSelect the folder where you want to transfer the item on master database(in this case). Click 'Next' and it will transfer the item to master database.If you like the blog, kindly put your comments. You can write email to support@bajajsumit.com for any Sitecore or .Net related help.