Showing posts with label Google App engine. Show all posts
Showing posts with label Google App engine. Show all posts

Sunday, January 24, 2016

Moved to Parse

Yesterday i mostly read few things. Also downloaded and installed the Mac updates. Was tired in the evening so slept early.
Yesterday while reading through Google app engine docs i came across this service called firebase. Its a service built in keeping in mind making it suitable for mobile backend. Looked promising to me and thought of using it rather than going to google app engine. On app engine i will have to write all the code both Android and python app engine app. Will also have to check all the caching and other optimizations. I already wrote earlier that i am no expert in either python or app engine so it will mean i will have to learn much.
While browsing through firebase docs and pricing model i remembered i tried using parse.com before i moved the PHP api to my VPS from appfog. I found it difficult at that time because i was not that fluent in java then. I am more familiar in it now so i compared the pricing model of parse, firebase and google app engine. I found using parse will be much economical and easier to me than using other two.
I am planning to serve images too along with text in my app and parse give more space and bandwidth in free tier than other two and also they have well cooked SDK that will fasten up my development speed. I will also won't have to write the cloud code on my own.
I had already imported the data when i earlier tried parse to i only had to write the android code using parse SDK today. I managed to write it very quickly and found a bug in the parse SDK. I found two workarounds and now my api is up and running on parse.
Will write a post about the bug and how i managed to workaround.
I must confess if i had little patience then when i tried parse earlier i won't have wasted so much time in writing app engine code and all. But then parse SDK has bug that made it impossible for me to make it work with my little knowledge.
Also, parse is not zippy as my app engine code is. But its workable and my development time is significantly reduced by using it.
Now i am reading parse docs so i won't get caught up this time in the bugs and other possible problems.
Later.

Thursday, January 21, 2016

Lazy day

Today was cold and lazy day.
I wanted to just lay down and not do anything, but you know.. 😔.
So i managed to import the api data to app engine datastore by pulling and parsing JSON from my current api. Actually i have imported 1 table and 1 more yet to be imported but that is not important. Even if i don't import it, it won't effect a thing but i will try to do that just for the sake of learning.
I tested the new api with my app and its working flawlessly.
I imported the data in local datastore, but the script will import it well in production server when i upload the project to app engine. Tomorrow i will be making a new app engine project and upload the api files to test it again.
I also learnt how to use memcache on app engine. Although it was just few line of code but it makes a huge difference in performance and server costs. What you do here is that you check if the data you looking for is saved in the memcache or not. If its there you serve it right away from memcache. If not you pull it from the datastore and save a copy in  memcache and also serve a copy to user. When next time that data is needed you pull it from the memcache and serve it without doing the roundtrip to the datastore. Memcache, as the name suggest is space in system memory(RAM) that is very fast compared to the disk or datastore so performance improvement is very good. And also app engine gives you restricted queries to datastore in free plan so you save that too by using memcache. If you Move to paid plan you will save cost by using memcache effectively.
I think i need to again read the app engine docs. I read it long back and now i have to look up every time i plan to do anything. This looking into is taking too much time and slowing me down considerably. 
Parsing JSON with python was new experience to me. I used simplejson to parse it. That doesn't mean i have learnt it. I found a sample code and adapted it to work by trial and error but afterward when i looked into the code it looked just like java code i wrote in my android app to parse the same JSON. Just a little syntax difference. Will read little more about simplejson. It will come very handy in long run.
As i have never learnt python in the way i should have, i feel little under confident writing the code but as i write it more i find it far more easier to write and way cleaner than either PHP or java. And writing app engine apps using webapp2 is a bliss compared to writing a vanilla PHP code.
In other news ,for some strange reason i am finding that my system is not loading few websites. It just keep on loading and doesn't show anything. If i try same pages from my phone using the same WiFi connection it loads in a jiffy. Don't know what's the problem. Will try to fix it. May be the problem is in the DNS. If it is then its a quick fix. If not then its going to be headache for me. Just chimed in that the problem may be in the host file i edited recently. Will look into it tomorrow.
What more..
Yes I updated more softwares.
Enough typing on phone on this cold and lazy day.
See ya..

Tuesday, January 19, 2016

App engine java python and more..

As i wrote in last post i am planning to use google app engine to host json api for my android apps so today time went into it.
I was using PHP to generate JSON from MySQL database. PHP makes it a breeze to generate JSON. Only few line of code and you are all set. App engine also support PHP but SQL is paid so i am not using it. Not because of the cost but if it can be done with app engine datastore using python or java then why not do it.
I am not fluent in either python or java but have workable knowledge and also know how to find the answers if stuck.
Today i managed to figure how to generate JSON from datastore using  python. Done it with help of django simplejson module.
Reading through the app engine docs i also found it interesting to build a backend using java. Android studio makes it real easy to go through the process but my internet speed killed all the fun. I could have built the whole api with java today but my system spent hours downloading the app engine java SDK and i think that too isn't perfectly working. I tested 2 modules one cloud endpoint and other java servlet. Endpoint one was not running perfectly. The time it took to download java SDK i managed to generate json using python.
Also my Mac(actually hackintosh) was refusing to load the page using "localhost:8080", which is default, as address. So i edited the host file and still nothing worked. When i changed the default port from 8080 to 8888 it started working.
Also genymotion refused to take "10.0.2.2:8888" as address to local api. I had to turn on the android emulator to get it working.
I hope tomorrow i will complete the api and also build the basic app to work with that api. Later i will polish the app.

Saturday, June 28, 2014

Location on App Engine SDK in Mac OSX

I use PyCharm to develop Google app engine python application. I updated it to newer version recently. After the update it started showing me this:
"error: please specify a valid app engine SDK folder"
This PyCharm error came up whenever tried to launch the application.
I tried finding the location of Google app engine SDK and it took me some time to figure it out. If you are also looking for fixing the same, here is where you should point PyCharm to:

/usr/local/google_appengine 
that's a symlink that links to the Google App engine SDK.
Hope this help.

PS: If you are find its broken after updating app engine app to newer version open the app as it requires setting it up again after updating.