what mongomapper version for sinatra 1.2.6 - mongodb

I use sinatra 1.2.6 and mango_mapper version 0.9.2 but project is slow for render page.How I config mongomapper and sinatra

I'm not sure what you mean by configuring Mongomapper and Sinatra. I use this in my configure block:
MongoMapper.database = ENV['MONGOLAB_DATABASE']
MongoMapper.connection = Mongo::Connection.new(ENV['MONGOLAB_URL'], 27107)
MongoMapper.database.authenticate(ENV['MONGOLAB_USER'], ENV['MONGOLAB_PASS'])
But then this is not just for Sinatra and is pretty much required everywhere. Performance is also ok here. You could check out the rstatus project on Github which uses now Rails but used to be Sinatra. So compare your code with theirs.

Related

Working configuration for Seaside Rest with current Pharo Build (5.0

I am desperately trying to install Seaside Rest in Pharo 5. Is it recommended, or should I go back to Pharo 4?
What I have done so far:
There is a Configuration called SeasideRest -> does not work / no ServerAdaptor
I have also tried (with a clean image)
ConfigurationOfSeaside3 project stableVersion load: 'REST'
ConfigurationOfSeaside project stableVersion loaddoes not load the REST part.
Any ideas?
Regards
Max
The ConfigurationOfSeasideRest is only for Seaside 3.0.x.
Since Seaside 3.1, the REST group is included in the main configuration ConfigurationOfSeaside3.
Since this should work fine in Pharo 5, I suspect that you are hitting a Metacello issue. The recommended way to load any configuration with Metacello is with the new API:
Metacello new
configuration:'Seaside3';
repository: 'http://www.smalltalkhub.com/mc/Seaside/MetacelloConfigurations/main';
version: #stable;
load: #('REST')

setting up ZEND framework for php informix

Our organization builds web applications using PHP/Informix.
Currently we do not have any frameworks and use our own libraries and modules.
Now we set up a new apache web server so that we could install and configure a framework where all brand new web applications can be developed.
I was thinking of setting up the Zend Framework.(Will it go with informix backend?). I have googled and looked around for information , but I thought would get some expert opinions from the experts here.
I need some advice as how to go about from scratch the correct way.
Installing,configuring,setting up a version control and writing a script to test all basic MVC features.
Any suggestions and references would be helpful.
If you are using Informix Dynamic Server as your backend, then yes you can use Zend Framework's native database classes and adapter for communicating with your Informix server.
Your requirements will be that PHP must be compiled with PDO support (enabled by default since PHP 5.1). You then need to download, compile, and install the PDO_IBM Pecl package.
In order to successfully build the PDO_IBM extension, you must have the DB2 client (9.1+) installed on your system already. When you compile the extension module, you must tell it the path to where those files are installed.
More information on PDO_IBM, and Zend_Db_Adapter talks a little bit about the available adapters (including PDO_IBM).
There is also a Pecl package PDO_INFORMIX for talking to Informix servers, but Zend_Db does not support this package. You will only be able to use Zend_Db_Adapter with PDO_IBM to communicate with IDS servers.
Hope that helps.

How to see requests in Sinatra?

I used to be able see http requests made for sinatra in the window I started my sinantra application from.
I think that after sinatra upgrade I cannot see them any more and I don't know how to make it so. I don't need to log them into a file.
set :logging, true didn't help
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
rack (1.4.0)
rack-protection (1.2.0)
sinatra (1.3.2)
sinatra-advanced-routes (0.5.1)
sinatra-reloader (0.5.0)
sinatra-sugar (0.5.1)
This is a bug introduced in Sinatra 1.3.2. The commit that introduced it was intented to fix another bug where the logging was being done twice in certain circumstances, but obviously isn't quite right.
This request logging is done by using the Rack::CommonLogger middleware component, which is now only added in certain cases. The fix/workaround is to simply add it yourself. Add
use Rack::CommonLogger
to the top of your application file (after requiring Sinatra). Note that you might end up with the original problem of seeing requests logged twice in some situations (e.g. if your deployment setup is different from your development setup).

Heroku is not pre-compiling my assets to prepare my app for asset pipeline

I'm having a bit of trouble getting my asset pipeline setup working with Heroku/Cedar using Rails 3.1.1
I've pushed my application and it launches successfully but there was no message that said "Preparing asset pipeline" and no static assets are being served up. No JS, CSS, or images are able to be found as there is no slug compilation time or runtime asset compilation being done.
Any help would be greatly appreciated.
They describe what should happen during deployment at this link which I'll summarize below:
With a Rails 3.1 application on Heroku Cedar when you git push heroku your assets will all be pre-compiled as part of the deploy process by using the rake task bundle exec rake assets:precompile.
Ok so the solution was this:
I'm using mongoid which has you remove the 'rails/all' line as part of the configuration. As a result sprockets was not being loaded.
What you need to do with rails 3.1+ is also add require "sprockets/railtie" in application.rb so that sprockets are enabled. Boom, works.
This info can be found on the mongoid website here. This is useful to know for anyone who may not be loading the full 'rails/all' in application.rb, sprockets is obviously required for the asset pipeline to work.
Have you seen this article on Rails 3.1 asset pipeline on Heroku - http://devcenter.heroku.com/articles/rails31_heroku_cedar. I reviewed it yesterday and picked up a good few hints from it and I've been running Rails 3.1 sites on Heroku for quite a while now.
Was this a new Rails 3.1 site or a site upgraded to Rails 3.1, things to check would be that the asset pipeline is enabled for production - by default Rails 3.1 uses
config.assets.enabled = false
in application.rb. Are you using app/assets for your assets and not public/

How to deploy a Zend Framework app on Heroku?

Basically for a Facebook tab I have a PHP app and want Heroku to use the 'public' folder as the web server's root folder instead of pointing to the very root of the app. Any help would be awesome as it seems Heroku doesn't have a ton of documentation around it's config options. Thank you.
I hosted my php codeigniter project on heroku lastmonth, so unless there is a server side configuration needed for your project. You should be able to host your zend project by pushing it as git repository to heroku. Just follow these tutorials.
http://www.youtube.com/watch?v=L2YlEIMrGxA
https://devcenter.heroku.com/articles/facebook
Not sure of that but Heroku's website says "Agile deployment for Ruby, Node.js, Clojure, Java, Python, and Scala.". But since there's no mention of PHP I think you can't deploy your Zend app on Heroku.
EDIT : my assertion was false, see comments
Thats not entirely correct (or no longer correct) - if you put a repository with an index.php in the root up it seems to recognise that as a php app.
The answer is not yet at least. They only offer the Facebook app hosting. I have gone with PHPFog for quick PHP hosting now.
EDIT: PHPFog is no more, now they have AppFog.