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
public string IP_Parse(string str) | |
{ | |
const string error_str = "Input error. Invalid IP-address."; | |
if (split == null) | |
return error_str; | |
string[] split = str.Split(new Char[] { '.' }, StringSplitOptions.RemoveEmptyEntries); | |
if (split.Length != 4) | |
return error_str; | |
for (int i = 0; i < split.Length; ++i) |
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
use std::collections::HashMap; | |
fn process_polish(funcs : &HashMap<&str, Box<(Fn(&mut Vec<f32>) -> f32)>>, token : &str, stack : &mut Vec<f32>) | |
{ | |
if funcs.contains_key(token) { | |
let val = funcs[token](stack); | |
stack.push(val); | |
}else{ | |
let tmp = token.parse::<f32>(); | |
match tmp{ |
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 <boost/fusion/tuple.hpp> | |
#include <boost/fusion/view.hpp> | |
#include <boost/fusion/algorithm.hpp> | |
#include <boost/fusion/adapted/struct/adapt_struct.hpp> | |
#include <boost/type_traits.hpp> | |
#include <boost/mpl/arg.hpp> | |
#include <boost/lambda/lambda.hpp> | |
#include <string> | |
#include <iostream> |
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 <boost/interprocess/managed_shared_memory.hpp> | |
#include <boost/interprocess/containers/vector.hpp> | |
#include <boost/interprocess/allocators/allocator.hpp> | |
#include<stdio.h> | |
#include <cstdlib> //std::system | |
//using namespace boost::interprocess; | |
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator; | |
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector; | |
int main(int argc, char *argv[]) |
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
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator; | |
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector; | |
DataVector *myvector; | |
void init_myvector() | |
{ | |
struct shm_remove | |
{ | |
shm_remove() { boost::interprocess::shared_memory_object::remove("MySharedMemory"); } | |
~shm_remove(){ boost::interprocess::shared_memory_object::remove("MySharedMemory"); } | |
} remover; |
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
typedef boost::interprocess::allocator<float, boost::interprocess::managed_shared_memory::segment_manager> ShmemAllocator; | |
typedef boost::interprocess::vector<float, ShmemAllocator> DataVector; | |
DataVector *myvector; | |
void init_myvector() | |
{ | |
struct shm_remove | |
{ | |
shm_remove() { boost::interprocess::shared_memory_object::remove("MySharedMemory"); } | |
//~shm_remove(){ boost::interprocess::shared_memory_object::remove("MySharedMemory"); } | |
} remover; |
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
if op == '+': | |
res = first + second |
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
try: | |
some() | |
except: | |
print(":(") | |
exit() |
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
def f(arg1, arg2='default'): | |
print('arg1', arg1) | |
print('arg2', arg2) | |
f('one', 'two') | |
f('one') | |
f('one', arg2='two') | |
f(arg1='one', arg2='two') |
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
class A: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y | |
def hi(self): | |
print(self.x, self.y) |
OlderNewer