Blog

Previous Next

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

A lot of people ask me things like ”What should I learn to get a programming job?” or ”How can I get a job as an engineer in Silicon Valley?”

Here’s an actual quote from last week:

So, I need some advice. I am 33 years old, and I need to get out of Support and in to at least DevOps if not full-stack development, but it’s so expensive. Any advice on what I should learn first?

The implication is usually which technology should you learn to get a job. As if your choice of technology is some kind of silver bullet.

Wanna know a dirty little secret? It doesn’t matter.

Any technology you’re likely to have heard of is a good pick. Does it have more than 10,000 results when you Google it? Then there are companies using it in production.

If companies are using it, then you can get a job doing it.

Ok, fine. There is a caveat: jobs are easier to get for technologies that are growing in popularity, and it’s harder to get a job in a technology that’s on its way out. So, maybe don’t pick FORTRAN or COBOL.

There’s another caveat — your choice of tech matters a lot more when you’re a programmer or developer than when you’re an engineer. That’s why engineers make $20,000 more than programmers on average.

Your real job as a software engineer isn’t to write code. It’s to translate hand-wavy business requirements into detailed specs that a computer can follow.

Your job is to ask questions and to find edge cases that the product people didn’t think of. Your job is to help operations define processes well enough to be automated.

Sure, you’ll write the code in the end, or maybe you’ll hand off the spec to a coder, but your real job is coming up with the spec. Even if it’s just in your head right before you write the code.

Don’t just learn a technology; learn how to solve problems with a technology.

The key here is that you have to play the long game. What interests you enough so that you can keep doing it for 10 years? It’s probably not a tech stack or a language, but a problem you want to solve.

Let’s say you work in support like that guy from the quote up top. What can you do to get a better job?

First, you can look at the job you already have. Are there problems you have or repetitive tasks you run into every day? You can probably automate those.

Start digging. Learn what you need to learn to solve your problem.

Then you look around. Are there any processes your team follows that are annoying? Processes that could be improved? Processes that you don’t use, but could make everyone’s lives better?

Then you can build something to make it easier. Start digging. Learn what you need. Someone who can take a loose problem and translate it into code is much more valuable than someone who can take specific instructions and write code.

Congratulations! You’re an engineer. You used technology to solve a real-world problem. And you didn’t even need anyone else to tell you the spec!

Not only is problem-oriented learning the most fun way to gain knowledge, it also teaches you all the other fringe skills that you need. Skills like turning fuzz into spec, Googling for solutions, digging into code to find bugs, talking to users, testing, and learning random new tech that’s handy. Learn all the things!

If you’re still stuck and don’t know which technology to use, go to HackerNews and find a “Who’s hiring” thread like this one. It’s a monthly collection of around 600–900 high quality jobs. Many of them list which technologies they use.

Read those threads. Count technology words. Pick the most popular 3. Learn them by solving a problem you have.

Be warned, though. That list changes completely every 2 or 3 years for libraries and frameworks and every 5 to 10 years for core technologies like languages, servers, and databases.

So don’t sweat the tech. Focus on learning to learn and solving problems. Be an engineer.

 

source: https://medium.com/swizec-s-nightowls/what-should-you-learn-to-get-a-better-coding-job-6453ef083597

Add a comment
Previous Next

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Scalar type declarations

Scalar type declarations come in two flavours: coercive (default) and strict. The following types for parameters can now be enforced (either coercively or strictly): strings (string), integers (int), floating-point numbers (float), and booleans (bool). They augment the other types introduced in PHP 5: class names, interfaces, array and callable.


<?php
// Coercive mode
function sumOfInts(int ...$ints)
{
    return array_sum($ints);
}

var_dump(sumOfInts(2, '3', 4.1));

The above example will output:

int(9)

To enable strict mode, a single declare directive must be placed at the top of the file. This means that the strictness of typing for scalars is configured on a per-file basis. This directive not only affects the type declarations of parameters, but also a function's return type (see return type declarations, built-in PHP functions, and functions from loaded extensions.

Full documentation and examples of scalar type declarations can be found in the type declaration reference.
Return type declarations

PHP 7 adds support for return type declarations. Similarly to argument type declarations, return type declarations specify the type of the value that will be returned from a function. The same types are available for return type declarations as are available for argument type declarations.


<?php

function arraysSum(array ...$arrays): array
{
    return array_map(function(array $array): int {
        return array_sum($array);
    }, $arrays);
}

print_r(arraysSum([1,2,3], [4,5,6], [7,8,9]));

 

The above example will output:

 

Array
(
    [0] => 6
    [1] => 15
    [2] => 24
)

 

Full documentation and examples of return type declarations can be found in the return type declarations. reference.
Null coalescing operator

The null coalescing operator (??) has been added as syntactic sugar for the common case of needing to use a ternary in conjunction with isset(). It returns its first operand if it exists and is not NULL; otherwise it returns its second operand.


<?php
// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';

// Coalescing can be chained: this will return the first
// defined value out of $_GET['user'], $_POST['user'], and
// 'nobody'.
$username = $_GET['user'] ?? $_POST['user'] ?? 'nobody';
?>


Spaceship operator

The spaceship operator is used for comparing two expressions. It returns -1, 0 or 1 when $a is respectively less than, equal to, or greater than $b. Comparisons are performed according to PHP's usual type comparison rules.


<?php
// Integers
echo 1 <=> 1; // 0
echo 1 <=> 2; // -1
echo 2 <=> 1; // 1

// Floats
echo 1.5 <=> 1.5; // 0
echo 1.5 <=> 2.5; // -1
echo 2.5 <=> 1.5; // 1
 
// Strings
echo "a" <=> "a"; // 0
echo "a" <=> "b"; // -1
echo "b" <=> "a"; // 1
?>


Constant arrays using define()

Array constants can now be defined with define(). In PHP 5.6, they could only be defined with const.


<?php
define('ANIMALS', [
    'dog',
    'cat',
    'bird'
]);

echo ANIMALS[1]; // outputs "cat"
?>


Anonymous classes

Support for anonymous classes has been added via new class. These can be used in place of full class definitions for throwaway objects:


<?php
interface Logger {
    public function log(string $msg);
}

class Application {
    private $logger;

    public function getLogger(): Logger {
         return $this->logger;
    }

    public function setLogger(Logger $logger) {
         $this->logger = $logger;
    }
}

$app = new Application;
$app->setLogger(new class implements Logger {
    public function log(string $msg) {
        echo $msg;
    }
});

var_dump($app->getLogger());
?>

The above example will output:

object(class@anonymous)#2 (0) {
}

Full documentation can be found in the anonymous class reference.
Unicode codepoint escape syntax

This takes a Unicode codepoint in hexadecimal form, and outputs that codepoint in UTF-8 to a double-quoted string or a heredoc. Any valid codepoint is accepted, with leading 0's being optional.


echo "\u{aa}";
echo "\u{0000aa}";
echo "\u{9999}";

The above example will output:

ª
ª (same as before but with optional leading 0's)

Closure::call()

Closure::call() is a more performant, shorthand way of temporarily binding an object scope to a closure and invoking it.
<?php
class A {private $x = 1;}

// Pre PHP 7 code
$getXCB = function() {return $this->x;};
$getX = $getXCB->bindTo(new A, 'A'); // intermediate closure
echo $getX();

// PHP 7+ code
$getX = function() {return $this->x;};
echo $getX->call(new A);

The above example will output:

1
1

Filtered unserialize()

This feature seeks to provide better security when unserializing objects on untrusted data. It prevents possible code injections by enabling the developer to whitelist classes that can be unserialized.


<?php

// converts all objects into __PHP_Incomplete_Class object
$data = unserialize($foo, ["allowed_classes" => false]);

// converts all objects into __PHP_Incomplete_Class object except those of MyClass and MyClass2
$data = unserialize($foo, ["allowed_classes" => ["MyClass", "MyClass2"]]);

// default behaviour (same as omitting the second argument) that accepts all classes
$data = unserialize($foo, ["allowed_classes" => true]);
IntlChar

The new IntlChar class seeks to expose additional ICU functionality. The class itself defines a number of static methods and constants that can be used to manipulate unicode characters.


<?php

printf('%x', IntlChar::CODEPOINT_MAX);
echo IntlChar::charName('@');
var_dump(IntlChar::ispunct('!'));

The above example will output:

10ffff
COMMERCIAL AT
bool(true)

In order to use this class, the Intl extension must be installed.
Expectations

Expectations are a backwards compatible enhancement to the older assert() function. They allow for zero-cost assertions in production code, and provide the ability to throw custom exceptions when the assertion fails.

While the old API continues to be maintained for compatibility, assert() is now a language construct, allowing the first parameter to be an expression rather than just a string to be evaluated or a boolean value to be tested.


<?php
ini_set('assert.exception', 1);

class CustomError extends AssertionError {}

assert(false, new CustomError('Some error message'));
?>

 

The above example will output:

Fatal error: Uncaught CustomError: Some error message

Full details on this feature, including how to configure it in both development and production environments, can be found in the expectations section of the assert() reference.
Group use declarations

Classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement.


<?php
// Pre PHP 7 code
use some\namespace\ClassA;
use some\namespace\ClassB;
use some\namespace\ClassC as C;

use function some\namespace\fn_a;
use function some\namespace\fn_b;
use function some\namespace\fn_c;

use const some\namespace\ConstA;
use const some\namespace\ConstB;
use const some\namespace\ConstC;

// PHP 7+ code
use some\namespace\{ClassA, ClassB, ClassC as C};
use function some\namespace\{fn_a, fn_b, fn_c};
use const some\namespace\{ConstA, ConstB, ConstC};
?>

Generator Return Expressions

This feature builds upon the generator functionality introduced into PHP 5.5. It enables for a return statement to be used within a generator to enable for a final expression to be returned (return by reference is not allowed). This value can be fetched using the new Generator::getReturn() method, which may only be used once the generator has finishing yielding values.


<?php

$gen = (function() {
    yield 1;
    yield 2;

    return 3;
})();

foreach ($gen as $val) {
    echo $val, PHP_EOL;
}

echo $gen->getReturn(), PHP_EOL;

The above example will output:

1
2
3

Being able to explicitly return a final value from a generator is a handy ability to have. This is because it enables for a final value to be returned by a generator (from perhaps some form of coroutine computation) that can be specifically handled by the client code executing the generator. This is far simpler than forcing the client code to firstly check whether the final value has been yielded, and then if so, to handle that value specifically.
Generator delegationGenerators can now delegate to another generator, Traversable object or array automatically, without needing to write boilerplate in the outermost generator by using the yield from construct.


<?php
function gen()
{
    yield 1;
    yield 2;
    yield from gen2();
}

function gen2()
{
    yield 3;
    yield 4;
}

foreach (gen() as $val)
{
    echo $val, PHP_EOL;
}
?>

The above example will output:

1
2
3
4

Integer division with intdiv()

The new intdiv() function performs an integer division of its operands and returns it.


<?php
var_dump(intdiv(10, 3));
?>

The above example will output:

int(3)

Session options

session_start() now accepts an array of options that override the session configuration directives normally set in php.ini.

These options have also been expanded to support session.lazy_write, which is on by default and causes PHP to only overwrite any session file if the session data has changed, and read_and_close, which is an option that can only be passed to session_start() to indicate that the session data should be read and then the session should immediately be closed unchanged.For example, to set session.cache_limiter to private and immediately close the session after reading it:

<?php
session_start([
    'cache_limiter' => 'private',
    'read_and_close' => true,
]);
?>
preg_replace_callback_array()

 

The new preg_replace_callback_array() function enables code to be written more cleanly when using the preg_replace_callback() function. Prior to PHP 7, callbacks that needed to be executed per regular expression required the callback function to be polluted with lots of branching.

Now, callbacks can be registered to each regular expression using an associative array, where the key is a regular expression and the value is a callback.
CSPRNG Functions

Two new functions have been added to generate cryptographically secure integers and strings in a cross platform way: random_bytes() and random_int().
list() can always unpack objects implementing ArrayAccess

Previously, list() was not guaranteed to operate correctly with objects implementing ArrayAccess. This has been fixed.

 

 

source: php.net

Add a comment
Previous Next

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

DIGITAL SCHOOL OF VIRTUAL AND OPEN LEARNING

i. INSTRUCTIONAL DESIGNER

ii. SYSTEMS ADMINISTRATOR

Applicants and Referees should write directly to:
Deputy Vice-Chancellor (Administration)
Kenyatta University
P. O. BOX 43844 – 00100
NAIROBI

Applications and letters from the referees should be received not later than,Wednesday,4th May 2016.

ENQUIRIES:
For details related to job specifications and general requirements, >>>Download the Job Advert with full description<<<
Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.
Women and persons with disability are encouraged to apply.

SCHOOL OF VISUAL AND PERFORMING ARTS

DEPARTMENT OF MUSIC AND DANCE

i. PART - TIME PIANO TUTOR
ii. PART - TIME BRASS AND WOODWIND TUTOR
iii. BRAILLE MUSIC INTERPRETER

The applicants should provide full details of educational and professional qualification, work experience, present post and salary, applicant’s telephone number and e-mail address.
Copies of certificates and testimonials should also be enclosed giving the names and addresses of three (3) referees who are conversant with the applicant’s competence in area of specialization.

Applicants and Referees should write directly to:
Deputy Vice-Chancellor (Administration)
Kenyatta University
P. O. BOX 43844 – 00100
NAIROBI

Applications and letters from the referees should be received not later than,Monday, 2nd May 2016.

ENQUIRIES:
For details related to job specifications and general requirements, >>>Download the Job Advert with full description<<<
Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.
Women and persons with disability are encouraged to apply.

Kenyatta University wishes to recruit qualified and dedicated applicants for vacant positions in the Department of Pathology in the School of Medicine:

SCHOOL OF MEDICINE

1. DEPARTMENT OF PATHOLOGY

1. ASSOCIATE PROFESSOR

AREA OF SPECIALIZATION

 MEDICAL PARASITOLOGY

2. LECTURER

AREAS OF SPECIALIZATION:

 HAEMATOLOGY

 CLINICAL CHEMISTRY

 ANATOMIC PATHOLOGY

3. TUTORIAL FELLOW

AREA OF SPECIALIZATION:

 MEDICAL MICROBIOLOGY

 IMMUNOLOGY

4. TECHNICIAN – GRADE C/D

AREA OF SPECIALIZATION:

 MICROBIOLOGY

5. TECHNICIAN – GRADE A/B

AREA OF SPECIALIZATION:

 HISTOPATHOLOGY

Applicants and Referees should write directly to:

Deputy Vice-Chancellor (Administration),
Kenyatta University,
P. O. BOX 43844 – 00100,
NAIROBI.

Applications and letters from the referees should be received not later than, Thursday 21st April 2016.
For details related to job specifications and general requirements, >>>Download the Job Advert with full description<<<
Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.
Women and persons with disability are encouraged to apply.

1. DEPARTMENT OF ELECTRICAL AND ELECTRONIC ENGINEERING
a) Programme: Biomedical Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Biomedical Instrumentation
 Bio-signals and systems
 Medical Imaging and Sensing
 Biomechanics

b) Programme: Electrical and Electronic Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Electronics and Microprocessors
 Electrical Machines
 Power Systems
 Telecommunications and Microwaves
 Control and Instrumentation

2. DEPARTMENT OF CIVIL ENGINEERING
Programme: Agricultural and Biosystems Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Farm Power and Machinery
 Soil and Water Resources
 Crop processing and Storage.
 Farm Structures and Environment
 Farm Electrification and IT

3. DEPARTMENT OF MECHANICAL ENGINEERING
a) Programme: Mechanical Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Solid (Applied Mechanics)
 Thermodynamics
 Fluid Mechanics
 Mechanics of Machines
 Materials

b) Programme: Aerospace Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Avionics
 Propulsion Engineering
 Airframe structures
 Flight Dynamics

4. DEPARTMENT OF GAS AND PETROLEUM ENGINEERING
Programme: Petroleum Engineering
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER

Areas of Specialization:
 Oil Field Engineering
 Oil-Gas Development Engineering
 Oil-Gas Drilling Engineering
 Petroleum Reservoir Engineering

Applicants and Referees should write directly to:

Deputy Vice-Chancellor (Administration),
Kenyatta University,
P. O. BOX 43844 – 00100,
NAIROBI.

Applications and letters from the referees should be received not later than, Monday, 11th April 2016.
For details related to job specifications and general requirements, >>>Download the Job Advert<<<
Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.
Women and persons with disability are encouraged to apply.

DIRECTORATE OF UNIVERSITY HEALTH SERVICES
1. DENTIST
2. COMMUNITY ORAL HEALTH OFFICER (COHO)
3. DENTAL LABORATORY TECHNICIAN

SUCCESSFUL APPLICANTS WILL BE REQUIRED TO WORK FULL TIME FOR THE UNIVERSITY.

Applicants and Referees should write directly to:
Deputy Vice-Chancellor (Administration)
Kenyatta University
P. O. BOX 43844 – 00100
NAIROBI

Applications and letters from the referees should be received not later than, Monday, 11th April 2016.

ENQUIRIES:
For details related to job specifications and general requirements, >>>Download this advert<<<

Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.

Women and persons with disability are encouraged to apply.

KENYATTA UNIVERSITY COMMERCIAL DAIRYTECH FARM ESTABLISHMENT
i. ASSISTANT FARM MANAGER - ANIMAL NUTRITION AND FEEDS
ii. ASSISTANT FARM MANAGER - CROPS SECTION
iii. TECHNICAL ASSISTANT – INSEMINATOR
iv. TECHNICAL ASSISTANT - FEEDS
v. MILKER
vi. TRACTOR DRIVER

Applicants and Referees should write directly to:

Deputy Vice-Chancellor (Administration),
Kenyatta University,
P. O. BOX 43844 – 00100,
NAIROBI.

Applications and letters from the referees should be received not later than, Monday, 11th April 2016.

ENQUIRIES
For details related to job specifications and general requirements, >>>>Download the Job Advert<<<<
Kenyatta University is an equal opportunity employer and canvassing will lead to automatic disqualification.
Women and persons with disability are encouraged to apply.

1. SCHOOL OF LAW
DEPARTMENT OF PUBLIC LAW
i. PROFESSOR
ii. ASSOCIATE PROFESSOR
iii. SENIOR LECTURER
iv. LECTURER
v. TUTORIAL FELLOW

2. SCHOOL OF AGRICULTURE & ENTERPRISE DEVELOPMENT
i. ASSOCIATE PROFESSOR - VETERINARY MEDICINE
ii. SENIOR LECTURER - VETERINARY MEDICINE
iii. LECTURER

Areas of specialization:
 Livestock Production Systems
 Animal Genetics and Breeding
 Animal Nutrition and Management
 Veterinary Clinical Medicine
 Dryland Crop Production
 Agricultural Engineering

iv. TUTORIAL FELLOW
Areas of specialization:
 Veterinary Clinical Medicine
 Animal Breeding
 Agricultural Education
 Dryland Crop Production
 Agricultural Extension

3. FINANCE DEPARTMENT:
i. SENIOR ACCOUNTS ASSISTANT - GRADE C/D
ii. ACCOUNTS ASSISTANT – GRADE A/B
iii. ACCOUNTS CLERK – GRADE III/IV

4. SCHOOL OF HUMANITIES AND SOCIAL SCIENCES
DEPARTMENT OF PUBLIC POLICY AND ADMINISTRATION
i. LECTURER
Areas of specialization:
 Strategic Management
 Organizational Leadership
 Public Policy
 Political Science
 International Relations

 

 

See more at http://www.ku.ac.ke/index.php/job-opportunities

Add a comment
Tags:
Previous Next

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

What is Web Caching

Web caching is a way of improving server performance by allowing commonly requested content to be stored in an easier to access location. This allows the visitor to access the content faster instead of having to fetch the same data multiple times.

By effectively creating caching rules, content that is suitable for caching will be stored to conserve resources, while highly-dynamic content will be served normally. In this guide, we will be discussing how to configure Apache using its caching modules.

Note: This guide was written with Apache 2.2 in mind. Changes to Apache 2.4 have lead to the replacement of some of the modules discussed in this guide. Due to this consideration, not all of the steps recommended below will work on Apache 2.4 installations.
An Introduction to Caching in Apache

Apache has a number of different methods of caching content that is frequently accessed. The two most common modules that enable this functionality are called "mod_cache" and "mod_file_cache".
The mod_file_cache Module

The mod_file_cache module is the simpler of the two caching mechanisms. It works by caching content that:

Is requested frequently
Changes very infrequently

If these two requirements are met, then mod_file_cache may be useful. It works by performing some of the file access operations on commonly used files when the server is started.
The mod_cache Module

The mod_cache module provides HTTP-aware caching schemes. This means that the files will be cached according to an instruction specifying how long a page can be considered "fresh".

It performs these operations using either the "mod_mem_cache" module or the "mod_disk_cache" modules. These are more complex caching models than mod_file_cache and are more useful in most circumstances.
Using mod_file_cache with Apache

The mod_file_cache module is useful to cache files that will not change for the life of the current Apache instance. The techniques used with this module will cause any subsequent changes to not be applied until the server is restarted.

These caching mechanisms can only be used with normal files, so no dynamically generated content or files generated by special content handlers will work here.

The module provides two directives that are used to accomplish caching in different ways.
MMapFile

MMapFile is a directive used to create a list of files and then map those files into memory. This is done only at server start up, so it is essential that none of the files set to use this type of caching are changed.

You can set up this type of caching in the server configuration file. This is done by specifying files to be cached in memory in a space-separated list:

MMapFile /var/www/index.html /var/www/otherfile.html var/www/static-image.jpg

These files will be held in memory and served from there when the resource is requested. If any of the files are changed, you need to restart the server.
CacheFile

This directive works by opening handles to the files listed. It maintains a table of these open file descriptors and uses it to cut time it takes to open these files.

Again, changes to the file during operation of the server will not be recognized by the cache. The original contents will continue to be served until the server is restarted.

This directive is used by specifying a space-separated list of files that should be cached with this method:

CacheFile /this/file.html that/file.html another/file/to/server.html

This will cause these files to be cached on server start.
Using mod_cache with Apache

The mod_cache module is a more flexible and powerful caching module. It functions by implementing HTTP-aware caching of commonly accessed files.

While all caching mechanisms rely on serving files in some persistent state, mod_cache can handle changing content by configuring how long a file is valid for caching.

The module relies on two other modules to do the majority of the cache implementation. These are "mod_disk_cache" and "mod_mem_cache".

The difference between these two is where the cache is kept, either on disk or in memory respectively. These are stored and retrieved using URI based keys. This is important to note as you can improve the caching of your site by turning on canonical naming.

This can be accomplished by putting this directive in the server configuration or virtual host definition:

UseCanonicalName On

How to Configure Caching

We will examine some common configuration directives and how they affect the functionality of the caching mechanisms.

If you look in the "/etc/apache2/mods-available" directory, you can see some of the default configuration files for these modules.
Configuring mod_mem_cache

Let's look at the mod_mem_cache configuration:

sudo nano /etc/apache2/mods-available/mem_cache.conf

CacheEnable mem /
MCacheSize 4096
MCacheMaxObjectCount 100
MCacheMinObjectSize 1
MCacheMaxObjectSize 2048

These directives are only read if the mod_mem_cache module is loaded. This can be done by typing the following:

sudo a2enmod mem_cache
sudo service apache2 restart

This will enable mod_mem_cache and also mod_cache.

CacheEnable mem /

The "CacheEnable mem /" line tells apache to create a memory cache for contents stored under "/" (which is everything).

MCacheSize 4096
MCacheMaxObjectCount 100

The next few lines describe the total size of the cache and the kinds of objects that will be stored. The "MCacheSize" directive and the "MCacheMaxOjectCount" directive both describe the maximum size of the cache, first in terms of memory usage, and then in terms of the maximum amount of objects.

MCacheMinObjectSize 1
MCacheMaxObjectSize 2048

The next two lines describe the kinds of data that will be cached, in terms of memory usage. The default values specify that files between 1 byte and 2 kilobytes will be considered for caching.
Configuring mod_disk_cache

We can learn about a different set of directives by examining the mod_disk_cache configuration file:

sudo nano /etc/apache2/mods-available/disk_cache.conf

CacheRoot /var/cache/apache2/mod_disk_cache
#CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3

This configuration is loaded if you enable the mod_disk_cache module, which can be done by typing:

sudo a2enmod disk_cache
sudo service apache2 restart

This command will also enable mod_cache in order to work properly.

CacheRoot /var/cache/apache2/mod_disk_cache
#CacheEnable disk /

The "CacheRoot" directive specifies where the cached content will be kept. The "CacheEnable disk /" directive is disabled by default. It is suggested that you enable this on a virtual host basis to get a better idea of what will be cached.

CacheDirLevels 5
CacheDirLength 3

The other two directives determine the caching structure within the cache root. Each cached element is hashed by the its URL, and then the hash is used as a filename and directory path.

The CacheDirLevel decides how many directories to create from the hash string and the CacheDirLength decides how many characters are in each directory name.

For example, if you have a file that hashes to "abcdefghijklmnopqrstuvwxyz", then a CacheDirLevel of 2 and a CacheDirLength of 4 would lead to this file being stored in:

[path_of_cache_root]/abcd/efgh/ijklmnopqrstuv

Caching that is stored on disk can become large depending on the expiration dates of the content. Apache includes a tool called "htcacheclean" to pare the cache down to a configured size. This is outside the scope of this guide.
Using CacheLock to Avoid Overwhelming the Backend

A problem can arise on a busy server when a cached resource expires.

The cache that needs to be refreshed will have to refetch the file from the normal file resource. During this time, if there are more requests for the file. This can create a huge spike in requests to the backend server as the cached version is being refreshed.

To avoid this situation, it is possible to enable a lock file that indicates that the resource is being recached and that subsequent requests should not go to the backend, because the issue is being addressed.

This lock can prevent apache from trying to cache the same resource multiple times when first caching. It also will serve the stale resource until the refreshed cache is complete.

Three directives are used to control CacheLock:

CacheLock [ On | Off ]
CacheLockMaxAge [time_in_seconds]
CacheLockPath [/path/to/lock/directory]

The first directive turns on the feature and the third directive establishes the directory where resource locks will be created.

The second directive, CacheLockMaxAge, is used to establish the longest time in seconds that a lock file will be considered valid. This is important in case there is a failure or an abnormal delay in refreshing a resource.
Conclusion

Caching in Apache can be simple or involved depending on your needs. While any kind of caching can improve your site performance, it is important to test your configurations to ensure that they are operating correctly.

It is also essential that you are familiar with the repercussions of improperly configured caching. It is sometimes necessary to re-evaluate your security practices after implementing caching to ensure that private resources are not accidentally being cached for public consumption.

The apache user documentation has plenty of information about how to configure caching if you get stuck. Even if you have a handle on the configuration, it is a helpful reference and good resource.

 

source: https://www.digitalocean.com/community/tutorials/how-to-configure-content-caching-using-apache-modules-on-a-vps

Add a comment

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

ubuntu-16.04

Ubuntu hasn’t had the best reputation among Linux users over the past few years–with some even going so far as to call it “boring”. If you’ve been hesitant to try it out, then hold on to your seats–Ubuntu 16.04 “Xenial Xerus” is not only an exciting release, but one that has the potential to be a game changer for the Linux ecosystem.

Ubuntu first leaped into the Linux world in 2004 and with it, completely changing the face of Linux taking it from the days of “only usable by experienced geeks” to the era of “Linux for Human Beings”. Now, 12 years later, they just might be on the verge of repeating that lightning in a bottle that took it from a brand new small project to becoming the most popular distribution of Linux. Ubuntu 16.04 was released today, and with it comes a ton of improvements throughout the distro. There are many changes that improve the usability and experience for the end user as well as potential landmark changes that might pique the interest of even the most skeptical of developers.

The Unity Launcher Can Be Moved to the Bottom of Your Screen

ubuntu-16-05-unity-launcher-bottom

Thanks to the Ubuntu Kylin team, users can now attach the Unity Launcher to the bottom of their screen instead of having to be forced to always have it on the left side. Believe it or not, it’s taken almost 6 years to get this basic feature.

There are a couple of ways to accomplish this, but the easiest way is through one command in the Terminal (though admittedly a fairly long command). Open up your terminal with Ctrl+Alt+T or from the Dash and run the following:

gsettings set com.canonical.Unity.Launcher launcher-position Bottom

You can also revert back to the Left side if you decide later that you don’t like it by running:

gsettings set com.canonical.Unity.Launcher launcher-position Left

That’s all it takes.

Online Dash Results Are Off by Default, and Updates to the “apt” Command

ubuntu-16.04-dash-no-ads

There has been quite a bit of controversy for a couple of years over the online search results in Ubuntu’s Dash. Some people even went so far as to (inaccurately) call them “spyware”. Ubuntu 16.04 puts an end to that controversy by disabling the results by default.

GNOME Software Replaces Ubuntu Software Center

ubuntu-16.04-software-calendar

The Ubuntu Software Center was another blemish on Ubuntu’s name. It was slow, unreliable, and the overall user experience was lacking. Ubuntu 16.04 address this issue by replacing the Ubuntu Software Center with GNOME’s Software solution. Ubuntu adopting GNOME Software is a great sign of more community involvement from Canonical, and that they’re willing to include an alternative piece of software if it’s better overall.

Similarly, Canonical adopted a new Calendar app in Ubuntu 16.04–just another way they’re adopting better software from the GNOME project.

If you’re more of a terminal junkie, 16.04 also adds new features to the “apt” command so you can simplify your command-line package management even further than before. Ubuntu 16.04 sees the addition of apt autoremove which replaces apt-get autoremove and apt purge package(s) which replaces apt-get purge package(s).

Unity 7.4 Is the Smoothest Unity Experience Yet

ubuntu-16.04-unity-7.4

I’ve been testing Ubuntu 16.04 and Unity 7.4 for quite some time now and I have to say, Unity 7.4 is by far the smoothest and best Unity experience I’ve had. I was a hold out for the days of 12.04’s Qt-based Unity, but I’m glad to see that Ubuntu 16.04 has adopted its best features. Here are the most notable changes arriving in Unity 7.4:

  • Shortcuts for Session Management such as restart, shutdown, etc from the Unity Dash
  • Icons appear in launcher while loading applications
  • Ability to move the Unity launcher to the bottom of the screen
  • Online Dash Results are disabled by default
  • App Menus can now be set to ‘Always Show’
  • New scroll bars in Unity Dash
  • External storage/Trash now display number of windows open
  • Quicklist (Jumplist) added to Workspace Switcher
  • Ability to Format a drive within a Unity Quicklist (great time saver but be careful)
  • Alt+{num} can now be used to open External storage items similar to Logo+{num} for opening applications
  • Ubuntu themes have improved Client Side Decorations support.

That’s a lot of good stuff.

ZFS Is Supported by Default in Ubuntu 16.04

ZFS is a very popular filesystem due to its reliability with large data sets, and it has been a very hot topic for the Linux community for years. Canonical has decided that ZFS support is necessary, so Ubuntu 16.04 has added support for ZFS by default. ZFS is not enabled by default, however, which is intentional. Since ZFS is not necessary for the majority of users, it fits best in large scale deployments. So while this is very cool, it’s not going to affect most people.

Ubuntu Snappy Has Potential to Change the Landscape of Linux

ubuntu-16.04-snappy

Finally, Ubuntu 16.04 introduces Ubuntu Snappy to the desktop, a brand new package management solution that has potential to change the landscape of Linux.

Linux-based operating systems come with many different types of release structures, but the two most common are Fixed Releases (aka stable releases) and Rolling Releases. Both of these common structures have pros and cons: Fixed Releases give you rock solid base system, but often with outdated applications that have to be supplemented with something like PPAs. Rolling Releases get you the software updated as soon as possible, whenever a new version is released–along with all of the latest bugs. Ubuntu Snappy is a new release structure that has all of the benefits of both systems combined into one.

Think of Snappy as an alternative to .deb files and PPAs. It’s a new form of app distribution that lets developers send you the latest version of their apps–in the form of “snaps”–as soon as they’re ready. They’re much easier and quicker for developers to push out, and you–the user–don’t have to go hunting for a PPA if the app isn’t included with Ubuntu’s default repository packages. And, if one release is buggy, it’s very easy to roll back to the last stable version.

In addition, snaps install differently than the traditional .deb files you’re used to. Snaps install as “read-only” mountable image based applications, which means you don’t have to worry about whether an app was packaged for Ubuntu 16.04, 16.10, or any other version–that Snap will work on any version of Ubuntu that supports Snaps.

Snappy on the Desktop is still in the early stages, so you won’t be switching to snaps entirely with Ubuntu 16.04. But the groundwork has been laid, and snaps should start to become more common over time. In fact, Ubuntu will be releasing a “Snap Store” of sorts in the future, likely using GNOME Software, making it easier to discover and install apps using Snappy.

Oh Snap! Excitement Is in the Air

I don’t think I’ve been more excited for a new release of Ubuntu since I first started using Linux, many years ago. The potential of Ubuntu Snappy alone has me smiling as I write this very paragraph, but add that to the rest of the changes coming in Ubuntu 16.04 and I’d say Ubuntu has become anything but boring. What do you think of this new release? Is my excitement contagious? Will you be giving Ubuntu 16.04 a try? Let me know in the comments thread.

 

source: http://www.howtogeek.com/251647/ubuntu-16.04-makes-ubuntu-exciting-again

Add a comment

About Me

Oops...Almost forgot to say something about me. But anyway, I'm that guy, yule Msee, who'll sort out your techie issue and hails from the land of milk and honey. Not forgetting the bitter herbs too.

This is what am best at. Feel free to ask something. 

Latest News

Latest Tweets

Search

Loading