Example - How to print the formatted time in Python
Here’s an example of how to print the formatted time in Python:
import time print time.strftime("%a, %b %d %I:%M %p")
That code results in the following output:
Thu, May 29 11:26 AM
Here’s an example of how to print the formatted time in Python:
import time print time.strftime("%a, %b %d %I:%M %p")
That code results in the following output:
Thu, May 29 11:26 AM
SQL FAQ: How can I select every row from a database table where a column value is not unique?
I’m working on an problem today where a Drupal article can have many revisions, and the way Drupal works is that a table named node_revisions
has a nid
field for “node id,” and a vid
field for “revision id.” If you have five revisions of an article (i.e., a blog post), there will be five records in this table, and each record will have the same nid
value and a unique vid
. If an article has no revisions, this table will have one entry with a unique nid
and unique vid
.
I’m currently working on a trilogy of “books” (booklets) about software cost estimating, and the third book in the series is about estimating the time and cost of software development projects in an agile development environment. The book isn’t complete yet, and some of it may not make sense without the first two books in the series, but I thought I’d release it here today, as almost everyone has some sort of “agile” development environment going today (or at least I hope so).
I just found these “Numbers every programmer should know” in an email I sent to myself a few years ago. I don’t remember the original source of the content, but I know they come from a talk titled “Building Software Systems at Google and Lessons Learned”, by a person named Jeffrey Dean, at Stanford:
L1 cache reference 0.5 ns Branch mispredict 5 ns L2 cache reference 7 ns Mutex lock/unlock 25 ns Main memory reference 100 ns Compress 1K bytes w/ cheap algorithm 3,000 ns Send 2K bytes over 1 Gbps network 20,000 ns Read 1 MB sequentially from memory 250,000 ns Round trip within same datacenter 500,000 ns Disk seek 10,000,000 ns Read 1 MB sequentially from disk 20,000,000 ns Send packet CA->Netherlands->CA 150,000,000 ns
I recently wrote my own URL-redirection service at kbhr.co, and a quick surprise when using my own service is how many “Twitter Bots” are out there. When I used goo.gl for my URL-redirects, it didn’t show data for any of these, but once I made my first post using kbhr.co, I found that at least 80% of the click-thrus were from bots, and many of them happen immediately.
I use MongoDB for my kbhr.co database, and this is a little peek at the “user-agent” field from the headers of the bots that followed one link I posted:
MongoDB FAQ: How do I create a MongoDB database?
To create a MongoDB database, follow these steps:
I’ve said it before, so I’ll only say it again briefly: I don’t like the Sencha Touch 2 documentation, I think it could be much more organized, deeper, and with better examples. So, in short, here are some links to the best Sencha Touch 2 documentation I can find.
Sencha Touch Guides (lists UI components):
There are probably simpler ways to do this, but for the moment, here’s a Sencha Touch 2 panel with a static list of data:
I truly believe (or at least hope) that 2013 will be seen as the year that software companies forgot about quality. Here are just a few examples I noticed last night and this morning:
Twitter: Today I was notified that people “favorited” some of my posts. Cool. Oh, wait, they were favorited eight days ago, but just showed up today.
As more of a “note to self” than an exact solution, here’s what I think I did to get the Sencha Touch iOS 7 theme (“Cupertino”) working in my Sencha Touch 2.3 mobile app.
First, I added the Cupertino stylesheet, font, and image stuff to my project’s resources directory:
./resources/themes/images/cupertino ./resources/themes/stylesheets/sencha-touch/cupertino
Next, I added this line to my index.html file:
I just went through my notes on the book, Clean Code, and thought I'd share what I thought were some of the best quotes and “lessons learned” from reading that book.
While I was researching the Erlang "error kernel pattern" yesterday, I ran across this great link of Software Engineering Principles. It's a great "all in one page" collection titled "Programming Rules and Conventions".
As a quick example of what you'll find on that page, here is a list of the software engineering principles from the third chapter of that document:
I tend to forget that I've written a lot of articles and tutorials that are out of the content management system that I now use to run devdaily.com, and last night I stumbled across an article I wrote on software cost estimating that I happen to think is pretty good. So, to make that article easier to find, here's a link to my software cost estimating tutorial.
(As you'll see from the look and feel of those web pages, those pages are formatted very differently, but you'll still be on the devdaily.com website.)
I just found this great little “Code Bloat” script on Ward Cunningham's Smallest Federated Wiki website:
wc -l `find . | perl -ne 'next if /jquery/; print if /\.(rb|haml|coffee)$/'`
If you’re familiar with those Linux commands (wc
, find
) and Perl, you can tell that the intent of the command is to find the number of lines of source code per file, for all files beneath the current subdirectory.
I've been looking at Google's Go programming language on and off for the last week or so, and though I won't be using it any time soon, it looks like an interesting new language.
In a world full of programming languages, you might wonder why Google programmers have decided to create yet another programming language. The Go programming language authors answer this question in their FAQ:
This web page is the resumé for Alvin Alexander, the creator of this website. Mr. Alexander occasionally provides software consulting services to select clients, including business analyst and computer programming services. He currently resides in Wasilla, Alaska (and is preparing to move to Palmer, as of August, 2010). Both cities are just north of Anchorage, Alaska.
jQuery insert text FAQ: How do I insert text into a section of my HTML page using jQuery?
I ran into a situation recently with my new website (see my new Alaska online store demo) where I couldn't figure out how to do something with a shopping cart tool named Ubercart, so rather than fight it any longer, I decided to just use jQuery to insert text into my HTML document right where I wanted it.
“Bad programmers worry about the code. Good programmers worry about data structures and their relationships.” ~ Linus Torvalds
More from this link: “git actually has a simple design, with stable and reasonably well-documented data structures. In fact, I'm a huge proponent of designing your code around the data, rather than the other way around, and I think it's one of the reasons git has been fairly successful […] I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important.”
“The computer industry is the only industry that is more fashion-driven than women’s fashion.” ~ Richard Stallman
A few quotes about the Lisp programming language, from Paul Graham's website:
“Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot.” ~ Eric Raymond
“We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.” ~ Guy Steele, Java spec co-author
“Lisp ... made me aware that software could be close to executable mathematics.” ~ L. Peter Deutsch
“The greatest single programming language ever designed.” ~ Alan Kay
“I suppose I should learn Lisp, but it seems so foreign.” ~ Paul Graham, 1983 (the joke being that he learned it and made a bunch of money using it)