Thứ Tư, 29 tháng 7, 2015

Load Testing Tools

Load Testing Tools

As websites, web applications, APIs and services become more and more critical, it's import to design and build applications so that they scale well for a large number of requests. To actually test and verify the behavior of services under load, testers and developers can perform load and stress tests. For web applications a load test would usually involve defining, writing and running test scenarios.
A test scenario could be a script that simulates the behavior of a typical user across multiple pages of a website or web application. Once you defined your test scenarios, you can execute it by simulating many concurrent virtual users and monitor how your application behaves. Likewise for APIs and other services, the idea is to generate requests that are as realistic and similar to the possible load of your production environment, so you can optimize and scale your application and services based on accurate and realistic data.

Load Testing Tools8 Tools

There are various tools that you can use to build, conduct and analyze load and stress tests for web applications and other services. Most tools require that you build test scenarios, usually scenarios a typical user would perform on a website, and then simulate many virtual users simultaneously.
Open Source

JMeter

JMeter is an open source Java-based load and performance testing tool. Besides testing web applications and services, you can also load test other services such as LDAP, mail servers or databases.
Open Source

Tsung

Tsung is an open source multi-protocol distributed load testing tool. The purpose of Tsung is to simulate users in order to test the scalability and performance of services, such as HTTP servers and other services.
Open Source

ApacheBench

This is a tool for benchmarking your HTTP server. It is designed to give you an impression of how your current Apache (or other web server) installation performs. This especially shows you how many requests per second your Apache installation is capable of serving and can be useful to benchmark web applications and APIs as well.
Open Source

Locust

Locust is a scalable and distributed load testing tool for web applications, websites and web-based services. Locust comes with a web-based user interface and allows you to write test scenarios in Python.
Commercial

WAPT

WAPT is a load and stress testing tool that allows you to build, generate and monitor load tests via a graphical user interface. WAPT comes in two editions and doesn't limit the number of virtual users you can use like most other commercial tools do.
Commercial

Webserver Stress Tool

The Webserver Stress Tool is an advanced load testing tool that comes with a graphical user interface to run and analyze your load tests. This tool can generate a number of different tests to verify your web applications and services.
Commercial

LoadUI

LoadUI is a cross-platform load and stress testing tool. LoadUI is available as both open source and commercial editions. Its UI allows you to create, configure and redistribute your load tests interactively and in real-time.
Commercial

Loadster

Loadster it a load and stress testing tool specifically designed for high-performance web applications. It comes in two parts: a tool to build and design your test scenarios, and an engine that you can use to actually run and distribute your load tests.


Load Testing Cloud Services

In addition to the above mentioned load testing tools, the following services make it easy to start large-scale load tests without having to build your own infrastructure. This is especially useful if you only have to conduct such tests from time to time, e.g. at specific points in your development efforts.
ServiceTypeDescriptionPricing
BlazeMeterWeb & APIsJMeter-compatible load testing serviceStarting @ $199/month
LoadStormWeb & APIsSaaS cloud testing serviceStarting @ $40/month
Load ImpactWeb & APIsWebsuite load testing serviceStarting @ $60
Loader.ioWeb & APIsFree cloud testing service by SendgrindFree

Using Apache Bench for Simple Load Testing

If you have access to a Mac or Linux server, chances are you may already have a really simple http load generating tool installed called Apache Bench, or ab. If you are on windows and have Apache installed, you may also have ab.exe in yourapache/bin folder.
Suppose we want to see how fast Yahoo can handle 100 requests, with a maximum of 10 requests running concurrently:
ab -n 100 -c 10 http://www.yahoo.com/
It will then generate output as follows:
Concurrency Level:      10
Time taken for tests:   1.889 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      1003100 bytes
HTML transferred:       949000 bytes
Requests per second:    52.94 [#/sec] (mean)
Time per request:       188.883 [ms] (mean)
Time per request:       18.888 [ms] (mean, across all concurrent requests)
Transfer rate:          518.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       57   59   1.7     59      64
Processing:   117  126   7.5    124     162
Waiting:       57   62   7.0     60      98
Total:        175  186   8.0    184     224

Percentage of the requests served within a certain time (ms)
  50%    184
  66%    186
  75%    187
  80%    188
  90%    192
  95%    203
  98%    216
  99%    224
 100%    224 (longest request)
As you can see this is very useful information, it returned requests at a rate of 52.94 requests per second, the fastest request was 175ms, the slowest 224ms
So the next time you are tempted to whip out cfloop and GetTickCount to do some benchmarking on a piece of code, give ab a try, it's easy to use, and will yield much more realistic results.
Because ab supports concurrency, this has two big advantages over cfloop. The main one is that it allows you to test how your code runs concurrently, this can help you identify any possible race conditions, or locking issues. Concurrent requests are also a more natural simulation of load than loops.
Suppose you wanted to test multiple url's concurrently as well? You can do this by creating a shell script, with multipleab calls. At the end of each line place an & this makes the command run in the background, and lets the next command start execution. You will also want to redirect the output to a file for each url using > filename For example:
#!/bin/sh

ab -n 100 -c 10 http://127.0.0.1:8300/test.cfm > test1.txt &
ab -n 100 -c 10 http://127.0.0.1:8300/scribble.cfm > test2.txt &
The usage info from the ab version installed on my Mac (v2.3) is listed below. As you can see there are many useful options for outputting results, and sending additional data in the request.
Usage: ab [options] [http[s]://]hostname[:port]/path
Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -t timelimit    Seconds to max. wait for responses
    -b windowsize   Size of TCP send/receive buffer, in bytes
    -p postfile     File containing data to POST. Remember also to set -T
    -T content-type Content-type header for POSTing, eg.
        'application/x-www-form-urlencoded'
        Default is 'text/plain'
    -v verbosity    How much troubleshooting info to print
    -w              Print out results in HTML tables
    -i              Use HEAD instead of GET
    -x attributes   String to insert as table attributes
    -y attributes   String to insert as tr attributes
    -z attributes   String to insert as td or th attributes
    -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)
    -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
        Inserted after all normal header lines. (repeatable)
    -A attribute    Add Basic WWW Authentication, the attributes
        are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
        are a colon separated username and password.
    -X proxy:port   Proxyserver and port number to use
    -V              Print version number and exit
    -k              Use HTTP KeepAlive feature
    -d              Do not show percentiles served table.
    -S              Do not show confidence estimators and warnings.
    -g filename     Output collected data to gnuplot format file.
    -e filename     Output CSV file with percentages served
    -r              Don't exit on socket receive errors.
    -h              Display usage information (this message)
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)

Thứ Sáu, 17 tháng 7, 2015

More example with Interface and Abstract in PHP

** You cannot have a class that extends two base classes. You could not have.
(You could use traits, which, hopefully, will be available from PHP 5.4 instead of)

Abstract
Abstract Classes focus on a kind of things similarity.
People are considered of type mammal and as such would not be considered of type vehicle.
Interface
Interfaces focus on collation of similar function.
For example: You are a human being and are of type mammal. If you want to fly then you will need to implement a flying Interface. If you want to shoot while flying, then you also need to implement thegun Interface.
See the examples below:
abstract class Mammal {
      protected $age_;
      //below are functions I think all mammals will have,including people
      abstract public function setAge($age);
      abstract public function getAge();
      abstract public function eat($food);
}
class Person extends Mammal {
      protected $job_; //Person's feature
      public function setAge($age){
        $this->age_ = $age;
      }

      public function getAge(){
        return $this->age_;
      }

      public function eat($food){
        echo 'I eat ' ,$food ,'today';
      }

      //People only attribute
      public function setJob($job){
         $this->job_ = $job;
      }
      public function getJob(){
         echo 'My job is ' , $this->job_;
      }

}

//Now a person wants to fly, but they are typically not able to do so.
//So we implement an interface
interface Plane{
  public function Fly(); 
}

//I also want shoot enemy
interface Gun{
  public function shoot();
}

class Person2 extends Mammal implements Plane,Gun{

      protected $job_;//Person feature
      public function setAge($age){
        $this->age_ = $age;
      }
      public function getAge(){
        return $this->age_;
      }
      public function eat($food){
        echo '<br/>I eat ' ,$food ,' today<br/>';
      }
      //Only a person has this feature.
      public function setJob($job){
         $this->job_ = $job;
      }
      public function getJob(){
         echo 'My job is ' , $this->job_;
      }

      //-----------------------------------------
      //below implementations from interfaces function. (features that humans do not have).
      //Person implements from other class
      public function fly(){
        echo '<br/>I use plane,so I can fly<br/>';
      }
      public function shoot(){
        echo 'I use gun,so I can shoot<br/>';
      }
}

$People = new Person();
echo '<pre>';
print_r( get_class_methods('People'));
echo '</pre>';

echo '<pre>';
print_r( get_class_methods('People2'));
echo '</pre>';

$People2 = new Person2();
$People2->setAge(24);
echo $People2->getAge();
$People2->eat('egg');
$People2->setJob('PHP devepop');
echo $People2->getJob();

$People2->fly();
$People2->shoot();

Thứ Năm, 16 tháng 7, 2015

Chia se du lieu may tinh ket noi boi day mang giua 2 may' laptop

http://goldenlink.com.vn/vi/kien-thuc/89-cac-buoc-ket-noi-mang-bang-cap-mang-giua-2-laptop.html
http://thuthuat.taimienphi.vn/chia-se-tai-lieu-giua-cac-may-tinh-trong-mang-lan-2066n.aspx

iMindMap Tutorial

1) iMindMap 8: Tutorial - 01




2) Hướng dẫn lập bản đồ tư duy bằng iMindMap 8




3) iMindMap 8 - New Target




4) iMindMap 8 - Brainstorming




5) What's new in iMindMap 8 - out now




6) iMindMap 8 - Export Overview

[ Drive + Fshare + Mega ] Imindmap 8.0.1 full crack + Portable full

IMindMap 8.0.4 



iMindMap là công cụ tuyệt vời để vẽ bản đồ tư duy đem mọi chi tiết trong đầu bạn ra thành các ý tươgnr, để nắm bắt ý tưởng của bạn trong một không gian không hạn chế. Sau khi nhìn thấy rất nhiều người sử dụng của chúng tôi bao gồm các bức tường với các ghi chú dán, chúng tôi quyết định cung cấp cho bạn một phiên bản kỹ thuật số mà bạn có thể lưu và chia sẻ với những người khác. Thêm văn bản và hình ảnh trên vải mới cork-board của chúng tôi, với các ghi chú dán khả năng mở rộng và các bảng nhỏ để nhóm ý tưởng lại.

Từ ý tưởng đến hành động chỉ trong 3 bước đơn giản 
Đưa các ý tưởng của bạn vào khu bản đồ tư duy, phát triển và tổ chức chúng trong iMindMap của trực quan Mind Map Xem và cuối cùng, đặt chúng vào công cụ quản lý công việc trực quan, DropTask. Đó là một quá trình đổi mới hoàn toàn cho các nhà tư tưởng sáng tạo những người muốn kết quả, chứ không phải hệ thống quản lý dự án phức tạp và cồng kềnh.


Ý tưởng của bạn trong 2 cách nhìn khác nhau
Bạn cần phải suy nghĩ không gian và bây giờ chúng tôi đã đưa cho bạn hai mà làm việc đồng bộ. Bạn có thể chuyển đổi qua lại với các nút bấm để xem và xây dựng trên ý tưởng của bạn trong imindmap.





Các nhánh mới được thiết kế đẹp hơn 


Thiết kế mới cho cả Window và Mac




Kho Icon và tab mới






Thay đổi giữa các bản đồ 



Phần home được thiết kế mới dễ quản lý các file hơn 




Tốc độ xử lý tuyệt vời












Và đây là phần quan trọng nhất hướng dẫn cr@ck :

B1 : Win Xp cài NET Framework 3.5 ( link microsoft ; http://www.microsoft.com/download/en....aspx?id=25150
hoặc mediafire : http://www.mediafire.com/?w6l2e2jnk7wjabw )
B2 : Xóa iMindmap cũ dùng cái trong máy cũng Ok . 


B3: tải về imindmap 8.0.4 :http://4ec3660a4c32731019bc-ddedd291...dows_8.0.4.exe



B4: tải về thuốc : imindmap 8.0.
https://www.fshare.vn/file/M4HR41H4SEDA

Cách cr@ck của bạn Rukaphuong's :

Vấn đề khi gặp phải của bản 8.0.4 là việc patch rất khó, áp dụng các kiểu làm của các bản trước đều không ăn thua. Bị dừng ngay ở chỗ sử dụng thử trial ngay từ lần đăng nhập đầu tiên, sau khi update lên bản 8.0.4, dù đã xóa các thư mục yêu cầu (như bên dưới) và chạy patch nhiều lần (quyền admin)
1, C: \ Users \ administrator \ .thinkbuzan 
2, xóa folder ThinkBuzan, win7 / 8 C nằm: \ ProgramData \ ThinkBuzan 
3, xóa thư mục JSoft, win7 / 8 nằm trong C: \ ProgramData \ JSoft 

Mình nghĩ do từ bản 8.0.4 này (cũng không chắc, do các bản 8.0.2 ; 8.0.3 trước đó không chưa cài nữa ) thì việc trial vào mạng, có kết nối với máy chủ nên nó phát hiện user đã hết hạn dùng trial rồi và không cho đăng nhập. dẫn tới các patch này bị vô hiệu. (patch chỉ làm việc được sau khi đã đăng nhập và ở quyền sử dụng trial; sau đó nó mới làm việc là nâng lên thành ultimate)
Do đó, mới lục lại cái em trial reset mà hồi lâu lắm vô tình tìm được (ai nói t copy của người khác (ở vietnam) là t )
File này bỏ quên từ hồi bản 7 tới giờ ln, cũng may còn giữ lại làm kỉ niệm thì mới giải quyết được. 

link https://www.fshare.vn/file/4D9XO8WLYSTG

Các bạn copy file trial reset vào thư mục cài đặt. chạy file quyền admin.
ròi mở lại imindmap, sao cho vào sử dụng được quyền trial của phần mềm là oke. -> đóng imindmap lại
Lúc này chạy lại file patch sẽ ra ultimate !.

Nếu vẫn chưa được lên ultimate thì cứ theo các bước từ trước đến giờ làm tới. xóa thư mục (như trên), chạy lại file

Và bản portable cho các bạn lưòi cài : 

Bản Portable cho bạn nào không muốn cài đặt  ( máy mình win 7 nên đã test portable chạy thành công còn win 8 và XP mình không có nên chưa test được )


B1 : Win Xp cài NET Framework 3.5 ( link microsoft ;http://www.microsoft.com/download/en....aspx?id=25150
hoặc mediafire : http://www.mediafire.com/?w6l2e2jnk7wjabw )
và Microsoft Visual C++ 2010 Redistributable Package ( đây là bản 32b)
http://www.microsoft.com/en-us/downl...s.aspx?id=5555 nếu bạn chưa có 
Đây là bản 64b :
http://www.microsoft.com/en-us/downl....aspx?id=14632
B2 : Up date win vì iMindmap đòi hỏi nhiều cái , máy mình update đủ rồi tạo portable, bạn nào update thiếu có thể bị lỗi 
B3: Xóa bản cũ đi

B4: Tải file portable 8.0.1 rồi sẽ được portable full  ( hiện mạng yếu nên mình chỉ up Mega mình sẽ up lên các host khác sau nhé )

Link download : 
https://mega.co.nz/#!4IgV2LRL!m6k2CH...wFIO_9gAfz_lBA
https://drive.google.com/file/d/0ByE...ew?usp=sharing



CR@CK Thành công 


windows 7 Ultimate


Thay đổi nội dung bởi lusilbi; 26-03-2015 lúc 23:21.

Thứ Tư, 15 tháng 7, 2015

Visibility in PHP Classes

In previous chapter we have discuss public, private and protected at various place. Public, private and protected are three type of visibility in php classes available for controlling access of your class variable and property. Everty visiblity level has it won rights. For example if your property or variable is available with public, means it can be use anywhere.

Available Visibility in PHP Classes

There are 3 type of visibility available in php for controlling your property or method.
  1. Public: Public method or variable can be accessible from anywher. I mean from inside the class, out side the class and in child(will dicuss in next chapter) class also.
  2. Private: Method or property with private visibility can only be accessible inside the class. You can not access private method or variable from outside of your class.
  3. Protected: Method or variable with protected visibility can only be access in the derived class. Or in other word in child class. Protected will be used in the process of inheritance.

Public Visibility in PHP Classes

Public visiblity is least restricted visibility available in php. If you will not define the visibity factor with your method or property then public will be by defautl applied. Public methods or variables can be accessible from anywhere.For example,  It can be accessible from using object(outside the class), or inside the class, or in child class. Following is the example of the public visibility in php classes:
class test
{
public $abc;
public $xyz;
public function xyz()
{
}
}
$objA = new test();
echo $objA->abc;//accessible from outside
$objA->xyz();//public method of the class test

So in above example class test is the very basic class. In this class every thing is open. Mininum restriction in the class is to access its properyt and methods using object outside the class.

Private Visibility in PHP Classes

Private method or properties can only be accessible withing the class. You can not access private variable or function of the class by making object out side the class. But you can use private function and property within the class using $this object. Private visibility in php classes is used when you do not want your property or function to be exposed outside the class. Following example of Private visibility in php classes.
Class test
{
public $abc;
private $xyz;
public function pubDo($a)
{
echo $a;
}
private function privDo($b)
{
echo $b;
}
public function pubPrivDo()
{
$this->xyz = 1;
$this->privDo(1);
}
}
$objT = new test();
$objT->abc = 3;//Works fine
$objT->xyz = 1;//Throw fatal error of visibility
$objT->pubDo("test");//Print "test"
$objT->privDo(1);//Fatal error of visibility
$objT->pubPrivDo();//Within this method private function privDo and variable xyz is called using $this variable.

Protected Visibility in PHP Classes

Protected visibility in php classes are only useful in case of inheritance and interface. We will discuss in dept of interfaces and inheritance in other chapter of this tutorial. Protected method or variable can be accessible either within class or child class. Here we will take very basic example:
class parent
{
protected $pr;
public $a
protected function testParent()
{
echo this is test;
}
}
class child extends parent
{
public function testChild()
{
$this->testParent(); //will work because it
}
}
$objParent = new parent();
$objParent->testParent();//Throw error
$objChild = new Child();
$objChild->setChild();//work because test child will call test parent.

If you will take anaylze above section you can found that method testParent() is not accessible from object of class. But it is accessible in child class.
Always use correct visibility in php classes to keep your structure healthy. Do not use code like this. It is break all visibility of your php class.
class test
{
public function method($method)
{
$this->$method();
}
private function abc()
{
//Do Something
}
protected function xyz()
{
//do something
}
}
$objT = new test();
$objT->method('abc');
$objT->method('xyz');
This is the very stupid implementation of public, private and protected. Because you can call any type of method in this implementation.
For the further detail about visibility in php classes you can go to:
http://php.net/manual/en/language.oop5.visibility.php

Học lập trình web căn bản với PHP

Bài 1: Các kiến thức căn bản Part 1:  https://jimmyvan88.blogspot.com/2012/05/can-ban-lap-trinh-web-voi-php-bai-1-cac.html Part 2:  https://...