Let’s say you are designing an iOS application which takes user input using a text field. When you add a text field to your storyboard and run your application, you will see that when you tap on the text field, the keyboard pops up automatically. But when you tap the return key, they keyboard doesn’t go away. As it turns out, the popping up of the keyboard is taken care of when you add the UITextField, but dismissing the keyboard is up to you. Here’s how you make it go away after you are done taking the input from the user: Continue reading “Dismissing The UITextField Keyboard”
iOS App: Separator Lines And Back Button In Master-Detail Application
When you create a master-detail application in iOS, a few things appear by default. If you notice it, you will see that the empty cells are separated by lines. But we want the separator lines to appear for items that are there in the table. Also, you will notice that the back button in the detail view contains the title by default. What if we want it to say something else? Perhaps not say anything at all. How do we do it? Continue reading “iOS App: Separator Lines And Back Button In Master-Detail Application”
Content Delivery Network – Part 2/2
In the previous post, we discussed about content delivery network (CDN) and why we need it. This post is a continuation of that topic. Here, we will discuss about the pros and cons of using CDN. CDN obviously helps the sites that experience heavy traffic. Most of the times, you will think that just using a CDN will deliver a better performance, but this is not always the case. If you don’t choose your provider carefully, your site will end up suffering. Let’s look at some of the advantages and disadvantages of using CDN. Continue reading “Content Delivery Network – Part 2/2”
Content Delivery Network – Part 1/2
Internet users today are demanding faster and higher-quality services from their media hosting companies. Being an internet user yourself, you should know that we place a high demand on these services. This is the reason quick access and delivery of rich-media like music, photos, videos etc has become a top priority. Wait a minute, why we need to care about all that? Doesn’t that just happen somewhere on the server? Well, who do you think makes that happen? It’s the people who manage the website. The beautiful site that loads all the high-resolution images for you doesn’t just work magically by itself. It needs to be optimized in a zillion ways for you to not feel the pain. All of your pages, including your photos and videos, will load quickly and instantly if the website owners use the right Content Delivery Network (CDN). Let’s see what this whole thing is about, shall we? Continue reading “Content Delivery Network – Part 1/2”
C++ Vector Memory Release
When you use C++ STL, it takes care of freeing up memory after a variable goes out of scope. But let’s say you have some code that needs the memory to be freed up immediately. This can happen under many circumstances when you are working under constrained resources. One of the more popular STL containers is ‘vector’. Let’s say you have declared a bunch of those in your code and you want to free them up manually. You may think that using clear() on that vector might take care of the situation, but it doesn’t. You can call clear(), and it will destroy all the objects, but it will not free up the memory. So how do we do it? Continue reading “C++ Vector Memory Release”
Package OpenCV not found? Let’s Find It.
OpenCV has been refined over the years and installing it has become way more user-friendly now. If has been ported to many platforms and you don’t need an IDE to use it. There are many different ways in which you can install it and use it in your existing code. But sometimes, when people try to do different things with it, they run into problems. This post deals with one such problem. When you write code that uses OpenCV, you need to tell your compiler where it is. The reason for this is that this location will contains all the libraries and binaries necessary for the header files to work in your code. If you don’t specify this, you will encounter the following error: Continue reading “Package OpenCV not found? Let’s Find It.”
What Is Random Walk?
Consider the following situation. We have a drunkard who is clinging to a lamppost, and now he decides to start walking. He is in the middle of the street and the road runs from east to west. In his inebriated state, he is as likely to take a step towards the east as he is towards the west. It just means that there is a 50% chance that he will go in either direction. From each new position, he is again as likely to go east or west. Each of his steps are of the same length but in random direction. After having taken ‘n’ number of steps, he is to be found standing at some position on the street. This is what a random walk is. We can plot the position against the number of steps taken for any particular random walk. Now the question is, can we model his movement so that we can predict where he will be after taking ‘n’ steps? Continue reading “What Is Random Walk?”
Understanding Recursion: Part 4/4
In the previous posts, we understood the basics of recursion, we discussed what happens when a recursive call is made and we saw some recursive code. But all that was from a programmer’s perspective. We looked at how we would see it. In this post, we will talk about about recursion from a machine’s perspective. We will see what happens inside when a recursive call is made. Don’t worry if you are not a hardcore coder, we will not be using too much jargon here. You will still be able to understand what we are about to discuss. Continue reading “Understanding Recursion: Part 4/4”
Understanding Recursion: Part 3/4
In the previous post, we discussed about how we can deconstruct a programming problem to use recursion to our advantage. We will continue to discuss about programming in this post as well. If you are not prepared to look at code, you may want to skip this post and proceed to the next one in the series. If not, continue reading! Let’s continue to talk about trees then. By now, you understand enough about trees for me to not discuss the basics. If you want a refresher on trees, please read my previous post. In this post, we will look at some common recursive programming problems. You will see the problem and the recursive code to solve it, but not the explanation. We have already discussed how to understand a recursive function in full depth. It’s up to you to understand what’s happening inside these functions here. Continue reading “Understanding Recursion: Part 3/4”
Understanding Recursion: Part 2/4
In the previous post, we discussed about the general nature of recursion and recursive programming. We looked at a simple piece of code to understand how recursion happens under the hood. This post delves a bit deeper into recursive programming. Now that we understand recursion, how do we apply it to a real programming problem? We need to understand how we can deconstruct a programming problem so that we can use recursion. Figuring this part out can get tricky sometimes! It’s easier for some problems, but not so much for a few others. In this post, we will look at an abstract data type and see how we use recursion to our advantage. Let’s get out hands dirty, shall we? Continue reading “Understanding Recursion: Part 2/4”