PHP – remove x number of characters from a string
Simply use PHP substr function to do the dirty jobs for you. This brings up a good question peopel usually ask. How do I remove the trailing comma at the end of a word, a string ?
Continue Reading →By Duy Michael Nguyen|PHP|Be the first to comment!
Simply use PHP substr function to do the dirty jobs for you. This brings up a good question peopel usually ask. How do I remove the trailing comma at the end of a word, a string ?
Continue Reading →By Duy Michael Nguyen|Uncategorized|Be the first to comment!
I follow the asp.net tutorial on Microsoft website to learn ASP.NET MVC. [http://www.asp.net/mvc/tutorials/getting-started-with-aspnet-mvc3/cs/accessing-your-model's-data-from-a-controller] Interesting enough, I’ve encountered a bug that alot of new beginner having trouble with. The devil unable to find the requested .net framework data provider. it may not be installed. I’ve spend couple hours to figure this out and I hope it [...]
Continue Reading →By Duy Michael Nguyen|Uncategorized|Be the first to comment!
Often, you want to free up your server , so you scratch your head and wonder what is the biggest files you have. With this simple command, you will find out how humongous your files are. find {/path/to/directory/} -type f -size +{size-in-kb}k -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 [...]
Continue Reading →By Duy Michael Nguyen|javasript|Be the first to comment!
Hi folks, this comes up so often that I want to share with you on how to ‘properly’ check a variable is undefined. [javascript] if (typeof something == "undefined") { // do thing when undefined } [/javascript] Credits goes to open source communities and all developers sharing their works.
Continue Reading →By Duy Michael Nguyen|jquery-ui|Be the first to comment!
Today, I am going to show you 2 tricks that you can use while working with Jquery UI Tabs. #1. Find the number of tabs [sourcecode language="javascript"] $("ul.ui-tabs-nav > li").length [/sourcecode] #2. Insert a new tabs after a specific tabs index [sourcecode language="javascript"] $("#myTabSelector").tabs("add", "#newTabId" + , ‘NewTabLabel’, 1); //1 is the index you want [...]
Continue Reading →By Duy Michael Nguyen|javasript, jQuery, Yii|5 Comments
Problem: You have a date field (e.g. birth date) generated using Yii CJuiDatePicker (e.g. http://www.yiiplayground.cubedwater.com/index.php?r=UiModule/jui/ziiDatePicker) or Jquery UI Datepicker (http://jqueryui.com/demos/datepicker/). The Yii CJuiDatePicker is the wrapper of Jquery UI Datepicker. Everything is fine and you are happy. When you want to clone your current form (contains the CJuiDatePicker ), and suddenly,the cloned date field (e.g. [...]
Continue Reading →By Duy Michael Nguyen|javasript, Yii|Be the first to comment!
Hi folks, I encounter this bug today and like to share the solution. I notice that I have 3 red js errors saying ‘missing jquery library’. Then I remember that I explicitly tell Yii do not use built-in jquery library as in this post how-to-use-your-own-jquery-library-in-yii/ I do not know how to include jquery library for [...]
Continue Reading →By Duy Michael Nguyen|datejs, javasript|Be the first to comment!
If you need to work on Date object in JavaScript, I recommend you have a look @ Datejs – Opensource Javascript library. Here is some quick tricks that may help to save your day. Tip#1: to get yesterday Date.today().add(-1).days(); Tip#2: to get Today Date.today() Tip #3: to get current week //starting from Sunday to Saturday [...]
Continue Reading →By Duy Michael Nguyen|jQuery|Be the first to comment!
Suppose we have the following drop-down list 1: <select id=”box” > 2: <option value=”1″>Value 1</option> 3: <option value=”2″>Value 2</option> 4: <option value=”3″>Value 3</option> 5: <option value=”4″>Value 4</option> 6: <optgroup label=”Group1″> 7: <option value=”5″>Value 5</option> 8: <option value=”6″>Value 6</option> 9: <option value=”7″>Value 7</option> 10: <option value=”8″>Value 8</option> 11: </optgroup> 12: </select> Trick #1: to get the [...]
Continue Reading →By Duy Michael Nguyen|Yii|3 Comments
Hi folks, By default, Yii uses its included Jquery library. However, sometimes it makes more sense to use whatever jquery version you want. There is a simple solution to that. All you have to do is telling Yii do not use the built-in Jquery by adding the below code in config/main.php. Note that the ‘clientScript‘ [...]
Continue Reading →| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||