Latest Posts

HTTP requests and JSON parsing in Python

import requests url = ‘http://maps.googleapis.com/maps/api/directions/json’ params = dict( origin=’Chicago,IL’, destination=’Los+Angeles,CA’, waypoints=’Joplin,MO|Oklahoma+City,OK’, sensor=’false’ ) resp = requests.get(url=url, params=params) data = resp.json() References https://stackoverflow.com/questions/6386308/http-requests-and-json-parsing-in-python

Continue reading »

Type Hinting in Python

fig: matplotlib.figure.Figure=plt.figure() ax: matplotlib.axes.Axes=fig.add_subplot(111) or fig, ax=plt.subplots() assert isinstance(fig,matplotlib.figure.Figure) assert isinstance(ax,matplotlib.axes.Axes) References https://www.jetbrains.com/help/pycharm/type-hinting-in-product.html

Continue reading »

Sort Java Strings in a Collection using Collator

Collections.sort(parentList, new Comparator<ListParentAdapter.Parent>() { @Override public int compare(ListParentAdapter.Parent o1, ListParentAdapter.Parent o2) { //return o1.getName().compareToIgnoreCase(o2.getName()); Locale locale=new Locale(“fa”,”IR”); Collator collator= Collator.getInstance(locale); return collator.compare(o1.getName(),o2.getName()); } }); References […]

Continue reading »
1 3 4 5 6 7 75