Wednesday, December 18, 2013

Tips on Socializing with Colleagues at Work


It is challenging for the office workers to socialize each other or it is a challenging subject to think about how much socializing is ideal. If you are rather an introverted person who does not open up easily to others, here are some ways to start off the conversation and socialize with your colleagues.

DO's

- Try initiating short talks whenever you run across someone in the office even if it is about the weather, food or holidays. This shows your effort to be open-friendly and can reduce any misunderstandings.
- Take five minutes in the afternoon to drop by offices of those whom you want to socialize with. It does take a little effort but the friendly chats surely contribute to ease the atmosphere and makes work more tolerable.
- Even if you don't have any topics at hand, try getting to know others as genuine people. Ask what they like and improve your relationships.

DO NOT's

- In your conversations, avoid speaking about religion and politics as these two can possibly become a sensitive or even offensive topic for anyone.
- Avoid being absent to the corporate event like Christmas lighting, for example. Those activities become a good opportunity to bond instead of wasting time.
- Do not hesitate to ask about the topics that you are not knowledgeable at. Rather try taking interest, follow up with the news stories that others like.

Tuesday, September 10, 2013

Simple Steps for Website Relaunch

1. Collect Materials
2. Prioritize Web Contents
3. Look & Feel
4. SEO & Content Optimization
5. Build & Test
6. Re-Launch


Other Helpful Tips: 

- Minimize the change of important contents and of their URL's. 

- If haven't, try using Google's Webmaster Tools for audience demographics, traffics, and development strategies for the future.  

Friday, September 06, 2013

Top Seven Mistakes in Building Website

Are you building a website that doesn't get viewers bored? Here are list of common mistakes for you to check through and fix your site before launching it officially. 

- No Call to Action: Are you asking for conversion without giving a taste to viewers? Webpage without call to action has nothing that activates the readers. Try seeing what the pages does for audience. Think of a clear purpose of what you want to achieve through that page. 

- No Address Bar: Unless your website is for simple product or a figure, audience wants to find what they want to find out about. Especially when your site has many articles to dig in, it is always convenient for viewers to have address bar on the website. 

- Passive Verbs: Is your website active or passive? Use active verbs and get rid of passive tense. 

- Long Passages: 260-600 words on a single webpage is known so that viwers can read easily. If longer than that, readers either would skip or not read at all. Visuals with short text welcomes viewers to stay longer and feel comfortable with your site. 

- Cluttered badges: Never emphasize too much on social media and other company banners that do not help promote your site but theirs. It tells the reader saying, "We don't have much to promote." 

- Portal Look: Do not clutter your website with unrelated topics, as it creates scattered attention to readers. Try focusing on top three things that you want your readers to get. More than that would rather divert readers to close the window. 


- No Compatibility: Make sure you test out your website in multiple devices and browsers. Try both on Mac and PC. Tablet and mobile. Firefox and Safari. This will optimize your traffic and avoid blunders. 

Thursday, September 05, 2013

Except from my paper - Web application security

To build secure Web applications, Microsoft describes a holistic approach, which is to apply security at all three layers: network, host, and application.   The first layer is network, which involves protecting the network infrastructure which consists of routers, firewalls, and switches.  In the host layer, it is securing the host, whether it is your Web server, application server, or database server.

According to the WASC Web Application Security Statistics Project 2008, an initiative to pool together sanitized website vulnerability data and to gain a better understanding about the web application vulnerability landscape, more than 13% of 12186 reviewed sites can be compromised completely automatically.  The probability to detect a urgent or critical error in dynamic web application is about 49% by automatic scanning and 96% by comprehensive expert analysis (white box method).  Also, Analyst firm Gartner Inc. of IBM has stated that 75% of all attacks on web sites and web applications target the application level and not the infrastructure.

Knowing the threats and incorporating security into the applications’ life cycle are important measures essential to the application security.  Open Web Application Security Project (OWASP) and Web Application Security Consortium (WASC) publish documents and initiates projects to raise awareness of application security by identifying some of the most critical risks. 




Here is link to the OWASP Top 10, which focuses on Top 10 Most Critical Web Application Security Risks to protect against these high risk problem areas. Be sure to check out the cheat sheet to prevent security vulnerability.

Monday, June 03, 2013

Setting flash message and redirect with yii-user-management

If you want to set a flash message letting the user know that they need to login or to have required credentials before proceeding to the page they requested, you can do the following.

In the main config file, please add the location of the 'errorHandler'.
 'components' => array(
      'errorHandler'=>array(
            'errorAction' => 'site/error'
        ),

),

Then, in the siteController, add the error action page
/**
     * This is the action to handle external exceptions.
     */
    public function actionError()
    {
        $error = Yii::app()->errorHandler->error;
        if ($error['code']=='403') {
            Yii::app()->user->setFlash('Require Login', $error['code']. 'Error Occured. Please login before continuing.');
            Yii::app()->user->setState('error_login', $error['code']. ' Error Occured. Please login before continuing.');
            /* Get the current URL to redirect */
            Yii::app()->user->setState('redirectUrl', Yii::app()->request->url);
            Yii::app()->controller->redirect(array('/user/user/login'));
        } else if ($error) {
            if ($error['code']=='404') {$error['code'] = "404: Page Not Found"; $error['message'] = "Sorry, but the page you are looking for has not been found.  Please check the URL for errors and try again.";}
            $this->render('error', array('error'=>$error));
        }
        else {
            throw new CHttpException(404, 'Page not found.');
        }
    }
Then, in yii-user-management page, located in app-page/modules/user/views/user/login.php, you can set the flash message to let the users know that they need to login before.

     <?php if(Yii::app()->user->getState('error_login')):?>
        <p class="flash-success"><?php echo Yii::app()->user->getState('error_login'); ?></p>
        <br />

<?php endif; ?>
Then, redirect them to the right page.  If you set the hiddenField for returnURL, yii-user-management will redirect you to the page that the user tried at the first place.

<?php
if(Yii::app()->user->getState('redirectUrl')) {
     $_GET['action'] = Yii::app()->user->getState('redirectUrl');
}
if(isset($_GET['action'])) {
    echo CHtml::hiddenField('returnUrl', urldecode($_GET['action']));
}

?>
I didn't actually use renderFlash used in Yum (yii-user-management), but it works well~

Tuesday, May 14, 2013

YII: Create a Delete Button with Post Action and Confirmation Dialog

Here is how to create a delete button or link with post action and also add confirmation dialog.

echo CHtml::link("Delete", '#', array('submit'=>array('post/delete', "id"=>$data->id), 'confirm' => 'Are you sure you want to delete?'));






In order to delete, you must pass variable through post action, not get action, so here is how you can make a delete button.


Tuesday, April 09, 2013

Using CJUIDatePicker in Yii CActiveForm Widget

If you want to add Jquery UI DatePicker in create/update form, you can do the following,
http://jqueryui.com/datepicker/

Inside
<?php
$form=$this->beginWidget('CActiveForm', array(
    'id'=>'event-form',
    'enableAjaxValidation'=>false,
)); ?>


<?php $this->endWidget(); ?>

Find the row you want to add the datepicker,

<div class="row">
 <?php echo $form->labelEx($model,'created'); ?>
 <?php echo $form->textField($model,'created'); ?>
 <?php echo $form->error($model,'created'); ?>
</div>
 
Replace 
<?php echo $form->textField($model,'created'); ?> 
with
 
<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
 'name'=>"Event[created]", // the name of the field
 'value'=>$model->created,  // pre-fill the value
 // additional javascript options for the date picker plugin
 'options'=>array(
 'showAnim'=>'fold',
 'dateFormat'=>'yy-mm-dd',  // optional Date formatting
 'debug'=>true,
),
 'htmlOptions'=>array(
 'style'=>'height:20px;'
 ),
 )); 
?>
That's it!  Unfortunately, it didn't work for me, so I had to update old jquery-ui.css and jquery-ui.js.

To update them, download the latest stable version and upload them to PATH-TO-FRAMEWORK/web/js/source/jui/js / jquery-ui.min.js and jquery-ui-i18n.min.js and /web/js/source/jui/css/base / jquery-ui.css

Yay! It is working~
 

 

Friday, February 22, 2013

YII: How to Customize the Admin action

If you want to add condition, you can do the following: 

1) copy-paste your action and change only name of it, for example "actionList"
2) change 2 lines of method search in your model to

public function search($param = array())
{
  $criteria=new CDbCriteria($param);
.....................................

3) copy-paste your admin view and rename it to "list" then open it and change line
'dataProvider'=>$model->search(),

to


'dataProvider'=>$model->search(array('condition'=>'column_name=1')),
 
// Added by me 
4) Or if you want to just use same "admin" view page, you can just add a variable:
 
                $this->render('admin',array(
   'model'=>$model, 'condition'=>$condition,
  ));
 
And in the admin view page, you can 
change it as below. 
'dataProvider'=>$model->search(array('condition'=>$condition)),
 
 
Reference:
http://www.yiiframework.com/forum/index.php/topic/13079-customising-the-admin-action-created-by-crud/
 

Secure your website with JavaScript, NO RIGHT CLICK

No right click code for images. Block your visitors from right clicking on your website pages with 'no right click for source'. Disable "copy and paste" to protect your websites source code!

http://www.hypergurl.com/norightclick.html

Error Fix: Delete Action Calls for Get Request in YII CGridView

Error Fix: Delete Action Calls for Get Request in YII CGridView

Suddenly, I noticed that delete button in YII CGridView didn't work.

Yii::app()->request->isPostRequest would return false, which means that variables were passed through $_GET request.

After checking FireBug js error, I had to update jquery.ba-bbq.js file and jquery.yiigridview.js file and updated jquery.js just in case.

https://github.com/yiisoft/yii/issues/2069

http://code.google.com/p/zii/source/browse/trunk/widgets/assets/gridview/jquery.yiigridview.js?r=208


Be sure to delete the specific folder that saved the javascript file in assets folder to delete the cache.
Everything is working fine after that~

Friday, February 15, 2013

Installing Drupal

To install Drupal:

1. Download latest stable version of Drupal
2. Upload them to the directory that you want to install
3. Extract the tar.gz or zip file to the directory
4. Move one directory up because the tar.gz or zip file would be extracted in one directory
5. Copy /sites/default/default.settings.php and change default.settings.php (you would see two files inside /sites/default/ folder - default.settings.php and settings.php)
6. Modify file permission for settings.php
7. Run install
8. Change permission for settings.php and other folders as directed by Drupal
  • /default on 755
  • /default/files including all subfolders and files on 744 (or 755)
  • /themes including all subfolders and files on 755
  • /modules including all subfolders and files on 755
  • /default/settings.php and /default/default.settings.php on 444

That's it~

Monday, January 21, 2013

Tuesday, January 15, 2013

YII: Changing Number of Items in the GGridView

In order to change the number of items in the GGridView, you can go to model and find search() method and add the following.


        public function search()
        {
                // Warning: Please modify the following code to remove attributes that
                // should not be searched.

                $criteria=new CDbCriteria;

                $criteria->compare('id',$this->id);
                ....

                return new CActiveDataProvider(get_class($this), array(
                        'criteria' => $criteria,
                        'pagination' => array(    // pagination property
                                'pageSize' => 30, // page size
                        ),                        // 
                ));
        }