This file contains hidden or 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
fill_elem_tree(C, AppIntId, ElemId) -> | |
case db:get(C, AppIntId, ElemId) of | |
{error, not_found} -> | |
{error, {?MODULE, no_value}}; | |
Value -> | |
ResultRec = wac_lib:from_binary(term, Value), | |
ChildsRec = [fill_elem_tree(C, AppIntId, ChildElId) || | |
ChildElId <- ResultRec#elem.childs], | |
#elem_info{id = ResultRec#elem.id, | |
name = ResultRec#elem.name, |
This file contains hidden or 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
%%%------------------------------------------------------------------- | |
%%% @author Artem Golovinsky <[email protected]> | |
%%% @copyright (C) 2012, Artem Golovinsky | |
%%% @doc Header file for epatom. | |
%%% | |
%%% Name of element/attribute is element_name()/attr_name(), | |
%%% when it is defined in RFC4287 and presented | |
%%% in http://www.w3.org/2005/Atom namespace. | |
%%% Otherwise, name of element/attribute is string() | |
%%% |
This file contains hidden or 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
-module(example). | |
-behaviour(gen_server). | |
%% API | |
-export([start_link/0]). | |
%% gen_server callbacks | |
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, | |
terminate/2, code_change/3]). |
This file contains hidden or 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
package HelloPackage; | |
import org.springframework.boot.*; | |
import org.springframework.boot.autoconfigure.*; | |
import org.springframework.context.ApplicationContext; | |
import org.springframework.context.annotation.ComponentScan; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.stereotype.*; | |
import org.springframework.web.bind.annotation.*; |
This file contains hidden or 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
-module(nasoc_conn_handler2). | |
-export([]). | |
-record(state, {cli_socket :: inet:socket(), | |
ext_socket :: inet:socket(), | |
cli_ip_port :: {ip_address(), ip_port()}, |
This file contains hidden or 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
var Calcs = React.createClass({ | |
getInitialState: function() { | |
return {count: ''}; | |
}, | |
handleClickNum: function(index) { | |
console.log("Adsads", index); | |
this.setState({count: index}); | |
}, |
This file contains hidden or 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
var Calcs = React.createClass({ | |
getInitialState: function() { | |
return {count: ''}; | |
}, | |
handleClickNum: function(index) { | |
this.setState({count: index}); | |
}, | |
render: function() { |
This file contains hidden or 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
1> F = fun(N) -> list_to_atom(integer_to_list(N)), timer:sleep(infinity) end. | |
17> [spawn(fun() -> F(N) end) || N <- lists:seq(1, 100000)]. | |
[<0.751.0>,<0.752.0>,<0.753.0>,<0.754.0>,<0.755.0>, | |
<0.756.0>,<0.757.0>,<0.758.0>,<0.759.0>,<0.760.0>,<0.761.0>, | |
<0.762.0>,<0.763.0>,<0.764.0>,<0.765.0>,<0.766.0>,<0.767.0>, | |
<0.768.0>,<0.769.0>,<0.770.0>,<0.771.0>,<0.772.0>,<0.773.0>, | |
<0.774.0>,<0.775.0>,<0.776.0>,<0.777.0>,<0.778.0>,<0.779.0>|...] | |
18> erlang:memory(atom_used). | |
2255590 | |
19> erlang:memory(atom). |
This file contains hidden or 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 user_register(session, username, password, email): | |
try: | |
new_user = User(name=username, email=email) | |
session.add(new_user) | |
session.commit() | |
return True, 'ok' | |
except exc.IntegrityError as e: | |
session.rollback() | |
code, msg = e.orig | |
print msg |
This file contains hidden or 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 User(Base): | |
__tablename__ = 'users' | |
id = Column(Integer, primary_key=True) | |
name = Column(String(32), unique=True, nullable=False) | |
email = Column(String(64), unique=True, nullable=False) | |
password = Column(String(64), nullable=False) | |
class Device(Base): | |
__tablename__ = 'devices' | |
id = Column(Integer, primary_key=True) |
OlderNewer