Skip to content

Instantly share code, notes, and snippets.

View lufehr's full-sized avatar

Luca Fehr lufehr

View GitHub Profile
@lufehr
lufehr / Chain.cs
Created September 13, 2012 12:28
Blog - ADT LinkedList - The Node
Node first = new Node { Value = 2 };
Node middle = new Node { Value = 4 };
first.Next = middle;
Node last = new Node { Value = 5 };
middle.next = last;
@lufehr
lufehr / InOrder
Created September 13, 2012 12:21
Blog - Algorithms and Datastructures: Trees, Traversals
Visit(Node current) {
if(current == null) {
return;
}
Visit(current.Left);
Process(current.Value);
Visit(current.Right);
}
@lufehr
lufehr / EmptyStackException.java
Created September 13, 2012 12:07
Blog - ADT Stack (Generic Linked List Based) Java
/**
 * Runtime exception thrown when one tries to perform operation
 * top or pop on an empty stack
 */
public class EmptyStackException extends RuntimeException
{
public EmptyStackException(String e)
{
super(e);
}
@lufehr
lufehr / ArrayStack.java
Created September 13, 2012 09:13
Blog - ADT Stack (Array Based) Java
public class ArrayStack<T> implements Stack<T> {
protected int capacity; // The actual capacity of the stack array
public static final int CAPACITY = 1000; // Default array capacity
protected T S[]; // Generic array to implement the stack
protected int top = -1; // Index for the top of the stack
public ArrayStack(int cap)
{
capacity = cap;
@lufehr
lufehr / gist:3712959
Created September 13, 2012 08:45
Blog - ASP.NET Shared Hosting - Web Deploy
msdeploy.exe -verb:sync
-source:iisApp=mydomain.com
-dest:iisApp=mydomain.com, computerName=https://webxxx.discountasp.net:8172/msdeploy.axd?site=mydomain.com,
userName=cpUsername, password=cpPassword, authtype=basic
-allowUntrusted
@lufehr
lufehr / initwithboost.cpp
Created September 13, 2012 07:49
Blog - C++ std::map/multimap
map<string, int> m;
m["Hans"]=60;
m["Fritz"]=23;
m["Sepp"]=78;
@lufehr
lufehr / set.cpp
Created September 13, 2012 07:45
Blog - C++ std::set/multiset
#include <set>
#include <string>
using namespace std;
// ...
set<string> setStr;
string s = "A";
@lufehr
lufehr / accumulate.cpp
Created September 12, 2012 23:03
Blog - C++ std::vector
#include <numeric>
// ...
istream_iterator<int> eof;
vector<int> v(istream_iterator<int>(cin), eof);
cout << "Summe: " << accumulate(v.begin(), v.end(), 0) << endl;
@lufehr
lufehr / algorithm.cpp
Created September 12, 2012 22:55
Blog - C++ STL Algorithm accumulate()
// addition
template <class InputIterator, class T>
T accumulate (InputIterator first, InputIterator last, T init)
{
while (first!=last) init = init + *first++;
return init;
}
// general Operation
template <class InputIterator, class T, Class binaryOperation>
@lufehr
lufehr / gist:3710349
Created September 12, 2012 22:15
Blog - Continous Integration: CruiseControl.NET with VisualSVN Server and Visual Studio
<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
<project name="TestProject1">
<sourcecontrol type="svn">
<trunkUrl>https://localhost:8088/svn/TestProject1/trunk</trunkUrl>
<workingDirectory>
C:\Development\CCNet\TestProject1
</workingDirectory>
<username>username</username>
<password>password</password>
</sourcecontrol>