Tag: Software

Simple Bean Machine program done in Powershell

Powershell Header

In the last article I posted the C++ Code for a simple Bean Machine output. Now I did the same in Powershell. I know this is not really a fantastic Powershell script, but its good to show others how things get done in Powershell.

Like in the C++ bean machine it works like this:

Bean MachineAnd the Output should look like this:

Bean Machine outputAnd here is how you do this in Powershell:

#Config
[int]$ballCount = 100
[array]$box = @(0, 1, 2, 3, 4, 5)
[string]$line = " +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-->"
[string]$numbers = " 0 5 10 15 20 25 30 35 40 45 50"
[object]$random = New-Object System.Random
 
#count
for([int]$i = 0; $i -lt $ballCount; $i++){
[int]$counter = 0
 
for([int]$j = 0; $j -lt 5; $j++){
$leftorright = $random.next(0,2)
$counter = $counter + $leftorright
}
$box[$counter] = $box[$counter] + 1
}
 
#Output
Write-Host $numbers
Write-Host $line
for ([int]$t = 0; $t -lt 6; $t++){
[string]$Statusline = ""
for ([int]$u = 0; $u -lt $box[$t]; $u++){
[string]$Statusline += "#"
}
Write-Host $t "|" $Statusline $box[$t]
Write-Host $line
}


Simple C++ dec2bin program @KTSI

This is a very simple dec2bin program done for KTSI.

#include 
#include 
#include 
 
using namespace std;
 
string dec2bin (int v) {
	if (v > 255) {
		return "";
	}
	else { 
		string bin;
		int oneorzero;
		for(int i=8;i>0;i--) {
			oneorzero = v % 2;
			if (oneorzero == 1) {
				bin = "1" + bin;
			}
			else {
				bin = "0" + bin;
			}
			v /= 2;
 
		}
 
	return bin;
 
	}
}
 
int main(){
    int v;
    do {
        cout << "Wert(ende = -1) = "; if (!(cin >> v)) {
            return 0;
        }
        if (v < 0) break;
        string s = dec2bin(v);
        cout << s << endl; //system("PAUSE"); } while(v >= 0);
    cout << "bye" << endl;
    //system("PAUSE");
    return 0;
}


GForge gets support for iOS

Good news for GForge users. GForge gets mobile support for iPhone and iPad. This was something I missed for a long time. This will make working with GForge even better.

Gforge

Here is the Blog post:

We are currently developing a client GForge Application for one of the most popular mobile devices platforms, iPhone and iPad. GForge mobile application will have the following features:

  • User management
  • Project Browser
  • Tracker Browser
  • Tracker Item View and Modification
  • Tracker Item Creation

Fast communication and information sharing are the keystones of GForge tools. Today’s mobile devices and smart phones provide a new way to take these two features to a higher level, allowing people to stay in touch even while they are on the road or away from a regular computer.

Since GForge Community opinions and feedback has been always very important for us we would like to know what other cool features you would like to see on this release.