Skip to content

Instantly share code, notes, and snippets.

View lamprosg's full-sized avatar

Lampros Giampouras lamprosg

  • Athens, Greece
View GitHub Profile
@lamprosg
lamprosg / erlang-b.js
Created March 3, 2012 20:04
Erlang B Equation - Traffic units and busy probability on GSM gateways
// Javascript: Percentage of busy
// calls with a=traffic and n lines
function erl(a,n)
{
u=1;
for(i=1;i<=n;i++)
{
u+=power(a,i)/factorial(i);
}
@lamprosg
lamprosg / qtxml.cpp
Created March 20, 2012 10:11
Writing and reading XML files with Qt - qxmlstreamwriter and qxmlstreamreader provided classes
//Writing and reading XML files with Qt - qxmlstreamwriter and qxmlstreamreader supported classes
void MyXMLClass::SaveXMLFile()
{
QString filename = QFileDialog::getSaveFileName(this,
tr("Save Xml"), ".",
tr("Xml files (*.xml)"));
@lamprosg
lamprosg / outofmemory.cpp
Created March 21, 2012 12:04
C++/Qt out of memory exceptions & handling
QApplication app(argc, argv);
...
try
{
app.exec();
}
catch (const std::bad_alloc &)
{
// clean up here, e.g. save the session
// and close all config files.
@lamprosg
lamprosg / SOAPrequest.xml
Created March 21, 2012 19:20
Tutorial - Example of a SOAP message (Web Services)
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
@lamprosg
lamprosg / Main.php
Created April 19, 2012 10:14
Simple Image Slideshow using JQuery Cycle
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Slideshow</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.cycle.all.min.js"></script>
@lamprosg
lamprosg / databaseconnection.php
Created April 21, 2012 09:20
Example: Getting rows from a MySQL table
<?php
$databaseuser="root";
$databasepassword="";
$databasename="eventkicker";
?>
@lamprosg
lamprosg / sendMail.html
Created April 21, 2012 09:25
Using Ajax in Javascript
<script type="text/javascript">
function sendMailMessage()
{
document.getElementById("sendbutton").innerHTML="<img src='images/loading.gif' border='0'>";
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
@lamprosg
lamprosg / style.css
Created April 21, 2012 09:32
CSS popdown & others
@charset "utf-8";
/* CSS Document */
A:link {text-decoration: none; color: #FFFFFF; font-weight:bold;}
A:visited {text-decoration: none; color: #FFFFFF;}
A:active {text-decoration: none; color: #CCCCCC;}
A:hover {text-decoration: none; color: #CCCCCC;}
BODY {font-size: 10pt; font-family:"Times New Roman", Times, serif; background-image:url(../images/sunlight.jpeg); background-repeat:no-repeat; background-attachment:fixed;}
@lamprosg
lamprosg / modify.html
Created April 21, 2012 09:41
Modify CSS with JavaScript
<link rel="stylesheet" type="text/css" href="stylesheets/maint_layout.css" />
<script type="text/javascript">
function showPage(item)
{
if (item==1)
{
document.getElementById('default').style.display = 'none';
document.getElementById('about').style.display = 'block';
}
@lamprosg
lamprosg / jquery.js
Last active August 13, 2018 13:33
JQuery basic use
$('document').ready(function(){
/**************************************************************/
$h1elements = $("h1"); //Returns a jQuery element from an HTML tag
/**************************************************************/
//use add to add the h2 elements to $h1elements
$h1andH2elements = $("h1").add("h2");