This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <iostream> | |
#include <bitset> | |
using namespace std; | |
string simple_2(unsigned long long int liczba){ | |
/* ta funkcja ucina niepotrzebne zera, tak, aby ciag byl ciagiem systemu dwojkowego (przyjmuje tylko liczby naturalne, w systemie 10-nym) */ | |
string binary = bitset<8>(liczba).to_string(); /* konwertujemy liczbe na binarna (o wielkosci 16 bitow) i zamieniamy w string (bo normalne liczby nie moga zaczynac sie od "0" :)) */ | |
string new_binary; | |
bool received = false; /* zmienna ktora definiuje, czy skonczylismy ucinac zera z poczatku */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"picture": "http://placehold.it/32x32", | |
"_id": "5494a031b43e219b5dd8d404", | |
"name": "Acevedo Church", | |
"gender": "male", | |
"age": 36, | |
"email": "acevedochurch@enormo.com", | |
"address": "652 Scott Avenue, Newkirk, West Virginia, 8972", | |
"balance": "$3,218.17", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <ctime> | |
using namespace std; | |
int main(){ | |
/* ustawiamy, aby rand() zawsze generowal nowe liczby na podstawie czasu */ | |
srand( time( NULL ) ); | |
int tab[10][10],i=0,j=0,suma=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'daemons' | |
Daemons.run('leds.rb') |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 1 column, instead of 2. in line 1.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typ nazwa opis | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
a Dupa xD Asdf, asdfvcx | |
b penisy fasdfasdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="javascript/jquery-2.1.4.min.js"></script> | |
</head> | |
<body> | |
<h1>sieci</h1> | |
<form> | |
<input type="text" id="ip-address" value="Adres IP"> | |
<input type="text" id="address-mask" value="Adres podsieci"> | |
<input type="button" id="submit" value="Oblicz"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I use a button to change the I18n.locale, which also sets the locale in session[:locale]. Everything works fine, every view is translated, flash messages as well, devise views, etc. | |
The problem I stepped upon, is that the Post model validation errors, after changing the locale with the button, are still sent in the old language (everything else, flash messages, devise views, and other views are properly translated). Refreshing the site doesn't fix it. | |
E.g. | |
Model validations: | |
validates_length_of :description, :minimum => 5, :maximum => 500, :too_long => I18n.t('posts.too_long'), :too_short => I18n.t('posts.too_short') | |
Reproducing the error: | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TL:DR - after changing the language, if user submits invalid values for Post model, the validation error is still thrown in the previous locale. | |
Extended version with code: | |
I use a button to change the I18n.locale, which also sets the locale in session[:locale]. Everything works fine, every view is translated, flash messages as well, devise views, etc. | |
The problem I stepped upon, is that the Post model validation errors, after changing the locale with the button, are still sending messages translated to the old language (everything else, flash messages, devise views, and other views are properly translated). Refreshing the site doesn't fix it. | |
E.g. | |
Model validations: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root :to => 'home#index' | |
#sessions | |
post 'auth/:provider/callback' => 'sessions#create' | |
post 'auth/failure', :to => 'sessions#failure' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hello, | |
I'm trying to download some API results from | |
http://steamcommunity.com/market/pricehistory/?country=US¤cy=3&appid=730&market_hash_name=Operation%20Phoenix%20Weapon%20Case | |
the link opened in browser works just fine, however when I tried to open it with open-uri (open(link).read()) it threw a [] 400. | |
I was adviced to take a look into headers I send, and so I have found some in Chrome devtools. I now get a response, however it's unreadable, and I suspect it might be due to the encoding / gzip inflation? Not sure, I'm really a rookie. | |
Help will be greatly appreciated. The code I'm using is shown below. :) |
OlderNewer