I still using Mavericks, although everyone have jump on El Capitan. Anyway to cut the story short, I already have a perfect platform to run my research simulation, perfect compatibility and don’t need extra stuff/features atm. So, how to stop this error every time you launch Keynote, Pages and Numbers?
This blog is about a postgraduate student's journey (Started 5th Sept 2014; Viva Voce 24th Aug 2020)
Monday, June 20, 2016
Thursday, March 3, 2016
Wednesday, February 24, 2016
Re-sync Subtitle using SubFix - 5 Steps
After a long wait, I finally finish downloaded all Frasier show. This is a great sitcom, it's just funny and enriches my vocabulary along the way. But I can't find any subtitle source that sync perfectly. I can live without the subs for a season or two, but I have 9 seasons without subtitles (season 3 - 9). I know I'm gonna miss a lot, especially with Frasier and Niles way of speaking. Long story short, I checked out subscene.com, addic7ed.com and tvsubs.net, but they all having the exact same version that out of sync. Some video and audio can be easily synced by just tweak the delay once or twice throughout the movie, but no this time, I have to re-sync every line of the text. Kinda pointless I say. After a short google, I found the perfect apps to re-sync sub easily and SAVES it =)
Let me introduce you the awesome SubFix. In only takes 5 easy steps to watch your movie with perfect sub.
Let me introduce you the awesome SubFix. In only takes 5 easy steps to watch your movie with perfect sub.
Tuesday, February 23, 2016
Control Structure in Swift
We usually used the common control structure in our programming. This post will cover 3 basic common structure in Swift; if else, for loop and while loop
if else
Eg: Create a program that checks if the user enter the correct password for a particular user.
var name = "Ange"
var pw = "password"
if name == "Ange" && pw == "password" {
print("Welcome " + name + ", you have entered the correct password")
}
else if name != "Ange" && pw != "password" {
print("You have entered the wrong username and wrong password")
}
else if pw != "password" {
print("You have entered the wrong password")
}
else {
print(("You have entered the wrong username")
}
![]() |
| if else statement |
for loop
Eg1: Print even number from 1 to 10
for var i = 2; i <= 10; i = i + 2 {
print(i)
print("\n")
}
Eg2: Create an array and divide all the elements in array by 2. Print the result.
var myArray = [2, 4, 8]
for [index, value] in enumerate(myArray} {
myArray[index] = value / 2
}
print(myArray)
for var i = 2; i <= 10; i = i + 2 {
print(i)
print("\n")
}
![]() |
| for loop |
Eg2: Create an array and divide all the elements in array by 2. Print the result.
var myArray = [2, 4, 8]
for [index, value] in enumerate(myArray} {
myArray[index] = value / 2
}
print(myArray)
![]() |
| for loop to access elements in an array |
while loop
Monday, February 22, 2016
Create Video from Still Images using iMovie 10.0.5
I wanted to create an animation of tailgating vs smooth cruising driving from still images. After search around, the free alternative for a Mac user like me is iMovie. I can't find much tutorial for the new iMovie in Mavericks, so I thought I should put one up here.
The most important thing here is to prepare your still images. I miss Paint in Windows system, but the next best option I have for Mac is Preview. Check out here how I prepare my still images.
Steps:
1. Lauch iMovie
So many buttons. You can see on the left panel, All Events and All Projects. It was quite confusing for me at first. What do I want to create here? A movie? project? or event? 'Events' are kinda like the main folder/categories for the movies you created. Projects are all the stuff you have created in iMovie, basically your movies. Feel free to correct me if I'm wrong =)
In this figure below, I have an event called 160219-FKJ, I will saved all movies created for my research purpose under this event.
Step 2: Import images
Step 3: Create movie
Step 4: Adding images to the movie
Step 7: Test movie
I hope this helps and feel free to comment below. Thanks.
Some remarks:
The most important thing here is to prepare your still images. I miss Paint in Windows system, but the next best option I have for Mac is Preview. Check out here how I prepare my still images.
Steps:
1. Lauch iMovie
So many buttons. You can see on the left panel, All Events and All Projects. It was quite confusing for me at first. What do I want to create here? A movie? project? or event? 'Events' are kinda like the main folder/categories for the movies you created. Projects are all the stuff you have created in iMovie, basically your movies. Feel free to correct me if I'm wrong =)
Eg: I went to Taiwan last May 2015. So I may create an event named 201505-Taiwan. Under the event 201505-Taiwan, I may have create movies such as: 150513-Taipei101.mp4, 150514-TaipeiZ00.mp4, 150515-RaoHeNightMarket.mp4.
In this figure below, I have an event called 160219-FKJ, I will saved all movies created for my research purpose under this event.
![]() |
| iMovie 10.0.5 |
Step 2: Import images
Once you have created/choose the event, then we can import the still images for our movie. Click on the button Import at the top and navigate to your images. If you have lots of images, I would suggest to name your files accordingly. I have certain naming conventions for all the 49 images below.
![]() |
| Import still images |
Step 3: Create movie
Now we can create our movie. Simply click on the '+' button at the top. I usually choose no theme for a simple academic animation.
![]() |
| Create movie |
Step 4: Adding images to the movie
You can drag the imported images to the timeline below. But make sure you know which image is which. When you selected an image in the timeline, the info of the selected image will show on the right panel. If you can't see this, click on 'adjust' --> 'circled-i'. In my case, I will drag the images accordingly(160222-tfsWaves-1 to 160222-tfsWaves-49)
Step 5: Cropping style
Once you have selected all the images, Select-All (Ctrl-A) to set the size of your images. By default the cropping style is set to 'Ken Burns'. I'm just gonna change all to 'Fit'. You can play around to see what style fits your movie
![]() |
| Cropping style |
Step 6: Setting frame duration
To set your frame duration, Select-All (Ctrl-A), click on the circled-i on top. You can set as fast as 0.3 secs per image( that's the lowest you can go). I'm just gonna set mine 0.5.
![]() |
| Setting frame duration |
Step 7: Test movie
You can start playing the movie from start or any sections you want. At the timeline, simply bring the vertical lines to the position you want and hit Spacebar (to start or pause).
Step 8: Save movie
Once you are satisfied, click on the 'share' button. I'm just gonna choose to save it as a file on my desktop.
![]() |
| Share/save movie. |
![]() |
| Add description and select movie size |
That's it. Voila! You can use the same steps for adding/combining videos too. Of course there are many other things you can add in iMovie, but once you get familiar with the interface, the rest pretty straight forward. It wasn't that hard actually, but it put me off for few years from using it.
I hope this helps and feel free to comment below. Thanks.
Some remarks:
Some other basic features you might need are at the lower left panel.
- Transitions - Some nice effect for images/videos transitions
- Titles - Titles
Wednesday, January 6, 2016
Create Simple GUI in Matlab
It's always easier if you can put your Matlab coding in GUI. Especially if you have lot of functions, you can use different push-buttons for each functions. This post will guide you to create a simple GUI, consists of your program title, push-button for function, axes to display your simulation/results.
Steps:
1. In Matlab Command Window
3. Rearrange and resize your window GUI accordingly. Save your GUI.
4. Once you save your gui (.fig file) an m-file will be automatically generated (the .fig and .m file will have the same name)
5. Open the GUI's m-file, and copy-paste each m-files function to each designated buttons. For instance, the 'Run' button is under function pushbutton1_callback(hObject, eventdata, handles). I can put all my code under this button.
The 'Stop' button is under function pushbutton2_Callback(hObject, eventdata, handles). I already set my 'Run' button to execute a while loop (eg: while stop==0), so I can set my 'Stop' button as following.
Steps:
1. In Matlab Command Window
>> guide
choose 'Blank GUI (default)2. A window will pop-out, you can design your GUI anyway you like. I usually keep it simple. There are 3 basic things you need for a basic GUI:
- Static text - optional but I like to have title for all my programs (double-click to access the properties)
- Push button - I used 2 push buttons, for 'Run' and 'Stop' (double-click to access the properties)
- Axes - this is where your simulation shown. You can set your Axes to have toolbar
Some note on Axes: I usually have toolbar for Axes, so I can navigate to each pixels and get their information, or zoom in and out.
To customise your Axes toolbar:
- Single left-click on Axes
- Click 'Tools' on the menu
- Select 'Toolbar Editor'
- Drag the following to the top: Pan, zoom in, zoom out, data cursor (you can customise to your liking)
![]() |
| Building Matlab simple GUI |
3. Rearrange and resize your window GUI accordingly. Save your GUI.
4. Once you save your gui (.fig file) an m-file will be automatically generated (the .fig and .m file will have the same name)
5. Open the GUI's m-file, and copy-paste each m-files function to each designated buttons. For instance, the 'Run' button is under function pushbutton1_callback(hObject, eventdata, handles). I can put all my code under this button.
The 'Stop' button is under function pushbutton2_Callback(hObject, eventdata, handles). I already set my 'Run' button to execute a while loop (eg: while stop==0), so I can set my 'Stop' button as following.
![]() |
| push-button 'Stop' |
![]() |
| Basic GUI |
Friday, December 4, 2015
Adding xlwrite to Matlab Static Path
Disclaimer: I'm not sure if the following steps going to mess up your system. This is what works for me, atm. Use at your own risk.
In my earlier post, I added the xlwrite and its needed 6 jar files to Matlab dynamic path. However every time I restart Matlab, I have have to re-do this setting again. I hate going back to my own post and checking out the steps, spending another 1 min to set up the system to use xlwrite. I know 1 min is nothing, but I like things automated. To go about this, add the jar files to Matlab static path. Check here for more about Static Path vs Dynamic Path.
I look everywhere on how to add jar files to static path. I didn't find any clear instructions on how to edit the classpath.txt, anyway this is what works for me.
Steps:
1. In Matlab command window:
3. We want Matlab to load our desired jar files at startup too. So put your jar files (poi_library) in matlabroot/java/jar/. Where on earth is this place? I'm using Mac, so that place is
Applications> Matlab>right-click>Show Package Contents>Java>jar
4. Back to Matlab, append the following at classpath.txt
In my earlier post, I added the xlwrite and its needed 6 jar files to Matlab dynamic path. However every time I restart Matlab, I have have to re-do this setting again. I hate going back to my own post and checking out the steps, spending another 1 min to set up the system to use xlwrite. I know 1 min is nothing, but I like things automated. To go about this, add the jar files to Matlab static path. Check here for more about Static Path vs Dynamic Path.
I look everywhere on how to add jar files to static path. I didn't find any clear instructions on how to edit the classpath.txt, anyway this is what works for me.
Steps:
1. In Matlab command window:
>> edit classpath.txt2. M-file will open. MATLAB reads the static class path only at startup. You can see these are all the files loaded at startup. Eg:
$matlabroot/java/jar/zh_CN/web_connectivity_res.jar
3. We want Matlab to load our desired jar files at startup too. So put your jar files (poi_library) in matlabroot/java/jar/. Where on earth is this place? I'm using Mac, so that place is
Applications> Matlab>right-click>Show Package Contents>Java>jar
![]() |
| matlabroot/java/jar |
4. Back to Matlab, append the following at classpath.txt
$matlabroot/java/jar/poi_library/poi-3.8-20120326.jar$matlabroot/java/jar/poi_library/poi-ooxml-3.8-20120326.jar$matlabroot/java/jar/poi_library/poi-ooxml-schemas-3.8-20120326.jar$matlabroot/java/jar/poi_library/xmlbeans-2.3.0.jar$matlabroot/java/jar/poi_library/dom4j-1.6.1.jar$matlabroot/java/jar/poi_library/stax-api-1.0.1.jar
Subscribe to:
Posts (Atom)

















