Oneplus One screen replacement tips


After disassembling and assembling my opo like 30 times, I feel competent to write this post.I bought the screen from AliExpress and chose DHL and it arrived in less than 1 week. There is also a small toolkit for screen replacement operation. I don’t like the idea of heating up the screen and separating it from the mid frame, I bought the screen with the middle frame. Slightly more expensive but definitely recommended. Plus be careful about the earpiece grill. Some of the screens on sale on aliexpress don’t have earpiece speaker grill.I’m not going to walk through how to disassemble opo because there are enough posts about it. My favorite one is iFixit’s teardownProblems with Cellular signalI first replaced everything, well I thought I replaced everything to the new body, my phone was working great, touch screen was working, my ghost swipes were gone; however, the cellular signal was so bad. It was coming and going. Especially inside the buildings it was totally lost. I opened the p...

Small Google App Engine gotchas


Working with GAE is sometimes tough in the beginning. GQL queries must not have “ in it. Instead ‘ single quotation must be used. GQL does not have LIKE You can not put the fields which are not indexed into the WHERE statement.Adding the field into index.yaml is not enough, you need to explicitly say it in the Model definition:class Event(ndb.Model):title = ndb.TextProperty()date = ndb.DateTimeProperty(auto_now_add=True)event_date = ndb.TextProperty(indexed=True) Plus it still may not work, the index needs to be built. In local just rewrite the data. Otherwise it’s not gonna work. While mapping the urls don’t put get parameters in the url structure. Only put the parameters by / - get params might be unlimited and their order can change. It’s fine to map them in variations. To save bandwidth use infinite expiration date for css by defining in app.yaml create an endpoint for pinging the app to prevent idle sleeps of machine in order to save up bandwidth. down notifier is good ...

Scraping web with python and selenium


A couple of weeks ago, I had a need to parse some parts of some web page. It was a page whose main content is loaded after finishing the GET request to the page. This means that python’s urllib, urllib2 and requests packages will fail to download the exact same source as your Chrome renders when you reach the site via browser (not programmatically). Because url libraries usually return the content after GET request finishes, they don’t wait until all of the ajax calls finish. This causes discrepancy between fetched code and rendered code. In my case, I needed the rendered code. After long investigation and asking out in StackOverflow (nobody replied and question is deleted), I ended up using Selenium to emulate normal browser behaviour. It was kinda hard for me because I need async flash content and firefox driver (default driver) of Selenium is not capable of rendering flash content. I switched to Chrome driver. This step just made things harder.Prereqs Install PhantomJS sudo eas...

Some handy Android code snippets


Email Validationpublic static boolean validateEmail(String email) { return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();}Share ButtonIntent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);sharingIntent.setType("text/plain");Resources res = activity.getResources();String shareSubject = res.getString(R.string.share_subject);String shareVia = res.getString(R.string.share_via);String shareBody = res.getString(R.string.share_body) + shareAdditional;sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, shareSubject);sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); activity.startActivity(Intent.createChooser(sharingIntent, shareVia));Show Simple Popup - AlertDialogprivate void showPopup() { AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create(); alertDialog.setTitle("Title"); alertDialog.setMessage("Message"); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { ...

How to update nodejs on Ubuntu (Debian)


Thanks StackOverflow!First method: Through NPM sudo npm cache clean -f sudo npm install -g n sudo n stable node -vSecond method: Through NVM curl https://raw.github.com/creationix/nvm/master/install.sh | sh source ~/.profile nvm install 0.10.26 nvm use v0.10.26 which node node -v install node globally (ie, into /usr/local)n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

Use Google App Engine Applications with Custom Domains for free


I like free. Looked for a good resource to achieve this. However, most of them are outdated and they say that to be able to use GAE apps with custom domain, you need a Google Apps account no you don’t. Plus, if you add your appid.appspot.com to your clouflare connected domain, app engine does not authorize the connection and redirects domain to google.com’s main page. It’s pretty weird but expected. In heroku, it’s really easy to allow custom domains and point them to your appid.herokuapp.com address from cloudflare by using its DNS flattening feature.Ok here are the steps to do that on app engine. Buy a domain, here is my fave Finish your app from Google App Engine Go to new Google Cloud Console, not old app engine console. Choose project and Compute -> App Engine -> Settings -> Custom domains (Yes it’s kinda secret). You will be able to see all of your domains you own from Google Webmaster Tools If your desired domain is already in Google Webmaster Tools, choose the...

Deploy web.py applications with pip requirements on Heroku


Running and deploying python apps on Heroku is pretty easy. I usually use web.py and Jinja2 templates for a typical web server. Install heroku toolbet Login to heroku heroku login Set the environment variablesheroku config:set PORT=8080 Heroku clone the app from created path.heroku git:clone -a myapp Create Procfile to tell heroku how to run the appgedit Procfile Put this into the Procfile: (Heroku assigns some random port every time it restarts the job so don’t hardcode the port here. It is highly like that heroku will fail to bind that port. Let it use its own port.)python main.py $PORTgedit requirements.txt Example content of requirements.txt (pip based installation will be done after pushing the code before deployment by heroku) web.py==0.37 Jinja2==2.6 Werkzeug==0.8.3 gunicorn==0.14.2 Deploy the app by using git: git add . git commit -m "Some commit" git push heroku master Visit yourapp.herokuapp.com To see the logs:heroku l...

How I store server logs in Google Spreadsheets


Disclaimer: I’m not an expert in this field. I just want to share my experiences with logs, you are welcome to give some feedback on my method.I like logs, I hate logs. I like analyzing them but I don’t like dealing with backups and everything.I have small sized projects like isimibul (job search engine for Turkey), Football Video Highlights. They have 3k-4k page views (API hits) per day. I would like to analyze some usage statistics like how many msecs it takes to handle a request or which job term is searched the most.At first I was using txt files to keep the logs. After some point it became real pain and I need some structured data. I started to log into sqlite in the server machine. However, that small sqlite file started to become something giant. As far as I observed (I might be wrong), dealing with big sqlite files increased the RAM usage of the server. So periodically I needed to back up and clean the logs (rm -rf is our friend). This system pushed me to find something more...

Got my new toy - OnePlus One


I finally got my OnePlus One after a long waiting for an invitation. I have been using it for 2 weeks.Pros Price price price. it’s a giant phablet. Gorgeous design. people are asking me all the time what phone this is. I started to like back cover. some people might not like it though. I don’t know, I fell on it from my bike and it survived with just some scratches in the back. Anyway, the back cover is replaceable, yet another +1. Camera is waaaay better than n5. It has slow mo and 4k UHD and DCI support. DCI is not supported by all 4k recorders. Cyanogenmod is awesomely awesome. They have great support. since this guy is their flagship, they are really solving problems with OTA updates. We have 2 year support from CM. Battery yes! finally. this is where I was bought in. my n5 was sufficient for everything but it’s battery was so unstable. I know it’s not gonna last long but it’s impossible to anticipate it. with opo you don’t have those things. I saw almost 5 hours screen ...

Ghost v0.5 update problem - No support for database client postgres


Error line from logs:ERROR: No support for database client postgresIf you are using postgres (usually for heroku users), just change your config.js file from:production: { url: 'http://hakanu.net', mail: {}, database: { client: 'postgres', toproduction: { url: 'http://hakanu.net', mail: {}, database: { client: 'pg',Redeploy your ghost.


subscribe via RSS