Twitter Feed

Social

Splitting an audio file into multiple smaller pieces

Uncategorized

I was having trouble figuring out how to split up a large audio file into smaller pieces via the command line. I finally found this post and found that I can use the following command:

ffmpeg -i filename.mp4 -f segment -segment_time 1800 -vn -c:a libmp3lame -b:a 128k -ac 2 -ar 44100 filename_03d.mp3

To make sure this works, you’ll need to install ffmpeg first if you don’t have it already:

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
Modern React with Redux, Stephen Grider Udemy course

4 Key Concepts to Understand in React-Redux

High Level Thoughts

When building React-redux applications, there are 4 key concepts to understand. If you have a high level understanding of these 4 concepts, you’ll have a much easier time building your application.

Container Components

Container components are React components that are hooked in to your global Redux application state. They will behave differently and render different content depending on the state of the application. Redux has a connect function that you can use to connect a component with a piece of the global application state using a mapStateToProps function.

Interactive Components

Interactive components are React components that are hooked into your application’s Action Creators. This means that they present an interface to the user that allows them to trigger actions that will update the global application’s state. The Redux connect function can also be used to connect a component with your action creators, using a mapDispatchToProps function. (In this function, we also call the bindActionCreators function, imported from redux, so that calling the action creator will result in the action being dispatched to the reducers later on.)

Action Creators

Action Creators are simply functions that return an action object. This object has a required 'type' key and an optional 'payload'. Whenever an action creator is called, the returned action object will be passed to all of the reducers. If these actions result in an AJAX request, we can use a combination of axios and redux-promise middleware to make sure that the promise returned from the AJAX request resolves before the action is dispatched to the reducers.

Reducers

Reducers are also simply functions that take two arguments and return an object representing the state of the application. The first parameter is called state and it represents the current state of the application. The second parameter is called action and it represents the action that was returned from calling the action creator.

These reducer functions are at the heart of how redux reduces the amount of changes necessary to keep the application state up to date. Each reducer is responsible for a certain piece of the global application state.

Let’s go a little deeper here. Reducer functions typically contain a switch statement on the action’s type property. If the action’s type is one that the particular reducer cares about, then it will return a new state object representing the state of the application after incorporating changes based on the action’s payload. It’s important here not to mutate the state parameter passed to the reducer, but to return a brand new state object instead.

If the particular reducer doesn’t care about this type of action, it will simply return the same state object that it was passed as a parameter. This way, the application state can be passed to all of the reducers every time an action creator fires, allowing the entire application state to be updated in response to every user action.

Coming Full Circle

Putting it all together, once all of the reducers have been called and the application state has been updated, all of the redux-connected container components that are affected by the changes in state will receive new props and re-render.

If you’d like to go deeper into learning React and Redux, I highly recommend Stephen Grider’s Modern React with Redux course on Udemy. It’s wonderfully paced and full of detailed diagrams and descriptions of how to use React with Redux.

Modern React with Redux, Stephen Grider Udemy course

4 Things to Remember When You Get Discouraged

Story

Over the last few months, I’ve been helping students when they get stuck working on the Learn.co online full stack web developer course. While I’ve been doing this job, I’ve encountered a few students who have expressed dismay and frustration when considering their progress. In this post, I want to talk about what I say to those students, because it’s something I wish that I had heard earlier on in my journey.

The Hidden Benefit of Writing Smaller Functions

Algorithm Challenges

I remember reading a passage on Quora a few years ago that really stuck with me. I’ve lost touch with the exact source, but from what I remember, the author was in the role of interviewing/hiring developers. The author’s basic idea was that experienced developer’s wrote smaller functions. Of course, it wasn’t until much later that I discovered the hidden benefit of writing smaller functions.

Get Smallest Common Multiple with JavaScript

Algorithm Challenges

Hi Everyone! I was working on a FreeCodeCamp algorithm challenge the other day and kept running into timeout issues when I ran it in their editor. I had tried it elsewhere and it was working, but I figured that I needed to optimize the solution so that it would run on FreeCodeCamp’s servers. After spending quite a bit of time working on how to get the smallest common multiple, I think I’ve arrived at a really performant solution, so I wanted to share it with you all here.

If you’d like to try it out for yourself, the challenge is called Smallest Common Multiple on FreeCodeCamp’s website. The instructions say that we’re going to have a function called smallestCommons that will take a single parameter arr. Our parameter arr is an array with two elements in it ([1,5]) and we’re told that they may not be in numerical order. The task we’re given is to find the smallest common multiple of the provided numbers (in arr) that can be evenly divided by both, as well as by all of the sequential numbers in the range between the two numbers.

For example, for smallestCommons([1,5]) we’d need to return the smallest number that is evenly divisible by 1, 2, 3, 4 & 5. The test cases we’re given are as follows:

smallestCommons([1,5]) should return a number. 
smallestCommons([1,5]) should return 60.
smallestCommons([5,1]) should return 60. 
smallestCommons([1,13]) should return 360360.
smallestCommons([23,18]) should return 6056820.

My First Experience with AngularJS and Rails 5

tutorial

Hi Everyone! My name is Dakota Lee Martinez. Over the last year or so, I’ve been working on the Flatiron School’s Full Stack Web Developer course. I’ve just completed the final project, a full stack web application built with AngularJS and Rails. I’m super excited to share my experience building the app with you all over the next series of posts.

About My Project

For this project, I wanted to pick something I’m passionate about and something that I would actually use. I remember when I first was exposed to code snippets. When I watched a few of Jeffrey Way’s laracasts, I was hooked. If you’re not familiar with custom code snippets, the idea is that you can write a code template for accomplishing a certain task. You give your snippet a trigger phrase. When you type this phrase the phrase expands into your template.

If this were all it could do, it would still be really cool. But, there’s more!!! You can add variables to your template, allowing you to type in a value and have it appear in multiple places within the template. This kind of thing is very useful for variable or function names. Even better, you can cycle through these variables within the snippet by hitting the tab key. This allows you to avoid spending time and keystrokes referencing library specific syntax for a task you’ve already done a lot of times and skip right to adjusting the values that are specific to your particular application.

Why I Wanted to Learn Software Development

Story

Hi Everyone! My name is Dakota Lee Martinez. In the following post, I want to talk to you about why I wanted to learn Software Development. In my life, I’ve been passionate about many things. But, few things are as exciting to me as the developments in the field of software.

Some of my favorite conversations have been about the role of technology in our rapidly changing world. I think that the ability to think abstractly and to create tools is one of the things that really sets humanity apart. At present, the acceleration of progress in Software Development is extremely inspiring to me. These days, there are so many amazing things that we can do on the internet.

I have always been a creative person. I would always be inventing new ways of doing math problems, imagining how different the world would be if we changed the rules, and exploring how changes in the language I use to talk to myself could transform the way I felt about my life. I’ve written many songs, recorded them, read about countless techniques for getting the best sound in a recording or a live situation. Still, as I’ve gotten older, software has become a more substantial presence in all areas of my life.

Today, I am continually amazed by all we are able to do with recording software in our bedrooms. Ultimately, I have felt the value that great software can provide within the world of music long before I decided to learn software development. There is one particular story that I have to share, because it’s a wonderful example of just how big of an emotional impact software can have. For this story, I’ll take you back to my college days studying music in Claremont.

Building a Hacker News Clone in AngularJS – Part 6

tutorial

Hi Everybody! Welcome to the final installment of our series on building a Hacker News clone in AngularJS. In this post, we’re going to discuss routing resolves and when we might want to add them to our application. For a quick review, let’s take a look at what we covered in the previous posts:

In Part 1, we covered creating an Angular service to connect to the Hacker News API.
In Part 2, we covered creating a custom Angular directive to display individual stories.
In Part 3, we covered AngularJS pagination with a library developed by Michael Bromley
In Part 4, we covered creating a custom Angular component to display individual comments, using Angular Filters to help out.
In Part 5, we covered displaying threaded comments by using nested components.

In Part 6 of our series, we’re going to be adding routing resolves to our application to make sure that we don’t transition to a story’s show page before we get the story’s data from the Hacker News API.

To do that, we’ll be going through how to create routing resolves to preload data from a service before hitting the controller. There are certain instances where this is more useful than others. Specifically, when we are wary of a promise failing, using resolves can be a better bet as we won’t load a page before we have the data needed to display it properly. If a promise within a routing resolve fails, the page stays in its current state.

Building a Hacker News Clone in AngularJS – Part 5

tutorial

Hi Everyone! Welcome to the next post in our series on building a Hacker News Clone in AngularJS! In this post, we’re going to focus on using nested components to display threaded comments on individual posts. In the last few posts, we’ve covered a bunch of topics.

In Part 1, we covered creating an Angular service to connect to the Hacker News API.
In Part 2, we covered creating a custom Angular directive to display individual stories.
In Part 3, we covered AngularJS pagination with a library developed by Michael Bromley
In Part 4, we covered creating a custom Angular component to display individual comments, using Angular Filters to help out.

In Part 5 of our series, we’re going to complete our custom Angular component that will display a comment. Specifically, we’re going to focus on expanding its functionality by allowing it to display nested comments (threaded comments). This will be a good example of how to implement nested components in AngularJS.