Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » Skylark reaching "beta" status, first 6 chapters of tutorial available..
Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36800] Fri, 06 July 2012 17:13 Go to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
...here:

http://www.ultimatepp.org/srcdoc$Skylark$Tutorial$en-us.html

(more to come, I have yet to cover sessions, Ajax support and SQL).

I would also like to ask for help with "deployment" documentation - Skylark now works as console program that serves HTTP and SCGI requests. I guess the most common deployment would be to connect it to Apache through SCGI and use start-stop-daemon, provide some /etc/init.d script etc... I can do documentation about the issue, but I do not feel like am the most qualified to do so...

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36813 is a reply to message #36800] Sun, 08 July 2012 15:50 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1779
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi Mirek,

Great work, the tutorials almost made me want to write a web-app Smile

However, I found a little problem... Out of curiosity, I tried to run ab (Apache Benchmark) on Skylark based application, namely tutorial/Skylark04. It works great, but only sometimes. After a (variable) number of requests, the application fails with assert:
Log:

****************** ASSERT FAILED: Assertion failed in /home/h/upp-production/uppsrc/Core/String.cpp, line 38
rc->refcount > 0


LastErrorMessage: No such file or directory


Backtrace:

Upp::AssertFailed (file=0x83fdb2f "/home/h/upp-production/uppsrc/Core/String.cpp", line=38, cond=0x84016ea "rc->refcount > 0") at /home/h/upp-production/uppsrc/Core/Util.cpp:110
Upp::String0::LFree (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.cpp:38
Upp::String0::Free (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.h:226
Upp::String0::~String0 (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.h:303
Upp::AString<Upp::String0>::~AString (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.h:34
Upp::Moveable<Upp::String, Upp::AString<Upp::String0> >::~Moveable (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/Topt.h:195
Upp::String::~String (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.h:306
Upp::String::~String (this=0xb426bf18) at /home/h/upp-production/uppsrc/Core/String.h:306
Upp::RawHtmlText::~RawHtmlText (this=0xb426bf18) at /home/h/upp-production/uppsrc/Skylark/Witz.h:14
Upp::RawHtmlText::~RawHtmlText (this=0xb426bf18) at /home/h/upp-production/uppsrc/Skylark/Witz.h:14
Upp::RawValueRep<Upp::RawHtmlText>::~RawValueRep (this=0xb426bf10) at /home/h/upp-production/uppsrc/Core/Value.hpp:70
Upp::RawValueRep<Upp::RawHtmlText>::~RawValueRep (this=0xb426bf10) at /home/h/upp-production/uppsrc/Core/Value.hpp:70
Upp::RawValueRep<Upp::RawHtmlText>::~RawValueRep (this=0xb426bf10) at /home/h/upp-production/uppsrc/Core/Value.hpp:70
Upp::Value::Void::Release (this=0xb426bf10) at /home/h/upp-production/uppsrc/Core/Value.h:85
Upp::Value::RefRelease (this=0xb626fa68) at /home/h/upp-production/uppsrc/Core/Value.cpp:25
Upp::Value::~Value (this=0xb626fa68) at /home/h/upp-production/uppsrc/Core/Value.h:239
Upp::Value::~Value (this=0xb626fa68) at /home/h/upp-production/uppsrc/Core/Value.h:239
Upp::Compiler::ExeBlock::Eval (this=0xb41a4ef0, x=...) at /home/h/upp-production/uppsrc/Skylark/Exe.cpp:386
Upp::Render (exe=..., r=0xb62706a0, var=...) at /home/h/upp-production/uppsrc/Skylark/Exe.cpp:395
Upp::Http::RenderResult (this=0xb62706a0, template_name=0x83fbfaa "Skylark04/index") at /home/h/upp-production/uppsrc/Skylark/Http.cpp:290
HomePage (http=...) at /home/h/upp-production/tutorial/Skylark04/main.cpp:7
Upp::Http::Dispatch (this=0xb62706a0, socket=...) at /home/h/upp-production/uppsrc/Skylark/Dispatch.cpp:327
Upp::SkylarkApp::RunThread (this=0xbffff3d8) at /home/h/upp-production/uppsrc/Skylark/App.cpp:67
Upp::SkylarkApp::WorkThread (this=0xbffff3d8) at /home/h/upp-production/uppsrc/Skylark/App.cpp:32
Upp::SkylarkApp::ThreadRun (this=0xbffff3d8) at /home/h/upp-production/uppsrc/Skylark/App.cpp:37
Upp::CallbackMethodAction<Upp::SkylarkApp, void (Upp::SkylarkApp::*)()>::Execute (this=0xb7fda7a0) at /home/h/upp-production/uppsrc/Core/Callback0.h:24
Upp::Callback::Execute (this=0xb7fd81b0) at /home/h/upp-production/uppsrc/Core/Callback.cpp:7
Upp::Callback::operator() (this=0xb7fd81b0) at /home/h/upp-production/uppsrc/Core/Cbgen.h:32
Upp::sThreadRoutine (arg=0xb7fd81b0) at /home/h/upp-production/uppsrc/Core/Mt.cpp:75
start_thread () from /lib/libpthread.so.0
clone () from /lib/libc.so.6


I guess there is some concurrency issue... To reproduce, you can run
ab -n 1000 -c 20 http://127.0.0.1:8001/myapp
.

And BTW: there is a lot of DLOGs and DDUMPs scattered in the skylark code, so it is not directly compilable in release mode Wink

Best regards,
Honza
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36814 is a reply to message #36800] Sun, 08 July 2012 17:48 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
This is great Mirek!

U++ is now becoming more complete!

Is this already available in latest Nightly build for testing?

[Updated on: Sun, 08 July 2012 17:55]

Report message to a moderator

Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36816 is a reply to message #36813] Sun, 08 July 2012 20:59 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
dolik.rce wrote on Sun, 08 July 2012 09:50

Hi Mirek,

Great work, the tutorials almost made me want to write a web-app Smile

However, I found a little problem... Out of curiosity, I tried to run ab (Apache Benchmark) on Skylark based application, namely tutorial/Skylark04. It works great, but only sometimes. After a (variable) number of requests, the application fails with assert:



Should be fixed, together with three other bugs revealed by 'ab'....

Now tested with one million ab requests without failing.

Also, DLOGs removed, it should be now possible to compile release mode.

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36817 is a reply to message #36814] Sun, 08 July 2012 21:01 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
lectus wrote on Sun, 08 July 2012 11:48

This is great Mirek!

U++ is now becoming more complete!

Is this already available in latest Nightly build for testing?


Hopefully this or next night (just added Skylark to the list of uppsrc production packages).

BTW, there are two more chapters in tutorial.

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36822 is a reply to message #36800] Mon, 09 July 2012 16:03 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 607
Registered: December 2005
Location: Budapest, Hungary
Contributor
Thanks Mirek!
Very valuable work.

One note: isn't it a security hole to get session variables using Http::operator[]? I can imagine a situation where user posts something with the name of the session variable, modifying its value.
It can be harmful if the user changes e.g. his/her user id in a web based system this way.
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36824 is a reply to message #36822] Mon, 09 July 2012 19:28 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
zsolt wrote on Mon, 09 July 2012 10:03

Thanks Mirek!
Very valuable work.

One note: isn't it a security hole to get session variables using Http::operator[]? I can imagine a situation where user posts something with the name of the session variable, modifying its value.
It can be harmful if the user changes e.g. his/her user id in a web based system this way.


You have got me thinking, but fortunately this is not the case:

HTTP request values are put into shared variable space first, then the session is loaded, overwritting the same variables with session values.

Means: what is set by SessionSet cannot be changed by HTTP request.

OK, one possible issue: User could provide some value before is is created in session and it could have been mistakingly considered a session value...

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36825 is a reply to message #36824] Mon, 09 July 2012 19:43 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 607
Registered: December 2005
Location: Budapest, Hungary
Contributor
mirek wrote on Mon, 09 July 2012 19:28


OK, one possible issue: User could provide some value before is is created in session and it could have been mistakingly considered a session value...

Yes, this can be a real danger in a large project with a lot of programmers (many of them can be very sloppy).
Don't you think, it would be more safe to separate session and post variables at least based on some configuration option?
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36826 is a reply to message #36825] Mon, 09 July 2012 20:42 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
zsolt wrote on Mon, 09 July 2012 13:43

mirek wrote on Mon, 09 July 2012 19:28


OK, one possible issue: User could provide some value before is is created in session and it could have been mistakingly considered a session value...

Yes, this can be a real danger in a large project with a lot of programmers (many of them can be very sloppy).
Don't you think, it would be more safe to separate session and post variables at least based on some configuration option?


Actually, I was a little bit afraid when introducing this "shared variable space", but decided to give it a try... anyway, I guess php $_REQUEST discussion applies here too (yep, cookies go there as well Smile so we have to take some measures. Even back when introducing the operator[], the option was to differentiate by first character of id.

So http[":var"] would be session, http["@var"] cookie and http["var"] either GET or POST (I guess not need to split those, as handlers react only to GET or POST, never both). GET and POST values with ':' and '@' at the start would be explicitly disallowed (and ignored).

The reason why not simply go with some Http::GetSession is that this way, some common processing is possible (e.g. Http::Int(const char *id)).

Do you see some catch in this remake?

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36827 is a reply to message #36826] Mon, 09 July 2012 21:19 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 607
Registered: December 2005
Location: Budapest, Hungary
Contributor
It is not too beautyful, I think.

I did not learn the sources yet, but wouldn't be logical to put that operator[] and Int() functionalities into a separate class?
It could be the ancestor of Http class and the type of session and cookie members as well.
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36828 is a reply to message #36827] Mon, 09 July 2012 21:44 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
zsolt wrote on Mon, 09 July 2012 15:19

It is not too beautyful, I think.



But it is not extremely ugly as well...Smile At least you now have clear sign that you are dealing with session / cookie. And IMO still less verbose that to write http.Session("var").

Quote:


I did not learn the sources yet, but wouldn't be logical to put that operator[] and Int() functionalities into a separate class?
It could be the ancestor of Http class and the type of session and cookie members as well.


Maybe... but you also have to think about representation of these variables in witz templates. Sure, we can have "cookie("var")" and "session("var")" witz functions, but that further complicates the code and makes witz compiler optimizations a bit more difficult (not that there are many, but variable accesses are compiled to something like array index read).

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36829 is a reply to message #36828] Mon, 09 July 2012 22:42 Go to previous messageGo to next message
zsolt is currently offline  zsolt
Messages: 607
Registered: December 2005
Location: Budapest, Hungary
Contributor
OK, it seems to be reasonable to me. Prefixes should be OK.

BTW, I feel myself very inspired to rewrite our company homepage in C++ Smile
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36830 is a reply to message #36829] Mon, 09 July 2012 23:08 Go to previous messageGo to next message
forlano is currently offline  forlano
Messages: 1112
Registered: March 2006
Location: Italy
Senior Contributor
zsolt wrote on Mon, 09 July 2012 22:42

OK, it seems to be reasonable to me. Prefixes should be OK.

BTW, I feel myself very inspired to rewrite our company homepage in C++ Smile


And I too! I hope to see some CRUD facility.

Luigi
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36833 is a reply to message #36830] Tue, 10 July 2012 22:08 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
Session variables now start with '.', cookie variables with '@', Skylark07 is updated to reflect this...

Mirek
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #36949 is a reply to message #36800] Thu, 26 July 2012 22:38 Go to previous messageGo to next message
lectus is currently offline  lectus
Messages: 329
Registered: September 2006
Location: Brazil
Senior Member
Just updated my U++ and tested the AddressBookWeb example on Linux and it works really well!

Congratulations and thanks to the U++ team!

Now I'll start playing with this web framework.

Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #40247 is a reply to message #36800] Wed, 10 July 2013 16:12 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 203
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
What is skylark and what can you use it for?
Can't figure that one out Embarassed
Re: Skylark reaching "beta" status, first 6 chapters of tutorial available.. [message #40250 is a reply to message #40247] Thu, 11 July 2013 07:52 Go to previous message
mirek is currently offline  mirek
Messages: 13045
Registered: November 2005
Ultimate Member
Alboni wrote on Wed, 10 July 2013 10:12

What is skylark and what can you use it for?
Can't figure that one out Embarassed


It is web framework - something you use to create website servers.

"Normally" you use PHP, CGI, Ruby, Jango.. Skylark is C++/U++ "competition" to these.
Previous Topic: Is U++ compatible with VC++ Express 2012?
Next Topic: Another problem with MT (damn it... :()
Goto Forum:
  


Current Time: Fri Jan 22 04:19:18 CET 2021

Total time taken to generate the page: 0.01450 seconds