Discovered a g++ compiler bug that can be reproduced on (gcc 4.1.2 default instalation on RH5, and gcc 4.3.5).
Given the following code:
template
class Wrapper
{
public: Wrapper( Wrapped *c );
Wrapped *c;
};
class Stream
{
public:
Stream(const Wrapper &cucucucu) {}
Stream &operator << (const std::string &s)
{
std::cout << s << std::endl;
return *this;
}
};
int main()
{
unsigned char *buffer;
//A a(cccc);
Stream str( Wrapper (buffer));
std::string s(”aoeuao”);
str << s;
}
the compiler throws the following misterous error:
t.cpp: In function 'int main()':
t.cpp:35: error: no match for 'operator<<' in 'str << s'
Yes, indeed when I was first thinking about sthg. like that few years ago and mentioned to a friend, he told me I am mad. And this obsession now came back…
What does a C virtual machine need? It needs a C code translator, and a sandbox environment where to run the translated code securely.
And how can you have a secure (for the host) sandbox environment? There are two solutions:
* any ptrace based solution (like umview)
* or the mysterious system call prctl system call
And it seems that the “I want to do everything” company is already hungry to promote there “my browser is everywhere”, but having it running fast and reliable with all kind of foreign plugins.
I love this idea, and I wish java will die out one day. Sun’s days are over, oracle will kill it anyway
see also:
* http://lwn.net/Articles/332990/
* http://lwn.net/Articles/332974
* http://code.google.com/p/seccompsandbox/wiki/overview
* http://www.kernel.org/doc/man-pages/online/pages/man2/prctl.2.html
* http://www.stanford.edu/~talg/papers/traps/abstract.html
* http://code.google.com/p/chromium/wiki/LinuxSandboxing
* http://nativeclient.googlecode.com/svn/trunk/src/native_client/documentation/npapi.html
* http://en.wikipedia.org/wiki/AppArmor
* http://en.wikipedia.org/wiki/Security-Enhanced_Linux
As always… the devil is in the details….
Never pretended to be an expert of mysql, but going deeper into the mysql api… hm…. I have never seen sthg. as primitive as that. Not primitive as primitive as in “C”, but primitive as in written by primitive people. How the hell can you design an api for prepared statements, where these statements might return randomly 0 to 4294967295 bytes of data, but you will find out only at the end the real length of the data. So what strategy, what memory allocation policy would you use? You keep always hundreds of megabyte of data allocated, in order to be sure that your libmysqclient will not crash your application, as you were too selfish with memory allocation?
And … the big noise lib drizzle. The big thing for the cloud and for the web. And if you read the first lines of specs, you find out that they support almost everything, but nothing from myqsl protocol, including prepared statements. Including in the nothing…
I managed to write the correct .htaccess in order to allow git-http-backend without changing apache main config file. The git-http-backend contains description only of a scenario where you have to change the apache config file.
This was tested on hostmonster, but supposed to work on others like bluehost or dreamhost etc.
First you have to make sure that at least git version 1.6.6 is installed on your system. You may build it yourself. We assume that is installed to
$HOME/system/usr/
Now create a script git-http-backend.sh in the directory
$HOME/public_html/website.com/git/
with the following content:
#!/bin/sh
#first we export the GIT_PROJECT_ROOT
export GIT_PROJECT_ROOT=$HOME/gitprojects/
#and run your git-http-backend
$HOME/system/usr/libexec/git-core/git-http-backend
#uncomment the following line if you want to see environment variable values
#echo $REMOTE_USER $QUERY_STRING $REQUEST_METHOD $PATH_INFO >> $HOME/logs/log
the .htaccess file should contain:
Options +ExecCgi
AuthName "Private Git Access"
AuthType Basic
#you need to add users and passwords to the .htpasswd file
#you have to add the same user and password on the client machine under ~/.netrc
AuthUserFile <<YOUR HOME DIR>>/public_html/website.com/git/.htpasswd
Require valid-user
RewriteEngine on
RewriteBase /git
SetHandler cgi-script
RewriteRule ^([a-zA-Z0-9._]*\.git/(HEAD|info/refs|objects/(info/[^/]+|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))|git-(upload|receive)-pack))$ /git/git-http-backend.sh/$1
note that:
1. <<YOUR HOME DIRE>> needs to be replaced by your home directory (or other folder you have access…)
2. the $HOME/public_html/website/git is the physical address of the website, and $HOME/gitprojects is the directory where you host the projects
3. you will be able now to clone your projects under:
4. do not forget to add a file git-daemon-export-ok in the *.git directory you want to “export”
5. make sure that both on your local computer and on your shared host you have at least git 1.6.6 with curl and expat
git clone http://website.com/git/myproject.git
Update:
the solution is there (here : ) : http://www.mobiphil.com/2010/03/git-on-shared-hosting-with-git-http-backend
Unfortunatelly the descriptions found on http://progit.org/2010/03/04/smart-http.html and http://ftp.sunet.se/pub/Linux/kernel.org/software/scm/git/docs/git-http-backend.html DO NOT work on a shared hosting. The apache configuration directives mentioned can be used only inside the global http.conf, but not on per directory .httaccess, where shared hosting users might have access. I will try to hack around to find a solution with rewrite, etc. that could be configured through .htaccess.
I more than welcome the git smart http transport extension. I was deeply disappointed that my new shared hosting provider does not support webdav, so I could not pull my software there for sharing. An fcgi version of the cgi would me more than welcome, as I am sure that most people will use this on shared hosting, like me.
I replaced everywhere the type of sizes with long long. This allows now opening of files larger than 2GB. It is really fast to open even a 4 GB file. With some hacks I made it possible to jump instantly to the end of a 4GB file. I will probably not give up, and will do some optimizations. There are some challenges:
1. line breaks are counted to often. This is not always needed. However do not know how much it costs to go through the 4GB and count the breaks.
2. When moving backwards, it seems that the full buffer is parsed from begin to the current position. This could be done backwards.
Loading a 4 GB file with qemacs takes less than 1 second. However jumping to the end of the file takes 1 minute. I thought at the begging that there would be some lazy loading behind the scenes, but not. The data is in memory, however going through the buffer is very very slow. I made some local optimizations, but there would be much much to much work to make such operations faster than with vim.
Viq was intentended to be a project to add vim like interface to qemacs…
My obsession for speed will probably make me abandon my favorite tool vim. Instead I will go back to emacs. Hm.. I mean not really to emacs, but qemacs. I mean not really qemacs, but qvi. That is qemacs with vim like bindings. But qvi does not sound very friendly, so what about viq, spelled WIK, like wiki.
Here is my list of ideas that are related to Wt, maybe they would fit for Wt GSoC 2010.
1. as about qt-wt integration: Considering that even well tuned browsers like the webkit based ones on embedded devices, would make sense to create a rendering engine for wt, that interacts with the Qt Declarative UI (QML). Such a combination would result in a very fast client and very fast server for deploying services on embedded devices
2. Implement WSqlQuery/WSqlModel etc family, as QSqlQuery/QSqlQueryModel . The Wt::Dbo family is nice, but they do not provide at the moment the integration with views.
3. The already proposed idea about using Qt Designer to design Wt widgets, might be a wrong direction. In my opinion a better solution would be to create a Wt application that would allow the construction of “empty” widgets, through a web application. The advantage of this approach is that contrary to Wt Designer, the widgets would render on the final web application as they render in the Wt. The product of this designer wt application would be a html template. Any .ui interface etc. would mean unnecessary overhead in the development cycle etc. etc.