Tutorial by Examples

import Test.Tasty import Test.Tasty.SmallCheck as SC import Test.Tasty.QuickCheck as QC import Test.Tasty.HUnit main :: IO () main = defaultMain tests tests :: TestTree tests = testGroup "Tests" [smallCheckTests, quickCheckTests, unitTests] smallCheckTests :: TestTree smal...
First, Install Java SE Development Kit This can be as simple as downloading, double-clicking on the downloaded file, and following the installation instructions. For install Java SE Development Kit download it from official web site. Java SE Development Kit. Downloads After JDK install is complete...
Nobody wants to require or include every time a class or inheritance is used. Because it can be painful and is easy to forget, PHP is offering so called autoloading. If you are already using Composer, read about autoloading using Composer. What exactly is autoloading? The name basically says it al...
Only the homepage works, all other pages return 404 Make sure mod_rewrite module has been installed in Apache and been enabled to load. See step 2 for info on how to do this here: https://www.digitalocean.com/community/tutorials/how-to-set-up-mod_rewrite-for-apache-on-ubuntu-14-04 Make sure the y...
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
Mage::getBaseUrl();
$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
$this->getSkinUrl('images/imagename.jpg');
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);
Mage::helper('core/url')->getCurrentUrl();
<?php class MyClass { ... } class OtherClass { ... } ?> Any class that has the same name as it's file name will be auto loaded by Silverstripe. OtherClass will be loaded too because it is in a file which is being read. MyPage.php <?php class MyPage_Controller e...
Profiling string concatanation: In [1]: import string In [2]: %%timeit s=""; long_list=list(string.ascii_letters)*50 ....: for substring in long_list: ....: s+=substring ....: 1000 loops, best of 3: 570 us per loop In [3]: %%timeit long_list=list(string.ascii_letters)*50...
Profiling repetition of elements in an array >>> import timeit >>> timeit.timeit('list(itertools.repeat("a", 100))', 'import itertools', number = 10000000) 10.997665435877963 >>> timeit.timeit('["a"]*100', number = 10000000) 7.118789926862576
Profiling concatanation of numbers python -m timeit "'-'.join(str(n) for n in range(100))" 10000 loops, best of 3: 29.2 usec per loop python -m timeit "'-'.join(map(str,range(100)))" 100000 loops, best of 3: 19.4 usec per loop
The source code with @profile directive before the function we want to profile: import requests @profile def slow_func(): s = requests.session() html=s.get("https://en.wikipedia.org/").text sum([pow(ord(x),3.1) for x in list(html)]) for i in range(50): s...
Editing the width of Separator Lines You can set make your table view's separator lines extend the to various widths across the table by changing the layoutMargins: property on your cell(s). This can be achieved in a number of ways. Changing the Separator Lines for specific cells In either your t...
Description An image maps is an image with clickable areas that usually act as hyperlinks. The image is defined by the <img> tag, and the map is defined by a <map> tag with <area> tags to denote each clickable area. Use the usemap and name attributes to bind the image and the map...
The var keyword allows a programmer to implicitly type a variable at compile time. var declarations have the same type as explicitly declared variables. var squaredNumber = 10 * 10; var squaredNumberDouble = 10.0 * 10.0; var builder = new StringBuilder(); var anonymousObject = new { One =...

Page 510 of 1336