Skip to content

Instantly share code, notes, and snippets.

public static Dictionary<int,string> EnumToDictionary(Type type)
{
// all translations are in file Enums.resx key => enum attribute name
ResourceManager rm = new ResourceManager(typeof(Enums));
return Enum.GetValues(type).Cast<int>().ToDictionary(e => e, e => rm.GetString(Enum.GetName(type, e)));
}
import java.io.FileNotFoundException;
import java.io.IOException;
import com.csvreader.CsvReader;
public class mBankParser {
public static void main(String [] args){
try {
require 'spec_helper'
describe "Rational" do
it "should create new object" do
RTest.new(3).should_not be_equal nil
end
it "should be equal to inf" do
RTest.new(0, 3, 0).to_f.should == 1.0/00
10.times {
it "should be equal to float" do
a1,b1,a2,b2 = rand(100), rand(100), rand(100), rand(100)
a = RTest.new(0, a1, b1)
b = RTest.new(0, a2, b2)
(a+b).to_f.should == (1.0*a1/b1 + 1.0*a2/b2)
end
}
jacbar@jacbar:~/aprog/ak_proj$ rspec spec
/home/jacbar/aprog/ak_proj/spec/rational_spec.rb:6: [BUG] unknown type 0x22 (0xc given)
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
-- control frame ----------
c:0024 p:---- s:0087 b:0087 l:000086 d:000086 CFUNC :initialize
c:0023 p:---- s:0085 b:0085 l:000084 d:000084 CFUNC :new
c:0022 p:0017 s:0081 b:0081 l:002108 d:000080 BLOCK /home/jacbar/aprog/ak_proj/spec/rational_spec.rb:6
c:0021 p:---- s:0079 b:0079 l:000078 d:000078 FINISH
c:0020 p:---- s:0077 b:0077 l:000076 d:000076 CFUNC :instance_eval
uint64_t float_to_rational(float a){
uint64_t result, r_denominator = 1, r_numerator, r_sign;
float fraction = a - floor(a);
while(fraction > 0){
fraction *= 10;
fraction = fraction - floor(fraction);
r_denominator *= 10;
}
r_numerator = (int)(a * r_denominator);
#include <stdio.h>
#include <stdint.h>
#include <math.h>
int main() {
float in, ulamek;
uint64_t denominator = 1, numerator, sign;
WR_CMD EQU 0FF2CH
WR_DATA EQU 0FF2DH
RD_STATUS EQU 0FF2EH
RD_DATA EQU 0FF2FH
ORG 0
START:
call LCD_INIT
/*******************************************************************************
* *
* ALGORYTM DIJKSTRY wyznaczania najkrotszej sciezki od *
* danego wierzcholka do wszystkich pozostalych w grafie skierowanym *
* o nieujemnych wagach *
* algorytm.org *
* (wersja zmodyfikowana przez "Sinus32" w celu *
* przystosowania do standardu jêzyka C++) *
* *
********************************************************************************/
\documentclass[wide,a4paper,titlepage,12pt]{mwart}
\usepackage{polski,graphicx,pdflscape}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\title{Projekt i symulacja działania serwerownii}
\author{Jacek Wieczorek\\Marcin Lubimow\\Piotr Pałka}
% Title page layout (fold)