fsockopen
(PHP 4, PHP 5, PHP 7)
fsockopen — 打开一个网络连接或者一个Unix套接字连接
说明
resource fsockopen ( string $hostname [, int $port = -1 [, int &$errno [,
string &$errstr [, float $timeout = ini_get("default_socket_timeout") ]]]] )
初始化一个套接字连接到指定主机（hostname）。
PHP支持以下的套接字传输器类型列表所支持的套接字传输器（Socket Transports）列表
。也可以通过stream_get_transports()来获取套接字传输器支持类型。
默认情况下将以阻塞模式开启套接字连接。当然你可以通过stream_set_blocking()将它转
换到非阻塞模式。
stream_socket_client()与之非常相似，而且提供了更加丰富的参数设置，包括非阻塞模
式和提供上下文的的设置。
参数
hostname
如果安装了OpenSSL，那么你也许应该在你的主机名地址前面添加访问协议ssl://或者
是tls://，从而可以使用基于TCP/IP协议的SSL或者TLS的客户端连接到远程主机。
port
端口号。如果对该参数传一个-1，则表示不使用端口，例如unix://。
errno
如果传入了该参数，holds the system level error number that occurred in the
system-level connect() call。
如果errno的返回值为0，而且这个函数的返回值为FALSE，那么这表明该错误发生在套
接字连接（connect()）调用之前，导致连接失败的原因最大的可能是初始化套接字的
时候发生了错误。
errstr
错误信息将以字符串的信息返回。
timeout
设置连接的时限，单位为秒。
Note:
注意：如果你要对建立在套接字基础上的读写操作设置操作时间设置连接时限，
请使用stream_set_timeout()，fsockopen()的连接时限（timeout）的参数仅仅
在套接字连接的时候生效。
返回值
fsockopen()将返回一个文件句柄，之后可以被其他文件类函数调用（例如：fgets()，
fgetss()，fwrite()，fclose()还有feof()）。如果调用失败，将返回FALSE。
错误／异常
如果主机（hostname）不可访问，将会抛出一个警告级别（E_WARNING）的错误提示。
更新日志
版本 说明
4.3.0 在win32系统上增加了对时限设置（timeout）参数的支持。
4.3.0 在TCP/IP协议的基础上增加了SSL和TLS。
范例
Example #1 fsockopen()的例子
\n";
} else {
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: www.example.com\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
?>
Example #2 使用UDP连接
下面这个例子展示了怎么样在自己的机器上通过UDP套接字连接（端口号13）来检索日期和
时间。
\n";
} else {
fwrite($fp, "\n");
echo fread($fp, 26);
fclose($fp);
}
?>
注释
Note:
因为环境的不同，某些情况下在Unix套接字连接或者自定义的连接设置连接时限（
timeout）可能不会生效。
Warning
UDP套接字有些时候在即使远程主机未知的情况，也能打开，并且不发生任何错误。只有当
你通过该套接字进行读写的时候才会发现错误。之所以会这样，是因为UDP是一个“非连接
状态”的协议，那么这就意味着当前操作系统直到它（套接字）真正需要发送和接受数据的
时候才会去尝试为其去建立连接。
Note: 当指定数值型的 IPv6 地址（例如 fe80::1）时必须用方括号将 IP 围起来——
例如， tcp://[fe80::1]:80。
参见
• pfsockopen() - 打开一个持久的网络连接或者Unix套接字连接。
• stream_socket_client() - Open Internet or Unix domain socket connection
• stream_set_blocking() - 为资源流设置阻塞或者阻塞模式
• stream_set_timeout() - Set timeout period on a stream
• fgets() - 从文件指针中读取一行
• fgetss() - 从文件指针中读取一行并过滤掉 HTML 标记
• fwrite() - 写入文件（可安全用于二进制文件）
• fclose() - 关闭一个已打开的文件指针
• feof() - 测试文件指针是否到了文件结束的位置
• socket_connect() - 开启一个套接字连接
• The Curl extension
User Contributed Notes 67 notes
===============================================================================
This script checks specific ports so you need to have the correct port open on
the server for this to work.
E.g if i have a windows domain controller and it is servering LDAP then the
following would be used to check it is online:
for a webserver:
etc etc
--------------------------------------------------------
===============================================================================
It appears that in PHP 5.6.0 (at least the version in Debian jessie, with
openssl 1.0.1h-3), this function *is* now validating SSL certificates (in a
variety of ways). First, it appears to fail for untrusted certificates (i.e. no
matching CA trusted locally), and secondly, it appears to fail for mismatched
hostnames in the request and certificate.
---------
$ echo "" | php -a
Interactive mode enabled
PHP Warning: fsockopen(): Peer certificate CN=`my.test.server' did not match
expected CN=`localhost' in - on line 1
PHP Warning: fsockopen(): Failed to enable crypto in - on line 1
PHP Warning: fsockopen(): unable to connect to ssl://localhost:993 (Unknown
error) in - on line 1
----------
$ echo "" | php -a
Interactive mode enabled
PHP Warning: fsockopen(): SSL operation failed with code 1. OpenSSL Error
messages:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify
failed in - on line 1
PHP Warning: fsockopen(): Failed to enable crypto in - on line 1
PHP Warning: fsockopen(): unable to connect to ssl://my.test.server:993
(Unknown error) in - on line 1
---------
#installed CA locally
---------
$ echo "" | php -a
Interactive mode enabled
Resource id #1
===============================================================================
To check if a Url is Online (with http and https)
Using @fgets to hide Warning when using SSL
(Bug: "Warning: function.fgets SSL: fatal protocol error", http://bugs.php.net/
bug.php?id=23220)
===============================================================================
A simple proxy list checker. You can check a list ip:port if that port is
opened on that IP.
'; // Show the proxy
fclose($con); // Close the socket handle
}
}
fclose($fisier); // Close the file
?>
===============================================================================
This is a very fast program for test a form or link (many times).
'somevalue',
'get_field_2' => 'somevalue' );
// Setup an array of fields to post with then create the post string
$posts = array ( 'post_field_1' => 'somevalue',
'post_field_2' => 'somevalue' );
// That's all. Now the program proccess $repeat times
$method = "GET";
if ( is_array( $gets ) ) {
$getValues = '?';
foreach( $gets AS $name => $value ){
$getValues .= urlencode( $name ) . "=" . urlencode( $value ) . '&';
}
$getValues = substr( $getValues, 0, -1 );
} else {
$getValues = '';
}
if ( is_array( $posts ) ) {
foreach( $posts AS $name => $value ){
$postValues .= urlencode( $name ) . "=" . urlencode( $value ) . '&';
}
$postValues = substr( $postValues, 0, -1 );
$method = "POST";
} else {
$postValues = '';
}
$request = "$method $target$getValues HTTP/1.1\r\n";
$request .= "Host: $host\r\n";
$request .= 'User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) ';
$request .= "Gecko/20021204\r\n";
$request .= 'Accept: text/xml,application/xml,application/xhtml+xml,';
$request .= 'text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,';
$request .= "image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1\r\n";
$request .= "Accept-Language: en-us, en;q=0.50\r\n";
$request .= "Accept-Encoding: gzip, deflate, compress;q=0.9\r\n";
$request .= "Accept-Charset: ISO-8859-1, utf-8;q=0.66, *;q=0.66\r\n";
$request .= "Keep-Alive: 300\r\n";
$request .= "Connection: keep-alive\r\n";
$request .= "Referer: $referer\r\n";
$request .= "Cache-Control: max-age=0\r\n";
if ( $method == "POST" ) {
$lenght = strlen( $postValues );
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$request .= "Content-Length: $lenght\r\n";
$request .= "\r\n";
$request .= $postValues;
}
for ( $i = 0; $i < $repeat; $i++ ) {
$socket = fsockopen( $server, $port, $errno, $errstr, $timeout );
fputs( $socket, $request );
if ( $size > 0 ) {
$ret = fgets( $socket, $size );
} else {
$ret = '';
while ( !feof( $socket ) ) {
$ret .= fgets( $socket, 4096 );
}
}
fclose( $socket );
echo "
$i -- $content $ret";
}
?>
Alejandro Salamanca
===============================================================================
Make sure you don't use a double line break ("\r\n\r\n") during the middle of
your header, as it appears to end the header.
This means a \r\n\r\n before "Connection: close\r\n\r\n" will not correctly
tell fsockopen to close the request, leading to a max timeout error.
Some of the code on this page does this. It took me days to figure out.
Example:
===============================================================================
note:
the default protocol - if not given - seems to be tcp://
===============================================================================
I have found, when using fsockopen() and the POST method, that using HTTP/1.1
is VERY significantly slower than HTTP/1.0 (at least for the server I'm
querying, an Orion-based server). Also, using cURL tended to be faster than
fsockopen(), though only slightly. For example, here was a recent set of data
(for the same exact request in each case):
cURL: 4.2sec
fsockopen() HTTP/1.0: 4.9sec
fsockopen() HTTP/1.1: 19.9sec (!)
I'm not sure why this was occurring. Perhaps it has something to do with the
Orion server, which I have little experience with. However, it was not a fluke,
and I double-checked the code to make sure there were no errors.
EDITORS NOTE: HTTP/1.1 uses persistent connection causing this delay. Use
"Connection: close" header to disable it.
===============================================================================
Improved HTTP/1.1 chunked transfer-encoding example.
The sample code given below by Jack does not function correctly when run
against a recent version of Apache (I'm assuming that this did once work, but
from the HTTP/1.1 spec I can only assume if it did work it was based mostly on
luck).
Richard.
===============================================================================
just a quick note for users attempting https and thinking they must resort to
curl or alternate methods -
you can use fsockopen, just read the docs closely. basically they are saying
to use 'ssl://' for a HTTPS (SSL) web request.
so this would work for authorize.net, and others; even for that paypal IPN -
however I think it would be best to leave the site and deal with paypal's form:
"somevalue");
//build the post string
foreach($formdata AS $key => $val){
$poststring .= urlencode($key) . "=" . urlencode($val) . "&";
}
// strip off trailing ampersand
$poststring = substr($poststring, 0, -1);
$fp = fsockopen("ssl://".$host, $port, $errno, $errstr, $timeout = 30);
if(!$fp){
//error tell us
echo "$errstr ($errno)\n";
}else{
//send the server request
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($poststring)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $poststring . "\r\n\r\n");
//loop through the response from the server
while(!feof($fp)) {
echo fgets($fp, 4096);
}
//close fp - we are done with it
fclose($fp);
}
?>
===============================================================================
This is a simple example for sending and retrieve SOAP message by using
fsockopen:
\n";
} else {
$soap_out = "POST /example/exampleServer.php HTTP/1.0\r\n";
$soap_out .= "Host: www.example.com\r\n";
$soap_out .= "User-Agent: MySOAPisOKGuys \r\n";
$soap_out .= "Content-Type: text/xml; charset=ISO-8859-1\r\n";
$soap_out .= "Content-Length: 512\r\n\r\n";
$soap_out .= '
<__numeric_0>
';
fputs($fp, $soap_out, strlen($soap_out)); // send request SOAP
echo "".$out."";
while (!feof($fp)) {
$soap_in . = fgets($fp, 100);
}
echo "$soap_in"; //display response SOAP
fclose($fp);
}
?>
And this is an example result:
POST /soap/example/contactServer.php HTTP/1.0
Host: www.example.com
User-Agent: MySOAPisOKGuys
Content-Type: text/xml; charset=ISO-8859-1
Content-Length: 512
<__numeric_0>
HTTP/1.1 200 OK
Date: Thu, 06 Apr 2006 07:03:26 GMT
Server: Apache/1.3.23 (Win32)
X-Powered-By: PHP/4.1.1
X-SOAP-Server: MySOAPisOKGuys
Content-Length: 625
Connection: close
Content-Type: text/xml; charset=ISO-8859-1
===============================================================================
";
srand((double)microtime()*1000000);
$boundary = "---------------------------".substr(md5(rand(0,32000)),0,10);
$data = "--$boundary";
for($i=0;$i
===============================================================================
Here is my fsockopen-based HTTP request fonction (GET and POST) :
'val1',
'var2' => 'val2') */
$postdata = array(), /* HTTP POST Data ie. array('var1' => 'val1',
'var2' => 'val2') */
$cookie = array(), /* HTTP Cookie Data ie. array('var1' => 'val1',
'var2' => 'val2') */
$custom_headers = array(), /* Custom HTTP headers ie. array('Referer: http:
//localhost/ */
$timeout = 1, /* Socket timeout in seconds */
$req_hdr = false, /* Include HTTP request headers */
$res_hdr = false /* Include HTTP response headers */
)
{
$ret = '';
$verb = strtoupper($verb);
$cookie_str = '';
$getdata_str = count($getdata) ? '?' : '';
$postdata_str = '';
foreach ($getdata as $k => $v)
$getdata_str .= urlencode($k) .'='. urlencode($v) . '&';
foreach ($postdata as $k => $v)
$postdata_str .= urlencode($k) .'='. urlencode($v) .'&';
foreach ($cookie as $k => $v)
$cookie_str .= urlencode($k) .'='. urlencode($v) .'; ';
$crlf = "\r\n";
$req = $verb .' '. $uri . $getdata_str .' HTTP/1.1' . $crlf;
$req .= 'Host: '. $ip . $crlf;
$req .= 'User-Agent: Mozilla/5.0 Firefox/3.6.12' . $crlf;
$req .= 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;
q=0.8' . $crlf;
$req .= 'Accept-Language: en-us,en;q=0.5' . $crlf;
$req .= 'Accept-Encoding: deflate' . $crlf;
$req .= 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' . $crlf;
foreach ($custom_headers as $k => $v)
$req .= $k .': '. $v . $crlf;
if (!empty($cookie_str))
$req .= 'Cookie: '. substr($cookie_str, 0, -2) . $crlf;
if ($verb == 'POST' && !empty($postdata_str))
{
$postdata_str = substr($postdata_str, 0, -1);
$req .= 'Content-Type: application/x-www-form-urlencoded' . $crlf;
$req .= 'Content-Length: '. strlen($postdata_str) . $crlf . $crlf;
$req .= $postdata_str;
}
else $req .= $crlf;
if ($req_hdr)
$ret .= $req;
if (($fp = @fsockopen($ip, $port, $errno, $errstr)) == false)
return "Error $errno: $errstr\n";
stream_set_timeout($fp, 0, $timeout * 1000);
fputs($fp, $req);
while ($line = fgets($fp)) $ret .= $line;
fclose($fp);
if (!$res_hdr)
$ret = substr($ret, strpos($ret, "\r\n\r\n") + 4);
return $ret;
}
?>
Example usages :
'v_get1'), array(), array('cookie1' => 'v_cookie1'), array(
'X-My-Header' => 'My Value'));
?>
[EDIT BY danbrown AT php DOT net: Contains a bugfix provided by "Wrinkled
Cheese" on 24-JUN-2011 to fix the $getdata foreach() loop; another bugfix
provided by Suat Secmen on 12-JAN-2012 to fix a $timeout = 1000, then
stream_set_timeout($fp, 0, $timeout * 1000), equaling 1,000 seconds.]
===============================================================================
thought you guys may appreciate this function, allows you to pass an array of
urls to download and does so simultaneously using non-blocking sockets, then
returns the data in an array.
===============================================================================
To make a telnet connection with a Cisco router:
";
fputs ($usenet, "toto\r\n");
fputs ($usenet, "en\r\n");
fputs ($usenet, "tutu\r\n");
fputs ($usenet, "exit\r\n");
while (!feof($usenet))
{
echo ". ".fgets($usenet, 128)."
\n";
}
}
?>
Then you will have:
Connected
. �� �� �� ��
.
. User Access Verification
.
. Password:
. testXB>en
. Password:
. testXB#exit
.
===============================================================================
For some reason the default FreeBSD 7.0 port (jailed environment) breaks
fsockopen() on SSL URLs, returning a constant stream of nothing! In my case
this resulted in php-cgi bringing down lighttpd completely, in rapid time!
Avoid FreeBSD/jails/fsockopen + SSL. Use curl_init() instead.
===============================================================================
2){
fputs ($usenet, "lo");
break;
}
}
}
echo "End.\r\n";
?>
===============================================================================
If you have to use a proxy to make requests outside of your local network, you
may use this class:
proxy_name;
}
public function set_proxy_name($n) {
$this->proxy_name = $n;
}
public function get_proxy_port() {
return $this->proxy_port;
}
public function set_proxy_port($p) {
$this->proxy_port = $p;
}
public function get_request_url() {
return $this->request_url;
}
public function set_request_url($u) {
$this->request_url = $u;
}
public function get_result() {
return $this->result;
}
public function set_result($r) {
$this->result = $r;
}
private function get_url_via_proxy() {
$proxy_fp = fsockopen($this->get_proxy_name(), $this->get_proxy_port
());
if (!$proxy_fp) {
return false;
}
fputs($proxy_fp, "GET " . $this->get_request_url() . " HTTP/1.0\r\
nHost: " . $this->get_proxy_name() . "\r\n\r\n");
while (!feof($proxy_fp)) {
$proxy_cont .= fread($proxy_fp, 4096);
}
fclose($proxy_fp);
$proxy_cont = substr($proxy_cont, strpos($proxy_cont, "\r\n\r\n") + 4);
return $proxy_cont;
}
private function get_url($url) {
$fd = @ file($url);
if ($fd) {
return $fd;
} else {
return false;
}
}
private function logger($line, $file) {
$fd = fopen($file . ".log", "a+");
fwrite($fd, date("Ymd G:i:s") . " - " . $file . " - " . $line . "\n");
fclose($fd);
}
function __construct($url, $proxy_name = "", $proxy_port = "") {
$this->set_request_url($url);
$this->set_proxy_name($proxy_name);
$this->set_proxy_port($proxy_port);
}
public function request_via_proxy() {
$this->set_result($this->get_url_via_proxy());
if (!$this->get_result()) {
$this->logger("FAILED: get_url_via_proxy(" . $this->get_proxy_name
() . "," . $this->get_proxy_port() . "," . $this->get_request_url() . ")",
"RemoteFopenViaProxyClass.log");
}
}
public function request_without_proxy() {
$this->set_result($this->get_url($this->get_request_url()));
if (!$this->get_result()) {
$this->logger("FAILED: get_url(" . $url . ")",
"RemoteFopenViaProxyClass.log");
}
}
}
?>
Use it this way:
set_proxy_name($insert_proxy_name);
$obj->set_proxy_port($insert_proxy_port);
$obj->set_request_url($insert_request_url);
$obj->request_via_proxy();
echo $obj->get_result();
?>
If there are errors during execution, the script tries to write some useful
information into a log file.
===============================================================================
I ran into a problem where I needed to make an fsockopen() style connection
from one specific ip address on a server with multiple ip aliases.
Unfortunately fsockopen() does not allow the specification of a source address
making it unsuitable. I could not find any other solutions elsewhere so here is
mine for those with php 5.1.0 or greater.
array('bindto' => '<IP_ADDRESS>:0'));
$context = stream_context_create($opts);
$fp = stream_socket_client("tcp://www.example.com:80", $errno, $errstr, 30,
STREAM_CLIENT_CONNECT, $context);
?>
Now $fp can be used like a resource handle returned by a vanilla fsockopen()
call!
===============================================================================
The DEFAULT stream timeout is set according to default_socket_timeout in your
php.ini file. Took forever for me to dig that up....
===============================================================================
If you are using fsockopen to access webpage, but come across a redirect
(Location: ) in the header and want to find and follow the redirect as in this
snippet:
Then don't forget to before trying to
follow this new link as $redirect actually has a \r\n on the end of it and
won't give you a valid path in the next iteration otherwise. A six hour bug.
Saul Dobney
===============================================================================
When you try to POST/GET requests via HTTPS over SSL/TLS you should notice
this:
";
// script
if($port == 443)
$sslhost = "ssl://".$host;
else
$sslhost = $host;
$fp = fsockopen($sslhost, $port);
fputs($fp, "$method $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: $contenttype\r\n");
fputs($fp, "Content-length: ".strlen($data)."\r\n");
fputs($fp, "Connection: close\r\n");
fputs($fp, "\r\n");
?>
The server usually does not understand the HTTP-header "Host: XXX" if you
provide it with the trailing "ssl://" used by fsockopen(); If you do it anyway
you probably get a HTTP 400 back as response. :-)
===============================================================================
The following function performs pop3 authentication. Returns NULL on error, or
true/false to indicate username/password matching:
$address is the hostname of the server and $ssl is a boolean that indicates
whether an SSL connection is requested.
===============================================================================
Here's a function to just fetch the contents behind an URL.
===============================================================================
The following snippet allows you to retrieve the title of a page.
Great for rewriting auto-url detectors to display the actual title rather then
http://...
0 ? $url['port'] : 80),
$errno, $errstr, $timeout);
if (!$fp)
{
return;
// echo "$errstr ($errno)
\n";
}
else
{
fputs ($fp, "GET /".$url['path'].($url['query'] ? '?'.$url['query'] :
'')." HTTP/1.0\r\nHost: ".$url['host']."\r\n\r\n");
$d = '';
while (!feof($fp))
{
$d .= fgets ($fp,2048);
if(preg_match('~(||(\s*(.*?)\s*))~i',
$d, $m))
break;
}
fclose ($fp);
return $m[3];
}
}
?>
===============================================================================
I was tearing my hair out for a week trying to figure out how to do this.
If you use fsockopen with a service that doesn't have an EOF, or you try to
read beyond EOF or line break, PHP can hang completely.
In my case, I was trying to write a class that talks to Kali servers
(www.kali.net) to get a list of people on the chat server. To keep PHP from
hanging due to the above, I discovered this:
0) {
$result["results"] = fread($fp, $bytes_left["unread_bytes"
]);
}
else {
$result["results"] = "";
}
fclose($fp);
}
return $result;
}
}
?>
When I send the request packet, I get a response packet of length 5. Then I
call socket_get_status() and use the unread_bytes key from it to know how far
to fread from the socket. Works very good.
I've only used this on PHP 4.2.1 so far.
===============================================================================
on my FreeBSD vm, with Joomla, I was getting the error
fsockopen(): unable to connect to ssl://localhost:443 (Unknown error)
when using a contact form and also the module updating process.
After reading other notes on here, regarding certificate validation, I
installed the port ca_root_nss
(Root certificates from certificate authorities included in the Mozilla
NSS library and thus in Firefox and Thunderbird.)
Now it works
===============================================================================
Rewrite/Update of king dot macro's DNS lookups function.
===============================================================================
My recursive unchunk function:
\'"\
', \'\\\\0\'=>"\x00"))), 0, $cnt).unchunk(substr($str, $cnt+2))
:""
',
$result
);
}
?>
===============================================================================
===============================================================================
When downloading large files, it is not really efficient to put the whole
server answer in memory before parsing the data to remove the header parts.
Here is a simple way to do it while writing the data as it arrive:
===============================================================================
[NOTE BY danbrown AT php DOT net: Updated version. Contains author-submitted
bug fixes.]
Here is a way to get an array of cities / states for any zip code anywhere in
the US. This example uses a $_GET variable to specify which zip code, but you
can get it from any source you wish. This will return actual and acceptable
zip code cities (according to USPS), but can be easily modified to include just
the actual city.
(?:)?([\w|\s]+), (\w+)/', $temp[0],
$acceptable, PREG_SET_ORDER);
$values = array();
foreach($acceptable as $value)
$values[] =
array
(
'city' => $value[1],
'state' => $value[2]
);
if(count($values) == 0)
echo 'Zip could not be found in the database!';
}
}
else
echo 'Please specify a zip!';
?>
===============================================================================
When you're connecting through a proxy server you can't rely on fsockopen
returning false to indicate that the connection has failed. (This also applies
to fgets and fwrite.)
To check whether the proxy succeeded in contacting the real target host, you
need to look for the http response code in the headers that get returned.
Typically, if the proxy was unable to reach the host, you'll find a line
containing something like:
HTTP/1.0 503 Service Unavailable
===============================================================================
"system level connect()" is not further documented inside the php documentation
so it is hard to find out more about error numbers.
someone suggest a more system-close way to find out more about error numbers
here: http://www.askapache.com/php/fsockopen-socket.html (an interesting read
about fsockopen anyway).
in my case i could debug to the fact that fsocketopen error number 16 was
resulted in the inpossibility to resolve a hostname.
===============================================================================
Notice using "tcp" insted of "http"
===============================================================================
My $0.02 on handling chunked transfer encoded output... Has rudimentary error
handling.
===============================================================================
OK';
}
else
{
$version_info = 'neaktualne';
$version_info .= '
'Latest_version_info' . $latest_version) .
' ' . sprintf(Current_version_info'. '1.0.00') . '
';
}
}
else
{
if ($errstr)
{
$version_info = '' . sprintf(
Connect_socket_error) . '
';
}
else
{
$version_info = ''Socket_functions_disabled'
';
}
}
$version_info .= ''Mailing_list_subscribe_reminder'
';
echo $version_info;
?>
===============================================================================
For those of you who do not have cURL, you might want to try this.
It doesn't have all the functions that cURL has, but it has the basics.
Please let me know of any bugs or problems.
\n$header";
}
$header = str_replace("\n","
",$header);
if ($return[1]){
$body = $return[1];
}else{
$body = "";
}
if ($c === 2){
if ($body){
$return = $body;
}else{
$return = $header;
}
}
if ($c === 1){
$return = $header;
}
if ($c === 3){
$return = "$header$body";
}
if ($f){
if (preg_match("/Location\:/","$header")){
$url = @explode("Location: ",$header);
$url = $url[1];
$url = @explode("\r",$url);
$url = $url[0];
$oldheader = str_replace("\r\n\r\n","",$header);
$l = "Location:";
$oldheader = str_replace("Location:",$l,$oldheader);
return open_page($url,$f,$c,$r,$a,$cf,$pd);
}else{
return $return;
}
}else{
return $return;
}
}
/////////////
////Usage////
/////////////
$url = "http://www.php.net";
$f = 1;
$c = 2;//1 for header, 2 for body, 3 for both
$r = NULL;
$a = NULL;
$cf = NULL;
$pd = NULL;
$page = open_page($url,$f,$c,$r,$a,$cf,$pd);
print $page;
?>
===============================================================================
I was having trouble doing an https in fopen and with fsockopen where the
address had ssl://. I was getting error code 114 in the log. After much
research i found that there was some ssl conflict trouble with MySQL
5.0.20-5.0.33. It had some functions that were interfering with openssl that
showed up in the php install.
http://bugs.mysql.com/bug.php?id=21930
http://bugs.mysql.com/bug.php?id=19289
===============================================================================
I've had issues with some of the handlers for chunked http 1.1 responses.
Here's a method that worked for me, if it works for you as well, then cheers :P
\n');
return false;
}
$requestHeader = $method." ".$path." HTTP/1.1\r\n";
$requestHeader.= "Host: ".$host."\r\n";
$requestHeader.= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT
5.1; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0\r\n";
$requestHeader.= "Content-Type: application/x-www-form-urlencoded\r\n";
if ($method == "POST")
{
$requestHeader.= "Content-Length: ".strlen($data)."\r\n";
}
$requestHeader.= "Connection: close\r\n\r\n";
if ($method == "POST")
{
$requestHeader.= $data;
}
fwrite($filePointer, $requestHeader);
$responseHeader = '';
$responseContent = '';
do
{
$responseHeader.= fread($filePointer, 1);
}
while (!preg_match('/\\r\\n\\r\\n$/', $responseHeader));
if (!strstr($responseHeader, "Transfer-Encoding: chunked"))
{
while (!feof($filePointer))
{
$responseContent.= fgets($filePointer, 128);
}
}
else
{
while ($chunk_length = hexdec(fgets($filePointer)))
{
$responseContentChunk = '';
logEventToTextFile('debug', $chunk_length);
$read_length = 0;
while ($read_length < $chunk_length)
{
$responseContentChunk .= fread($filePointer, $chunk_length
- $read_length);
$read_length = strlen($responseContentChunk);
}
$responseContent.= $responseContentChunk;
fgets($filePointer);
}
}
logEventToTextFile('debug', $responseContent);
return chop($responseContent);
}
?>
===============================================================================
Lots of tries and lots of reading http-headers...
If you want to post $_POST vars and (in this case) one file named userfile to
$remote_server and $remote_url.
$value){
$data .="--$boundary\r\n";
$data .= "Content-Disposition: form-data; name=\"".$index."\"\r\n";
$data .= "\r\n".$value."\r\n";
$data .="--$boundary\r\n";
}
// and attach the file
$data .= "--$boundary\r\n";
$content_file = join("", file($tmp_name));
$data .="Content-Disposition: form-data; name=\"userfile\"; filename=\"
$file_name\"\r\n";
$data .= "Content-Type: $content_type\r\n\r\n";
$data .= "".$content_file."\r\n";
$data .="--$boundary--\r\n";
$header .= "Content-length: " . strlen($data) . "\r\n\r\n";
// Open the connection
$fp = fsockopen($remote_server, 80);
// then just
fputs($fp, $header.$data);
fclose($fp);
?>
===============================================================================
login to the site prior to downloading page:
In some wierd situations site security is based on
ASPSESSION ID and where could be a
login asp script in one place, and the actual page with
information in another place.
for such cases you have to submit ( POST ) you login and
password first, when grab ASP session (and also some
cookies from response, and when use that ASP SESSION in
second request to the actual page: (i took some parts of
codes from other ppl)
\n".$mycookies."\n
";
//$body =PostPage("www.example.com/coolpage.asp",
//"action=zzz",$mycookies);
//echo "
Body:
\n".$body."\n";
//im using get page - so it goes like this:
$opts = array('http'=>array('method'=>"GET",
'header'=>"Accept-language: en\r\nCookie: ".$mycookies."\r\n" ));
$context = stream_context_create($opts);
$fp = fopen('http://www.example.com/coolpage.asp?p1=1&p2=23', 'r', false,
$context);
fpassthru($fp);
$html = fread($fp, 1000000);
fclose($fp);
echo $html;
function PostPage($host,$query,$others=''){
$path=explode('/',$host);
$host=$path[0];
unset($path[0]);
$path='/'.(implode('/',$path));
$post="POST $path HTTP/1.1\r\nHost: $host\r\n";
$post.="Content-type: application/x-www-form-";
$post.="urlencoded\r\n${others}";
$post.="User-Agent: Mozilla 4.0\r\nContent-length: ";
$post.=strlen($query)."\r\nConnection: close\r\n\r\n$query";
$h=fsockopen($host,80);
fwrite($h,$post);
for($a=0,$r='';!$a;){
$b=fread($h,8192);
$r.=$b;
$a=(($b=='')?1:0);
}
fclose($h);
return $r;
}
function GetCookies($host,$query,$others=''){
$path=explode('/',$host);
$host=$path[0];
unset($path[0]);
$crlf = "\r\n";
$path='/'.(implode('/',$path));
$post="POST $path HTTP/1.1\r\nHost: $host\r\n";
$post.="Content-type: application/x-www-form-urlencoded\r\n${others}";
$post.="User-Agent: Mozilla 4.0\r\nContent-length: ";
$post.=strlen($query)."\r\nConnection: close\r\n\r\n$query";
$h=fsockopen($host,80);
fwrite($h,$post);
$r="";
for($a=0;!$a;){
$b=fread($h,512);
echo $b;
$r.=$b;
$gotSession=strpos($r,"ASPSESSION");
if($gotSession)
if(strpos($r, $crlf . $crlf,$gotSession)>0) break;
$a=(($b=='')?1:0);
}
fclose($h);
$arr = split("Set-Cookie:",$r);
$AllCookies="";$count=1;
while ($count < count($arr)) {
$AllCookies.=substr($arr[$count].";",
0,strpos($arr[$count].";",";")+1);
$count++;}
return $AllCookies;
}
?>
It's not optimized , but i hope someone might find it usefull.
Best Regards
DRY_GIN
===============================================================================
This is an ident request example. If your client is running identd your real
username will be known by the server.
It is also usefull to identify people bypassing IP ACLs by using SOCKS proxy
and dynamic IP forwarding. If the socks proxy server uses ident (most unices
do) you will know his real username.
For more information see RFC1413
Timeout of 2 seconds in the example may not be enough.
\n";
exit;
}
else {
$out = "$remport, 80\r\n";
fwrite($fp, $out);
$answer=fgets($fp, 128);
}
fclose($fp);
$ansparts=explode(":",$answer);
$user=chop($ansparts[3]);
echo "You are $user@$remip:$remport";
?>
===============================================================================
Additional ICQ status request over proxy
Thanx
[EDIT BY danbrown AT php DOT net: Based on code provided in a note by (rafaelbc
AT matrix DOT com DOT br) on 23-MAY-09, which has since been removed.]
===============================================================================
Something useful for ICQ:
===============================================================================
The following script will login to a POP3 account using the username, password
and server name provided via a standard form; determine the amount of messages
using a binary search; then purge all messages.
===============================================================================
Here's a function that I needed and couldn't use CURL... it helps you if you
want to send the POST data (instead of GET) from one form to 2 or more other
PHP scripts. Trust me... it's a life saver!!
$value)
$values[]="$key=".urlencode($value);
$data_string=implode("&",$values);
// Find out which port is needed - if not given use standard (=80)
if(!isset($URL_Info["port"]))
$URL_Info["port"]=80;
// building POST-request:
$request.="POST ".$URL_Info["path"]." HTTP/1.1\n";
$request.="Host: ".$URL_Info["host"]."\n";
$request.="Referer: $referer\n";
$request.="Content-type: application/x-www-form-urlencoded\n";
$request.="Content-length: ".strlen($data_string)."\n";
$request.="Connection: close\n";
$request.="\n";
$request.=$data_string."\n";
$fp = fsockopen($URL_Info["host"],$URL_Info["port"]);
fputs($fp, $request);
while(!feof($fp)) {
$result .= fgets($fp, 128);
}
fclose($fp);
return $result;
}
$output1=HTTP_Post("http://www.example.com/script1.php",$_POST);
$output2=HTTP_Post("http://www.example.net/script2.php",$_POST);
?>
===============================================================================
You may be able to speed this function up by using an IP address instead of a
domain. PHP uses getHostByAddr internally in this function anyway, so you can
save a step in the function process.
===============================================================================
The documentation example is of a GET request. I have found POST documentation
to be lacking, and here's a function to easily simulate submitting form data:
===============================================================================
Set up SSL connection to server that requires client certificate:
Convert client certificate from *.pfx (pkcs12) into*.pem with openssl (if
needed):
> openssl pkcs12 -in keys.pfx -out keys.pem
PHP:
===============================================================================
Here is a function for testing a website/URI for availability:
";
return(false);
}
}
}
?>
===============================================================================
Just a note to everyone who is using fsockopen and fread / fgets for a HTTP
connection.
Unless you specify "Connection: Close" in your headers you will need to wait
for the socket to time out before feof($streamPointer) to return true.
This has wasted 2 days of my time, grr!
-Rob
===============================================================================
Try this.
Use AUTH when necessary.
Read RFC 821 when having problems.
\r\n", 1, 1);
echo smtp_command($handle, "RCPT TO:<$to_mail>\r\n", 1, 1);
echo smtp_command($handle, "DATA\r\n", 1, 1);
echo smtp_command($handle, "$message\r\n.\r\n", 1, 1);
// don't do it like this - it will hang up
// echo smtp_command($handle, "$message", 1, 1);
// echo smtp_command($handle, "\r\n.\r\n", 1, 1);
echo smtp_command($handle, "QUIT\r\n", 1, 1);
smtp_close($handle);
function smtp_connect($host, $port, $timeout=30, $echo_command=False,
$echo_response=False, $nl2br=False)
{
$errno = 0;
$errstr = 0;
if($echo_command)
{
if($nl2br) { echo nl2br("CONNECTING TO $host\r\n"); }
else { echo "CONNECTING TO $host\r\n"; }
}
$handle = fsockopen($host, $port, $errno, $errstr, $timeout);
if(!$handle)
{
if($echo_command)
{
if($nl2br) { echo nl2br("CONNECTION FAILED\r\n"); }
else { echo "CONNECTION FAILED\r\n"; }
}
return False;
}
if($echo_command)
{
if($nl2br) { echo nl2br("SUCCESS\r\n"); }
else { echo "SUCCESS\r\n"; }
}
$response = fgets($handle,1);
$bytes_left = socket_get_status($handle);
if ($bytes_left > 0) { $response .= fread($handle, $bytes_left[
"unread_bytes"]); }
if($echo_response)
{
if($nl2br) { echo nl2br($response); }
else { echo $response; }
}
return $handle;
}
function smtp_command($handle, $command, $echo_command=False, $nl2br=False)
{
if($echo_command)
{
if($nl2br) { echo nl2br($command); }
else { echo $command; }
}
fputs($handle, $command);
$response = fgets($handle,1);
$bytes_left = socket_get_status($handle);
if ($bytes_left > 0) { $response .= fread($handle, $bytes_left[
"unread_bytes"]); }
if($nl2br) { return nl2br($response); }
else { return $response; }
}
function smtp_close($handle)
{
fclose($handle);
}
?>
===============================================================================
If you want to connect via Telnet, it could be useful to set also the Terminal
Type (some OS requires it)
ciao
Sergio Paternoster
===============================================================================
Here's a quick function to establish a connection to a web server that will
time out if the connection is lost after a user definable amount of time or if
the server can't be reached.
Also supports Basic authentication if a username/password is specified. Any
improvements or criticisms, please email me! :-)
Returns either a resource ID, an error code or 0 if the server can't be reached
at all. Returns -1 in the event that something really wierd happens like a
non-standard http response or something. Hope it helps someone.
Cheers,
Ben Blazely
0) // Check the status of the
link
{
$endHeader = false; // Strip initial header
information
while ( !$endHeader)
{
if (fgets($urlHandle) == "\r\n")
$endHeader = true;
}
return $urlHandle; // All OK, return the file handle
}
else if (strlen($response) < 15) // Cope with wierd non
standard responses
{
fclose($urlHandle);
return -1;
}
else // Cope with a standard
error response
{
fclose($urlHandle);
return substr($response,9,3);
}
}
return $urlHandle;
}
else
{
return 0;
}
}
}
?>
===============================================================================
Here is how to connect to the web from behind a proxy server:
===============================================================================
The timeout parameter was not supported under windows until PHP 4.3.0,
previously it was fixed at 30sec.
===============================================================================
Here is some code to help out abit more with the EOF problem.
I had a problem where I needed to strip out so many lines of server input to
get back right data i wanted.
0) { fread($fp, $bytes_left[unread_bytes]); }
}
fputs($fp, "$message\r\n");
for ($i = 1; $i < $lineamount+1; $i++) {
$status.=fread($fp,1);
$bytes_left = socket_get_status($fp);
if ($bytes_left > 0) { $status.=fread($fp, $bytes_left[unread_bytes]); }
}
fclose ($fp);
}
return $status;
}
?>
===============================================================================
Although undocumented, it seems that $hostname can be a ":"
string:
===============================================================================
Did you know that fsockopen() DOES NOT validate SSL certificates whatsoever?
For the sake of World's overall security level, I guess it would be a very
positive idea to add a BIG WARNING notice on the manual page!
Citing the extensive study titled "The Most Dangerous Code in the World:
Validating SSL Certiﬁcates in Non-Browser Software" published in 2012 (google
it if they removed the link) on page 5:
"PHP provides several methods for establishing SSL connections. For example,
fsockopen, which opens a raw socket to the remote server, can be used to
connect to SSL servers by putting “ssl://” in the URL. Even though fsockopen
does not perform any certificate checks whatsoever, PHP application developers
routinely use it for SSL connection establishment (see Section 9)."
For proper certificate validation with some level of ease, you can always move
to cURL, but be careful:
"PHP also provides a cURL binding, which uses cURL’s default settings to
establish SSL connections with proper certificate validation. As we show in
Sections 7.1, 7.2, and 7.3, application developers often set cURL options
incorrectly, overriding the defaults and breaking certificate validation."
For more detailed insights, try out the following code:
===============================================================================
A short, quick unchunk function that makes use of regular expressions:
===============================================================================
An edit to my below function for extra headers support and a bit of debugging
( array("key" => "value") type)
"", "https://" => "ssl:/
/", "ssl://" => "ssl://", "\\" => "/", "//" => "/") );
if( ( $protocol = stripos($uri, "://") ) !== FALSE ){
if( ( $domain_pos = stripos($uri, "/", ($protocol + 3)) ) !==
FALSE ){
$domain = substr($uri, 0, $domain_pos);
$file = substr($uri, $domain_pos);
}
else{
$domain = $uri;
$file = "/";
}
}
else{
if( ( $domain_pos = stripos($uri, "/") ) !== FALSE ){
$domain = substr($uri, 0, $domain_pos);
$file = substr($uri, $domain_pos);
}
else{
$domain = $uri;
$file = "/";
}
}
$fp = fsockopen($domain, $port, $errno, $errstr, 30);
if(!$fp){
return FALSE;
}
else{
$out = "GET " . $file . " HTTP/1.1\r\n";
$out .= "Host: " . $domain . "\r\n";
foreach( $extra_headers as $nm => $vl ){
$out .= strtr( strval($nm), array( "\r" => "", "\n" => "", ": " => "", ":"
=> "") ) . ": " . strtr( strval($vl), array( "\r" => "", "\n" => "", ": " => ""
, ":" => "") ) . "\r\n";
}
$out .= "Connection: Close\r\n\r\n";
$response = "";
fwrite($fp, $out);
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
fclose($fp);
global $http_response_header;
$http_response_header = array();
if( stripos($response, "\r\n\r\n") !== FALSE ){
$hc = explode("\r\n\r\n", $response);
$headers = explode("\r\n", $hc[0]);
if(!is_array($headers))$headers = array();
foreach($headers as $key => $header){
$a = "";
$b = "";
if( stripos($header, ":") !== FALSE ){
list($a, $b) = explode(":", $header);
$http_response_header[trim($a)] = trim($b);
}
}
return end($hc);
}
else if( stripos($response, "\r\n") !== FALSE ){
$headers = explode("\r\n", $response);
if(!is_array($headers))$headers = array();
foreach($headers as $key => $header){
if( $key < ( count($headers) - 1 ) ){
$a = "";
$b = "";
if( stripos($header, ":") !== FALSE ){
list($a, $b) = explode(":", $header);
$http_response_header[trim($a)] = trim($b);
}
}
}
return end($headers);
}
else{
return $response;
}
}
}/*endfunction download*/
}/*endif no function download*/
?>
===============================================================================
I would like to save people some time. I spent a couple hours trying to
de-hunkify the response from apache2. I found out that if you simply make a
1.0 request vs. a 1.1 request you will get no hunks and so this simple script
below will get the page you want in plain text, no hunks:
I borrowed some of the script from another poster here - the portion removing
the returned header.
===============================================================================
In all header aspects I can understand for 3rd party content you may not be
able to apply the following but for those reading pages where content being
read by fsockopen is editable then I suggest adding a simple unique tag to the
beginning of any page being read such as ":THISTAG:"
Cleaning the header contents becomes simplier when you can then use a method
like split to grab your data like:
list($header,$data) = explode(":THISTAG:",$data);
===============================================================================
To just take the HTTP content from fsockopen, better wait until feof finish to
read the \r\n separator
===============================================================================
Here's how to send an email using SMTP. This includes rudimentary checking on
server responses during the process of sending an email. Could be improved by
more comprehensive processing of the result codes...or going on to the next
mail exchanger when you fail after connecting to the first.
===============================================================================
look at this smart ssl/http fsockopen function as a good solution for dealing
with things
$v) $str .= urlencode($k).'='.
urlencode($v).'&'; $str = substr($str,0,-1);
$fp = fsockopen($host,$port,$errno,$errstr,$timeout=30);
if(!$fp) die($_err.$errstr.$errno); else {
fputs($fp, "POST $path HTTP/1.1\r\n");
fputs($fp, "Host: $host\r\n");
fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
fputs($fp, "Content-length: ".strlen($str)."\r\n");
fputs($fp, "Connection: close\r\n\r\n");
fputs($fp, $str."\r\n\r\n");
while(!feof($fp)) $d .= fgets($fp,4096);
fclose($fp);
} return $d;
}
?>


--- layout: post authors: ["Jonathan Cooper"] title: Feedback from the Oxford DTCs date: 2013-05-24 time: "10:00:00" tags: ["Oxford University"] ---
Having helped at two previous bootcamps (Oxford last year and UCL last month), a couple of weeks ago I had my first attempt at organising one at the University of Oxford, primarily aimed at students from the Doctoral Training Centres. Mario Antonioletti and Shoaib Sufi from the Software Sustainability Institute kindly did most of the instructing (I only ran two sessions), and Mario has already written a blog post with his perspective. Here I want to report the feedback we received from attendees and give some of my thoughts on the experience.
It took a while for registrations to get going - the vast majority signed up in the last week - but we had very few drop-outs before the event, with 30 attending the first day, and 24 still present at the end of the second. We did the traditional good point-bad point round-the-room feedback at that point, and got quite a few useful comments, shown below. I also sent round a more detailed questionnaire after the event which received 10 responses. All enjoyed the bootcamp, and rated it overall good or very good. They also all felt they learned something useful, would recommend such events to others, and think universities should run them as standard.
| Good | Bad |
|---|---|
| Lectures good - not too fast | Issues getting pace correct for everyone |
| Covered basics well and included advanced topics | Some topics too easy |
| Selection of topics covered | Slightly too long on simple things in databases - more complex topics |
| Python good solid foundation | Intro Python too slow - too much basic programming |
| Documentation for the topics good, so could read the material to catch up | Version control too fast |
| Lots of topics, didn't get bored | Starting with version control - in at deep end - start simpler? |
| Sticky notes good idea | Version control not deep enough - need to explain concepts - what program actually does |
| Tech support from helpers great | Time management - wanted more Matlab |
| Examples very practical - could think how to apply them to my work | Include some theory behind Python - what important compared to other languages |
| Access to all the materials from the start and afterwards | Example used BitBucket but course materials on GitHub |
| Having sample code, e.g. seeing how other people implement tests | Databases needed more intro and context |
| Exercises good to learn from | Examples of big projects to explain the idea behind version control |
| Good balance of trying it yourself and lecturing | Using wrong programs on desktops - no cygwin |
| Everyone could see the screens | NumPy & SciPy not covered deeply enough |
| Number of demonstrators good - didn't have to wait for help | More comparison between Python and Matlab |
| Generally very helpful | |
| Awesome that this is free |
I think we did pitch things generally at slightly too easy a level for our audience. This was particularly the case for the introductory Python session, which started quite slowly. Several responses to the questionnaire requested fewer topics but in more depth, with less time spent on the very basics. It was interesting to me that the students wanted more background to the topics taught, for instance comparing Python with other programming languages and discussing the kinds of problems for which it is particularly suited, or explaining the mental model and behind-the-scenes behaviour of Git.
There were also some differences in what attendees wanted out of the bootcamp. Some were particularly keen to learn Python, and they seemed to really appreciate what we covered. Others wanted more to improve their Matlab skills, and so were disappointed that the 'Software Carpentry in Matlab' session was squeezed by earlier sessions overrunning. I think they would probably have wanted a workshop devoted to covering the general principles entirely in Matlab without any Python, too.
The location in the Zoology Department worked very well for a bootcamp. It was a newly equipped suite designed for teaching computer based courses. There were thus desks with plenty of space for helpers to move behind attendees, and desktop thin clients for those who couldn't bring their own laptops (or had issues with their setup). Best of all, the instructor's screen could be projected on three walls of the room, so everyone could see a screen in front and to the side.
Most setup issues were caused by Enthought releasing Canopy between the installation instructions being written and the bootcamp occurring, so those attendees who didn't already have Python were faced with an installation that didn't match the instructions. The additional setup script for Windows users was also broken by paths changing. More annoying were some issues experienced with IPython on some machines, which we didn't get to the bottom of unfortunately. Pasting with %paste didn't work for some (%cpaste seemed to be an effective work-around), and tab completion was entirely absent on some systems.
We came across a few issues (and some good ideas) that might be helpful for future bootcamps to consider.
There were a couple of other comments worth mentioning. One person wanted a topic on understanding pre-written code. Possibly going through a model solution to a longer exercise would be beneficial for this. Another person suggested splitting the workshop into half days on different topics, and letting attendees pick which they attend. I don't think this would work for normal bootcamps, but with particular audiences, especially those with more background in some topics, this might be a helpful approach.
But my favourite comment of all, in one questionnaire response, was: "In my opinion the best aspect of the course was the explanations given about new concepts by the very competent computer scientists who ran the bootcamp. This was especially true for Jonathan and Aron." I think that's a good note on which to end!


Good news rarely arrives late on a Wednesday night, so I was pleasantly surprised when news of a new Bos taurus reference assembly, Btau_5.0 reached my ears. Btau_5.0 replaces 2009s Btau_4.6.1 and will probably replace the widely used umd 3.1 assembly. Whilst optimistic predictions had a new reference genome arriving by Christmas 2014, I wasn’t holding out too much hope!
For the uninitiated, a reference assembly or reference genome is a high quality example of the genome of an organism, often assembled from multiple (in this case 2) individuals.
A good reference genome allows for the quick and relatively painless assembling of other genomes of the same organism, as well as accurate identification polymorphic sites in those genomes.
Problems in the reference genome lead to regions of the genome that just don’t make sense.
So why am I excited about Btau_5.0? Compared to umd3.1 t looks really good.
| umd3.1 | Btau_5.0 | |
| Total-length |<PHONE_NUMBER> |<PHONE_NUMBER> |
| Contig N50 | 276285 | 96955 |
| Contig count | 42267 | 75617 |
Better than UMD3.1?
Contig (from contiguous) N50 is the figure by which reference assemblies are judged. N50 is a weighted mean statistic such as that 50% of the assembly is contained in contiguous set of overlapping DNA segments equal to or larger than this value.
Whilst the length of both assemblies are comparable, Btau5.0 contig N50 is 2.8 times that of umd3.1, wow!
Full stats can be accessed here
Sounds perfect?
One disappointment is the total length of the assembly; we’re still missing a good chunk of the whole genome! For the time being I’ll have to accept that ~10% of the data I sequence remaining unmapped and unused.
Additionally, whilst contig N50 can be a useful way to compare genomes of equal size, it is also possible to artificially raise N50 by deliberately excluding short contigs and/or increasing the padding of Ns within scaffolds.
A new reference also risks bringing with it it's own quirks and regions that don't make sense, however a great reference genome would reduce errors and improve our ability to hunt causative SNPs
Progress is always a good thing which is why I'm very excited to see what's in store for bovine genomics. I'm a bit apprehensive to ditch umd3.1 for the time being, lets wait and see!
I'll try to keep this post updated as I find out more; thanks for reading!


My Sortable List of Favorite Chapters
- Oldies-but-Goodies: Foundational Moo
- Switching Paddles Midstream: Changing HTML After Page Load
- And On The 8th Day: Creating HTML Elements
- That's Not All Folks: Animation and Scrolling
- Mr. Clean Uses Ajax: Remote Asynchronous Calls
- Easy Come Easy Go: Drag and Drop
- Knock And The Door Will Open: Events and Listeners
- Dynomite! (Movin' On Up): Working with Transitions
- WTFudge Is Going On?: Troubleshooting MooTools
- Enough Is Never Enough: Extending MooTools
- I'll Gladly Pay Tue. For Moo Today: Extensions on the Web
- Electric Milk: Plugins and More


Methods
(static) useDownloader(data, name, type, onDownloaded, onError, event) → {Downloader}
- Source:
Hook for downloading data
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | Object | Downloaded data |
name |
string | Name of downloaded data |
type |
string | Type of downloaded data |
onDownloaded |
function | Function is called after successful downloading |
onError |
function | Function is called after failed downloading |
event |
string | Event that triggers downloading |
Returns:
- Object for inserting to html element
- Type
- Downloader
Type Definitions
Downloader
- Source:
Properties:
| Name | Type | Description |
|---|---|---|
ref |
MutableRefObject.<HTMLElement> | Reference to html element |
Object for inserting to html element
Type:
- Object


Menu
Registries
Notes
Alerts
Files
Print
Edit
Back
Logout
Brand
:
Acquisition Date
:
at
years
Year
:
has
years
License
:
License Date
:
has
years
Registrations
Hours/Km
Description
Date
Add Registration
×
Add Registration
Hours/Km
Description
Date
Add
Cancel
×
Delete Registration
Are you sure want delete the registration
?
Notes
Note
Add Note
×
Add Note
Description
Add
Cancel
×
Delete
Are you sure want delete the note
?
Alerts
Description
Next Warning
Add Alert
×
Add Alert
Description
:
First Warning Date
:
Periodicity
:
Every year
Every half year
Just once
Add
Cancel
×
Delete Alert
Are you sure want delete the alert
?
Files
Feature soon available
Print
Imprimir Registos + Notas
Imprimir Registos
Imprimir Notas
Edit
Edit Data
Brand
:
Acquisition Date
:
Year
:
License
:
License Date
:
Submit
Edit Image
Image
:
Submit
×
Vehicle's Photo


{{ project.name }}
{{ project.description }} {% if project.type == 'public' %} Public {% else %} Private {% endif %}
{% if messages %}
{% for message in messages %}
{% include 'core/footer.html' %}
{% endfor %}
{% endif %}
Overview
Edit Project
Change the name, description or privacy status of the project.
Change the name, description or privacy status of the project.
Delete Project
Delete this project, resources, API Keys etc (and anything associated with it)
Delete this project, resources, API Keys etc (and anything associated with it)


Project Proposal
This document describes the problem and steps undertaken in providing the solution.
Functional Requirements
This document provides the specifications & functionality of the proposed design solution.
Design Specifications
This document provides the technical specifications and functionality of the proposed design for our product.
Poster Presentation
This is poster presentation outlining how the system works in its use case environment.


Engenharia da Computação Alguma coisa
This is your second panel
This is your third panel
This is your fourth panel


This is the 475 Home Page Page Contents This page house all of my 475 coursework. It currently have links to my site's homepage and will have links to future 475 assignments.


public class HungarianAlgorithm
extends java.lang.Object
An assignment for a cost matrix that has more workers than jobs will necessarily include unassigned workers, indicated by an assignment value of -1; in no other circumstance will there be unassigned workers. Similarly, an assignment for a cost matrix that has more jobs than workers will necessarily include unassigned jobs; in no other circumstance will there be unassigned jobs. For completeness, an assignment for a square cost matrix will give exactly one unique worker to each job.
This version of the Hungarian algorithm runs in time O(n^3), where n is the maximum among the number of workers and the number of jobs.
| Constructor and Description |
|---|
HungarianAlgorithm(double[][] costMatrix)
Construct an instance of the algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
computeInitialFeasibleSolution()
Compute an initial feasible solution by assigning zero labels to the
workers and by assigning to each job a label equal to the minimum cost
among its incident edges.
|
int[] |
execute()
Execute the algorithm.
|
protected void |
executePhase()
Execute a single phase of the algorithm.
|
protected int |
fetchUnmatchedWorker() |
protected void |
greedyMatch()
Find a valid matching by greedily selecting among zero-cost matchings.
|
protected void |
initializePhase(int w)
Initialize the next phase of the algorithm by clearing the committed
workers and jobs sets and by initializing the slack arrays to the values
corresponding to the specified root worker.
|
protected void |
match(int w,
int j)
Helper method to record a matching between worker w and job j.
|
protected void |
reduce()
Reduce the cost matrix by subtracting the smallest element of each row
from all elements of the row as well as the smallest element of each
column from all elements of the column.
|
protected void |
updateLabeling(double slack)
Update labels with the specified slack by adding the slack value for
committed workers and by subtracting the slack value for committed jobs.
|
public HungarianAlgorithm(double[][] costMatrix)
protected void computeInitialFeasibleSolution()
public int[] execute()
protected void executePhase()
The runtime of a single phase of the algorithm is O(n^2), where n is the dimension of the internal square cost matrix, since each edge is visited at most once and since increasing the labeling is accomplished in time O(n) by maintaining the minimum slack values among non-committed jobs. When a phase completes, the matching will have increased in size.
protected int fetchUnmatchedWorker()
dim
if none.protected void greedyMatch()
protected void initializePhase(int w)
protected void match(int w, int j)
protected void reduce()
protected void updateLabeling(double slack)


Fresh graduate with a Computer Science degree in the Hong Kong University of Science and
Technology.
A sound background in Java and Web development.
collaborative skills, as well as programming techniques such as Java, C++ and JavaScript
I have developed
during years of study.


Before Change
))
else:
//If you"re rendering in sphinx, the relative path of the rst file is one below the make file so compensate accordingly
return os.path.join("..",os.path.relpath(pkg_resources.resource_filename(
"cellprofiler",
os.path.join("data", "images", filename)
)))
PROTIP_RECOMEND_ICON = __image_resource("thumb-up.png")
After Change
// Otherwise, we are probably building the documentation in sphinx.
// The path separator used by sphinx is "/" on all platforms.
return "../images/{}".format(filename)
PROTIP_RECOMEND_ICON = __image_resource("thumb-up.png")


Test all changes, including patches, before deploying them. Test each change for validation of input, error handling, secure cryptographic storage, secure communications, and proper role-based access control.
Testing helps ensure that changes do not introduce new vulnerabilities or break functionality.
Create a testing environment that simulates the environment where changes are to be applied. Apply changes in the testing environment. Test each change for validation of all input, error handling, secure cryptographic storage, secure communications, and proper role-based access control. Document the results of the tests. If the tests are successful, apply the changes to the production environment.


WITNESS LIST Criminal Justice Committee April 8, 1997-9:00A SB 89 Registering, but not testifying: For: Ferrero, David (TX ABC), Austin Garey, Glen (Texas Restaurant Ass'n), Austin Lewis, Bill (MADD), Austin On: Rannals, Lonnie J. (TX DPS), Austin Raymond, Kevin (TX DPS), Austin SB 322 For: Groomer, Cindy (Co. & Dist. Clerks Assn), Amarillo Registering, but not testifying: For: Wolbrueck, Bonnie (Co. & Dist. Clerks Assn), Georgetown SB 542 For: Lyons, Laura (TX Against Sex Assault), Austin O'Neal-Batjer, Colleen (self), San Angelo Riddering, Hannah (TX Nat'l Org for Women), Austin Registering, but not testifying: For: Davis, Grace L. (Journeys), Houston SB 550 For: Carter, Joan M. (Ctr. for Battered Women), Austin Isaacks, Bruce (Denton Co. Criminal DA), Denton Registering, but not testifying: For: Riddering, Hannah (TX Nat'l Org for Women), Austin Schneider, Christina (TX Cncl Family Violence), Austin Vleck, S.C. Van (Ft. Worth Police Dept.), Ft. Worth SB 710 For: Wyman, Carol (Livestock Show & Rodeo), Houston Against: Toy, Christopher (The Ticket Company, Inc), Houston Registering, but not testifying: Against: Stopnicki, Jack (Ticket Stop), Houston SB 875 On: Jordan, Paul C. (TX DPS), Austin Registering, but not testifying: On: Bozarth, Melinda (TDCJ), Austin Cranford, Susan (TDCJ), Austin White, Bonita (TDCJ), Austin SB 1218 For: Lawrence, Judge Tom (self), Humble SB 1579 Registering, but not testifying: On: Sallans, Jim (Office of the Governor), Austin


OpenSSH: suite of secure networking utilities based on the secure shell protocol. Provides a secure channel over an unsecured network.
allows forwarding of TCP/IP connections to a remote machine over an encrypted channel. Insecure applications can be secured with this.
protects against several security problems: IP spoofing, fake routes, DNS spoofing. Public key authentication, one-time passwords.
Agent forwarding


|
Max API
8.2.0
|
Data structure for the buffer~ object. More...
#include <buffer.h>
Data Fields | |
| t_object | b_obj |
| doesn't have any signals so it doesn't need to be pxobject | |
| long | b_valid |
| flag is off during read replacement or editing operation | |
| float * | b_samples |
| stored with interleaved channels if multi-channel | |
| long | b_frames |
| number of sample frames (each one is sizeof(float) * b_nchans bytes) | |
| long | b_nchans |
| number of channels | |
| long | b_size |
| size of buffer in floats | |
| float | b_sr |
| sampling rate of the buffer | |
| float | b_1oversr |
| 1 / sr | |
| float | b_msr |
| sr * .001 | |
| float * | b_memory |
| pointer to where memory starts (initial padding for interp) | |
| t_symbol * | b_name |
| name of the buffer | |
| long | b_susloopstart |
| looping info (from AIFF file) in samples | |
| long | b_susloopend |
| looping info (from AIFF file) in samples | |
| long | b_relloopstart |
| looping info (from AIFF file) in samples | |
| long | b_relloopend |
| looping info (from AIFF file) in samples | |
| long | b_format |
| 'AIFF' or 'Sd2f' | |
| t_symbol * | b_filename |
| last file read (not written) for info~ | |
| long | b_oldnchans |
| used for resizing window in case of # of channels change | |
| long | b_outputbytes |
| number of bytes used for output sample (1-4) | |
| long | b_modtime |
| last modified time ("dirty" method) | |
| struct _buffer * | b_peer |
| objects that share this symbol (used as a link in the peers) | |
| t_bool | b_owner |
| b_memory/b_samples "owned" by this object | |
| long | b_outputfmt |
| sample type (A_LONG, A_FLOAT, etc.) | |
| t_int32_atomic | b_inuse |
| objects that use buffer should ATOMIC_INCREMENT / ATOMIC_DECREMENT this in their perform | |
| void * | b_dspchain |
| dspchain used for this instance | |
| long | b_padding |
| amount of padding (number of samples) in b_memory before b_samples starts | |
| long | b_paddingchanged |
| flag indicating that b_padding has changed and needs to be allocated | |
| t_object * | b_jsoundfile |
| internal instance for reading/writing FLAC format | |
| t_systhread_mutex | b_mutex |
| mutex to use when locking and performing operations anywhere except perform method | |
| long | b_wasvalid |
| internal flag used by replacement or editing operation | |
| t_object * | b_custom_error_handler |
| used to return error numbers to a caller if this object is embedded inside of another object (e.g. playlist~) | |
| t_clock * | b_dirty_clock |
| used to return error numbers to a caller if this object is embedded inside of another object (e.g. playlist~) More... | |
| t_qelem * | b_dirty_qelem |
| used to move buffer dirty notifications to the main thread | |
| t_bool | b_dirty_done |
| a buffer is not only dirty, but needs the 'done' message sent out its b_doneout outlet | |
| t_filepath | b_filevol |
| path of last file read (not written) | |
Data structure for the buffer~ object.
Deprectated. Use t_buffer_ref and t_buffer_obj instead.
| t_clock* t_buffer::b_dirty_clock |
used to return error numbers to a caller if this object is embedded inside of another object (e.g. playlist~)
used to move buffer dirty notifications to the main thread


You need to set up the admin board
It seems have no Admin Board yet. Don't worry, this is very easy to set up:
First, open the board that you wish to use as your Admin Board. It is important that the extension is enabled for this board!
Then, click on the button that says 'Make this my Admin Board'. Wait for the success message and you're ready to go!


Chem 12B is the second part of the College of Chemistry organic chemistry series, and focuses on the chemical/physical properties, and the reactions and synthesis of, major classes of organic compounds. This class is more difficult than the 3A/3B series, and there is a larger emphasis on multistep synthesis and reaction mechanisms.
The course looks at a broad spectrum of organic compounds, and typically 2-5 lecture days are spent on each topic (see below). The course also includes a weekly 5-hour lab that closely supplements the material learned in lecture. The lab requires the usage and interpretation of spectra from commonly utilized instrumentation such as mass spectrometry, HPLC, and NMR. Programs such as MestReNova and ChemDraw will also be utilized to interpret data. An analysis of your sample-derived NMR will typically be required every week.
Course is only offered in the spring
Per Week: 3 hours of lecture, 5 hour lab, 1 hour lab lecture
The class is a lower division requirement for Chemistry/Chemical Biology majors, and can fulfill an elective requirement for Chemical Engineers. As it is a prerequisite for many future chemistry courses, it is suggested to take this course the Spring of your second year. This class is very time-intensive, so plan your semester accordingly.
This class is necessary for Chemistry/Chemical Biology majors, and fulfills requirements for the Biotechnology, Chemical Processing, Energy & Environment, Materials Science & Technology concentrations, or a science elective for Chemical Engineering majors.
This class builds off of itself and only requires some background from 12A.
There are several reactions and reaction conditions that require some degree of memorization. Having a good understanding of the material and the reaction mechanism is necessary.
Labs typically finish an hour or so early.
Do not expect that, just because you did well in 12A, you will do well in 12B.
Written by: Alex Oanta
Last edited: Spring 2018


Recover the {{ foundFunds.balance | toBtc }} {{ displayNetwork.value.toUpperCase() }} from this wallet to your address.
Your transaction could not be created. {{ result.errors[0] }}


light
1,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
1,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
0,player,Roxas Keyheart,100%,20000,100%,10000,100%,1000,1,Bard
debugX
1
1
Roxas Keyheart
1
2
Roxas Keyheart
1
3
Roxas Keyheart
1
4
Roxas Keyheart
1
5
Roxas Keyheart
1
6
Roxas Keyheart
1
7
Roxas Keyheart
8
8
Roxas Keyheart
1
9
Roxas Keyheart


| Name | Side | Role |
|---|---|---|
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Name | Side | Role |
|---|---|---|
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Name | Side | Role | |
|---|---|---|---|
| Obi Wan Kenobi | Light | Jedi | |
| Greedo | South | Scumbag | |
| Obi Wan Kenobi | Light | Jedi | |
| Greedo | South | Scumbag |
| Name | Side | Role |
|---|---|---|
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Name | Side | Role |
|---|---|---|
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Name | Side | Role |
|---|---|---|
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Name | Side | Role |
|---|---|---|
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Obi Wan Kenobi | Light | Jedi |
| Greedo | South | Scumbag |
| Rendering engine | Browser | Platform | CSS grade |
|---|---|---|---|
| Trident | Internet Explorer 4.0 | Win 95+ | X |
| Trident | Internet Explorer 5.0 | Win 95+ | C |
| Trident | Internet Explorer 5.5 | Win 95+ | A |
| Trident | Internet Explorer 6 | Win 98+ | A |
| Trident | Internet Explorer 7 | Win XP SP2+ | A |
| Trident | AOL browser (AOL desktop) | Win XP | A |
| Gecko | Firefox 1.0 | Win 98+ / OSX.2+ | A |
| Gecko | Firefox 1.5 | Win 98+ / OSX.2+ | A |
| Gecko | Firefox 2.0 | Win 98+ / OSX.2+ | A |
| Gecko | Firefox 3.0 | Win 2k+ / OSX.3+ | A |
| Gecko | Camino 1.0 | OSX.2+ | A |
| Gecko | Camino 1.5 | OSX.3+ | A |
| Gecko | Netscape 7.2 | Win 95+ / Mac OS 8.6-9.2 | A |
| Gecko | Netscape Browser 8 | Win 98SE+ | A |
| Gecko | Netscape Navigator 9 | Win 98+ / OSX.2+ | A |
| Gecko | Mozilla 1.0 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.1 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.2 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.3 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.4 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.5 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.6 | Win 95+ / OSX.1+ | A |
| Gecko | Mozilla 1.7 | Win 98+ / OSX.1+ | A |
| Gecko | Mozilla 1.8 | Win 98+ / OSX.1+ | A |
| Gecko | Seamonkey 1.1 | Win 98+ / OSX.2+ | A |
| Gecko | Epiphany 2.20 | Gnome | A |
| Webkit | Safari 1.2 | OSX.3 | A |
| Webkit | Safari 1.3 | OSX.3 | A |
| Webkit | Safari 2.0 | OSX.4+ | A |
| Webkit | Safari 3.0 | OSX.4+ | A |
| Webkit | OmniWeb 5.5 | OSX.4+ | A |
| Webkit | iPod Touch / iPhone | iPod | A |
| Webkit | S60 | S60 | A |
| Presto | Opera 7.0 | Win 95+ / OSX.1+ | A |
| Presto | Opera 7.5 | Win 95+ / OSX.2+ | A |
| Presto | Opera 8.0 | Win 95+ / OSX.2+ | A |
| Presto | Opera 8.5 | Win 95+ / OSX.2+ | A |
| Presto | Opera 9.0 | Win 95+ / OSX.3+ | A |
| Presto | Opera 9.2 | Win 88+ / OSX.3+ | A |
| Presto | Opera 9.5 | Win 88+ / OSX.3+ | A |
| Presto | Opera for Wii | Wii | A |
| Presto | Nokia N800 | N800 | A |
| Presto | Nintendo DS browser | Nintendo DS | C/A1 |
| KHTML | Konqureror 3.1 | KDE 3.1 | C |
| KHTML | Konqureror 3.3 | KDE 3.3 | A |
| KHTML | Konqureror 3.5 | KDE 3.5 | A |
| Tasman | Internet Explorer 4.5 | Mac OS 8-9 | X |
| Tasman | Internet Explorer 5.1 | Mac OS 7.6-9 | C |
| Tasman | Internet Explorer 5.2 | Mac OS 8-X | C |
| Misc | NetFront 3.1 | Embedded devices | C |
| Misc | NetFront 3.4 | Embedded devices | A |
| Misc | Dillo 0.8 | Embedded devices | X |
| Misc | Links | Text only | X |
| Misc | Lynx | Text only | X |
| Misc | IE Mobile | Windows Mobile 6 | C |
| Misc | PSP browser | PSP | C |
| Other browsers | All others | - | U |


The Technology
Imagination, meet implementation. HTML5 is the cornerstone of the W3C's open web platform; a framework designed to support innovation and foster the full potential the web has to offer. Heralding this revolutionary collection of tools and standards, the HTML5 identity system provides the visual vocabulary to clearly classify and communicate our collective efforts.
The Movement
You're excited about HTML5; we are too. You've not just been enjoying the HTML5-powered web already — you're building it! As adoption and inspiration spreads, the web community will find creative ways to apply HTML5 and related technologies, spark trends, and capture best practices. As momentum builds, we hope you bring this logo along for the ride and paint the world orange.


Fork IOCamlJS and switch to the gh-pages branch.
Create the new notebook in the notebooks subdirectory.
$ iocaml -js min notebooks/my_demo.ipynb -no-split-lines
Note we require the -no-split-lines option to save the notebook in a format understood by iocamljs when used without the server. Just ensure the notebook is saved this way before publishing.
Add a new html file to the project my_demo.html
with the following contents
---
layout: iocamljs
notebook_guid: "my_demo.ipynb"
kernel: min
---
The notebook_guid parameter should point to the newly created notebook. The kernel
parameter selects which iocamljs kernel will run. Here min
refers to the kernel
static/services/kernels/js/kernel.min.js
. You can also add new kernels
with custom package sets if required.
Finally add the link to the landing page in index.md
* [My demo](my_demo.html)
Send a pull request.


Top level functions
Project functions
create_project(name, description): Project
def get_project_by_id(project_id): Project
def get_all_projects(): list of Projects
User function
def get_all_users(): list of Users
Template function
def get_all_templates(): list of Templates
Classes for Objects of Discourse
User
- class variables
- id = ""
- fullname = ""
- email = ""
- class methods
- can_access(project): boolean
Project
- class variables
- id = ""
- name = ""
- description = ""
- size = 0
- mediatypes = {}
- _top = None
- source = remote_url
- delete_tally = {}
- class methods
- def rename(name, description=None): Project
-
def put(): Project
-
def delete(dry_run=False): Project with DeleteTally
-
def create_experiment(name, description): Experiment
-
def get_experiment_by_id(experiment_id): Experiment
-
def get_all_experiments(): Experiments
-
def created_directory(name, path): Directory
-
def get_directory_by_id(directory_id): Directory
-
def get_all_directories(): list of Directories
-
def get_top_directory(): Directory
- def get_directory_list(path): list of Directories
- def get_directory(directory_id): Directory
-
def create_or_get_all_directories_on_path(path): list of Directories
-
def add_directory(path): Directory
-
def add_file_using_directory(directory, file_name, local_path,
verbose=False, limit=50): File
-
def add_file_by_local_path(local_path, verbose=False, limit=50): File
-
def add_directory_tree_by_local_path(local_path, verbose=False,
limit=50): Directory
-
def fetch_sample_by_id(sample_id): Sample
-
def get_by_local_path(local_path): Directory
-
def file_exists_by_local_path(local_path, checksum=False): boolean
- def get_all_processes(): list of Processes
- def get_process_by_id(process_id): Process
- def get_all_samples(): list of Samples
-
def get_sample_by_id(sample_id): Sample
Experiment
- class variables
- id = None
-
name = ""
-
description = ""
-
project_id = None
-
project = None
-
status = None
-
funding = ''
-
note = ''
-
tasks = None
-
publications = None
-
notes = None
-
papers = None
-
collaborators = None
-
citations = None
-
goals = None
-
aims = None
-
category = None
-
samples = []
-
processes = {} # a set
-
delete_tally = {}
- class methods
- def rename(name): Experiment
-
def put(): Experiment
-
def delete(dry_run=False, delete_processes_and_samples=False): Experiment with DeleteTally
- def create_process_from_template(template_id): Process
-
def get_process_by_id(process_id): Process
- def get_all_processes(): list of Processes
- def get_sample_by_id(sample_id): Sample
-
def get_all_samples(): list of Samples
-
def decorate_with_samples(): Experiment
-
def decorate_with_processes(): Experiment
Process
- class variables
- does_transform = False
-
input_files = []
-
output_files = []
-
input_samples = []
-
output_samples = []
-
owner = ''
-
setup = []
-
measurements = []
-
transformed_samples = []
-
what = ''
-
why = ''
-
category = None
-
experiment = None
-
project = None
-
properties_dictionary = {}
-
# filled in when Process is in Sample.processes
-
direction = ''
-
process_id = ''
-
sample_id = ''
-
property_set_id = ''
-
experiments = []
-
# filled in when measurements are attached
-
measurements = []
- class methods
-
def pretty_print(shift=0, indent=2, out=sys.stdout): None
- def rename(process_name): Process
-
def put(): Process
- def create_samples(sample_names): Samples
-
def get_sample_by_id(process_id): Sample
-
def get_all_samples(): list of Samples
-
def add_input_samples_to_process(samples): Process
- def add_files(files_list): Process
- def get_setup_properties_as_dictionary(): directory of setup properties indexed by ?
- def set_value_of_setup_property(name, value): None
-
def set_unit_of_setup_property(name, unit): None
-
def update_setup_properties(name_list): Process
-
def make_list_of_samples_with_property_set_ids(samples): list of Samples
- def create_measurement(data): Measurement
- def set_measurements_for_process_samples(measurement_property,
measurements): Process
-
def set_measurement(attribute, measurement_data, name=None): Process
-
def add_integer_measurement(attribute, value, name=None): Process
- def add_number_measurement(attrname, value, name=None): Process
- def add_boolean_measurement(attrname, value, name=None): Process
- def add_string_measurement(attrname, value, name=None): Process
- def add_file_measurement(attrname, file, name=None): Process
-
def add_sample_measurement(attrname, sample, name=None): Process
-
def add_list_measurement(attrname, value, value_type, name=None): Process
- def add_numpy_matrix_measurement(attrname, value, name=None): Process
- def add_selection_measurement(attrname, value, name=None): Process
- def add_vector_measurement(attrname, value, name=None): Process
- def decorate_with_output_samples(): Process
- def decorate_with_input_samples(): Process
Sample
- class variables
- id = None
-
name = ""
-
property_set_id = ''
-
project = None
-
experiment = None
- properties = []
-
experiments = []
-
property_set_id = None
-
direction = ''
-
sample_id = None
- processes = {}
-
files = []
-
is_grouped = False;
-
has_group = False;
-
group_size = 0;
- class methods
-
def pretty_print(shift=0, indent=2, out=sys.stdout): None
- def rename(name): Sample
-
def put(): Sample
- def delete(): Sample
- def update_with_details(): Sample
- def decorate_with_processes(): Sample
Directory
- class variables
- id = ""
-
name = ""
-
checksum = ""
-
path = ""
-
size = 0
-
# additional fields
-
_project = None
-
_parent_id = None
-
Note: children are not stored locally, but always fetch from remote!
- class methods
- def rename(new_name): Directory
- def move(new_directory): Directory
- def put(): Directory
- def delete(): Directory
- def get_children(): list of (Directory or File)
- def create_descendant_list_by_path(path): list of Directory
- def get_descendant_list_by_path(path): list of Directory
- def add_file(file_name, input_path, verbose=False, limit=50): Directory
- def add_directory_tree(dir_name, input_dir_path, verbose=False,
limit=50): Directory
File
- class variables
- id = ""
-
name = ""
-
description = ""
-
owner = ""
-
path = ""
-
size = 0
-
uploaded = 0
-
checksum = ""
-
current = True
-
mediatype = {}
-
tags = []
-
notes = []
- samples = []
-
processes = []
- _project = None
-
_directory_id = None
- class methods
- def rename(new_file_name): File
- def move(new_directory): File
- def put(): File
- def delete(): File
- def download_file_content(local_download_file_path): local (output) file_path
-
def parent(): Directory
-
def local_path(): local path
Template
NOTE: Template is truncated, for now, as we only need the id to create a processes from a Template
-
global (static) values
-
create = "global_Create Samples"
-
compute = "global_Computation"
- primitive_crystal_structure = "global_Primitive Crystal
Structure"NOTE: Template is truncated, for now, as we only need the id
to create a processes from a Template
- class methods
-
def pretty_print(shift=0, indent=2, out=sys.stdout): None
Property
- class variables
- setup_id = ''
-
property_set_id = ''
-
parent_id = ''
-
property_id = ''
-
required = False
-
unit = ''
-
attribute = ''
-
value = ''
-
units = [] # of string
-
choices = [] # of string
- class methods
-
def abbrev_print(shift=0, indent=2, out=sys.stdout): None
- def pretty_print(shift=0, indent=2, out=sys.stdout): None
Minor subclasses of Property
-
class MeasuredProperty
-
class NumberProperty
-
class StringProperty
-
class BooleanProperty
-
class DateProperty
-
class SelectionProperty
-
class FunctionProperty
-
class CompositionProperty
-
class VectorProperty
-
class MatrixProperty
class Measurement
- class variables
- attribute = ''
-
unit = ''
-
value = ''
-
file = None
-
is_best_measure = False
-
measurement_id = ''
-
sample_id = ''
-
property_id = ''
- class methods
-
def abbrev_print(shift=0, indent=2, out=sys.stdout): None
- def pretty_print(shift=0, indent=2, out=sys.stdout): None
Minor Subclasses on Measurement
-
class MeasurementComposition
-
class MeasurementString
-
class MeasurementVector
-
class MeasurementSelection
-
class MeasurementFile
-
class MeasurementInteger
-
class MeasurementNumber
-
class MeasurementBoolean
-
class MeasurementSample


Depei Zhang
Time complexity: O(n * log(n))
Leetcode runtime & memory (cpp): 16 ms (94.46%) & 13.1 MB
Solution:
P2: LC347. Top K Frequent Elements
Time complexity: O(n * log(k))
Leetcode runtime & memory (cpp): 8 ms (99.98%) & 11.5 MB
Solution:
P3: LC973. K Closest Points to Origin
Time complexity: O(n * log(k))
Leetcode runtime & memory (cpp): 240 ms (70.93%) & 49.4 MB
Solution:
P4: LC239. Sliding Window Maximum
Time complexity: O(n * log(k))
Leetcode runtime & memory (cpp): 52 ms (96.61%) & 15.1 MB
Solution:
P5: LC407. Trapping Rain Water II
Time complexity: O(m * n * log(m + n))
Leetcode runtime & memory (cpp): 12 ms (100.00%) & 12.9 MB
Solution:
P6: LC218. The Skyline Problem
Time complexity: O(n * log(n))
Leetcode runtime & memory (cpp): 20 ms (99.63%) & 14.6 MB
Solution:


Before Change
for key, val in other.items():
// Override the required set
if key in other.required_vars:
self._requiredVars.add(key)
elif key in self._requiredVars:
self._requiredVars.remove(key)
self._attr[key] = val
def extend(self, cls):
for key, var in getattr(cls, self.localAttrSpaceName).items():
After Change
for key, val in other.items():
// Multiple inheritance is NOT allowed
if key in self._attr:
raise ValueError(
f"var {key!r} is already present in the var space"
)
self._attr[key] = val
def extend(self, cls):
localVarSpace = getattr(cls, self.localAttrSpaceName)


---
title: 5 Habits that Boost Productivity
date: '2015-07-06T19:00:26+05:30'
tags:
- misc
tumblr_url: https://sureshshanmugam.com/post/123368855708/5-habits-that-boost-productivity
---
5 Habits that Boost Productivity
——————————
The Frictionless Field Guides are a freelancer’s best friend. Short, topical ebooks that are easy to read and full of powerful advice.
Check out the growing series today!


Questioner
Sign Up
Log In
Meetup Details
Meetup Topic
Type
type
Convention
Conference
Camp
Class
Rally
Workshop
Meeting
Meetup image
Location
Meetup Date
Organized by


DigitalArt!
We are a digital
design studio.
Full website coming soon.
Let's talk
Be first to know, and stay in touch.
Submit


OpenAFP
Contents
Index
OpenAFP
Portability
non-portable (GHC-only)
Stability
experimental
Maintainer
<EMAIL_ADDRESS>Description
This module re-exports all Records, Types, Internals and Prelude modules, and provides some toplevel convenience functions.
Synopsis
module
OpenAFP.Types
module
OpenAFP.Records
module
OpenAFP.Internals
module
OpenAFP.Prelude.Exts
module
OpenAFP.Prelude.Utils
module
OpenAFP.Prelude.Lookups
module
OpenAFP.Prelude.Instances
module
OpenAFP.Internals.UConv
readAFP
:: MonadIO m => FilePath -> m [
AFP_
]
writeAFP
::
Binary
a => FilePath -> [a] -> IO ()
filterAFP
:: FilePath -> FilePath -> [(
ChunkType
,
AFP_
-> IO [
AFP_
])] -> IO ()
readArgs
:: MonadIO m => Int -> m [String]
afp_Chunks
:: FilePath -> [
AFP_
]
Produced by
Haddock
version ADDOCK_VERSION


Latest Updates
- 10/10/2007 The first thing that most Javascript programmers
- 10/10/2007 End up doing is adding some code
- 10/10/2007 The code that you want to run
- 08/10/2007 Inside of which is the code that you want to run
- 08/10/2007 Right when the page is loaded
- 05/10/2007 Problematically, however, the Javascript code
- 04/10/2007 The first thing that most Javascript programmers
- 04/10/2007 End up doing is adding some code
- 04/10/2007 The code that you want to run
- 03/10/2007 Inside of which is the code that you want to run
- 03/10/2007 Right when the page is loaded
- 01/10/2007 Problematically, however, the Javascript code


class: left, middle background-image: url(../../images/master-folie.png) .title[ ## Proxies and Reflect API
### Oleg Varaksin ####<EMAIL_ADDRESS>] --- # Slide 1. --- class: center, middle, inverse # That's all folks, thanks for your attention! .back[[Back to the homepage](http://ova2.github.io/es6-presentations/)] Slideshow created with [remark](https://github.com/gnab/remark)


It is recommended that you always use the largest node size your available RAM can support. See the following table for recommended settings.
| RAM for rippled | node_size value |
Notes |
|---|---|---|
| < 8GB | tiny | Not recommended for testing or production servers. |
| 8GB | small | Recommended for test servers. |
| 16GB | medium | |
| 32GB | huge | Recommended for production servers. |
Tip
To tune your server, it may be useful to start with tiny and increase the size to small, medium, and so on as you refine the requirements for your use case.


An archetypal application has a grammar.
To create a grammar, use the marpa_g_new()
method.
When a grammar is no longer in use, its memory can be freed
using the
marpa_g_unref()
method.
To be precomputed,
a grammar must have one or more symbols.
To create symbols, use the
marpa_g_symbol_new()
method.
To be precomputed,
a grammar must have one or more rules.
To create rules, use the
marpa_g_rule_new()
and
marpa_g_sequence_new()
methods.
For non-trivial parsing,
one or more of the symbols must be terminals.
To mark a symbol as a terminal,
use the
marpa_g_symbol_is_terminal_set()
method.
To be precomputed,
a grammar must have exactly one start symbol.
To mark a symbol as the start symbol,
use the
marpa_g_start_symbol_set()
method.
Before parsing with a grammar, it must be precomputed.
To precompute a grammar,
use the
marpa_g_precompute()
method.


--- layout: post title: Yarn Along date: 2011-04-06 11:57:10.000000000 -04:00 categories: - Knitting - Yarn Along tags: - Fuzzy Felted Friends by Saori Yamazaki - Happy Gloves by Miyako Kanamori - Moda Vera Marvel Girls Dress - Wrapped in Love by Felicity Dawson - Yarn along status: publish type: post published: true meta: aktt_notify_twitter: 'no' _edit_last: '1' dsq_thread_id: '1188023961' author: login: cint email<EMAIL_ADDRESS>display_name: Jacinta first_name: Jacinta last_name: '' ---
Joining in with Ginny at Small Things yarn along this week.
I found this free pattern at Spotlight and thought it would be great for Scarlett for school. Scarlett's favourite colour at the moment is blue and I just love the colour of the yarn I chose for her. It is a greenish blue colour. However, the yarn is acrylic which has that cotton wool feel to it, which I don't like. (I purchased it in a rush and didn't realise it wasn't really soft). So I am having second thoughts about using it. I do have some lovely pure wool that is white, that I am thinking of colouring, which would be much nicer.  So technically, I haven't gotten anything on my needles at the moment, but it is consuming headspace!
Reading-wise, I purchased the books pictured below, at a book shop that has gone into liquidation and they were selling books a very reasonable prices. I couldn't help myself and purchased 3. The are all lovely and I think I will be giving away the Happy Gloves book by Miyako Kanamori, in a future giveaway. It's really cute. All the projects are made using a pair of gloves.
The Wrapped in Love book by Felicity Dawson, I have eyed off in the past, but couldn't resist it this time. The Fuzzy Felted Friends book by Saori Yamazaki is gorgeous and has heaps of cute projects. Lets just say, I have more than enough inspiration to keep me busy, just need to find more time (don't we all!!)
Jacinta x


A polar bar chart is similar to a bar chart, but the y-axis is circular. In this demo we see the total Winter Olympics medals earned for the top 10 countries.


Outline/Purpose
To provide a simple and easy to use budgeting system that allows money to be
assigned to categories that constitute an area of expense.
For every category of spending there is a corrasponding envelope. This ensure
that money can be set aside for that type of spending.
Accounts can be added to represent accounts existing in the real world to ensure
checks can be made to ensure everything is accounted for.
The system will also allow credit card spending and debt to contribute to total
available funds.
Accounts will assign expenses to a category this then removes this money from
the envelope.
Income can be slipt in to different sources and added to accounts when received
At the beginning of each budget cycle an amount is specified for each envelope and
these funds are taken from the pool of income and dispersed to the envelopes.
The user has the option of dispersing every dollar proportionally or simply specify
the amounts assigned to the envelopes the former dispersing every doller in the pool.
Credit cards provide 0 income and any amount withdrawn from the card is considered
a debt and subtracted from the net avaiable funds. Money can be transfered to a
credit card to remove the debt. This would represent a credit card payment in the
real world.
Example
Accounts Amount Limit
Everyday Account $1000 N/A
Saving Acccount $30,000 N/A
Credit Card -$100 $2000
Cash $20 N/A
Coin $12.85 N/A
Envelopes Weekly Budget Weekly spend
Morgage $300 $300
Groceries $100 $65(
Screenshots
Classes
Core Components
User
- string userName
- string password (encrypted hash)
- Account[] accounts
- Envelope[] evelopes
- Currency netTotal
________________________
+ string getUserName()
+ void setUserName()
+ string getPassword()
+ void setPassword()
Account
- string name
- Currency total
________________
+ string getName()
+ void setName()
+ Currency getTotal()
+ void setTotal()
+ void addTransaction()
+ void removeTransaction()
BankAccount extends Account
- string bankName
______________________________
+ string getBankName()
+ void setBankName()
Envelope extends Account
- Currency budgetAmount
________________________
+ Currency getBugetAmount()
+ void setBudgetAmount()
Transaction
- date date
- amount currency
- category category
- string otherParty
- string description
__________________________
+ Date getDate()
+ void setDate()
+ Currency getAmount()
+ void setAmount()
+ Category getCategory()
+ void setCategory()
+ string getOtherParty()
+ void setOtherParty()
+ string getDescription()
+ void setDescription()
Withdrawal extends Transaction
Deposit extends Transaction
Utilities
Currency
- dollars Integer
- cents Integer
Date
- day integer
- month integer
- year integer
INAGB Interface
*Pages
MainScreen
-buttons button[]


If you happen to see this page, it is obviously that the agent is not working, or that you have not yet imported the CSV rules file to be applied on this demo project.
Please note that you may have to wait a bit before the rules are applied - it can take up to 10 minutes on a free plan.


The StratusLab OpenNebula Proxy adds the StratusLab authentication mechanisms to OpenNebula. The links (password, certificate) to the endpoint require an XML-RPC (not a browser) client.
See other files in the parent directory for information and links to services running on this machine.


Jiaming "Fungus" Chen
No description available
Fungus
Quantity: 5
New Quantity:
Gummy Bears
Quantity: 1
Chicken
Quantity: 10
Apartment Building
Quantity: 1
Birthday Cake
Quantity: 2
Pants
Quantity: 1
Chocolate Bars
Quantity: 100
Gum
Quantity: 1
Friends
Quantity: 0
How many would you like?


| Interface | Description |
|---|---|
| ActionFilter |
A filter allowing to filter transport actions
|
| ActionFilterChain |
A filter chain allowing to continue and process the transport action request
|
| Class | Description |
|---|---|
| AbstractListenableActionFuture<T,L> | |
| ActionFilter.Simple |
A simple base class for injectable action filters that spares the implementation from handling the
filter chain.
|
| ActionFilters |
Holds the action filters injected through plugins, properly sorted by
ActionFilter.order() |
| AdapterActionFuture<T,L> | |
| AutoCreateIndex |
Encapsulates the logic of whether a new index should be automatically created when
a write operation is about to happen in a non existing index.
|
| DefaultShardOperationFailedException | |
| DelegatingActionListener<Instigator extends ActionResponse,Delegated extends ActionResponse> | |
| DestructiveOperations |
Helper for dealing with destructive operations and wildcard usage.
|
| HandledTransportAction<Request extends ActionRequest,Response extends ActionResponse> |
A TransportAction that self registers a handler into the transport service
|
| IndicesOptions |
Controls how to deal with unavailable concrete indices (closed or missing), how wildcard expressions are expanded
to actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices.
|
| PlainActionFuture<T> | |
| PlainListenableActionFuture<T> | |
| ThreadedActionListener<Response> |
An action listener that wraps another action listener and threading its execution.
|
| ThreadedActionListener.Wrapper |
Wrapper that can be used to automatically wrap a listener in a threaded listener if needed.
|
| ToXContentToBytes |
Base class for
ToXContent implementation that also support conversion to BytesReference for serialization purposes |
| TransportAction<Request extends ActionRequest,Response extends ActionResponse> | |
| TransportActions |