Sunday, April 28, 2019

Just Got Back From Minnebar14

My wife and I just returned from the latest MinneBar tech conference; https://minnestar.org/minnebar/.  I regret not knowing about these local conferences, learned of them only 4 years ago.  Since attending our first, we anticipate and eagerly await the announcement of tickets with the same enthusiasm as a pre-teen looking forward to their current boy band obsession.

They're tagline is 'For Tech. By Tech' organized in the form of typical an 'unconference', informally formatted sessions, a good number of first-timer presenters; nerds presenting nerdy topics to nerds.  In past years, the majority of the sessions were tech-rich offering a variety of interesting topics.  The challenge was always down-selecting from a number of sessions down to just one.  The presenters and audience are tolerant of migrating from one topic to another, encouraging attending a session to give it a chance and leave for another if it wasn't your cup of tea.  Everyone talking passionately about technologies and a fluid audience base flowing in/out with the goal of absorbing as much they can in the time left in the hourglass.

The sessions were primarily about tech, with a smaller fraction focused on the business side with an emphasis on start-ups.  Today, I learned that this start-up/tech pairing was baked into the DNA of Minnebar.

This year, the sessions flipped the script; the large majority of the sessions were about the business side with the minority of the sessions associated with tech.  This was the first year, after returning, that we mutually felt regret in attending.  Before I continue on; this is a zero-cost technical conference, thousands in attendance all organized and executed by an army of volunteers.  One can quickly make a case; 'you have no right to complain' and to that I would absolutely agree.  I suspect however that we aren't alone in our disappointment in this year and MinneBar openly requests feedback.  Additionally, under no illusion was attending a complete waste of time, attending any discussion with an open mind you leave with something.  It's more a matter of; knowing what I know now about this particular Minnebar....would I go again.  To that, I'd unfortunately say no, but I still look forward to next year's conference in hope that it returns to it's origins in tech.  *fingers crossed*  I also am not placing blame on Minnestar, the organizing committee.  I know essentially nothing about how the content of the conference is selected, perhaps the non-tech emphasis is due to lack of tech-rich presenters.  If however the emphasis on non-tech was intentional, perhaps some of my observations could be taken into consideration.

Founders / Technologists -- A Logical Match

From the beginning, the focus of MinneBar was aimed at bringing together start-up folks and technologists, so it's understandable and desired to have non-technical folks attend as well as present so please don't interpret any of my comments as a desire for tech-only content and attendance.  Small businesses don't have deep pockets like larger corporations to locate joint-minded tech heads.  This symbiotic relationship is one of the things that sets MinneBar apart from other conferences.  Finding the right mix of attendees is a complicated problem and I wish MinneStar my best in doing so.  Over-emphasis on one group will drive away the other.  Founders want to meet technologists, technologists wish to meet founders.  I suspect an undesirable affect would be exclusive attendance of techies or founders.  Personally, I fear we are at the cusp of that potential path.
Techies are drawn to tech, and our primary motivation to attend this conference.  We have an opportunity of sampling 8 glorious hours of interesting topics as well as future opportunities to present sessions ourselves.  Personally, we aren't currently seeking out job opportunities or a co-founder, so sessions focused on networking and soft-topics (while appealing to others) aren't worth trading a gorgeous spring day for.  I may not be their intended demographic though.

Minnebar Mission

MinneStar has an executive board so I'm confident that they have a well thought out mission.  It could very well be that the tech-heavy conferences of the past go against their mission.  This year they had a record-breaking attendance so they may very-well be directly on path.  World-wide, the gig economy and entrepreneurial paths are trending so non-tech sessions may very well be the right path for them.
Selfishly, these topics are of less interest to me and I suspect other tech heads.  Contrasting MinneBar with a singles bar, you're trying to bringing pairings together.  If the bar drives away the ladies you're left with a building full of guys.  Likewise, if the bar emphasizes attendance from guys, you drive out the ladies.  Personally, I feel the non-tech emphasis this year will drive away technologists; especially if they feel similarly to us this year.
Equally, the mission of MinneBar may very well be a more diversified attendance.  If so, bulls-eye; there was a more diverse group in terms of occupations, genders, interests and cultural diversity than I've ever witnessed before.  Refreshing for such a conference and perhaps a direct artifact of the non-tech emphasis.

Comments/Suggestions

The mere thought of standing in front of a room of dozens of people I don't know is the formal definition of Hell to me.  Again, having no knowledge of how sessions are selected it could very well be that the platoon of brave souls has simply dried up.  However, if tech-intensive sessions were turned away for a non-tech place at the table I would respectively ask you to 'knock that shit off!'  With decades of feeling out-of-place and hiding our geekhood, these conferences are an opportunity to meet others with similar interests and 'get your geek on'.  This conference is precisely what I thought a good place for doing just that.

Do you know the difference between an introverted nerd and an extroverted nerd? An introverted nerd looks at his/her feet when you talk to them. An extroverted nerd looks at your feet.  Presenters, stop enticing people to mingle as part of your sessions *grown*.  This is an automatic walkout trigger for me, not because I'm afraid to talk to others but rather I don't seek it out without some mutual goal or interest.  Perhaps this makes me an asshole, but given the general responses to these requests I'm far from alone.  I'll gladly talk with a stranger given an opportunity and a common interest; I suspect this to be true for many of my fellow introverts.

Personally, I particularly like first-time presenters, I feel they are particularly brave and enjoy a presentations with some warts over one that's been polished to a mirror finish.

I equally enjoy deep-dive technical topics as well as broad-stroke 'Intro to XYZ' newbie-focused topics.  One hour presentations are only going to go so deep without making presumptions about your audience.  I genuinely miss university colloquiums and the past format of this conference took a similar form.

Minnebar discourages sales presentations and I've never attended any session that violated that principle directly.  In reality, presenters all have motives and a soft-shoe nudge/nudge, wink/wink reference isn't uncommon.  As you move away from true technical presenters I suspect this principle will become harder to enforce.  All but unicorn sales reps are capable of discussing tech in detail, move away from tech flings this door wide open.  Polished presenters will take the stage over flinching introverts.

While I'm an avid drinker, well-acquainted with all the key beer and liquor food groups, I've yet to attend the organized happy hour.  I may very well be missing out on something extraordinary.  As much as I enjoy free drinks and enjoy company during so....introducing myself to strangers without a common interest just isn't something I do.  I trade free drinks with strangers for a bar tab with friends. Perhaps one day I'll attend with colleagues/friends, but honestly....the line length is an equally effective deterant.

This conference encourages stepping in/out of sessions to sample the topic.  If you can do so without disrupting the session I highly encourage you to do so.  In past conferences I migrated in/out of sessions because there were so many interesting topics to choose from.  Get a taste, not to you liking, move to any 6 other tasty topics.  This year, it was difficult to find one highly interesting topic let alone multiples.

Roll The Credits

The annual Minnebar conference has always been one of my favorites and I hope it once again claims that title.  Their demographic and intended audience may honestly not be aimed to those like me and the past years topics may simply have been a good bt of luck on my part.  The complexity of wrestling presenters, topics, volunteers and logistics of such an event is mind-blowing and those that run this ship deserve the highest of praise.

Thank you to the presenters as well as the battalion of volunteers planning and executing the conference.

Monday, April 22, 2019

FFMpeg Blending










FFMpeg can blend two input files which allows for a gradual transition from one to the other.  This post will demonstrate how this can be done with two image files or video files.  Let's get started.

Blending Images

Let's snag a couple images to show how blending can be used in transitioning from one to the other.  More specifically, we're grabbing one image and cropping them to form two images.


$ wget https://upload.wikimedia.org/wikipedia/commons/thumb/1/1b/Bush-Arnie-morph.jpg/300px-Bush-Arnie-morph.jpg -O src.jpg
$ convert -crop 100x300+0+0 src.jpg s1.jpg
$ convert -crop 100x300+200+0 src.jpg s2.jpg




Next, let's generate a 5 second video using the two source images.  Notice the A/B coefficients are relative to time finally capping at 1 when there remains 1 second of video left.  The blending coefficients define how much of one or the other video frame is blended.



$ ffmpeg -loop 1 -i s1.jpg -loop 1 -i s2.jpg -filter_complex "[1:v][0:v]blend=all_expr='A*(if(gte(T,$((5-1))),1,T/$((5-1))))+B*(1-(if(gte(T,$((5-1))),1,T/$((5-1)))))'" -t 5 foo.mp4



The result;

Blending Videos

We can provide a similar effect on videos.  Let's grab a source video and split it into two videos that we'll blend between.


$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o src.mp4 https://www.youtube.com/watch?v=-sUXMzkh-jI
$ ffmpeg -i src.mp4 -ss 10 -t 5 -an vid1.mp4
$ ffmpeg -i src.mp4 -ss 60 -t 5 -an vid2.mp4



Let's blend the videos in the same manner as our images;


$ ffmpeg -i vid1.mp4 -i vid2.mp4 -filter_complex "[1:v][0:v]blend=all_expr='A*(if(gte(T,$((5-1))),1,T/$((5-1))))+B*(1-(if(gte(T,$((5-1))),1,T/$((5-1)))))'" foo00.mp4





There you are, the most fun you can have while blending short of making margaritas.

Cheers.

Sunday, April 14, 2019

Remodeling Software Engineering Practices


I overheard a clever engineering nugget at work today.  I'd attribute authorship to the speaker but I'm unsure he would care about this wee little blog or want his name associated with the quip.  I'll refer to the author as DP.

I'll be phrasing it as I heard it, paraphrasing given my limited short-term memory.

"I remodeled my kitchen some time ago.  The designer was armed with a extensive list of questions.  After answering what seemed an endless number of questions,  I noticed the designer hadn't asked where I wanted the dishwasher located, to which she responded 'the dishwasher always goes to the right of the sink'."  DP, a diligent engineer, extracted a design philosophy from this simple event.  When best practice principles are known it's best to not ask the customer less they answer wrong.

Finding the right balance is always a challenge, it's easily to over-correct.  While the customer has expertise in the problem domain, you have expertise in much of the solution domain.  It's your responsibility to bring your expertise in as applicable, that's specifically why they brought you in.  For example, best-practices in UX design is likely outside your customer's expertise and rather than asking specific layout input from your customer it's better practice to base a layout on best practices and acquire feedback.  Both you and your customers bring the right stuff to the table is a recipe for a successful meal.

Good dining.

Monday, April 8, 2019

Ffmpeg Reverse Video - If I Could Turn Back Time


Staying on the time/ffmpeg topic, this blog will demonstrate how to reverse a video, essentially stepping backwards in time.

Since FFMpeg functionality is fluid with new features, and sometimes command-line arguments, changing along the way I've primarily stuck with a known version in my posts; namely FFMpeg v2.7.2.  This is relevant because in this particular post there are two ways to reverse a video; 1) deconstruction frame-by-frame followed by reassembly, 2) a video filter available in newer versions of Ffmpeg.

Source Video

Let's start by grabbing an interesting video to work from.  Calvin and Hobbes certainly will fit the bill.


$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' -o input.mp4 https://www.youtube.com/watch?v=KckYcuiKAN8



Snag a Clip

Let's snag the clip when Hobbes tackles Calvin, a solid segment that could benefit from a reversal.


$ ffmpeg -ss 20.0 -i input.mp4 -t 4 -strict -2 clip.mp4



Reverse the Clip

For newer versions of FFMpeg, this is simply a matter of applying the 'reverse' video filter, like so:


$ ffmpeg -i clip.mp4 -vf reverse reverse.mp4



Alas, with older versions of FFMpeg this can be also done, just a little more heavy lifting involved.  In general, we'll deconstruct the video into a series of frames, then re-encode by supplying the frames in reverse order.



$ ffmpeg -i clip.mp4 frame%06d.png

$ ls -t *.png | awk '{print "file \x27" $$1 "\x27"}' > fileList.txt

$ ffmpeg -f concat -r 30 -i fileList.txt reversed.mp4



Resulting in our reversed clip;

Gotta love that tiger!!

Monday, April 1, 2019

Linux Find -- Your Tool To Searching For Dinosaur Bones


Imagine that you have a Swiss Army knife, but you only use the file on it.  Punch a hole in a leather belt, smooth out a broken nail, opening a can of beans, or filleting a trout….chances are you can get the job done with it, but you’re certainly making your job harder than it needs to be.

That’s a pretty fair analogy to how I’ve used the ‘find’ command for the majority of my life.  ‘Shoulder surfing’ of colleagues and I feel that’s the norm.  I’ve only recently (say over the past couple years) began using some of the other find ‘blades’ which can really make your job easier.

Searching for files satisfying a file (or directory) name and finding files of a particular type (e.g. file, directory) are certainly the most common uses for using find.

$ find . –name “*.cpp”
$ find . –iname “*main*.cpp”
$ find . –type f

Often, you want to act on the file list, like grepping for a specific string in each of the files.  For yeeeeeeeeeears I did that by passing the results of the find command to a new command line.  For example, if I was interested in locating the main function declarations in any C++ files found from the current directory I’d do it by either:


$ grep –l “main“ `find . –name “*.cpp”`
$ grep –l “main” $(find . –name “*.cpp”)

*shrug*; so….what’s wrong with that?  Whelp…a couple things: 1) its more complex than it needs to be and 2) it’s not uncommon for the results of find to exceed the command line length limits.  So, why in the world did I do that for literally DECADES?  Simple…I didn’t know any better and frankly the ‘-exec’ option confused my little ‘ol knowledge nugget. 
Understanding the ‘-exec’ subcommand will pay dividends almost immediately, once you get over the confusing syntax.  The subcommand takes the form ‘-exec somecommand {} \;’, the results of the find command will be substituted for the brackets.  The following ‘\;’ indicates the end of the command chain….just get in the habit of slapping it on the end for now.
So, the equivalent of the previous commands would take the form:


$ find . –name “*.cpp” –exec grep –l “main” {} \;

Suppose you have 2 files that satisfy this find: file1.cpp & file2.cpp, notionally this would result in the equivalent of ‘grep –l “main” file1.cpp file2.cpp’.
Well, that doesn’t seem much simpler….why bother?  Let’s say you’re interested in searching for header and implementation files (e.g. *.h & *.cpp).  You could certainly accomplish this without the exec subcommand:


$ grep –l “main“ `find . –name “*.cpp”` `find . –name “*.h”`
$ grep –l “main” $(find . –name “*.cpp”) $(find . –name “*.h”)

The equivalent using the exec subcommand would be:


$ find . \( -name "*.cpp" -o -name "*.h" \) -exec grep -l "main" {} \;

The first half specifies a search criteria of all files satisfying “*.h” OR “*.cpp”.

Last bit, consider how you’d find all files that reference ‘main’ but aren’t headers or implementation files?  Extremely simple change for the exec subcommand example, consider the complexity of not using exec.



$ find . –not \( -name "*.cpp" -o -name "*.h" \) -exec grep -l "main" {} \;

If you haven’t already done so, start using the special blades of your find command.