Here’s a list of things that I’ve had to do on mysql from time to time. You dont always need these but when you do, its good to have them put together in one place.
Enable logging and get all sql queries hitting a mysql DB written to a log file
mysql> show variables like “general_log%”; This shows you two values usually. One ‘’ is a flag for setting general logging on and off. The other ‘’ is where to actually log to.
mysql> SET GLOBAL general_log = ‘ON’;
mysql> show variables like “general_log%”;
+——————+————————-+
| Variable_name | Value |
+——————+————————-+
| general_log | ON |
| general_log_file | /var/lib/mysql/logname.log |
+——————+————————-+
2 rows in set (0.00 sec)
tail -f /var/log/mysqld/logname.log
When you’ve gotten what you’re looking for, go back and turn off the logging.
mysql> SET GLOBAL general_log = 'OFF’;
Enabling slow query logging
You notice a web page loading slowly and you suspect it might be because its taking a long time to fetch the results from the DB. Or you’re running performance tests against your system and you want to find out which of your queries are running slowly and hurting your system’s response time? Well - mysql has a slow query logging facility that can help you narrow down the issue.
ssh into your mysql server as a user that has superuser privileges etc and add the below lines to /etc/my.cnf and restart mysql service on that box.
[mysqld]
slow_query_log=1
slow_query_log_file=/tmp/slow.log
long_query_time=2
The ‘slow_query_log’ flag turns on or off slow query logging. The ‘slow_query_log_file’ setting specifies the actual file to log to and the ‘long_query_time’ is the setting where you specify what is to be considered a slow query. Here, 2 stands for anything longer than 2 seconds.
And you’re all set! Run your tests, your UI scripts etc and then check in on the /tmp/slow.log file and you should see the queries you’re interested in.
Listing out all the currently executing queries on a mysql server
The show processlist
command is really useful in that, it shows you whats currently executing on your mysql server, what state they are in etc etc. Sort of like the ps -ef
for mysql.
mysql> show processlist;
+—-+——+———–+——-+———+——-+———-+——————+
| Id | User | Host | db | Command | Time | State | Info
|
+—-+——+———–+——-+———+——-+———-+——————+
| 29 | test | localhost | test | Sleep | 281 | | NULL
|
| 30 | test | localhost | test | Sleep | 281 | | NULL
|
| 31 | test | localhost | test | Sleep | 281 | | NULL
|
| 32 | test | localhost | test | Sleep | 15280 | | NULL
|
| 35 | test | localhost | dbmap | Sleep | 13481 | | NULL
|
| 41 | test | localhost | dbmap | Sleep | 3033 | | NULL
|
| 42 | test | localhost | test | Sleep | 3033 | | NULL
|
| 43 | root | localhost | NULL | Query | 0 | starting | show
processlist |
+—-+——+———–+——-+———+——-+———-+——————+
8 rows in set (0.00 sec)
Getting mysql server status from the command line
After you’ve logged into your mysql server, issue the status
command to see various bits of information about your mysql server and your current session, including current user, current database, is SSL being used or not, mysql version, Server characterset, uptime of the server, number of slow queries, no of open tables, average number of queries per second etc. Here’s a sample output,
mysql> status
————–
mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64) using EditLine
wrapper
Connection id: 59
Current database: test
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ’’
Using delimiter: ;
Server version: 5.7.17 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 4 hours 39 min 28 sec
Threads: 8 Questions: 7605 Slow queries: 0 Opens: 626 Flush tables:
1 Open tables: 588 Queries per second avg: 0.453
Finding simple things about the DB like - what are the different
databases available, what are the different tables in current DB etc
show databases;
show tables;
The easier way to get deadlock data to find deadlocks in your DB
Install innotop (yum install innotop).
Once you’ve got that installed, you can connect innotop to your DB from the command line like this
innotop –user root –askpass
and you will be prompted for the password on the command line. Then you will be placed in the Dashboard view of innotop. Hit ? there and you will see a list of different information screens that you can then navigate to depending on what you’re trying to find out. L for locks, U for user statistics, D for InnoDB deadlocks, M for replication status, K for InnoDB Lock Waits etc. Try it out!
This article has a whole lot more information on using innotop
Finding deadlocks with queries running against your DB (The harder way)
The show engine innodb status;
gives you a whole lot of data about
your database. One of the things that I find useful is the data on
deadlocks.
Here’s a sample output from this command, (Warning - wall of text coming your way, my apologies!)
| InnoDB | |
=====================================
2017-02-06 21:32:28 0x7f5326922700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 2 seconds
—————–
BACKGROUND THREAD
—————–
srv_master_thread loops: 32 srv_active, 0 srv_shutdown, 15943 srv_idle
srv_master_thread log flush and writes: 15975
———-
SEMAPHORES
———-
OS WAIT ARRAY INFO: reservation count 1101
OS WAIT ARRAY INFO: signal count 1033
RW-shared spins 0, rounds 399, OS waits 218
RW-excl spins 0, rounds 127, OS waits 3
RW-sx spins 0, rounds 0, OS waits 0
Spin rounds per wait: 399.00 RW-shared, 127.00 RW-excl, 0.00 RW-sx
————
TRANSACTIONS
————
Trx id counter 4075
Purge done for trx’s n:o < 3940 undo n:o < 0 state: running but idle
History list length 17
LIST OF TRANSACTIONS FOR EACH SESSION:
—TRANSACTION<PHONE_NUMBER>91456, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>89632, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>88720, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>90544, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>87808, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>86896, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>85984, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
—TRANSACTION<PHONE_NUMBER>85072, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
LOG
—
Log sequence number 5145450
Log flushed up to 5145450
Pages flushed up to 5145450
Last checkpoint at 5145441
0 pending log flushes, 0 pending chkp writes
1490 log i/o’s done, 0.00 log i/o’s/second
———————-
BUFFER POOL AND MEMORY
———————-
Total large memory allocated 137428992
Dictionary memory allocated 2551617
Buffer pool size 8191
Free buffers 7084
Database pages 1096
Old database pages 384
Modified db pages 0
Pending reads 0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 231, created 865, written 1002
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read
ahead 0.00/s
LRU len: 1096, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
————–
ROW OPERATIONS
————–
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=5270, Main thread ID=139994953017088, state: sleeping
Number of rows inserted 5124, updated 362, deleted 17, read 21639
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s


## My Talks _By Daniel Scheufler_
Contact: [Daniel<EMAIL_ADDRESS>Blog: [Daniel.Scheufler.io](daniel.scheufler.io)
Loop: [Loop-de-loop](/_loop.html)
## Whiteboarding * [Demystifying the Whiteboard Interview](talks/whiteboard/demystify-whiteboard.html) * [NHDNUG - Towards a Better Whiteboarding Interview](talks/whiteboard/whiteboard-nhdnug.html) * [TechFriday - Whiteboarding Communication](talks/whiteboard/whiteboard-tech-friday.html)
## Meetings * [Designing and Running Effective Meetings](talks/meeting/effective-meeting.tf.html) * [NHDNUG](talks/meeting/effective-meeting.nhdnug.html)
## Joint * Expand your Impace * How to break into Public Speaking
## Miscellanous * [Micro-Team Experiment](talks/joint/micro-teams.html) * [IU COMM 112: Effective Communication on the Whiteboard](talks/whiteboard/effective-comm.html) * [Words Must Mean Things](talks/words_mean_things.html)
## WIP * [What is a Software Engineer](talks/software-engineer.html) * React/Redux Testing with Jest
## Ideas * Effective git * React/Redux Program Design * Hexo as a Blog?


You are given an object like this:
{ 'Name' : 'Pesho', 'Born' : 'Asia', 'BirthDate' : 2006, 'Live' : 'Sofia Zoo' }
You need to extract information with Angular and add it to your HTML file in the same way as the picture below:
Add image in the object from this URL: http://tigerday.org/wp-content/uploads/2013/04/tiger.jpg
Note: Use only Angular JS styles for text values.


Reflected bool type.
Reflected unsigned 8-bit integer type.
Reflected 64-bit float type.
Reflected 32-bit float type.
Reflected signed 32-bit integer type.
Reflected signed 64-bit integer type.
Reflected signed 8-bit integer type.
Reflected signed 16-bit integer type.
Reflected unsigned 32-bit integer type.
Reflected 32-bit pointer type. Relevant only when compiling for 32-bit WebAssembly.
Reflected 64-bit pointer type. Relevant only when compiling for 64-bit WebAssembly.
Reflected unsigned 64-bit integer type.
Reflected unsigned 16-bit integer type.
Reflected void type.
Tests if the specified global name references a built-in array.
Tests if the specified global name references a built-in string.
Patches a declaration to inherit from its actual implementation.
Generated using TypeDoc
Reflection components representing the actual WebAssembly output.


Policy gradient
Posted: 2016-11-22 , Modified: 2016-11-22
Tags: reinforcement learning
Posted: 2016-11-22 , Modified: 2016-11-22
Tags: reinforcement learning
[SASM00] Policy gradient methods for RL with function approximation
A version of policy iteration with arbitrary differentiable function converges to a locally optimal policy.
Problems with the value-function approach
\[\De \te \approx \al \pdd{\rh}{\te}.\]
The policy is parameterized by \(\te\), and gives probabilities of making action \(a\) in state \(s\), \[ \pi_\te(a|s) = \Pj_\te(a|s). \] Before, we considered the value at every state. Here, it’s more convenient to consider the value of a fixed start state, which we’ll denote by \(\rh\).
There are 2 ways we can have an expression for \(\rh\).Consider two settings.
The second is the usual definition of the \(Q\)-function. Think of the first as “advantage” of starting at \((s,a)\). It converges because working out with matrices, \[ \E R_t = \rh_\te + O_{s,a} \pa{\la^t} \] where \(\la\) is the second-largest eigenvalue of the transition matrix (besides 1). So instead of discounting to make \(Q\) converge, we subtract the mean to make \(Q\) converge. Define \(V^\pi(s) = \max_a Q^\pi(s,a)\).
Then (for continuous spaces replace \(\sum\) with \(\int\)) \[\rh_\te = \sum_s d_\te(s) \sum_{a} Q^\te(s,a) \pi_\te(a|s) \] (Whenever something depends on the policy \(\pi_\te\), we write \(\te\) as shorthand: \(Q^{\te} = Q^{\pi_\te}\).
We need to calculate the derivative. Naively using the product rule, we would need \(\nb_\te d_\te(s)\) which we don’t have a way of estimating. But we can derive an expression that doesn’t include this term! To do this we differentiate the Bellman equation for \(V\) (which implicitly includes \(\rh\)).
Lemma 1. \[ \nb_\te \rh_\te = \sum_s d_\te(s) \sum_a \nb_\te \pi(s|a) Q^\te(s,a). \]
Proof. Our strategy is to write the one-step expansion of \(Q^\te\) Let \(R(s,a)\) be the one-step reward of action \(a\) in state \(s\). We write the proof for the undiscounted case. \[\begin{align} \nb_\te V^\te (s) &= \sum_a \pa{ (\nb_\te \pi_\te(a|s)) Q^\te(s,a) + \pi_\te(a|s) (\nb_te Q^\te(s,a))} &= \sum_a (\nb_\te \pi_\te (a|s)) Q^\te(s,a) + \pi(a|s) \nb_\te\pa{\E R(s,a) - \rh_\te + \sum_{s'} \Pj(s'|s,a) V^{\te}(s')}\\ \nb_\te \rh_\te &= \pa{\sum_a \nb_\te \pi_\te (a|s)) Q^\te(s,a) + + \pi(a|s) \sum_{s'} \nb_\te V^{\te} (s') \Pj(s'|s,a) }- \nb_\te V^{\te}(s) \end{align}\] This is unsatisfactory because we can’t estimate \(\nb_\te V^{\te}(s')\) for every \(s'\). But there is a combination of these we can estimate, namely the stationary distribution. So multiply by \(d_\te(s)\) and sum. \[\begin{align} \nb_\te \rh_\te &= \pa{\sum_{s} d_\te(s) \pa{\sum_a(\nb_\te \pi_\te(a|s)) Q^{\te}(s,a)} + \cancel{d_\te(s) \pa{\sum_a\pi(a|s) \sum_{s'} \nb_\te V^{\te}(s') \Pj(s'|s,a)}} - \cancel{\nb_\te V_\te(s)}}. \end{align}\]We have to replace \(Q^\te\) by an estimate. This doesn’t correspond to an update rule directly, because we can’t estimate \(\nb_\te(s|a)\).
We estimate of \(Q^\te\) by a function approximation, updating by \(\nb_w (\wh Q^\te(s,a) - f_w(s,a))^2\) given a sample \((s,a)\). This converges to a local min where (\(\wh Q^\te\) is an unbiased estimator) \[\begin{align} \E \nb_w \pa{\wh Q^{\te} (s,a) - f_w(s,a)} &=0\\ \sum_s d_\te(s) \sum_a \pi_\te(s|a) (Q^\te(s,a) - f_w(s,a)) &=0 \end{align}\]We would like to be able to replace \(Q^\te(s,a)\) in Lemma 1 with the approximation \(f_w(s,a)\). In order to do this we need the error to be 0: \[ \sum_s d^{\pi}(s) \pa{ \sum_a (\nb_\te \pi_\te(s|a)) Q^\te(s,a) - \nb_\te\pi(s|a) f_w(s,a) } \] In order for these to match up, we need \[ \nb_w f_w(s,a) = \fc{\nb_\te \pi(s|a)}{\pi(s|a)} = \nb_\te(\ln \pi(s|a)). \]
Question: Do people wait until convergence, or do they do alternating minimization in practice? Does alternating minimization converge?
Work out the loglinear case: \[\begin{align} \pi(s|a) &= \fc{e^{\te^T \phi_a(s)}}{\sum_b e^{\te^T\phi_b(s)}}\\ \nb_\te \ln \pi(s|a) &= \phi_a(s) - \fc{\sum_b e^{\te^T\phi_b(s)} \phi_b(s)}{\sum_b e^{\te^T \phi_b(s)}}\\ &= \phi_a(s) - \sum_b \pi(s|b) \phi_b(s). \end{align}\]So take \[ f_w(s,a) = w^T ( \phi_a(s) - \sum_b \pi(s|b) \phi_b(s)). \]
How well does this parametrization work, compared to Q-learning by FA?


| Contents | Previous | Next | Java Management Extensions (JMX) Technology Tutorial |
This chapter introduces the fundamental notion of the Java Management Extensions (JMX) API, namely managed beans, or MBeans.
An MBean is a managed Java object, similar to a JavaBeanTM, that follows the design patterns set forth in the instrumentation level of the JMX specification. An MBean can represent a device, an application, or any resource that needs to be managed. MBeans expose a management interface: a set of readable and/or writable attributes and a set of invokable operations, along with a self-description. The management interface does not change throughout the life of an MBean instance. MBeans can also emit notifications when certain defined events occur.
The JMX specification defines four types of MBean: standard MBeans, dynamic MBeans, open MBeans and model MBeans. The examples in this chapter demonstrate the simplest type of MBean, namely standard MBeans.
A standard MBean is defined by writing a Java
interface called SomethingMBean
and a
Java class called Something
that
implements that interface. Every method in the interface defines
either an attribute or an operation in the MBean. By default every
method defines an operation. Attributes and operations are simply
methods which follow certain design patterns. A standard MBean is
composed of the MBean interface which lists the methods for all
exposed attributes and operations, and the class which implements
this interface and provides the functionality of the instrumented
resource.
The following sections dissect an example standard
MBean, and a simple JMX agent that manages the MBean. The code
samples are taken from the directory work_dir/jmx_examples/Essential/com/example/mbeans.
An example of a very basic MBean interface, named
HelloMBean
, is shown in CODE EXAMPLE 2-1.
package com.example.mbeans; public interface HelloMBean { public void sayHello(); public int add(int x, int y); public String getName(); public int getCacheSize(); public void setCacheSize(int size); }
As stated previously, by convention an MBean
interface takes the name of the Java class that implements it, with
the suffix MBean added. So, in this case, the interface is
called HelloMBean
. The Hello
class that implements this interface is
described in Section "MBean
Implementation".
According to the JMX specification, an MBean
interface consists of named and typed attributes that are readable
and possibly writable, and named and typed operations that can be
invoked by the applications that are managed by the MBean. The
HelloMBean
interface shown in CODE EXAMPLE 2-1, declares
two operations: the Java methods add()
and sayHello()
.
Of the two attributes that are declared by
HelloMbean
, Name
is a read-only string, and CacheSize
is an integer that can be both read and
written. Getter and setter methods are declared, to allow the managed
application to access and possibly change the attribute values. As
defined by the JMX specification, a getter is any public method
whose name begins with get and which does not return void. A getter
enables a manager to read the value of the attribute, whose type is
that of the returned object. A setter is any public method whose
name begins with set and which takes a single parameter. A setter
enables a manager to write a new value in the attribute, whose type
is the same as that of the parameter.
The implementation of these operations and attributes is shown in the following section.
The Hello
class shown
in CODE EXAMPLE 2-1
implements HelloMBean
.
package com.example.mbeans; public class Hello implements HelloMBean { public void sayHello() { System.out.println("hello, world"); } public int add(int x, int y) { return x + y; } public String getName() { return this.name; } public int getCacheSize() { return this.cacheSize; } public synchronized void setCacheSize(int size) { this.cacheSize = size; System.out.println("Cache size now " + this.cacheSize); } private final String name = "Reginald"; private int cacheSize = DEFAULT_CACHE_SIZE; private static final int DEFAULT_CACHE_SIZE = 200; }
The straightforward Java class Hello
provides the definitions of the operations and
attributes declared by HelloMBean
. As
you can see, the sayHello()
and
add()
operations are extremely simple,
but real-life operations can be as simple or as sophisticated as
you like.
Methods to get the Name
attribute and to get and set the cacheSize
attribute are also defined. In this
example, the Name
attribute value never
changes, but in a real scenario it might change as the managed
resource runs. For example, the attribute might represent
statistics such as uptime or memory usage. Here, it is merely the
name “Reginald”.
Calling the setCacheSize
method allows you to alter the
cacheSize
attribute from its declared
default value of 200. In reality, changing the cacheSize
attribute could require other operations
to be performed, such as discarding entries or allocating new ones.
This example merely prints a message to confirm that the cache size
has changed, but more sophisticated operations could be defined in
the place of the simple call to println()
.
With the simple Hello
MBean and its interface thus defined, they can now be used to
manage the resource they represent, as shown in the following
section.
As presented in the Java Management Extensions (JMX) Technology Overview, once a resource has been instrumented by MBeans, the management of that resource is performed by a JMX agent.
The core component of a JMX agent is the
MBean server, a managed object server in
which MBeans are registered (see the API documentation for the
MBeanServer
interface for details of the
MBean server implementation). A JMX agent also includes a set of
services to manage MBeans.
CODE EXAMPLE 2-1 presents
a basic JMX agent, named Main
.
package com.example.mbeans; import java.lang.management.*; import javax.management.*; public class Main { public static void main(String[] args) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("com.example.mbeans:type=Hello"); Hello mbean = new Hello(); mbs.registerMBean(mbean, name); System.out.println("Waiting forever..."); Thread.sleep(Long.MAX_VALUE); } }
The JMX agent Main
begins by obtaining any MBean server that is running on the
platform, by calling the getPlatformMBeanServer()
method of the java.lang.management.ManagementFactory
class. If
there is no MBean server already running on the platform, then
getPlatformMBeanServer()
creates one
automatically by calling the JMX method MBeanServerFactory.createMBeanServer()
. The
MBeanServer
instance obtained by
Main
is named mbs
.
Next, Main
defines an
object name for the MBean instance it will create. Every JMX MBean
must have an object name. The object name is an instance of the JMX
class ObjectName
, and must conform to
the syntax defined by the JMX specification, namely it must
comprise a domain, and a list of
key-properties (see the API
documentation for the ObjectName
class
for details of this syntax). In the object name defined by
Main
, name
,
the domain is com.example.mbeans
(the
package in which the example MBeans are contained) and the
key-property declares that this object is of the type Hello
.
An instance of a Hello
object is created, named mbean
. This
Hello
object is itself an instance of
the MBean Hello
that was defined in
Section "MBean
Implementation".
The Hello
object named
mbean
is then registered as an MBean in
the MBean server mbs
with the object
name name
, by passing the object and the
object name into a call to the JMX method MBeanServer.registerMBean()
.
With the Hello
MBean
registered in the MBean server, Main
will simply wait for management operations to be performed on
Hello
. In the scope of this example,
these management operations are invoking sayHello()
, and add()
,
and getting and setting the attribute values.
Having examined the example classes, you can now
run the example. The Java Platform, Standard Edition comes with a
management and monitoring console, named JConsole, that is used to
interact with the MBean in this example. JConsole is located in
JavaSE_HOME/bin/jconsole
, in which JavaSE_HOME is the installation directory of the
Java Platform, Standard Edition (Java SE platform).
To run the example, follow the steps below, or see
the README
file:
/jmx_examples/Essential
.
$
cd work_dir/jmx_examples/Essential
$
javac com/example/mbeans/*.java
Main
application.
$
java com.example.mbeans.Main
You will see confirmation that Main
is waiting for something to happen.
$
jconsole
You will see the JConsole tool open, presenting a list of running JMX agents that you can connect to.
com.example.mbeans.Main
from
the list in the “New Connection” window, and click on
“Connect”.
You will see a summary of your platform’s current activity.
This panel shows you all the MBeans currently registered in the MBean server.
com.example.mbeans
node in the MBean tree.
You will see the example MBean Hello
, that was created and registered by
Main
. If you click on Hello
, you will see its associated Attributes and
Operations nodes in the MBean tree.
Hello
MBean node in the
MBean tree.
The Hello
MBean’s
metadata and its associated Descriptor will be displayed.
Attributes
node of the
Hello
MBean in the MBean tree.
This displays the MBean attributes that were
defined by the Hello
class.
CacheSize
attribute to 150
In the terminal window in which you started
Main
, you will see confirmation of this
change of attribute.
Operations
node of the
Hello MBean in the MBean tree.
Here you will see the two operations declared by
the Hello
MBean, sayHello()
and add()
.
sayHello()
operation, by
clicking on the sayHello
button.
A JConsole dialogue box will inform you that the
method was invoked successfully, and you will see the message
“hello, world” in the
terminal window in which Main
is
running.
add()
operation to add up, and click on the add
button.
You will be informed of the answer in a JConsole dialogue box.
MBeans can generate notifications, for example to signal a state change, a detected event, or a problem.
For an MBean to generate notifications, it must
implement the interface NotificationBroadcaster
, or its subinterface
NotificationEmitter
. All you need to do
to send a notification is to construct an instance of the class
javax.management.Notification
or a
subclass (such as AttributeChangedNotification
), and pass it to
NotificationBroadcasterSupport.sendNotification
.
Every notification has a source. The source is the object name of the MBean that emitted the notification.
Every notification has a sequence number. This number can be used to order notifications coming from the same source when order matters and there is a danger of the notifications being handled in the wrong order. It is all right for the sequence number to be zero, but it is better for it to increment for each notification from a given MBean.
There is an example of a standard MBean that emits
notifications in the directory work_dir/jmx_examples/Notification/com/example/mbeans
. This
example is essentially the same as the example seen in Section "Standard
MBeans", except that the Hello
MBean implements the NotificationBroadcaster
interface.
As stated above, the only difference between this example and the one presented in Section "Standard MBeans" is the fact that the MBean implementation allows for the sending of notifications.
Notifications are activated by implementing the
NotificationBroadcaster
interface, as
shown in CODE EXAMPLE 2-1.
package com.example.mbeans; import javax.management.*; public class Hello extends NotificationBroadcasterSupport implements HelloMBean { public void sayHello() { System.out.println("hello, world"); } public int add(int x, int y) { return x + y; } public String getName() { return this.name; } public int getCacheSize() { return this.cacheSize; } public synchronized void setCacheSize(int size) { int oldSize = this.cacheSize; this.cacheSize = size; System.out.println("Cache size now " + this.cacheSize); Notification n = new AttributeChangeNotification(this, sequenceNumber++, System.currentTimeMillis(), "CacheSize changed", "CacheSize", "int", oldSize, this.cacheSize); sendNotification(n); } @Override public MBeanNotificationInfo[] getNotificationInfo() { String[] types = new String[] { AttributeChangeNotification.ATTRIBUTE_CHANGE }; String name = AttributeChangeNotification.class.getName(); String description = "An attribute of this MBean has changed"; MBeanNotificationInfo info = new MBeanNotificationInfo(types, name, description); return new MBeanNotificationInfo[] {info}; } private final String name = "Reginald"; private int cacheSize = DEFAULT_CACHE_SIZE; private static final int DEFAULT_CACHE_SIZE = 200; private long sequenceNumber = 1; }
As you can see in CODE EXAMPLE 2-1, this
Hello
MBean implementation extends the
NotificationBroadcasterSupport
class,
that itself implements the NotificationEmitter
interface.
The operations and attributes are set in the same
way as before, with the only exception that the cacheSize
attribute’s setter method now
defines a new value oldSize
, which
records the cacheSize
attribute’s
value prior to the set operation.
The notification is constructed from an instance,
n
, of the JMX class AttributeChangeNotification
, which extends
javax.management.Notification
. The
notification is constructed within the definition of the
setCacheSize()
method, from the
following information, that is passed to AttributeChangeNotification
as parameters:
Hello
MBean, represented simply by
this
sequenceNumber
, that is set at 1 and
that increases incrementallycacheSize
oldSize
this.cacheSize
The notification n is then passed to the
NotificationBroadcasterSupport.sendNotification()
method.
Finally, the MBeanNotification
is defined to describe the
characteristics of the different notification instances emitted by
the MBean for a given Java class of notification, which in this
case is AttributeChangeNotification
notifications.
The MBean interface, HelloMBean
, and the JMX agent Main
are identical to those used in the previous
example.
Having examined the example classes, you can now
run the example. This example again uses JConsole to interact with
the Hello
MBean.To run the example,
follow the steps below, or see the README
file:
/jmx_examples/Notification
.
$
cd work_dir/jmx_examples/Notification
$
javac com/example/mbeans/*.java
Main
application.
$
java com.example.mbeans.Main
You will see confirmation that Main
is waiting for something to happen.
$
jconsole
You will see the JConsole tool open, presenting a list of running JMX agents that you can connect to.
com.example.mbeans.Main
from
the list in the “New Connection” window, and click on
“Connect”.
You will see a summary of your platform’s current activity.
This panel shows you all the MBeans currently registered in the MBean server.
com.example.mbeans
node in the MBean tree.
You will see the example MBean Hello
, that was created and registered by
Main
. If you click on Hello
, you will see its associated Attributes
, Operations
and Notifications
nodes in the MBean
tree.
Hello
MBean node in the
MBean tree.
This displays the MBean’s metadata and its associated Descriptor.
Notifications
node of
the Hello MBean in the MBean tree.
You will see that the panel is blank.
The current number of notifications received (0), will be displayed in the Notifications node label.
Attributes
node of the
Hello
MBean in the MBean tree, and
change the value of the CacheSize
attribute to 150
In the terminal window in which you started
Main
, you will see confirmation of this
change of attribute. You will also see that the number of
notifications received displayed in the Notifications node has
changed to 1.
Notifications
node of
the Hello
MBean in the MBean tree again.
You will see the details of the notification that was sent.
An MXBean is a new type of MBean that provides a simple way to code an MBean that only references a pre-defined set of types. In this way, you can be sure that your MBean will be usable by any client, including remote clients, without any requirement that the client have access to model-specific classes representing the types of your MBeans. MXBeans provide a convenient way to bundle related values together without requiring clients to be specially configured to handle the bundles.
In the same way as for standard MBeans, an MXBean
is defined by writing a Java interface called SomethingMXBean
and a Java class that implements that
interface. However, unlike standard MBeans, MXBeans do not require
the Java class to be called Something
.
Every method in the interface defines either an attribute or an
operation in the MXBean. The annotation @MXBean
can be also used to annotate the Java
interface instead of requiring the interface’s name to be
followed by the MXBean suffix.
MXBeans provide a convenient way to bundle related
values together in an MBean without requiring clients to be
specially configured to handle the bundles when interacting with
that MBean. MXBeans already existed in the Java 2 Platform,
Standard Edition (J2SE) 5.0, in the package java.lang.management
. With the Java SE 6 platform,
users can now define their own MXBeans, in addition to the standard
set defined in java.lang.management
.
The key idea behind MXBeans is that types such as
java.lang.management.MemoryUsage
that
are referenced in the MXBean interface, java.lang.management.MemoryMXBean
in this case, are
mapped into a standard set of types, the so-called Open Types that
are defined in the package javax.management.openmbean
. The exact mapping rules
appear in the MXBean specification, but to oversimplify we could
say that simple types like int
or
String
are unchanged, while complex
types like MemoryUsage
get mapped to the
standard type CompositeDataSupport
.
The operation of MXBeans is demonstrated by
example programs that you will find in the directory work_dir/jmx_examples/MXBean/com/example/mxbeans
after you
have downloaded and unzipped the jmx_examples.zip
file. The MXBean example contains
the following files:
QueueSamplerMXBean
interface.QueueSampler
class that implements
the MXBean interface.QueueSample
Java type returned by
the getQueueSample()
method in the
MXBean interface.Main
, the program that sets up and
runs the example.The MXBean example performs the following actions.
type Queue<String>
.getQueueSample
,
in the MXBean that takes a snapshot of the queue when invoked and
returns a Java class QueueSample
that
bundles the following values together:CODE EXAMPLE 2-1 shows the
code of the sample QueueSamplerMXBean
interface.
package com.example.mxbeans; public interface QueueSamplerMXBean { public QueueSample getQueueSample(); public void clearQueue(); }
As you can see, you declare an MXBean interface in
exactly the same way as you declare a standard MBean. The
QueueSamplerMXBean
interface declares
two operations, getQueueSample
and
clearQueue
.
The QueueSampler
class
implements the QueueSamplerMXBean
interface, as shown in CODE EXAMPLE 2-1.
package com.example.mxbeans; import java.util.Date; import java.util.Queue; public class QueueSampler implements QueueSamplerMXBean { private Queue<String> queue; public QueueSampler(Queue<String> queue) { this.queue = queue; } public QueueSample getQueueSample() { synchronized (queue) { return new QueueSample(new Date(), queue.size(), queue.peek()); } } public void clearQueue() { synchronized (queue) { queue.clear(); } } }
The MXBean operations getQueueSample() and
clearQueue() declared by the MXBean interface are defined in
QueueSampler
. The getQueueSample()
operation simply returns an instance of the QueueSample
Java type, created with the values
returned by the java.util.Queue
methods
peek()
and size()
and an instance of java.util.Date.
The QueueSample
instance returned by QueueSampler
is
defined in the QueueSample
class shown
in CODE EXAMPLE 2-1.
package com.example.mxbeans; import java.beans.ConstructorProperties; import java.util.Date; public class QueueSample { private final Date date; private final int size; private final String head; @ConstructorProperties({"date", "size", "head"}) public QueueSample(Date date, int size, String head) { this.date = date; this.size = size; this.head = head; } public Date getDate() { return date; } public int getSize() { return size; } public String getHead() { return head; } }
In QueueSample
class,
the MXBean framework calls all the getters in QueueSample
to convert the given instance into a
CompositeData
and uses the @ConstructorProperties
annotation to reconstruct a
QueueSample
instance from a CompositeData
.
Having defined an MXBean interface and the class
that implements it, as well as the Java type that is returned, the
MXBean must now be created and registered in an MBean server. These
actions are performed by the example class Main
.
package com.example.mxbeans; import java.lang.management.ManagementFactory; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; import javax.management.MBeanServer; import javax.management.ObjectName; public class Main { public static void main(String[] args) throws Exception { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); ObjectName name = new ObjectName("com.example.mxbeans:type=QueueSampler"); Queue<String> queue = new ArrayBlockingQueue<String>(10); queue.add("Request-1"); queue.add("Request-2"); queue.add("Request-3"); QueueSampler mxbean = new QueueSampler(queue); mbs.registerMBean(mxbean, name); System.out.println("Waiting..."); Thread.sleep(Long.MAX_VALUE); } }
The Main
class gets the
platform MBean server, creates an object name for the MXBean
QueueSampler
, creates a Queue
instance for the QueueSampler
MXBean to process, and feeds this Queue
instance to a newly created QueueSampler
MXBean. The MXBean is then registered in the MBean server in
exactly the same way as a standard MBean.
To run the example, follow the steps below, or see
the README
file:
/jmx_examples/MXBean
.
$
cd work_dir/jmx_examples/MXBean
$
javac com/example/mxbeans/*.java
Main
application.
$
java com.example.mxbeans.Main
You will see confirmation that Main
is waiting for something to happen.
$
jconsole
You will see the JConsole tool open, presenting a list of running JMX agents that you can connect to.
com.example.mxbeans.Main
from
the list in the “New Connection” window, and click on
“Connect”.
You will see a summary of your platform’s current activity.
This panel shows you all the MBeans currently registered in the MBean server.
com.example.mxbeans
node in the MBean tree.
You will see the example MBean QueueSampler
, that was created and registered by
Main. If you click on QueueSampler
, you
will see its associated Attributes and Operations nodes in the
MBean tree.
Attributes
node.
You will see the QueueSample
attribute appear in the right-hand pane,
with its value of javax.management.openmbean.CompositeDataSupport
.
CompositeDataSupport
value.
You can see the QueueSample
values date
,
head
and size
because the MXBean framework has converted the QueueSample
instance into CompositeData
. If you had defined QueueSampler
as a Standard MBean rather than as an
MXBean, JConsole would not have found the QueueSample
class because it would not be in its
class path. If QueueSampler
had been a
standard MBean, you would have received a ClassNotFoundException
when retrieving the
QueueSample
attribute value. This
demonstrates the usefulness of using MXBeans when connecting to JMX
agents through generic JMX clients, like JConsole.
Operations
node.
You will see a button to invoke the clearQueue
operation.
clearQueue
button.
You will be informed that the method was invoked successfully.
Attributes
node again and
double click on the CompositeDataSupport
value.
The queue has been reset now.
In this example JConsole has been used as the JMX client but if you were to access your MXBean programmatically in a JMX client you write yourself, then you could do so in one of two ways:
MBeanServer mbs = ...whatever...; ObjectName name = new ObjectName("com.example.mxbeans:type=QueueSampler"); CompositeData queueSample = (CompositeData) mbs.getAttribute(name, "QueueSample"); int size = (Integer) queueSample.get("size");
MBeanServer mbs = ...whatever...; ObjectName name = new ObjectName("com.example.mxbeans:type=QueueSampler"); QueueSamplerMXBean proxy = JMX.newMXBeanProxy(mbs, name, QueueSamplerMXBean.class); QueueSample queueSample = proxy.getQueueSample(); int size = queueSample.getSize();
CODE EXAMPLE 2-2 uses the
newMXBeanProxy method to create the MXBean proxy. An equivalent
method, newMBeanProxy
, exists to create
proxies for other types of MBeans. The newMBeanProxy
and newMXBeanProxy
methods are used in exactly the same
way.
Descriptors allow you to give additional information about MBeans to management clients. For example, a Descriptor on an MBean attribute might say what units it is measured in, or what its minimum and maximum possible values are. As of Java SE 6, Descriptors are an integrated part of the JMX API and are available in all types of MBeans.
Descriptors give you a convenient way to attach arbitrary extra metadata to your MBeans. Descriptors have always existed in the JMX API, but until Java SE 6 they were only available in conjunction with Model MBeans.
For most constructors in the classes MBean*Info
(MBeanInfo
,
MBeanAttributeInfo
, and so on), a
parallel constructor exists with the same parameters plus an
additional javax.management.Descriptor
parameter. The same is true for OpenMBean*InfoSupport
. The MBean*Info
and OpenMBean*InfoSupport
classes contain a getDescriptor()
method.
Open MBeans return information about default and
legal values from the getDefaultValue()
,
getLegalValues()
, getMaxValue()
, getMinValue()
methods of OpenMBeanParameterInfo
and OpenMBeanAttributeInfo
. This information is now also
present in the corresponding Descriptors, and other types of MBean
can also return the information in their Descriptors.
MBean Descriptors are demonstrated in the example
classes you will find in the directory work_dir/jmx_examples/Descriptors/com/example/mxbeans
after
you have downloaded and unzipped the jmx_examples.zip
file. The MBean Descriptor example
contains the following files.
Author
, an annotation the supplies
the name of the author of the MBean interface.DisplayName
, an annotation that
supplies a display name for methods in the MBean interface.Main
, the program that sets up and
runs the example.QueueSamplerMXBean
interface.QueueSampler
class that implements
the MXBean interface.QueueSample
Java type returned by
the getQueueSample()
method in the
MXBean interface.Version
, an annotation that supplies
the current version of the MBean interface.The QueueSampler
MXBean
in this example basically performs the same actions as the MXBean
example presented in Chapter 2,
"Introducing MXBeans", except with the
addition of MBean Descriptors. This example shows how the
DescriptorKey
meta-annotation can be
used to add new descriptor items to the Descriptors for a standard
MBean (or an MXBean) via annotations in the standard MBean (or
MXBean) interface.
A new annotation DescriptorKey
can be used to add information to the
Descriptors for a standard MBean (or MXBean) via annotations in the
Standard MBean (or MXBean) interface. This makes it possible for a
tool that generates standard MBeans from an existing management
model to include information from the model in the generated MBean
interfaces, rather than in separate files.
CODE EXAMPLE 2-1 shows the
definition of the annotation Author
.
package com.example.mxbeans; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import javax.management.DescriptorKey; @Documented @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Author { @DescriptorKey("author") String value(); }
This annotation supplies the name of the creator
of the MBean interface. A new field author
will be added to the MBeanInfo
Descriptor with the value defined by the
@Author
annotation. The files
Version
and DisplayName
define annotations of those names in
exactly the same way as for Author
above. In each of Version
and
DisplayName
, the @DescriptorKey
value is “version”
and “displayname”
respectively.
In the case of Version, a new field version
will be added to the MBeanInfo
Descriptor with the value defined by the
@Version
annotation.
For DisplayName
, new
field displayName
will be added to the
MBeanAttributeInfo
Descriptor or the
MBeanOperationInfo
Descriptor with the
value defined by the @DisplayName
annotation depending on whether the annotated method is a
getter/setter or an operation, respectively.
The QueueSamplerMXBean
interface used in this example is slightly different from the one
used in the MXBeans example, in as much as it implements MBean
Descriptors to publish some of its information.
package com.example.mxbeans; @Author("Mr Bean") @Version("1.0") public interface QueueSamplerMXBean { @DisplayName("GETTER: QueueSample") public QueueSample getQueueSample(); @DisplayName("OPERATION: clearQueue") public void clearQueue(); }
Here, you see that the @Author
annotation is set to Mr.
Bean
, the @Version
annotation is
set to 1.0
, and the @DisplayName
is set to the names either of the
attribute QueueSample
or the operation
clearQueue
.
To run the example, follow the steps below, or see
the README
file:
/jmx_examples/Descriptors
.
$
cd work_dir/jmx_examples/Descriptors
$
javac com/example/mxbeans/*.java
Main
application.
$
java com.example.mxbeans.Main
You will see confirmation that Main
is waiting for something to happen.
$
jconsole
You will see the JConsole tool open, presenting a list of running JMX agents that you can connect to.
com.example.mxbeans.Main
from
the list in the “New Connection” window, and click on
“Connect”.
You will see a summary of your platform’s current activity.
This panel shows you all the MBeans currently registered in the MBean server.
com.example.mxbeans
node in the MBean tree.
You will see the example MBean QueueSampler
, that was created and registered by
Main. If you click on QueueSampler
, you
will see its associated Attributes and Operations nodes in the
MBean tree.You will also see the fields author
and version
in the
MBeanInfo
Descriptor table.
Attributes
and
Operations
nodes under the QueueSampler
MBean node.
You will see the individual Attributes and Operations.
QueueSample
node.
You will see the field displayName
in the MBeanAttributeInfo
Descriptor table.
clearQueue
node.
You will see the field displayName
in the MBeanOperationInfo
Descriptor table.


Artist Prints Fake AirPod Stickers and Puts Them Across San Francisco to Prank People
An artist is pranking the people of San Francisco, California by placing about 20 life-size AirPod stickers on the streets, trains and other places around the city.
San Francisco: Apple AirPods boast of great sound quality, however, if they do fall out, they are going to be a massive pain to find due to their small size. And not to forget, they are damn expensive too, so losing them is sure to ruin someone’s day.
Playing with the same worry and fear, an artist is now pranking the people of San Francisco, California by placing about 20 life-size AirPod stickers on the streets, trains and other places around the city.
The prankster Pablo Rochat told Mashable, “I see people with AirPods all the time in San Francisco. I got a pair myself recently, and they’re an awkward shape so I drop them occasionally. I see my friends drop them, too. I thought it would be funny just to pretend like everyone’s dropping them.”
For making the stickers, Rochat used some high-resolution AirPod images, a printer, and some sticker paper. Rochat then tweeted pictures and video documenting the whole process:
Rochat said some people definitely found the prank funny while others became annoyed and confused after realizing they were just stickers. He also posted a video of how the prank really unfolded with some people falling for it:
Twitter users had a field day laughing at the prank and hailed Rochat for his creativity while some even berated him for coming up with such a mean prank
Rochat later also invited people to join in the fun and posted a free template on his website for fellow pranksters to print out their own AirPod stickers.
Apple’s AirPod are small white earbuds that start at $159 for the pair.
For breaking news and live news updates, like us on Facebook or follow us on Twitter and Instagram. Read more on Buzz Latest News on India.com.
Story Timeline
- 18 Nov 2019 Apple releases first firmware update for AirPods Pro
- 13 Nov 2019 Apple AirPods Pro with active noise-cancellation is now available in India: Price, Features
- 30 Oct 2019 macOS Catalina 10.15.1 update rolling out, brings new emoji and support for AirPods Pro
Comments - Join the Discussion


--- layout: post title: Web illustration date: '2015-12-15T18:30:38+01:00' categories: - Illustration picture_url: https://film-Storyboards.tumblr.com/post/135283897943/retro-style-Illustration-for-24vision ---
Retro-style Illustration for 24Vision


Use SQLite and PHP
XAMPP comes with built-in support for SQLite, making it easy to get started building database-powered applications with PHP. This guide will walk you through the process of creating and populating a new SQLite database using XAMPP, then accessing the data within it using PHP.
Begin by creating and populating a new database using the SQLite command-line client, as below:
-
Open a new Linux terminal.
-
Change to the htdocs/ subdirectory of your XAMPP installation directory (typically /opt/lampp) and create a new SQLite database file named mydb.sq3 with the SQLite command-line client:
cd /opt/lampp/htdocs /opt/lampp/bin/sqlite3 mydb.sq3
You should now see an SQLite prompt, as below:
In case your user privileges don’t let you write to the htdocs/ sub-directory, prefix your commands with sudo. -
At the sqlite> prompt, create a new table to hold your data. In this example, the table is named items and it contains 3 columns, for item ID, item name and item cost. You can use standard CREATE TABLE syntax to create the table, and you can learn more about SQLite’s built-in datatypes here.
CREATE TABLE items (id INTEGER PRIMARY KEY, name TEXT, price REAL);
-
Add some data to the new inventory table using INSERT commands, as shown below:
INSERT INTO items VALUES ('1001', 'Salt', 3.15); INSERT INTO items VALUES ('1002', 'Pepper', 2.75); INSERT INTO items VALUES ('1003', 'Eggs', 2.00); INSERT INTO items VALUES ('1004', 'Bacon', 7.25); INSERT INTO items VALUES ('1005', 'Milk', 1.15); INSERT INTO items VALUES ('1006', 'Strawberries', 8.73); INSERT INTO items VALUES ('1007', 'Cereal', 2.65);
-
You can now also run a SELECT query on the data. For example, the query below returns all items that cost less than $3:
SELECT * FROM items WHERE price < 3.00;
-
Once you’re done using the database, exit it by typing .quit at the sqlite> prompt.
| The database file (in this example, mydb.sq3) contains all your tables and data, so you should remember to back it up regularly. |
The previous steps discussed how to create and use an SQLite database using the command-line client. However, more often than not, you’ll be using an SQLite database in combination with a PHP-powered Web application. XAMPP includes the PHP SQLite extension, so doing this is not very difficult at all.
To connect to your SQLite database and execute queries on it with PHP, use your text editor to create an example script named sqlite.php in the htdocs subdirectory of your XAMPP installation directory and fill it with the following code:
<?php $db = new SQLite3('mydb.sq3'); $sql = "SELECT * FROM items WHERE price < 3.00"; $result = $db->query($sql); while ($row = $result->fetchArray(SQLITE3_ASSOC)){ echo $row['name'] . ': $' . $row['price'] . '<br/>'; } unset($db);
The first line of code creates a new SQLite3 object, using the mydb.sq3 database file you created earlier. Then, the object’s query() method is used to execute a SELECT query on the database, and the result object’s fetchArray() method is used to iterate over the result set. Adding the SQLITE3_ASSOC parameter to the fetchArray() method tells PHP to return the results as an associative array, making it easy to access individual fields of the result set and display them on a Web page.
Once done, save your changes and ensure that your Apache server is running. Then, browse to http://localhost/sqlite.php to execute the script. You should see something like this:
| To find out more about SQLite’s powerful features, read the SQLite documentation. |


press click button to start, the horse will go through all 64 cells and will never make a shad on one cell twice


--- layout: page title: "Join Us" description: "" ---
This is the only thing we hope to accomplish. And it is also the only thing I will ever ask. Do not believe any of our content until you have put them into practice and find out for yourself how they can transform your life and your happiness. Everything else in this entire website is not very important.
To contribute to True Happiness is mainly to contribute to your own practice of happiness! But other than that here are the ways you can contribute and be a part of True Happiness.
If you find True Happiness to be useful in your life please share to others so that they too can develop their happiness! This means a lot to me so please share!
If you find True Happiness helpful to your happiness please don't support us by subscribing through the channels below. This means a lot to us!
True Happiness was created purely out of love and run entirely on the generosity of the people. Our commitment is to you. We have a policy of no-charging on all of our contents and will accept only donation.
DonatePlease email your article through contact. In addition, please also clearly provide you name, your background, and your contact information. The content of your article should...
True Happiness is looking forward to your contribution! Once we received all your information, we will get back to you as soon as possible.
For more information please, contact
True Happiness is looking for someone with a artistic sense of making beautiful video for each blog post. These videos will be posted on our youtube channels to create for ways users can access True Happiness. Please contact us by sending us the basic information about yourself, your background and your portfolio or work samples. We would love to talk. Here are examples of the kind of work True Happiness is looking for.
I am not a native English speaker. Thus, what I need is someone to read over my content before posting on True Happiness. An editor should to be able to correct my grammar as well as give constructive advice on how to improve my writing.
Recommended readings:
First Time Visitor of True Happiness
Why Happiness Matters to The World?
If you have any other ways you would like to contribute or are looking to just work with or for True Happiness in one way or another, please feel free to contact. True Happiness is yours and it is always open to new ideas!


Allow decimal number (with default decimalSeparator is the dot)
While user typing, it will remove all decimalSeparator that have other decimalSeparator following. After this processing, only the last decimalSeparator is kept.
This is vanilla JS, no other library required
Tested on Chrome, Firefox, IE10, IE11
Tested on Windows, the keycodes is taken from http://keycode.info
What do I provide?
This is just a JS function toHtmlNumericInput(string, bool). Copy it to your page and that's all.
How to use
Call toHtmlNumericInput('num'); // by default, DOT is the decimalSeparator, you can type "123456.789"
Call toHtmlNumericInput('num', true); // if you want to use COMMA as decimalSeparator, you can type "123456,789"
A working sample and how to use in action is here on Github


[gecode-users] CP 2006: Second Call for Papers
Christian Schulte
schulte at imit.kth.se
Fri Mar 31 11:39:01 CEST 2006
[sorry for multiple copies]
Call for Papers
CP 2006
Twelfth International Conference on
Principles and Practice of Constraint Programming
September 25 - 29, 2006
Nantes, France
http://www.sciences.univ-nantes.fr/cp06/
The CP conference is the annual international conference on constraint
programming and related areas. It is concerned with all aspects of
computing with constraints, including: theory, algorithms,
applications, environments, languages, models and systems. CP 2006
includes a technical programme, where presentations of theoretical and
application papers, as well as invited talks, tutorials, posters and
system demos aim at describing the best results and techniques in the
state-of-the-art of constraint programming. Moreover, CP 2006
continues the tradition of the CP doctoral programme, in which PhD
students can present their work, listen to tutorials on career and
ethical issues, and discuss their work with senior researchers via a
mentoring scheme. Finally, there will also be a number of workshops,
where researchers will be able to meet in an informal setting and
discuss their most recent ideas with their peers.
Papers are solicited from all disciplines concerned with constraints
and any application domain using constraints. Example topics include
problem modelling, problem solving, efficiency and usability. Papers
which report on successful applications of constraint technology are
also solicited.
Submitted papers must be original and must not be simultaneously
submitted for publication in a journal or another conference. Authors
are required to prepare their papers by following the Springer
instructions found at: http://www.springer.de/comp/lncs/authors.html.
A page limit of 15 will be strictly enforced. The proceedings will be
published by Springer Verlag, in the Lecture Notes in Computer Science
series.


1. Maven dependencies
Add the following dependency.
<dependency>
<groupId>org.avaje.metric</groupId>
<artifactId>avaje-metric-core</artifactId>
<version>4.4.2</version>
</dependency>
2. Maven plugin enhancement
Add the maven plugin below specifying the packages that should be scanned for classes
annotated with @Singleton
, @Path
, @Service
etc.
You can also use the Avaje Metrics @Timed
annotation.
<build>
<plugins>
<plugin>
<groupId>org.avaje.metric</groupId>
<artifactId>enhance-maven-plugin</artifactId>
<version>4.2.1</version>
<executions>
<execution>
<id>main</id>
<phase>process-classes</phase>
<configuration>
<classSource>target/classes</classSource>
<packages>org.example.myapp.**</packages>
<transformArgs>debug=1</transformArgs>
</configuration>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
3. Reporting
Add MetricReporter to your application. This has a Timer that will fire periodically and collect the metrics and send then to a reporter.
import org.avaje.metric.report.MetricReportConfig;
import org.avaje.metric.report.MetricReportManager;
...
// There are default reporters that come with avaje-metric-core.
// Defaults to writing metrics in a csv format every 60 seconds.
// A daily file is written keeping a maximum of 20 file
MetricReportConfig config = new MetricReportConfig();
// report aggregate statistics every 10 seconds
config.setFreqInSeconds(10);
MetricReportManager reportManager = new MetricReportManager(config);
... and you're off
At this point you can run your application and metrics will be written to a csv file every minute.
Output example:
00:00:51, lg, jvm.gc.ps-marksweep, count=4, time=1556
00:00:51, lg, jvm.gc.ps-scavenge, count=48, time=6811
00:00:51, dg, jvm.memory.heap, pct=23.0, init=61.75, used=210.21, committed=379.5, max=878.5
00:00:51, dg, jvm.memory.nonheap, pct=4.0, init=23.44, used=9.12, committed=23.44, max=214.0
00:00:51, dm, jvm.os.loadAverage, value=1.17
00:00:51, dm, jvm.system.uptime, value=0.0
00:00:51, lg, jvm.threads, current=5, peak=5, daemon=4
00:00:51, tm, org.example.MyService.performLogin, count=34, avg=28972, max=39150, sum=985073, dur=60, err.count=0
00:00:51, tm, org.example.MyService.checkWeather, count=1, avg=954, max=954, sum=954, dur=60, err.count=0
Notes:
- Times are reported in microseconds. avg=28972 means an average of 29 milliseconds.
- If a metric had no events since the last collection it is considered 'empty' and not reported and you won't see it in the output
- dur=60 means that the duration that the metric covers is 60 seconds. This is effectively the number of seconds since the last collection (which is when the counters where last reset).
- Some core JVM gauges for GC, Memory, Threads etc are automatically registered.
4. Refine metric names
The metric names are the full package class and method names. This is ok but you might want to modify
those names because they are long and you want to use some common prefixes like web.api
,
service
, db
, integration
instead. Using the common prefixes can make it
easier to rollup/group related metrics together.
Add a file called metric-name-mapping.txt
into src/main/resources
and
add some name=value pairs which will be used to truncate/replace part or all of the package name.
org.example.myapp.endpoint=web.api
org.example.myapp.repository.dao=dataaccess
org.example.myapp=myapp


Henry Mancini, Mercer - Moon River https://youtu.be/Q7SI7N22k_A Orig: F# - Kapo: 11 G G G Emi C G/H Moon river wider than a mile, C G/H F#mi75- H7 I'm crossing you in style some day D#dim Emi7 G7 C F75- old dream maker, you heart breaker, Emi Emi7 C#mi7 F#7 wherever you're go ing Hmi7 E7 Ami7 D7 I'm go ing your way G Emi C G/H Two drifters, off to see the world, C G/H F#mi75- H7 There's such a lot of world to see Emi Emi7 A9/C# C7 G Where af ter the same rainbow's end C G/H waiting round the bend, C G/H my Huckleberry friend, Emi Ami D7 D6 C /H /A G Moon River and me


I play with the senior team and train twice a week.
My team and I won the U16's League final in 2016.
Our intermediate team qualified to meet favourites Eire Og in Premier intermediate Championship Semi Final following a well earned 0-14 to 0-07 victory.


class Arel::SelectManager
Constants
- STRING_OR_SYMBOL_CLASS
Public Class Methods
new(table = nil)
click to toggle source
Calls superclass method
Arel::TreeManager.new
# File lib/arel/select_manager.rb, line 9 def initialize table = nil super() @ast = Nodes::SelectStatement.new @ctx = @ast.cores.last from table end
Public Instance Methods
as(other)
click to toggle source
# File lib/arel/select_manager.rb, line 50 def as other create_table_alias grouping(@ast), Nodes::SqlLiteral.new(other) end
constraints()
click to toggle source
# File lib/arel/select_manager.rb, line 26 def constraints @ctx.wheres end
distinct(value = true)
click to toggle source
# File lib/arel/select_manager.rb, line 149 def distinct(value = true) if value @ctx.set_quantifier = Arel::Nodes::Distinct.new else @ctx.set_quantifier = nil end self end
distinct_on(value)
click to toggle source
# File lib/arel/select_manager.rb, line 158 def distinct_on(value) if value @ctx.set_quantifier = Arel::Nodes::DistinctOn.new(value) else @ctx.set_quantifier = nil end self end
except(other)
click to toggle source
# File lib/arel/select_manager.rb, line 201 def except other Nodes::Except.new ast, other.ast end
Also aliased as: minus
exists()
click to toggle source
Produces an Arel::Nodes::Exists node
# File lib/arel/select_manager.rb, line 46 def exists Arel::Nodes::Exists.new @ast end
from(table)
click to toggle source
# File lib/arel/select_manager.rb, line 87 def from table table = Nodes::SqlLiteral.new(table) if String === table case table when Nodes::Join @ctx.source.right << table else @ctx.source.left = table end self end
froms()
click to toggle source
# File lib/arel/select_manager.rb, line 100 def froms @ast.cores.map { |x| x.from }.compact end
group(*columns)
click to toggle source
# File lib/arel/select_manager.rb, line 76 def group *columns columns.each do |column| # FIXME: backwards compat column = Nodes::SqlLiteral.new(column) if String === column column = Nodes::SqlLiteral.new(column.to_s) if Symbol === column @ctx.groups.push Nodes::Group.new column end self end
having(expr)
click to toggle source
# File lib/arel/select_manager.rb, line 121 def having expr @ctx.havings << expr self end
initialize_copy(other)
click to toggle source
Calls superclass method
Arel::TreeManager#initialize_copy
# File lib/arel/select_manager.rb, line 16 def initialize_copy other super @ctx = @ast.cores.last end
intersect(other)
click to toggle source
# File lib/arel/select_manager.rb, line 197 def intersect other Nodes::Intersect.new ast, other.ast end
join(relation, klass = Nodes::InnerJoin)
click to toggle source
# File lib/arel/select_manager.rb, line 104 def join relation, klass = Nodes::InnerJoin return self unless relation case relation when String, Nodes::SqlLiteral raise if relation.empty? klass = Nodes::StringJoin end @ctx.source.right << create_join(relation, nil, klass) self end
join_sources()
click to toggle source
# File lib/arel/select_manager.rb, line 229 def join_sources @ctx.source.right end
limit()
click to toggle source
# File lib/arel/select_manager.rb, line 21 def limit @ast.limit && @ast.limit.expr end
Also aliased as: taken
lock(locking = Arel.sql('FOR UPDATE'))
click to toggle source
# File lib/arel/select_manager.rb, line 54 def lock locking = Arel.sql('FOR UPDATE') case locking when true locking = Arel.sql('FOR UPDATE') when Arel::Nodes::SqlLiteral when String locking = Arel.sql locking end @ast.lock = Nodes::Lock.new(locking) self end
locked()
click to toggle source
# File lib/arel/select_manager.rb, line 67 def locked @ast.lock end
offset()
click to toggle source
# File lib/arel/select_manager.rb, line 30 def offset @ast.offset && @ast.offset.expr end
on(*exprs)
click to toggle source
# File lib/arel/select_manager.rb, line 71 def on *exprs @ctx.source.right.last.right = Nodes::On.new(collapse(exprs)) self end
order(*expr)
click to toggle source
# File lib/arel/select_manager.rb, line 167 def order *expr # FIXME: We SHOULD NOT be converting these to SqlLiteral automatically @ast.orders.concat expr.map { |x| STRING_OR_SYMBOL_CLASS.include?(x.class) ? Nodes::SqlLiteral.new(x.to_s) : x } self end
orders()
click to toggle source
# File lib/arel/select_manager.rb, line 175 def orders @ast.orders end
outer_join(relation)
click to toggle source
# File lib/arel/select_manager.rb, line 117 def outer_join relation join(relation, Nodes::OuterJoin) end
project(*projections)
click to toggle source
# File lib/arel/select_manager.rb, line 132 def project *projections # FIXME: converting these to SQLLiterals is probably not good, but # rails tests require it. @ctx.projections.concat projections.map { |x| STRING_OR_SYMBOL_CLASS.include?(x.class) ? Nodes::SqlLiteral.new(x.to_s) : x } self end
projections()
click to toggle source
# File lib/arel/select_manager.rb, line 141 def projections @ctx.projections end
projections=(projections)
click to toggle source
# File lib/arel/select_manager.rb, line 145 def projections= projections @ctx.projections = projections end
skip(amount)
click to toggle source
# File lib/arel/select_manager.rb, line 34 def skip amount if amount @ast.offset = Nodes::Offset.new(amount) else @ast.offset = nil end self end
Also aliased as: offset=
source()
click to toggle source
# File lib/arel/select_manager.rb, line 233 def source @ctx.source end
take(limit)
click to toggle source
# File lib/arel/select_manager.rb, line 217 def take limit if limit @ast.limit = Nodes::Limit.new(limit) @ctx.top = Nodes::Top.new(limit) else @ast.limit = nil @ctx.top = nil end self end
Also aliased as: limit=
union(operation, other = nil)
click to toggle source
# File lib/arel/select_manager.rb, line 186 def union operation, other = nil if other node_class = Nodes.const_get("Union#{operation.to_s.capitalize}") else other = operation node_class = Nodes::Union end node_class.new self.ast, other.ast end
where_sql(engine = Table.engine)
click to toggle source
# File lib/arel/select_manager.rb, line 179 def where_sql engine = Table.engine return if @ctx.wheres.empty? viz = Visitors::WhereSql.new(engine.connection.visitor, engine.connection) Nodes::SqlLiteral.new viz.accept(@ctx, Collectors::SQLString.new).value end
window(name)
click to toggle source
# File lib/arel/select_manager.rb, line 126 def window name window = Nodes::NamedWindow.new(name) @ctx.windows.push window window end
with(*subqueries)
click to toggle source
# File lib/arel/select_manager.rb, line 206 def with *subqueries if subqueries.first.is_a? Symbol node_class = Nodes.const_get("With#{subqueries.shift.to_s.capitalize}") else node_class = Nodes::With end @ast.with = node_class.new(subqueries.flatten) self end
Private Instance Methods
collapse(exprs, existing = nil)
click to toggle source
# File lib/arel/select_manager.rb, line 250 def collapse exprs, existing = nil exprs = exprs.unshift(existing.expr) if existing exprs = exprs.compact.map { |expr| if String === expr # FIXME: Don't do this automatically Arel.sql(expr) else expr end } if exprs.length == 1 exprs.first else create_and exprs end end


Our team was given the Proctor Silex 2-Slice Toaster (seen below) to dissect and analyze with the goal to recommend changes to reduce part count and assembly time. We pieced together a step by step assembly guide for the toaster, and used techniques to identify potential parts that could be consolidated or removed. After iterating on design concepts, we reduced the 63 part (excluding heating and electronic components) Silex toaster to just 24 parts. The reduction in parts also led to a reduction in assembly steps from 28 to 11. Our new design maintains the simplicity of a toaster, while greatly reducing manufacturing and assembly costs.
This toaster retails for the price of 12.99 on Amazon. Due to the low price tag, we imagined there would be few parts to redesign. We were wrong.
While disassembling toaster, we recorded each part's function and gave it a name to help with future identification. We counted 63 total parts excluding the electronic and heating components that were out of the scope of the project.
Once fully disassembled, we embarked on the journey to put it all back together(ish) using the instructions we had just created. In doing so, we identified that 20 parts could be removed from the current design to reduce cost.
Through the process of disassembling and reassembling the toaster, we derived all of the actions that go into toasting bread. We added these requirements and more to a Quality Function Deployment, where we ranked the current toaster and two competitors relative to the importance to the customer.
Through this we identified that the toaster needed temperature resistant surfaces, a simple control interface, cleaning feature, and compatible with multiple types of bread. We quantified this to the following
After much ideation and brainstorming, we landed on a tray design similar to a toaster oven. It consists of 4 main components. A stainless steel top casing, a L - shaped bottom and front face made of heat resistant phenolic, and a stainless steel slider to enclose on the bread. A single dial would control the duration of the bread toasting, and a led notification light and sound would notify the user that the bread has finished toasting. The brackets surrounding the bread tighten with the opening and closing of the drawer.
After sketching the concept, we creating a rendering and made a few minor changes. We changed the placement of the control interface to be on the side with the sliding drawer, as we felt it was more intuitive. (Electronic housing not shown)
Other final design choices include a thermochromic paint on the stainless steel top cover, which would help indicate its temperature similar the heated coils in the Silex toaster, and a safety an auto-circuit breaking function when the drawer is opened.


Application Catalog
Service Catalog
HR
Recruitement
Employee On-Boarding
Time Sheet Reporting
Perfomance Review
Employee Off-Boarding
Finance
Monthly Finance Model
Customer Invoices
OCR
Welcome to Ismile Bot
×
Welcome to Ismile Bot
×


This application provides an interactive Swagger documentation that you can access here.
The source code is accessible on GitHub at the following address: https://github.com/erik1066/ex-ms-kotlin-boilerplate.
This microservice app is primarily designed as a demo of Kotlin, Swagger and Spring Boot
To test use the following URL (using Swagger or curl
):
curl -X GET \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
'http://<IP_ADDRESS>:8080/greeting?name=Kotlin'


LinkedIn
Home
What is LinkedIn
Join Today
Sign In
Email:
Password:
Over 175 million professionals use LinkedIn to exchange information, ideas and opportunities
Stay informed about your contacts and industry
Find the people & knowledge you need to achieve your goals
Control your professional identity online
Join LinkedIn Today
Sign Up
First Name:
Last Name:
Email:
Password:
6 or more characters
Already on LinkedIn?
Sign in.
Search for someone by name:
First Name:
Last Name:


Visualizing Wars:
The Face of Geopolitics
by Armand Boschin, Cyril Wendl and Francis Damachi
A piece of (fake) news
A 90s kid
As conventional journalism is being superseded by mass consumption of social media which are often likely to convey biased or fake news, it seems crucial to reassess our understanding of the more recent world conflicts. The aim of this data story is to lay down some historical landmarks of world politics.
The end of the 1980s represent a turning point in history with the end of the Cold War. Many people hoped this would lead to a New World Order. Has it been the case? Which conflicts have taken place since then? How has the world violence evolved since 1989? Let's find answers in the data.
Our work is based on the Uppsala Conflict Data Program (UCDP) dataset which records all lethal events having taken place in any country (except Syria and North-Korea) from 1989 to 2016. Along the data story, some links are provided for further information. Furthermore, to understand more broadly the current economic and political stability, we also show economic data from the World Bank.
In the following, an event represents an incident where armed forces were used by an organised actor against another actor resulting in at least one direct death on either side.
Global Analysis
In order to get a raw sense of world peace, we think of two indicators, the total number of deaths and civilian deaths caused by armed events.
Death time series on a global scale
The obvious strongest outlier of all years is 1994 because of the Rwandan Genocide. In 1994, the opposition between the Hutus and the Tutsis (two ethnic groups) led to a massive genocide. There is no official record of the casualties but most sources agree on the UN estimation of 800'000 Tutsi victims in less than 100 days.
For comparison, the Holocaust caused about six million Jewish victims during Nazi Germany and the Khmer Rouges killed around 1.5 million people under Pol Pot's Democratic Kampuchea. The Rwandan genocide is the most deadly event in the post cold-war era. It is also ranked 7 among all the genocides in history.
Looking at conflicts on a global scale makes it hard to discern any general tendency. Instead, we can have a look at the figures on a regional scale.
Regional Analysis
The following figure provides details on the death tolls on a regional scale. For didactic purposes,
hovering on the bars reveals details about the conflicts happening in the corresponding year. A conflict is displayed
if it accounts for more than the 98% quantile of deaths during this year.
Take some time to get an idea of the most important conflicts in each continent.
Detailed deaths time series by region
Region
Details
Hover on a bar to obtain more information on conflicts.
The above confirms that Africa, the Middle East and Asia (mainly the western part of Asia) are the three
main regions marked by armed conflicts. It is also possible to look at major crises by looking at countries
which, during some years, experienced death tolls a 1000 times larger than the median number of deaths over all years.
By doing so, we get conflicts you might have already noticed by playing with the preceding figure (such
as the Bosnian war,
the Rwandan genocide,
the Yemeni Revolution)
but also the Mozambican Civil War (5222 casualties),
the Tajikistani Civil War (4571 casualties),
and some punctual crisis such as the Tianamen Square protests
in China in 1989 (2600 casualties).
The following map allows localizing the conflicts. We'll let you hang around on a fatal march then.
Countries
- Use the buttons
to activate the year slideshow or directly use the slider to visualize data for a given year.
- Click to see the sum of deaths for all years
- Click on to change the data between civilian and total deaths
- Hover on a country for some key numbers
- Click on a country to get more detailed information
- Click on the same country again to get back
Actors Analysis
In addition to a geographical analysis, it is interesting to study the actors causing the conflicts.
In the UCDP data set
the name of the actors but no additional information is given.
We enriched the set by scraping some key Wikipedia pages in order to get a list of armed actors and
information about them such as their ideology or official designation as terrorists. Then the scrapted data was matched and merged with
the actors using a Levenshtein string distance.
This allowed us to provide the following visualization of actors' involvement in conflicts. The bubbles
represent the sum of deaths an actor caused in all conflicts (excluding collateral victims). The sum
of civilians killed in conflicts in which the actor was involved is also provided for information in the detail view.
Note that the Government of Rwanda has been removed from the data set in the following visualization
because of the genocide, since it would have otherwise crushed all the other bubbles.
Actor Type
Actors
- The bubble colors indicate the type of actor. Some actors have several types, in which case the color corresponds to the most general one. For example, communists can also be liberation movements. Therefore, when selecting a cluster, the colors may be mixed.
- The bubbles size represents the number of total deaths caused by an actor, excluding collateral civil deaths.
- Hover on a bubble to see the actor's name
- Click on it to get more information
- If you see some bubbles jittering, do it like in a real war: end the fight by dropping a big actor in the middle. 😉
The bubbles indicate a tendency that governments seem to be responsible for the largest amount of deaths. However in many cases, governments might not be legitimate (lawfully or morally). The most important actor (except from the Government of Rwanda) is the Government of Afghanistan due to its war against the Talibans. This war caused more than 100'000 combatant victims.
From a historical point of view, it is important to note that because Syria is excluded from the data set, this story might not give a real insight into the most recent situation. Especially the Islamic State is not really important here and yet, the Battle of Mosul in Iraq caused more than 40'000 civilian casualties last July.
Conclusion
The goal of this data analysis project was to raise awareness for the global developments of the world peace. Through graphical visualization, new insights on complex data can be obtained.
The in-depth analysis of a large-scale dataset shows a number of major difficulties to understanding data: Being able to create links requires first and foremost a huge amount of data cleaning and standardization. Secondly, data can be enriched by merging it with external datasets and combining its features. Both have been crucial in this project to produce better visualizations.
Finally, the quality of the visualizations depends to a large extent on the possibilities, learning curve and ease of implementation of the used framework. We have enjoyed delving into this challenge, using various frameworks, programming tools and, most importantly, our minds to better understand the recent world history.
About us
Find us on GitHub


Engineering and maintenance
Veterinary nurse
Veterinary nurses work with vets to provide nursing care for sick and injured animals.
Zookeeper
Keeper, animal keeper, zoo keeper
Zookeepers look after animals in zoos, safari parks and aquariums.
Veterinary nurses work with vets to provide nursing care for sick and injured animals.
Zookeepers look after animals in zoos, safari parks and aquariums.


We have systems!
- engineer killer architectures
- revolutionize compelling architectures
- aggregate synergistic ROI
- embrace one-to-one niches
- deliver scalable e-services
- facilitate cutting-edge mindshare
- synergize wireless partnerships
- architect one-to-one systems
- target integrated convergence
- revolutionize interactive methodologies
- engineer rich deliverables


A stock exchange, securities exchange or bourse is a facility where stockbrokers and traders can buy and sell securities, such as shares of stock and bonds and other financial instruments. Stock exchanges may also provide facilities for the issue and redemption of such securities and instruments and capital events including the payment of income and dividends Securities traded on a stock exchange include stock issued by listed companies, unit trusts, derivatives, pooled investment products and bonds. Stock exchanges often function as "continuous auction" markets with buyers and sellers consummating transactions via open outcry at a central location such as the floor of the exchange or by using an electronic trading platform.
To be able to trade a security on a certain stock exchange, the security must be listed there. Usually, there is a central location at least for record keeping, but trade is increasingly less linked to a physical place, as modern markets use electronic communication networks, which give them advantages of increased speed and reduced cost of transactions. Trade on an exchange is restricted to brokers who are members of the exchange. In recent years, various other trading venues, such as electronic communication networks, alternative trading systems and "dark pools" have taken much of the trading activity away from traditional stock exchanges.


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/cc.20failure.html ---
Is this a bug?
example {α β : Type} (x1 x2 : α) (y : β) (h : x1 = x2) {p : β → Prop} (hp : p y) : ∃ y', p y' ∧ (x2, y') = (x1, y) := begin existsi _, split, exact hp, -- ⊢ (x2, y) = (x1, y) cc -- cc tactic failed end
(I know the lemma and proof are strange, this is a minimized version of some real code)
It seems that cc
doesn't recognize that the y
s are equal because one of them was created by substituting for a metavariable, or something.
subst h
I observed this a few days ago as well, but in a setting which was too hard to minimize.
try set_option pp.all true
subst h
rw h
stop!
this works
example {α β : Type} (x1 x2 : α) (y : β) (h : x1 = x2) {p : β → Prop} (hp : p y) : ∃ y', p y' ∧ (x2, y') = (x1, y) := ⟨_, hp, begin cc, end⟩
So it seems like a bug.
by cc
Yeah, changing cc
to exact by cc
works also
(And also in my real code.)
It's to do with the metavariable
example {α β : Type} (x1 x2 : α) (y : β) (h : x1 = x2) {p : β → Prop} (hp : p y) : ∃ y', p y' ∧ (x2, y') = (x1, y) := begin existsi y, split, exact hp, -- ⊢ (x2, y) = (x1, y) cc -- cc tactic failed end
works
I thought exact hp
unified the metavariable
It does. That's what makes this so confusing.
The displayed proof state is exactly the same whether you write existsi _
or existsi y
but cc
only works in the second case
Last updated: Apr 24 2020 at 19:02 UTC


Timeline data: Japan Ministry of Foreign Affairs, Japan Guide, World Bank, BBC, Wikipedia and SEDAC.
100 more frequent out of 530 total Japanese loanwords in the online edition of the Oxford English Dictionary. On a 1-8 scale, Band 3 contains words which occur between 0.01 and 0.1 times per million words in typical modern English usage. Band 4 words occur between 0.1 and 1.0 times per million words, and Band 5 words between 1 and 10 times per million words. The most recent citation for a Japanese loanword in the OED is Sudoku, cited in 2000. Pronunciations are in American and British English.
TOP TEN CATEGORIES OF JAPANESE LOANWORDS IN THE OED
Food & Drink, Martial Arts and Arts & Crafts are the top three categories of Japanese words in the Oxford English Dictionary, indicating the impact of different aspects of Japanese culture on the English-speaking world.
JAPANESE LOANWORD NATURALIZATION STAGES
Linguists have developed measures to understand the naturalization process of loanwords. Kinjo Gakuin University researcher Schun Doi created this schematic to analyze Japanese loanwords in the Oxford English Dictionary, the world's most authoritative English lexicon. The schematic places loanwords on a continuum with three general stages in their transition from totally Japanese to full incorporation into the English lexicon.
{{ chartTitle }}
Japanese has contributed the second most loanwords to the Oxford English Dictionary among Asian languages. Japan's large contribution comes despite the nation's history of isolation and the fact that it was never colonized by an English-speaking country.
{{ chartTitle }}
Historians point to three waves of Japanophilia: the first in the late 1800s after Japan opened to the world and Westerners experienced Japanese arts and crafts at events like the 1876 Philadelphia Expo; the second after WWII when Westerners discovered Zen Buddhism and Japanese poetry; and the third, pop culture-driven wave currently underway. The addition of loanwords to the OED reflects these waves. The surge of words in the 1720s shows the impact of the publication of Kæmpfer's History of Japan.
JAPANESE LOANWORDS IN THE NEW YORK TIMES
Explore 12 Japanese loanwords ordered from their first appearance in the New York Times to the present. The terms progress from older waves of Japanophilia to recent terms representing the 'Cool Japan' boom. Spikes in interest can be observed, such as one for 'geisha' in the 2000s following the release of the book and film Memoirs of a Geisha.
ANIMATED WORD MAPS
View the rise and fall of Japanese loanwords geographically over time by Google Search interest. Single Words represent contemporary Japan; Word Pairs show the changing interest in words representing traditional and contemporary Japan.


The 2000 Bobcat Classic, April 22-23, hosted by the Montana State Cycling Club,
will be open to USCF riders, Cat 3/4, for the MSU Campus Criterium and Triple
Tree Time Trials. We are discussing whether to add Cat 2's and will let you know
when we know.
Please visit the following site to learn more about the race. (Note on the site,
the Madison County Road Race is open to collegiate riders only.)
http://www.geocities.com/bobcatclassic/home.htm
Questions? Email Rob Whitacre<EMAIL_ADDRESS>Happy spinning,
-- Rob Whitacre


New Bell
I picked up a new toy for my bike this past week. My Dawes bike hasn’t had a bell on it, probably since I bought the bike. It came with one, but it’s pretty poor bell that the bike came with (something cheap and nasty that the bike has to be sold with in the UK). It just about works. Nothing special.
Anyhow, I’ve been using the bike for a while now but I’ve not had a bell on it and this can get annoying - riding to work, the majority of the route is along a shared path and it means that I can’t warn people that I’m coming up behind them.
So I decided that I needed to get a new bell and so I had a look around. I eventually settled on a Crane Sakura bell.
I’d considered getting the one of the Lion Works bells but it seemed that they might be a little large for what I was thinking and the alternative one I was looking at, the Spurcycle bell was just a bit to pricey.
I decided that the brass Crane bell would do the job and I ordered from Velo Vitality. It wasn’t a shop I’d ordered from in the past, but I was very impressed with the service. The bell was sent on the same day I ordered and was shipped via Second Class Recorded (which did mean a few days delay whilst I had to go to the post office to get it but rather this than go to a courier location!) I’d happily recommend them again and I’ll keep an eye on their website (they’re based in Brighton with a store just near the station apparently).
Anyhow, I fitted it this weekend to Odin finally.
I had no trouble installing it, even though the standard bars that Dawes installed on the bike have quite a slope. Ideally, I’ll get an old inner tube and create an inner for the attachment because at the minute, the bell is metal against metal which isn’t ideal but does work.
All I need to do now is to get out on the bike again!