
Catégorie : Non classé
Découverte du M5Stack
Contrôler vos modèles LEGO Powered Up au Nunchuk à l’aide de votre Arduino
Auto-héberger son agenda avec Baïkal
Poudlard Express motorisé
Si vous voulez rajouter un moteur sur votre Poudlard Express c’est possible avec les légo powered up:
Installer une version spécifique de Wine sous ubuntu
Si vous utilisez Wine pour jouer à vos jeux Windows il n’est pas rare que certaines versions de Wine ne fonctionne pas avec votre programme.
Voici les commandes pour installer une version antérieure de Wine:
$ apt-cache policy winehq-staging $ aptitude install winehq-staging=4.12~bionic
Nouvelle version de mon CV
La toute dernière version de mon CV est disponible !!!
Accéder au CV de Sébastien Colas
UNIX and Linux Essentials Ed 2

La version 2 du cours « Unix and Linux Essentials Ed 2 » d’Oracle sera disponible à partir du 25 Juin 2018.
Noter bien que je suis cité en tant que « Technical Contributors » & « Reviewers »
Accéder au cours
Get number of unread posts on phpbb3 in php
<?php
/*
* Doc: https://www.phpbb.com/customise/db/mod/view_or_mark_unread_posts/support/unread_posts_counter_small_optimize-t_99119
*/
/* Headers JSON */
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . 'GMT' );
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Content-type: application/json; charset=iso-8859-1');
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include ($phpbb_root_path . 'common.' . $phpEx);
$user->session_begin();
global $db, $user;
if ($user->data['user_id'] == ANONYMOUS)
{
echo '{"unread_posts":"0"}';
return;
}
// Select unread topics
$unread_topics = array ();
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id)
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id)
WHERE t.topic_last_post_time > ' . $user->data['user_lastmark'] . ' AND
(
(tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR
(tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR
(tt.mark_time IS NULL AND ft.mark_time IS NULL)
)
LIMIT 1001';
$result = $db->;sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$unread_topics[] = $row['topic_id'];
}
if (empty ($unread_topics))
{
echo '{"unread_posts":"0"}';
return;
}
// now count the posts with post time after each of the relevant times
$sql = 'SELECT COUNT(p.post_id) as count
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (p.forum_id = ft.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')
LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (p.topic_id = tt.topic_id AND tt.user_id = ' . $user->data['user_id'] . ')
WHERE ' . $db->sql_in_set('p.topic_id', $unread_topics) . '
AND
(
p.post_time > tt.mark_time
OR (tt.mark_time IS NULL AND p.post_time > ft.mark_time)
OR (ft.mark_time IS NULL AND p.post_time > ' . $user->data['user_lastmark'] . ')
)';
$result = $db->sql_query($sql);
$unread_post_count = $db->sql_fetchfield('count', false, $result);
$db->sql_freeresult($result);
echo '{"unread_posts":"' . $unread_post_count . '"}';
?>
Oracle Traffic Director UNIX init script
Oracle does not provite /etc/init.d script to automatically launch Oracle Traffic Director at unix/linux startup. Here my own script:
#!/bin/bash
#
# oracle-traffic-director This shell script takes care of starting and stopping
# oracle-traffic-director.
#
# chkconfig: 345 99 0
# description: Start/Stop Oracle Traffic Director
# Oracle Traffic Director Instance
OTD_INSTANCE_DIRECTORY=/u01/app/oracle/product/11.1.1.7.0/trafficdirector_instance
OTD_INSTANCE=net-demo1
# Source function library.
. /etc/init.d/functions
start() {
# Start daemons.
echo -n $"Starting Oracle Traffic Director Instance $OTD_INSTANCE: "
daemon ${OTD_INSTANCE_DIRECTORY}/${OTD_INSTANCE}/bin/startserv
RETVAL=$?
echo
[ $RETVAL -eq 0 ]
return $RETVAL
}
stop() {
echo -n $"Shutting down Oracle Traffic Director Instance $OTD_INSTANCE: "
daemon ${OTD_INSTANCE_DIRECTORY}/${OTD_INSTANCE}/bin/stopserv
RETVAL=$?
echo
[ $RETVAL -eq 0 ]
return $RETVAL
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac


