วันศุกร์ที่ 16 ตุลาคม พ.ศ. 2558

วิธีทำสอบ App ที่พัฒนาด้วย cordova

1. เข้าสู่ command line ด้วยคำสั่ง cmd
2. สั่งให้ cordova ให้จำลองเครื่องเป็น localhost server ด้วยคำสั่ง cordova serve
3. เมื่อเราแก้ไขไฟล์ index.html ก่อนจะทำสอบให้ใช้คำสั่ง cordova prepare เพื่อ copy ไพล์ HTML,CSS,JS ไปยัง ptatform/.../www

การติดตั้ง Cordova/PhoneGap และ Android Studio บน Windows

  1. Download JDK- Java SE Development Kit - Windows x64 - (latest edition) and Install using default options
    1. Add a system variable JAVA_HOME and point it to the directory containing the contents of the JDK (example C:\Program Files\Java\jdk1.7.0_51)
    2. Add ;%JAVA_HOME%\bin; to the Path system variable.
    3. If you have a Proxy Server, note proxy server settings and:
      1. Start --> Type Java Control Panel
      2. General Tab --> Click Network Settings...
      3. Choose the appropriate settings, "use browser settings" may work for you.
    4. Validate Java Install:
      1. From a command prompt enter the following
        java -version
      2. You should see something like :
        java version "1.7.0_51"

วันอาทิตย์ที่ 4 ตุลาคม พ.ศ. 2558

ทำเว็บอย่างไร?? ให้เป็นมิตรกับ facebook

1. อย่าลืมใส่ Open Graph tags  ด้านล่างนี้

Title
<meta property="og:title" content="Workday Sets Price Range for I.P.O." />
Site name
<meta property="og:site_name" content="My Favorite News"/>
URL
<meta property="og:url" content="http://www.myfavnews.com/2013/1/1/workday-price-range" />
Description
<meta property="og:description" content="Workday, a provider of cloud-based
applications for human resources, said on Monday that it would seek to price
its initial public offering at $21 to $24 a share.  At the midpoint of that
range, the offering would value the company at $3.6 billion. Like many other
technology start-ups, Workday, founded in 2005, will have a dual-class share
structure, with each Class B share having 10 votes. Its co-chief executives,
David Duffield, the founder of PeopleSoft, and Aneel Bhusri, who was chief
strategist at PeopleSoft, will have 67 percent of the voting rights after
the I.P.O., according to the prospectus." />
Facebook App ID
<meta property="fb:app_id" content="[FB_APP_ID]" />
Object Type
<meta property="og:type" content="article" />
Localization
<meta property="og:locale" content="th_TH">
Author and Publisher
<meta property="article:author" content="https://www.facebook.com/fareedzakaria" />
<meta property="article:publisher" content="https://www.facebook.com/cnn" />


2.ขนาดรูป  1200 x 630 px   หรืออย่างต่ำสุด 600 x 315 px


ที่มา
https://developers.facebook.com/docs/sharing/best-practices#images
https://developers.facebook.com/docs/sharing/webmasters

วันอาทิตย์ที่ 20 กันยายน พ.ศ. 2558

laravel กับ Controller does not exist.

เวลาเราเพิ่ม controller และ route แล้ว แต่ก็ยังเจอ Controller does not exist. สั้นง่ายๆ

php artisan dump-autoload
##คำสั่งนี้มีการปรับปรุงไฟล์ vendor/composer/autoload_classmap.php ##
ในกรณีเราเพิ่ม controller ใหม่ใน localhost เมื่อเรา dump-autoload ให้ทำการ upload flie vendor/composer/autoload_classmap.php ไปไว้บน hosting ด้วย

วันอาทิตย์ที่ 13 กันยายน พ.ศ. 2558

วิธีติดตั้ง laravel 4.2 บน hosting จริง

ย้ายทุกอย่างใน folder public มาอยู่บน Document Root

วิธีที่ได้ผลที่สุด แล้วก็ไม่ยาก ใช้ได้แน่ๆก็คือย้ายแอพพลิเคชั่นของเราทั้งหมดไปไว้ที่ root จะเป็น www หรือ public_html หรือ htdocs ก็แล้วแต่จะพิจารณากันตามโฮสท์ใครส่วนใหญ่บ้านเราใช้ DirectAdmin ก็น่าจะ public_html กันเนาะ
ขั้นแรก ย้ายทุกอย่างออกจาก public มาไว้ที่  www  หรือ DocumentRoot
Image title
ขั้นต่อมาก็ลบเจ้าโฟลเดอร์ public ทิ้งซะ ก็จะได้โครงสร้างประมาณนี้
Image title
มีอะไรต้องแก้อีกนิดนึงในไฟล์  bootstrap/paths.php
Image title 
ขั้นตอนสุดท้ายเราต้องเข้าไปแก้พาธในไฟล์ index.phpImage title

ที่มา

วันเสาร์ที่ 5 กันยายน พ.ศ. 2558

วิธี Resize และ Crop รูปภาพใน Laravel 4

Image

A Laravel 4 wrapper for the Imagecow image resizing / respoisive image package. Seehttps://github.com/oscarotero/imageCow for more detail on the underlying image manipulation package.
Image cow can use either GD or ImageMagick to transform image.

Instalation

Install as any other Laravel 4 package:
1) Add to composer:
"require": {
    ...
    "kevbaldwyn/image":"dev-master"
    ...
}
2) Composer Update:
$ composer update
3) Add to the providers array in app.php:
    'providers' => array(

    ...

    'KevBaldwyn\Image\Providers\Laravel\ImageServiceProvider'
)
4) Add to the facades array in app.php:
    'aliases' => array(

    ...

    'Image' => 'KevBaldwyn\Image\Providers\Laravel\Facades\Image'
)
5) Publish the package config file to change the defaults:
$ php artisan config:publish kevbaldwyn/image
6) Copy the /vendor/imagecow/imagecow/Imagecow/Imagecow.js file to a publicly accessible web directory. The default path is set as /public/js/Imagecow.js, but whatever it is set as in the config the file must exist.

Usage

Standard

To provide image links on your templates use like so:
<img src="{{ Image::path('/image.jpg', 'resizeCrop', 400, 200) }}" />
Where the first argument is the image which is referenced from the root of the public directory. The second argument is the transform method and each subsequent argument is an argument that would be passed to the relevant transform method used. See the Imagecow Documentation for more details.

ที่มา:https://github.com/kevbaldwyn/image/

วันพฤหัสบดีที่ 3 กันยายน พ.ศ. 2558

laravel 4.2 CMS (fullycms)



วิธีติดตั้ง
  1. เข้าไป download zip file จาก https://github.com/sseffa/fullycms/tree/laravel-4.2
  2. ใช้  command line open in the folder, run composer install
  3. Enter your database details into app/config/database.php
  4. Run php artisan app:install to setup and seed your database
  5. Default admin, email: admin@admin.com, password: admin
  6. Settings app/config/sfcms.php. (optional)
    • Cache enable / disable
    • image folder
    • post per page
    • ...
วิธีแก้ปัญหา
1.หา path ไม่เจอดังรูป
วิธีแก้ไข-> เปิดไฟล์ \public\filemanager\scripts\filemanager.config.js  แก้ไขในบรรทัด "fileRoot": "sf_cms/public/uploads/" ให้เป็น "fileRoot": "project-folder/public/uploads/",



วันเสาร์ที่ 22 สิงหาคม พ.ศ. 2558

Laravel Media Manager

Laravel Media Manager 0.1.0 beta

This package is still under development.

Laravel 4 advanced media manager (file manager and uploader) package based on elFinder 2.1. Inspired by laravel-elfinder package developed by Barry vd. Heuvel. Note that this package is still under development. You can use this file manager in Laravel 4 as a standalone media manager or as a plugin for TinyMCE or CKEditor. For more info take a look at files in src/views folder.

Installation

First of all you should add laravel-media-manager package to your composer.json file using this line:
"ahmadazimi/laravel-media-manager": "dev-master",
Add the MediaManagerServiceProvider to your application providers by adding this line to providers array in app/config/app.php:
'W3G\MediaManager\MediaManagerServiceProvider',
To copy the Media Manager assets to the public folder, using the following artisan command:

composer update symfony/symfony

php artisan mediamanager:publish
Also remember to publish the assets after each update (or add the command to your post-update-cmd in composer.json)
You can now add the routes for elFinder to your routes.php
Route::group(array('before' => 'auth'), function()
    {
        \Route::get('media', 'W3G\MediaManager\MediaManagerController@showStandalone');
        \Route::any('media/connector', 'W3G\MediaManager\MediaManagerController@connector');
    });
Of course you can define your own filters/routes if you want.

Configuration

The default configuration requires a directory called 'media' in the public folder. You can change this by publishing the config file.
php artisan config:publish ahmadazimi/laravel-media-manager
In your app/config/packages/ahmadazimi/laravel-media-manager, you can change the default folder, the access callback or define your own roots and also some extra parameters for elFinder.

ref.
  • https://github.com/ahmadazimi/laravel-media-manager
  • http://symfony.com/blog/upgrading-your-symfony-projects-the-easy-way

วันอังคารที่ 4 สิงหาคม พ.ศ. 2558

วิธีทำให้ Laravel ติดต่อกับ MySql

วิธีทำให้ Laravel ติดต่อกับ MySql

1.สร้างฐานข้อมูล(Database)
2.คอนฟิกในการเชื่อมฐานข้อมูล จะถูกกำหนดอยู่ในไฟล์ app/config/database.php
3.รัน migrate เพื่อแก้ไขโครงสร้างฐานข้อมูล ด้วยคำสั่ง  php artisan migrate:make users เพื่อสร้างไฟล์ class ขึ้นมาไว้ในไดเร็กทอรี app/database/migrations/[current date]_users.php
4.แก้ไขไฟล์ app/database/migrations/[current date]_users.php
public function up()
{
Schema::create('users', function($table)
            {
                $table->increments('id');
                $table->string('first_name', 128);
                $table->string('last_name', 128);
                $table->string('email', 128);
  $table->timestamps();
            });
}
public function down()
{
Schema::drop('users');

}
5.รัน php artisan migrate อีกครั้งเพื่อสร้าง table users

ที่มา
http://spalinux.com/2015/01/laravel-connect-to-database
http://www.taroworldtaro.com/laravel-2-migrates-seeders/
http://ethaizone.com/blog/2012/10/%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%9A-laravel-migrations/

วันเสาร์ที่ 1 สิงหาคม พ.ศ. 2558

คำสั่งติดตั้ง lavavel 4.2 ด้วย composer

composer create-project laravel/laravel project-name ~4.2.0 --prefer-dist

เครื่องมือดีในการตรวจสอบเว็บไซต์ง่ายๆ มาให้นักพัฒนาเว็บไซต์

วันนี้มีเครื่องมือดีในการตรวจสอบเว็บไซต์ง่ายๆ มาให้นักพัฒนาเว็บไซต์ ผู้ดูแลเว็บไซต์ และผู้ที่สนใจ
ที่ช่วยดูว่า เว็บไซต์ที่เรามีอยู่ได้มาตรฐานหรือไม่ ซึ่งช่วยในการประกอบการทำเว็บไซต์ กำหนดทิศทาง หรือมีอะไรที่จะต้องปรับปรุง กันบ้าง เพื่อให้เว็บไซต์เราติดอันดับ มาลองดูกันครับ
http://validator.w3.org ใช้ตรวจสอบโครงสร้างของเอกสารว่าโครงสร้างได้มาตรฐานหรือไม่ ??
http://www.brokenlinkcheck.com ตรวจสอบว่าเว็บไซต์มีลิงค์ที่ตายอยู่หรือไม่ ??
http://www.thaiwebaccessibility.com/validator หรือhttp://wave.webaim.org ใช้ในการตรวจสอบเรื่องของมาตราฐาน ว่าหากได้ออกแบบรองรับการใช้งานตามรูปแบบ Universal Design หรือ Web Accessibility หรือไม่
https://jigsaw.w3.org/css-validator เพื่อใช้ตรวจสอบโครงสร้างการตกแต่งเว็บไซต์
http://serps.com/tools/rank_checker ลองตรวจสอบกันว่า Google ให้คะแนนเว็บไซต์ของเราอย่างไร
http://mobiletest.me ใช้ตรวจสอบว่าหากเข้าใช้งานด้วย Smart Device เช่น iPhone, Android, Windows Phone จะหน้าตาเป็นอย่างไร
http://www.siteworthtraffic.com ใช้ตรวจสอบดูมูลค่าเว็บไซต์ของคุณว่ามีมูลค่าจากโฆษณา ได้กี่ $ และมี Page View, Unique Visitor เท่าใด
http://www.seowebpageanalyzer.com ใช้ดูเรื่อง Search Engine Optimisation โดยจะสรุปข้อมูลที่จำเป็นสำหรับการทำ SEO
http://www.google.com/trends/ อันนี้ให้ใช้ในการวิเคราะห์ แนวโน้มของเนื้อหาของเว็บไซต์ หรือ เปรียบเทียบ โดยแนวโน้มของเรื่องราวว่ามีคนสนใจเรื่องนี้หรือไม่ อย่างไร?
น่าจะเป็นเครื่องมือที่มีประโยชน์ทุกท่าน เพื่อใช้ในการตรวจสอบเว็บไซต์ของเรากันนะครับ

ที่มา
https://www.facebook.com/groups/thaiwebaccessibility/?multi_permalinks=1105314679497914&notif_t=group_highlights

วันศุกร์ที่ 31 กรกฎาคม พ.ศ. 2558

แก้ไขปัญหา XAMPP กับ .htaccess

1. แก้ไข โดยการเอา(#)ออกจากบรรทัดนี้ #LoadModule rewrite_module modules/mod_rewrite.so

2.ให้แก้ไข

<Directory />
    AllowOverride none
    Require all denied
</Directory>
เป็น
<Directory />
    AllowOverride all
    Require all denied
</Directory>