Meteor is a platform for building real-time web apps that sits between your appâÃÂÃÂs database and its user interface and makes sure both are kept in-sync. It is built on Node.js, so it uses javascript on both the client and the server.
To then run that new app at http://localhost:3000/:
$ cd[project directory] $ meteor
To stop the app from running, press ctrl+c
Adding a package like Twitter Bootstrap to a Meteor app is incredibly simple. No files to link up, Meteor takes care of all of that out of the box:
$ meteor add twbs:bootstrap
Structure
Meteor has five types of packages. most can be seen in [project directory]/.meteor/packages:
meteor-base is MeteorâÃÂÃÂs set of core components.
First-party packages that come bundled with Meteor that can be removed, such as mongo (the database) and session (a client-side reactive dictionary).
Local packages specific to your app, which are stored in /packages
Third-party packages available at MeteorâÃÂÃÂs online package repo, AtmosphereArchived Link. These are named in the author:package convention.
NPM packages in Node.js. They arenâÃÂÃÂt listed with other Meteor packages, but can be imported and used by other Meteor packages.
Meteor has some special directories:
/.meteor/ is where Meteor stoes its own code. DonâÃÂÃÂt modify it.
Code in /server only runs on the server
Code in /client only runs on the client
Everything else runs in both places
Static assets should be stored in /public (The exception is CSS. Meteor automatically loads and minifies CSS, so it should be stored in /client)
Meteor loads files in a specific order:
Before anything: Files in /lib
After everything else: Any files named main.*
Everything else is loaded in alphabetical order by file name.
Deployment
To quickly set up a staging server, you can create a Meteor account and deploy to a Meteor subdomain for free:
$ meteor deploy yourappname.meteor.com
For deploying to your own server, check out Meteor Up, a command line utility that automates setup and deployment for you.
404 Error Pages
Making a 404 error page isnâÃÂÃÂt enough, you have to tell Apache where to find it. IâÃÂÃÂm used to working on WordPress, which takes care of that automatically. Turns out IâÃÂÃÂve been running this site for a few months without my 404 page working. Whoops!
To do so, add ErrorDocument 404 /404.html to your .htaccess file. Replace /404.html with the path to your 404 page.
Secure Hash Algorithms
What are they and what is the difference between SHA1 and SHA2?
SHA stands for Secure Hash Algorithm. The short story about how is works is that a mathematical operation is run on a given input and a unique output, or hash, is generated. By comparing the output to an expected output, you can verify the dataâÃÂÃÂs integrity. The theory is that no two different input values should result in the same hash output (called a collision).
SHA1 algorithms produce a 160-bit hash value, while SHA2 algorithms can produce 224, 256, 384 or 512 bit hash values depending on the function used.
The very short explanation is that SHA2 hashes larger and are theoretically much less likely to have a collision than SHA1 hashes due to the underlying algorithmic changes.
What is it used for?
Generally, SHA is used for verification. If the hash you calculate matches the expected result, your data has most likely not been tampered with or corrupted.
Git uses SHA1 to verify data has not changed due to accidental corruption.
SHA is used to sign SSL certificates.
Bitcoin uses SHA2 to verify transactions
SHA2 is used in the DKIM message signing standard (i.e. what checks to make sure someone isnâÃÂÃÂt spoofing your email account)
Some software vendors are adopting SHA2 for password hashing.
Why should I care?
SHA1 is on its way out. Chrome is showing errors on sites with SHA1 SSL certificates that expire past Jan 1, 2016. All major browsers will stop accepting SHA1 SSL certificates by 2017.
Every site using SSL signed with SHA1 needs to update their certificates.
I might start using this for my code snippets in the future. Right now I have some CSS styles that conflict with it, so I need to sort those out first.
VPN Connection issues
I had VPN connection issues today. The solution was to stop using the IPSec client and start using the AnyConnect client.
Iâve been having a lot of discussions about privacy and data collection recently, both at work and with friends. This episode of Whatâs the Point on privacy with Kashmir Hill cleared up some common misconceptions. The main points:
If a companyâs fundamental business model is collecting data and figuring out things about you (i.e. Google and Facebook), they arenât selling your data, but rather selling access to your attention to advertisers. They donât want to give up your data to other people because it is such a valuable resource to them.
Some companies who sell you physical products have a side-business selling data on what you bought and when to others.
Privacy has become a genuine concern for companies recently, as evidenced by the rise in end-to-end encryption in consumer products like iMessage. This is worrying to some government agencies.
If you read privacy policies, they actually tell you all the ways a company is going to violate your privacy. As long as a company doesnât do anything they didnât say they were going to do, they are protected.
When writing these TIL posts, I want to eliminate as much resistance as possible so I can get straight to writing. The more steps I have to take, the less likely I am to follow through. So I took some time today to automate the one of the tedious parts: Setting up the markdown file I write these posts in with most of the specs already filled out.
I created 3 TextExpander snippets to help with this process:
One with today’s date string and extension separated by dashes for the file name: %Y-%m-%d-.md (I tried a fill-in for the title, but the filename doesn’t stay selected in Coda when another window launches)
One with Javascript randomly picking one of the 7 default header images I use (this is used in the next snippet):
Besides for the normal scope, budget, platform, dependencies, timeline, and underlying technologies, here are a few things you need to consider when architecting and planning out a software development project:
After delivery, what resources will we have available to maintain the system and handle emergencies?
What impact will maintenance and support have on our ability to sell and develop new projects in the future?
What is the opportunity cost of using one developer over another?
Use the jQuery parents() selector to return the appropriate parent element, then use the css() method to set the style you want. For example, ("a i").parents("li").css({"margin-right": "5px"}); finds list items who are the ancestors of icons wrapped in links and makes their right margin 5px.
Change the structure of your code and add specific classes that you can apply your desired styles to. For example, instead of applying a right margin to all list items and then a different right margin (via parent selector) for all list items that contain icons, make two classes with the proper margins and apply one to the plain list items and the other to list items that contain icons.
I opted for #2. It makes your CSS cleaner, keeps you from having to load new dependencies like jQuery, and keeps the styles in one place so you don’t have to search 6 months from now for where that extra margin is coming from. I’d only use the first option in cases where you have complex rules that can’t be accomplished by restructuring your code and/or adding classes to make your desired change possible.
Project-wide Find and Replace in Coda
I do the vast majority of my code-writing in Coda. I used to have to open up TextWrangler to do find and replace across multiple files, but apparently Panic added this feature into Coda sometime between v1 and v2.5. I got used to having to switch and didn’t look for it again until today.
It is buried in the sidebar under “Find In” instead of in the regular find and replace bar, so I never saw it. You can search across open files, the entire site, or in a specific directory on your local machine.