EzDevInfo.com

falcon

Falcon is a high-performance Python framework for building cloud APIs, smart proxies, and app backends. Falcon - The minimalist Python WSGI framework falcon is a truly fast, light-weight framework for building cloud apis. it tries to do as little as possible while remaining highly effective.

What is your opinion on the Falcon language?

Falcon is a programming language that supports multiple paradigms like message passing, OO, functional, and yet the code looks nice and clean.

What do you think, does it have a chance to take off and be used as a general purpose programming glue language? Is it worth exploring? What are your impressions so far if you used it in real projects?


Source: (StackOverflow)

Sequence combinations

I am trying to find all possibilities of a 4 digit code using the numbers 1 thru 6. the same number can be used for any of the four (i.e. 1, 1, 1, 1).


Source: (StackOverflow)

Advertisements

Why does my Falcon script print the date a month ahead instead of today's date?

Today is April 25, 2009 which in US format is abbreviated month-day-year, so today is 04-25-09. This line

> CurrentTime().toString("%m-%d-%y")

should print "04-25-09". Instead it prints "05-25-09". Why is that? According to the docs CurrentTime() returns a TimeStamp instance. TimeStamp has a toString() method which accepts a date/time format as a parameter, which is supposed to be in strftime format. Is there something wrong with my understanding of the code? I am using Falcon 0.8.14.2("Vulture") on Windows Vista (64-bit)

[2]: http://linux.die.net/man/3/strftime strftime format


Source: (StackOverflow)

User management in Single Page App + REST backend

What is the best way to do user management in a single page JS (Mithril) app? I want users to login to load preferences and take on a role so they gain certain permissions. I have a REST API backend written in Python (Falcon web framework). Having read a bit into it, it seems to boil down to sending credentials to the backend and get a token back. But the question is how that should be done. It seems that tokens are a better method than cookies, but that has effects on the exchange of secrets/tokens. the 'xhr.withCredentials' method seems to be cookie based for instance. JWT (json web tokens) seems like a modern, interesting option, but it's hard to find a clear explanation how it could be used with a SPA.. And once the Mithril app has a token, where should I store it and how should I use it with subsequent requests?


Source: (StackOverflow)

How to integrate QT with novint falcon?

Novint falcon is integrated using the HDAL SDK on Visual Studio. I could not find any documentation online to install the SDK on QT. I tried to include the HDAl library and header files in my QT project. The .pro file looks like this.The error is

:-1: error: No rule to make target '../imagesegment/hdl.h', needed by 'debug/main.o'. Stop.

#-------------------------------------------------
#
# Project created by QtCreator 2014-11-04T14:24:33
#
#-------------------------------------------------

QT       += core

QT       -= gui

TARGET = imagesegment
CONFIG   += console
CONFIG   -= app_bundle

TEMPLATE = app


SOURCES += main.cpp \
    haptics.cpp \
    gshaptics.cpp \
    main_dx9.cpp \
    main_opengl.cpp \
    StdAfx.cpp

HEADERS += \
    hdl.h \
    hdlConstants.h \
    hdlErrors.h \
    hdlExports.h \
    hdlu.h \
    hdluExports.h \
    adll.h \
    afuncs.h \
    atypes.h \
    avars.h \
    glut.h \
    haptics.h \
    StdAfx.h \
    Widget.h


win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/lib/ -lhdl
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/lib/ -lhdld

INCLUDEPATH += $$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include
DEPENDPATH += $$PWD/../../../../Program Files/Novint/HDAL_SDK_2.1.3/include


Source: (StackOverflow)

Falcon, hadoop core concepts

Im quite a frontend biased dev so some backend weird concepts are sometimes hard to me to understand, specially outside the js world (I know node, express backend).

I will have to develop a frontend for falcon - hadoop, The UI should allow creating a new feed. Users shall be allowed to define a process workflow, The users must define or create at least one cluster prior to creating feed or process.

Those are some req I received

My questions are:

Does the Feed entity behaves like a document or object?, lets say similar to a json object?

Are the clusters just different places where different tasks are made? (I mean in the hadoop, falcon way of life)

The process entity is just the lifecycle of tasks to perform in a feed entity?

And a cluster entity, is just a separate group of tasks?

I know that there is a REST api to communicate with that backend, will that be enough to manage feeds, clusters, etc? or there are limitations?

EDIT

To ysr answer I want to add as the time went through I have a more precise understanding,

entities (feed, process, cluster) are defined, submitted and getted in xml format, entities specification here http://falcon.apache.org/EntitySpecification.html

the REST API is http://falcon.apache.org/restapi/ResourceList.html and you are able to manage your entities lifecycle using it.

From the front end perspective I didnt need to know much more than that.


Source: (StackOverflow)

Falcon app not running under gunicorn

I have this trivial falcon app :

import falcon

class ThingsResource:
    def on_get(self, req, resq) :
        #"""Handels GET requests"""
        resp.status = falcon.HTTP_200
                resp.body = '{"message":"hello"}'


app = falcon.API()
things = ThingsResource()
app.add_route('/things', things)

I'm trying run it using gunicorn this way :

arif@ubuntu:~/dialer_api$ gunicorn things:app

But when i get this when i try to connect it with httpie :

arif@ubuntu:~$ http localhost:8000/things
HTTP/1.1 500 Internal Server Error
Connection: close
Content-Length: 141
Content-Type: text/html

<html>
  <head>
    <title>Internal Server Error</title>
  </head>
  <body>
    <h1><p>Internal Server Error</p></h1>

  </body>
</html>

This is so trivial, i don't what's going wrong here?


Source: (StackOverflow)

Falcon & Oozie - How to configure job.properties for oozie in falcon

I have a oozie workflow which calls a sqoop and hive action. This individual workflow works fine when I run oozie from command line. Since the sqoop and hive scripts vary, I pass the values to the workflow.xml using job.properties file.

sudo oozie job -oozie http://hostname:port/oozie -config job.properties -run

Now I want to configure this oozie workflow in Falcon. Can you please help me in figuring out where can I configure or pass the job.properties?

Below is the falcon process.xml

<process name="demoProcess" xmlns="uri:falcon:process:0.1">
<tags>pipeline=degIngestDataPipeline,owner=hadoop, externalSystem=svServers</tags>
<clusters>
    <cluster name="demoCluster">
        <validity start="2015-01-30T00:00Z" end="2016-02-28T00:00Z"/>
    </cluster>
</clusters>
<parallel>1</parallel>
<order>FIFO</order>
<frequency>hours(1)</frequency>
<outputs>
    <output name="output" feed="demoFeed" instance="now(0,0)" />
</outputs>

<workflow name="dev-wf" version="0.2.07"
engine="oozie" path="/apps/demo/workflow.xml" />

<retry policy="periodic" delay="minutes(15)" attempts="3" />
</process>

I could not find much help on the web or the falcon documentation regarding this.


Source: (StackOverflow)

Getting Shell script console output in Falcon

I am working in Falcon. Trying to convert the existing oozie workflow. In Oozie, we can get the console output of a shell script in other actions by using the following way :

In script :

CalculateDate.sh*
...
CURRENT_DATE=`date`
echo "CURRENT_DATE=${CURRENT_DATE}"
...

In workflow :

<action>
<hive>
.......
<param>DATE=${wf:actionData('CalculateDate')['CURRENT_DATE']}</param>
......
</hive>
</action>

I dont want to call a workflow from a falcon process to have shell action in it. Is there any equivalent way to get that in falcon?

Thanks in Advance !


Source: (StackOverflow)

Falcon : how to use hbase as backend database instead of default titan

I have been playing with falcon on Hortonworks platform. It uses titan as back end graph database.I know it allows to use other databases like hbase to serve the same purpose.

How do I use it ?

I know I have to go in falcon config section in ambari and maybe add some custom startup properties but not able to figure out which property and which value.

Can someone please help me with this?


Source: (StackOverflow)

Adding falcon application routes on a root directory

I am writing a falcon application for serving some webpages. Now I have some js, css files under /js, /css under the root dir. These /js and /css directories can have multiple subdirectories and the files may be located inside one of the sub directories.

I want to have a falcon apps route added such that the webpage requests for

/js/subdir1/subdir2/temp.js
/js/subdir1/temp2.js 

can be satisfied by the same responder method.

But when I tried, having a route added like

app.add_route("/js/{filename}", ResourceClass())

the request for /js/subdir1/subdir2/temp.js does not reach the responder.

The responder I have is as below,

class ResourceClass(object):
    def on_get(self, request, response, filename):
        file_path = os.path.join(path_to_js,filename)
        serve_file(response, file_path)

serve_file will create the appropriate response and return it.

I want the filename to be populated as

"subdir1/subdir2/temp.js" for "/js/subdir1/subdir2/temp.js" and
"subdir1/temp2.js" for "/js/subdir1/temp2.js "

How can I add the route and add the responder ?


Source: (StackOverflow)

Pyserial readline() shows mix up of bits

I am very new to Arduino and Python. I'm working on the communication between an Arduino Uno and my laptop using Pyserial. The Python script in my laptop is called by an H3D Viewer, which is linked to a Novint Falcon.

My laptop sends the positional data of the Falcon to the Arduino, to be sent to the robot. Right now I'm merely trying to read back the data I sent from the Arduino, to make sure everything works. But it doesn't!

Here is part of my Python script (which is called by a .x3d file).

dp_text, = references.getValue()

class display (threading.Thread): 
  def __init__(self, delay):
    threading.Thread.__init__(self)
    self.delay = delay

  def run(self):
    while 1:

        receivedFalconData=[]
        tex=[]
        tex.append("DevicePosX = " + str(localFalconData))

        receivedFalconData=ser.readline()
        ser.flush()
        ser.flushInput()
        tex.append("Input = " + str(receivedFalconData))

        dp_text.string.setValue(tex)
        time.sleep(self.delay)

displaying = display(0.1)
displaying.start()

The above thread is in charged of refreshing the text node in the H3D Viewer every 100ms. The Arduino's code is below:

#include <SoftwareSerial.h>

char Axispos[6] ={0,0,0,0,0,0};
int xvalue= 0;

SoftwareSerial mySerial(7,6); //RX, TX

void setup() {

  Serial.begin( 9600 );
  Serial.flush();
  mySerial.begin(9600);
}

void loop(){

  while( Serial.available() > 0 ) 
  {
    Serial.readBytes(Axispos,6);
    Serial.flush();

    xvalue = (Axispos[0] << 8) + (Axispos[1] & 0xff);

    Serial.println(xvalue);
    Serial.flush();

    mySerial.write(Axispos);
    mySerial.flush();

    delay(500);

  }
}

The x-axis value read by the Arduino is sent back to the laptop and stored in receivedFalconData. This value is supposed to be the same as localFalconData, which is the x-axis value in the script itself.

The results: receivedFalconData mimics localFalconData for a few seconds, before going wild.

It sometimes shows the correct value again, though, which tells me this is probably an issue with the Pyserial input buffer overflow? How could this be the case, since (if I'm correct) serial.readline() empties the input buffer after reading it? Furthermore, the Arduino only sends data every .5 second, whereas the laptop reads every .1 second.

But when the readline() part is placed in the class for sending data (which is called whenever the Falcon has new data available), receivedFalconData is perfectly correct.

Also, I get two of these ☐ symbols behind receivedFalconData when it is displayed in H3D...

Can someone who has experience with Pyserial please please help me? I would gladly give more info if my problem is still unclear to you.


Source: (StackOverflow)

Yet Another Syntax Highlighting in Geany Issue

I am trying to get Geany to recognize syntax highlighting for Falcon, but have had no luck thus far. I have tried following this SO solution, but no such luck. I am using version 1.23 of Geany on Fedora 18. The following is my custom ~/.config/geany/filedefs/filetypes.Falcon.conf file:

   [keywords]
   primary= <snip>
   identifiers=<snip>

   [settings]
   extension=fal
   comment_single=//
   comment_open=/*
   comment_close=*/
   comment_use_indent=false
   symbol_list_sort_mode=1
   tag_parser=Falcon
   lexer_filetype=Python

   [indentation]
   width=4
   type=0

   # (use only one of it at one time)
   compiler=
   linker=
   run_cmd=falcon "%f"

I cut out all the primary and identifiers since those are rather long, but I do have them included. I have tried using lexer_filetype=C, but still no syntax-highlighting. Any suggestions that might help me out?


Source: (StackOverflow)

Falcon language reserved keywords

I'm writing a compiler for Falcon (as a course project for my graduate level compiler's class). Currently I'm working on lexical analyser. In that I need to figure out whether a lexeme is a keyword or an identifier. I'm unable to find a list of all reserved keywords for Falcon. For languages like C, C++ it is easily available on either on Wikipedia pages or some standard books.

One dirty hack I did was I downloaded vim syntax file for Falcon to figure out all keywords but I got around 70 words by this method but I read somewhere that Falcon has around 30 keywords like C. I also looked at Falcon's reference manual but there is also I couldn't find a compiled list of all keywords at one place. Does anyone know where I can get the list of all keywords for Falcon?

Thank you.


Source: (StackOverflow)

return from celery to falcon

I am using falcon and celery, I want to raise exceptions if celery queued job fails or return to the falcon response method. my code is the same as:

delete.apply_async((niam, DeleteAllocatedSpace, uid), queue='users', countdown=2)

and the delete function is:

@app.task(track_started=True)
def delete(_iam, DeleteAllocatedSpace, uid):
    delete user

How do I raise exceptions in those circumstances?


Source: (StackOverflow)