nitrogen

Including the Erlang client library from Riak in Nitrogen

心已入冬 提交于 2019-12-29 08:04:11
问题 i'm just starting up with a web app using nitrogen and everything is going well. But i also want my app to interface with a riak db that i set up and i'm having some trouble. I'm confused as to how I "include" the erlang client interface so that my code in nitrogen can access it. (https://wiki.basho.com/display/RIAK/Erlang+Client+PBC) I'm new to erlang and nitrogen, but i mean in general, for erlang, how do i include other libraries as reference? Do i just take the compiled beam files and

How to read from post param?

丶灬走出姿态 提交于 2019-12-25 02:44:11
问题 I need to parse text file. This file is in post param. I have code like this: upload_file('POST', []) -> File = Req:post_param("file"), What should I do next? How to parse it? 回答1: What's inside Req:post_param("file") ? You assume it's a path to a file: have you checked the value of File ? Anyway, it's Req:post_files/0 you are probably looking for: [{_, _FileName, TempLocation, _Size}|_] = Req:post_files(), {ok,Data} = file:read_file(TempLocation), It's also probably a Bad Idea to leave the

I cannot access to nitrogen/inets server from any machine but the localhost

自作多情 提交于 2019-12-13 17:59:57
问题 Thanks to many discussions in this forum, I found that I should be able to build the application I was planning to do for home usage based on Nitrogen. So I ran into Nitrogen tutorials, Demo and docs, and start to do some tests based on the self contained inets/nitrogen site. Everything was going well until I wanted to try to access my new website from another PC. Of course I had to tune my box first in order to route wan requests to lan... But after a day searching, reading and testing, I am

How to keep track of a process per browser window and access it at each event in Nitrogen?

本秂侑毒 提交于 2019-12-12 18:19:28
问题 In Nitrogen, the Erlang web framework, I have the following problem. I have a process that takes care of sending and receiving messages to another process that acts as a hub. This process acts as the comet process to receive the messages and update the page. The problem is that when the user process a button I get a call to event. How do I get ahold of that Pid at an event. the code that initiates the communication and sets up the receiving part looks like this, first I have an event which

Using the Erlang client library from Riak in Nitrogen

左心房为你撑大大i 提交于 2019-12-12 06:37:59
问题 This question is a continuation of Including the Erlang client lib which was asked before. I was able to include the library by changing: {mimetypes, ".*", {git, "git://github.com/spawngrid/mimetypes", {branch, master}}}, %% Uncomment the following lines and comment the bottom lines with specific %% tags to always pull the latest versions {nitrogen_core, ".*", {git, "git://github.com/nitrogen/nitrogen_core",{branch, master}}}, to: {mimetypes, ".*", {git, "git://github.com/spawngrid/mimetypes"

how do we efficiently handle time related constraints on mnesia records?

℡╲_俬逩灬. 提交于 2019-12-05 06:49:12
问题 i am writing records into mnesia which should be kept there only for an allowed time (24 hours). after 24 hours, before a user modifies part of them, the system should remove them automatically. forexample, a user is given free airtime (for voice calls) which they should use in a given time. if they do not use it, after 24 hours, the system should remove these resource reservation from the users record. Now, this has brought in timers. an example of a record structure is: -record(free_airtime

how do we efficiently handle time related constraints on mnesia records?

点点圈 提交于 2019-12-03 20:51:24
i am writing records into mnesia which should be kept there only for an allowed time (24 hours). after 24 hours, before a user modifies part of them, the system should remove them automatically. forexample, a user is given free airtime (for voice calls) which they should use in a given time. if they do not use it, after 24 hours, the system should remove these resource reservation from the users record. Now, this has brought in timers. an example of a record structure is: -record(free_airtime, { reference_no, timer_object, %% value returned by timer:apply_after/4 amount }). The timer object in

Including the Erlang client library from Riak in Nitrogen

给你一囗甜甜゛ 提交于 2019-11-29 11:43:14
i'm just starting up with a web app using nitrogen and everything is going well. But i also want my app to interface with a riak db that i set up and i'm having some trouble. I'm confused as to how I "include" the erlang client interface so that my code in nitrogen can access it. (https://wiki.basho.com/display/RIAK/Erlang+Client+PBC) I'm new to erlang and nitrogen, but i mean in general, for erlang, how do i include other libraries as reference? Do i just take the compiled beam files and throw it somewhere, then have an -include line at the top of my erlang code? if so, where do do i throw