Skip to content

Instantly share code, notes, and snippets.

<?php
function fun() {return (3.75*0.12345*12345*9.999);};
function test() {
$start = microtime(true);
$s = 'php';
for ($i = 0; $i < call_user_func('fun'); $i += (0.5 + 0.5)) {
$s = preg_replace('#[02468]#', 'X', sha1(md5($s)));
}
return microtime(true) - $start;
@vojkny
vojkny / benchmark.php
Created August 20, 2011 18:37
benchmark.php
<?php
// to be run from commandline with apache benchmarking tool 'ab' as:
// $ ab -n 100 http://site/benchmark.php
function test() {
function fun() {return (3.75*0.12345*12345*9.999);};
$start = microtime(true);
$s = 'php';
for ($i = 0; $i < call_user_func('fun'); $i += (0.47373 + 2494.9999%2494.5555)) {
<?php
/**
* This source file is subject to the "New BSD License".
*
* For more information please see http://nette.org
*
* @author Vojtěch Knyttl
* @copyright Copyright (c) 2010 Vojtěch Knyttl
* @license New BSD License
* @link http://tabella.knyt.tl/
@vojkny
vojkny / string.php
Created January 15, 2012 02:02
Maite\String
<?php
namespace Maite;
class String {
/** @var string */
protected static $classInjection = 'Maite\Utils\Strings';
/** @var string */
Jan 22, 2012 5:47:35 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000046: Connection properties: {user=postgres, password=****}
Jan 22, 2012 5:47:36 PM org.hibernate.dialect.Dialect <init>
INFO: HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
Jan 22, 2012 5:47:36 PM org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation
INFO: HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
Jan 22, 2012 5:47:36 PM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService
INFO: HHH000399: Using default transaction strategy (direct JDBC transactions)
Jan 22, 2012 5:47:36 PM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>
INFO: HHH000397: Using ASTQueryTranslatorFactory
@vojkny
vojkny / gist:1676280
Created January 25, 2012 13:35
persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="org.knyttl" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<!--<provider>org.hibernate.ejb.HibernatePersistence</provider>-->
@vojkny
vojkny / gist:1676282
Created January 25, 2012 13:35
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.knyttl.app</groupId>
<artifactId>knyttl</artifactId>
<packaging>jar</packaging>
<version>+.0</version>
<name>Knyttl</name>
<url>http://knyt.tl</url>
@vojkny
vojkny / gist:1754951
Created February 6, 2012 21:18
Exception
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -DSTOP.PORT=0 -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DOPTIONS=jmx -Didea.launcher.port=7541 "-Didea.launcher.bin.path=/Applications/IntelliJ IDEA 11.app/bin" -Dfile.encoding=MacRoman -classpath "start.jar:/Applications/IntelliJ IDEA 11.app/lib/idea_rt.jar" com.intellij.rt.execution.application.AppMain org.eclipse.jetty.start.Main /private/var/folders/w1/kl5dwvcd7f7fw2yfzny34sx00000gn/T/context2999229479106151724config/contexts-config.xml
[2012-02-05 08:58:59,253] Artifact goout:war exploded: Server is not connected. Press 'Deploy' to start deployment.
52450
STOP.KEY=cl4x4us1afwg
2012-02-05 20:59:00.611:WARN:oejx.XmlConfiguration:Config error at <Ref id="DeploymentManager"><Call name="addAppProvider"><Arg>| <New class="org.eclipse.jetty.deploy.providers.ContextProvider"><Set name="monitoredDirName"><P
/* what I would like to achieve: */
public interface ItemRepository<T> {
@Query("select distinct a from " + TABLE_NAME + " a " + "join ti.tags tt where tt = ?1")
public List<T> findByTag(Tag t); }
}
public interface AaaaRepository extends ItemRepository<Aaaa> {
TABLE_NAME = "Aaaa";
}
@vojkny
vojkny / gist:1847994
Created February 16, 2012 21:28
Deploying Tomcat
/usr/local/tomcat7/bin/catalina.sh run
Feb 16, 2012 10:10:12 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /Applications/IntelliJ IDEA 11.app/Contents/Resources/Java:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources:/Users/knyttl/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Feb 16, 2012 10:10:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Feb 16, 2012 10:10:12 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Feb 16, 2012 10:10:12 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1125 ms
Feb 16, 2012 10:10:12 PM org.apache.catalina.core.StandardService startInternal