/etc/hosts : 127.0.0.1 localhost host.domain.com
Tuesday, June 28, 2011
Postfix send my local emails as they are external emails !!!
If your machine address is host.domain.com your machine needs to know that this address is localhost.
Thursday, June 23, 2011
PHP - sort multidimentional array - order by column1, column2, ...
In sql we can do an order by occording to multiple columns
this query will output data ordered by sale_context then by delivery_method then by payment_method.
now I want to do the same thing with arrays in php,
I let my code explain how to do it
select sale_context, delivery_method, payment_method FROM sales order by 1, 2, 3
this query will output data ordered by sale_context then by delivery_method then by payment_method.
now I want to do the same thing with arrays in php,
I let my code explain how to do it
$data = array(); $data[] = array('sale_context' => 'internet', 'delivery_method' => 'regular post', 'payment_method' => 'visa'); $data[] = array('sale_context' => 'phone', 'delivery_method' => 'express post', 'payment_method' => 'mastercard'); $data[] = array('sale_context' => 'internet', 'delivery_method' => 'regular post', 'payment_method' => 'cach'); $data[] = array('sale_context' => 'phone', 'delivery_method' => 'express post', 'payment_method' => 'visa'); // order by sale_context, delivery_method, payment_method $sales_context_list = array(); $delivery_method_list = array(); $payment_method_list = array(); foreach($data AS $key => $row) { $sales_context_list[] = $row['sale_context']; $delivery_method_list[] = $row['delivery_method']; $payment_method_list[] = $row['payment_method']; } echo "DATA BEFORE SORT"; print_r($data); array_multisort($sales_context_list, SORT_ASC, $delivery_method_list, SORT_ASC, $payment_method_list, SORT_ASC, $data); echo "DATA AFTER order by sale_context, delivery_method, payment_method "; print_r($data);
Monday, May 30, 2011
configure ssl with lighttpd
in a test or development environment we can use a self signed certificated (not secure for use in production environment)
In a production environment we need to setup a secure environment
How to create a self signed ssl certificate
In a production environment we need to setup a secure environment
How to create a Third party signed ssl certificate
Wednesday, May 4, 2011
After installing otrs you may need to configure an apache virtual host domain
UseCanonicalName Off DocumentRoot /opt/otrs/ ServerName otrs.meine-domain.net:80 ServerAdmin webmaster at meine-domain.net ErrorLog /var/log/httpd/otrs_error.log CustomLog /var/log/httpd/otrs_access.log combined Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/" ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/" ScriptAlias / "/opt/otrs/bin/cgi-bin/" Perlrequire /opt/otrs/scripts/apache2-perl-startup.pl PerlModule Apache::Reload PerlInitHandler Apache::Reload ErrorDocument 403 /index.pl AllowOverride None Options +ExecCGI SetHandler perl-script PerlHandler ModPerl::Registry PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders PerlSendHeader On PerlSetupEnv On Order allow,deny Allow from all DirectoryIndex index.pl
ErrorDocument 403 /index.pl AllowOverride None Options +ExecCGI -Includes Order allow,deny Allow from all DirectoryIndex index.pl AllowOverride None Order allow,deny Allow from all
Tuesday, April 12, 2011
Good Blog ; Ubuntu Algérie
Good work
http://www.ubuntudz.com/
A command line to watch aljazeera with mplayer
to install rtmpdump : (install librtmp0 first for dependency)
http://security.ubuntu.com/ubuntu/pool/universe/r/rtmpdump/
http://www.ubuntudz.com/
A command line to watch aljazeera with mplayer
rtmpdump -qv -r rtmp://livestfslivefs.fplive.net/livestfslive-live/ -y "aljazeera_ar_medium?videoId=747084146001&lineUpId=&pubId=665003303001&playerId=751182905001&affiliateId=" -W "http://admin.brightcove.com/viewer/us1.24.04.08.2011-01-14072625/federatedVideoUI/BrightcovePlayer.swf" -p http://english.aljazeera.net/watch_now/ -a "aljazeeraflashlive-live?videoId=747084146001&lineUpId=&pubId=665003303001&playerId=751182905001&affiliateId=" | mplayer -
to install rtmpdump : (install librtmp0 first for dependency)
http://security.ubuntu.com/ubuntu/pool/universe/r/rtmpdump/
Saturday, February 5, 2011
Simple Example Draw a Rectangle using mouse
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class DrawRectRx extends JPanel
{
private int pointCount =0;
private Point points[] = new Point[100];
private Point points2[] = new Point[100];
private Point start = new Point();
private Point end = new Point();
Rectangle rect = new Rectangle();
public DrawRectRx()
{
addMouseMotionListener( new MouseMotionAdapter()
{
public void mouseDragged(MouseEvent ev)
{
end = ev.getPoint();
rect.setFrameFromDiagonal(start, end);
repaint();
}//end mouse drag
});
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
start = e.getPoint();
}
public void mouseReleased(MouseEvent ev)
{
points[pointCount] = start;
points2[pointCount] = ev.getPoint();
pointCount++;
rect.setFrameFromDiagonal(start, start);
repaint();
}
});
}
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
// Draw line being dragged.
g2.setPaint(Color.red);
g2.draw(rect);
// Draw lines between points in arrays.
g2.setPaint(Color.blue);
Rectangle r = new Rectangle();
for (int i =0; i < pointCount; i++)
{
r.setFrameFromDiagonal(points[i], points2[i]);
g2.fill(r);
}
}
public static void main(String[] args)
{
DrawRectRx test = new DrawRectRx();
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.add(test);
f.setSize(400,400);
f.setLocation(200,200);
f.setVisible(true);
}
}
Subscribe to:
Posts (Atom)