Skip to main content

Posts

A javascript library for formatting and manipulating numbers.

Numeral.js , while less complex, was inspired by and heavily borrowed from  Moment.js  so if you have use momentjs before you should be familiar with this library. Numbers can be formatted to look like currency, percentages and more. How to use: numeral(1000).format('0,0') returns 1,000 numeral(1230974).format('0.0a') returns 1.2m numeral(1000.234).format('$0,0.00') returns $1,000.23 numeral(1230974).format('($ 0.00 a)') returns $ 1.23 m numeral(1).format('0%') returns 100% numeral(0.974878234).format('0.000%') returns 97.488% For more sample and options go to  http://numeraljs.com/ .

Button click always fires when you press enter key

I've spent hours trying to figure this out, but the solution is just adding the type="button" attribute to the button element. Issue. <button id="generateButton" class="btn btn-info btn-sm">Generate</button> Solution <button id="generateButton" type="button" class="btn btn-info btn-sm">Generate</button> I got the solution from this post on SOF. http://stackoverflow.com/questions/12325066/button-click-event-fires-when-pressing-enter-key-in-different-input-no-forms

Introducing the YouTube Kids app

Countries outside of the US have kids too,  Please Google I need this in Philippines App Store like last February 2015. :)

Turn checkboxes and radio buttons in toggle switches

http://www.bootstrap-switch.org/

jQuery BBQ: Back Button & Query Library

jQuery BBQ leverages the HTML5 hashchange event to allow simple, yet powerful bookmarkable #hash history. In addition, jQuery BBQ provides a full .deparam() method, along with both hash state management, and fragment / query string parse and merge utility methods. http://benalman.com/projects/jquery-bbq-plugin/

Format date and time using Moment.js

The javascript function below will format a given datetime object like facebook ish using momentjs . function formatDateTime(dte, format) {     var diff = moment().diff(moment(dte), 'days');     if (diff == 0) {         return moment(dte).fromNow();     }     else if (diff == 1) {         return moment(dte).calendar();     }     else {         if (format) {             return moment(dte).format(format);         }         else {             return moment(dte).format("MMM DD, YYYY hA");         }     } } The return value will depend on the datetime pass to the function: If today "a few seconds ago" or "13 minutes" ago or "an hour ago" If yesterday "Yesterday at 5:15 PM" If the second parameter is pass it will use it ...

HowTo: Convert a given number into its ordinal value in VB.NET

Found this code from  stackoverflow  and made some small change to it,  this will convert any given number to its ordinal value. Example: Convert(1) will return 1st Convert(11) will return 11th Convert(12) will return 12th Convert(23) will return 23rd Public Function Convert(ByVal number As Integer) As String         Dim ones As Integer = number Mod 10         Dim tens As Integer = Math.Floor(number / 10) / 10         If (number > 10 And number < 14) Then             Return number.ToString() & "th"         Else             Select Case ones                 Case 1                     Return number.ToString() & "st"                 Case 2             ...

Dotnetnuke Messages and Notifications links not working properly

It take me a week to figure this out, had to look into the source code,  In our case the issue occur because we have a custom User Profile page and the Message Center page in not a child of that page. We just move the messages page under profile page and everything works properly.  Also make sure you clear cache under host settings. I ask a question about this on DNN Q&A

DotNetNuke and Apache Solr in action

All search functionality of  zeekbeek.com is powered by SOLR. Also we are using  jQuery Waypoints  for infinite scroll of search results and  jQuery BBQ  for handing #hash.

Allow Indexing Page Settings and ROBOTS Meta in DotNetNuke

This is a single page settings that every DotNetNuke Admin should never forget. This setting controls whether a page should be indexed by search crawlers. It uses the INDEX/NOINDEX values for ROBOTS meta tag. It is located in: Page Settings > Advance Settings > Other Settings

Example on how to use dnnConfirm jQuery Plugin

The JS code below will show a dnn confirm dialog upon click on any button with my-Button class.  Pay attention to isButton option on initialization and the isTrigger parameter on button click. //initialization $(".my-Button").dnnConfirm({     text: "Confirm Message",     title: "Confirm",     isButton: true }); //button click handler $(".my-Button").click(function (e, isTrigger) {     if (isTrigger) {         // Your code here     }     return false; });

DotNetNuke+Apache Solr=High Speed Enterprise Search

We have successfully implemented Apache Solr as a Search Solution for DotNetNuke . Here's the summary on how we did it. First we installed  BitNami Apache Solr Stack  to our test machine(Windows 7). We change the Solr Schema to fit our needs.   We build a DNN Scheduler to add/edit/delete documents to Solr using Solrnet . After we are done indexing,  we created a search class to query Solr Webservice using Solrnet. Now we have an Intelligent and Fast Search. :) FYI: Solr has a cool Dashboard that will let you check if your documents are being index properly or do some test query. I will find time to share actual source code in the near future. Regards

Another way implementing dnnConfirm

// Delete review button $(".Delete-Button").dnnConfirm({     text: "Confirm Message",     title: "Confirm Title",     isButton: true }); $(document).delegate(".Delete-Button", "click", function (e) {     if (e.isTrigger) {         //Your code here     }     return false; });

Disable tokeninput inside of Compose Message Dialog

I implemented DotNetNuke's dnnComposeMessage method/plugin in one of my module and I notice that other than the contact being pre-populated, users are also allowed to add/edit contact, this is great if you want it that way, however if you don't want users to change contacts other than what you already pre-populated, then we should disable it. I can't find a method inside of tokeninput plugin so I use CSS to hide the close icon and input control which in turn disable add or delete of contact during compose message dialog. Below is my CSS, using facebook theme. .composeMessageDialog fieldset .dnnFormItem .token-input-input-token-facebook input { display: none; } .composeMessageDialog fieldset .dnnFormItem .token-input-delete-token-facebook { display: none; }