500 Error on bluemix with simple-html-dom - db2

I'm hoping someone can help me here. I'm using simple html dom to get some data from a website and everything works fine on my local PC, but i get the 500 internal server error in the console when I uploaded to the ibm bluemix. I have tried tried to add the solution here
Simple html dom file_get_html not working - is there any workaround?
It doesn't work...like I said it works fine on my localhost. With same database connection and everything

getting what you described in your comment,
$publications = [];
is not the right sintax for empty/reset a PHP array and this is the reason for having error 500.
The right PHP way to do it is
$publications = array();
You can use also
$publications = null;
but you then have to check if null when using it again or
unset($publications);
like you have already done, but keep in mind that it destroys the var so you have to initialize it again later.

Related

Storage link not loading image sails and get 404 error

I've an app made with Sails.js and tested, and worked fine before, but now if someone load a new image, the app throw an 404 with that file. The olders one are working very well in this point, but the new ones are having this problem.
Im using with this server I'm using Ubuntu, front end angular.

How can I use postgraphQL in conjunction with ReactQL

I'd like to use the postgraphQL library to auto-generate my graphql schema from a postgres database. I've used this in express apps previously, but I'm trying to make it work with the ReactQL starter kit.
In an express app server file, I've imported postgraphql and then used something like:
app.use(postgraphql(endpoint, schema, {options}));
Seems like the syntax is probably similar with the Koa server in ReactQL, but I'm not quite sure where to put it.
Update: I got it working by adding the code above into the /kit/entry/server.js file in ReactQL. Maybe someone can point out whether or not that's a good practice if it's supposed to occur somewhere else, like in app.js.
Update 2: While the above seems to work (I can hit graphiql and see my schema), I'm getting this message in the terminal:
Error: Can't set headers after they are sent.
and this in the browser console:
PostGraphQL: Listening for server sent events
PostGraphQL: Failed to connect to server

PouchDB Extension not showing second database

I’ve only just started using PouchDB (with Ionic), so I’m still working on wrapping my head around everything and getting it all set up (all my experience is in MySQL).
I have a simple Ionic app working with PouchDB and some basic CRUD abilities, now I’m trying to visualise what I’m doing using the PouchDB Extension for Chrome. So far so good, I click a “+” button to add an item to a list and the new database shows up under “Databases” in the PouchDB Extension.
Now I’m doing the exact same thing for a second database, and it’ll put my newly created items in a separate list, all seems to be good, I can edit and delete these items as well, just like in the first database. But this second database won’t show up in the PouchDB Extension and for the life of me I can’t figure out why, I’m doing exactly the same as with the first database.
This is part of my code for the first database:
function initDB() {
_db = new PouchDB('threads');
};
function addThread(thread) {
return $q.when(_db.post(thread));
};
And then this is what I'm doing for the second one:
function initDB() {
_db = new PouchDB('categories');
};
function addCategory(category) {
return $q.when(_db.post(category));
};
Btw: This is the tutorial I've followed to get the PouchDB part of my Ionic app working. (Basically just followed part of it twice to get the second database working)
Edit: So I just found the "application" tab in Chrome's developer tools (again, I come from MySQL databases, never worked with local storage before). I can view the Web SQL databases there and both my databases do show up there, but still only the first one is shown in the PouchDB extension :(
Edit 2: Alright this is turning into a whole different problem. I was aware that the PouchDB extension doesn't support the websql adapter, I thought PouchDB defaulted to IndexedDB but apparently idb isn't available in my Chrome installation? If I do the following to explicitly say I want to use the IndexedDB adapter:
_db = new PouchDB('threads', {adapter: 'idb'});
I get the following error: Error: Invalid Adapter: idb
If open the page in either Firefox or Chrome Canary I get no errors at all, and after adding the PouchDB inspector to Canary everything works as I want it to. I did update Chrome to the latest version (Version 53.0.2785.101 (64-bit)).
Any ideas as to why my regular Chrome installation doesn't support IndexedDB? (it should right, or am I going nuts? (I feel like I am))
Edit 3: Ok even though I feel like I'm talking to myself I'll continue posting my findings. Since the problems seemed to lie with my Google Chrome installation I reinstalled it, problem solved. If someone has some idea of what went wrong I'm all ears, until then I'm finally continuing on my project haha..
I ran into same issues, chrome extention doesnt support websql, only index db.
https://github.com/angular-pouchdb/angular-pouchdb/issues/63
you can try this to get the DB sizing etc.
db.info().then(function (resp) {
//resp will contain disk_size
})

How to test an error page with Error 500 using Zend Framework

I am working on a project where client requires me to beautifully display error 500 with stacktrace etc.
So, I checked the Error Controller and made a nice fancy error page in corresponding views/script
The problem is, how do I test it?
Whilst working on the project, I cleared error on every page and there is no way I could generate it again. Also, I am using doctrine and I remember "echo-ing" the entitymanager array but, I cannot trace the location.
How would I custom generate error 500, "keeping it real"?
PS: I tried htaccess thing and trust me, it throws apache error and not zend 500.
It was pretty silly but, finally found it.
All I needed was to mis-spell a dql tablename on any page where I use querybuilder.

symfony/zend integration - blank screen

I need to use ZendAMF on a symfony project and I'm currently working on integrating the two.
I have a frontend app with two modules, one of which is 'gateway' - the AMF gateway. In my frontend app config, I have the following in the configure function:
// load symfony autoloading first
parent::initialize();
// Integrate Zend Framework
require_once('[MY PATH TO ZEND]\Loader.php');
spl_autoload_register(array('Zend_Loader', 'autoload'));
The executeIndex function my the gateway actions.class.php looks like this
// No Layout
$this->setLayout(false);
// Set MIME Type
$this->getResponse()->setContentType('application/x-amf; charset='.sfConfig::get('sf_charset'));
// Disable cause this is a non-html page
sfConfig::set('sf_web_debug', false);
// Create AMF Server
$server = new Zend_Amf_Server();
$server->setClass('MYCLASS');
echo $server->handle();
return sfView::NONE;
Now when I try to visit the url for the gateway module, or even the other module which was working perfectly fine until this attempt, I only see a blank screen, with not even the symfony dev bar loaded. Oddly enough, my symfony logs are not being updated as well, which suggests that Synfony is not even being 'reached'.
So presumably the error has something to do with Zend, but I have no idea how to figure out what the error could be. One thing I do know for sure is that this is not a file path error, because if I change the path in the following line (a part of frontendConfiguration as shown above), I get a Zend_Amf_Server not found error. So the path must be correct. Also if I comment out this very same line, the second module resumes to normality, and my gateway broadcasts a blank x-amf stream.
spl_autoload_register(array('Zend_Loader', 'autoload'));
Does anyone have any tips on how I could attach this problem?
Thanks
P.S. I'm currently running an older version of Zend, which is why I am using Zend_Loader instead of Zend_autoLoader (I think). But I've tried switching to the new lib, but the error still remains. So it's not a version problem as well.
got it...
I was not using
set_include_path()
while loading Zend. It's still odd that it would give such a cryptic error, but this was the missing piece indeed.