Unity Quest 2 checklist

The URP (Universal Render Pipeline) is still a work in progress as of writing this page. Unless you need high control on render pipeline RIGHT NOW, just stick to the 3D project template. 1. Asset Store -> “Oculus Integration” Download and install this package. This package is what “Google VR SDK for Unity” used to […]

Blender Tips and Key-Bindings

Since I came to Blender from Unity, up axis is Z in Blender, not Y. Tip: Keep Backface Culling option selected (you will see it in Viewport Shading). This will avoid problems of flipped normals. This is also a nice optimization feature. Note that this will affect objects that have no thickness. Like a plane. […]

New Node – Typescript project checklist

Assuming Node, npm, nvm are all installed and updated. 1) npm init -y : Create the package.json file. 2) npm install typescript –save-dev : Install the typescript compiler 3) npx tsc –init: create tsconfig.json file Now we want to automate our *.ts transpilation into javascript. 4) npm install ts-node –save-dev : In package.json, under scripts: […]

Responsive Images in a nutshell

General Page load speed is an important metric for SEO. Targeting images for the appropriate browsers goes a great deal in achieving this, particularly on mobile devices. We shall discuss the srcset attribute on the img tag to help us achieve this. This attribute is available on newer browsers. Before we start, we need to […]

Flexbox in a nutshell

General Info Flexbox is aimed at a container based layout where we are primarily focused on arranging container items in a single dimension with some abilities of aligning along the cross-axis as well. Because of this, flexbox is often the preferred tool for laying out items along a single dimension. This is different from CSS-Grid […]

Getting SQL query string from Django orm query

I often want to see the actual SQL generated by the orm query. This is important especially if you are running some DML queries like update, select etc and want to ensure that generated sql is exactly what you had in mind. If the query results in a queryset, its really straight forward. goto ./ […]

Temporary Files in Python

Let me start with an actual use case scenario. As a backend developer, I need to process the user uploaded file data all the time. Here temporary files shine. The best part about these is that they make cleanup easier. If you make a real file, you need to use some OS level utility to […]

Removing non-ascii characters from text in Python

I was handling some text scraped using Scrapy and the text had non-ascii unicode charcters like \u003e. If I did this, it didn’t work: html_text = response.text.encode(‘ascii’, errors=’ignore’).decode() Here response.text is the string that contains unicode text (scrapy returns strings encoded in unicode). The html_text still had non ascii unicode characters like \u003e This worked: […]

ES6 Javascript quick recap cookbook

// crreate a whole random number between [0,20) function wholeRandomNumber(){ return Math.floor(Math.random() * 20) } console.log(wholeRandomNumber()) // random numbers within a range [min, max] function randomRange(min, max){ return Math.floor(Math.random()*(max-min + 1)) + min } console.log(randomRange(1,2)) // parseInt // return integer from a string. It will returrn NaN if string cannot be converted to a number […]

Working with Python lxml parser for creating XML elements

lxml parser can be a bit confusing because of the sheer range of options it offers. Here are a few cookbook style examples. XML Generation Target code: <root_element xmlns=”” some_more_params=”12345-678-ABC” yet_more_params=”POKEMON-SUCKS”> <element> <element_data1 type=”sometype”><![CDATA[SomeVal123]]></element_data1> <element_data2>12345</element_data2> <element_data3 some_attr=”some_attr”>More random data</element_data3> </element> <another_element> <element_data1 type=”sometype”><![CDATA[SomeVal1234]]></element_data1> <element_data2>12345</element_data2> <element_data3 some_attr=”some_attr”>More random data</element_data3> </another_element> </root_element> Ok, Here is the code […]