Thursday, April 20, 2017

TC Cup of Codes: Separate Numbers from a String in Javascript

So this morning, a friend asked how to separate numbers from a string using Javascript. He wants to use car plates as input, for example: "AB1234DCD" and wants the output to be "AB 1234 DCD".

After spent some time coding Googling with various possible algorithms keywords, I finally got the answer from.....http://stackoverflow.com. :D

Using split.(/(\d+)/) it will automatically split the string "AB1234DCD" into an array "AB", "1234", "DCD". And after that, you can do anything you want to the array. In the code below, I use join(" ") to append the array and add white space between each element.


  
1
2
3
4
5
6
7
8
9
function SplitPlate() {
   var plateOld = document.getElementById('oldPlate').value;
   arr = plateOld.split(/(\d+)/)
   plateFinal = arr.join(" ");
   //alert(test);
 
   var plateNew = document.getElementById('newPlate');
   plateNew.innerHTML = plateFinal;
 }
 

  
function SplitPlate() {
   var plateOld = document.getElementById('oldPlate').value;
   arr = plateOld.split(/(\d+)/)
   plateFinal = arr.join(" ");
   //alert(test);

   var plateNew = document.getElementById('newPlate');
   plateNew.innerHTML = plateFinal;
 }

Tuesday, April 18, 2017

TC Apps Insight: Impossible Rush

Categories: Games
Genre: Arcade, Puzzle
Platform: Android
Developer: Akkad

***

A few days ago I read a story about a 15 years old who created this game and, for the shake of curiosity, I downloaded the game.

"Great idea!"

That was the first thing came to my mind when playing this game (with some curse words here and there..lol). It's simple, yet so challenging. No talking, no BS, just STP (Straight To Play)

The first screen shows a button named "play" and one option at the bottom-left for sounds.


The challenge is to match the color of dropped balls with the correct color of rectangle's side which rotatable by tap.

The numbers at the top screen are pretty much explained themselves. On left to right orders, they are: highscore, current score, and attempts remaining.


That's it!
Happy playing :)

Sunday, April 16, 2017

TC Midnight Mumbles: Where Should I Go? What Should I Do? Why?

I read a good article today (here it is). It's really related to my situation these days. I felt that I'm running on a circle. I felt the weariness but I'm getting nowhere near what I want. While all the people around me already accomplished many things.

I moved up to the Capital (Jakarta) a year ago felt so determined to do what I've planned. But my plans are only sketches on papers. Nothing details and easily fades away. As I mentioned in my previous post, this results in a year of got carried away by anything but what I should've done.

It sucks, really. And facing that was all my faults, I can't stop blaming myself.

****

Last Sunday (9/4), I attended this meeting about personal development (since I really want to change). I told my story to the forum, and it turned out I'm not the only one having those problems. All other attendees have similar problems, we are not happy with our current situations. We are living an unfulfilled life. We have fears of our goals. We care but act indifferent. We think we are failures.

After hours of discussion, bit by bit we discover what's really our problems and find out what's really the solutions. To me, the mentor suggested that I need to find my reason, because, apparently, I don't have a really strong "why" on doing those things. Ja, I agree, my reason was to only proving the world that I could, and that's a weak ass reason. I have this imagination of success, but I simply didn't do the work. I want the result, but ignore the process.

Knowing the "why" is not an easy task to do. Yeah, perhaps for some, they can figure it out easily. But for most people, It probably requires a lifelong journey of searching. Knowing the "why" may be the same as knowing the purpose of life. Because the "why" should be our compass. It is what we use to guide ourselves in life and achieve something.

Right, purpose of life..

Finding purpose of life requires massive self-reflection. One need to ask themselves what it is, and, since there might be several, write EVERYTHING that comes to mind. 

I already, kind of, know what is my purpose of life should be. Because the fastest way to find it is through religion. I am a Moslem, thus the only purpose of life I should have is to worship God and I shall do fine in this world. One of the verse in the Qur'an says:

And He will provide him from (sources) he never could imagine. And whosoever puts his trust in Allah, then He will suffice him. Verily, Allah will accomplish his purpose. Indeed Allah has set a measure for all things. (QS: At-Talaq, 3)
This is actually the perfect solution. By relying on God, the burden of uncertainty about the future is alleviated completely. 

Now the next question will be, how to trust?

That's another story to tell. I still have a lot to learn, and this blog will play a huge part in my, hopefully, transition.

Links worth a visit:

Friday, April 14, 2017

TC Good Tunes: Asteriska Cabrini (Sidewalk Folk @ Filosofi Kopi Melawai)

First time I saw her, she was on my colleague's wedding. She was on the stage and I was like,

"Who's this pretty lady, with pretty voice, singing my favorite indie songs?"

So when my colleague come to office again a week after, I asked about the singer on her wedding. She said,

"Oh, it was my friend. Don't you know? the singer from Barasuara, the indie band!"

As a self-proclaimed indie aficionado, I was slightly taken aback by her question that I have no idea who Barasuara is. I replied with just,

"Oooo..."

So, you probably know what I did next. I did an extensive research on her the band. 
The band was awesome! I'll tell you on another post.

****
Let's get back to Asteriska.

On Wednesday night, Filosofi Kopi Melawai held an event called Sidewalk Folk and had her as the guest star. 

She arrived around 8 PM. Stunning. Start singing few minutes after. Most of the songs were from her solo album, Distance. And some other were from her favorite singers, I believe.




Unfortunately I couldn't be able to record all of her performances but here it is one good song that I recorded, which I don't know what the title is.


Here are some links worth to visit:

1. Itunes -- https://itunes.apple.com/us/artist/asteriska/id1021559429
2. Soundcloud -- https://soundcloud.com/cabriniasteriska
3. Instagram -- https://www.instagram.com/asteriska_/
4. Last.fm -- https://www.last.fm/music/Asteriska

Thursday, April 13, 2017

TC Learning Notes: Add Social Media Links to Youtube Channel

I am not new to Youtube. It has been my go source to find tutorials, entertainment, funny bits, live performances and so on. What I'm new at, is being a creator. And because of the influence of this awesome film-maker, named, Casey Neistat, I finally upload my first video 5 months ago.

Now, in my spare time, I try to learn about video-editing and about the platform some more. Whether about its settings, designs, analytics, and also the main-awesomeness, monetization!

There are so many things to learn and what I want to show you right now is how to put social media links on the channel art.

1. Sign in to your account and open your Youtube channel.



2. Click the gear button on the right side under the channel art.

3. Make sure this option is active. And click save to close the window.


4. Click "Edit Links" on the right top of your channel art to add the links.


5. Add your social media url.


6. Your links are ready to be clicked!

TC Lazy Screening: 3 Movies Based On True Stories

It's​ been a while since I had time to watch movies. I used to watch a lot, but due to my commitment, I have managed to tone this addiction down.

Buuuuut, in the span of last week, I unexpectedly, watched so many movies and tv series seasons.

Haha...lots of catching ups to do from those characters.

And between those movies, 3 of them apparently have some truth aspects supporting the stories. I always love to learn from other people's experiences in life (kepo). I hope you are, too.

I really hope..

Pff..Whatevs.. :D

It is not a review about the movies, you can find it elsewhere, and I'll try my best not to put any spoilers in this post. So anyway, here they are *drumrolls :

1. Snowden (2016)


The first movie is Snowden. It was based on the book The Snowden files. Told the story about Edward Snowden (played by Joseph Gordon-Levitt), an NSA contractor who were able to leak various classified documents as a result from its illegal surveillance project. The movie has shown what he needed to do to get to share those information which jeopardized his job, his career, even his life.

2. Joy (2015)


The second is Joy. Its story was loosely based on Joy Mangano biography of how she build her empire from scratch. Joy, in this movie, has to bury her dreams and potentials in early life because of everything that happened around her. But eventually, her eagerness to solve a problem is still strong enough to resurface those potentials and light up her path to her dreams. With a high amount of relentless efforts and hard work she has put, she finally able to do the one thing she loves. Innovating.

3. War Dogs (2016)


The last one and the most interesting among the list. It was based on the story of David Packouz and Efraim Diveroli. They were arms dealers who received a $30 Million contract to arm American allies in Afghanistan. The movie showed their struggle to overcome various obstacles to gain trust from the gov. Since it was a comedy-drama movie, lots of the scenes were a bit of a stretch from the truth to make it more aligned to the theme.

Saturday, April 8, 2017

TC Cup of Codes: Display Line of Codes on A Blog Post

I want to learn programming again.

I've been away for too long from this "world" and I miss it so much. The creative process. The late-nights. The "A-ha" moments. Even the stressed-out by.

So, one of the main purpose of this blog is to document all the lessons I've learnt. And it will look good if I can show the lines of codes properly on a post.

I've looked it up, and here's how to display your codes better on a blog post. P.S.: I'm using blogger account for this tutorial.

********

1. Log in to your blogger account.

2. Click on Theme from the side menu

3. Click Edit HTML

4. Insert the following codes in the <head> section of your HTML:


  
01
02
03
04
05
06
07
08
09
10
11
12
13
14
<pre class="brush: html" name="code"><script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushJScript.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCss.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shLegacy.js" type="text/javascript"></script>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>    
<script language="javascript">
window.onload = function () {
    dp.SyntaxHighlighter.ClipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
    dp.SyntaxHighlighter.HighlightAll('code');
    dp.SyntaxHighlighter.BloggerMode();
}
</script></pre>
 

  
<pre class="brush: html" name="code"><script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushJScript.js" type="text/javascript"></script> 
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCss.js" type="text/javascript"></script>
<script src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shLegacy.js" type="text/javascript"></script>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css" rel="stylesheet" type="text/css"></link>
<link href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css" rel="stylesheet" type="text/css"></link>     
<script language="javascript">
window.onload = function () {
    dp.SyntaxHighlighter.ClipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';
    dp.SyntaxHighlighter.HighlightAll('code');
    dp.SyntaxHighlighter.BloggerMode();
}
</script></pre>
If you need to display certain other languages, you can use other brushes to display the codes better. Here are some of the list:

http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/


5. Save your changes

6. Use the following into the <body> whenever you want to put your code:

  
1
2
3
4
5
<div style="text-align: justify;">
<pre class="brush: html" name="code"><pre class="brush: javascript" name="code"># Your Javascript Code</pre>
</pre>
</div>
<div style="text-align: justify;">
 

  
<div style="text-align: justify;">
<pre class="brush: html" name="code"><pre class="brush: javascript" name="code"># Your Javascript Code</pre>
</pre>
</div>
<div style="text-align: justify;">

************

Thats it!

Now you can display some codes on your blog post.

Sources:

Monday, April 3, 2017

TC Midnight Mumbles: The First Three Things I Think When April is Mentioned

April, the fourth month of the year. The ending of the first quarter and the starting of the second quarter. Haha...WTF am I talking about?

Here are the first three things come to my mind when April is mentioned:

1. April's Fools Day

April Fool's Day is celebrated every April 1st. It's a day dedicated for doing pranks, spreading hoaxes, playing jokes, and so on. Yeah...you get the idea.

I'm not a fan of this particular day. It's sad, really, to treat a day as an excuse to do bad things to others recklessly. Cuz, some of them (most of them) jokes are not even funny and just simply mean.

2. My Projects

It goes like,

"What??! April already??! I haven't finished creating this, and that one as well, and the other one behind that that one!!"

I have several projects that are currently on halt (pfft..excuse!). Because I got too carried away by everything else. Seems, now is the right time to dig everything up bit by bit.

3. My Study Plans

Since a few years back, I've been wanting to apply for a study. And when I finally received it, timing was being a b*tch, so I need to let that chance go. Now after a year settled, I want to try again for sure this time.

Sunday, April 2, 2017

TC Lazy Screening: After "Before The Flood"

You are the last best hope of Earth. We ask you to protect it or we, and all living things we cherish, are history. - Leonardo DiCaprio


I finally had the time to watch Before The Flood.

Yeah, I was 160s days late.

Perhaps since it's a documentary (which is not on my first-pick list to spend the time on), I tend to avoid watching it. And not until recently, I find that documentaries are actually interesting.

I'm not going to give you any comprehensive review on the movie or on the theme it has brought. You can find it someplace else from the actual experts on movie-reviewing. In my opinion, it's a great movie, splendid techniques on the productions, and successfully deliver its message on the urgent matter.

Before The Flood shows some astonishing views of the imminent danger that we're currently facing --- the end of the world --- is actually, mostly, sadly, a result of our actions, our wrongdoings. It's because of our extensive usage of fossil fuels over the past decades, our involvement in causing wildfires, our non-stop and increasing demands of cattle's products, and so on.

The movie also shows many initiatives from around the world to prevent it from happening (early). Like creating alternatives renewable resources' plantations, spreading awareness through various media, and also initiating global actions through agreements and laws.

Well, that's it. I encourage you to watch this movie since it's a good one and perhaps you can learn something from it. As a closing statement, whilst I agree that we should save this world, I believe that the end of the world is an inevitable event. I also believe that although we have the right to enjoy the Earth's resources, abusive actions that could lead to destruction is not the right thing to do. Be a cultivator, not a destroyer.

Some links worth a visit:
0. the trailer --> here
1. https://www.beforetheflood.com/
2. http://www.imdb.com/title/tt5929776/
3. http://channel.nationalgeographic.com/before-the-flood/
4. http://www.ucsusa.org/global_warming/science_and_impacts/impacts/causes-of-sea-level-rise.html#.WODZOG-GO00
5. https://climate.nasa.gov/news/2533/short-lived-greenhouse-gases-cause-centuries-of-sea-level-rise/
6. http://www.ecomena.org/islam-environment/