Categories
Mastering Development

Loop Through API with Django

I am trying to loop through this data via Django. The data was able to show using in my Django Template. By then, I can view details as per the Date. data.json {“data”:[{“1/22/20”:{“confirmed”:555,”deaths”:17,”recovered”:28}},{“1/23/20”:{“confirmed”:654,”deaths”:18,”recovered”:30}},{“1/24/20”:{“confirmed”:941,”deaths”:26,”recovered”:36}},{“1/25/20”:{“confirmed”:1434,”deaths”:42,”recovered”:39}},{“1/26/20”:{“confirmed”:2118,”deaths”:56,”recovered”:52}},{“1/27/20”:{“confirmed”:2927,”deaths”:82,”recovered”:61}},{“1/28/20”:{“confirmed”:5578,”deaths”:131,”recovered”:107}},{“1/29/20”:{“confirmed”:6166,”deaths”:133,”recovered”:126}},{“1/30/20”:{“confirmed”:8234,”deaths”:171,”recovered”:143}},{“1/31/20”:{“confirmed”:9927,”deaths”:213,”recovered”:222}},{“2/1/20”:{“confirmed”:12038,”deaths”:259,”recovered”:284}},{“2/2/20”:{“confirmed”:16787,”deaths”:362,”recovered”:472}},{“2/3/20”:{“confirmed”:19881,”deaths”:426,”recovered”:623}},{“2/4/20”:{“confirmed”:23892,”deaths”:492,”recovered”:852}},{“2/5/20”:{“confirmed”:27635,”deaths”:564,”recovered”:1124}},{“2/6/20”:{“confirmed”:30794,”deaths”:634,”recovered”:1487}},{“2/7/20”:{“confirmed”:34391,”deaths”:719,”recovered”:2011}},{“2/8/20”:{“confirmed”:37120,”deaths”:806,”recovered”:2616}},{“2/9/20”:{“confirmed”:40150,”deaths”:906,”recovered”:3244}},{“2/10/20”:{“confirmed”:42762,”deaths”:1013,”recovered”:3946}},{“2/11/20”:{“confirmed”:44802,”deaths”:1113,”recovered”:4683}},{“2/12/20”:{“confirmed”:45221,”deaths”:1118,”recovered”:5150}},{“2/13/20”:{“confirmed”:60368,”deaths”:1371,”recovered”:6295}},{“2/14/20”:{“confirmed”:66885,”deaths”:1523,”recovered”:8058}},{“2/15/20”:{“confirmed”:69030,”deaths”:1666,”recovered”:9395}},{“2/16/20”:{“confirmed”:71224,”deaths”:1770,”recovered”:10865}},{“2/17/20”:{“confirmed”:73258,”deaths”:1868,”recovered”:12583}},{“2/18/20”:{“confirmed”:75136,”deaths”:2007,”recovered”:14352}},{“2/19/20”:{“confirmed”:75639,”deaths”:2122,”recovered”:16121}},{“2/20/20”:{“confirmed”:76197,”deaths”:2247,”recovered”:18177}},{“2/21/20”:{“confirmed”:76819,”deaths”:2251,”recovered”:18890}},{“2/22/20”:{“confirmed”:78572,”deaths”:2458,”recovered”:22886}},{“2/23/20”:{“confirmed”:78958,”deaths”:2469,”recovered”:23394}},{“2/24/20”:{“confirmed”:79561,”deaths”:2629,”recovered”:25227}},{“2/25/20”:{“confirmed”:80406,”deaths”:2708,”recovered”:27905}},{“2/26/20”:{“confirmed”:81388,”deaths”:2770,”recovered”:30384}},{“2/27/20”:{“confirmed”:82746,”deaths”:2814,”recovered”:33277}},{“2/28/20”:{“confirmed”:84112,”deaths”:2872,”recovered”:36711}},{“2/29/20”:{“confirmed”:86011,”deaths”:2941,”recovered”:39782}},{“3/1/20”:{“confirmed”:88369,”deaths”:2996,”recovered”:42716}},{“3/2/20”:{“confirmed”:90306,”deaths”:3085,”recovered”:45602}},{“3/3/20”:{“confirmed”:92840,”deaths”:3160,”recovered”:48228}},{“3/4/20”:{“confirmed”:95120,”deaths”:3254,”recovered”:51170}},{“3/5/20”:{“confirmed”:97886,”deaths”:3348,”recovered”:53796}},{“3/6/20”:{“confirmed”:101801,”deaths”:3460,”recovered”:55865}},{“3/7/20”:{“confirmed”:105847,”deaths”:3558,”recovered”:58358}},{“3/8/20”:{“confirmed”:109821,”deaths”:3802,”recovered”:60694}},{“3/9/20”:{“confirmed”:113590,”deaths”:3988,”recovered”:62494}},{“3/10/20”:{“confirmed”:118620,”deaths”:4262,”recovered”:64404}},{“3/11/20”:{“confirmed”:125875,”deaths”:4615,”recovered”:67003}},{“3/12/20”:{“confirmed”:128352,”deaths”:4720,”recovered”:68324}},{“3/13/20”:{“confirmed”:145205,”deaths”:5404,”recovered”:70251}},{“3/14/20”:{“confirmed”:156101,”deaths”:5819,”recovered”:72624}},{“3/15/20”:{“confirmed”:167454,”deaths”:6440,”recovered”:76034}},{“3/16/20”:{“confirmed”:181574,”deaths”:7126,”recovered”:78088}},{“3/17/20”:{“confirmed”:197102,”deaths”:7905,”recovered”:80840}},{“3/18/20”:{“confirmed”:214821,”deaths”:8733,”recovered”:83312}},{“3/19/20”:{“confirmed”:242500,”deaths”:9867,”recovered”:84975}},{“3/20/20”:{“confirmed”:272035,”deaths”:11299,”recovered”:87420}},{“3/21/20”:{“confirmed”:304396,”deaths”:12973,”recovered”:91692}},{“3/22/20”:{“confirmed”:336953,”deaths”:14651,”recovered”:97899}},{“3/23/20”:{“confirmed”:378235,”deaths”:16505,”recovered”:98351}},{“3/24/20”:{“confirmed”:418045,”deaths”:18625,”recovered”:108000}},{“3/25/20”:{“confirmed”:467653,”deaths”:21181,”recovered”:113787}},{“3/26/20”:{“confirmed”:529591,”deaths”:23970,”recovered”:122150}},{“3/27/20”:{“confirmed”:593291,”deaths”:27198,”recovered”:130915}},{“3/28/20”:{“confirmed”:660706,”deaths”:30652,”recovered”:139415}},{“3/29/20”:{“confirmed”:720117,”deaths”:33925,”recovered”:149082}},{“3/30/20”:{“confirmed”:782365,”deaths”:37582,”recovered”:164566}}],”dt”:”2020-03-30 22:58:55″,”ts”:1585609135.0}

Categories
Mastering Development

React: How to use getDerivedStateFromProps() to set component state. It interferes with controlled component that uses the same state variable

I have a component that receives a variable as a prop. The getDerivedStateFromProps() is typical, meaning that when nextProps.someProp doesn’t equal prevState.someStateVar, that prop is assigned to state variable. I also have a Controlled element – an HTML text Input element which is associated with the same state variable. The problem is, when I change […]

Categories
Mastering Development

How to change group widget content background color in Qt Style CSS

I’m trying to change skin of a program that supports Qt Style CSS, but I don’t have access to the source code. I need to change the background color of the groups inside a QWidget, I tried with: QWidget { background-color: #4d4d4d; } But it changes the color of the whole window, but I can […]

Categories
Mastering Development

css bootstrap make all cols in row same height [duplicate]

I have two boxes next to each other, Box1 (left) has a little text and Box2 (right) has alot of text: How can I make Box 1 extend to be the same height as Box 2 by padding more white space onto box 1? I’m trying to make it so both boxes are the same […]

Categories
Mastering Development

read depth buffer of framebuffer object

I am trying to copy the depth buffer of a fbo to a vector. I initially started with using renderbuffers and glReadPixels but this resulted in a vector full of zeros despite glGetErrors() not highlighting any issues. I then switched to textures and drew these to the screen. The colour texture shows evidence of depth […]

Categories
Mastering Development

How to set a shortcut key for choosing current word in IDEA2019?

Generally, ‘Command + w’ is the shortcut for ‘choosing current word’ in JetBrains IDEA. But in latest IDEA Community version, ‘Command + w’ is uesd for ‘closing current tab/window’. How to set a shortcut key for choosing current word in IDEA2019? I know I can do it in the Keymap setting, but I can’t find […]

Categories
Mastering Development

how to apply in python mobile averaging considering periodic boundary conditions in data

I would like to perform mobile averaging considering periodic boundary conditions. I try to make myself clear. I have this data: Date,Q 1989-01-01 00:00,0 1989-01-02 00:00,1 1989-01-03 00:00,4 1989-01-04 00:00,6 1989-01-05 00:00,8 1989-01-06 00:00,10 1989-01-07 00:00,11 I would like to compute the mobile averaging considering 3 data: the next and the previous. In particular, I […]

Categories
Mastering Development

kendodropdownlist filter json response that has field

I am doing the below currently; all my JSON entries have styleName, however some have the field txt, I want to display only the styleName data that has the txt field in my dropdown list. var dataSourceJSON = new kendo.data.DataSource({ transport: { read: { url: dataURL, dataType: “json”, type: ‘GET’ } }});dataSourceJSON.read(); $(“#dropdown”).kendoDropDownList({ dataSource : […]

Categories
Mastering Development

Compiler cannot infer type from wrapped generic IEnumerable

I am trying to write a generic extension method for a dictionary of type Dictionary<TKey, IEnumerable<TValue>> that should return the instance of the IEnumerable<TValue> for a given key and if there is no entry yet for that key create a new instance of IEnumerable<TValue> and add it for that key. public static TEnumerable GetAndEnsureEnumerableForKey<TKey, TValue, […]

Categories
Mastering Development

Nativescript Angular TabStrip Visibility set to collapse still take up space

I have a navigation tab written as below. I wish to hide the tabStrip and setting the visibility to collapse did the job. However the hidden tabStrip still taken up white space in the area. Any ideas how i can get rid of the white space completely? <Tabs selectedIndex=”0″ tabsPosition=”top” > <TabStrip [visibility]=”hideTab() ? ‘visible’ […]