Visual Studio Theme Collections (2005-2010)

This site allows you to create and share Visual Studio color schemes. It also contains numerous themes.
http://studiostyl.es/

Posted in IT | Tagged | Leave a comment

Using PhotoGap to develop iOS App & Android App

  1. http://mobile.tutsplus.com/tutorials/phonegap/phonegap-from-scratch/
  2. http://mobile.tutsplus.com/tutorials/phonegap/phonegap-from-scratch-device-apis/
  3. http://mobile.tutsplus.com/tutorials/phonegap/phonegap-from-scratch-app-template/
Posted in IT | Tagged , | Leave a comment

Customize Drupal Contact Form

Step 1: You need an empty module

As explained here, you need a place to put your custom code. A good place for your “code tricks” can be an empty module where you put all your custom stuff. You can go here for more info on creating an empty module.
Step 2: Modify the form

For example, imagine you want to add a selector field to your site-wide contact form. For example, you want to ask user’s favourite color. This would be the code:

function [--foo--]_form_contact_mail_page_alter(&$form, $form_state) {
// Options on our new selector box
$options = array(
‘red’ => t(‘Red’),
‘green’ => t(‘Green’),
‘blue’ => t(‘Blue’),
‘none’ => t(‘I don\’t bother’)
);
$form['color'] = array(
‘#title’ => t(‘Favourite color’),
‘#type’ => ‘select’,
‘#required’ => true,
‘#options’ => $options,
‘#default_value’ => ‘none’
);

// Resorting the whole form, so that our new field appears where we want to.
$order = array (‘name’, ‘mail’, ‘subject’,
‘color’, ‘cid’, ‘message’, ‘copy’, ‘submit’);
foreach($order as $key => $field) {
$form[$field]['#weight'] = $key;
}
}

That’s it, we modified the form. Remember to change [--foo--] by your custom module’s name, and please notice we use the t() function to make the text of the new field translatable.

If you want more info on forms manipulation, check the Drupal Forms API quickstart guide.

Now, we must modify the output so we receive the data of this new field when someone sends us a message.
Step 3: Modify the email we receive

This is even easier. We use the mail_alter hook, being careful to alter only the contact form mail, as this hook is used for every mail the system sends:

function [--foo--]_mail_alter(&$message) {
// We have to be careful to alter only the contact form mail,
// as this hook is used for every mail the system sends.
if ($message['id'] == ‘contact_page_mail’) {
// We’re gonna insert ‘Favourite color’ before message body.
$message['body'][2] = $message['body'][1];
$options = array(
‘red’ => t(‘Red’),
‘green’ => t(‘Green’),
‘blue’ => t(‘Blue’),
‘none’ => t(‘I don\’t bother’)
);
$message['body'][1] = t(‘Favour’).’: ‘
.$options[$message['params']['color']];
}
}

Save and enjoy. You did it. You modified the site-wide contact form in Drupal. No big deal, isn’t it?

Posted in Uncategorized | Tagged | Leave a comment

Setup the Superfish menu on Danland 7.x

Superfish is an enhanced Suckerfish-style menu jQuery plugin that takes an existing pure CSS drop-down menu, below are the step by step to configuring the Superfish menu on Danland Drupal 7 theme:

  1. Build a standard drupal menu. Set the correct levels to “expanded” (the parent item).
  2. Disable Main menu in the Danland theme settings.
  3. Place the Main menu block in the Superfish menu region. Your menu will be automatically rendered as a drop-down menu.
  4. To modify the animation style and speed please see Superfish menu page
Posted in IT | Tagged | Leave a comment

How to : Drupal Views Custom Templating

The templates used to render the views are listed in the “Theme Information” link in the Views edition UI. You can override the templates in your theme by copying the file from the Views module folder to your theme’s folder.

But the default Views’s template are very verbose and complete. Using the unformatted style and your four fields in display order (when reading from left to right), you should end up with a markup rich enough to achieve your layout in CSS without additional PHP/HTML code.

To override a style or content for a specific view. You have to go to views, and then go to the (page/ block/ attachment) you wants, then find “Theme: information”. There you will see a list of all templates currently using (in BOLD) and the candidate (normal fonts) template files. Select which tpl.php file you want to use.

Go to views module directory (/sites/all/module/views/) and under “theme” directory you should find base tpl.php for your chosen file. Copy that file in your theme folder. Rename it on naming convention given in Theme:information (mentioned in last paragraph).

In Drupal admin interface, click “Rescan template files”. If everything is ok, the original bold tpl.php file should not be bolded anymore. Bolded one should be your newly created tpl.php. You can now style and restructure the new tpl.php file as you like.

Posted in Uncategorized | Tagged | Leave a comment

How to decrypt ASP.net membership password which passwordformat=”encrypted”

namespace MembershipPasswordRecover
{
    public class NetFourMembershipProvider : SqlMembershipProvider
    {
        public string GetClearTextPassword(string encryptedPwd)
        {
            byte[] encodedPassword = Convert.FromBase64String(encryptedPwd);
            byte[] bytes = this.DecryptPassword(encodedPassword);
            if (bytes == null)
            {
                return null;
            }
            return Encoding.Unicode.GetString(bytes, 0, bytes.Length);

        }
    }
}

static void Main(string[] args)
{
    var passwordManager = new NetFourMembershipProvider();
    var clearPWd = passwordManager.GetClearTextPassword("encryptedpasswordhere");
    Console.WriteLine(clearPWd);
}
Posted in ASP.net | Tagged , | Leave a comment

Multi File Upload for Umbraco Tricks

If you experienced file upload error when using multifileupload for Umbraco. There is a trick to solve this problem.

GO TO web.config, under system.webserver > handler, add the following 3 sentences.

      <add verb="*" name="MultipleFileUploadHandler" path="MultipleFileUploadHandler.axd" type="noerd.Umb.DataTypes.multipleFileUpload.MultipleFileUploadHandler, noerd.Umb.DataTypes.multipleFileUpload"/>
      <remove name="MultiFileUpload"/>
      <add name="MultiFileUpload" path="MultipleFileUploadHandler.axd" verb="POST" type="noerd.Umb.DataTypes.multipleFileUpload.MultipleFileUploadHandler, noerd.Umb.DataTypes.multipleFileUpload" preCondition="integratedMode"/>
This should solve the problem!
Posted in ASP.net, IT | Tagged | Leave a comment

Install Drupal in Chinese

Manual Drupal 7 setup

To install and use Drupal in a language other than English without additional module requirements:

See if a translation of this Drupal version is available in your language of choice on the translation server. Not all languages are available for every version of Drupal, but if yours is available, follow these steps to install Drupal in your language:

  1. Download the language file from the translation server.
  2. You will find a directory named translations inside the directory of the profile you will be using. Normally you use standard profile so you can use profiles/standard/translations. Move the downloaded .po file inside this folder.
  3. Install Drupal as per usual by visiting www.example.com/install.php.

Automating installation and updates

Once you start to add modules and a theme to the site, downloading and keeping translations updated manually can be tedious. It is suggested that instead you start off with the Localized Drupal installation profile or use the Localization update module to import the translation files automatically.

Posted in Uncategorized | Tagged | Leave a comment

“Install new module” Link missing in Drupal Admin

Resolved the issue by enabling the Update manager module. This is not intuitive, because users should be able to install new modules without wanting to receive automatic notification of updates (to core and contrib modules and themes).

Posted in IT | Tagged | 1 Comment

IIS 7 Fix “The request filtering module is configured to deny a request that exceeds the request content length”

The root cause is usually the upload file size exceed default 30MB, which is set in IIS request filtering. So you need to change the MaxAllowedContentLength

Reference:
http://www.iis.net/ConfigReference/system.webServer/security/requestFiltering/requestLimits

Posted in IT | Tagged , , | Leave a comment