How not to make the same mistakes

Hey everyone,

Have you found yourself seeing that you are doing something right, in which the end result turned out to be wrong?

Human error happens all the time; we don’t live in a perfect world.

This doesn’t only happen in the programming world, it even happens to the best of us.

I’ll give you an example of myself… I was inspecting my roof at my own home without using any ladders, and it was yesterday as a matter of fact. Climbing up the roof was fine. Why I did it was because repairs were required. By the way, I don’t have a ladder yet.

Now then, going down the roof, it seemed too scary for me to jump off a slanted surface, although the distance was a lot shorter to make the jump.

Therefore, instead, I did what seemed fine for me as a child. I used to jump off around 8 feet off the playground without any problems at all.

I did exactly just that, and then gravity hit my left ankle really hard. The end result? It got sprained.

And that was the error on my part.

As for myself, I’m turning 31 next month. It is not the same as 10 years ago; aging every couple of years will make you a little weaker than you think you can handle.

And guys, it may be better to have some money well spent in the now that will last for the next coming years. If I did invest in a ladder which costed not as much, then I would have been able to enjoy my weekend a lot more.

Now, I will have to make a trip to the doctor, which is a little more of a bummer.

Anyway, you maybe asking, where am I getting at with this?

The time to invest in your own self. That is like loving yourself first. After that, you can find yourself assured that you’ll do things a lot better.

Now as for my situation, I know what I shouldn’t have done, and I’m going to make it different the next time. So a high-risk, low-reward type of situation is very bad.

Anyway, that’s all I have. Today is a day’s visit to the doctor to see if there is anything wrong with my ankle.

However, until next time, for sure!

Brian.

For large objects, should I use WeakReferences or dispose until I’m done?

Hey everyone,

Short post today. I’m just giving some food for thought.

This post has come up since I’ve just done something that might be interesting for those of you. Especially, those of us who are dealing with high resolution images.

So, I’ve come across a very similar problem today along with what I’ve done before. Except before, I was always recycling and/or disposing my images. Now with what I had done before, these have worked quite well for me, though sometimes I can get unpredictable results like app crashes.

Even in RecyclerView, depending on the image being loaded, you can end up with a race condition. Hey guys, I get it; your image loaded is different than what you chose, so in this case I’d record the position under OnViewAttachedToWindow.

Now for the big question! Dispose my image, or use a WeakReference? The answer I’ll give you is, it really depends on your situation.

Let’s say I have a ViewHolder that also includes a bitmap that my ImageView will reference. In this case, I must keep track of the bitmap mainly in OnBindViewHolder and OnViewRecycled. Sure, this is more maintenance, but it helps me learn the inner workings of how a RecyclerView and its adapter works. Granted, this solution is good if you’re loading multiple images in your RecyclerView.

Now then, let’s revisit our RecyclerView that has a SnapHelper that loads one image (so like a full-page screen) per swipe. In this case, I am able to make a static bitmap which is under a WeakReference, and then therefore it’ll just load when I need it, or throw the bitmap away some time later when the system knows I’m really done with it. I played with this, and the Android Profiler provided good results with ram, along with my emulator that had a RAM threshold of 256MB! If the image nulled out for some odd reason, hey, I didn’t do it. Now having one image per page, one bitmap makes sense. If there were multiple images, I’d already be able to tell that this wouldn’t work so well.

So there you have it! Take your pick, and make it efficient 🙂

Until next time!

Brian.

What is that perfect amount of time for a vacation?

Hey everyone,

Just a question. When was the last time you had a vacation? Was it a week ago? Months ago? Years ago?

Whatever it was, maybe you’ve thought about getting another vacation, and some time soon.

If it’s the earlier option, you’ll probably want to hold off on it for the next couple of months. However, let’s talk about those who just had one at least some months before.

Maybe you are found that project quite boring, and that it’s time to maybe step up your game.

Vacation time is to recharge your batteries. You probably want to find that spark again, I’m guessing? If so, taking a long weekend vacation will be good (between 3 to 5 days). I’ve just done it as a matter of fact, and I think I have more charge for more capacity.

Maybe you’re looking into spending some time with family? I would say around 10 days is enough. Too much longer than that, and you’ll feel out of it like the cosmos has hit you to Pluto.

Unless you really feel out of it, and you’re ready for something new, then take that next challenging project and keep churning after a much longer vacation. Maybe you’re on hiatus, but this one is a long one. However, you can spark up a business idea and then implement that. It gives you some time to think through your life goals as well. It also will give you an opportunity to ask yourself what you’d like to do.

However, life can take us to many interesting places. Towards those travels, we can also navigate through our professions as well, however long it takes to solve a problem.

So the main thing to do would be to love yourself first. This way, you’ll be able to perform on anything that you’d like to do. This also enables you to keep rocking, rockstar 😉

Until next time!

Brian.

How to plan a work day each day

Hey everyone!

I know that I have been through those days where I felt as if there’s nothing to do. Well, we all pretty much have them, especially as just a developer.

Or don’t you? If you don’t, then you are the exception 😉

But we’ll talk about the rule here.

Being free with work, you’re still working regardless, just in a different mode. This one is more on thought processing.

One example is you can always do research on making something better with your app. This reward in itself gives you the experience to tackle something similar later on, and faster! It’s probably the most time consuming, but it is well worth it.

Another example is if you really want, you can also talk with your lead if any help is needed. If there is something he/she will delegate, then that is for you to do 🙂

Then we also have non-priority to do items. Depending on the difficulty and the task’s modification, this is also ideal to also make yourself worry-free about it in the future. Being caught up shows everyone how awesome you can be!

There are many more examples, but some are just being thrown out there to help you decide what is good for you in the current moment.

Now if that new task will take a few days, then that will help you become preoccupied with something work related. During this time, you can plan for that next to do task. It can be improving the task by refactoring the current implementation, or something new just as the examples above. Whatever it is, just note that each passing day gives some sort of accomplishment.

And don’t worry about failure. It is a path to success in your career. I fail all the time with something that doesn’t work as intended, but that doesn’t stop me to find a solution to that problem I’m solving.

We all also know those rock stars that reached their fame. They never stopped, they just kept on going. Therefore, rock on, rock star 😉

Until next time!

Brian.