Skip to content

Instantly share code, notes, and snippets.

View nepda's full-sized avatar

Nepomuk Pajonk nepda

View GitHub Profile
@nepda
nepda / uebung.hs
Last active December 11, 2015 19:19
Höhere Programmiersprachen - Übung Textuelle Version: http://wiki.nepda.eu/wiki/H%C3%B6here_Programmiersprachen_(%C3%9Cbung)
-- Übung zur Vorlesung Höhere Programmiersprachen
-- im Wintersemester 12/13 an der TU Chemnitz
--
-- http://wiki.nepda.eu/wiki/Höhere_Programmiersprachen_(Übung)
--
-- -----------------------------
-- Ü1, A1 a
nand:: Bool->Bool->Bool
nand a b = not (a && b)
@nepda
nepda / Listing 1: Domonstration von blockierendem Verhalten.js
Last active December 18, 2015 21:59
Beispiel Codeschnipsel/Listings für die Hauptseminararbeit Web Engineering "Beyond Node.js"
// Initialisierung ...
if (request == 'catalog_products') {
var products = db.query('SELECT * FROM `catalog_products`');
// warten auf Antwort der Datenbank...
// ...
// ...
foreach (i in products) {
response.write(product[i].title + ', ' + product[i].price + ' &euro;<br>');
}
}
typedef struct {
signal s;
} bsem; // binary semaphor
void bsem_down(bsem s) {
wait(bsem.s);
}
void bsem_up(bsem s) {
signal(bsem.s);
typedef struct {
unsigned int cnt;
bsem wait;
bsem mutex;
} sem;
void sem_down(sem s) {
bsem_down(s.wait);
bsem_down(s.mutex);
if (s.cnt > 1) {
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class SamplePage : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Clicked at " + DateTime.Now.ToString();
}
<?php
namespace Console\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\Console\Request as ConsoleRequest;
class IndexController extends AbstractActionController
{
protected $prompt = '$ > ';
@nepda
nepda / JSON-HAL-With-Server-Status (JHWS2).md
Last active August 29, 2015 13:57
This specification aims to extends the HAL specification by a standard way for providing (error) messages and statuses according to the request.

JSON HAL With Server Status (JHWS2) Specification

Authors

This specification aims to extends the HAL specification by a standard way for providing messages and statuses according to the request. Additionally you have the possibility to transfer more than one result due the "ResponseSet".

Problems with the current HAL specification

#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
int main(int argc, char** argv) {
int fd,
count,
nbytes = 4;
char buffer[4];
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char** argv) {
int f1,
f2,
res;
char buffer[42];
f1 = open("foo1", O_RDONLY, 0);
f2 = open("foo2", O_RDWR | O_CREAT | O_TRUNC, 0644);
res = read(f1, buffer, 42); // read "Hallo Welt\n", 10 bytes from f1 into buffer
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <wait.h>
int main(int argc, char** argv) {
pid_t cpid;
int fd[2],