<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Raj</title>
    <description>The latest articles on DEV Community by Raj (@krisrajzlive).</description>
    <link>https://dev.to/krisrajzlive</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F463874%2F77912402-afc6-40a6-b1c1-c23365fcd454.jpeg</url>
      <title>DEV Community: Raj</title>
      <link>https://dev.to/krisrajzlive</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/krisrajzlive"/>
    <language>en</language>
    <item>
      <title>python tenacity with static methods</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Mon, 22 Nov 2021 13:54:14 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/python-tenacity-with-static-methods-f6</link>
      <guid>https://dev.to/krisrajzlive/python-tenacity-with-static-methods-f6</guid>
      <description>&lt;p&gt;Can I use tenacity with static methods? How do I decorate __retry_attempt() method??&lt;/p&gt;

</description>
    </item>
    <item>
      <title>react wait until state change</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Mon, 05 Jul 2021 14:53:08 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/react-wait-until-state-change-4hck</link>
      <guid>https://dev.to/krisrajzlive/react-wait-until-state-change-4hck</guid>
      <description>&lt;p&gt;as state changes are happening asynchronously, how can I wait until state change is complete and call a function? Note: I am using functional component.&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>help</category>
    </item>
    <item>
      <title>python group multiple</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sun, 04 Jul 2021 03:16:37 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/python-group-multiple-4cki</link>
      <guid>https://dev.to/krisrajzlive/python-group-multiple-4cki</guid>
      <description>&lt;p&gt;I have the dataset (attached image) contains device and sensor data with a timestamp. I want to generate aggregates for every minute, device and sensor. I tried this expression but it does not help. As there are two devices and three sensors, I should get only 6 records per minute but the expression below returns more than that. Can anyone help fix my code please?&lt;/p&gt;

&lt;p&gt;deviceid (S):timestamp (S):datatype (S):value (N)&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-12.788845:Temperature:101.4&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-13.333129:SPO2:90&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-13.925137:HeartRate:106&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-14.187335:HeartRate:74&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-14.796972:HeartRate:90&lt;br&gt;
BSM_DEV01:2021-06-27T23-13-15.794070:HeartRate:96&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-47.802607:HeartRate:78&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-48.800688:HeartRate:91&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-49.802867:HeartRate:68&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-50.789980:HeartRate:77&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-51.799726:HeartRate:95&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-52.801113:SPO2:89&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-53.112701:HeartRate:95&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-53.790853:HeartRate:84&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-54.794649:HeartRate:84&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-55.794330:HeartRate:107&lt;br&gt;
BSM_DEV02:2021-06-27T23-13-56.792531:HeartRate:106&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-00.790879:HeartRate:89&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-01.789911:HeartRate:102&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-02.789042:SPO2:89&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-03.083248:HeartRate:99&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-03.795986:HeartRate:104&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-04.800193:HeartRate:85&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-05.799052:HeartRate:80&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-06.800894:HeartRate:83&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-07.803821:HeartRate:94&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-08.804032:HeartRate:75&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-09.794357:HeartRate:75&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-10.799049:HeartRate:85&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-11.796780:HeartRate:88&lt;br&gt;
BSM_DEV01:2021-06-27T23-14-12.796486:Temperature:98&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-13.104431:SPO2:91&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-13.392373:HeartRate:81&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-13.792080:HeartRate:98&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-14.791361:HeartRate:78&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-15.801512:HeartRate:77&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-16.802908:HeartRate:80&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-17.802081:HeartRate:92&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-18.801312:HeartRate:88&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-19.803425:HeartRate:115&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-20.797984:HeartRate:64&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-21.792599:HeartRate:85&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-22.794500:SPO2:87&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-23.093992:HeartRate:84&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-23.793901:HeartRate:54&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-24.802120:HeartRate:80&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-25.790220:HeartRate:69&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-26.795034:HeartRate:108&lt;br&gt;
BSM_DEV02:2021-06-27T23-14-27.791092:Temperature:99.1&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;items_by_minute = itertools.groupby(
            items, 
            key=lambda x: (x["timestamp"][:16], x['deviceid'], x['datatype'])
        )

        # Calculate the statistics for each minute
        for minute, items in items_by_minute:
            values_per_minute = [item["value"] for item in items]

            avg = statistics.mean(values_per_minute)
            min_value = min(values_per_minute)
            max_value = max(values_per_minute)

            print(f"Minute: {minute} / Average {avg} | Min {min_value} / Max {max_value}")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>python</category>
      <category>help</category>
    </item>
    <item>
      <title>dealing with async method calls</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Thu, 22 Apr 2021 14:08:04 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/dealing-with-async-method-calls-22oa</link>
      <guid>https://dev.to/krisrajzlive/dealing-with-async-method-calls-22oa</guid>
      <description>&lt;p&gt;newNote is optional and if available should be pushed to notes colleciton via reducer using addProjectNotes function hook. The createProject methods seems called before the addProjectNotes completes execution and Notes collection is always blank. How can I call createProject only after addProjectNotes is fully executed?&lt;/p&gt;

&lt;p&gt;'''&lt;br&gt;
if (projectData.newNote) {&lt;br&gt;
            addProjectNotes(addNote(projectData.newNote))&lt;br&gt;
        }&lt;br&gt;
        createProject(projectData, setIsSubmitting, submittedCallback);&lt;br&gt;
'''&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>help</category>
    </item>
    <item>
      <title>mention component </title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Mon, 05 Apr 2021 15:04:32 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/mention-component-34k5</link>
      <guid>https://dev.to/krisrajzlive/mention-component-34k5</guid>
      <description>&lt;p&gt;Looking out for a component that supports mentioning users with draftjs component.&lt;br&gt;
Is this &lt;a href="https://www.draft-js-plugins.com/plugin/mention"&gt;https://www.draft-js-plugins.com/plugin/mention&lt;/a&gt; the only available?!&lt;/p&gt;

</description>
      <category>help</category>
      <category>reactnative</category>
    </item>
    <item>
      <title>react state lost</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Mon, 05 Apr 2021 14:56:48 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/help-needed-react-state-lost-2750</link>
      <guid>https://dev.to/krisrajzlive/help-needed-react-state-lost-2750</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Here's the state data structure:
projectData:
{
        projectCode: '',
        projectName: '',
        projectDescription: '',
        clientCode: '',
        clientName: '',
        officeCode: '',
        office: '',
        industryTypeName: '',
        statusName: '',
        statusCode: '',
        projectResources: []
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here's the reducer, when this gets executed all the state data is lost except projectResources&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;case "SET_PROJECTROLE":
            {
                const newResources = [...state.projectData.projectResources];
                newResources[action.payload.Index].ProjectRole = action.payload.ProjectRole;
                return {
                    ...state,
                    projectData:
                    {
                        ...state.projecData,
                        projectResources: [...newResources]
                    }
                };
            }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>reactnative</category>
      <category>draftjs</category>
      <category>help</category>
    </item>
    <item>
      <title>state hook not a function</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Tue, 22 Dec 2020 07:37:50 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/state-hook-not-a-function-32on</link>
      <guid>https://dev.to/krisrajzlive/state-hook-not-a-function-32on</guid>
      <description>&lt;p&gt;I got stuck on using state hook and keep getting state hook is not a function. Tried restoring all packages and used different syntax not sure what I am missing here. Getting error message setExactPage is not a function. Any help would be appreciated.&lt;/p&gt;

&lt;p&gt;const [currentPage, setPrevPage, setNextNext, setExactPage] = useState(0);&lt;br&gt;
const handleFirstProposalPage = () =&amp;gt; { setExactPage(1) };&lt;/p&gt;

&lt;p&gt;First Page: {currentPage}&lt;br&gt;
  First Page  &lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>Getting started with reducer...</title>
      <dc:creator>Raj</dc:creator>
      <pubDate>Sat, 05 Sep 2020 06:53:01 +0000</pubDate>
      <link>https://dev.to/krisrajzlive/getting-started-with-reducer-5f2g</link>
      <guid>https://dev.to/krisrajzlive/getting-started-with-reducer-5f2g</guid>
      <description>&lt;p&gt;Has anyone worked on react with reducers? I am having issue with state management and would appreciate any help.&lt;/p&gt;

</description>
      <category>reactnative</category>
    </item>
  </channel>
</rss>
