Excerpt

Thursday, November 10, 2016

Move files into folders, sorted by month and day with PowerShell

Notes:



  • Not suitable for folder with sub-folders, such as folder of extracted zip file

  • Recommended to execute on a test environment first


Steps:



  1. Change the $files and $targetPath values accordingly

  2. Copy the modified script and paste into Windows PowerShell

  3. Wait


The script:


# Get the files which should be moved, without folders
$files = Get-ChildItem 'CHANGE THIS TO ORIGINAL PATH' -Recurse | where {!$_.PsIsContainer}

# List Files which will be moved
$files

# Target folder where files should be moved to. The script will automatically create a folder for the year and month.
$targetPath = 'CHANGE THIS TO TARGET PATH'

foreach ($file in $files)
{
# Get year and Month of the file
# I used LastWriteTime since this are synced files and the creation day will be the date when it was synced
$year = $file.LastWriteTime.Year.ToString()
$month = $file.LastWriteTime.Month.ToString()

# Out FileName, year and month
$file.Name
$year
$month

# Set Directory Path
$Directory = $targetPath + "\" + $year + "\" + $month
# Create directory if it doesn't exsist
if (!(Test-Path $Directory))
{
New-Item $directory -type directory
}

# Move File to new location
$file | Move-Item -Destination $Directory
}

Screenshots:


[caption id="attachment_5100" align="aligncenter" width="646"]2016-11-09_11-51-24 Before (what a mess!)[/caption]

2016-11-09_11-58-42

2016-11-09_12-10-37

[caption id="attachment_5104" align="aligncenter" width="702"]2016-11-09_15-14-41 After[/caption]

2016-11-09_12-16-26

Source:


 

http://www.thomasmaurer.ch/2015/03/move-files-to-folder-sorted-by-year-and-month-with-powershell/

Tuesday, November 8, 2016

Hide Wordpress header image on specific URL

Objective: Hide Wordpress header image on specific URL


Target URL: All URL except http://hilmanali.com/blog/


Theme: Sorbet (child)


File name: header.php


Original code:


<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<?php do_action( 'before' ); ?>
<header id="masthead" class="site-header" role="banner">
<?php if ( get_header_image() ) : ?>
<a href="<?php echo esc_url( home_url( '/blog' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
</a>
<?php endif; // End header image check. ?>
<div class="site-header-wrapper">
<div class="site-branding">
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/blog' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>

Modified code:


<body <?php body_class(); ?>>
<?php
global $wp;
$current_url = add_query_arg( $wp->query_string, '', home_url( $wp->request ) );
$is_specific_network = stripos( $current_url, 'http://hilmanali.com/blog/page/' );
?>
<div id="page" class="hfeed site">
<?php do_action( 'before' ); ?>
<header id="masthead" class="site-header" role="banner">
<?php if( $is_specific_network !== false ) { ?>
<?php } else { ?>
<a href="<?php echo esc_url( home_url( '/blog' ) ); ?>" rel="home">
<img src="<?php header_image(); ?>" width="<?php echo get_custom_header()->width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="">
</a>
<?php } ?>
<div class="site-header-wrapper">
<div class="site-branding">
<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/blog' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
</div>

Screenshots:


2016-11-07_22_48_26

2016-11-07_22_49_05

2016-11-07_22_49_17

 

Sunday, November 6, 2016

Langkawi Lagi!!!

Seperti biasa, setiap satu atau dua tahun, Mama dan Abah akan bawak DDD makan angin. Dan kali ni, destinasi yang telah ditetapkan adalah Langkawi lagi hahaha!

Cuma bezanya, rombongan 3 hari 2 malam kali ni telah disertai oleh semua adik beradik Mama. Bermakna, semua pakcik makcik dan sepupu DDD ada. Kira punya kira, ada la dalam 30 orang! :-D

Memang seronok dan agak havoc, biarlah gambar-gambar ini berbicara :-)

Flickr Album 72157674678579112

https://goo.gl/photos/fYdWAdMwGGHKJ4PK8

https://www.flickr.com/photos/hilmanali/sets/72157674678579112

Monday, October 17, 2016

Fotografi Jalanan, Pasar Karat - Masjid India

Lokasi outing fotografi jalanan kali ini adalah di Pasar Karat dan Masjid India, bersama seorang sahabat. Jujurnya, setelah hampir 20 tahun tinggal di Lembah Kelang, ini adalah kali pertama aku akan menjejakkan kaki di lokasi tersebut.

Sekitar jam 9 pagi, kami tiba di lokasi yang pertama (sekitar Petaling Street). Dalam perjalanan menuju ke lorong masuk Pasar Karat, kelihatan seorang lelaki India yang sedang asyik memintal-mintal misainya sambil ditarik ke atas. Aku menghampiri beliau dan senyum. Sambil menegur dengan sedikit pujian ke atas misainya, aku menunjukkan isyarat dengan kamera (permission), samada boleh mengambil gambar atau tidak. Dan dia tidak ada masalah dengan permintaan itu.

Selesai berborak dengan Mr. Sathiya, kami memulakan langkah memasuki lorong ke Pasar Karat. Beberapa tips dan nasihat yang pernah aku baca dari blogger di internet, tempat yang sebegini haruslah kita berhati-hati. Tidak semua peniaga di sini peramah, begitu juga pengunjungnya. Barang-barang yang berharga perlu disimpan dengan baik, jangan bawa terlalu banyak wang tunai, kena peka penculik saku, jangan keras kepala dan sebagainya.

Terdapat banyak barangan yang dijual di tepi jalanan dan pengunjung yang datang juga sangat ramai. Antara barangan yang dijual adalah barang-barang elektrik, telefon, perhiasan, buku, kamera lama, pakaian dan sebagainya. Dan kebanyakan barang-barang yang dijual adalah barangan terpakai. Yang pasti, harganya murah.

Flickr album 72157671794451864

https://www.flickr.com/photos/darwisy/29731621194/in/datetaken/

https://www.flickr.com/photos/darwisy/30362064975/in/datetaken/

https://www.flickr.com/photos/darwisy/29731577984/in/datetaken/

https://www.flickr.com/photos/darwisy/30362072975/in/datetaken/

https://www.flickr.com/photos/darwisy/29731580794/in/datetaken/

https://www.flickr.com/photos/darwisy/30275789551/in/datetaken/

https://www.flickr.com/photos/darwisy/30065010320/in/datetaken/

https://www.flickr.com/photos/darwisy/30362079635/in/datetaken/

https://www.flickr.com/photos/darwisy/30326804616/in/datetaken/

https://www.flickr.com/photos/darwisy/30326806396/in/datetaken/

https://www.flickr.com/photos/darwisy/30362085915/in/datetaken/

Setelah hampir 1 jam di situ, kami melangkah kaki menuju ke Masjid India melalui Petaling Street dan Pasaraya Seni. Agak berpuas hati dengan outing di Pasar Karat tadi, Insya Allah akan berkunjung semula satu hari nanti. Dengan lebih ramai sahabat, mungkin?

https://www.flickr.com/photos/darwisy/30326789186/in/datetaken/

https://www.flickr.com/photos/darwisy/30326810036/in/datetaken/

https://www.flickr.com/photos/darwisy/29730360713/in/datetaken/

https://www.flickr.com/photos/darwisy/30362092225/in/datetaken/

https://www.flickr.com/photos/darwisy/29730364403/in/datetaken/

https://www.flickr.com/photos/darwisy/30326817436/in/datetaken/

https://www.flickr.com/photos/darwisy/30275777551/in/datetaken/

https://www.flickr.com/photos/darwisy/30275822631/in/datetaken/

https://www.flickr.com/photos/darwisy/30326820226/in/datetaken/

https://www.flickr.com/photos/darwisy/29730370833/in/datetaken/

https://www.flickr.com/photos/darwisy/30362069435/in/datetaken/

https://www.flickr.com/photos/darwisy/30245497552/in/datetaken/

https://www.flickr.com/photos/darwisy/29731610564/in/datetaken/

https://www.flickr.com/photos/darwisy/30245502372/in/datetaken/

https://www.flickr.com/photos/darwisy/29731615254/in/datetaken/

https://www.flickr.com/photos/darwisy/30326837806/in/datetaken/

https://www.flickr.com/photos/darwisy/30245507322/in/datetaken/

Thursday, October 6, 2016

HyppTV Everywhere WebTV Plug-in

Sekiranya anda mengalami masalah untuk download atau install HyppTV Everywhere WebTV Plug-in, boleh cuba langkah-langkah ini.

Objektif Utama:



  • Untuk menonton rancangan TV di internet browser (Firefox / IE / Chrome) menggunakan khidmat HyppTV Everywhere


Keperluan:



  • Pengguna Unifi

  • Berdaftar di HyppTV Everywhere

  • Menurut penjelasan dari he.help@tm.com.my, plug-in ini tidak boleh digunakan di internet browser Chrome


Masalah:



  • Login di http://hypptv.tm.com.my

  • Disuruh install HyppTV plug-in dengan klik butang OK

  • Tidak boleh download atau install HyppTV plug-in setelah klik butang OK (seperti gambar di bawah)


hypptv everywhere install failed

Solusi:



  1. Download WebTV Plug-in di sini (URL telah diberi oleh he.help@tm.com.my)

  2. Install plug-in tadi (boleh ikuti langkah di User Guide ini bermula 4b. iv)

  3. Setelah selesai, login semula di http://hypptv.tm.com.my

  4. Berkemungkinan, symptom sama akan berlaku jika klik butang OK. Teruskan dengan klik butang Cancel.


P/s:

  • Post ini ditulis setelah kecewa dengan jawapan-jawapan yang diberi di Twitter TMConnects dan direct message

  • Menulis tutorial dalam Bahasa Melayu memang sukar :-D