Model example for make_declarative_base() - flask-sqlalchemy

I've upgrade Flask-SQLalchemy from 2.1 and since 2.2 version this function requires a model parameter. Can somebody show an usage example for this?

Related

Choosing btw Scrapy V1.8 and V2.0

Hi I have wanted to learn Scrapy and use it to scrape dynamic data off of webpages, and use it in a website backend.
When I went to the official docs, I go to know that V.2.0 just came out.
Given that I'm new to scrappy, and plan to develop an autonomous hosted application, I was wondering whether I should choose v 1.8 over v 2.0 because bugs would've been worked out better and there'll be more tutorials etc. But on the other hand, I'll end up learning 2.0 anyway in the future, so maybe I should start with 2.0 itself.
So I have two questions:
Are there any major changes from v1.8 to v.2.0 (I am aware that there are release notes that accompany each version, but the only thing that I can really understand is that Python 2 support was removed; everything else uses terminology that I don't understand.)
I'd be grateful for your advice on which one I should opt for.
I have worked with Selenium & BeatifulSoup4 on 1 project before hand, which involved scraping stock price and relative strength index, and using that as a part of Flask backed web app.
Always use the latest Scrapy release for a new project, unless you cannot for some reason.
There are no major changes in how Scrapy works between 1.8 and 2.0; upgrading from 1.8 to 2.0 should be as easy as upgrading from 1.7 to 1.8.

how to convert yii 1 application to version 2

We have website which built in yii 1.1 version, now we would like to convert it to version 2. But we already have a lots of functionality and we do not have much time to do everything by scratch in yii 2. please do suggest.
I don't think there is a fast way of converting or migrating from Yii 1.1 to Yii2. They are similar in some ways but different enough.
I would recommend you first read most of The Definitive Guide to Yii 2.0, which includes Upgrading from Version 1.1.
In my opinion the best you can do is try to replicate the same modules and their functionality one at a time, trying to reuse as much code as you can from the 1.1 version. A few things that i think would be important are:
Create the new Yii2 models using Gii and adapt methods from your Yii 1.1 models. Edit and add validation rules as needed. There are many rules that might not have been available in Yii 1.1, however it can also be true the other way around.
Generate Yii2 modules with Gii. Just need these to create a better project structure. If you didn't use modules on Yii 1.1 i would recommend doing so for Yii2.
Generate Yii2 CRUDs with Gii inside the corresponding modules. This will help generate the controller, actions, views and search model needed for basic CRUD functionality. After that, you will need to edit the views and controller to fit your needs, which you can use your 1.1 code for reference.
Install needed extensions and widgets using composer. Many extensions from Yii 1.1 have updated versions for Yii2, but for those that do not you will have to find substitutes, which shouldn't be too difficult, although you will most likely have to read the documentation for both familiar and new extensions.
In the end you will need to spend time to have a Yii2 version of your website, there is no easy and fast way to jump
You don't need to convert your application completely you can use both at same time please have a look to
http://www.yiiframework.com/doc-2.0/guide-tutorial-yii-integration.html

upgrade from jackson(codehaus) 1.9 to jackson(fasterxml) 2.3

I have been facing a issue related to upgrading a opensource application from jackson 1.9 to jackson 2.3.
The problem is coming in the method objectmapper.readvalue.
The version i was using initially was objectmapper.readvalue(jsonnode,typereference) with a jsondeserializer registered along with simplemodule.
now this method is deprecated in jackson2.3 and for this i planned to use
objectmapper.readvalue(jsonparser,typereference) getting jsonparser through jsonnode.traverse().
But jsonparser passed through this way resulted in giving out a null objectmapper through jsonparser.getCodec(), which is a standard way of getting a result.
This code was totally working with jackson 1.9..
I am not very well versed with jackson and not been able to find ample document on net for migration to new jackson.
Looking forward for any pointer/help in this regard...
Thanks in advance

Is there a better implementation for SybaseDialect in Version 3.0 of NHibernate?

We have upgraded to NHibernate 3.0 with Fluent-NHibernate.
In version 2.1.2 we where able to use the SybaseDialect for ASE 12. In version 3.0 SybaseDialect for ASE 12 is not supported.
I reused the old Dialect from Nhib 2.1.2 and all is working.
What I wanted to ask since this one was removed as it was considered not a good implementation, is there a better one out there?
Since it's working I am not sure what improvements need be made but I thought I would ask.
This blog post has the scoop. Haven't tried upgrading so can't comment if the version 2.1.2 Sybase dialect with NHibernate 3.0 will perform any differently than using it with the NHibernate 2.1.2 version.
I took the Dialect class from NHibernate v2.1.2 and created a SybaseDialect.cs and then in the Config file I reference it, this seems to work fine.

LinFu version in NHibernate 2.1

I'm migrating the data layer of our application to NH version 2.1.0 (from 2.0.1) and noticed the use of LinFu. I discovered that framework and want to use it in other pieces of the application, especially I want to use the LinFu.Reflection.dll, which requires a reference to LinFu.DynamicProxy and here comes the trouble, the 1.0 final version of LinFu that I can find on google.code is not the same version used by NHibernate itself. Do I need to rebuild NHibernate.ByteCode.LinFu.dll changing the reference to the available version? If not, what else?
I have faced the same problem a few days ago. There's a tool named ILMERGE that merges .NET DLL-files, and that way you should be able to have several versions of the same DLL in your application.
Unfortunately I haven't tested the tool yet, I didn't get around to it, but I'll test in the next week.
But Rhino Mocks for example, has a binary with all dependencies included: http://ayende.com/projects/rhino-mocks/downloads.aspx, so it seems doable.