Showing posts with label Learning. Show all posts
Showing posts with label Learning. Show all posts

Friday, September 17, 2021

TC Speaks Fluently: Some English Proverbs Equivalent to Indonesian Proverbs

Often times, when you translate an English literature, you will stumble upon some proverbs in the language and do not want to translate it per words. Instead, you want to find equal proverbs which have the similar meaning in your target language (in this post, it will be Indonesian). Here are some examples of those proverbs:
  1. To have an axe to grind = Ada udang di balik batu
  2. One scabbed sheep is enough to spoil a flock = Sebab nila setitik rusak susu sebelanga
  3. To cherish a viper in one’s bosom = Air susu dibalas air tuba
  4. To fish in troubled waters = Memancing di air keruh
  5. Cut your coat according to your cloth = Bayang-bayang hendaklah sepanjang badan
  6. To carry coals to New-castle = Membuang garam ke laut
  7. The pot calls the cattle black = Udang hendak mengatai ikan
  8. He is a dog in the manger = Badak-badak, minta aku daging; Bangau2, minta aku leher
  9. A thorn in one’s flesh = Seperti duri dalam daging
  10. Home, sweet home = Hujan emas di negeri orang, hujan batu di negeri awak, elok juga di negeri awak
  11. Huge winds blow on high hills = Besar kapal besar gelombangnya, besar kayu besar dahannya
  12. Barking dogs seldom bite = Anjing menggonggong tidak akan menggigit
  13. No rose without thorn = Tiada gading yang tak retak
  14. Like father, like child = Air cucuran atap jatuhnya ke pelimpahan juga
  15. Misfortunes never come singly = Antan patah, lesung hilang
  16. Out of the frying-pan into the fire = Lepas dari mulut harimau jatuh ke mulut buaya
  17. To behold the mote in the eye of one’s neighbour, but not the beam in one’s own = Gajah di kelopak mata tak tampak, kuman di seberang lautan tampak
  18. Once a use and ever a custom = Kebiasaan menjadi tabiat
  19. Strike the iron while it is hot = Menjemur di waktu hari panas.
  20. Such things bring grist to his mill = Pucuk dicinta ulam tiba
  21. Such as the tree, such is the fruit = Bagaimana biduk, bagaimana pengayuh
  22. The apple falls near the tree = Air cucuran atap jatuhnya ke pelimpahan juga
  23. Harm set, haram get= Siapa menggali lubang, ia juga terperosok ke dalamnya
  24. After rain comes sunshine = Sesudah hujan datang terang
  25. His bread is buttered on both sides = Seperti parang bermata dua
  26. There is no smoke without a fire = Kalau tak ada api takkan ada asap
  27. The right man in the right place = Asal ayam pulang ke lesung, asal itik pulang ke pelimpahan
  28. The tongue wounds more than a lance = Berkata peliharakan lidah
  29. To show the white feather = Malu berani, mati takut
  30.  When at Rome, do as Rome does = Di mana tanah dipijak, disitu langit dijunjung
  31. In the land of the blind, the one-eyed is king = Dimana tiada elang, kata belalang, akulah elang
  32. To kill two birds with one stone = Sekali merangkuh dayung, dua, tiga pulau terlampaui
  33. To pour water into a broken basin = Bagai menghasta kain sarung
  34. Too much of a good thing is good for nothing = Seperti kersik di pulau
  35. To save money for a rainy day = Sebelum hujan sediakan payung
  36. Where there is a will there is a way = Dimana ada kemauan disitu ada jalan
  37. You must not countyour chickens before they are hatched = Belum beranak sudah ditimang
  38. Repentance always comes too late = Sesal dahulu pendapatan, sesal kemudian tiada berguna
  39. So many countries, so many customs = Lain ladang lain belalang, lain lubuk lain ikannya
  40. Spare the rod and spoil the child = Kasih akan anak dipertangis, kasih akan istri dipertinggalkan
  41. Falling crumb one must be content with crust = Tidak ada rotan, akar pun jadi
  42. Bean-pods are noisiest when dry = Tong kosong nyaring bunyinya
  43. The die is cast = Nasi sudah menjadi bubur
  44. Many a little makes a mickle = Sehari selembar benang, lama2 menjadi sehelai kain
  45. To put the cart before the horse = Dahulu bajak dari jawi
  46. With one’s back to the wall = Seperti ikan dalam belat
  47. Once bitten twice shy = Sekali jalan terkena, dua kali jalan tahu
  48. Let sleeping dogs lie = Jangan dibangunkan kucing tidur
  49. No pains, no gains = pahit dahulu manis kemudian
  50. A penny saved is a penny gained = Hemat pangkal kaya
  51. If the blind lead the blind, both fall into the ditch = Seperti kapak menyelam beliung
  52. Between the devil and the deep sea = Bagai memakan si mala kama, jika dimakan ibu mati, tidak dimakan ayah mati.
  53. Don’t cut your nose off to spite your face = Menepuk air di dulang, terpercik muka sendiri
  54. As the twig is bent, the tree is inclined = Kecil termanja-manja, besar terbawa-bawa
  55. A dwarf is on a giant’s shoulder can see of the two = Berdiri sama tinggi, duduk sama rendah
  56. A golden key opens every door = Ada uang abang sayang, tidak ada uang abang melayang
  57. Little helps =Sedikit demi sedikit lama-lama jadi bukit
  58. Live and learn = Jauh berjalan banyak dilihat
  59. A well-regulated family often gets the accident = Sepandai-pandai tupai melompat, suatu saat akan jatuh juga

Tuesday, January 26, 2021

TC Cup of Codes: Smooth Scroll to The Top

On today's post, I would like to add another enhancement to my blog. As I've been reading my posts on my phone, one thing came to my realization, it's tiring to scroll back up finding home. So I decided to look around on what I could do, which finally led to this snippet for a Scroll Up.

For this tutorial, I would like to use a circular button (you can use any button you want) with an up arrow sign. I believe, in the UX part, it won't be treated as having an ambiguous function (Up Arrow means go to the Top). 


1. Go To Your Layout


There are two ways to do this, the first option is you can go to your Theme section and edit your template. The second option is go to your Layout and add HTML/Javascript widget. For this tutorial, I'm gonna use the second way.

Choose Add A Gadget:


Pick HTML/Javascript:

2. Add The Codes Below

ouou




  
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!--Smooth Back to Top Button Start-->
<script>
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);} else {
jQuery('.back-to-top').fadeOut(duration);}});
jQuery('.back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;})});</script>
<style>
div#page {
max-width: 900px;
margin-left: auto;
margin-right: auto;
padding: 20px;}
.back-to-top {
position: fixed;
bottom: 0%;
left: 50%;
text-decoration: none;
color: #000000;
font-size: 12px;
padding: 1em;
display: none;}
.back-to-top:hover {
text-decoration: none;}</style>
<!--Smooth Back to Top Button End-->
 

  
<!--Smooth Back to Top Button Start-->
<script>
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);} else {
jQuery('.back-to-top').fadeOut(duration);}});
jQuery('.back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;})});</script>
<style>
div#page {
max-width: 900px;
margin-left: auto;
margin-right: auto;
padding: 20px;}
.back-to-top {
position: fixed;
bottom: 0%;
left: 50%;
text-decoration: none;
color: #000000;
font-size: 12px;
padding: 1em;
display: none;}
.back-to-top:hover {
text-decoration: none;}</style>
<a href="#" class="back-to-top"><img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis0o6j0ShMri8ADgshCFbc6yKh9zI6p0s6h4mlRho1nyxoGUMGwQAFMhQyWjgOKllc5-W5U3viGUONvadVm2V63czLARhYRBYycwfRkpGwuX61hg4jnPoBbQOY9F4fNUuQY0_h_xVut8k/" alt="Back to Top" / /></a>
<!--Smooth Back to Top Button End-->
Let's analyze the codes part by part.

1. The <script> part

The document ready() method will specify a function to execute when the DOM is fully loaded.
 
1
jQuery(document).ready(function()
 
 
jQuery(document).ready(function()
The offset will allow you to determine when the button will show up, the duration will determine how long the animation will work (in will be used for the fade in and fade out effect)
 
1
2
var offset = 220;
var duration = 500;
 
 
var offset = 220;
var duration = 500;
And the last part, here comes the magic. scrollTop() method will set or return the vertical scrollbar position for the elements. It will also use offset to determine whether the page has moved or not.

 
1
2
3
4
5
6
7
8
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);} else {
jQuery('.back-to-top').fadeOut(duration);}});
jQuery('.back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;})});
 
 
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);} else {
jQuery('.back-to-top').fadeOut(duration);}});
jQuery('.back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;})});
So, there you have it. A button to scroll your page up to the top after reading the article you've written. See you on another post!

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;
 }

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: