1
0
mirror of https://github.com/djohnlewis/stackdump synced 2024-12-04 15:07:36 +00:00
stackdump/questions (1).json
2021-06-10 09:46:47 +01:00

1 line
491 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{"items":[{"tags":["sql","google-bigquery"],"owner":{"reputation":1,"user_id":15480821,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GhaQIWPcBlhCShm2ZSOy8UJWCIU6YeDr2mzDUq0=k-s128","display_name":"Joe Griffin","link":"https://stackoverflow.com/users/15480821/joe-griffin"},"is_answered":false,"view_count":1,"answer_count":0,"score":0,"last_activity_date":1623259457,"creation_date":1623259457,"question_id":67908983,"share_link":"https://stackoverflow.com/q/67908983","body_markdown":"The query I&#39;m using does the job that I need it to do. Basically I need to take the maximum &#39;Fee&#39; from each day in the past 7 days, then average those together to get a 7 day average for each ID. \r\n\r\nThe data in &#39;table_one&#39; has over 2 billion rows, however it contains data from the whole of 2021 whereas I only need data for the most recent week, which is why i&#39;ve used the &#39;_PARTITIONTIME&#39; line, however there are likely still millions of records after filtering. I have a feeling the issue could be due to the two &#39;rank () over&#39; lines. When I look in the &#39;Execution Details&#39; in BQ, the wait times are the longest but the compute times are also considerably long.\r\n\r\n```with raw_data as (\r\nselect TimeStamp\r\n, EXTRACT(DAYOFWEEK FROM TimeStamp) as day_of_week\r\n, RestaurantId\r\n, Fee\r\n, MinAmount\r\n, Zone\r\nfrom table_one to,\r\nunnest(calculatedfees) as fees,\r\nunnest(Bands) as bands\r\nwhere\r\ntimestamp between timestamp(date_sub(date_trunc(current_date, week(monday)), interval 1 week)) and timestamp(date_trunc(current_date, week(monday)))\r\nand _PARTITIONTIME &gt;= timestamp(current_date()-8)\r\nand Fee &lt; 500),\r\n\r\nranked_data as (\r\nselect *\r\n, rank() over(partition by RestaurantId, Zone, day_of_week order by TimeStamp desc) as restaurant_zone_timestamp_rank -- identify last update for restaurant / zone pair\r\n, rank() over(partition by RestaurantId, Zone, TimeStamp, day_of_week order by MinAmount desc) as restaurant_zone_timestamp_minamount_rank -- identify highest &quot;MinAmount&quot; band\r\nfrom raw_data),\r\n\r\ndaily_week_fee as (\r\nselect RestaurantId\r\n, day_of_week\r\n, max(Fee) as max_delivery_fee\r\nfrom ranked_data\r\nwhere restaurant_zone_timestamp_rank = 1\r\nand restaurant_zone_timestamp_minamount_rank = 1\r\ngroup by 1,2),\r\n\r\navg_max_fee as (\r\nselect \r\nRestaurantID\r\n, avg(max_delivery_fee) as weekly_avg_fee\r\nfrom daily_week_fee\r\ngroup by 1)\r\n\r\nSELECT restaurant.restaurant_id_local\r\n, restaurant.restaurant_name\r\n, amf.weekly_avg_fee/100 as avg_df\r\nFROM restaurants r\r\nLEFT JOIN avg_max_fee amf\r\nON CAST(r.restaurant_id AS STRING) = amf.RestaurantId\r\nWHERE company.brand_key = &quot;Country&quot;\r\n\r\n```","link":"https://stackoverflow.com/questions/67908983/my-query-is-taking-a-very-long-time-any-suggestions-on-how-i-can-optimise-it","title":"My query is taking a very long time, any suggestions on how I can optimise it?","body":"<p>The query I'm using does the job that I need it to do. Basically I need to take the maximum 'Fee' from each day in the past 7 days, then average those together to get a 7 day average for each ID.</p>\n<p>The data in 'table_one' has over 2 billion rows, however it contains data from the whole of 2021 whereas I only need data for the most recent week, which is why i've used the '_PARTITIONTIME' line, however there are likely still millions of records after filtering. I have a feeling the issue could be due to the two 'rank () over' lines. When I look in the 'Execution Details' in BQ, the wait times are the longest but the compute times are also considerably long.</p>\n<pre><code>select TimeStamp\n, EXTRACT(DAYOFWEEK FROM TimeStamp) as day_of_week\n, RestaurantId\n, Fee\n, MinAmount\n, Zone\nfrom table_one to,\nunnest(calculatedfees) as fees,\nunnest(Bands) as bands\nwhere\ntimestamp between timestamp(date_sub(date_trunc(current_date, week(monday)), interval 1 week)) and timestamp(date_trunc(current_date, week(monday)))\nand _PARTITIONTIME &gt;= timestamp(current_date()-8)\nand Fee &lt; 500),\n\nranked_data as (\nselect *\n, rank() over(partition by RestaurantId, Zone, day_of_week order by TimeStamp desc) as restaurant_zone_timestamp_rank -- identify last update for restaurant / zone pair\n, rank() over(partition by RestaurantId, Zone, TimeStamp, day_of_week order by MinAmount desc) as restaurant_zone_timestamp_minamount_rank -- identify highest &quot;MinAmount&quot; band\nfrom raw_data),\n\ndaily_week_fee as (\nselect RestaurantId\n, day_of_week\n, max(Fee) as max_delivery_fee\nfrom ranked_data\nwhere restaurant_zone_timestamp_rank = 1\nand restaurant_zone_timestamp_minamount_rank = 1\ngroup by 1,2),\n\navg_max_fee as (\nselect \nRestaurantID\n, avg(max_delivery_fee) as weekly_avg_fee\nfrom daily_week_fee\ngroup by 1)\n\nSELECT restaurant.restaurant_id_local\n, restaurant.restaurant_name\n, amf.weekly_avg_fee/100 as avg_df\nFROM restaurants r\nLEFT JOIN avg_max_fee amf\nON CAST(r.restaurant_id AS STRING) = amf.RestaurantId\nWHERE company.brand_key = &quot;Country&quot;\n\n</code></pre>\n"},{"tags":["reactjs","search","filter","null"],"owner":{"reputation":51,"user_id":13978077,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgyemKG89F21vxDsa8pYqEhOkJoZDtyN_r1AUZn9w=k-s128","display_name":"Chaz Cathcart","link":"https://stackoverflow.com/users/13978077/chaz-cathcart"},"is_answered":false,"view_count":1,"answer_count":0,"score":0,"last_activity_date":1623259454,"creation_date":1623259454,"question_id":67908982,"share_link":"https://stackoverflow.com/q/67908982","body_markdown":"I made a simple search function for filtering through a datatable filled with JSON objects from an API.\r\n\r\nIt works for most tables in my application but will crash it if any of the objects in the table have a null value.\r\n\r\nmy search function looks like this:\r\n\r\n\r\n const search = (rows) =&gt; {\r\n const columns = rows[0] &amp;&amp; Object.keys(rows[0]);\r\n\r\n return rows.filter((row) =&gt;\r\n columns.some(\r\n (column) =&gt;\r\n row[column]\r\n .toString()\r\n .toLowerCase()\r\n .indexOf(q.toString().toLowerCase()) &gt; -1\r\n )\r\n );\r\n };\r\n\r\nI just want to replace any null values in the objects with an empty string.\r\n\r\nCan anyone help me with this in a simple way?","link":"https://stackoverflow.com/questions/67908982/search-filter-a-table-in-react-replace-null-values-with-an-empty-string","title":"Search/Filter a table in React: Replace null values with an empty string","body":"<p>I made a simple search function for filtering through a datatable filled with JSON objects from an API.</p>\n<p>It works for most tables in my application but will crash it if any of the objects in the table have a null value.</p>\n<p>my search function looks like this:</p>\n<p>const search = (rows) =&gt; {\nconst columns = rows[0] &amp;&amp; Object.keys(rows[0]);</p>\n<pre><code>return rows.filter((row) =&gt;\n columns.some(\n (column) =&gt;\n row[column]\n .toString()\n .toLowerCase()\n .indexOf(q.toString().toLowerCase()) &gt; -1\n )\n);\n</code></pre>\n<p>};</p>\n<p>I just want to replace any null values in the objects with an empty string.</p>\n<p>Can anyone help me with this in a simple way?</p>\n"},{"tags":["spring-boot","jpa"],"answers":[{"owner":{"reputation":43,"user_id":11388786,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f42c9fb8ccbd1251fd02c56b39919d94?s=128&d=identicon&r=PG&f=1","display_name":"boomeran","link":"https://stackoverflow.com/users/11388786/boomeran"},"is_accepted":false,"score":0,"last_activity_date":1623259451,"creation_date":1623259451,"answer_id":67908981,"question_id":67901818,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":43,"user_id":11388786,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/f42c9fb8ccbd1251fd02c56b39919d94?s=128&d=identicon&r=PG&f=1","display_name":"boomeran","link":"https://stackoverflow.com/users/11388786/boomeran"},"is_answered":false,"view_count":14,"answer_count":1,"score":0,"last_activity_date":1623259451,"creation_date":1623232648,"question_id":67901818,"share_link":"https://stackoverflow.com/q/67901818","body_markdown":"I am trying to extract data from multiple databases in different servers. This has been successful after configuring different Data sources as shown in my code however i cannot see to configure 2 different Data sources on the same connection.\r\n\r\nI have tried to create 2 beans within the config file but i would still need to set the Data source.\r\n\r\n```java\r\n@Configuration\r\n@EnableJpaRepositories(basePackages = {&quot;balances.Repository.World&quot;},\r\n entityManagerFactoryRef = &quot;ASourceEntityManager&quot;,transactionManagerRef = &quot;ASourceTransactionManager&quot;)\r\n@EnableTransactionManagement\r\npublic class World{\r\n @Autowired\r\n private Environment env;\r\n\r\n @Bean\r\n public LocalContainerEntityManagerFactoryBean ASourceEntityManager() {\r\n\r\n LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();\r\n em.setDataSource(ASourceDatasource());\r\n em.setPackagesToScan(new String(&quot;balances.Repository.World&quot;));\r\n em.setPersistenceUnitName(&quot;ASourceEntityManager&quot;);\r\n HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();\r\n em.setJpaVendorAdapter(vendorAdapter);\r\n HashMap&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();\r\n properties.put(&quot;hibernate.dialect&quot;,env.getProperty(&quot;app.datasource.ASource.hibernate.dialect&quot;));\r\n properties.put(&quot;hibernate.show-sql&quot;,env.getProperty(&quot;app.datasource.ASource.show-sql&quot;));\r\n em.setJpaPropertyMap(properties);\r\n return em;\r\n\r\n }\r\n \r\n @Bean\r\n @ConfigurationProperties(prefix = &quot;app.datasource.ASource&quot;)\r\n public DataSource ASourceDatasource() {\r\n\r\n DriverManagerDataSource dataSource = new DriverManagerDataSource();\r\n \r\n dataSource.setDriverClassName(env.getProperty(&quot;app.datasource.ASource.driverClassName&quot;));\r\n dataSource.setUrl(env.getProperty(&quot;app.datasource.ASource.url&quot;));\r\n dataSource.setUsername(env.getProperty(&quot;app.datasource.ASource.username&quot;));\r\n dataSource.setPassword(env.getProperty(&quot;app.datasource.ASource.password&quot;));\r\n\r\n return dataSource;\r\n }\r\n\r\n @ConfigurationProperties(prefix = &quot;app.datasource.ASourceB&quot;)\r\n public DataSource ASourceDatasource() {\r\n\r\n DriverManagerDataSource dataSource = new DriverManagerDataSource();\r\n dataSource.setDriverClassName(env.getProperty(&quot;app.datasource.ASourceB.driverClassName&quot;));\r\n dataSource.setUrl(env.getProperty(&quot;app.datasource.ASourceB.url&quot;));\r\n dataSource.setUsername(env.getProperty(&quot;app.datasource.ASourceB.username&quot;));\r\n dataSource.setPassword(env.getProperty(&quot;app.datasource.ASourceB.password&quot;));\r\n\r\n return dataSource;\r\n }\r\n\r\n\r\n @Bean\r\n public PlatformTransactionManager ASourceTransactionManager() {\r\n\r\n JpaTransactionManager transactionManager\r\n = new JpaTransactionManager();\r\n transactionManager.setEntityManagerFactory(\r\n ASourceEntityManager().getObject());\r\n return transactionManager;\r\n }\r\n\r\n\r\n```","link":"https://stackoverflow.com/questions/67901818/how-can-i-connect-to-2-different-schemas-on-one-datasource-in-springboot","title":"How can i connect to 2 different Schemas on one datasource in springboot","body":"<p>I am trying to extract data from multiple databases in different servers. This has been successful after configuring different Data sources as shown in my code however i cannot see to configure 2 different Data sources on the same connection.</p>\n<p>I have tried to create 2 beans within the config file but i would still need to set the Data source.</p>\n<pre class=\"lang-java prettyprint-override\"><code>@Configuration\n@EnableJpaRepositories(basePackages = {&quot;balances.Repository.World&quot;},\n entityManagerFactoryRef = &quot;ASourceEntityManager&quot;,transactionManagerRef = &quot;ASourceTransactionManager&quot;)\n@EnableTransactionManagement\npublic class World{\n @Autowired\n private Environment env;\n\n @Bean\n public LocalContainerEntityManagerFactoryBean ASourceEntityManager() {\n\n LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();\n em.setDataSource(ASourceDatasource());\n em.setPackagesToScan(new String(&quot;balances.Repository.World&quot;));\n em.setPersistenceUnitName(&quot;ASourceEntityManager&quot;);\n HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();\n em.setJpaVendorAdapter(vendorAdapter);\n HashMap&lt;String, Object&gt; properties = new HashMap&lt;String, Object&gt;();\n properties.put(&quot;hibernate.dialect&quot;,env.getProperty(&quot;app.datasource.ASource.hibernate.dialect&quot;));\n properties.put(&quot;hibernate.show-sql&quot;,env.getProperty(&quot;app.datasource.ASource.show-sql&quot;));\n em.setJpaPropertyMap(properties);\n return em;\n\n }\n \n @Bean\n @ConfigurationProperties(prefix = &quot;app.datasource.ASource&quot;)\n public DataSource ASourceDatasource() {\n\n DriverManagerDataSource dataSource = new DriverManagerDataSource();\n \n dataSource.setDriverClassName(env.getProperty(&quot;app.datasource.ASource.driverClassName&quot;));\n dataSource.setUrl(env.getProperty(&quot;app.datasource.ASource.url&quot;));\n dataSource.setUsername(env.getProperty(&quot;app.datasource.ASource.username&quot;));\n dataSource.setPassword(env.getProperty(&quot;app.datasource.ASource.password&quot;));\n\n return dataSource;\n }\n\n @ConfigurationProperties(prefix = &quot;app.datasource.ASourceB&quot;)\n public DataSource ASourceDatasource() {\n\n DriverManagerDataSource dataSource = new DriverManagerDataSource();\n dataSource.setDriverClassName(env.getProperty(&quot;app.datasource.ASourceB.driverClassName&quot;));\n dataSource.setUrl(env.getProperty(&quot;app.datasource.ASourceB.url&quot;));\n dataSource.setUsername(env.getProperty(&quot;app.datasource.ASourceB.username&quot;));\n dataSource.setPassword(env.getProperty(&quot;app.datasource.ASourceB.password&quot;));\n\n return dataSource;\n }\n\n\n @Bean\n public PlatformTransactionManager ASourceTransactionManager() {\n\n JpaTransactionManager transactionManager\n = new JpaTransactionManager();\n transactionManager.setEntityManagerFactory(\n ASourceEntityManager().getObject());\n return transactionManager;\n }\n\n\n</code></pre>\n"},{"tags":["ms-word","pandoc","bibtex"],"owner":{"reputation":2958,"user_id":5596534,"user_type":"registered","accept_rate":92,"profile_image":"https://i.stack.imgur.com/mUhM3.jpg?s=128&g=1","display_name":"boshek","link":"https://stackoverflow.com/users/5596534/boshek"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259448,"creation_date":1623259448,"question_id":67908980,"share_link":"https://stackoverflow.com/q/67908980","body_markdown":"I am having to work with word users who don&#39;t use bibtex. However I am trying to create a workflow where those users simply input [@citation] directly in the word doc. Then I use `pandoc` to convert that word doc back to markdown so I can more readily use bibtex. So here is what is in the word doc (`foo.docx`):\r\n\r\n```\r\nSentence with a citation [@foo]\r\n```\r\nThen I run this pandoc code:\r\n\r\n```\r\npandoc -s foo.docx -t markdown -o foo.md\r\n```\r\n\r\nThen resulting markdown is:\r\n\r\n```\r\nSentence with a citation \\[\\@foo\\]\r\n```\r\n\r\nBecause of these escaped characters, I can&#39;t actually generate the citations. Happy to entertain other ideas to make this work but merging markdown and office users seems to be always a bit friction-y. The ultimately question is how to maintain citation from word to markdown?","link":"https://stackoverflow.com/questions/67908980/dont-escape-bibtex-citation-in-pandoc-conversion","title":"Don&#39;t escape bibtex citation in pandoc conversion","body":"<p>I am having to work with word users who don't use bibtex. However I am trying to create a workflow where those users simply input [@citation] directly in the word doc. Then I use <code>pandoc</code> to convert that word doc back to markdown so I can more readily use bibtex. So here is what is in the word doc (<code>foo.docx</code>):</p>\n<pre><code>Sentence with a citation [@foo]\n</code></pre>\n<p>Then I run this pandoc code:</p>\n<pre><code>pandoc -s foo.docx -t markdown -o foo.md\n</code></pre>\n<p>Then resulting markdown is:</p>\n<pre><code>Sentence with a citation \\[\\@foo\\]\n</code></pre>\n<p>Because of these escaped characters, I can't actually generate the citations. Happy to entertain other ideas to make this work but merging markdown and office users seems to be always a bit friction-y. The ultimately question is how to maintain citation from word to markdown?</p>\n"},{"tags":["excel","google-sheets"],"answers":[{"owner":{"reputation":693,"user_id":15384825,"user_type":"registered","profile_image":"https://i.stack.imgur.com/m7FLv.gif?s=128&g=1","display_name":"Irvin Jay G.","link":"https://stackoverflow.com/users/15384825/irvin-jay-g"},"is_accepted":false,"score":0,"last_activity_date":1623259446,"creation_date":1623259446,"answer_id":67908979,"question_id":67905144,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":269,"user_id":5893819,"user_type":"registered","accept_rate":73,"profile_image":"https://www.gravatar.com/avatar/ca7fe4d986d66c41e00e194510efd2e6?s=128&d=identicon&r=PG&f=1","display_name":"greeny","link":"https://stackoverflow.com/users/5893819/greeny"},"is_answered":false,"view_count":24,"answer_count":1,"score":0,"last_activity_date":1623259446,"creation_date":1623245380,"question_id":67905144,"share_link":"https://stackoverflow.com/q/67905144","body_markdown":"I have a dataset of jobs for a gardening company.\r\n``` \r\nstatus # ID Date Name Frequency\r\n☐ 4 340 09/06/20 Jack Once Off\r\n☐ 1 543 22/05/20 Sarah Weekly\r\n☐ 3 121 01/05/20 Emily Fortnightly\r\n☐ 3 577 11/06/20 Peter Once Off\r\n```\r\n\r\nWhen a booking is complete I want to check the box in the first column which will then create a new row with the following conditions\r\n \r\n- row is created only for jobs that are &quot;weekly&quot; or &quot;fortnighly&quot;. Once off jobs wont create a row when the box is checked\r\n- The date in the new row is a week or a fortnight in the future of the original row depending on its frequency value\r\n- The job # goes up by one from the original row #\r\n- The ID, name and frequency rows remain the same\r\n\r\nFor example if I ticked the checkbox for the 3rd row it would create a new row like this:\r\n\r\n``` \r\n☐ 4 121 15/05/20 Emily Fortnightly\r\n```\r\n\r\nIs this possible? Thanks!\r\n","link":"https://stackoverflow.com/questions/67905144/automatically-create-new-row-when-checkbox-is-ticked-in-google-sheets","title":"Automatically create new row when checkbox is ticked in Google Sheets","body":"<p>I have a dataset of jobs for a gardening company.</p>\n<pre><code>status # ID Date Name Frequency\n☐ 4 340 09/06/20 Jack Once Off\n☐ 1 543 22/05/20 Sarah Weekly\n☐ 3 121 01/05/20 Emily Fortnightly\n☐ 3 577 11/06/20 Peter Once Off\n</code></pre>\n<p>When a booking is complete I want to check the box in the first column which will then create a new row with the following conditions</p>\n<ul>\n<li>row is created only for jobs that are &quot;weekly&quot; or &quot;fortnighly&quot;. Once off jobs wont create a row when the box is checked</li>\n<li>The date in the new row is a week or a fortnight in the future of the original row depending on its frequency value</li>\n<li>The job # goes up by one from the original row #</li>\n<li>The ID, name and frequency rows remain the same</li>\n</ul>\n<p>For example if I ticked the checkbox for the 3rd row it would create a new row like this:</p>\n<pre><code>☐ 4 121 15/05/20 Emily Fortnightly\n</code></pre>\n<p>Is this possible? Thanks!</p>\n"},{"tags":["java","minecraft"],"owner":{"reputation":1,"user_id":16178381,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgkZAspUgcO3K9D6l9wxZzmp6iczMgNjd9KVvAUQw=k-s128","display_name":"Fabooxdedo","link":"https://stackoverflow.com/users/16178381/fabooxdedo"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259437,"creation_date":1623259437,"question_id":67908978,"share_link":"https://stackoverflow.com/q/67908978","body_markdown":"&gt;09.06 17:14:21 [Server] INFO Exception in thread &quot;main&quot; java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0\r\n\r\nAlguien sabe como solucionar este problema? Someone knows how to fix this problem?","link":"https://stackoverflow.com/questions/67908978/java-lang-unsupportedclassversionerror-minecraft-java-server","title":"java.lang.UnsupportedClassVersionError minecraft JAVA server","body":"<blockquote>\n<p>09.06 17:14:21 [Server] INFO Exception in thread &quot;main&quot; java.lang.UnsupportedClassVersionError: net/minecraft/server/Main has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0</p>\n</blockquote>\n<p>Alguien sabe como solucionar este problema? Someone knows how to fix this problem?</p>\n"},{"tags":["c#","winforms","events"],"comments":[{"owner":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"edited":false,"score":1,"creation_date":1623256975,"post_id":67908181,"comment_id":120029754,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"edited":false,"score":0,"creation_date":1623257153,"post_id":67908181,"comment_id":120029830,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":15648890,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1532f40a96faa3e8dbbde6e586db72e0?s=128&d=identicon&r=PG&f=1","display_name":"Blueonics","link":"https://stackoverflow.com/users/15648890/blueonics"},"reply_to_user":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"edited":false,"score":0,"creation_date":1623258245,"post_id":67908181,"comment_id":120030271,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"is_accepted":false,"score":0,"last_activity_date":1623259437,"creation_date":1623259437,"answer_id":67908977,"question_id":67908181,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":15648890,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1532f40a96faa3e8dbbde6e586db72e0?s=128&d=identicon&r=PG&f=1","display_name":"Blueonics","link":"https://stackoverflow.com/users/15648890/blueonics"},"is_answered":false,"view_count":22,"answer_count":1,"score":0,"last_activity_date":1623259437,"creation_date":1623256132,"question_id":67908181,"share_link":"https://stackoverflow.com/q/67908181","body_markdown":"I am writing up a C# application using Winforms, and I need to collect some data based on my selection from a comboBox. I also have a start button that enables data collection, and a stop button that halts the data collection. \r\n\r\n This is what I am capable of doing right now:\r\n Measure all data from all channels by switching my selection on the comboBox (one channel at a time). The process goes like: select a channel- start button click - wait for data collection - stop button click\r\n\r\n But here is what I want to do in code:\r\n Select a channel - start button click - wait for data collection - stop button click\r\n switch to next channel - start button click -wait for data collection - stop button click \r\n ................\r\n repeat this process until done. \r\n \r\n My question is: what should I adopt to achieve this?\r\n I have been trying to use startButton.PerformClick( ) to enabling the buttons, however, I need to stop for a few seconds in between starting and stopping to wait for data collection.\r\n\r\n You may ask why because this is very inefficient, but for some reason the DLL from the third party cannot collect data from all channels at the same time. So i have to manually switch my channel selection from the comboBox in order to collect all data at one go. \r\n\r\n Please let me know if you have any suggestions.\r\n\r\nThanks in advance. \r\n\r\n\r\n&#39;&#39;&#39;\r\n\r\n private void timer_Tick(object sender, EventArgs e)\r\n {\r\n startButton.PerformClick();\r\n \r\n }\r\n private void timer2_Tick(object sender, EventArgs e)\r\n {\r\n stopButton.PerformClick();\r\n }\r\n\r\n private void checkAll_CheckedChanged(object sender, EventArgs e)\r\n {\r\n int i = 0;\r\n while (i != 40) //there are a total of 40 channels\r\n {\r\n\r\n System.Windows.Forms.Timer mytimer = new System.Windows.Forms.Timer();\r\n mytimer.Interval = 5000;\r\n\r\n System.Windows.Forms.Timer mytimer2 = new System.Windows.Forms.Timer();\r\n mytimer2.Interval = 7000;\r\n\r\n mytimer.Start();\r\n mytimer.Tick += new EventHandler(timer_Tick);\r\n\r\n mytimer2.Start();\r\n mytimer2.Tick += new EventHandler(timer2_Tick);\r\n\r\n physicalChannelComboBox.SelectedIndex = i;\r\n i++;\r\n Thread.Sleep(5000);\r\n }\r\n\r\n }\r\n\r\n&#39;&#39;&#39;\r\n","link":"https://stackoverflow.com/questions/67908181/c-winforms-simulate-user-clicksstart-wait-for-data-collection-stop","title":"C# Winforms: Simulate user clicks(start- wait for data collection - stop)","body":"<p>I am writing up a C# application using Winforms, and I need to collect some data based on my selection from a comboBox. I also have a start button that enables data collection, and a stop button that halts the data collection.</p>\n<pre><code>This is what I am capable of doing right now:\nMeasure all data from all channels by switching my selection on the comboBox (one channel at a time). The process goes like: select a channel- start button click - wait for data collection - stop button click\n</code></pre>\n<p>But here is what I want to do in code:\nSelect a channel - start button click - wait for data collection - stop button click\nswitch to next channel - start button click -wait for data collection - stop button click\n................\nrepeat this process until done.</p>\n<p>My question is: what should I adopt to achieve this?\nI have been trying to use startButton.PerformClick( ) to enabling the buttons, however, I need to stop for a few seconds in between starting and stopping to wait for data collection.</p>\n<p>You may ask why because this is very inefficient, but for some reason the DLL from the third party cannot collect data from all channels at the same time. So i have to manually switch my channel selection from the comboBox in order to collect all data at one go.</p>\n<p>Please let me know if you have any suggestions.</p>\n<p>Thanks in advance.</p>\n<p>'''</p>\n<pre><code> private void timer_Tick(object sender, EventArgs e)\n {\n startButton.PerformClick();\n \n }\n private void timer2_Tick(object sender, EventArgs e)\n {\n stopButton.PerformClick();\n }\n\n private void checkAll_CheckedChanged(object sender, EventArgs e)\n {\n int i = 0;\n while (i != 40) //there are a total of 40 channels\n {\n\n System.Windows.Forms.Timer mytimer = new System.Windows.Forms.Timer();\n mytimer.Interval = 5000;\n\n System.Windows.Forms.Timer mytimer2 = new System.Windows.Forms.Timer();\n mytimer2.Interval = 7000;\n\n mytimer.Start();\n mytimer.Tick += new EventHandler(timer_Tick);\n\n mytimer2.Start();\n mytimer2.Tick += new EventHandler(timer2_Tick);\n\n physicalChannelComboBox.SelectedIndex = i;\n i++;\n Thread.Sleep(5000);\n }\n\n }\n</code></pre>\n<p>'''</p>\n"},{"tags":["mercurial"],"owner":{"reputation":7893,"user_id":3195477,"user_type":"registered","accept_rate":20,"profile_image":"https://i.stack.imgur.com/PK4P1.jpg?s=128&g=1","display_name":"StayOnTarget","link":"https://stackoverflow.com/users/3195477/stayontarget"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259433,"creation_date":1623259433,"question_id":67908976,"share_link":"https://stackoverflow.com/q/67908976","body_markdown":"I&#39;m running a batch graft between branches like this:\r\n\r\n hg graft --rev &quot;file(&#39;libraries/project/**&#39;)&quot;\r\n\r\nIn total a few dozen changesets are being grafted.\r\n\r\nPeriodically I am getting messages like this which interrupt the graft operation and wait for user input:\r\n\r\n grafting 16356:268ef234596a &quot;commit message here&quot;\r\n file &#39;project\\source\\filename.cs&#39; was deleted in local [local] but was modified in other [graft].\r\n You can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\r\n What do you want to do? \r\n\r\nNow, I know that 100% of the time the &quot;deleted&quot; option is appropriate. But is there any way to force HG to automatically use that option?\r\n\r\nLooking in the [documentation][1] nothing is mentioned about this circumstance. Nor does `hg graft --help --verbose` (which seems to be the same content as the docs anyway).\r\n\r\n---\r\n\r\nAt first I thought I could use the \r\n\r\n -t\t--tool TOOL\tspecify merge tool\r\n\r\noption... but I don&#39;t think that would work, because none of the [available merge tools][2] would only affect deletions. There could be other kinds of merge conflicts which I&#39;d have to deal with manually.\r\n\r\n\r\n [1]: https://www.mercurial-scm.org/repo/hg/help/graft\r\n [2]: https://www.mercurial-scm.org/repo/hg/help/merge-tools","link":"https://stackoverflow.com/questions/67908976/how-to-automatically-resolve-a-merge-conflict-because-of-a-deleted-file-during-a","title":"How to automatically resolve a merge conflict because of a deleted file during a graft?","body":"<p>I'm running a batch graft between branches like this:</p>\n<pre><code>hg graft --rev &quot;file('libraries/project/**')&quot;\n</code></pre>\n<p>In total a few dozen changesets are being grafted.</p>\n<p>Periodically I am getting messages like this which interrupt the graft operation and wait for user input:</p>\n<pre><code>grafting 16356:268ef234596a &quot;commit message here&quot;\nfile 'project\\source\\filename.cs' was deleted in local [local] but was modified in other [graft].\nYou can use (c)hanged version, leave (d)eleted, or leave (u)nresolved.\nWhat do you want to do? \n</code></pre>\n<p>Now, I know that 100% of the time the &quot;deleted&quot; option is appropriate. But is there any way to force HG to automatically use that option?</p>\n<p>Looking in the <a href=\"https://www.mercurial-scm.org/repo/hg/help/graft\" rel=\"nofollow noreferrer\">documentation</a> nothing is mentioned about this circumstance. Nor does <code>hg graft --help --verbose</code> (which seems to be the same content as the docs anyway).</p>\n<hr />\n<p>At first I thought I could use the</p>\n<pre><code>-t --tool TOOL specify merge tool\n</code></pre>\n<p>option... but I don't think that would work, because none of the <a href=\"https://www.mercurial-scm.org/repo/hg/help/merge-tools\" rel=\"nofollow noreferrer\">available merge tools</a> would only affect deletions. There could be other kinds of merge conflicts which I'd have to deal with manually.</p>\n"},{"tags":["pyspark","databricks"],"owner":{"reputation":19,"user_id":7466812,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/423e394f62c194d31f79cf032a671f80?s=128&d=identicon&r=PG&f=1","display_name":"Sagar Moghe","link":"https://stackoverflow.com/users/7466812/sagar-moghe"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259426,"creation_date":1623259426,"question_id":67908975,"share_link":"https://stackoverflow.com/q/67908975","body_markdown":"I have a very large dataset like 1TB of flat file. I have computed a new column that is stored in another dataframe. I want to add this new column to my original dataframe without the overhead of performing a join. I made sure that the two dataframe have same number of rows and I do not need a join to merge this table.The 2 columns can be adjacently placed side by side without any errors. \r\n\r\nI also tried to create third df merging 2 df but failed.\r\n\r\n df3 = df1.withColumn(&#39;newColumn&#39;,df2[&#39;onlyColumnInThisDataframe&#39;])\r\n\r\nNote: df2 is computed independent of df1 and cannot be done with some transformation on df1 using withColumn.","link":"https://stackoverflow.com/questions/67908975/append-a-column-to-pyspark-data-frame-from-another-data-frame-without-performing","title":"append a column to pyspark data frame from another data frame without performing a join","body":"<p>I have a very large dataset like 1TB of flat file. I have computed a new column that is stored in another dataframe. I want to add this new column to my original dataframe without the overhead of performing a join. I made sure that the two dataframe have same number of rows and I do not need a join to merge this table.The 2 columns can be adjacently placed side by side without any errors.</p>\n<p>I also tried to create third df merging 2 df but failed.</p>\n<pre><code>df3 = df1.withColumn('newColumn',df2['onlyColumnInThisDataframe'])\n</code></pre>\n<p>Note: df2 is computed independent of df1 and cannot be done with some transformation on df1 using withColumn.</p>\n"},{"tags":["php","mysqli","error-handling"],"owner":{"reputation":1,"user_id":15805992,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gizl0MCrJZs_EK1-tjjFh-X8Fh-WudDoYhArVmKaQ=k-s128","display_name":"Glitcher 2018","link":"https://stackoverflow.com/users/15805992/glitcher-2018"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259425,"creation_date":1623259425,"question_id":67908974,"share_link":"https://stackoverflow.com/q/67908974","body_markdown":"[Here is error code][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/0CkAs.png\r\n\r\nI&#39;m using UniController for php.\r\nI get this error when I view www.","link":"https://stackoverflow.com/questions/67908974/how-do-i-fix-no-such-file-or-directory-in-unknown-on-line-0","title":"How do I fix No such file or directory in Unknown on line 0?","body":"<p><a href=\"https://i.stack.imgur.com/0CkAs.png\" rel=\"nofollow noreferrer\">Here is error code</a></p>\n<p>I'm using UniController for php.\nI get this error when I view www.</p>\n"},{"tags":["nginx","ffmpeg","rtmp","m3u8"],"answers":[{"owner":{"reputation":88257,"user_id":1109017,"user_type":"registered","profile_image":"https://i.stack.imgur.com/PX561.png?s=128&g=1","display_name":"llogan","link":"https://stackoverflow.com/users/1109017/llogan"},"is_accepted":false,"score":0,"last_activity_date":1623259420,"last_edit_date":1623259420,"creation_date":1623098370,"answer_id":67878436,"question_id":67877727,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":13,"user_id":7570267,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/89867ce1f3a5997a56e92b73e57540d0?s=128&d=identicon&r=PG&f=1","display_name":"rayjhp","link":"https://stackoverflow.com/users/7570267/rayjhp"},"is_answered":false,"view_count":13,"answer_count":1,"score":0,"last_activity_date":1623259420,"creation_date":1623094527,"question_id":67877727,"share_link":"https://stackoverflow.com/q/67877727","body_markdown":"I&#39;m trying to do a Web TV for my Radio but i&#39;m stucked into this problem.\r\n\r\nI&#39;m trying to put a video loop (mp4) and trying to add into that loop the audio source of my radio who stream in m3u8 via Shoutcast. \r\n\r\nIs possible to do this? I try to search everything on internet without any particular result. ","link":"https://stackoverflow.com/questions/67877727/combine-two-input-audio-video-in-nginx-rtmp","title":"Combine two input audio/video in Nginx RTMP","body":"<p>I'm trying to do a Web TV for my Radio but i'm stucked into this problem.</p>\n<p>I'm trying to put a video loop (mp4) and trying to add into that loop the audio source of my radio who stream in m3u8 via Shoutcast.</p>\n<p>Is possible to do this? I try to search everything on internet without any particular result.</p>\n"},{"tags":["ios","uigesturerecognizer","uipickerview"],"owner":{"reputation":1999,"user_id":544795,"user_type":"registered","accept_rate":69,"profile_image":"https://i.stack.imgur.com/rimwB.png?s=128&g=1","display_name":"Sjakelien","link":"https://stackoverflow.com/users/544795/sjakelien"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259420,"creation_date":1623259420,"question_id":67908972,"share_link":"https://stackoverflow.com/q/67908972","body_markdown":"Bear with me. I did some investigations.\r\n\r\nWhat I want, is a UIPickerview to behave ***as if it was operated by me***, the user.\r\n\r\nI know this:\r\n\r\n self.picker.selectRow(43, inComponent: 0, animated: true)\r\n\r\nbut that doesn&#39;t include the scroll speed and the slow down.\r\n\r\nI&#39;m looking for something that I can operate as follows:\r\n\r\n\r\n func scroll(picker:UIPickerView, direction: Int, speed: Double){\r\n // I might need some callback, but this would be great already.\r\n // likely, the parameters would include a simulated Gesture, but I don&#39;t know how to do that\r\n }\r\n\r\n\r\nI hope somebody understands what I mean\r\n\r\n\r\nthanks","link":"https://stackoverflow.com/questions/67908972/mimic-gesture-to-drive-uipickerview","title":"Mimic gesture to drive UIPickerview","body":"<p>Bear with me. I did some investigations.</p>\n<p>What I want, is a UIPickerview to behave <em><strong>as if it was operated by me</strong></em>, the user.</p>\n<p>I know this:</p>\n<pre><code>self.picker.selectRow(43, inComponent: 0, animated: true)\n</code></pre>\n<p>but that doesn't include the scroll speed and the slow down.</p>\n<p>I'm looking for something that I can operate as follows:</p>\n<pre><code> func scroll(picker:UIPickerView, direction: Int, speed: Double){\n // I might need some callback, but this would be great already.\n // likely, the parameters would include a simulated Gesture, but I don't know how to do that\n }\n</code></pre>\n<p>I hope somebody understands what I mean</p>\n<p>thanks</p>\n"},{"tags":["python","pandas","numpy"],"owner":{"reputation":325,"user_id":15492238,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5bb9116f49e2fd92ba919ad7f1fd1141?s=128&d=identicon&r=PG&f=1","display_name":"tj judge ","link":"https://stackoverflow.com/users/15492238/tj-judge"},"is_answered":false,"view_count":5,"answer_count":0,"score":0,"last_activity_date":1623259417,"creation_date":1623259417,"question_id":67908971,"share_link":"https://stackoverflow.com/q/67908971","body_markdown":"I have a dataframe:\r\n\r\n 1 2 3 4 5\r\n Name Segment Axis Cost \r\n Amazon 1 slope 200 NaN 2.5 2.5 2.5 2.5\r\n x 200 0.0 1.0 2.0 3.0 4.0\r\n y 200 0.0 0.4 0.8 1.2 1.6\r\n 2 slope 100 NaN 2.0 2.0 2.0 2.0\r\n x 100 0.0 2.0 4.0 6.0 8.0\r\n y 100 0.0 1.0 2.0 3.0 4.0\r\n\r\nHow can a multiple the values in the corresponding slope rows on the Axis index, to the corresponding Cost index.\r\n\r\n\r\nExpected output:\r\n\r\n 1 2 3 4 5\r\n Name Segment Axis Cost \r\n Amazon 1 slope 200 NaN 500 500 500 500\r\n x 200 0.0 1.0 2.0 3.0 4.0\r\n y 200 0.0 0.4 0.8 1.2 1.6\r\n 2 slope 100 NaN 200 200 200 200\r\n x 100 0.0 2.0 4.0 6.0 8.0\r\n y 100 0.0 1.0 2.0 3.0 4.0","link":"https://stackoverflow.com/questions/67908971/multiple-by-corresponding-index-values","title":"Multiple by corresponding index values","body":"<p>I have a dataframe:</p>\n<pre><code> 1 2 3 4 5\nName Segment Axis Cost \nAmazon 1 slope 200 NaN 2.5 2.5 2.5 2.5\n x 200 0.0 1.0 2.0 3.0 4.0\n y 200 0.0 0.4 0.8 1.2 1.6\n 2 slope 100 NaN 2.0 2.0 2.0 2.0\n x 100 0.0 2.0 4.0 6.0 8.0\n y 100 0.0 1.0 2.0 3.0 4.0\n</code></pre>\n<p>How can a multiple the values in the corresponding slope rows on the Axis index, to the corresponding Cost index.</p>\n<p>Expected output:</p>\n<pre><code> 1 2 3 4 5\nName Segment Axis Cost \nAmazon 1 slope 200 NaN 500 500 500 500\n x 200 0.0 1.0 2.0 3.0 4.0\n y 200 0.0 0.4 0.8 1.2 1.6\n 2 slope 100 NaN 200 200 200 200\n x 100 0.0 2.0 4.0 6.0 8.0\n y 100 0.0 1.0 2.0 3.0 4.0\n</code></pre>\n"},{"tags":["java",".net","jsp","jakarta-ee","taglib"],"owner":{"reputation":1,"user_id":10162275,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/569e9b4f603907049eb1fe486ff54479?s=128&d=identicon&r=PG&f=1","display_name":"MD Burke","link":"https://stackoverflow.com/users/10162275/md-burke"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259413,"creation_date":1623259413,"question_id":67908970,"share_link":"https://stackoverflow.com/q/67908970","body_markdown":"I need to make a call to a Java EE taglib that exists on another server. It is available via the web. What I need is the .Net equivalent code to implement this.\r\n\r\n &lt;%@ taglib uri = &quot;http://www.example.com/custlib&quot; prefix = &quot;mytag&quot; %&gt;\r\n &lt;html&gt;\r\n &lt;body&gt;\r\n &lt;mytag:hello/&gt;\r\n &lt;/body&gt;\r\n &lt;/html&gt;","link":"https://stackoverflow.com/questions/67908970/java-taglib-called-from-net-web-aplication","title":"Java taglib called from .Net web aplication","body":"<p>I need to make a call to a Java EE taglib that exists on another server. It is available via the web. What I need is the .Net equivalent code to implement this.</p>\n<pre><code>&lt;%@ taglib uri = &quot;http://www.example.com/custlib&quot; prefix = &quot;mytag&quot; %&gt;\n&lt;html&gt;\n &lt;body&gt;\n &lt;mytag:hello/&gt;\n &lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n"},{"tags":["spring-boot","spring-mvc","spring-security"],"owner":{"reputation":178,"user_id":939857,"user_type":"registered","accept_rate":0,"profile_image":"https://www.gravatar.com/avatar/717f0bfe9a70d20956f534822306af9f?s=128&d=identicon&r=PG","display_name":"user939857","link":"https://stackoverflow.com/users/939857/user939857"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259404,"creation_date":1623259404,"question_id":67908969,"share_link":"https://stackoverflow.com/q/67908969","body_markdown":"I have started playing with Springboot and Spring MVC\r\n\r\nI have had no problems, but now I am attempting to utilize security.\r\n\r\nWith the following pom, controller and curl request the curl request is completely ignored.\r\n\r\nIf I run with debug, with a stop point in the controller, it never gets there.\r\nThere are no error messages, but there are hundreds of lines of negative matches.\r\n\r\nMy controller does not show up under Mappings.\r\n\r\nWhat do am I missing?\r\n\r\n\r\n## pom\r\n\r\n &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\r\n &lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;\r\n \txmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;\r\n \txsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;\r\n \t&lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;\r\n \t&lt;parent&gt;\r\n \t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t&lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;\r\n \t\t&lt;version&gt;2.5.0&lt;/version&gt;\r\n \t\t&lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;\r\n \t&lt;/parent&gt;\r\n \t&lt;groupId&gt;org.xxx&lt;/groupId&gt;\r\n \t&lt;artifactId&gt;address-services&lt;/artifactId&gt;\r\n \t&lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;\r\n \t&lt;name&gt;address-services&lt;/name&gt;\r\n \t&lt;description&gt;REST services for address validation&lt;/description&gt;\r\n \t\r\n \t&lt;properties&gt;\r\n \t\t&lt;java.version&gt;11&lt;/java.version&gt;\r\n \t\t\t&lt;skip_unit_tests&gt;false&lt;/skip_unit_tests&gt;\r\n \t\t&lt;org.slf4j.version&gt;1.7.28&lt;/org.slf4j.version&gt;\r\n \t\t&lt;org.xxx.version&gt;9.2.0&lt;/org.xxx.version&gt;\r\n \t\t&lt;com.h2database.version&gt;1.4.199&lt;/com.h2database.version&gt; \r\n \t\t&lt;commons.lang.version&gt;2.4&lt;/commons.lang.version&gt;\r\n \t\t&lt;commons.io.version&gt;2.6&lt;/commons.io.version&gt;\r\n \t\t&lt;dom4j.version&gt;1.6.1&lt;/dom4j.version&gt;\r\n \t\t&lt;!-- &lt;org.springframework.version&gt;5.2.7.RELEASE&lt;/org.springframework.version&gt; --&gt;\r\n \t&lt;/properties&gt;\r\n \t\r\n \t&lt;dependencies&gt;\r\n \t &lt;!-- spring --&gt;\r\n \t &lt;!-- \r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t --&gt;\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.thymeleaf.extras&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;thymeleaf-extras-springsecurity5&lt;/artifactId&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;\r\n \t\t\t&lt;scope&gt;test&lt;/scope&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.springframework.security&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;\r\n \t\t\t&lt;scope&gt;test&lt;/scope&gt;\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t&lt;!-- xxx --&gt;\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.xxx&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;xxx-core&lt;/artifactId&gt;\r\n \t\t\t&lt;version&gt;${org.xxx.version}&lt;/version&gt;\r\n \t\r\n \t\t\t\t&lt;exclusions&gt;\r\n \t\t\t\t&lt;exclusion&gt;\r\n \t\t\t\t\t&lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\r\n \t\t\t\t\t&lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\r\n \t\t\t\t&lt;/exclusion&gt;\r\n \t\t\t&lt;/exclusions&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.xxx&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;xxx-test&lt;/artifactId&gt;\r\n \t\t\t&lt;version&gt;${org.xxx.version}&lt;/version&gt;\r\n \t\t\t&lt;scope&gt;test&lt;/scope&gt;\r\n \t\t&lt;/dependency&gt;\r\n \r\n \t\t&lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.xxx&lt;/groupId&gt; &lt;artifactId&gt;xxx-hibernate&lt;/artifactId&gt; \r\n \t\t\t&lt;version&gt;${org.xxx.hibernate.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.xxx&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;xxx-jcmdline&lt;/artifactId&gt;\r\n \t\t\t&lt;version&gt;${org.xxx.version}&lt;/version&gt;\r\n \t\t&lt;/dependency&gt;\r\n \t\t\r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;org.xxx&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;xxx-jcmdline&lt;/artifactId&gt;\r\n \t\t\t&lt;version&gt;${org.xxx.version}&lt;/version&gt;\r\n \t\t&lt;/dependency&gt;\r\n \r\n \t\t&lt;!-- others --&gt;\r\n \t\t&lt;!-- \r\n \t\t&lt;dependency&gt;\r\n \t\t\t&lt;groupId&gt;commons-dbcp&lt;/groupId&gt;\r\n \t\t\t&lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;\r\n \t\t\t&lt;version&gt;1.2.2&lt;/version&gt;\r\n \t\t\t&lt;scope&gt;test&lt;/scope&gt;\r\n \t\t&lt;/dependency&gt;\r\n --&gt;\r\n \t&lt;/dependencies&gt;\r\n \r\n \t&lt;build&gt;\r\n \t\t&lt;plugins&gt;\r\n \t\t\t&lt;plugin&gt;\r\n \t\t\t\t&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\r\n \t\t\t\t&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;\r\n \t\t\t&lt;/plugin&gt;\r\n \t\t&lt;/plugins&gt;\r\n \t&lt;/build&gt;\r\n \r\n &lt;/project&gt;\r\n\r\n## The controller \r\n\r\n package org.xxx.address.service;\r\n \r\n import java.util.ArrayList;\r\n import java.util.List;\r\n \r\n import org.xxx.address.beans.AddressBean;\r\n import org.xxx.address.beans.AddressList;\r\n import org.xxx.address.service.usps.UspsAddressValidator;\r\n import org.xxx.address.usps.AddressValidationException;\r\n import org.slf4j.Logger;\r\n import org.slf4j.LoggerFactory;\r\n import org.springframework.stereotype.Controller;\r\n import org.springframework.ui.Model;\r\n import org.springframework.web.bind.annotation.ModelAttribute;\r\n import org.springframework.web.bind.annotation.PostMapping;\r\n import org.springframework.web.bind.annotation.RequestBody;\r\n \r\n @Controller\r\n public class ValidationRest {\r\n \r\n \tLogger logger = LoggerFactory.getLogger(getClass());\r\n \t\r\n \tpublic ValidationRest() {\r\n \t}\r\n \t\r\n @PostMapping(value=&quot;/validateAddress&quot;)\r\n public String validateAddress(\r\n \t\t@ModelAttribute String address1,\r\n \t\t@ModelAttribute String address2,\r\n \t\t@ModelAttribute String city,\r\n \t\t@ModelAttribute String state,\r\n \t\t@ModelAttribute String zip,\r\n \t\tModel model) throws AddressValidationException {\r\n AddressBean address = new AddressBean(address1,address2,city,state,zip);\r\n List&lt;AddressBean&gt; list = new ArrayList&lt;AddressBean&gt;();\r\n list.add(address);\r\n UspsAddressValidator validator = new UspsAddressValidator();\r\n \t\t List&lt;AddressBean&gt; response = null;\r\n \t\ttry {\r\n \t\t response = validator.validate(list);\r\n \t\t} catch (AddressValidationException e) {\r\n \t\t\t// TODO Auto-generated catch block\r\n \t\t\te.printStackTrace();\r\n \t\t\tthrow e;\r\n \t\t}\r\n \t\tmodel.addAttribute(&quot;response&quot;,response);\r\n \treturn &quot;validatedAddress&quot;;\r\n }\r\n\r\n## curl\r\n\r\necho rooter &gt; curl -u root -X POST \\\r\nlocalhost:8080/validateAddress/&amp;address1=410SouthMain&amp;address2=&amp;city=Romeo&amp;state=MI&amp;zip=78723\r\n\r\n## stdout/stderr\r\n\r\n /\\\\ / ___&#39;_ __ _ _(_)_ __ __ _ \\ \\ \\ \\\r\n ( ( )\\___ | &#39;_ | &#39;_| | &#39;_ \\/ _` | \\ \\ \\ \\\r\n \\\\/ ___)| |_)| | | | | || (_| | ) ) ) )\r\n &#39; |____| .__|_| |_|_| |_\\__, | / / / /\r\n =========|_|==============|___/=/_/_/_/\r\n :: Spring Boot :: (v2.5.0)\r\n \r\n INFO - 11:55:02,777 AddressApplication - Starting AddressApplication v0.0.1-SNAPSHOT using Java 14.0.2 on atx with PID 2737903 (/home/jjs/git/diamond-21-windoze/javautil/address-services/target/address-services-0.0.1-SNAPSHOT.jar started by jjs in /home/jjs/git/diamond-21-windoze/javautil/address-services)\r\n INFO - 11:55:02,777 AddressApplication - No active profile set, falling back to default profiles: default\r\n Jun 09, 2021 11:55:03 AM org.apache.catalina.core.StandardService startInternal\r\n INFO: Starting service [Tomcat]\r\n Jun 09, 2021 11:55:03 AM org.apache.catalina.core.StandardEngine startInternal\r\n INFO: Starting Servlet engine: [Apache Tomcat/9.0.46]\r\n Jun 09, 2021 11:55:03 AM org.apache.catalina.core.ApplicationContext log\r\n INFO: Initializing Spring embedded WebApplicationContext\r\n INFO - 11:55:04,220 AddressApplication - Started AddressApplication in 1.74 seconds (JVM running for 2.089)\r\n\r\n Negative matches:\r\n -----------------\r\n \r\n ActiveMQAutoConfiguration:\r\n Did not match:\r\n - @ConditionalOnClass did not find required class &#39;javax.jms.ConnectionFactory&#39; (OnClassCondition)\r\n \r\n AopAutoConfiguration.AspectJAutoProxyingConfiguration:\r\n Did not match:\r\n - @ConditionalOnClass did not find required class &#39;org.aspectj.weaver.Advice&#39; (OnClassCondition)\r\n \r\n ArtemisAutoConfiguration:\r\n Did not match:\r\n - @ConditionalOnClass did not find required class &#39;javax.jms.ConnectionFactory&#39; (OnClassCondition)\r\n\r\n continues for hundreds of lines.\r\n\r\n## Mappings\r\n\r\n DEBUG Mappings - \r\n \to.s.d.r.w.RepositoryController:\r\n \t{OPTIONS [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForRepositories()\r\n \t{HEAD [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForRepositories()\r\n \t{GET [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: listRepositories()\r\n DEBUG Mappings - \r\n \to.s.d.r.w.RepositoryEntityController:\r\n \t{POST [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: postCollectionResource(RootResourceInformation,PersistentEntityResource,PersistentEntityResourceAssembler,String)\r\n \t{OPTIONS [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForItemResource(RootResourceInformation)\r\n \t{HEAD [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForItemResource(RootResourceInformation,Serializable,PersistentEntityResourceAssembler)\r\n \t{GET [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: getItemResource(RootResourceInformation,Serializable,PersistentEntityResourceAssembler,HttpHeaders)\r\n \t{PUT [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: putItemResource(RootResourceInformation,PersistentEntityResource,Serializable,PersistentEntityResourceAssembler,ETag,String)\r\n \t{PATCH [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: patchItemResource(RootResourceInformation,PersistentEntityResource,Serializable,PersistentEntityResourceAssembler,ETag,String)\r\n \t{DELETE [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deleteItemResource(RootResourceInformation,Serializable,ETag)\r\n \t{OPTIONS [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForCollectionResource(RootResourceInformation)\r\n \t{HEAD [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headCollectionResource(RootResourceInformation,DefaultedPageable)\r\n \t{GET [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: getCollectionResource(RootResourceInformation,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\r\n \t{GET [/{repository}], produces [application/x-spring-data-compact+json || text/uri-list]}: getCollectionResourceCompact(RootResourceInformation,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\r\n DEBUG Mappings - \r\n \to.s.d.r.w.RepositoryPropertyReferenceController:\r\n \t{GET [/{repository}/{id}/{property}/{propertyId}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: followPropertyReference(RootResourceInformation,Serializable,String,String,PersistentEntityResourceAssembler)\r\n \t{GET [/{repository}/{id}/{property}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: followPropertyReference(RootResourceInformation,Serializable,String,PersistentEntityResourceAssembler)\r\n \t{DELETE [/{repository}/{id}/{property}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deletePropertyReference(RootResourceInformation,Serializable,String)\r\n \t{GET [/{repository}/{id}/{property}], produces [text/uri-list]}: followPropertyReferenceCompact(RootResourceInformation,Serializable,String,HttpHeaders,PersistentEntityResourceAssembler)\r\n \t{[PATCH, PUT, POST] [/{repository}/{id}/{property}], consumes [application/json || application/x-spring-data-compact+json || text/uri-list], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: createPropertyReference(RootResourceInformation,HttpMethod,CollectionModel,Serializable,String)\r\n \t{DELETE [/{repository}/{id}/{property}/{propertyId}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deletePropertyReferenceId(RootResourceInformation,Serializable,String,String)\r\n DEBUG Mappings - \r\n \to.s.d.r.w.RepositorySearchController:\r\n \t{OPTIONS [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForSearches(RootResourceInformation)\r\n \t{HEAD [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForSearches(RootResourceInformation)\r\n \t{GET [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: listSearches(RootResourceInformation)\r\n \t{GET [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: executeSearch(RootResourceInformation,MultiValueMap,String,DefaultedPageable,Sort,PersistentEntityResourceAssembler,HttpHeaders)\r\n \t{GET [/{repository}/search/{search}], produces [application/x-spring-data-compact+json]}: executeSearchCompact(RootResourceInformation,HttpHeaders,MultiValueMap,String,String,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\r\n \t{OPTIONS [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForSearch(RootResourceInformation,String)\r\n \t{HEAD [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForSearch(RootResourceInformation,String)\r\n DEBUG RepositoryRestHandlerMapping - 27 mappings in org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping\r\n DEBUG Mappings - \r\n \to.s.d.r.w.RepositorySchemaController:\r\n \t{GET [/profile/{repository}], produces [application/schema+json]}: schema(RootResourceInformation)\r\n DEBUG Mappings - \r\n \to.s.d.r.w.a.AlpsController:\r\n \t{GET [/profile/{repository}], produces [application/alps+json || */*]}: descriptor(RootResourceInformation)\r\n \t{OPTIONS [/profile/{repository}], produces [application/alps+json]}: alpsOptions()\r\n DEBUG Mappings - \r\n \to.s.d.r.w.ProfileController:\r\n \t{OPTIONS [/profile]}: profileOptions()\r\n \t{GET [/profile]}: listAllFormsOfMetadata()\r\n \r\n","link":"https://stackoverflow.com/questions/67908969/spring-mvc-controller-ignored","title":"Spring MVC controller ignored","body":"<p>I have started playing with Springboot and Spring MVC</p>\n<p>I have had no problems, but now I am attempting to utilize security.</p>\n<p>With the following pom, controller and curl request the curl request is completely ignored.</p>\n<p>If I run with debug, with a stop point in the controller, it never gets there.\nThere are no error messages, but there are hundreds of lines of negative matches.</p>\n<p>My controller does not show up under Mappings.</p>\n<p>What do am I missing?</p>\n<h2>pom</h2>\n<pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;\n&lt;project xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot;\n xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;\n xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;\n &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;\n &lt;parent&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;\n &lt;version&gt;2.5.0&lt;/version&gt;\n &lt;relativePath /&gt; &lt;!-- lookup parent from repository --&gt;\n &lt;/parent&gt;\n &lt;groupId&gt;org.xxx&lt;/groupId&gt;\n &lt;artifactId&gt;address-services&lt;/artifactId&gt;\n &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;\n &lt;name&gt;address-services&lt;/name&gt;\n &lt;description&gt;REST services for address validation&lt;/description&gt;\n \n &lt;properties&gt;\n &lt;java.version&gt;11&lt;/java.version&gt;\n &lt;skip_unit_tests&gt;false&lt;/skip_unit_tests&gt;\n &lt;org.slf4j.version&gt;1.7.28&lt;/org.slf4j.version&gt;\n &lt;org.xxx.version&gt;9.2.0&lt;/org.xxx.version&gt;\n &lt;com.h2database.version&gt;1.4.199&lt;/com.h2database.version&gt; \n &lt;commons.lang.version&gt;2.4&lt;/commons.lang.version&gt;\n &lt;commons.io.version&gt;2.6&lt;/commons.io.version&gt;\n &lt;dom4j.version&gt;1.6.1&lt;/dom4j.version&gt;\n &lt;!-- &lt;org.springframework.version&gt;5.2.7.RELEASE&lt;/org.springframework.version&gt; --&gt;\n &lt;/properties&gt;\n \n &lt;dependencies&gt;\n &lt;!-- spring --&gt;\n &lt;!-- \n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-data-rest&lt;/artifactId&gt;\n &lt;/dependency&gt;\n --&gt; \n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n \n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n \n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n \n &lt;dependency&gt;\n &lt;groupId&gt;org.thymeleaf.extras&lt;/groupId&gt;\n &lt;artifactId&gt;thymeleaf-extras-springsecurity5&lt;/artifactId&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n\n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-starter-test&lt;/artifactId&gt;\n &lt;scope&gt;test&lt;/scope&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n \n &lt;dependency&gt;\n &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;\n &lt;artifactId&gt;spring-security-test&lt;/artifactId&gt;\n &lt;scope&gt;test&lt;/scope&gt;\n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n &lt;!-- xxx --&gt;\n &lt;dependency&gt;\n &lt;groupId&gt;org.xxx&lt;/groupId&gt;\n &lt;artifactId&gt;xxx-core&lt;/artifactId&gt;\n &lt;version&gt;${org.xxx.version}&lt;/version&gt;\n \n &lt;exclusions&gt;\n &lt;exclusion&gt;\n &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;\n &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;\n &lt;/exclusion&gt;\n &lt;/exclusions&gt;\n &lt;/dependency&gt;\n &lt;dependency&gt;\n &lt;groupId&gt;org.xxx&lt;/groupId&gt;\n &lt;artifactId&gt;xxx-test&lt;/artifactId&gt;\n &lt;version&gt;${org.xxx.version}&lt;/version&gt;\n &lt;scope&gt;test&lt;/scope&gt;\n &lt;/dependency&gt;\n\n &lt;!-- &lt;dependency&gt; &lt;groupId&gt;org.xxx&lt;/groupId&gt; &lt;artifactId&gt;xxx-hibernate&lt;/artifactId&gt; \n &lt;version&gt;${org.xxx.hibernate.version}&lt;/version&gt; &lt;/dependency&gt; --&gt;\n &lt;dependency&gt;\n &lt;groupId&gt;org.xxx&lt;/groupId&gt;\n &lt;artifactId&gt;xxx-jcmdline&lt;/artifactId&gt;\n &lt;version&gt;${org.xxx.version}&lt;/version&gt;\n &lt;/dependency&gt;\n \n &lt;dependency&gt;\n &lt;groupId&gt;org.xxx&lt;/groupId&gt;\n &lt;artifactId&gt;xxx-jcmdline&lt;/artifactId&gt;\n &lt;version&gt;${org.xxx.version}&lt;/version&gt;\n &lt;/dependency&gt;\n\n &lt;!-- others --&gt;\n &lt;!-- \n &lt;dependency&gt;\n &lt;groupId&gt;commons-dbcp&lt;/groupId&gt;\n &lt;artifactId&gt;commons-dbcp&lt;/artifactId&gt;\n &lt;version&gt;1.2.2&lt;/version&gt;\n &lt;scope&gt;test&lt;/scope&gt;\n &lt;/dependency&gt;\n --&gt;\n &lt;/dependencies&gt;\n\n &lt;build&gt;\n &lt;plugins&gt;\n &lt;plugin&gt;\n &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;\n &lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;\n &lt;/plugin&gt;\n &lt;/plugins&gt;\n &lt;/build&gt;\n\n&lt;/project&gt;\n</code></pre>\n<h2>The controller</h2>\n<p>package org.xxx.address.service;</p>\n<pre><code>import java.util.ArrayList;\nimport java.util.List;\n\nimport org.xxx.address.beans.AddressBean;\nimport org.xxx.address.beans.AddressList;\nimport org.xxx.address.service.usps.UspsAddressValidator;\nimport org.xxx.address.usps.AddressValidationException;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.springframework.stereotype.Controller;\nimport org.springframework.ui.Model;\nimport org.springframework.web.bind.annotation.ModelAttribute;\nimport org.springframework.web.bind.annotation.PostMapping;\nimport org.springframework.web.bind.annotation.RequestBody;\n\n@Controller\npublic class ValidationRest {\n\n Logger logger = LoggerFactory.getLogger(getClass());\n \n public ValidationRest() {\n }\n \n @PostMapping(value=&quot;/validateAddress&quot;)\n public String validateAddress(\n @ModelAttribute String address1,\n @ModelAttribute String address2,\n @ModelAttribute String city,\n @ModelAttribute String state,\n @ModelAttribute String zip,\n Model model) throws AddressValidationException {\n AddressBean address = new AddressBean(address1,address2,city,state,zip);\n List&lt;AddressBean&gt; list = new ArrayList&lt;AddressBean&gt;();\n list.add(address);\n UspsAddressValidator validator = new UspsAddressValidator();\n List&lt;AddressBean&gt; response = null;\n try {\n response = validator.validate(list);\n } catch (AddressValidationException e) {\n // TODO Auto-generated catch block\n e.printStackTrace();\n throw e;\n }\n model.addAttribute(&quot;response&quot;,response);\n return &quot;validatedAddress&quot;;\n }\n</code></pre>\n<h2>curl</h2>\n<p>echo rooter &gt; curl -u root -X POST <br />\nlocalhost:8080/validateAddress/&amp;address1=410SouthMain&amp;address2=&amp;city=Romeo&amp;state=MI&amp;zip=78723</p>\n<h2>stdout/stderr</h2>\n<pre><code> /\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\\n( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n \\\\/ ___)| |_)| | | | | || (_| | ) ) ) )\n ' |____| .__|_| |_|_| |_\\__, | / / / /\n =========|_|==============|___/=/_/_/_/\n :: Spring Boot :: (v2.5.0)\n\nINFO - 11:55:02,777 AddressApplication - Starting AddressApplication v0.0.1-SNAPSHOT using Java 14.0.2 on atx with PID 2737903 (/home/jjs/git/diamond-21-windoze/javautil/address-services/target/address-services-0.0.1-SNAPSHOT.jar started by jjs in /home/jjs/git/diamond-21-windoze/javautil/address-services)\nINFO - 11:55:02,777 AddressApplication - No active profile set, falling back to default profiles: default\nJun 09, 2021 11:55:03 AM org.apache.catalina.core.StandardService startInternal\nINFO: Starting service [Tomcat]\nJun 09, 2021 11:55:03 AM org.apache.catalina.core.StandardEngine startInternal\nINFO: Starting Servlet engine: [Apache Tomcat/9.0.46]\nJun 09, 2021 11:55:03 AM org.apache.catalina.core.ApplicationContext log\nINFO: Initializing Spring embedded WebApplicationContext\nINFO - 11:55:04,220 AddressApplication - Started AddressApplication in 1.74 seconds (JVM running for 2.089)\n\nNegative matches:\n-----------------\n\n ActiveMQAutoConfiguration:\n Did not match:\n - @ConditionalOnClass did not find required class 'javax.jms.ConnectionFactory' (OnClassCondition)\n\n AopAutoConfiguration.AspectJAutoProxyingConfiguration:\n Did not match:\n - @ConditionalOnClass did not find required class 'org.aspectj.weaver.Advice' (OnClassCondition)\n\n ArtemisAutoConfiguration:\n Did not match:\n - @ConditionalOnClass did not find required class 'javax.jms.ConnectionFactory' (OnClassCondition)\n\n continues for hundreds of lines.\n</code></pre>\n<h2>Mappings</h2>\n<pre><code>DEBUG Mappings - \n o.s.d.r.w.RepositoryController:\n {OPTIONS [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForRepositories()\n {HEAD [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForRepositories()\n {GET [/ || ], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: listRepositories()\nDEBUG Mappings - \n o.s.d.r.w.RepositoryEntityController:\n {POST [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: postCollectionResource(RootResourceInformation,PersistentEntityResource,PersistentEntityResourceAssembler,String)\n {OPTIONS [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForItemResource(RootResourceInformation)\n {HEAD [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForItemResource(RootResourceInformation,Serializable,PersistentEntityResourceAssembler)\n {GET [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: getItemResource(RootResourceInformation,Serializable,PersistentEntityResourceAssembler,HttpHeaders)\n {PUT [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: putItemResource(RootResourceInformation,PersistentEntityResource,Serializable,PersistentEntityResourceAssembler,ETag,String)\n {PATCH [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: patchItemResource(RootResourceInformation,PersistentEntityResource,Serializable,PersistentEntityResourceAssembler,ETag,String)\n {DELETE [/{repository}/{id}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deleteItemResource(RootResourceInformation,Serializable,ETag)\n {OPTIONS [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForCollectionResource(RootResourceInformation)\n {HEAD [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headCollectionResource(RootResourceInformation,DefaultedPageable)\n {GET [/{repository}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: getCollectionResource(RootResourceInformation,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\n {GET [/{repository}], produces [application/x-spring-data-compact+json || text/uri-list]}: getCollectionResourceCompact(RootResourceInformation,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\nDEBUG Mappings - \n o.s.d.r.w.RepositoryPropertyReferenceController:\n {GET [/{repository}/{id}/{property}/{propertyId}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: followPropertyReference(RootResourceInformation,Serializable,String,String,PersistentEntityResourceAssembler)\n {GET [/{repository}/{id}/{property}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: followPropertyReference(RootResourceInformation,Serializable,String,PersistentEntityResourceAssembler)\n {DELETE [/{repository}/{id}/{property}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deletePropertyReference(RootResourceInformation,Serializable,String)\n {GET [/{repository}/{id}/{property}], produces [text/uri-list]}: followPropertyReferenceCompact(RootResourceInformation,Serializable,String,HttpHeaders,PersistentEntityResourceAssembler)\n {[PATCH, PUT, POST] [/{repository}/{id}/{property}], consumes [application/json || application/x-spring-data-compact+json || text/uri-list], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: createPropertyReference(RootResourceInformation,HttpMethod,CollectionModel,Serializable,String)\n {DELETE [/{repository}/{id}/{property}/{propertyId}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: deletePropertyReferenceId(RootResourceInformation,Serializable,String,String)\nDEBUG Mappings - \n o.s.d.r.w.RepositorySearchController:\n {OPTIONS [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForSearches(RootResourceInformation)\n {HEAD [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForSearches(RootResourceInformation)\n {GET [/{repository}/search], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: listSearches(RootResourceInformation)\n {GET [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: executeSearch(RootResourceInformation,MultiValueMap,String,DefaultedPageable,Sort,PersistentEntityResourceAssembler,HttpHeaders)\n {GET [/{repository}/search/{search}], produces [application/x-spring-data-compact+json]}: executeSearchCompact(RootResourceInformation,HttpHeaders,MultiValueMap,String,String,DefaultedPageable,Sort,PersistentEntityResourceAssembler)\n {OPTIONS [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: optionsForSearch(RootResourceInformation,String)\n {HEAD [/{repository}/search/{search}], produces [application/hal+json || application/json || application/prs.hal-forms+json]}: headForSearch(RootResourceInformation,String)\nDEBUG RepositoryRestHandlerMapping - 27 mappings in org.springframework.data.rest.webmvc.RepositoryRestHandlerMapping\nDEBUG Mappings - \n o.s.d.r.w.RepositorySchemaController:\n {GET [/profile/{repository}], produces [application/schema+json]}: schema(RootResourceInformation)\nDEBUG Mappings - \n o.s.d.r.w.a.AlpsController:\n {GET [/profile/{repository}], produces [application/alps+json || */*]}: descriptor(RootResourceInformation)\n {OPTIONS [/profile/{repository}], produces [application/alps+json]}: alpsOptions()\nDEBUG Mappings - \n o.s.d.r.w.ProfileController:\n {OPTIONS [/profile]}: profileOptions()\n {GET [/profile]}: listAllFormsOfMetadata()\n</code></pre>\n"},{"tags":["flutter"],"comments":[{"owner":{"reputation":120,"user_id":15702670,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/22e4bff54c1a017062661f04eea08f73?s=128&d=identicon&r=PG&f=1","display_name":"sungkd123","link":"https://stackoverflow.com/users/15702670/sungkd123"},"edited":false,"score":0,"creation_date":1623257532,"post_id":67908426,"comment_id":120029990,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":49,"user_id":14363696,"user_type":"registered","profile_image":"https://lh4.googleusercontent.com/-7azapK1NJSI/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucl-TROjxllcALgiTuCaonhIv3c_6Q/photo.jpg?sz=128","display_name":"sara s","link":"https://stackoverflow.com/users/14363696/sara-s"},"reply_to_user":{"reputation":120,"user_id":15702670,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/22e4bff54c1a017062661f04eea08f73?s=128&d=identicon&r=PG&f=1","display_name":"sungkd123","link":"https://stackoverflow.com/users/15702670/sungkd123"},"edited":false,"score":0,"creation_date":1623259194,"post_id":67908426,"comment_id":120030618,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":221,"user_id":11161388,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/38d79227cfe016067dd0713f46741bbc?s=128&d=identicon&r=PG&f=1","display_name":"Jaime Ortiz","link":"https://stackoverflow.com/users/11161388/jaime-ortiz"},"is_accepted":false,"score":0,"last_activity_date":1623259400,"last_edit_date":1623259400,"creation_date":1623257687,"answer_id":67908573,"question_id":67908426,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":49,"user_id":14363696,"user_type":"registered","profile_image":"https://lh4.googleusercontent.com/-7azapK1NJSI/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucl-TROjxllcALgiTuCaonhIv3c_6Q/photo.jpg?sz=128","display_name":"sara s","link":"https://stackoverflow.com/users/14363696/sara-s"},"is_answered":false,"view_count":15,"answer_count":1,"score":0,"last_activity_date":1623259400,"creation_date":1623257032,"question_id":67908426,"share_link":"https://stackoverflow.com/q/67908426","body_markdown":"i want to generate signed apk in flutter but i dont have this option in build menu.\r\nwhen i open editing tool in new window, show me error of gradle. and buid menu dont have any option for genrate signed apk\r\n it is my gradle wrapper code.[![enter image description here][1]][1]\r\n\r\n \r\n\r\n \r\n\r\n #Fri Jun 23 08:50:38 CEST 2017\r\n distributionBase=GRADLE_USER_HOME\r\n distributionPath=wrapper/dists\r\n zipStoreBase=GRADLE_USER_HOME\r\n zipStorePath=wrapper/dists\r\n distributionUrl=https\\://services.gradle.org/distributions/gradle-6.7-all.zip\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [![enter image description here][2]][2]\r\n [1]: https://i.stack.imgur.com/DJjw2.png\r\n [2]: https://i.stack.imgur.com/B4laZ.png","link":"https://stackoverflow.com/questions/67908426/how-generate-signed-apk-in-flutter","title":"how generate signed apk in flutter","body":"<p>i want to generate signed apk in flutter but i dont have this option in build menu.\nwhen i open editing tool in new window, show me error of gradle. and buid menu dont have any option for genrate signed apk\nit is my gradle wrapper code.<a href=\"https://i.stack.imgur.com/DJjw2.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/DJjw2.png\" alt=\"enter image description here\" /></a></p>\n<pre><code>#Fri Jun 23 08:50:38 CEST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-6.7-all.zip\n</code></pre>\n<p><a href=\"https://i.stack.imgur.com/B4laZ.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/B4laZ.png\" alt=\"enter image description here\" /></a></p>\n<pre><code>[![enter image description here][2]][2]\n</code></pre>\n"},{"tags":["python"],"comments":[{"owner":{"reputation":37218,"user_id":4354477,"user_type":"registered","accept_rate":52,"profile_image":"https://i.stack.imgur.com/SuxtS.gif?s=128&g=1","display_name":"ForceBru","link":"https://stackoverflow.com/users/4354477/forcebru"},"edited":false,"score":2,"creation_date":1623250245,"post_id":67906523,"comment_id":120026601,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16176951,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gh4i1bLCTLQ1hTgQeGw_c7FjZQykuDKZO-mHYkQ=k-s128","display_name":"Zih69420","link":"https://stackoverflow.com/users/16176951/zih69420"},"reply_to_user":{"reputation":37218,"user_id":4354477,"user_type":"registered","accept_rate":52,"profile_image":"https://i.stack.imgur.com/SuxtS.gif?s=128&g=1","display_name":"ForceBru","link":"https://stackoverflow.com/users/4354477/forcebru"},"edited":false,"score":0,"creation_date":1623250622,"post_id":67906523,"comment_id":120026765,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16176951,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gh4i1bLCTLQ1hTgQeGw_c7FjZQykuDKZO-mHYkQ=k-s128","display_name":"Zih69420","link":"https://stackoverflow.com/users/16176951/zih69420"},"is_answered":false,"view_count":19,"answer_count":0,"score":-1,"last_activity_date":1623259394,"creation_date":1623249984,"last_edit_date":1623259394,"question_id":67906523,"share_link":"https://stackoverflow.com/q/67906523","body_markdown":"using sublime text and when i do a simple print i get this error\r\n\r\n```none\r\nC:\\Python38\\python.exe: can&#39;t find &#39;__main__&#39; module in &#39;&#39;\r\n[Finished in 150ms]\r\n```\r\n\r\nI&#39;ve used some other websites but can&#39;t really understand and or cant find a fix\r\nusing python\r\nlmk","link":"https://stackoverflow.com/questions/67906523/cant-find-main-module-in-in-sublime-text-using-python","title":"cant find _main_ module in&#39; in sublime text using python","body":"<p>using sublime text and when i do a simple print i get this error</p>\n<pre class=\"lang-none prettyprint-override\"><code>C:\\Python38\\python.exe: can't find '__main__' module in ''\n[Finished in 150ms]\n</code></pre>\n<p>I've used some other websites but can't really understand and or cant find a fix\nusing python\nlmk</p>\n"},{"tags":["typescript","sorting","lodash"],"comments":[{"owner":{"reputation":99406,"user_id":3001761,"user_type":"registered","profile_image":"https://i.stack.imgur.com/feZwC.jpg?s=128&g=1","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1623258843,"post_id":67908720,"comment_id":120030484,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":908,"user_id":2547324,"user_type":"registered","accept_rate":57,"profile_image":"https://i.stack.imgur.com/bzaZD.png?s=128&g=1","display_name":"Peter The Angular Dude","link":"https://stackoverflow.com/users/2547324/peter-the-angular-dude"},"reply_to_user":{"reputation":99406,"user_id":3001761,"user_type":"registered","profile_image":"https://i.stack.imgur.com/feZwC.jpg?s=128&g=1","display_name":"jonrsharpe","link":"https://stackoverflow.com/users/3001761/jonrsharpe"},"edited":false,"score":0,"creation_date":1623259414,"post_id":67908720,"comment_id":120030713,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":908,"user_id":2547324,"user_type":"registered","accept_rate":57,"profile_image":"https://i.stack.imgur.com/bzaZD.png?s=128&g=1","display_name":"Peter The Angular Dude","link":"https://stackoverflow.com/users/2547324/peter-the-angular-dude"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259390,"creation_date":1623258376,"last_edit_date":1623259390,"question_id":67908720,"share_link":"https://stackoverflow.com/q/67908720","body_markdown":"Based on my other question... https://stackoverflow.com/questions/67890798/i-need-to-loop-through-a-complex-json-array-of-objects-to-return-only-two-items\r\n\r\nI have an array of objects like so from the previous question\r\n\r\n[![enter image description here][1]][1]\r\n\r\nWhat I need done is and here&#39;s what I&#39;ve tried, to sort on country_name only, the two character code is not necessary\r\n\r\nI used lodash to make the new array of objects. This will go into a dropdown.\r\n\r\n**I TRIED THIS FIRST: Nothing**\r\n\r\n // this.newJSONCountryArr.sort((a,b) =&gt; priorityIndex[a.country_name - b.country_alpha2_code]);\r\n\r\n**THEN THIS:**\r\n this.newJSONCountryArr.sort(this.compare);\r\n console.log(&#39;New Country Arr: &#39;, self.newJSONCountryArr);\r\n\r\n compare(a: { country_name: string; }, b: { country_name: string; }): number{\r\n if (a.country_name &lt; b.country_name) {\r\n return -1;\r\n }\r\n if (a.country_name &gt; b.country_name) {\r\n return 1;\r\n }\r\n return 0;\r\n }\r\n\r\nI really don&#39;t need a number returned I simply want to sort the array of objects based on the objects I have by country_name.\r\n\r\nPerhaps I need to sort as they are placed or pushed into the new array as with this code snippet I used as the solution to the aforementioned question\r\n\r\n // Now to make a new array for only country code and name\r\n let results = _.map(this.countries, function (res) {\r\n let newResults = { country_name: res.columns[1].paramValue, country_alpha2_code: res.columns[2].paramValue };\r\n // console.log(&#39;New Results: &#39;, newResults);\r\n self.newJSONCountryArr.push(newResults);\r\n });\r\n\r\n**UPDATE:**\r\n\r\nWhat I would like are all the countries sorted in the array of objects from this:\r\n\r\n {\r\n countries: [{\r\n &quot;country_alpha2_code&quot;: &quot;PW&quot;,\r\n &quot;country_name&quot;: &quot;PALAU&quot;\r\n },{\r\n &quot;country_alpha2_code&quot;: &quot;US&quot;,\r\n &quot;country_name&quot;: &quot;UNITED STATES&quot;\r\n }\r\n ]\r\n }\r\n\r\n**TO THIS:**\r\n\r\n {\r\n countries: [\r\n {\r\n &quot;country_alpha2_code&quot;: &quot;US&quot;,\r\n &quot;country_name&quot;: &quot;UNITED STATES&quot;\r\n },{\r\n &quot;country_alpha2_code&quot;: &quot;PW&quot;,\r\n &quot;country_name&quot;: &quot;PALAU&quot;\r\n }\r\n ]\r\n }\r\n\r\n [1]: https://i.stack.imgur.com/06kVt.png","link":"https://stackoverflow.com/questions/67908720/need-to-sort-an-array-of-objects-with-two-string-elements-countries-on-the-cou","title":"Need to sort an array of objects with two string elements (countries) on the country name typescript or lodash","body":"<p>Based on my other question... <a href=\"https://stackoverflow.com/questions/67890798/i-need-to-loop-through-a-complex-json-array-of-objects-to-return-only-two-items\">I need to loop through a complex JSON ARRAY of objects to return only two items using LODASH with Typescript</a></p>\n<p>I have an array of objects like so from the previous question</p>\n<p><a href=\"https://i.stack.imgur.com/06kVt.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/06kVt.png\" alt=\"enter image description here\" /></a></p>\n<p>What I need done is and here's what I've tried, to sort on country_name only, the two character code is not necessary</p>\n<p>I used lodash to make the new array of objects. This will go into a dropdown.</p>\n<p><strong>I TRIED THIS FIRST: Nothing</strong></p>\n<pre><code>// this.newJSONCountryArr.sort((a,b) =&gt; priorityIndex[a.country_name - b.country_alpha2_code]);\n</code></pre>\n<p><strong>THEN THIS:</strong>\nthis.newJSONCountryArr.sort(this.compare);\nconsole.log('New Country Arr: ', self.newJSONCountryArr);</p>\n<pre><code>compare(a: { country_name: string; }, b: { country_name: string; }): number{\n if (a.country_name &lt; b.country_name) {\n return -1;\n }\n if (a.country_name &gt; b.country_name) {\n return 1;\n }\n return 0;\n}\n</code></pre>\n<p>I really don't need a number returned I simply want to sort the array of objects based on the objects I have by country_name.</p>\n<p>Perhaps I need to sort as they are placed or pushed into the new array as with this code snippet I used as the solution to the aforementioned question</p>\n<pre><code>// Now to make a new array for only country code and name\nlet results = _.map(this.countries, function (res) {\n let newResults = { country_name: res.columns[1].paramValue, country_alpha2_code: res.columns[2].paramValue };\n // console.log('New Results: ', newResults);\n self.newJSONCountryArr.push(newResults);\n});\n</code></pre>\n<p><strong>UPDATE:</strong></p>\n<p>What I would like are all the countries sorted in the array of objects from this:</p>\n<pre><code>{\n countries: [{\n &quot;country_alpha2_code&quot;: &quot;PW&quot;,\n &quot;country_name&quot;: &quot;PALAU&quot;\n },{\n &quot;country_alpha2_code&quot;: &quot;US&quot;,\n &quot;country_name&quot;: &quot;UNITED STATES&quot;\n }\n ]\n}\n</code></pre>\n<p><strong>TO THIS:</strong></p>\n<pre><code>{\n countries: [\n {\n &quot;country_alpha2_code&quot;: &quot;US&quot;,\n &quot;country_name&quot;: &quot;UNITED STATES&quot;\n },{\n &quot;country_alpha2_code&quot;: &quot;PW&quot;,\n &quot;country_name&quot;: &quot;PALAU&quot;\n }\n ]\n}\n</code></pre>\n"},{"tags":["reactjs","typescript","react-router-dom"],"answers":[{"owner":{"reputation":2480,"user_id":11360669,"user_type":"registered","profile_image":"https://graph.facebook.com/2103762023053861/picture?type=large","display_name":"Hagai Harari","link":"https://stackoverflow.com/users/11360669/hagai-harari"},"is_accepted":false,"score":0,"last_activity_date":1623259390,"creation_date":1623259390,"answer_id":67908967,"question_id":67904767,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":16,"user_id":10293700,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e73014f6225f56b4bef264efb26330be?s=128&d=identicon&r=PG&f=1","display_name":"Saurabh Anand","link":"https://stackoverflow.com/users/10293700/saurabh-anand"},"is_answered":false,"view_count":14,"answer_count":1,"score":0,"last_activity_date":1623259390,"creation_date":1623243948,"last_edit_date":1623258570,"question_id":67904767,"share_link":"https://stackoverflow.com/q/67904767","body_markdown":"\r\nProblem: Currently app is redirecting user from **PageA** to **ErrorPage** if some data is not found on **PageA** using react-router redirect. Now when the user is on **ErrorPage** and clicks on the browser back button. IT DOES NOT take back to **PageA**\r\nHere is a code example\r\n`\r\n//PageA - this component is inside BrowserRouter\r\n\r\n import React from &#39;react&#39;\r\n \r\n const PageA = () = {\r\n \tconst data = null\r\n \treturn (\r\n \t\tdata ? (&lt;PageAComponent /&gt;) : (\r\n \t\t&lt;Redirect\r\n \t\t\t\tto={{\r\n \t\t\t\t\t\tpathname: &quot;/errorPage&quot;,\r\n \t\t\t\t\t\tstate: { referrer: &#39;PageA&#39; }\r\n \t\t\t\t}}\r\n \t\t/&gt;\r\n \t\t)\r\n \t)\r\n }\r\n\r\n//ErrorPage\r\n\r\n import React from &#39;react&#39;\r\n \r\n const ErrorPage = () = {\r\n \treturn (\r\n \t\t&lt;&gt;.....something is displayed.....&lt;/&gt;)\r\n \t)\r\n }\r\n \r\n ","link":"https://stackoverflow.com/questions/67904767/not-able-to-go-back-to-original-page-from-where-react-router-redirect-was-call","title":"Not able to go back to original page from where React Router - Redirect was called","body":"<p>Problem: Currently app is redirecting user from <strong>PageA</strong> to <strong>ErrorPage</strong> if some data is not found on <strong>PageA</strong> using react-router redirect. Now when the user is on <strong>ErrorPage</strong> and clicks on the browser back button. IT DOES NOT take back to <strong>PageA</strong>\nHere is a code example\n`\n//PageA - this component is inside BrowserRouter</p>\n<pre><code>import React from 'react'\n\nconst PageA = () = {\n const data = null\n return (\n data ? (&lt;PageAComponent /&gt;) : (\n &lt;Redirect\n to={{\n pathname: &quot;/errorPage&quot;,\n state: { referrer: 'PageA' }\n }}\n /&gt;\n )\n )\n}\n</code></pre>\n<p>//ErrorPage</p>\n<pre><code>import React from 'react'\n\nconst ErrorPage = () = {\n return (\n &lt;&gt;.....something is displayed.....&lt;/&gt;)\n )\n}\n</code></pre>\n"},{"tags":["sql","arrays","string","select"],"comments":[{"owner":{"reputation":9568,"user_id":8651601,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/af7c1c409038facf6d3ee6f7f002350b?s=128&d=identicon&r=PG&f=1","display_name":"Kazi Mohammad Ali Nur","link":"https://stackoverflow.com/users/8651601/kazi-mohammad-ali-nur"},"edited":false,"score":0,"creation_date":1623258956,"post_id":67908843,"comment_id":120030532,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":15501638,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/357ed8eba8ad1a8e71d59d933d761d2b?s=128&d=identicon&r=PG&f=1","display_name":"Chris","link":"https://stackoverflow.com/users/15501638/chris"},"reply_to_user":{"reputation":9568,"user_id":8651601,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/af7c1c409038facf6d3ee6f7f002350b?s=128&d=identicon&r=PG&f=1","display_name":"Kazi Mohammad Ali Nur","link":"https://stackoverflow.com/users/8651601/kazi-mohammad-ali-nur"},"edited":false,"score":0,"creation_date":1623259239,"post_id":67908843,"comment_id":120030639,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":9568,"user_id":8651601,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/af7c1c409038facf6d3ee6f7f002350b?s=128&d=identicon&r=PG&f=1","display_name":"Kazi Mohammad Ali Nur","link":"https://stackoverflow.com/users/8651601/kazi-mohammad-ali-nur"},"edited":false,"score":0,"creation_date":1623259418,"post_id":67908843,"comment_id":120030715,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":9568,"user_id":8651601,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/af7c1c409038facf6d3ee6f7f002350b?s=128&d=identicon&r=PG&f=1","display_name":"Kazi Mohammad Ali Nur","link":"https://stackoverflow.com/users/8651601/kazi-mohammad-ali-nur"},"is_accepted":false,"score":0,"last_activity_date":1623259354,"creation_date":1623259354,"answer_id":67908954,"question_id":67908843,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":15501638,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/357ed8eba8ad1a8e71d59d933d761d2b?s=128&d=identicon&r=PG&f=1","display_name":"Chris","link":"https://stackoverflow.com/users/15501638/chris"},"is_answered":false,"view_count":15,"answer_count":1,"score":0,"last_activity_date":1623259388,"creation_date":1623258856,"last_edit_date":1623259388,"question_id":67908843,"share_link":"https://stackoverflow.com/q/67908843","body_markdown":"I think i did a big mistake and i can&#39;t figure how to do this thing:\r\n\r\nI have a table with a list of rooms and the column members (varchar) containing the list of accepted memberd id separated by commas (Es. 1,2,15,1000)\r\n\r\nI need to select all rooms where id IN members string. Any idea??? Something like\r\n\r\n SELECT * FROM rooms WHERE id IN rooms.members\r\n\r\n(I know it wont work, but i hope i explained myself ^^&#39; )\r\n\r\n**EDIT**\r\n*I need to do a sql query with PDO in PHP, I&#39;m using MySQL and the goal is to get a list of all the rows where the id is listed in the members list string*","link":"https://stackoverflow.com/questions/67908843/sql-how-to-select-rows-where-id-is-in-string-field","title":"SQL: how to select rows where id is in string field?","body":"<p>I think i did a big mistake and i can't figure how to do this thing:</p>\n<p>I have a table with a list of rooms and the column members (varchar) containing the list of accepted memberd id separated by commas (Es. 1,2,15,1000)</p>\n<p>I need to select all rooms where id IN members string. Any idea??? Something like</p>\n<pre><code>SELECT * FROM rooms WHERE id IN rooms.members\n</code></pre>\n<p>(I know it wont work, but i hope i explained myself ^^' )</p>\n<p><strong>EDIT</strong>\n<em>I need to do a sql query with PDO in PHP, I'm using MySQL and the goal is to get a list of all the rows where the id is listed in the members list string</em></p>\n"},{"tags":["node.js","google-app-engine","google-cloud-platform"],"answers":[{"owner":{"reputation":727,"user_id":9267296,"user_type":"registered","profile_image":"https://i.stack.imgur.com/6GnXc.png?s=128&g=1","display_name":"Edo Akse","link":"https://stackoverflow.com/users/9267296/edo-akse"},"is_accepted":false,"score":0,"last_activity_date":1623259384,"creation_date":1623259384,"answer_id":67908966,"question_id":67903298,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":119,"user_id":8734928,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/feaaefadcc84f8be4a598ce9f4b7e00e?s=128&d=identicon&r=PG&f=1","display_name":"Jul","link":"https://stackoverflow.com/users/8734928/jul"},"is_answered":false,"view_count":7,"answer_count":1,"score":0,"last_activity_date":1623259384,"creation_date":1623238293,"question_id":67903298,"share_link":"https://stackoverflow.com/q/67903298","body_markdown":"I&#39;ve tried looking for a concrete answer to this but can&#39;t find an answer anywhere. I have a very long-running (but not particularly intensive) task that I want to run every 12 hours. \r\n\r\nI&#39;ve set up a Google App Engine standard node.js Express server that runs this code, and it works perfectly when running locally. \r\n\r\nHowever, around halfway through (but completely at random) it fails with the following error messages:\r\n\r\n 2021-06-09T11:10:02.935685Z [start] 2021/06/09 11:10:02.934508 Quitting on terminated signal \r\n 2021-06-09T11:10:02.951563Z [start] 2021/06/09 11:10:02.951205 Start program failed: user application failed with exit code -1 (refer to stdout/stderr logs for more detail): signal: terminated \r\n 2021-06-09T11:10:10.891535Z [start] 2021/06/09 11:10:10.890652 Quitting on terminated signal \r\n 2021-06-09T11:10:10.997898Z [start] 2021/06/09 11:10:10.997488 Start program failed: user application failed with exit code -1 (refer to stdout/stderr logs for more detail): signal: terminated \r\n\r\nThose are the only logs I get that reference some kind of error - and there&#39;s a ton of error-handling in the code, none of which is triggered or logs anything at all. It&#39;s almost like the function just times out at some point - which leads me to wonder if there&#39;s a maximum execution time for Google App Engine?\r\n\r\nIs there a better way to do what I&#39;m trying to do?","link":"https://stackoverflow.com/questions/67903298/google-app-engine-randomly-stops-executing","title":"Google App Engine randomly stops executing","body":"<p>I've tried looking for a concrete answer to this but can't find an answer anywhere. I have a very long-running (but not particularly intensive) task that I want to run every 12 hours.</p>\n<p>I've set up a Google App Engine standard node.js Express server that runs this code, and it works perfectly when running locally.</p>\n<p>However, around halfway through (but completely at random) it fails with the following error messages:</p>\n<pre><code>2021-06-09T11:10:02.935685Z [start] 2021/06/09 11:10:02.934508 Quitting on terminated signal \n2021-06-09T11:10:02.951563Z [start] 2021/06/09 11:10:02.951205 Start program failed: user application failed with exit code -1 (refer to stdout/stderr logs for more detail): signal: terminated \n2021-06-09T11:10:10.891535Z [start] 2021/06/09 11:10:10.890652 Quitting on terminated signal \n2021-06-09T11:10:10.997898Z [start] 2021/06/09 11:10:10.997488 Start program failed: user application failed with exit code -1 (refer to stdout/stderr logs for more detail): signal: terminated \n</code></pre>\n<p>Those are the only logs I get that reference some kind of error - and there's a ton of error-handling in the code, none of which is triggered or logs anything at all. It's almost like the function just times out at some point - which leads me to wonder if there's a maximum execution time for Google App Engine?</p>\n<p>Is there a better way to do what I'm trying to do?</p>\n"},{"tags":["sql","sql-server","tsql","sql-execution-plan"],"owner":{"reputation":5323,"user_id":1492229,"user_type":"registered","accept_rate":100,"profile_image":"https://i.stack.imgur.com/JpJrO.jpg?s=128&g=1","display_name":"asmgx","link":"https://stackoverflow.com/users/1492229/asmgx"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259377,"creation_date":1623259377,"question_id":67908964,"share_link":"https://stackoverflow.com/q/67908964","body_markdown":"I have an insert statement in SQL Server.\r\n\r\nI tried it for a smaller subset, was fast\r\n\r\nincreased the number to 1milllion records and was fast 1 min 10 sec\r\n\r\nnow I doubled it and it seems stuck it has been running for 10 min now and no results\r\n\r\nI included the Plan when it was 5 min.\r\n\r\nhttps://www.brentozar.com/pastetheplan/?id=r15MPuC5u\r\n\r\nmaybe someone can tell me how to improve the process.\r\n\r\nPS. I added non clustered index on Tag (RepID).\r\n\r\nTag(iiD) is a primary Key\r\n\r\nReps(RepID) is a primary Key.\r\n\r\nWhile I am writing this. the process finished at 11:47\r\n\r\n\r\nhttps://www.brentozar.com/pastetheplan/?id=HJd9uOCcu\r\n\r\n\r\n\r\nHere is my code\r\n\r\n insert into R3..Tags (iID,DT,RepID,Tag,xmiID,iBegin,iEnd,Confidence,Polarity,Uncertainty,Conditional,Generic,HistoryOf,CodingScheme,Code,CUI,TUI,PreferredText,ValueBegin,ValueEnd,Value,Deleted,sKey,RepType)\r\n SELECT T.iID,T.DT,T.RepID,T.Tag,T.xmiID,T.iBegin,T.iEnd,T.Confidence,T.Polarity,T.Uncertainty,T.Conditional,T.Generic,T.HistoryOf,T.CodingScheme,T.Code,T.CUI,T.TUI,T.PreferredText,T.ValueBegin,T.ValueEnd,T.Value,T.Deleted,T.sKey,R.RepType\r\n FROM Recovery..tags T inner join Recovery..Reps R on T.RepID = R.RepID\r\n where T.iID between 2000001 and 4000000\r\n\r\n\r\n","link":"https://stackoverflow.com/questions/67908964/why-my-query-become-too-slow-when-number-of-records-increased","title":"Why my query become too slow when number of records increased","body":"<p>I have an insert statement in SQL Server.</p>\n<p>I tried it for a smaller subset, was fast</p>\n<p>increased the number to 1milllion records and was fast 1 min 10 sec</p>\n<p>now I doubled it and it seems stuck it has been running for 10 min now and no results</p>\n<p>I included the Plan when it was 5 min.</p>\n<p><a href=\"https://www.brentozar.com/pastetheplan/?id=r15MPuC5u\" rel=\"nofollow noreferrer\">https://www.brentozar.com/pastetheplan/?id=r15MPuC5u</a></p>\n<p>maybe someone can tell me how to improve the process.</p>\n<p>PS. I added non clustered index on Tag (RepID).</p>\n<p>Tag(iiD) is a primary Key</p>\n<p>Reps(RepID) is a primary Key.</p>\n<p>While I am writing this. the process finished at 11:47</p>\n<p><a href=\"https://www.brentozar.com/pastetheplan/?id=HJd9uOCcu\" rel=\"nofollow noreferrer\">https://www.brentozar.com/pastetheplan/?id=HJd9uOCcu</a></p>\n<p>Here is my code</p>\n<pre><code>insert into R3..Tags (iID,DT,RepID,Tag,xmiID,iBegin,iEnd,Confidence,Polarity,Uncertainty,Conditional,Generic,HistoryOf,CodingScheme,Code,CUI,TUI,PreferredText,ValueBegin,ValueEnd,Value,Deleted,sKey,RepType)\nSELECT T.iID,T.DT,T.RepID,T.Tag,T.xmiID,T.iBegin,T.iEnd,T.Confidence,T.Polarity,T.Uncertainty,T.Conditional,T.Generic,T.HistoryOf,T.CodingScheme,T.Code,T.CUI,T.TUI,T.PreferredText,T.ValueBegin,T.ValueEnd,T.Value,T.Deleted,T.sKey,R.RepType\nFROM Recovery..tags T inner join Recovery..Reps R on T.RepID = R.RepID\nwhere T.iID between 2000001 and 4000000\n</code></pre>\n"},{"tags":["javascript"],"comments":[{"owner":{"reputation":4717,"user_id":479156,"user_type":"registered","accept_rate":92,"profile_image":"https://i.stack.imgur.com/x9N3C.jpg?s=128&g=1","display_name":"Ivar","link":"https://stackoverflow.com/users/479156/ivar"},"edited":false,"score":0,"creation_date":1623259424,"post_id":67908963,"comment_id":120030716,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16073880,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5526fcc45828a5008925a70dc290cc16?s=128&d=identicon&r=PG&f=1","display_name":"kaciy68680","link":"https://stackoverflow.com/users/16073880/kaciy68680"},"is_answered":false,"view_count":11,"answer_count":0,"score":0,"last_activity_date":1623259370,"creation_date":1623259370,"question_id":67908963,"share_link":"https://stackoverflow.com/q/67908963","body_markdown":"I&#39;m new to JS can someone help me explain with words what is this\r\n```\r\n const newmode = pickBody.classList.contains(&#39;darkmode&#39;) ? &#39;darkmode&#39; : &#39;lightmode&#39;;\r\n```\r\nso how if and else is used in this case","link":"https://stackoverflow.com/questions/67908963/if-and-else-shortened","title":"If and Else shortened","body":"<p>I'm new to JS can someone help me explain with words what is this</p>\n<pre><code> const newmode = pickBody.classList.contains('darkmode') ? 'darkmode' : 'lightmode';\n</code></pre>\n<p>so how if and else is used in this case</p>\n"},{"tags":["flutter","android-studio","dart","flutter-layout"],"answers":[{"owner":{"reputation":613,"user_id":9138027,"user_type":"registered","profile_image":"https://i.stack.imgur.com/SpEvC.jpg?s=128&g=1","display_name":"Ali Yar Khan","link":"https://stackoverflow.com/users/9138027/ali-yar-khan"},"is_accepted":false,"score":0,"last_activity_date":1623259370,"creation_date":1623259370,"answer_id":67908962,"question_id":67902107,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":613,"user_id":9138027,"user_type":"registered","profile_image":"https://i.stack.imgur.com/SpEvC.jpg?s=128&g=1","display_name":"Ali Yar Khan","link":"https://stackoverflow.com/users/9138027/ali-yar-khan"},"is_answered":false,"view_count":21,"answer_count":1,"score":0,"last_activity_date":1623259370,"creation_date":1623233769,"question_id":67902107,"share_link":"https://stackoverflow.com/q/67902107","body_markdown":"I have this design which i want to create \r\n\r\n[![Bottom button image][1]][1]\r\n\r\n\r\nI have tried this code :\r\n\r\n @override\r\n Path getClip(Size size) {\r\n var path = Path();\r\n \r\n path.lineTo(0.0, size.height - 50);\r\n path.lineTo(size.width / 2 - 35 , size.height -50);\r\n \r\n path.quadraticBezierTo(size.width / 2 - 35 , size.height , size.width / 2 + 120 , size.height);\r\n \r\n path.quadraticBezierTo(size.width /2 + 35 , size.height, size.width / 2 + 35, size.height - 50);\r\n \r\n path.lineTo(size.width / 2 + size.width, size.height - 50);\r\n path.lineTo(size.width, 0.0);\r\n \r\n path.close();\r\n return path;\r\n \r\n \r\n }\r\n\r\nBut i am failing to do ... The result i am getting is \r\n\r\n[![My result][2]][2]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/5GiXt.jpg\r\n [2]: https://i.stack.imgur.com/CVDhq.png\r\n\r\nI can&#39;t understand what i am doing wrong. Pleas help me also i want that shadow as well after clipping at the bottom. but i am not getting that to make things visible i change the colour of scaffold to grey","link":"https://stackoverflow.com/questions/67902107/how-to-clip-the-container-with-half-circle-outward-in-bottom-center","title":"How to clip the container with half circle outward in bottom center","body":"<p>I have this design which i want to create</p>\n<p><a href=\"https://i.stack.imgur.com/5GiXt.jpg\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/5GiXt.jpg\" alt=\"Bottom button image\" /></a></p>\n<p>I have tried this code :</p>\n<pre><code>@override\n Path getClip(Size size) {\n var path = Path();\n\n path.lineTo(0.0, size.height - 50);\n path.lineTo(size.width / 2 - 35 , size.height -50);\n\n path.quadraticBezierTo(size.width / 2 - 35 , size.height , size.width / 2 + 120 , size.height);\n\n path.quadraticBezierTo(size.width /2 + 35 , size.height, size.width / 2 + 35, size.height - 50);\n\n path.lineTo(size.width / 2 + size.width, size.height - 50);\n path.lineTo(size.width, 0.0);\n\n path.close();\n return path;\n\n\n }\n</code></pre>\n<p>But i am failing to do ... The result i am getting is</p>\n<p><a href=\"https://i.stack.imgur.com/CVDhq.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/CVDhq.png\" alt=\"My result\" /></a></p>\n<p>I can't understand what i am doing wrong. Pleas help me also i want that shadow as well after clipping at the bottom. but i am not getting that to make things visible i change the colour of scaffold to grey</p>\n"},{"tags":["javascript","google-sheets-api"],"comments":[{"owner":{"reputation":1411,"user_id":5103577,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Okf5j.png?s=128&g=1","display_name":"Luke Borowy","link":"https://stackoverflow.com/users/5103577/luke-borowy"},"edited":false,"score":0,"creation_date":1623255883,"post_id":67908008,"comment_id":120029253,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":11,"user_id":15790364,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/-Wl25wDidqNY/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclne4ErijuCUDv6MilqD0L9JrTI8Q/s96-c/photo.jpg?sz=128","display_name":"light1","link":"https://stackoverflow.com/users/15790364/light1"},"reply_to_user":{"reputation":1411,"user_id":5103577,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Okf5j.png?s=128&g=1","display_name":"Luke Borowy","link":"https://stackoverflow.com/users/5103577/luke-borowy"},"edited":false,"score":0,"creation_date":1623257213,"post_id":67908008,"comment_id":120029862,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":1411,"user_id":5103577,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Okf5j.png?s=128&g=1","display_name":"Luke Borowy","link":"https://stackoverflow.com/users/5103577/luke-borowy"},"is_accepted":false,"score":0,"last_activity_date":1623259368,"last_edit_date":1623259368,"creation_date":1623258341,"answer_id":67908709,"question_id":67908008,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":11,"user_id":15790364,"user_type":"registered","profile_image":"https://lh6.googleusercontent.com/-Wl25wDidqNY/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuclne4ErijuCUDv6MilqD0L9JrTI8Q/s96-c/photo.jpg?sz=128","display_name":"light1","link":"https://stackoverflow.com/users/15790364/light1"},"is_answered":false,"view_count":18,"answer_count":1,"score":0,"last_activity_date":1623259368,"creation_date":1623255411,"question_id":67908008,"share_link":"https://stackoverflow.com/q/67908008","body_markdown":" var params1 = {\r\n spreadsheetId: &#39;Id&#39;, \r\n range: &quot;sheet 1!A2&quot;,\r\n };\r\n \r\n var clearValuesRequestBody = {\r\n };\r\n \r\n var request = await gapi.client.sheets.spreadsheets.values.clear(params1, clearValuesRequestBody);\r\n\r\nI am trying to delete a row in google sheets using google sheets API in javascript. But I am able to delete only the first cell of the row. I believe there has to be something in clear values request body but I don&#39;t know what. Also if you can suggest me how to remove that blank row that has been created by deleting this row, that would be great.","link":"https://stackoverflow.com/questions/67908008/how-to-delete-row-in-google-sheets-using-api-v4-in-javascript","title":"how to delete row in google sheets using api v4 in Javascript?","body":"<pre><code> var params1 = {\n spreadsheetId: 'Id', \n range: &quot;sheet 1!A2&quot;,\n };\n \n var clearValuesRequestBody = {\n };\n \n var request = await gapi.client.sheets.spreadsheets.values.clear(params1, clearValuesRequestBody);\n</code></pre>\n<p>I am trying to delete a row in google sheets using google sheets API in javascript. But I am able to delete only the first cell of the row. I believe there has to be something in clear values request body but I don't know what. Also if you can suggest me how to remove that blank row that has been created by deleting this row, that would be great.</p>\n"},{"tags":["azure","azure-active-directory","azure-ad-b2c","azure-ad-b2c-custom-policy"],"owner":{"reputation":541,"user_id":1918727,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/88505b04605caa05be0ad1606e5133e1?s=128&d=identicon&r=PG&f=1","display_name":"J.J","link":"https://stackoverflow.com/users/1918727/j-j"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259359,"creation_date":1623259359,"question_id":67908959,"share_link":"https://stackoverflow.com/q/67908959","body_markdown":"I want to allow multiple Azure AD customers to sign-in into my app using their own AAD accounts.\r\n\r\nFor that I was considering this tutorial [Set up sign-in for multi-tenant Azure Active Directory using custom policies in Azure Active Directory B2C](https://docs.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-azure-ad-multi-tenant?pivots=b2c-custom-policy), but in the section &quot;***Configure Azure AD as an identity provider***&quot; **point 5** says &quot;*Under the TechnicalProfile element, update the value for DisplayName, for example, Contoso Employee. This value is displayed on the sign-in button on your sign-in page.*&quot;\r\n\r\nBy reading that section it seems to me that I will end up with an array of buttons, one for each AAD customer.\r\n\r\nIs it possible to have a single button, like &quot;Work account&quot; to encapsulate all possible AAD tenants? and then internally figure out which ones is the right one?(maybe based on email domain..)","link":"https://stackoverflow.com/questions/67908959/set-up-sign-in-for-multi-tenant-azure-active-directory-single-button-for-all-t","title":"Set up sign-in for multi-tenant Azure Active Directory - Single Button for all tenants","body":"<p>I want to allow multiple Azure AD customers to sign-in into my app using their own AAD accounts.</p>\n<p>For that I was considering this tutorial <a href=\"https://docs.microsoft.com/en-us/azure/active-directory-b2c/identity-provider-azure-ad-multi-tenant?pivots=b2c-custom-policy\" rel=\"nofollow noreferrer\">Set up sign-in for multi-tenant Azure Active Directory using custom policies in Azure Active Directory B2C</a>, but in the section &quot;<em><strong>Configure Azure AD as an identity provider</strong></em>&quot; <strong>point 5</strong> says &quot;<em>Under the TechnicalProfile element, update the value for DisplayName, for example, Contoso Employee. This value is displayed on the sign-in button on your sign-in page.</em>&quot;</p>\n<p>By reading that section it seems to me that I will end up with an array of buttons, one for each AAD customer.</p>\n<p>Is it possible to have a single button, like &quot;Work account&quot; to encapsulate all possible AAD tenants? and then internally figure out which ones is the right one?(maybe based on email domain..)</p>\n"},{"tags":["sql","group-by"],"comments":[{"owner":{"reputation":3307,"user_id":1459036,"user_type":"registered","accept_rate":56,"profile_image":"https://i.stack.imgur.com/yeDJp.jpg?s=128&g=1","display_name":"Brad","link":"https://stackoverflow.com/users/1459036/brad"},"edited":false,"score":1,"creation_date":1623153965,"post_id":67886455,"comment_id":119991366,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":672,"user_id":4594961,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/30a5323629c0d684810a8c996965299c?s=128&d=identicon&r=PG&f=1","display_name":"Marko Ivkovic","link":"https://stackoverflow.com/users/4594961/marko-ivkovic"},"edited":false,"score":1,"creation_date":1623153977,"post_id":67886455,"comment_id":119991376,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":158,"user_id":16119285,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b406f241444f9a189020055819cb3c0b?s=128&d=identicon&r=PG&f=1","display_name":"banana_99","link":"https://stackoverflow.com/users/16119285/banana-99"},"edited":false,"score":0,"creation_date":1623155414,"post_id":67886455,"comment_id":119992042,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":38271,"user_id":905902,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a18869332564b1c3dfad9586d37095b2?s=128&d=identicon&r=PG","display_name":"wildplasser","link":"https://stackoverflow.com/users/905902/wildplasser"},"edited":false,"score":0,"creation_date":1623156765,"post_id":67886455,"comment_id":119992661,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":429,"user_id":10293830,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-Zs3buhL4ipA/AAAAAAAAAAI/AAAAAAAAAAA/APUIFaPvo3joFAuJJsZ8thzVW4kBg4gkdg/mo/photo.jpg?sz=128","display_name":"PankajSanwal","link":"https://stackoverflow.com/users/10293830/pankajsanwal"},"is_accepted":false,"score":0,"last_activity_date":1623157101,"creation_date":1623157101,"answer_id":67887452,"question_id":67886455,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":48,"user_id":9531348,"user_type":"registered","profile_image":"https://i.stack.imgur.com/9LPzr.png?s=128&g=1","display_name":"DvirB","link":"https://stackoverflow.com/users/9531348/dvirb"},"is_accepted":false,"score":0,"last_activity_date":1623157608,"creation_date":1623157608,"answer_id":67887587,"question_id":67886455,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16163856,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/acda53d44c9e7cecda2074ad6f40dbaf?s=128&d=identicon&r=PG&f=1","display_name":"Cancillero","link":"https://stackoverflow.com/users/16163856/cancillero"},"is_answered":false,"view_count":44,"closed_date":1623162012,"answer_count":2,"score":0,"last_activity_date":1623259358,"creation_date":1623153569,"last_edit_date":1623259358,"question_id":67886455,"share_link":"https://stackoverflow.com/q/67886455","body_markdown":"I have a table like attached. I want to write a query where the column `Status` changes if a `Group` has a row with type `Reexam` and if the corresponding `Group` has status `Passed`. E.g., the `Status` should change to `Passed` for the whole group.\r\n\r\nAttached example\r\n\r\n[![example][1]][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/0tVNf.png","link":"https://stackoverflow.com/questions/67886455/select-rows-by-a-common-column-and-display-them-with-different-values","closed_reason":"Needs details or clarity","title":"SELECT rows by a common column and display them with different values","body":"<p>I have a table like attached. I want to write a query where the column <code>Status</code> changes if a <code>Group</code> has a row with type <code>Reexam</code> and if the corresponding <code>Group</code> has status <code>Passed</code>. E.g., the <code>Status</code> should change to <code>Passed</code> for the whole group.</p>\n<p>Attached example</p>\n<p><a href=\"https://i.stack.imgur.com/0tVNf.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/0tVNf.png\" alt=\"example\" /></a></p>\n"},{"tags":["azure","azure-web-app-service"],"owner":{"reputation":48,"user_id":8545033,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ed98a45259e197b36dfb72f313a4cffd?s=128&d=identicon&r=PG&f=1","display_name":"Alec Jones","link":"https://stackoverflow.com/users/8545033/alec-jones"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259358,"creation_date":1623259358,"question_id":67908958,"share_link":"https://stackoverflow.com/q/67908958","body_markdown":"I&#39;m trying to pull my changes from the git repository but I got the error **Filename too long**.\r\n\r\nTo resolve this issue, I tried running the command `git config --system core.longpaths true` but I get `Permission denied error: could not lock config file` error. I think this is normal because running the command above requires admin CLI.\r\n\r\nWould like to ask if there&#39;s any way I can enable the longpaths in azure web app service?\r\n\r\n","link":"https://stackoverflow.com/questions/67908958/file-name-too-long-in-azure-web-app-service-ci-cd","title":"File name too long in Azure Web App Service CI/CD","body":"<p>I'm trying to pull my changes from the git repository but I got the error <strong>Filename too long</strong>.</p>\n<p>To resolve this issue, I tried running the command <code>git config --system core.longpaths true</code> but I get <code>Permission denied error: could not lock config file</code> error. I think this is normal because running the command above requires admin CLI.</p>\n<p>Would like to ask if there's any way I can enable the longpaths in azure web app service?</p>\n"},{"tags":["c"],"comments":[{"owner":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":1,"creation_date":1623256295,"post_id":67908167,"comment_id":120029436,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":1,"creation_date":1623256343,"post_id":67908167,"comment_id":120029459,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":2,"creation_date":1623256363,"post_id":67908167,"comment_id":120029470,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":1,"creation_date":1623256408,"post_id":67908167,"comment_id":120029488,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":109,"user_id":11478529,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/29b4713b937df82a2612d28bd03b5564?s=128&d=identicon&r=PG&f=1","display_name":"Akil","link":"https://stackoverflow.com/users/11478529/akil"},"reply_to_user":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":0,"creation_date":1623256436,"post_id":67908167,"comment_id":120029509,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":175231,"user_id":140750,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/4c7af12cad08c95bc206a9636d164224?s=128&d=identicon&r=PG","display_name":"William Pursell","link":"https://stackoverflow.com/users/140750/william-pursell"},"is_accepted":false,"score":0,"last_activity_date":1623256517,"creation_date":1623256517,"answer_id":67908273,"question_id":67908167,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":3001,"user_id":4228131,"user_type":"registered","accept_rate":100,"profile_image":"https://i.stack.imgur.com/RyKUe.jpg?s=128&g=1","display_name":"WedaPashi","link":"https://stackoverflow.com/users/4228131/wedapashi"},"is_accepted":false,"score":0,"last_activity_date":1623258536,"last_edit_date":1623258536,"creation_date":1623257546,"answer_id":67908550,"question_id":67908167,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":109,"user_id":11478529,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/29b4713b937df82a2612d28bd03b5564?s=128&d=identicon&r=PG&f=1","display_name":"Akil","link":"https://stackoverflow.com/users/11478529/akil"},"is_answered":false,"view_count":41,"answer_count":2,"score":0,"last_activity_date":1623259358,"creation_date":1623256086,"last_edit_date":1623259358,"question_id":67908167,"share_link":"https://stackoverflow.com/q/67908167","body_markdown":"I am solving a problem in which I have a date (YYYY-MM-DD) as user input and I need to find out the day(Sunday, Monday,.. ). I have tried to remove the hyphen so that I can proceed with Zellor&#39;s rule. To achieve that I used a loop. However, it doesn&#39;t seem to work.\r\nHere&#39;s is my code:\r\n\r\n #include&lt;stdio.h&gt;\r\n int main(){\r\n char date[11], datenum[9]; \r\n int date_num;\r\n printf(&quot;Enter the date in yyyy-mm-dd format\\n&quot;);\r\n scanf(&quot;%s&quot;, &amp;date);\r\n int j = 0;\r\n for (int i=0; i&lt;10; i++){\r\n if (date[i]!=&#39;-&#39; &amp;&amp; j&lt;8){\r\n datenum[j] = date[i];\r\n\r\n j++;\r\n }\r\n } \r\n printf(&quot;%s\\n&quot;, datenum);\r\n return 0;\r\n }\r\nI was expecting 20210609 as output when I gave 2021-06-09 as input but that doesn&#39;t seem to be the case. Instead, I got 202106092021-06-09.","link":"https://stackoverflow.com/questions/67908167/trying-to-remove-hyphens-from-a-string-in-c","title":"Trying to remove hyphens from a string in C","body":"<p>I am solving a problem in which I have a date (YYYY-MM-DD) as user input and I need to find out the day(Sunday, Monday,.. ). I have tried to remove the hyphen so that I can proceed with Zellor's rule. To achieve that I used a loop. However, it doesn't seem to work.\nHere's is my code:</p>\n<pre><code>#include&lt;stdio.h&gt;\nint main(){\n char date[11], datenum[9]; \n int date_num;\n printf(&quot;Enter the date in yyyy-mm-dd format\\n&quot;);\n scanf(&quot;%s&quot;, &amp;date);\n int j = 0;\n for (int i=0; i&lt;10; i++){\n if (date[i]!='-' &amp;&amp; j&lt;8){\n datenum[j] = date[i];\n\n j++;\n }\n } \n printf(&quot;%s\\n&quot;, datenum);\n return 0;\n}\n</code></pre>\n<p>I was expecting 20210609 as output when I gave 2021-06-09 as input but that doesn't seem to be the case. Instead, I got 202106092021-06-09.</p>\n"},{"tags":["python","pandas","pandas-groupby"],"owner":{"reputation":53,"user_id":12489364,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AAuE7mC3ZFowV-wqtW5plJtElEs1g7LEbfYt9C6W6y58Sw=k-s128","display_name":"Dan Murphy","link":"https://stackoverflow.com/users/12489364/dan-murphy"},"is_answered":false,"view_count":9,"answer_count":0,"score":0,"last_activity_date":1623259358,"creation_date":1623259358,"question_id":67908957,"share_link":"https://stackoverflow.com/q/67908957","body_markdown":"I have a dataframe with 3 columns, Date, Time and Usage. The times are in 15 minute intervals (some intervals may/will be missing). The Date column lists every day in the month (possible to have more than one month).\r\n\r\nThe goal is to sum up the usage values by hour per day per month. I was able to accomplish this with a groupby, but it creates a multi-index Series. When I try adding &quot;reset_index()&quot; to the end of my groupby I get an error since I am using the same column twice (once by month and once by day). I have a feeling I need to alias my columns so I can then flatten the multi-index but I&#39;m not sure how.\r\n\r\n*note I know I can just create &quot;helper&quot; columns for the day and hour and use those in my groupby, but I was hoping to not have to do that. \r\n\r\n import pandas as pd\r\n \r\n df = pd.read_csv(&#39;Interval Data&#39;, sep=&#39;;&#39;)\r\n \r\n df.columns = df.columns.str.replace(&#39; &#39;, &#39;&#39;)\r\n df = df[[&#39;END_TIME&#39;, &#39;USAGE_DATE&#39;, &#39;USAGE&#39;]]\r\n df[&#39;END_TIME&#39;] = pd.to_datetime(df[&#39;END_TIME&#39;])\r\n df[&#39;USAGE_DATE&#39;] = pd.to_datetime(df[&#39;USAGE_DATE&#39;])\r\n \r\n grp_df = df.groupby([df.USAGE_DATE.dt.month, df.USAGE_DATE.dt.day, df.END_TIME.dt.hour])[&#39;USAGE&#39;].sum()\r\n \r\n print(grp_df.head())\r\n\r\n","link":"https://stackoverflow.com/questions/67908957/python-pandas-dataframe-difficulties-flattening-after-groupby","title":"Python Pandas DataFrame difficulties flattening after GroupBy","body":"<p>I have a dataframe with 3 columns, Date, Time and Usage. The times are in 15 minute intervals (some intervals may/will be missing). The Date column lists every day in the month (possible to have more than one month).</p>\n<p>The goal is to sum up the usage values by hour per day per month. I was able to accomplish this with a groupby, but it creates a multi-index Series. When I try adding &quot;reset_index()&quot; to the end of my groupby I get an error since I am using the same column twice (once by month and once by day). I have a feeling I need to alias my columns so I can then flatten the multi-index but I'm not sure how.</p>\n<p>*note I know I can just create &quot;helper&quot; columns for the day and hour and use those in my groupby, but I was hoping to not have to do that.</p>\n<pre><code>import pandas as pd\n\ndf = pd.read_csv('Interval Data', sep=';')\n\ndf.columns = df.columns.str.replace(' ', '')\ndf = df[['END_TIME', 'USAGE_DATE', 'USAGE']]\ndf['END_TIME'] = pd.to_datetime(df['END_TIME'])\ndf['USAGE_DATE'] = pd.to_datetime(df['USAGE_DATE'])\n\ngrp_df = df.groupby([df.USAGE_DATE.dt.month, df.USAGE_DATE.dt.day, df.END_TIME.dt.hour])['USAGE'].sum()\n\nprint(grp_df.head())\n</code></pre>\n"},{"tags":["javascript","node.js","next.js","serverless","vercel"],"owner":{"reputation":23,"user_id":12302959,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/47ec7ff6e00b42135ec6a1effc594401?s=128&d=identicon&r=PG&f=1","display_name":"Alina Homyakova","link":"https://stackoverflow.com/users/12302959/alina-homyakova"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259357,"creation_date":1623259357,"question_id":67908956,"share_link":"https://stackoverflow.com/q/67908956","body_markdown":"This code gets the bitcoin rate on usual js.\r\n \r\n function getRate(){\r\n \t// https://api.coindesk.com/v1/bpi/currentprice.json\r\n \t$.get(\r\n \t\t&quot;https://api.coindesk.com/v1/bpi/currentprice.json&quot;,\r\n \t\tfunction(data){\r\n \t\t\tdata = JSON.parse(data);\r\n \t\t\tconsole.log(data);\r\n \t\t}\r\n \t);\r\n }\r\n \r\n function getHistoryRate(){\r\n \t// https://api.coindesk.com/v1/bpi/currentprice.json\r\n \t$.get(\r\n \t\t&quot;https://api.coindesk.com/v1/bpi/historical/close.json&quot;,\r\n \t\t{\r\n \t\t\t&quot;start&quot; : $(&#39;#date1&#39;).val(),\r\n \t\t\t&quot;end&quot; : $(&#39;#date2&#39;).val()\r\n \t\t},\r\n \t\tfunction(data){\r\n \t\t\tdata = JSON.parse(data);\r\n \t\t\tconsole.log(data);\r\n \t\t}\r\n \t);\r\n }\r\n\r\n\r\nHow to realize the same logic using Next.js and Vercel serverless functions?","link":"https://stackoverflow.com/questions/67908956/how-to-use-correctly-serverless-functions-to-get-bitcoin-rate","title":"How to use correctly serverless functions to get Bitcoin rate?","body":"<p>This code gets the bitcoin rate on usual js.</p>\n<pre><code>function getRate(){\n // https://api.coindesk.com/v1/bpi/currentprice.json\n $.get(\n &quot;https://api.coindesk.com/v1/bpi/currentprice.json&quot;,\n function(data){\n data = JSON.parse(data);\n console.log(data);\n }\n );\n}\n\nfunction getHistoryRate(){\n // https://api.coindesk.com/v1/bpi/currentprice.json\n $.get(\n &quot;https://api.coindesk.com/v1/bpi/historical/close.json&quot;,\n {\n &quot;start&quot; : $('#date1').val(),\n &quot;end&quot; : $('#date2').val()\n },\n function(data){\n data = JSON.parse(data);\n console.log(data);\n }\n );\n}\n</code></pre>\n<p>How to realize the same logic using Next.js and Vercel serverless functions?</p>\n"},{"tags":["flutter","dart"],"owner":{"reputation":1,"user_id":15454445,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a99de6a7ef1f09a888f0938f61b1c74b?s=128&d=identicon&r=PG&f=1","display_name":"Mohamed Salah","link":"https://stackoverflow.com/users/15454445/mohamed-salah"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259355,"creation_date":1623259355,"question_id":67908955,"share_link":"https://stackoverflow.com/q/67908955","body_markdown":"I&#39;m using Flutter and I need to create a simple **mobile application** that open a webpage then click on the elements .\r\n\r\nfor example open YouTube and login with user and password then search for a word (**programmatically when I click a button**).\r\n\r\nI created python script that doing all of that using selenium but I couldn&#39;t convert it to apk.\r\n\r\nso I&#39;m trying to learn flutter to build it (and if there is easier way to create mobile app just tell me) **so** just tell me the steps for creating this Flutter app that doing these tasks automatically. \r\n\r\nThanks. \r\n","link":"https://stackoverflow.com/questions/67908955/flutter-automatically-open-webpage-then-click-elements","title":"Flutter automatically open webpage, then click elements","body":"<p>I'm using Flutter and I need to create a simple <strong>mobile application</strong> that open a webpage then click on the elements .</p>\n<p>for example open YouTube and login with user and password then search for a word (<strong>programmatically when I click a button</strong>).</p>\n<p>I created python script that doing all of that using selenium but I couldn't convert it to apk.</p>\n<p>so I'm trying to learn flutter to build it (and if there is easier way to create mobile app just tell me) <strong>so</strong> just tell me the steps for creating this Flutter app that doing these tasks automatically.</p>\n<p>Thanks.</p>\n"},{"tags":["javascript","css","slick.js"],"answers":[{"owner":{"reputation":1060,"user_id":6398325,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/166a2efcf4426448f22068976b35a281?s=128&d=identicon&r=PG&f=1","display_name":"Gunther","link":"https://stackoverflow.com/users/6398325/gunther"},"is_accepted":false,"score":0,"last_activity_date":1623259355,"last_edit_date":1623259355,"creation_date":1623254243,"answer_id":67907714,"question_id":67905648,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":27,"user_id":7873564,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-9qqKI43jxik/AAAAAAAAAAI/AAAAAAAAB1g/ptrCcxi77Lc/photo.jpg?sz=128","display_name":"Xavier Godbout","link":"https://stackoverflow.com/users/7873564/xavier-godbout"},"is_answered":false,"view_count":15,"answer_count":1,"score":1,"last_activity_date":1623259355,"creation_date":1623247147,"last_edit_date":1623252497,"question_id":67905648,"share_link":"https://stackoverflow.com/q/67905648","body_markdown":"I&#39;m trying to create a timeline using Slick carousel. What I&#39;m trying to achieve is as you progress in the timeline, all the previous slides stay colored and when you go back they turn back to grey. I tried my best with onAfterChange and onBeforeChange but I can&#39;t target multiple previous slides, only the last previous slides.\r\n\r\nHere&#39;s a JSFiddle of my timeline : https://jsfiddle.net/23wL9ymv/\r\n\r\n\r\n----------\r\nhtml\r\n\r\n &lt;div class=&quot;wrapper&quot;&gt;\r\n &lt;div class=&quot;carrousel__candidature__timeline&quot;&gt;\r\n &lt;div class=&quot;timeline-item p&quot;&gt;Architecture&lt;/div&gt;\r\n &lt;div class=&quot;timeline-item p&quot;&gt;Design dint&#233;rieur&lt;/div&gt;\r\n &lt;div class=&quot;timeline-item p&quot;&gt;Accr&#233;dit&#233;s LEED&lt;/div&gt;\r\n &lt;div class=&quot;timeline-item p&quot;&gt;Sp&#233;cialiste codes&lt;/div&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n\r\n\r\n----------\r\ncss\r\n\r\n .wrapper {\r\n max-width: 800px;\r\n }\r\n\r\n .slick-list {\r\n \twidth: 100%;\r\n }\r\n\r\n .carrousel__candidature__timeline {\r\n \t\t\t\t.timeline-item {\r\n \t\t\t\t\twidth: auto;\r\n \t\t\t\t\theight: auto;\r\n \t\t\t\t\tbackground: transparent;\r\n \t\t\t\t\tmargin-bottom: 20px !important;\r\n \t\t\t\t\tposition: relative;\r\n \t\t\t\t\tfont-size: 14px;\r\n \t\t\t\t\tline-height: 28px;\r\n \t\t\t\t\tfont-weight: 400;\r\n \t\t\t\t\toutline: none;\r\n \t\t\t\t\tcursor: pointer;\r\n \t\t\t\t\tcolor: grey;\r\n \r\n \t\t\t\t\t&amp;::before {\r\n \t\t\t\t\t\tcontent: &quot;&quot;;\r\n \t\t\t\t\t\tposition: absolute;\r\n \t\t\t\t\t\ttop: 36px;\r\n \t\t\t\t\t\tleft: -100%;\r\n \t\t\t\t\t\twidth: 100%;\r\n \t\t\t\t\t\theight: 2px;\r\n \t\t\t\t\t\tbackground-color: grey;\r\n \t\t\t\t\t\ttransition: 0.2s;\t\r\n \t\t\t\t\t}\r\n \r\n \t\t\t\t\t&amp;::after {\r\n \t\t\t\t\t\tcontent: &quot;&quot;;\r\n \t\t\t\t\t\tposition: absolute;\r\n \t\t\t\t\t\ttop: 30px;\r\n \t\t\t\t\t\tleft: 0;\r\n \t\t\t\t\t\twidth: 15px;\r\n \t\t\t\t\t\theight: 15px;\r\n \t\t\t\t\t\tborder-radius: 100%;\r\n \t\t\t\t\t\tbackground-color: grey;\r\n \t\t\t\t\t\ttransition: 0.2s;\r\n \t\t\t\t\t\tz-index: 1000;\r\n \t\t\t\t\t}\r\n \r\n \t\t\t\t\t&amp;.slick-current {\r\n \t\t\t\t\t\tcolor: red;\r\n \t\t\t\t\t}\r\n\r\n &amp;.slick-current::before {\r\n background-color: red;\r\n }\r\n\r\n &amp;.slick-current::after {\r\n background-color: red;\r\n }\r\n \t\t\t\t}\r\n \t\t\t}\r\n\r\n\r\n----------\r\njs\r\n\r\n $(&#39;.carrousel__candidature__timeline&#39;).slick({\r\n \tslidesToShow: 4,\r\n \tSlideToScroll: 1,\r\n asNavFor: &#39;.carrousel__candidature__content&#39;,\r\n centerMode: false,\r\n focusOnSelect: true,\r\n mobileFirst: true,\r\n \tarrows: false,\r\n \tdots: false,\r\n \tinfinite: false,\r\n \tvariableWidth: false\r\n });\r\n\r\n\r\n\r\n [1]: https://jsfiddle.net/23wL9ymv/","link":"https://stackoverflow.com/questions/67905648/add-class-to-multiple-previous-slides-with-slick-carrousel","title":"Add class to multiple previous slides with Slick carrousel","body":"<p>I'm trying to create a timeline using Slick carousel. What I'm trying to achieve is as you progress in the timeline, all the previous slides stay colored and when you go back they turn back to grey. I tried my best with onAfterChange and onBeforeChange but I can't target multiple previous slides, only the last previous slides.</p>\n<p>Here's a JSFiddle of my timeline : <a href=\"https://jsfiddle.net/23wL9ymv/\" rel=\"nofollow noreferrer\">https://jsfiddle.net/23wL9ymv/</a></p>\n<hr />\n<p>html</p>\n<pre><code>&lt;div class=&quot;wrapper&quot;&gt;\n &lt;div class=&quot;carrousel__candidature__timeline&quot;&gt;\n &lt;div class=&quot;timeline-item p&quot;&gt;Architecture&lt;/div&gt;\n &lt;div class=&quot;timeline-item p&quot;&gt;Design dintérieur&lt;/div&gt;\n &lt;div class=&quot;timeline-item p&quot;&gt;Accrédités LEED&lt;/div&gt;\n &lt;div class=&quot;timeline-item p&quot;&gt;Spécialiste codes&lt;/div&gt;\n &lt;/div&gt;\n&lt;/div&gt;\n</code></pre>\n<hr />\n<p>css</p>\n<pre><code>.wrapper {\n max-width: 800px;\n}\n\n.slick-list {\n width: 100%;\n}\n\n.carrousel__candidature__timeline {\n .timeline-item {\n width: auto;\n height: auto;\n background: transparent;\n margin-bottom: 20px !important;\n position: relative;\n font-size: 14px;\n line-height: 28px;\n font-weight: 400;\n outline: none;\n cursor: pointer;\n color: grey;\n\n &amp;::before {\n content: &quot;&quot;;\n position: absolute;\n top: 36px;\n left: -100%;\n width: 100%;\n height: 2px;\n background-color: grey;\n transition: 0.2s; \n }\n\n &amp;::after {\n content: &quot;&quot;;\n position: absolute;\n top: 30px;\n left: 0;\n width: 15px;\n height: 15px;\n border-radius: 100%;\n background-color: grey;\n transition: 0.2s;\n z-index: 1000;\n }\n\n &amp;.slick-current {\n color: red;\n }\n\n &amp;.slick-current::before {\n background-color: red;\n }\n\n &amp;.slick-current::after {\n background-color: red;\n }\n }\n }\n</code></pre>\n<hr />\n<p>js</p>\n<pre><code>$('.carrousel__candidature__timeline').slick({\n slidesToShow: 4,\n SlideToScroll: 1,\n asNavFor: '.carrousel__candidature__content',\n centerMode: false,\n focusOnSelect: true,\n mobileFirst: true,\n arrows: false,\n dots: false,\n infinite: false,\n variableWidth: false\n});\n</code></pre>\n"},{"tags":["python","deep-learning","google-colaboratory","streamlit"],"answers":[{"owner":{"reputation":1572,"user_id":13573168,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/526b271be828738bc7b071c5abdc8eff?s=128&d=identicon&r=PG&f=1","display_name":"Prakash Dahal","link":"https://stackoverflow.com/users/13573168/prakash-dahal"},"is_accepted":false,"score":0,"last_activity_date":1623162681,"last_edit_date":1623162681,"creation_date":1623161645,"answer_id":67888788,"question_id":67883973,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16162477,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyG2faDJHyB45cgXllXzMuM1wHf48aSBzODtpY1=k-s128","display_name":"Annadata Alekhya","link":"https://stackoverflow.com/users/16162477/annadata-alekhya"},"is_answered":false,"view_count":31,"answer_count":1,"score":-2,"last_activity_date":1623259354,"creation_date":1623140483,"last_edit_date":1623259354,"question_id":67883973,"share_link":"https://stackoverflow.com/q/67883973","body_markdown":"I am getting this error even after doing reset runtime . That process didn&#39;t work for me . Suggest another way.\r\n\r\n ContextualVersionConflict Traceback (most recent call last)\r\n &lt;ipython-input-2-8f70969ba6d2&gt; in &lt;module&gt;()\r\n 2 import numpy as np\r\n 3 import cv2\r\n ----&gt; 4 import streamlit as st\r\n 5 from tensorflow import keras\r\n 6 from tensorflow.keras.models import load_model\r\n \r\n 4 frames\r\n /usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)\r\n 775 # Oops, the &quot;best&quot; so far conflicts with a dependency\r\n 776 dependent_req = required_by[req]\r\n --&gt; 777 raise VersionConflict(dist, req).with_context(dependent_req)\r\n 778 \r\n 779 # push the new requirements onto the stack\r\n \r\n ContextualVersionConflict: (ipykernel 4.10.1 (/usr/local/lib/python3.7/dist-packages), Requirement.parse(&#39;ipykernel&gt;=5.1.2; python_version &gt;= &quot;3.4&quot;&#39;), {&#39;pydeck&#39;})","link":"https://stackoverflow.com/questions/67883973/contextualversionconflict-error-while-importing-streamlit-in-google-colab","title":"ContextualVersionConflict : Error while importing streamlit in Google Colab","body":"<p>I am getting this error even after doing reset runtime . That process didn't work for me . Suggest another way.</p>\n<pre><code>ContextualVersionConflict Traceback (most recent call last)\n&lt;ipython-input-2-8f70969ba6d2&gt; in &lt;module&gt;()\n 2 import numpy as np\n 3 import cv2\n----&gt; 4 import streamlit as st\n 5 from tensorflow import keras\n 6 from tensorflow.keras.models import load_model\n\n4 frames\n/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py in resolve(self, requirements, env, installer, replace_conflicting, extras)\n 775 # Oops, the &quot;best&quot; so far conflicts with a dependency\n 776 dependent_req = required_by[req]\n--&gt; 777 raise VersionConflict(dist, req).with_context(dependent_req)\n 778 \n 779 # push the new requirements onto the stack\n\nContextualVersionConflict: (ipykernel 4.10.1 (/usr/local/lib/python3.7/dist-packages), Requirement.parse('ipykernel&gt;=5.1.2; python_version &gt;= &quot;3.4&quot;'), {'pydeck'})\n</code></pre>\n"},{"tags":["angular","checkbox"],"comments":[{"owner":{"reputation":812,"user_id":5964111,"user_type":"registered","profile_image":"https://i.stack.imgur.com/JMst9.jpg?s=128&g=1","display_name":"tmsbrndz","link":"https://stackoverflow.com/users/5964111/tmsbrndz"},"edited":false,"score":1,"creation_date":1623258248,"post_id":67908545,"comment_id":120030273,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":61,"user_id":10618245,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8bd6d582c65525950f7b6149af109345?s=128&d=identicon&r=PG&f=1","display_name":"Paul James","link":"https://stackoverflow.com/users/10618245/paul-james"},"edited":false,"score":0,"creation_date":1623258308,"post_id":67908545,"comment_id":120030292,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1011,"user_id":8760028,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/63b1af9245d3c42448c0a0b5efe04ce1?s=128&d=identicon&r=PG&f=1","display_name":"pranami","link":"https://stackoverflow.com/users/8760028/pranami"},"edited":false,"score":0,"creation_date":1623258498,"post_id":67908545,"comment_id":120030355,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":2939,"user_id":7025699,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0215d7583f9677b077a5a183d9bfd5d7?s=128&d=identicon&r=PG&f=1","display_name":"Apoorva Chikara","link":"https://stackoverflow.com/users/7025699/apoorva-chikara"},"edited":false,"score":0,"creation_date":1623258839,"post_id":67908545,"comment_id":120030480,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1011,"user_id":8760028,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/63b1af9245d3c42448c0a0b5efe04ce1?s=128&d=identicon&r=PG&f=1","display_name":"pranami","link":"https://stackoverflow.com/users/8760028/pranami"},"reply_to_user":{"reputation":2939,"user_id":7025699,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0215d7583f9677b077a5a183d9bfd5d7?s=128&d=identicon&r=PG&f=1","display_name":"Apoorva Chikara","link":"https://stackoverflow.com/users/7025699/apoorva-chikara"},"edited":false,"score":0,"creation_date":1623259374,"post_id":67908545,"comment_id":120030692,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1011,"user_id":8760028,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/63b1af9245d3c42448c0a0b5efe04ce1?s=128&d=identicon&r=PG&f=1","display_name":"pranami","link":"https://stackoverflow.com/users/8760028/pranami"},"is_answered":false,"view_count":17,"answer_count":0,"score":0,"last_activity_date":1623259350,"creation_date":1623257527,"last_edit_date":1623259350,"question_id":67908545,"share_link":"https://stackoverflow.com/q/67908545","body_markdown":"I have a list of checkboxes as shown below:\r\n\r\n &lt;div class=&quot;col-md-4 md-padding&quot; *ngFor=&quot;let node of nodeList; let j=index;&quot;&gt;\r\n &lt;md-checkbox-group&gt;\r\n &lt;md-checkbox\r\n class=&quot;md-h6 row md-padding--xs&quot;\r\n name=&quot;{{node.FQDN}}&quot;\r\n label=&quot;{{node.FQDN}}&quot;\r\n value=&quot;{{node.FQDN}}&quot;\r\n required=&quot;true&quot;\r\n htmlId=&quot;filter_label_{{j}}&quot;\r\n (click)=&quot;updatefilter(node.FQDN)&quot;\r\n [formControlName]=&quot;servers&quot;\r\n [(ngModel)]=&quot;node.selected&quot;&gt;\r\n &lt;/md-checkbox&gt;\r\n \r\n \r\n &lt;/md-checkbox-group&gt;\r\n \r\n \r\n &lt;/div&gt;\r\n\r\nI have to check if the checbox is checked or unchecked. How do I proceed?\r\n\r\nEdit 1: The node array object has the following attributes:\r\n\r\n [\r\n {\r\n DNSResolved: &quot;true&quot;,\r\n FQDN: &quot;sa-103.abc.com&quot;,\r\n HostName: &quot;sa-103&quot;,\r\n Role: &quot; Voice/Video&quot;,\r\n productTypeId: &quot;1&quot;\r\n },\r\n\r\n {\r\n DNSResolved: &quot;true&quot;,\r\n FQDN: &quot;sa-104.abc.com&quot;,\r\n HostName: &quot;sa-104&quot;,\r\n Role: &quot; Voice/Video&quot;,\r\n productTypeId: &quot;1&quot;\r\n },\r\n\r\n {\r\n DNSResolved: &quot;true&quot;,\r\n FQDN: &quot;sa-105.abc.com&quot;,\r\n HostName: &quot;sa-105&quot;,\r\n Role: &quot; Voice/Video&quot;,\r\n productTypeId: &quot;1&quot;\r\n }","link":"https://stackoverflow.com/questions/67908545/how-do-i-get-the-checked-and-unchecked-values-of-a-checkbox-in-angular","title":"How do I get the checked and unchecked values of a checkbox in angular","body":"<p>I have a list of checkboxes as shown below:</p>\n<pre><code> &lt;div class=&quot;col-md-4 md-padding&quot; *ngFor=&quot;let node of nodeList; let j=index;&quot;&gt;\n &lt;md-checkbox-group&gt;\n &lt;md-checkbox\n class=&quot;md-h6 row md-padding--xs&quot;\n name=&quot;{{node.FQDN}}&quot;\n label=&quot;{{node.FQDN}}&quot;\n value=&quot;{{node.FQDN}}&quot;\n required=&quot;true&quot;\n htmlId=&quot;filter_label_{{j}}&quot;\n (click)=&quot;updatefilter(node.FQDN)&quot;\n [formControlName]=&quot;servers&quot;\n [(ngModel)]=&quot;node.selected&quot;&gt;\n &lt;/md-checkbox&gt;\n\n\n &lt;/md-checkbox-group&gt;\n\n\n &lt;/div&gt;\n</code></pre>\n<p>I have to check if the checbox is checked or unchecked. How do I proceed?</p>\n<p>Edit 1: The node array object has the following attributes:</p>\n<pre><code> [\n {\n DNSResolved: &quot;true&quot;,\n FQDN: &quot;sa-103.abc.com&quot;,\n HostName: &quot;sa-103&quot;,\n Role: &quot; Voice/Video&quot;,\n productTypeId: &quot;1&quot;\n },\n\n {\n DNSResolved: &quot;true&quot;,\n FQDN: &quot;sa-104.abc.com&quot;,\n HostName: &quot;sa-104&quot;,\n Role: &quot; Voice/Video&quot;,\n productTypeId: &quot;1&quot;\n },\n\n {\n DNSResolved: &quot;true&quot;,\n FQDN: &quot;sa-105.abc.com&quot;,\n HostName: &quot;sa-105&quot;,\n Role: &quot; Voice/Video&quot;,\n productTypeId: &quot;1&quot;\n }\n</code></pre>\n"},{"tags":["amazon-web-services","amazon-ec2","configuration","openvpn"],"owner":{"reputation":544,"user_id":13458882,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-NeIT50aX_fw/AAAAAAAAAAI/AAAAAAAAAAA/AAKWJJOea_cg3fhsaJ9qIOgcOrFUDjjslg/photo.jpg?sz=128","display_name":"Fenzox","link":"https://stackoverflow.com/users/13458882/fenzox"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259347,"creation_date":1623259347,"question_id":67908953,"share_link":"https://stackoverflow.com/q/67908953","body_markdown":"I have openvpn gui downloaded on my ec2 instance and have it linked to my config file. Upon connection, I&#39;m getting this error on my browser. I have tested the config file on another PC and it works just fine. I have also added inbound rules on my ec2 instance based on the documentation by was on amazon vpc\r\n\r\n\r\n\r\n This site cant be reached\r\n www.google.coms DNS address could not be found. Diagnosing the problem.\r\n Try:\r\n Running Windows Network Diagnostics\r\n Changing DNS over HTTPS settings\r\n DNS_PROBE_STARTED\r\n Check your DNS over HTTPS settings\r\n Go to Opera &gt; Preferences… &gt; System &gt; Use DNS-over-HTTPS instead of the systems DNS settings and check your DNS-over-HTTPS provider.\r\n\r\nThe following is my logfile from OpenVPN. Any help is appreciated!\r\n\r\n Wed Jun 09 16:25:04 2021 OpenVPN 2.4.9 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 16 2020\r\n Wed Jun 09 16:25:04 2021 Windows version 6.2 (Windows 8 or greater) 64bit\r\n Wed Jun 09 16:25:04 2021 library versions: OpenSSL 1.1.1f 31 Mar 2020, LZO 2.10\r\n Enter Management Password:\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340\r\n Wed Jun 09 16:25:04 2021 Need hold release from management interface, waiting...\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;state on&#39;\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;log all on&#39;\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;echo all on&#39;\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;bytecount 5&#39;\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;hold off&#39;\r\n Wed Jun 09 16:25:04 2021 MANAGEMENT: CMD &#39;hold release&#39;\r\n Wed Jun 09 16:25:06 2021 MANAGEMENT: CMD &#39;username &quot;Auth&quot; &quot;bryanlee544984-1&quot;&#39;\r\n Wed Jun 09 16:25:06 2021 MANAGEMENT: CMD &#39;password [...]&#39;\r\n Wed Jun 09 16:25:06 2021 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.\r\n Wed Jun 09 16:25:06 2021 NOTE: --fast-io is disabled since we are running on Windows\r\n Wed Jun 09 16:25:06 2021 Outgoing Control Channel Authentication: Using 160 bit message hash &#39;SHA1&#39; for HMAC authentication\r\n Wed Jun 09 16:25:06 2021 Incoming Control Channel Authentication: Using 160 bit message hash &#39;SHA1&#39; for HMAC authentication\r\n Wed Jun 09 16:25:06 2021 MANAGEMENT: &gt;STATE:1623255906,RESOLVE,,,,,,\r\n Wed Jun 09 16:25:06 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]157.245.129.235:443\r\n Wed Jun 09 16:25:06 2021 Socket Buffers: R=[65536-&gt;65536] S=[65536-&gt;65536]\r\n Wed Jun 09 16:25:06 2021 Attempting to establish TCP connection with [AF_INET]157.245.129.235:443 [nonblock]\r\n Wed Jun 09 16:25:06 2021 MANAGEMENT: &gt;STATE:1623255906,TCP_CONNECT,,,,,,\r\n Wed Jun 09 16:25:07 2021 TCP connection established with [AF_INET]157.245.129.235:443\r\n Wed Jun 09 16:25:07 2021 TCP_CLIENT link local: (not bound)\r\n Wed Jun 09 16:25:07 2021 TCP_CLIENT link remote: [AF_INET]157.245.129.235:443\r\n Wed Jun 09 16:25:07 2021 MANAGEMENT: &gt;STATE:1623255907,WAIT,,,,,,\r\n Wed Jun 09 16:25:07 2021 MANAGEMENT: &gt;STATE:1623255907,AUTH,,,,,,\r\n Wed Jun 09 16:25:07 2021 TLS: Initial packet from [AF_INET]157.245.129.235:443, sid=a3ac1635 90610b41\r\n Wed Jun 09 16:25:07 2021 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this\r\n Wed Jun 09 16:25:07 2021 VERIFY OK: depth=1, C=US, ST=CA, L=Kansas, O=DNSFlex, OU=Community, CN=DNSFlex CA, name=server, emailAddress=support@dnsflex.com\r\n Wed Jun 09 16:25:07 2021 VERIFY OK: depth=0, C=US, ST=CA, L=Kansas, O=DNSFlex, OU=Community, CN=server, name=server, emailAddress=support@dnsflex.com\r\n Wed Jun 09 16:25:07 2021 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA\r\n Wed Jun 09 16:25:07 2021 [server] Peer Connection Initiated with [AF_INET]157.245.129.235:443\r\n Wed Jun 09 16:25:09 2021 MANAGEMENT: &gt;STATE:1623255909,GET_CONFIG,,,,,,\r\n Wed Jun 09 16:25:09 2021 SENT CONTROL [server]: &#39;PUSH_REQUEST&#39; (status=1)\r\n Wed Jun 09 16:25:09 2021 PUSH: Received control message: &#39;PUSH_REPLY,redirect-gateway def1 bypass-dhcp,ping 10,ping-restart 120,comp-lzo no,sndbuf 393216,rcvbuf 393216,tun-ipv6,route-ipv6 2000::/3,tun-ipv6,route-gateway 10.13.0.1,topology subnet,ping 10,ping-restart 120,ifconfig-ipv6 2604:aaa:bbb:ccc::1039/64 2604:aaa:bbb:ccc::1,ifconfig 10.13.0.59 255.255.255.0,peer-id 0,cipher AES-256-GCM&#39;\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: timers and/or timeouts modified\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: compression parms modified\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: --sndbuf/--rcvbuf options modified\r\n Wed Jun 09 16:25:09 2021 Socket Buffers: R=[65536-&gt;393216] S=[65536-&gt;393216]\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: --ifconfig/up options modified\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: route options modified\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: route-related options modified\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: peer-id set\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: adjusting link_mtu to 1627\r\n Wed Jun 09 16:25:09 2021 OPTIONS IMPORT: data channel crypto options modified\r\n Wed Jun 09 16:25:09 2021 Data Channel: using negotiated cipher &#39;AES-256-GCM&#39;\r\n Wed Jun 09 16:25:09 2021 Outgoing Data Channel: Cipher &#39;AES-256-GCM&#39; initialized with 256 bit key\r\n Wed Jun 09 16:25:09 2021 Incoming Data Channel: Cipher &#39;AES-256-GCM&#39; initialized with 256 bit key\r\n Wed Jun 09 16:25:09 2021 interactive service msg_channel=0\r\n Wed Jun 09 16:25:09 2021 ROUTE_GATEWAY 172.31.16.1/255.255.240.0 I=12 HWADDR=06:e2:32:04:b1:06\r\n Wed Jun 09 16:25:09 2021 GDG6: remote_host_ipv6=n/a\r\n Wed Jun 09 16:25:09 2021 NOTE: GetBestInterfaceEx returned error: Element not found. (code=1168)\r\n Wed Jun 09 16:25:09 2021 ROUTE6: default_gateway=UNDEF\r\n Wed Jun 09 16:25:09 2021 open_tun\r\n Wed Jun 09 16:25:09 2021 TAP-WIN32 device [Ethernet 3] opened: \\\\.\\Global\\{F237FC86-05B2-438C-8B9F-F72BE24473AD}.tap\r\n Wed Jun 09 16:25:09 2021 TAP-Windows Driver Version 9.21 \r\n Wed Jun 09 16:25:09 2021 Set TAP-Windows TUN subnet mode network/local/netmask = 10.13.0.0/10.13.0.59/255.255.255.0 [SUCCEEDED]\r\n Wed Jun 09 16:25:09 2021 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.13.0.59/255.255.255.0 on interface {F237FC86-05B2-438C-8B9F-F72BE24473AD} [DHCP-serv: 10.13.0.254, lease-time: 31536000]\r\n Wed Jun 09 16:25:09 2021 Successful ARP Flush on interface [29] {F237FC86-05B2-438C-8B9F-F72BE24473AD}\r\n Wed Jun 09 16:25:09 2021 MANAGEMENT: &gt;STATE:1623255909,ASSIGN_IP,,10.13.0.59,,,,,2604:aaa:bbb:ccc::1039\r\n Wed Jun 09 16:25:10 2021 NETSH: C:\\Windows\\system32\\netsh.exe interface ipv6 set address interface=29 2604:aaa:bbb:ccc::1039 store=active\r\n Wed Jun 09 16:25:10 2021 add_route_ipv6(2604:aaa:bbb:ccc::/64 -&gt; 2604:aaa:bbb:ccc::1039 metric 0) dev Ethernet 3\r\n Wed Jun 09 16:25:10 2021 C:\\Windows\\system32\\netsh.exe interface ipv6 add route 2604:aaa:bbb:ccc::/64 interface=29 fe80::8 store=active\r\n Wed Jun 09 16:25:10 2021 env_block: add PATH=C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem\r\n Wed Jun 09 16:25:15 2021 TEST ROUTES: 1/1 succeeded len=0 ret=1 a=0 u/d=up\r\n Wed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 157.245.129.235 MASK 255.255.255.255 172.31.16.1\r\n Wed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=10 and dwForwardType=4\r\n Wed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\r\n Wed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 0.0.0.0 MASK 128.0.0.0 10.13.0.1\r\n Wed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=20 and dwForwardType=4\r\n Wed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\r\n Wed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 128.0.0.0 MASK 128.0.0.0 10.13.0.1\r\n Wed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=20 and dwForwardType=4\r\n Wed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\r\n Wed Jun 09 16:25:15 2021 add_route_ipv6(2000::/3 -&gt; 2604:aaa:bbb:ccc::1 metric -1) dev Ethernet 3\r\n Wed Jun 09 16:25:15 2021 C:\\Windows\\system32\\netsh.exe interface ipv6 add route 2000::/3 interface=29 fe80::8 store=active\r\n Wed Jun 09 16:25:15 2021 env_block: add PATH=C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem\r\n Wed Jun 09 16:25:15 2021 Initialization Sequence Completed\r\n Wed Jun 09 16:25:15 2021 MANAGEMENT: &gt;STATE:1623255915,CONNECTED,SUCCESS,10.13.0.59,157.245.129.235,443,172.31.29.175,64549,2604:aaa:bbb:ccc::1039","link":"https://stackoverflow.com/questions/67908953/configuration-needed-to-run-openvpn-gui-on-aws-ec2","title":"Configuration needed to run OpenVPN GUI on AWS EC2","body":"<p>I have openvpn gui downloaded on my ec2 instance and have it linked to my config file. Upon connection, I'm getting this error on my browser. I have tested the config file on another PC and it works just fine. I have also added inbound rules on my ec2 instance based on the documentation by was on amazon vpc</p>\n<pre><code>This site cant be reached\nwww.google.coms DNS address could not be found. Diagnosing the problem.\nTry:\nRunning Windows Network Diagnostics\nChanging DNS over HTTPS settings\nDNS_PROBE_STARTED\nCheck your DNS over HTTPS settings\nGo to Opera &gt; Preferences… &gt; System &gt; Use DNS-over-HTTPS instead of the systems DNS settings and check your DNS-over-HTTPS provider.\n</code></pre>\n<p>The following is my logfile from OpenVPN. Any help is appreciated!</p>\n<pre><code>Wed Jun 09 16:25:04 2021 OpenVPN 2.4.9 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 16 2020\nWed Jun 09 16:25:04 2021 Windows version 6.2 (Windows 8 or greater) 64bit\nWed Jun 09 16:25:04 2021 library versions: OpenSSL 1.1.1f 31 Mar 2020, LZO 2.10\nEnter Management Password:\nWed Jun 09 16:25:04 2021 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340\nWed Jun 09 16:25:04 2021 Need hold release from management interface, waiting...\nWed Jun 09 16:25:04 2021 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'state on'\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'log all on'\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'echo all on'\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'bytecount 5'\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'hold off'\nWed Jun 09 16:25:04 2021 MANAGEMENT: CMD 'hold release'\nWed Jun 09 16:25:06 2021 MANAGEMENT: CMD 'username &quot;Auth&quot; &quot;bryanlee544984-1&quot;'\nWed Jun 09 16:25:06 2021 MANAGEMENT: CMD 'password [...]'\nWed Jun 09 16:25:06 2021 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.\nWed Jun 09 16:25:06 2021 NOTE: --fast-io is disabled since we are running on Windows\nWed Jun 09 16:25:06 2021 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication\nWed Jun 09 16:25:06 2021 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication\nWed Jun 09 16:25:06 2021 MANAGEMENT: &gt;STATE:1623255906,RESOLVE,,,,,,\nWed Jun 09 16:25:06 2021 TCP/UDP: Preserving recently used remote address: [AF_INET]157.245.129.235:443\nWed Jun 09 16:25:06 2021 Socket Buffers: R=[65536-&gt;65536] S=[65536-&gt;65536]\nWed Jun 09 16:25:06 2021 Attempting to establish TCP connection with [AF_INET]157.245.129.235:443 [nonblock]\nWed Jun 09 16:25:06 2021 MANAGEMENT: &gt;STATE:1623255906,TCP_CONNECT,,,,,,\nWed Jun 09 16:25:07 2021 TCP connection established with [AF_INET]157.245.129.235:443\nWed Jun 09 16:25:07 2021 TCP_CLIENT link local: (not bound)\nWed Jun 09 16:25:07 2021 TCP_CLIENT link remote: [AF_INET]157.245.129.235:443\nWed Jun 09 16:25:07 2021 MANAGEMENT: &gt;STATE:1623255907,WAIT,,,,,,\nWed Jun 09 16:25:07 2021 MANAGEMENT: &gt;STATE:1623255907,AUTH,,,,,,\nWed Jun 09 16:25:07 2021 TLS: Initial packet from [AF_INET]157.245.129.235:443, sid=a3ac1635 90610b41\nWed Jun 09 16:25:07 2021 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this\nWed Jun 09 16:25:07 2021 VERIFY OK: depth=1, C=US, ST=CA, L=Kansas, O=DNSFlex, OU=Community, CN=DNSFlex CA, name=server, emailAddress=support@dnsflex.com\nWed Jun 09 16:25:07 2021 VERIFY OK: depth=0, C=US, ST=CA, L=Kansas, O=DNSFlex, OU=Community, CN=server, name=server, emailAddress=support@dnsflex.com\nWed Jun 09 16:25:07 2021 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 2048 bit RSA\nWed Jun 09 16:25:07 2021 [server] Peer Connection Initiated with [AF_INET]157.245.129.235:443\nWed Jun 09 16:25:09 2021 MANAGEMENT: &gt;STATE:1623255909,GET_CONFIG,,,,,,\nWed Jun 09 16:25:09 2021 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)\nWed Jun 09 16:25:09 2021 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1 bypass-dhcp,ping 10,ping-restart 120,comp-lzo no,sndbuf 393216,rcvbuf 393216,tun-ipv6,route-ipv6 2000::/3,tun-ipv6,route-gateway 10.13.0.1,topology subnet,ping 10,ping-restart 120,ifconfig-ipv6 2604:aaa:bbb:ccc::1039/64 2604:aaa:bbb:ccc::1,ifconfig 10.13.0.59 255.255.255.0,peer-id 0,cipher AES-256-GCM'\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: timers and/or timeouts modified\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: compression parms modified\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: --sndbuf/--rcvbuf options modified\nWed Jun 09 16:25:09 2021 Socket Buffers: R=[65536-&gt;393216] S=[65536-&gt;393216]\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: --ifconfig/up options modified\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: route options modified\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: route-related options modified\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: peer-id set\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: adjusting link_mtu to 1627\nWed Jun 09 16:25:09 2021 OPTIONS IMPORT: data channel crypto options modified\nWed Jun 09 16:25:09 2021 Data Channel: using negotiated cipher 'AES-256-GCM'\nWed Jun 09 16:25:09 2021 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key\nWed Jun 09 16:25:09 2021 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key\nWed Jun 09 16:25:09 2021 interactive service msg_channel=0\nWed Jun 09 16:25:09 2021 ROUTE_GATEWAY 172.31.16.1/255.255.240.0 I=12 HWADDR=06:e2:32:04:b1:06\nWed Jun 09 16:25:09 2021 GDG6: remote_host_ipv6=n/a\nWed Jun 09 16:25:09 2021 NOTE: GetBestInterfaceEx returned error: Element not found. (code=1168)\nWed Jun 09 16:25:09 2021 ROUTE6: default_gateway=UNDEF\nWed Jun 09 16:25:09 2021 open_tun\nWed Jun 09 16:25:09 2021 TAP-WIN32 device [Ethernet 3] opened: \\\\.\\Global\\{F237FC86-05B2-438C-8B9F-F72BE24473AD}.tap\nWed Jun 09 16:25:09 2021 TAP-Windows Driver Version 9.21 \nWed Jun 09 16:25:09 2021 Set TAP-Windows TUN subnet mode network/local/netmask = 10.13.0.0/10.13.0.59/255.255.255.0 [SUCCEEDED]\nWed Jun 09 16:25:09 2021 Notified TAP-Windows driver to set a DHCP IP/netmask of 10.13.0.59/255.255.255.0 on interface {F237FC86-05B2-438C-8B9F-F72BE24473AD} [DHCP-serv: 10.13.0.254, lease-time: 31536000]\nWed Jun 09 16:25:09 2021 Successful ARP Flush on interface [29] {F237FC86-05B2-438C-8B9F-F72BE24473AD}\nWed Jun 09 16:25:09 2021 MANAGEMENT: &gt;STATE:1623255909,ASSIGN_IP,,10.13.0.59,,,,,2604:aaa:bbb:ccc::1039\nWed Jun 09 16:25:10 2021 NETSH: C:\\Windows\\system32\\netsh.exe interface ipv6 set address interface=29 2604:aaa:bbb:ccc::1039 store=active\nWed Jun 09 16:25:10 2021 add_route_ipv6(2604:aaa:bbb:ccc::/64 -&gt; 2604:aaa:bbb:ccc::1039 metric 0) dev Ethernet 3\nWed Jun 09 16:25:10 2021 C:\\Windows\\system32\\netsh.exe interface ipv6 add route 2604:aaa:bbb:ccc::/64 interface=29 fe80::8 store=active\nWed Jun 09 16:25:10 2021 env_block: add PATH=C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem\nWed Jun 09 16:25:15 2021 TEST ROUTES: 1/1 succeeded len=0 ret=1 a=0 u/d=up\nWed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 157.245.129.235 MASK 255.255.255.255 172.31.16.1\nWed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=10 and dwForwardType=4\nWed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\nWed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 0.0.0.0 MASK 128.0.0.0 10.13.0.1\nWed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=20 and dwForwardType=4\nWed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\nWed Jun 09 16:25:15 2021 C:\\Windows\\system32\\route.exe ADD 128.0.0.0 MASK 128.0.0.0 10.13.0.1\nWed Jun 09 16:25:15 2021 ROUTE: CreateIpForwardEntry succeeded with dwForwardMetric1=20 and dwForwardType=4\nWed Jun 09 16:25:15 2021 Route addition via IPAPI succeeded [adaptive]\nWed Jun 09 16:25:15 2021 add_route_ipv6(2000::/3 -&gt; 2604:aaa:bbb:ccc::1 metric -1) dev Ethernet 3\nWed Jun 09 16:25:15 2021 C:\\Windows\\system32\\netsh.exe interface ipv6 add route 2000::/3 interface=29 fe80::8 store=active\nWed Jun 09 16:25:15 2021 env_block: add PATH=C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem\nWed Jun 09 16:25:15 2021 Initialization Sequence Completed\nWed Jun 09 16:25:15 2021 MANAGEMENT: &gt;STATE:1623255915,CONNECTED,SUCCESS,10.13.0.59,157.245.129.235,443,172.31.29.175,64549,2604:aaa:bbb:ccc::1039\n</code></pre>\n"},{"tags":["c"],"comments":[{"owner":{"reputation":3001,"user_id":4228131,"user_type":"registered","accept_rate":100,"profile_image":"https://i.stack.imgur.com/RyKUe.jpg?s=128&g=1","display_name":"WedaPashi","link":"https://stackoverflow.com/users/4228131/wedapashi"},"edited":false,"score":0,"creation_date":1623258778,"post_id":67908745,"comment_id":120030457,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":3001,"user_id":4228131,"user_type":"registered","accept_rate":100,"profile_image":"https://i.stack.imgur.com/RyKUe.jpg?s=128&g=1","display_name":"WedaPashi","link":"https://stackoverflow.com/users/4228131/wedapashi"},"edited":false,"score":1,"creation_date":1623258878,"post_id":67908745,"comment_id":120030500,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":31121,"user_id":10871073,"user_type":"registered","profile_image":"https://i.stack.imgur.com/ddBW9.png?s=128&g=1","display_name":"Adrian Mole","link":"https://stackoverflow.com/users/10871073/adrian-mole"},"is_accepted":false,"score":0,"last_activity_date":1623259343,"creation_date":1623259343,"answer_id":67908952,"question_id":67908745,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":15043462,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GjcrmUNncFNCy94XOvN33vw31WkJ_OSXutcJwsUsg=k-s128","display_name":"Gautam Bisht","link":"https://stackoverflow.com/users/15043462/gautam-bisht"},"is_answered":false,"view_count":20,"answer_count":1,"score":0,"last_activity_date":1623259343,"creation_date":1623258491,"last_edit_date":1623258633,"question_id":67908745,"share_link":"https://stackoverflow.com/q/67908745","body_markdown":"```\r\n#include &lt;stdio.h&gt;\r\nchar q[50];\r\nint doo(int p, int n, char* s) {\r\n int i = 0, j = 0;\r\n while (s[i] != &#39;\\0&#39;) {\r\n if ((i &lt; p) &amp;&amp; (i &gt; (p + n))) {\r\n q[j] = s[i];\r\n ++j;\r\n }\r\n i++;\r\n }\r\n puts(p);\r\n}\r\nint main() {\r\n char s[50];\r\n int n, p;\r\n printf(&quot;&lt;--program by gautam--&gt;\\n&quot;);\r\n printf(&quot;enter the string--&gt;&quot;);\r\n gets(s);\r\n printf(&quot;\\nenter the numbers of character to be deleted and position--&gt;&quot;);\r\n scanf(&quot;%d%d&quot;, &amp;n, &amp;p);\r\n --p;\r\n doo(p, n, s);\r\n return 0;\r\n}\r\n```\r\n\r\nso the question is to delete certain elements of string by asking user position and number of elements to delete from there. i m trying to copy all element except those whose position is provided by user","link":"https://stackoverflow.com/questions/67908745/its-not-printing-the-new-array-what-could-be-the-reason","title":"its not printing the new array. what could be the reason?","body":"<pre><code>#include &lt;stdio.h&gt;\nchar q[50];\nint doo(int p, int n, char* s) {\n int i = 0, j = 0;\n while (s[i] != '\\0') {\n if ((i &lt; p) &amp;&amp; (i &gt; (p + n))) {\n q[j] = s[i];\n ++j;\n }\n i++;\n }\n puts(p);\n}\nint main() {\n char s[50];\n int n, p;\n printf(&quot;&lt;--program by gautam--&gt;\\n&quot;);\n printf(&quot;enter the string--&gt;&quot;);\n gets(s);\n printf(&quot;\\nenter the numbers of character to be deleted and position--&gt;&quot;);\n scanf(&quot;%d%d&quot;, &amp;n, &amp;p);\n --p;\n doo(p, n, s);\n return 0;\n}\n</code></pre>\n<p>so the question is to delete certain elements of string by asking user position and number of elements to delete from there. i m trying to copy all element except those whose position is provided by user</p>\n"},{"tags":["typescript","express","mysql-connector"],"answers":[{"owner":{"reputation":1521,"user_id":3388225,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/93628db6b26d48a6c44b7bbeda92264e?s=128&d=identicon&r=PG","display_name":"aleksxor","link":"https://stackoverflow.com/users/3388225/aleksxor"},"is_accepted":false,"score":0,"last_activity_date":1623259338,"creation_date":1623259338,"answer_id":67908950,"question_id":67906257,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1351,"user_id":11401460,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/442924dbecfe090e125cb9fdd1b7faa4?s=128&d=identicon&r=PG&f=1","display_name":"uber","link":"https://stackoverflow.com/users/11401460/uber"},"is_answered":false,"view_count":10,"answer_count":1,"score":0,"last_activity_date":1623259338,"creation_date":1623249071,"last_edit_date":1623249774,"question_id":67906257,"share_link":"https://stackoverflow.com/q/67906257","body_markdown":"I&#39;m creating a connection to an AWS mysql database like so:\r\n```\r\nconst config = {\r\n host: process.env.RDS_HOSTNAME,\r\n user: process.env.RDS_USERNAME,\r\n password: process.env.RDS_PASSWORD,\r\n port: 3306,\r\n database: process.env.RDS_DB_NAME,\r\n}\r\n\r\nconst db = mysql.createConnection(config) // config gets highlighted\r\n```\r\nBut I get the following error:\r\n```\r\nArgument of type &#39;{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }&#39; is not assignable to parameter of type &#39;string | ConnectionConfig&#39;.\r\n\r\nType &#39;{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }&#39; is not assignable to type &#39;ConnectionConfig&#39;.\r\n\r\n Types of property &#39;host&#39; are incompatible.\r\n Type &#39;string | undefined&#39; is not assignable to type &#39;string&#39;.\r\n Type &#39;undefined&#39; is not assignable to type &#39;string&#39;.ts(2345)\r\n```\r\nEarlier on, I had a problem with the port coming from `.env`. When I switched to hardcoding the port, I get this. \r\n\r\nI don&#39;t understand what the problem is nor how to solve it.","link":"https://stackoverflow.com/questions/67906257/argument-of-type-host-string-undefined-user-string-undefined-is","title":"Argument of type &#39;{ host: string | undefined; user: string | undefined ... }&#39; is not assignable to parameter of type &#39;string | ConnectionConfig&#39;","body":"<p>I'm creating a connection to an AWS mysql database like so:</p>\n<pre><code>const config = {\n host: process.env.RDS_HOSTNAME,\n user: process.env.RDS_USERNAME,\n password: process.env.RDS_PASSWORD,\n port: 3306,\n database: process.env.RDS_DB_NAME,\n}\n\nconst db = mysql.createConnection(config) // config gets highlighted\n</code></pre>\n<p>But I get the following error:</p>\n<pre><code>Argument of type '{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }' is not assignable to parameter of type 'string | ConnectionConfig'.\n\nType '{ host: string | undefined; user: string | undefined; password: string | undefined; port: number; database: string | undefined; }' is not assignable to type 'ConnectionConfig'.\n\n Types of property 'host' are incompatible.\n Type 'string | undefined' is not assignable to type 'string'.\n Type 'undefined' is not assignable to type 'string'.ts(2345)\n</code></pre>\n<p>Earlier on, I had a problem with the port coming from <code>.env</code>. When I switched to hardcoding the port, I get this.</p>\n<p>I don't understand what the problem is nor how to solve it.</p>\n"},{"tags":["java","eclipse"],"owner":{"reputation":13,"user_id":15194704,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GiKrIBX6eF-yStQgm7Fxj0xI-yKtC4mkQoHBkbpFw=k-s128","display_name":"developer531","link":"https://stackoverflow.com/users/15194704/developer531"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259336,"creation_date":1623259336,"question_id":67908949,"share_link":"https://stackoverflow.com/q/67908949","body_markdown":"So I&#39;m using the Eclipse IDE for Java to work on exercises and store examples from my Java How to Program book. I organize them with folders for each chapter being inside the src folder, but the folders are automatically turned into packages. How can I make them just normal folders?\r\n\r\n[![Folder structure][1]][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/I0lDo.png","link":"https://stackoverflow.com/questions/67908949/folders-showing-up-as-packages-in-eclipse","title":"Folders showing up as packages in Eclipse","body":"<p>So I'm using the Eclipse IDE for Java to work on exercises and store examples from my Java How to Program book. I organize them with folders for each chapter being inside the src folder, but the folders are automatically turned into packages. How can I make them just normal folders?</p>\n<p><a href=\"https://i.stack.imgur.com/I0lDo.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/I0lDo.png\" alt=\"Folder structure\" /></a></p>\n"},{"tags":["ruby-on-rails","activerecord","ruby-on-rails-6"],"answers":[{"owner":{"reputation":145,"user_id":3756612,"user_type":"registered","profile_image":"https://graph.facebook.com/510650564/picture?type=large","display_name":"bryanfeller","link":"https://stackoverflow.com/users/3756612/bryanfeller"},"is_accepted":false,"score":0,"last_activity_date":1623259330,"creation_date":1623259330,"answer_id":67908948,"question_id":67905820,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":85,"user_id":6114401,"user_type":"registered","accept_rate":61,"profile_image":"https://www.gravatar.com/avatar/95358dfea7fa0c136721bc3a87f5ad0c?s=128&d=identicon&r=PG&f=1","display_name":"spacerobot","link":"https://stackoverflow.com/users/6114401/spacerobot"},"is_answered":false,"view_count":14,"answer_count":1,"score":0,"last_activity_date":1623259330,"creation_date":1623247728,"question_id":67905820,"share_link":"https://stackoverflow.com/q/67905820","body_markdown":"I have a form where people can either create one cardrequest or many via uploading a csv file with ids. I have it working to simply create the requests. There are two things left I need to do in this routine that I am not sure how to do and looking for advice on. \r\n\r\n1.) I need to check the ids either from the file upload or the single form field against an active table. If they are not active alert the person of that. \r\n\r\n2.) If a combination of empid and cardholdergroup already exist update that request with the new params that were passed through. \r\n\r\nHere is my action. Any thoughts on how/where I should do those? Any advice is appreciated.\r\n\r\n def create\r\n if cardrequest_params[:file].present?\r\n file_path = cardrequest_params[:file].path\r\n @cardholdergroups = cardrequest_params[:cardholdergroup_ids].map do |cardholdergroup_id|\r\n CSV.foreach(file_path) do |row|\r\n @cardrequest = Cardrequest.create(empid: row[0], startdate: cardrequest_params[:startdate], enddate: cardrequest_params[:enddate], user_id: current_user.id, cardholdergroup_ids: cardholdergroup_id)\r\n end\r\n end\r\n else\r\n @cardholdergroups = cardrequest_params[:cardholdergroup_ids].map do |cardholdergroup_id|\r\n @cardrequest = Cardrequest.create(empid: cardrequest_params[:empid], startdate: cardrequest_params[:startdate], enddate: cardrequest_params[:enddate], user_id: current_user.id, cardholdergroup_ids: cardholdergroup_id)\r\n end\r\n end\r\n respond_to do |format|\r\n if @cardrequest.save\r\n format.html { redirect_to cardrequests_path, notice: &quot;Cardrequest was successfully created.&quot; }\r\n format.json { render :show, status: :created, location: @cardrequest }\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n format.json { render json: @cardrequest.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end","link":"https://stackoverflow.com/questions/67905820/rails-controller-loop-questions-update-where-exists","title":"Rails controller loop questions - update where exists","body":"<p>I have a form where people can either create one cardrequest or many via uploading a csv file with ids. I have it working to simply create the requests. There are two things left I need to do in this routine that I am not sure how to do and looking for advice on.</p>\n<p>1.) I need to check the ids either from the file upload or the single form field against an active table. If they are not active alert the person of that.</p>\n<p>2.) If a combination of empid and cardholdergroup already exist update that request with the new params that were passed through.</p>\n<p>Here is my action. Any thoughts on how/where I should do those? Any advice is appreciated.</p>\n<pre><code> def create\n if cardrequest_params[:file].present?\n file_path = cardrequest_params[:file].path\n @cardholdergroups = cardrequest_params[:cardholdergroup_ids].map do |cardholdergroup_id|\n CSV.foreach(file_path) do |row|\n @cardrequest = Cardrequest.create(empid: row[0], startdate: cardrequest_params[:startdate], enddate: cardrequest_params[:enddate], user_id: current_user.id, cardholdergroup_ids: cardholdergroup_id)\n end\n end\n else\n @cardholdergroups = cardrequest_params[:cardholdergroup_ids].map do |cardholdergroup_id|\n @cardrequest = Cardrequest.create(empid: cardrequest_params[:empid], startdate: cardrequest_params[:startdate], enddate: cardrequest_params[:enddate], user_id: current_user.id, cardholdergroup_ids: cardholdergroup_id)\n end\n end\n respond_to do |format|\n if @cardrequest.save\n format.html { redirect_to cardrequests_path, notice: &quot;Cardrequest was successfully created.&quot; }\n format.json { render :show, status: :created, location: @cardrequest }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @cardrequest.errors, status: :unprocessable_entity }\n end\n end\n end\n</code></pre>\n"},{"tags":["android","kotlin","many-to-many","android-room","relation"],"owner":{"reputation":1,"user_id":16177985,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a0ffdf208d8c2bf6fda513dc6c43439f?s=128&d=identicon&r=PG&f=1","display_name":"Zharkov Max","link":"https://stackoverflow.com/users/16177985/zharkov-max"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259326,"creation_date":1623259326,"question_id":67908947,"share_link":"https://stackoverflow.com/q/67908947","body_markdown":"Got a problem, where i have a third-party field in a cross reference class.\r\nI have a\r\nProject entity data class:\r\n\r\n @Entity(tableName = &quot;projects&quot;)\r\n data class Project(\r\n \r\n @PrimaryKey(autoGenerate = true)\r\n val projectId: Int = 0,\r\n \r\n var title: String,\r\n \r\n var details: String,\r\n \r\n var date: Date,\r\n \r\n var price: Int\r\n )\r\nRecord entity data class:\r\n\r\n @Entity(tableName = &quot;records&quot;)\r\n data class Record (\r\n \r\n @PrimaryKey(autoGenerate = true)\r\n val recordId: Int,\r\n \r\n var title: String,\r\n \r\n var details: String,\r\n \r\n var price: Int,\r\n \r\n )\r\n\r\nCross reference entity data class\r\n \r\n @Entity(\r\n tableName = &quot;cross_ref&quot;,\r\n primaryKeys = [&quot;projectId&quot;, &quot;recordId&quot;],\r\n foreignKeys = [\r\n ForeignKey(\r\n entity = Project::class,\r\n parentColumns = [&quot;projectId&quot;],\r\n childColumns = [&quot;projectId&quot;]\r\n ),\r\n ForeignKey(\r\n entity = Record::class,\r\n parentColumns = [&quot;recordId&quot;],\r\n childColumns = [&quot;recordId&quot;]\r\n )\r\n ]\r\n )\r\n data class ProjectRecordCrossRef(\r\n \r\n val projectId: Int,\r\n \r\n @ColumnInfo(index = true)\r\n val recordId: Int,\r\n \r\n val quantity: Int\r\n )\r\n\r\nand a POJO class\r\n\r\n data class ProjectWithRecords(\r\n @Embedded\r\n val project: Project,\r\n \r\n @Relation(\r\n parentColumn = &quot;projectId&quot;,\r\n entityColumn = &quot;recordId&quot;,\r\n associateBy = Junction(ProjectRecordCrossRef::class)\r\n )\r\n val records: MutableList&lt;Record&gt;,\r\n \r\n @Relation(\r\n entity = ProjectRecordCrossRef::class,\r\n parentColumn = &quot;projectId&quot;,\r\n entityColumn = &quot;quantity&quot;\r\n )\r\n val quantities: MutableList&lt;Int&gt; = arrayListOf()\r\n )\r\n\r\nAlso I have a Dao class\r\n\r\n @Dao\r\n interface CrossRefDao {\r\n \r\n @Transaction\r\n @Query(&quot;SELECT * FROM projects WHERE projectId = :projectId&quot;)\r\n fun getProjectWithRecords(projectId: Int): LiveData&lt;ProjectWithRecords&gt;\r\n \r\n @Query(&quot;SELECT * FROM cross_ref WHERE projectId =:projectId&quot;)\r\n suspend fun getAllByProjectId(projectId: Int) : List&lt;ProjectRecordCrossRef&gt;\r\n \r\n @Query(&quot;SELECT * FROM cross_ref&quot;)\r\n suspend fun getAllCrosses(): List&lt;ProjectRecordCrossRef&gt;\r\n \r\n @Query(&quot;SELECT * FROM cross_ref WHERE projectId =:projectId AND recordId =:recordId&quot;)\r\n suspend fun getAllByProjectAndRecordIds(projectId: Int, recordId: Int) : List&lt;ProjectRecordCrossRef&gt;\r\n \r\n @Insert(onConflict = OnConflictStrategy.REPLACE)\r\n suspend fun insert(crossRef: ProjectRecordCrossRef)\r\n \r\n @Delete\r\n suspend fun delete(crossRefs: List&lt;ProjectRecordCrossRef&gt;)\r\n }\r\n\r\nThe problem is: I can&#39;t get quantities from Dao in a POJO\r\n\r\nSo, how can i get list of third-party values from cross reference?\r\n\r\nProjectWithRecords has\r\nProject, \r\nlist of records,\r\nlist of quantities of records.\r\n\r\nMay be I should make it another way? \r\n","link":"https://stackoverflow.com/questions/67908947/android-room-fetch-data-with-where-cross-reference-data-class-has-a-third-party","title":"Android Room fetch data with where cross reference data class has a third-party element","body":"<p>Got a problem, where i have a third-party field in a cross reference class.\nI have a\nProject entity data class:</p>\n<pre><code>@Entity(tableName = &quot;projects&quot;)\ndata class Project(\n\n @PrimaryKey(autoGenerate = true)\n val projectId: Int = 0,\n\n var title: String,\n\n var details: String,\n\n var date: Date,\n\n var price: Int\n)\n</code></pre>\n<p>Record entity data class:</p>\n<pre><code>@Entity(tableName = &quot;records&quot;)\ndata class Record (\n\n @PrimaryKey(autoGenerate = true)\n val recordId: Int,\n\n var title: String,\n\n var details: String,\n\n var price: Int,\n\n )\n</code></pre>\n<p>Cross reference entity data class</p>\n<pre><code>@Entity(\n tableName = &quot;cross_ref&quot;,\n primaryKeys = [&quot;projectId&quot;, &quot;recordId&quot;],\n foreignKeys = [\n ForeignKey(\n entity = Project::class,\n parentColumns = [&quot;projectId&quot;],\n childColumns = [&quot;projectId&quot;]\n ),\n ForeignKey(\n entity = Record::class,\n parentColumns = [&quot;recordId&quot;],\n childColumns = [&quot;recordId&quot;]\n )\n ]\n)\ndata class ProjectRecordCrossRef(\n\n val projectId: Int,\n\n @ColumnInfo(index = true)\n val recordId: Int,\n\n val quantity: Int\n)\n</code></pre>\n<p>and a POJO class</p>\n<pre><code>data class ProjectWithRecords(\n @Embedded\n val project: Project,\n\n @Relation(\n parentColumn = &quot;projectId&quot;,\n entityColumn = &quot;recordId&quot;,\n associateBy = Junction(ProjectRecordCrossRef::class)\n )\n val records: MutableList&lt;Record&gt;,\n\n @Relation(\n entity = ProjectRecordCrossRef::class,\n parentColumn = &quot;projectId&quot;,\n entityColumn = &quot;quantity&quot;\n )\n val quantities: MutableList&lt;Int&gt; = arrayListOf()\n)\n</code></pre>\n<p>Also I have a Dao class</p>\n<pre><code>@Dao\ninterface CrossRefDao {\n\n @Transaction\n @Query(&quot;SELECT * FROM projects WHERE projectId = :projectId&quot;)\n fun getProjectWithRecords(projectId: Int): LiveData&lt;ProjectWithRecords&gt;\n\n @Query(&quot;SELECT * FROM cross_ref WHERE projectId =:projectId&quot;)\n suspend fun getAllByProjectId(projectId: Int) : List&lt;ProjectRecordCrossRef&gt;\n\n @Query(&quot;SELECT * FROM cross_ref&quot;)\n suspend fun getAllCrosses(): List&lt;ProjectRecordCrossRef&gt;\n\n @Query(&quot;SELECT * FROM cross_ref WHERE projectId =:projectId AND recordId =:recordId&quot;)\n suspend fun getAllByProjectAndRecordIds(projectId: Int, recordId: Int) : List&lt;ProjectRecordCrossRef&gt;\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n suspend fun insert(crossRef: ProjectRecordCrossRef)\n\n @Delete\n suspend fun delete(crossRefs: List&lt;ProjectRecordCrossRef&gt;)\n}\n</code></pre>\n<p>The problem is: I can't get quantities from Dao in a POJO</p>\n<p>So, how can i get list of third-party values from cross reference?</p>\n<p>ProjectWithRecords has\nProject,\nlist of records,\nlist of quantities of records.</p>\n<p>May be I should make it another way?</p>\n"},{"tags":["javascript","jquery","salesforce","google-tag-manager","demandware"],"owner":{"reputation":1,"user_id":13316411,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgQvTgc-hzZiihLGpDlPE4p-JG_2ErjYhLjp-ZoYQ=k-s128","display_name":"Scott Peraza","link":"https://stackoverflow.com/users/13316411/scott-peraza"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259322,"creation_date":1623259322,"question_id":67908946,"share_link":"https://stackoverflow.com/q/67908946","body_markdown":"I have a website that currently has GTM. We are trying to use FB conversion API for better targeted ads. I was informed today that our Demandware subscription (Sales force commerce cloud) only allows 8 api calls per page load. This is not a problem when people browse, but at checkout we have 6 api calls going off already, and if we exceed 8 api calls the system (SFCC) crashes. Any ideas as to how to either structure it so the tag firing can be bundled into one call, or how we can store the data on the server side elsewhere, to be fired in increments over night?","link":"https://stackoverflow.com/questions/67908946/how-to-intercept-gtm-data-implement-fb-conversion-api-with-only-3-api-calls-pe","title":"How to intercept GTM data / implement FB conversion API with only 3 api calls per page load","body":"<p>I have a website that currently has GTM. We are trying to use FB conversion API for better targeted ads. I was informed today that our Demandware subscription (Sales force commerce cloud) only allows 8 api calls per page load. This is not a problem when people browse, but at checkout we have 6 api calls going off already, and if we exceed 8 api calls the system (SFCC) crashes. Any ideas as to how to either structure it so the tag firing can be bundled into one call, or how we can store the data on the server side elsewhere, to be fired in increments over night?</p>\n"},{"tags":["python","discord","discord.py"],"answers":[{"owner":{"reputation":1,"user_id":16178423,"user_type":"registered","profile_image":"https://i.stack.imgur.com/hhYby.png?s=128&g=1","display_name":"i-am-cal","link":"https://stackoverflow.com/users/16178423/i-am-cal"},"is_accepted":false,"score":0,"last_activity_date":1623259320,"last_edit_date":1623259320,"creation_date":1623259222,"answer_id":67908917,"question_id":67908882,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":11,"user_id":15601103,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b419e9b18f3522f2ee9d002932ba7198?s=128&d=identicon&r=PG&f=1","display_name":"Deyan Nikolov","link":"https://stackoverflow.com/users/15601103/deyan-nikolov"},"is_answered":false,"view_count":7,"answer_count":1,"score":0,"last_activity_date":1623259320,"creation_date":1623259067,"question_id":67908882,"share_link":"https://stackoverflow.com/q/67908882","body_markdown":"Okay, I know that the title isn&#39;t very descriptive, but please hear me out.\r\n\r\nI&#39;m trying to create a help &quot;log&quot; command:\r\n\r\n```\r\n@client.command()\r\nasync def logs(ctx):\r\n for channel in ctx.guild.channels:\r\n if channel.name == &quot;henry-logs&quot;:\r\n await ctx.send(&quot;Henry Logs channel is already setup. If you have access to it, it should be available in the channel list&quot;)\r\n else:\r\n await ctx.send(&quot;Henry logs channel is not found! If you have such access please create channel named **EXACTLY**&quot;)\r\n await ctx.send(&quot;```henry-logs```&quot;)\r\n```\r\n\r\nHowever it doesn&#39;t send the not found message once, but for every channel that is not &quot;henry-logs&quot;, since I used for channel in guild.\r\nIs there a way I can fix it and send it only once if the channel doesn&#39;t exist and once if does exist?","link":"https://stackoverflow.com/questions/67908882/discord-py-find-channel","title":"Discord.py find channel","body":"<p>Okay, I know that the title isn't very descriptive, but please hear me out.</p>\n<p>I'm trying to create a help &quot;log&quot; command:</p>\n<pre><code>@client.command()\nasync def logs(ctx):\n for channel in ctx.guild.channels:\n if channel.name == &quot;henry-logs&quot;:\n await ctx.send(&quot;Henry Logs channel is already setup. If you have access to it, it should be available in the channel list&quot;)\n else:\n await ctx.send(&quot;Henry logs channel is not found! If you have such access please create channel named **EXACTLY**&quot;)\n await ctx.send(&quot;```henry-logs```&quot;)\n</code></pre>\n<p>However it doesn't send the not found message once, but for every channel that is not &quot;henry-logs&quot;, since I used for channel in guild.\nIs there a way I can fix it and send it only once if the channel doesn't exist and once if does exist?</p>\n"},{"tags":["python","pandas","multi-index"],"owner":{"reputation":25,"user_id":16061104,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5933e3c9706c4ffb950ab7cf460f5164?s=128&d=identicon&r=PG&f=1","display_name":"tillwss","link":"https://stackoverflow.com/users/16061104/tillwss"},"is_answered":false,"view_count":7,"answer_count":0,"score":0,"last_activity_date":1623259319,"creation_date":1623259319,"question_id":67908945,"share_link":"https://stackoverflow.com/q/67908945","body_markdown":"I have a df in which some dates of the time period for each station are missing: How do I fill the missing dates per station and set &quot;Value&quot; to NaN within a multi index df?\r\n\r\nThe df looks like this:\r\n```\r\n Value\r\nStation_Number Date \r\nCA002100805 2003-01-01 -296\r\nCA002202570 2003-01-01 -269\r\nCA002203058 2003-01-01 -268\r\nCA002300551 2003-01-01 -23\r\nCA002300902 2003-01-01 -200\r\n... ...\r\nUSS0062S01S 2020-12-31 -94\r\nUSW00026533 2020-12-31 -216\r\nUSW00026616 2020-12-31 -100\r\nUSW00027401 2020-12-31 -223\r\nUSW00027502 2020-12-31 -273\r\n```\r\nThe time span goes from 01.01.2003 until 31.12.2020.","link":"https://stackoverflow.com/questions/67908945/fill-missing-dates-in-multi-index-df","title":"Fill missing dates in multi index df","body":"<p>I have a df in which some dates of the time period for each station are missing: How do I fill the missing dates per station and set &quot;Value&quot; to NaN within a multi index df?</p>\n<p>The df looks like this:</p>\n<pre><code> Value\nStation_Number Date \nCA002100805 2003-01-01 -296\nCA002202570 2003-01-01 -269\nCA002203058 2003-01-01 -268\nCA002300551 2003-01-01 -23\nCA002300902 2003-01-01 -200\n... ...\nUSS0062S01S 2020-12-31 -94\nUSW00026533 2020-12-31 -216\nUSW00026616 2020-12-31 -100\nUSW00027401 2020-12-31 -223\nUSW00027502 2020-12-31 -273\n</code></pre>\n<p>The time span goes from 01.01.2003 until 31.12.2020.</p>\n"},{"tags":["python","regex","grouping"],"owner":{"reputation":14283,"user_id":289011,"user_type":"registered","accept_rate":97,"profile_image":"https://www.gravatar.com/avatar/7fabc4413849953957908f8690c2c24c?s=128&d=identicon&r=PG","display_name":"BorrajaX","link":"https://stackoverflow.com/users/289011/borrajax"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259317,"creation_date":1623259317,"question_id":67908944,"share_link":"https://stackoverflow.com/q/67908944","body_markdown":"So, this is just a learning exercise... I know there are easy substitutions and replacements that I can do, but I was wondering whether removing dashes/hyphens (erm...this character: `-`) from a string **using exclusively `re.match`**\r\n\r\nLet&#39;s say I have something like:\r\n\r\nInput -&gt; `&quot;123-456-78&quot;`\r\n\r\nIs there a way of doing something along the lines of: `(?P&lt;something&gt;\\d+(?:-*)\\d+...)` so I could end up with just the digits in the matched group?\r\n\r\n```python\r\nimport re\r\ninput = &quot;123-456-78&quot;\r\nmatch = re.match(r&quot;(?P&lt;something&gt;...)&quot;, input)\r\nprint(match.groupdict()[&#39;something&#39;])\r\n\r\n12345678\r\n```\r\n\r\nJust curious, really (I&#39;m trying to improve my regular expressions knowledge). Thank you in advance.\r\n\r\nPS: I am using Python 3.6, in case it&#39;s relevant.","link":"https://stackoverflow.com/questions/67908944/remove-dashes-hyphens-using-only-regex-matches-in-python","title":"Remove dashes (hyphens) using only regex matches in Python","body":"<p>So, this is just a learning exercise... I know there are easy substitutions and replacements that I can do, but I was wondering whether removing dashes/hyphens (erm...this character: <code>-</code>) from a string <strong>using exclusively <code>re.match</code></strong></p>\n<p>Let's say I have something like:</p>\n<p>Input -&gt; <code>&quot;123-456-78&quot;</code></p>\n<p>Is there a way of doing something along the lines of: <code>(?P&lt;something&gt;\\d+(?:-*)\\d+...)</code> so I could end up with just the digits in the matched group?</p>\n<pre class=\"lang-py prettyprint-override\"><code>import re\ninput = &quot;123-456-78&quot;\nmatch = re.match(r&quot;(?P&lt;something&gt;...)&quot;, input)\nprint(match.groupdict()['something'])\n\n12345678\n</code></pre>\n<p>Just curious, really (I'm trying to improve my regular expressions knowledge). Thank you in advance.</p>\n<p>PS: I am using Python 3.6, in case it's relevant.</p>\n"},{"tags":["vue.js","data-binding","vuejs2","vue-component","2-way-object-databinding"],"owner":{"reputation":129,"user_id":14186234,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8fc20eef464612122fc743d0ca351184?s=128&d=identicon&r=PG&f=1","display_name":"Suzy","link":"https://stackoverflow.com/users/14186234/suzy"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259310,"creation_date":1623259310,"question_id":67908943,"share_link":"https://stackoverflow.com/q/67908943","body_markdown":"I am using Vue 2 and I&#39;m trying to have a parent component pass in multiple values to the child, and have the child return back a specific object to the parent. It needs to be two way data binding for the data.\r\n\r\nFor example I have this school object:\r\n```\r\n school: {\r\n name: &quot;Tech School&quot;,\r\n type: &quot;highschool&quot;\r\n }\r\n```\r\n\r\nA list of students with different properties: (The list can be huge, but this is pseudo code)\r\n```\r\n data () {\r\n return {\r\n totalStudents: [{\r\n school: {\r\n name: &quot;Tech School&quot;,\r\n type: &quot;highschool&quot;\r\n },\r\n studentId: 123,\r\n city: &quot;seattle&quot;\r\n },\r\n school: {\r\n name: &quot;Art School&quot;,\r\n type: &quot;university&quot;\r\n }\r\n studentId: 747,\r\n city: &quot;toronto&quot;\r\n },\r\n }],\r\n } \r\n }\r\n\r\n```\r\nThe parent calls this custom child component (I&#39;m not sure how to write this part)\r\n```\r\n &lt;CustomChildPicker :value=&quot;prop&quot; @input=&quot;prop=\r\n totalStudents[index].school, // trying to pass these 3 fields from parent to child\r\n totalStudents[index].studentId,\r\n totalStudents[index].city&quot;\r\n v-model=totalStudents[index].school //only want this updated data back from child\r\n /&gt;\r\n```\r\n\r\nHow do we pass in dynamic data to the child component, but only have the school object have two way data binding with the parent? \r\n\r\nI want to pass data from the parent to the child, and the child does some conversions to that data and pass the converted data back to the parent. (school object)\r\n\r\nBut also if the data in the parent changes, the child gets the updated changed data, redo the conversions above and give the updated data back to the parent. (if the student&#39;s city changes, then their school also changes) \r\n\r\nHow would we do this? Thanks for the help!","link":"https://stackoverflow.com/questions/67908943/how-to-pass-parent-to-child-dynamic-data-into-model-with-multiple-fields-vue","title":"How to pass parent to child dynamic data into model with multiple fields - Vue?","body":"<p>I am using Vue 2 and I'm trying to have a parent component pass in multiple values to the child, and have the child return back a specific object to the parent. It needs to be two way data binding for the data.</p>\n<p>For example I have this school object:</p>\n<pre><code> school: {\n name: &quot;Tech School&quot;,\n type: &quot;highschool&quot;\n }\n</code></pre>\n<p>A list of students with different properties: (The list can be huge, but this is pseudo code)</p>\n<pre><code> data () {\n return {\n totalStudents: [{\n school: {\n name: &quot;Tech School&quot;,\n type: &quot;highschool&quot;\n },\n studentId: 123,\n city: &quot;seattle&quot;\n },\n school: {\n name: &quot;Art School&quot;,\n type: &quot;university&quot;\n }\n studentId: 747,\n city: &quot;toronto&quot;\n },\n }],\n } \n }\n\n</code></pre>\n<p>The parent calls this custom child component (I'm not sure how to write this part)</p>\n<pre><code> &lt;CustomChildPicker :value=&quot;prop&quot; @input=&quot;prop=\n totalStudents[index].school, // trying to pass these 3 fields from parent to child\n totalStudents[index].studentId,\n totalStudents[index].city&quot;\n v-model=totalStudents[index].school //only want this updated data back from child\n /&gt;\n</code></pre>\n<p>How do we pass in dynamic data to the child component, but only have the school object have two way data binding with the parent?</p>\n<p>I want to pass data from the parent to the child, and the child does some conversions to that data and pass the converted data back to the parent. (school object)</p>\n<p>But also if the data in the parent changes, the child gets the updated changed data, redo the conversions above and give the updated data back to the parent. (if the student's city changes, then their school also changes)</p>\n<p>How would we do this? Thanks for the help!</p>\n"},{"tags":["python","pandas","matplotlib"],"owner":{"reputation":372,"user_id":14829523,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/074b5d61968152cfa3fdaf216aff7cc7?s=128&d=identicon&r=PG&f=1","display_name":"Exa","link":"https://stackoverflow.com/users/14829523/exa"},"is_answered":false,"view_count":7,"answer_count":0,"score":0,"last_activity_date":1623259307,"creation_date":1623259307,"question_id":67908942,"share_link":"https://stackoverflow.com/q/67908942","body_markdown":"I have the following dummy dfs:\r\n\r\n # First df\r\n columns_One = [&#39;count&#39;]\r\n data_One = [[&#39;1.0&#39;],\r\n [&#39;100.0&#39;],\r\n [&#39;100.0&#39;],\r\n [&#39;120.0&#39;],\r\n [&#39;500.0&#39;],\r\n [&#39;540.0&#39;],\r\n [&#39;590.0&#39;]]\r\n dummy_One = pd.DataFrame(columns=columns_One, data=data_One)\r\n \r\n # Second df\r\n columns_Two = [&#39;count&#39;]\r\n data_Two = [[&#39;1.0&#39;],\r\n [&#39;100.0&#39;],\r\n [&#39;102.0&#39;],\r\n [&#39;300.0&#39;],\r\n [&#39;490.0&#39;],\r\n [&#39;400.0&#39;],\r\n [&#39;290.0&#39;]]\r\n dummy_Two = pd.DataFrame(columns=columns_Two, data=data_Two)\r\n\r\nI am trying to plot two charts next to each other like this:\r\n\r\n fig, axes = pyplot.subplots(1, 2)\r\n\r\n bins = numpy.linspace(1, 10)\r\n \r\n \r\n dummy_One.hist(&#39;dummy 1&#39;, bins, ax=axes[0])\r\n dummy_Two.hist(&#39;dummy 2&#39;, bins, ax=axes[1])\r\n pyplot.xticks(range(11))\r\n pyplot.xlabel(&#39;I am the x axis&#39;)\r\n pyplot.ylabel(&#39;I am the y axis&#39;)\r\n pyplot.legend(loc=&#39;upper right&#39;)\r\n \r\n pyplot.show()\r\n\r\nbut getting the error `ValueError: Grouper and axis must be same length`\r\n\r\nI do not understand why. The two dfs have the same shape.\r\n\r\n","link":"https://stackoverflow.com/questions/67908942/plotting-two-histograms-side-by-side-results-in-valueerror","title":"Plotting two histograms side by side results in ValueError","body":"<p>I have the following dummy dfs:</p>\n<pre><code># First df\ncolumns_One = ['count']\ndata_One = [['1.0'],\n ['100.0'],\n ['100.0'],\n ['120.0'],\n ['500.0'],\n ['540.0'],\n ['590.0']]\ndummy_One = pd.DataFrame(columns=columns_One, data=data_One)\n\n# Second df\ncolumns_Two = ['count']\ndata_Two = [['1.0'],\n ['100.0'],\n ['102.0'],\n ['300.0'],\n ['490.0'],\n ['400.0'],\n ['290.0']]\ndummy_Two = pd.DataFrame(columns=columns_Two, data=data_Two)\n</code></pre>\n<p>I am trying to plot two charts next to each other like this:</p>\n<pre><code>fig, axes = pyplot.subplots(1, 2)\n\nbins = numpy.linspace(1, 10)\n\n\ndummy_One.hist('dummy 1', bins, ax=axes[0])\ndummy_Two.hist('dummy 2', bins, ax=axes[1])\npyplot.xticks(range(11))\npyplot.xlabel('I am the x axis')\npyplot.ylabel('I am the y axis')\npyplot.legend(loc='upper right')\n\npyplot.show()\n</code></pre>\n<p>but getting the error <code>ValueError: Grouper and axis must be same length</code></p>\n<p>I do not understand why. The two dfs have the same shape.</p>\n"},{"tags":["java","android","android-linearlayout","visibility","show-hide"],"comments":[{"owner":{"reputation":111,"user_id":11057391,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/06497cd1e589611aa9863dc56786060c?s=128&d=identicon&r=PG&f=1","display_name":"Saravanan","link":"https://stackoverflow.com/users/11057391/saravanan"},"edited":false,"score":1,"creation_date":1623258222,"post_id":67908594,"comment_id":120030261,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16177674,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Ghq1-kEBr_o9EZvxjj3eU7RT2_uVgmCW6yGY5DXOQ=k-s128","display_name":"Suraj Verma","link":"https://stackoverflow.com/users/16177674/suraj-verma"},"reply_to_user":{"reputation":111,"user_id":11057391,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/06497cd1e589611aa9863dc56786060c?s=128&d=identicon&r=PG&f=1","display_name":"Saravanan","link":"https://stackoverflow.com/users/11057391/saravanan"},"edited":false,"score":0,"creation_date":1623258655,"post_id":67908594,"comment_id":120030409,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":111,"user_id":11057391,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/06497cd1e589611aa9863dc56786060c?s=128&d=identicon&r=PG&f=1","display_name":"Saravanan","link":"https://stackoverflow.com/users/11057391/saravanan"},"edited":false,"score":0,"creation_date":1623259006,"post_id":67908594,"comment_id":120030552,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16177674,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Ghq1-kEBr_o9EZvxjj3eU7RT2_uVgmCW6yGY5DXOQ=k-s128","display_name":"Suraj Verma","link":"https://stackoverflow.com/users/16177674/suraj-verma"},"reply_to_user":{"reputation":111,"user_id":11057391,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/06497cd1e589611aa9863dc56786060c?s=128&d=identicon&r=PG&f=1","display_name":"Saravanan","link":"https://stackoverflow.com/users/11057391/saravanan"},"edited":false,"score":0,"creation_date":1623259392,"post_id":67908594,"comment_id":120030701,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":968,"user_id":9089370,"user_type":"registered","profile_image":"https://i.stack.imgur.com/5ofPv.jpg?s=128&g=1","display_name":"androidLearner","link":"https://stackoverflow.com/users/9089370/androidlearner"},"is_accepted":false,"score":0,"last_activity_date":1623259307,"creation_date":1623259307,"answer_id":67908941,"question_id":67908594,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16177674,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Ghq1-kEBr_o9EZvxjj3eU7RT2_uVgmCW6yGY5DXOQ=k-s128","display_name":"Suraj Verma","link":"https://stackoverflow.com/users/16177674/suraj-verma"},"is_answered":false,"view_count":13,"answer_count":1,"score":0,"last_activity_date":1623259307,"creation_date":1623257797,"last_edit_date":1623258101,"question_id":67908594,"share_link":"https://stackoverflow.com/q/67908594","body_markdown":"**The main layout is a Linear layout inside that a scroll view is there which contain sublayouts. Here is my layout [omitted everything except the specific layout (marked with red) as it will be very long] :**\r\n\r\n &lt;ScrollView\r\n android:layout_width=&quot;match_parent&quot;\r\n android:layout_height=&quot;match_parent&quot;&gt;\r\n\r\n &lt;LinearLayout\r\n android:layout_width=&quot;match_parent&quot;\r\n android:layout_height=&quot;match_parent&quot;\r\n android:orientation=&quot;vertical&quot;&gt;\r\n\r\n &lt;androidx.cardview.widget.CardView\r\n android:layout_width=&quot;match_parent&quot;\r\n android:layout_height=&quot;wrap_content&quot;\r\n android:layout_gravity=&quot;center&quot;\r\n android:layout_marginStart=&quot;10dp&quot;\r\n android:layout_marginTop=&quot;8dp&quot;\r\n android:layout_marginEnd=&quot;10dp&quot;\r\n android:layout_marginBottom=&quot;8dp&quot;\r\n android:foreground=&quot;?android:attr/selectableItemBackground&quot;\r\n app:cardCornerRadius=&quot;8dp&quot;\r\n app:cardElevation=&quot;10dp&quot;&gt;\r\n\r\n &lt;LinearLayout\r\n android:layout_width=&quot;match_parent&quot;\r\n android:layout_height=&quot;match_parent&quot;\r\n android:orientation=&quot;vertical&quot;\r\n android:padding=&quot;8dp&quot;&gt;\r\n\r\n\r\n &lt;LinearLayout\r\n android:id=&quot;@+id/layoutIncomeTax&quot;\r\n android:layout_width=&quot;match_parent&quot;\r\n android:layout_height=&quot;wrap_content&quot;\r\n android:orientation=&quot;horizontal&quot;&gt;\r\n\r\n &lt;TextView\r\n android:layout_width=&quot;wrap_content&quot;\r\n android:layout_height=&quot;wrap_content&quot;\r\n android:gravity=&quot;start&quot;\r\n android:text=&quot;Income Tax:&quot;\r\n android:textColor=&quot;@color/black&quot;\r\n android:textSize=&quot;16sp&quot; /&gt;\r\n\r\n &lt;TextView\r\n android:id=&quot;@+id/tvIncomeTax&quot;\r\n android:layout_width=&quot;wrap_content&quot;\r\n android:layout_height=&quot;wrap_content&quot;\r\n android:layout_weight=&quot;1&quot;\r\n android:gravity=&quot;end&quot;\r\n android:text=&quot;0&quot;\r\n android:textColor=&quot;@color/black&quot;\r\n android:textSize=&quot;16sp&quot;\r\n android:textStyle=&quot;bold&quot; /&gt;\r\n\r\n &lt;/LinearLayout&gt;\r\n\r\n &lt;/LinearLayout&gt;\r\n\r\n &lt;/androidx.cardview.widget.CardView&gt;\r\n\r\n &lt;/LinearLayout&gt;\r\n\r\n &lt;/ScrollView&gt;\r\n\r\n\r\n&lt;/LinearLayout&gt;\r\n\r\n\r\n**Here is my code (removed unnecessary codes) :**\r\n\r\npublic class ViewSalary extends AppCompatActivity {\r\n\r\n private Spinner selectShift, selectYear, selectMonth;\r\n private EditText edtEmployeeCode;\r\n private Button viewSalaryBtn;\r\n private String shift, year, month;\r\n\r\n\r\n DatabaseReference rootDatabaseRef;\r\n\r\n private LinearLayout layoutIncomeTax;\r\n\r\n private TextView tvIncomeTax;\r\n\r\n @Override\r\n protected void onCreate(Bundle savedInstanceState) {\r\n super.onCreate(savedInstanceState);\r\n setContentView(R.layout.activity_view_salary);\r\n\r\n\r\n viewSalaryBtn = findViewById(R.id.viewSalaryBtn);\r\n\r\n layoutIncomeTax = findViewById(R.id.layoutIncomeTax);\r\n\r\n tvIncomeTax = findViewById(R.id.tvIncomeTax);\r\n\r\n rootDatabaseRef = FirebaseDatabase.getInstance().getReference().child(&quot;Salary&quot;);\r\n\r\n viewSalaryBtn.setOnClickListener(new View.OnClickListener() {\r\n @Override\r\n public void onClick(View v) {\r\n\r\n viewSalary();\r\n\r\n String checkIncomeTax = tvIncomeTax.getText().toString();\r\n if (checkIncomeTax.equals(&quot;0.0&quot;)) {\r\n layoutIncomeTax.setVisibility(layoutIncomeTax.GONE);\r\n }\r\n\r\n }\r\n });\r\n\r\n\r\n }\r\n\r\n private void viewSalary() {\r\n\r\n final String empCode = edtEmployeeCode.getText().toString();\r\n\r\n DatabaseReference empRef = rootDatabaseRef.child(shift).child(year).child(month).child(empCode);\r\n\r\n empRef.addValueEventListener(new ValueEventListener() {\r\n @Override\r\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\r\n if (dataSnapshot.exists()) {\r\n\r\n String incomeTax = dataSnapshot.child(&quot;IncomeTax&quot;).getValue(String.class);\r\n\r\n tvIncomeTax.setText(incomeTax);\r\n\r\n } else {\r\n Toast.makeText(ViewSalary.this, &quot;Data does not exist!&quot;, Toast.LENGTH_SHORT).show();\r\n }\r\n }\r\n\r\n @Override\r\n public void onCancelled(@NonNull DatabaseError error) {\r\n Toast.makeText(ViewSalary.this, error.getMessage(), Toast.LENGTH_SHORT).show();\r\n }\r\n });\r\n\r\n }\r\n\r\n\r\n}\r\n\r\n**I want to hide all linear layouts on button click after getting the data loaded and if TextView value is &quot;0.0&quot; (like the one marked with red in screenshot)**\r\n\r\n[Screenshot][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/LvAea.jpg","link":"https://stackoverflow.com/questions/67908594/how-to-set-visibility-gone-of-a-linear-layout-which-is-inside-a-scroll-view-and","title":"How to set visibility GONE of a Linear Layout which is inside a scroll view and contains two TextViews inside?","body":"<p><strong>The main layout is a Linear layout inside that a scroll view is there which contain sublayouts. Here is my layout [omitted everything except the specific layout (marked with red) as it will be very long] :</strong></p>\n<pre><code>&lt;ScrollView\n android:layout_width=&quot;match_parent&quot;\n android:layout_height=&quot;match_parent&quot;&gt;\n\n &lt;LinearLayout\n android:layout_width=&quot;match_parent&quot;\n android:layout_height=&quot;match_parent&quot;\n android:orientation=&quot;vertical&quot;&gt;\n\n &lt;androidx.cardview.widget.CardView\n android:layout_width=&quot;match_parent&quot;\n android:layout_height=&quot;wrap_content&quot;\n android:layout_gravity=&quot;center&quot;\n android:layout_marginStart=&quot;10dp&quot;\n android:layout_marginTop=&quot;8dp&quot;\n android:layout_marginEnd=&quot;10dp&quot;\n android:layout_marginBottom=&quot;8dp&quot;\n android:foreground=&quot;?android:attr/selectableItemBackground&quot;\n app:cardCornerRadius=&quot;8dp&quot;\n app:cardElevation=&quot;10dp&quot;&gt;\n\n &lt;LinearLayout\n android:layout_width=&quot;match_parent&quot;\n android:layout_height=&quot;match_parent&quot;\n android:orientation=&quot;vertical&quot;\n android:padding=&quot;8dp&quot;&gt;\n\n\n &lt;LinearLayout\n android:id=&quot;@+id/layoutIncomeTax&quot;\n android:layout_width=&quot;match_parent&quot;\n android:layout_height=&quot;wrap_content&quot;\n android:orientation=&quot;horizontal&quot;&gt;\n\n &lt;TextView\n android:layout_width=&quot;wrap_content&quot;\n android:layout_height=&quot;wrap_content&quot;\n android:gravity=&quot;start&quot;\n android:text=&quot;Income Tax:&quot;\n android:textColor=&quot;@color/black&quot;\n android:textSize=&quot;16sp&quot; /&gt;\n\n &lt;TextView\n android:id=&quot;@+id/tvIncomeTax&quot;\n android:layout_width=&quot;wrap_content&quot;\n android:layout_height=&quot;wrap_content&quot;\n android:layout_weight=&quot;1&quot;\n android:gravity=&quot;end&quot;\n android:text=&quot;0&quot;\n android:textColor=&quot;@color/black&quot;\n android:textSize=&quot;16sp&quot;\n android:textStyle=&quot;bold&quot; /&gt;\n\n &lt;/LinearLayout&gt;\n\n &lt;/LinearLayout&gt;\n\n &lt;/androidx.cardview.widget.CardView&gt;\n\n &lt;/LinearLayout&gt;\n\n&lt;/ScrollView&gt;\n</code></pre>\n\n<p><strong>Here is my code (removed unnecessary codes) :</strong></p>\n<p>public class ViewSalary extends AppCompatActivity {</p>\n<pre><code>private Spinner selectShift, selectYear, selectMonth;\nprivate EditText edtEmployeeCode;\nprivate Button viewSalaryBtn;\nprivate String shift, year, month;\n\n\nDatabaseReference rootDatabaseRef;\n\nprivate LinearLayout layoutIncomeTax;\n\nprivate TextView tvIncomeTax;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_view_salary);\n\n\n viewSalaryBtn = findViewById(R.id.viewSalaryBtn);\n\n layoutIncomeTax = findViewById(R.id.layoutIncomeTax);\n\n tvIncomeTax = findViewById(R.id.tvIncomeTax);\n\n rootDatabaseRef = FirebaseDatabase.getInstance().getReference().child(&quot;Salary&quot;);\n\n viewSalaryBtn.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n\n viewSalary();\n\n String checkIncomeTax = tvIncomeTax.getText().toString();\n if (checkIncomeTax.equals(&quot;0.0&quot;)) {\n layoutIncomeTax.setVisibility(layoutIncomeTax.GONE);\n }\n\n }\n });\n\n\n}\n\nprivate void viewSalary() {\n\n final String empCode = edtEmployeeCode.getText().toString();\n\n DatabaseReference empRef = rootDatabaseRef.child(shift).child(year).child(month).child(empCode);\n\n empRef.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n if (dataSnapshot.exists()) {\n\n String incomeTax = dataSnapshot.child(&quot;IncomeTax&quot;).getValue(String.class);\n\n tvIncomeTax.setText(incomeTax);\n\n } else {\n Toast.makeText(ViewSalary.this, &quot;Data does not exist!&quot;, Toast.LENGTH_SHORT).show();\n }\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n Toast.makeText(ViewSalary.this, error.getMessage(), Toast.LENGTH_SHORT).show();\n }\n });\n\n}\n</code></pre>\n<p>}</p>\n<p><strong>I want to hide all linear layouts on button click after getting the data loaded and if TextView value is &quot;0.0&quot; (like the one marked with red in screenshot)</strong></p>\n<p><a href=\"https://i.stack.imgur.com/LvAea.jpg\" rel=\"nofollow noreferrer\">Screenshot</a></p>\n"},{"tags":["python","flask","range","flask-sqlalchemy"],"owner":{"reputation":13,"user_id":13541951,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/fa18bf723514cb20c3c9766a4899ce2b?s=128&d=identicon&r=PG&f=1","display_name":"programmeurNED","link":"https://stackoverflow.com/users/13541951/programmeurned"},"is_answered":false,"view_count":7,"answer_count":0,"score":0,"last_activity_date":1623259305,"creation_date":1623259305,"question_id":67908940,"share_link":"https://stackoverflow.com/q/67908940","body_markdown":"For a school project, I am building a mastermind game with Python 3.8 and Flask webapp. Firstly, I created a program just using functions, and now I am trying to implement classes.\r\n\r\nWhen: &#39;objMastermind.secret_list(objMastermind)&#39; is executed in Flask.py it return []. However, the variable iMaxPos, iMaxColor = 4? Thus, the for-loop isn&#39;t doing his job.\r\n\r\nCan someone help me out? \r\nThanks in advance!\r\n\r\n*main = webflask.py*\r\n\r\n**mastermind.py**\r\n\r\n```\r\n# Built-in library\r\nimport random\r\n\r\nMAX_COLORS = 4\r\nMAX_POSITIONS = 4\r\ncorrectGuesses = 0\r\ncurrentTries = 0\r\n\r\nclass Mastermind(): \r\n\r\n @property\r\n def userInputs(self, iMaxColors, iMaxPositions, iGuessesList, qSecretList):\r\n self.iMaxColors = iMaxColors\r\n self.iMaxPositons = iMaxPositions\r\n self.iGuessesList = iGuessesList\r\n self.qSecretList = qSecretList\r\n return self.iMaxColors, self.iMaxPositons, self.iMaxPositons\r\n\r\n @userInputs.setter\r\n def userInputs(self, iMaxColors, iMaxPositions, iGuessesList, qSecretList):\r\n self.iMaxColors = iMaxColors\r\n self.iMaxPositons = iMaxPositions\r\n self.iGuessesList = iGuessesList\r\n self.qSecretList = qSecretList\r\n\r\n def __init__(self):\r\n self.iMaxColors = 0\r\n self.iMaxPositons = 0\r\n self.iGuessesList = []\r\n self.qSecretList = []\r\n\r\n #generates a list of random numbers\r\n def secret_list(self, objMastermind):\r\n objMastermind.qSecretList = []\r\n print(&quot;iMaxPos =&quot;, objMastermind.iMaxPositions)\r\n print(&quot;iMaxColor =&quot;, objMastermind.iMaxColors)\r\n\r\n #loop max_positions amount of times\r\n for i in range(int(objMastermind.iMaxPositons)): \r\n objMastermind.qSecretList.append(random.randint(1, int(objMastermind.iMaxColors)))\r\n print(i)\r\n #print the secret_list ** don&#39;t tell anyone **\r\n print(objMastermind.qSecretList)\r\n print(&quot;Done&quot;)\r\n print(objMastermind.iMaxColors)\r\n return objMastermind.qSecretList\r\n\r\n def guesses(objMastermind):\r\n guess_list = []\r\n for i in range(objMastermind.iMaxPositons):\r\n guess_list.append(int(input(&quot;Please, guess the number: &quot;)))\r\n\r\n #print the inserted \r\n print(&quot;\\n&quot;, guess_list)\r\n return guess_list\r\n\r\n def checkResult(mastermind_list, guesses_list):\r\n correctGuesses = 0\r\n closeGuesses = 0\r\n for i in range(len(guesses_list)):\r\n if(guesses_list[i] == mastermind_list[i]):\r\n correctGuesses += 1\r\n \r\n print(&quot;correctGuesses: &quot;, correctGuesses)\r\n\r\n closeGuesses = len(set(guesses_list).intersection(mastermind_list))\r\n closeGuesses -= correctGuesses\r\n \r\n print(&quot;closeGuesses: &quot;, closeGuesses)\r\n\r\n return correctGuesses \r\n\r\nif __name__ == &quot;__main__&quot;:\r\n\r\n #mastermind_list = Mastermind.secret_list(MAX_COLORS, MAX_POSITIONS)\r\n #print(mastermind_list)\r\n\r\n #print(&quot;Welcome to the Mastermind game&quot;)\r\n #print(&quot;Try to guess the 4 secret numbers.\\n&quot;)\r\n\r\n while(correctGuesses &lt; MAX_POSITIONS):\r\n #guesses_list = Mastermind.guesses(MAX_POSITIONS)\r\n\r\n #correctGuesses = Mastermind.checkResult(mastermind_list, guesses_list)\r\n \r\n currentTries += 1\r\n if(correctGuesses &lt; MAX_POSITIONS):\r\n print(&quot;\\nYou guessed &quot; + str(correctGuesses) + &quot; number(s) corretly.\\n&quot;)\r\n correctGuesses = 0\r\n continue\r\n else:\r\n if (currentTries == 1):\r\n print(&quot;Congratulation, you guessed all 4 numers!! It took you &quot; + str(currentTries) + &quot; try.\\n&quot;)\r\n else:\r\n print(&quot;Congratulation, you guessed all 4 numers!! It took you &quot; + str(currentTries) + &quot; tries.\\n&quot;)\r\n```\r\n\r\n**webflask.py**\r\n```\r\nfrom mastermind import Mastermind\r\nfrom flask import Flask, render_template, request, url_for, redirect\r\nfrom werkzeug.utils import redirect\r\n\r\napp = Flask(__name__, template_folder=&#39;template&#39;)\r\n\r\n#init\r\nobjMastermind = Mastermind()\r\n\r\n@app.route(&#39;/&#39;, methods=[&quot;POST&quot;, &quot;GET&quot;])\r\ndef mastermind_home():\r\n \r\n if(request.method == &quot;POST&quot;):\r\n player_name= request.form[&quot;fullName&quot;]\r\n objMastermind.iMaxColors = int(request.form[&quot;maxColors&quot;])\r\n objMastermind.iMaxPositions = int(request.form[&quot;maxPositions&quot;])\r\n objMastermind.secret_list(objMastermind)\r\n return redirect(url_for(&quot;startGame&quot;, usr=player_name))\r\n else:\r\n return render_template(&#39;mastermind_html.html&#39;)\r\n\r\n@app.route(&quot;/the-game-&lt;usr&gt;&quot;)\r\ndef startGame(usr):\r\n guessList = []\r\n mastermind_list = []\r\n if(request.method == &quot;POST&quot;):\r\n guessListPos1= request.form[&quot;guessListPos1&quot;]\r\n guessListPos2= request.form[&quot;guessListPos2&quot;]\r\n guessListPos3= request.form[&quot;guessListPos3&quot;]\r\n guessListPos4= request.form[&quot;guessListPos4&quot;]\r\n\r\n guessList.append(guessListPos1, guessListPos2, guessListPos3, guessListPos4)\r\n Mastermind.Mastermind.checkResult(mastermind_list, guessList)\r\n return render_template(&#39;mastermind_game.html&#39;, fullname = usr)\r\n else:\r\n return render_template(&#39;mastermind_game.html&#39;, fullname = usr)\r\n #return f&quot;&lt;h1&gt;{usr}&lt;/h1&gt;&quot;\r\n\r\n\r\n\r\n#@app.route(&#39;/&#39;)\r\n#def home():\r\n #return &#39;Hello WorldTom!&#39;\r\n \r\nif __name__ == &#39;__main__&#39;:\r\n app.run(debug=True)\r\n app.logger()\r\n\r\n\r\n```\r\n\r\n**Output:**\r\n```\r\n* Serving Flask app &#39;webflask&#39; (lazy loading)\r\n * Environment: production\r\n WARNING: This is a development server. Do not use it in a production deployment.\r\n Use a production WSGI server instead.\r\n * Debug mode: on\r\n * Restarting with stat\r\n * Debugger is active!\r\n * Debugger PIN: 492-502-031\r\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\r\n127.0.0.1 - - [09/Jun/2021 19:15:09] &quot;GET / HTTP/1.1&quot; 200 -\r\niMaxPos = 4\r\niMaxColor = 4\r\nDone\r\n4\r\n127.0.0.1 - - [09/Jun/2021 19:15:12] &quot;POST / HTTP/1.1&quot; 302 -\r\n127.0.0.1 - - [09/Jun/2021 19:15:12] &quot;GET /the-game-Tim%20Boekhorst HTTP/1.1&quot; 200 -\r\n```","link":"https://stackoverflow.com/questions/67908940/python-class-integration-for-loop-not-working","title":"Python class integration for-loop not working","body":"<p>For a school project, I am building a mastermind game with Python 3.8 and Flask webapp. Firstly, I created a program just using functions, and now I am trying to implement classes.</p>\n<p>When: 'objMastermind.secret_list(objMastermind)' is executed in Flask.py it return []. However, the variable iMaxPos, iMaxColor = 4? Thus, the for-loop isn't doing his job.</p>\n<p>Can someone help me out?\nThanks in advance!</p>\n<p><em>main = webflask.py</em></p>\n<p><strong>mastermind.py</strong></p>\n<pre><code># Built-in library\nimport random\n\nMAX_COLORS = 4\nMAX_POSITIONS = 4\ncorrectGuesses = 0\ncurrentTries = 0\n\nclass Mastermind(): \n\n @property\n def userInputs(self, iMaxColors, iMaxPositions, iGuessesList, qSecretList):\n self.iMaxColors = iMaxColors\n self.iMaxPositons = iMaxPositions\n self.iGuessesList = iGuessesList\n self.qSecretList = qSecretList\n return self.iMaxColors, self.iMaxPositons, self.iMaxPositons\n\n @userInputs.setter\n def userInputs(self, iMaxColors, iMaxPositions, iGuessesList, qSecretList):\n self.iMaxColors = iMaxColors\n self.iMaxPositons = iMaxPositions\n self.iGuessesList = iGuessesList\n self.qSecretList = qSecretList\n\n def __init__(self):\n self.iMaxColors = 0\n self.iMaxPositons = 0\n self.iGuessesList = []\n self.qSecretList = []\n\n #generates a list of random numbers\n def secret_list(self, objMastermind):\n objMastermind.qSecretList = []\n print(&quot;iMaxPos =&quot;, objMastermind.iMaxPositions)\n print(&quot;iMaxColor =&quot;, objMastermind.iMaxColors)\n\n #loop max_positions amount of times\n for i in range(int(objMastermind.iMaxPositons)): \n objMastermind.qSecretList.append(random.randint(1, int(objMastermind.iMaxColors)))\n print(i)\n #print the secret_list ** don't tell anyone **\n print(objMastermind.qSecretList)\n print(&quot;Done&quot;)\n print(objMastermind.iMaxColors)\n return objMastermind.qSecretList\n\n def guesses(objMastermind):\n guess_list = []\n for i in range(objMastermind.iMaxPositons):\n guess_list.append(int(input(&quot;Please, guess the number: &quot;)))\n\n #print the inserted \n print(&quot;\\n&quot;, guess_list)\n return guess_list\n\n def checkResult(mastermind_list, guesses_list):\n correctGuesses = 0\n closeGuesses = 0\n for i in range(len(guesses_list)):\n if(guesses_list[i] == mastermind_list[i]):\n correctGuesses += 1\n \n print(&quot;correctGuesses: &quot;, correctGuesses)\n\n closeGuesses = len(set(guesses_list).intersection(mastermind_list))\n closeGuesses -= correctGuesses\n \n print(&quot;closeGuesses: &quot;, closeGuesses)\n\n return correctGuesses \n\nif __name__ == &quot;__main__&quot;:\n\n #mastermind_list = Mastermind.secret_list(MAX_COLORS, MAX_POSITIONS)\n #print(mastermind_list)\n\n #print(&quot;Welcome to the Mastermind game&quot;)\n #print(&quot;Try to guess the 4 secret numbers.\\n&quot;)\n\n while(correctGuesses &lt; MAX_POSITIONS):\n #guesses_list = Mastermind.guesses(MAX_POSITIONS)\n\n #correctGuesses = Mastermind.checkResult(mastermind_list, guesses_list)\n \n currentTries += 1\n if(correctGuesses &lt; MAX_POSITIONS):\n print(&quot;\\nYou guessed &quot; + str(correctGuesses) + &quot; number(s) corretly.\\n&quot;)\n correctGuesses = 0\n continue\n else:\n if (currentTries == 1):\n print(&quot;Congratulation, you guessed all 4 numers!! It took you &quot; + str(currentTries) + &quot; try.\\n&quot;)\n else:\n print(&quot;Congratulation, you guessed all 4 numers!! It took you &quot; + str(currentTries) + &quot; tries.\\n&quot;)\n</code></pre>\n<p><strong>webflask.py</strong></p>\n<pre><code>from mastermind import Mastermind\nfrom flask import Flask, render_template, request, url_for, redirect\nfrom werkzeug.utils import redirect\n\napp = Flask(__name__, template_folder='template')\n\n#init\nobjMastermind = Mastermind()\n\n@app.route('/', methods=[&quot;POST&quot;, &quot;GET&quot;])\ndef mastermind_home():\n \n if(request.method == &quot;POST&quot;):\n player_name= request.form[&quot;fullName&quot;]\n objMastermind.iMaxColors = int(request.form[&quot;maxColors&quot;])\n objMastermind.iMaxPositions = int(request.form[&quot;maxPositions&quot;])\n objMastermind.secret_list(objMastermind)\n return redirect(url_for(&quot;startGame&quot;, usr=player_name))\n else:\n return render_template('mastermind_html.html')\n\n@app.route(&quot;/the-game-&lt;usr&gt;&quot;)\ndef startGame(usr):\n guessList = []\n mastermind_list = []\n if(request.method == &quot;POST&quot;):\n guessListPos1= request.form[&quot;guessListPos1&quot;]\n guessListPos2= request.form[&quot;guessListPos2&quot;]\n guessListPos3= request.form[&quot;guessListPos3&quot;]\n guessListPos4= request.form[&quot;guessListPos4&quot;]\n\n guessList.append(guessListPos1, guessListPos2, guessListPos3, guessListPos4)\n Mastermind.Mastermind.checkResult(mastermind_list, guessList)\n return render_template('mastermind_game.html', fullname = usr)\n else:\n return render_template('mastermind_game.html', fullname = usr)\n #return f&quot;&lt;h1&gt;{usr}&lt;/h1&gt;&quot;\n\n\n\n#@app.route('/')\n#def home():\n #return 'Hello WorldTom!'\n \nif __name__ == '__main__':\n app.run(debug=True)\n app.logger()\n\n\n</code></pre>\n<p><strong>Output:</strong></p>\n<pre><code>* Serving Flask app 'webflask' (lazy loading)\n * Environment: production\n WARNING: This is a development server. Do not use it in a production deployment.\n Use a production WSGI server instead.\n * Debug mode: on\n * Restarting with stat\n * Debugger is active!\n * Debugger PIN: 492-502-031\n * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n127.0.0.1 - - [09/Jun/2021 19:15:09] &quot;GET / HTTP/1.1&quot; 200 -\niMaxPos = 4\niMaxColor = 4\nDone\n4\n127.0.0.1 - - [09/Jun/2021 19:15:12] &quot;POST / HTTP/1.1&quot; 302 -\n127.0.0.1 - - [09/Jun/2021 19:15:12] &quot;GET /the-game-Tim%20Boekhorst HTTP/1.1&quot; 200 -\n</code></pre>\n"},{"tags":["c#",".net","datagridview"],"owner":{"reputation":1,"user_id":6951001,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/90574f53e532d5af85038dc7ffd8b379?s=128&d=identicon&r=PG&f=1","display_name":"DBAStarter","link":"https://stackoverflow.com/users/6951001/dbastarter"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259302,"creation_date":1623259302,"question_id":67908939,"share_link":"https://stackoverflow.com/q/67908939","body_markdown":"I have a bound DataGridView in which I&#39;ve set a DateTimePicker control to become accessible when I click in the first column of a row. This works well.\r\n\r\nMy problem is when I exit the DateTimePicker cell and the DataGridView is repopulated the active cell always becomes the top left in the grid. To remedy this, I store the current Column and Row indexes then set the CurrentCell:\r\n```\r\nint iColumn = e.ColumnIndex;\r\nint iRow = e.RowIndex;\r\ndgvDataGrid.CurrentCell = dgvDataGrid[iColumn + 1, iRow];\r\n```\r\nI tried including\r\n```\r\ndgvDataGrid.CurrentCell.Selected = true;\r\n```\r\nAnd\r\n```\r\ndgvDataGrid.BeginEdit(true);\r\n```\r\nBut it seems no matter what I try I cannot begin entering data into the Selected cell unless I actually click in that cell first. I have checked, the iColumn and iRow values are what I expect/want them to be.\r\n\r\nMy goal is to set the CurrentCell then be able to enter data into it with out having to click the cell first.\r\nAny help is appreciated. \r\n","link":"https://stackoverflow.com/questions/67908939/cannot-type-in-cell-after-setting-datagridview-currentcell","title":"Cannot type in cell after setting DataGridView.CurrentCell","body":"<p>I have a bound DataGridView in which I've set a DateTimePicker control to become accessible when I click in the first column of a row. This works well.</p>\n<p>My problem is when I exit the DateTimePicker cell and the DataGridView is repopulated the active cell always becomes the top left in the grid. To remedy this, I store the current Column and Row indexes then set the CurrentCell:</p>\n<pre><code>int iColumn = e.ColumnIndex;\nint iRow = e.RowIndex;\ndgvDataGrid.CurrentCell = dgvDataGrid[iColumn + 1, iRow];\n</code></pre>\n<p>I tried including</p>\n<pre><code>dgvDataGrid.CurrentCell.Selected = true;\n</code></pre>\n<p>And</p>\n<pre><code>dgvDataGrid.BeginEdit(true);\n</code></pre>\n<p>But it seems no matter what I try I cannot begin entering data into the Selected cell unless I actually click in that cell first. I have checked, the iColumn and iRow values are what I expect/want them to be.</p>\n<p>My goal is to set the CurrentCell then be able to enter data into it with out having to click the cell first.\nAny help is appreciated.</p>\n"},{"tags":["javascript","date","timezone","timezone-offset"],"comments":[{"owner":{"reputation":448,"user_id":5091166,"user_type":"registered","profile_image":"https://i.stack.imgur.com/CNSWr.png?s=128&g=1","display_name":"JavaScript","link":"https://stackoverflow.com/users/5091166/javascript"},"edited":false,"score":1,"creation_date":1623228389,"post_id":67900555,"comment_id":120016390,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":124839,"user_id":257182,"user_type":"registered","accept_rate":43,"profile_image":"https://www.gravatar.com/avatar/f2c683e7dc0c4d4bcc790f87eaa67301?s=128&d=identicon&r=PG","display_name":"RobG","link":"https://stackoverflow.com/users/257182/robg"},"edited":false,"score":0,"creation_date":1623230357,"post_id":67900555,"comment_id":120017228,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":19,"user_id":11825348,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/39d634f30787726eb74a501ce3ba5911?s=128&d=identicon&r=PG&f=1","display_name":"parsa","link":"https://stackoverflow.com/users/11825348/parsa"},"is_accepted":false,"score":-1,"last_activity_date":1623229079,"creation_date":1623229079,"answer_id":67900811,"question_id":67900555,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":198020,"user_id":634824,"user_type":"registered","accept_rate":87,"profile_image":"https://www.gravatar.com/avatar/889cf720c96957e615463b5c903a5e18?s=128&d=identicon&r=PG","display_name":"Matt Johnson-Pint","link":"https://stackoverflow.com/users/634824/matt-johnson-pint"},"is_accepted":false,"score":0,"last_activity_date":1623259301,"creation_date":1623259301,"answer_id":67908938,"question_id":67900555,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":19,"user_id":11825348,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/39d634f30787726eb74a501ce3ba5911?s=128&d=identicon&r=PG&f=1","display_name":"parsa","link":"https://stackoverflow.com/users/11825348/parsa"},"is_answered":false,"view_count":35,"answer_count":2,"score":1,"last_activity_date":1623259301,"creation_date":1623227996,"question_id":67900555,"share_link":"https://stackoverflow.com/q/67900555","body_markdown":"I recently noticed that the values of these two are different on some dates.\r\n\r\nFor example, the output of both is the same for `04/01/2020` but different for `03/01/2020`.\r\n\r\n```javascript\r\nconsole.log(\r\n new Date(&quot;2020/03/01&quot;).getTimezoneOffset(), //-210\r\n new Date().getTimezoneOffset(), //-270\r\n);\r\n\r\nconsole.log(\r\n new Date(&quot;2020/04/01&quot;).getTimezoneOffset(), //-270\r\n new Date().getTimezoneOffset(), //-270\r\n);\r\n\r\n```\r\n\r\nI did this test for all the months of this year and the result was:\r\n\r\n- `2020/01/01` -&gt; different ``` ```\r\n- `2020/02/01` -&gt; different \r\n- `2020/03/01` -&gt; different \r\n- `2020/04/01` -&gt; same\r\n- `2020/05/01` -&gt; same\r\n- `2020/06/01` -&gt; same\r\n- `2020/07/01` -&gt; same\r\n- `2020/08/01` -&gt; same\r\n- `2020/09/01` -&gt; same\r\n- `2020/10/01` -&gt; different \r\n- `2020/11/01` -&gt; different \r\n- `2020/12/01` -&gt; different ","link":"https://stackoverflow.com/questions/67900555/what-is-the-difference-between-new-date-gettimezoneoffset-and-new-datestrin","title":"What is the difference between new Date().getTimezoneOffset() and new Date(string).getTimezoneOffset()?","body":"<p>I recently noticed that the values of these two are different on some dates.</p>\n<p>For example, the output of both is the same for <code>04/01/2020</code> but different for <code>03/01/2020</code>.</p>\n<pre class=\"lang-js prettyprint-override\"><code>console.log(\n new Date(&quot;2020/03/01&quot;).getTimezoneOffset(), //-210\n new Date().getTimezoneOffset(), //-270\n);\n\nconsole.log(\n new Date(&quot;2020/04/01&quot;).getTimezoneOffset(), //-270\n new Date().getTimezoneOffset(), //-270\n);\n\n</code></pre>\n<p>I did this test for all the months of this year and the result was:</p>\n<ul>\n<li><code>2020/01/01</code> -&gt; different <code> </code></li>\n<li><code>2020/02/01</code> -&gt; different</li>\n<li><code>2020/03/01</code> -&gt; different</li>\n<li><code>2020/04/01</code> -&gt; same</li>\n<li><code>2020/05/01</code> -&gt; same</li>\n<li><code>2020/06/01</code> -&gt; same</li>\n<li><code>2020/07/01</code> -&gt; same</li>\n<li><code>2020/08/01</code> -&gt; same</li>\n<li><code>2020/09/01</code> -&gt; same</li>\n<li><code>2020/10/01</code> -&gt; different</li>\n<li><code>2020/11/01</code> -&gt; different</li>\n<li><code>2020/12/01</code> -&gt; different</li>\n</ul>\n"},{"tags":["node.js","reactjs","typescript"],"owner":{"reputation":1,"user_id":14403853,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e1539f1ec4bf7d7218597d7d7f704ade?s=128&d=identicon&r=PG&f=1","display_name":"dkdj44","link":"https://stackoverflow.com/users/14403853/dkdj44"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259299,"creation_date":1623259299,"question_id":67908937,"share_link":"https://stackoverflow.com/q/67908937","body_markdown":"controller node js \r\n```\r\n const vacation = new vacationModel(req.body);\r\n console.log(req.files);\r\n\r\n if (req.files === undefined) {\r\n console.log(&quot;missing image&quot;);\r\n return res.status(400).send(&quot;missing image&quot;);\r\n }\r\n const image = req.files.vacationImageName;\r\n console.log(image);\r\n\r\n const addedVacation = await vacationLogic.addNewVacationAsync(\r\n vacation,\r\n image\r\n );\r\n res.json(addedVacation);\r\n } catch (err) {\r\n console.log(err);\r\n res.status(400).send(err.message);\r\n }\r\n});\r\n```\r\nreact app\r\n```\r\n async function send(vacation: vacationModel) {\r\n try {\r\n const res = await axios.post&lt;vacationModel&gt;(\r\n globals.addNewVacationUrl,\r\n vacationModel.convertToFormData(vacation)\r\n );\r\n console.log(vacationModel.convertToFormData(vacation));\r\n```\r\nthe result was that the image was send as a req.body \r\nbut not as a req.files so i cant accsses the image from node cause its undefined\r\n","link":"https://stackoverflow.com/questions/67908937/sending-an-image-as-post-request-in-react-with-axios-returns-undefiend","title":"sending an image as POST request in react with axios returns undefiend","body":"<p>controller node js</p>\n<pre><code> const vacation = new vacationModel(req.body);\n console.log(req.files);\n\n if (req.files === undefined) {\n console.log(&quot;missing image&quot;);\n return res.status(400).send(&quot;missing image&quot;);\n }\n const image = req.files.vacationImageName;\n console.log(image);\n\n const addedVacation = await vacationLogic.addNewVacationAsync(\n vacation,\n image\n );\n res.json(addedVacation);\n } catch (err) {\n console.log(err);\n res.status(400).send(err.message);\n }\n});\n</code></pre>\n<p>react app</p>\n<pre><code> async function send(vacation: vacationModel) {\n try {\n const res = await axios.post&lt;vacationModel&gt;(\n globals.addNewVacationUrl,\n vacationModel.convertToFormData(vacation)\n );\n console.log(vacationModel.convertToFormData(vacation));\n</code></pre>\n<p>the result was that the image was send as a req.body\nbut not as a req.files so i cant accsses the image from node cause its undefined</p>\n"},{"tags":["mysql","sql","oracle","oracle12c"],"comments":[{"owner":{"reputation":21611,"user_id":10138734,"user_type":"registered","profile_image":"https://i.stack.imgur.com/sf6Zj.jpg?s=128&g=1","display_name":"Akina","link":"https://stackoverflow.com/users/10138734/akina"},"edited":false,"score":0,"creation_date":1623243408,"post_id":67903994,"comment_id":120023095,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":21611,"user_id":10138734,"user_type":"registered","profile_image":"https://i.stack.imgur.com/sf6Zj.jpg?s=128&g=1","display_name":"Akina","link":"https://stackoverflow.com/users/10138734/akina"},"is_accepted":false,"score":0,"last_activity_date":1623243606,"creation_date":1623243606,"answer_id":67904671,"question_id":67903994,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":2119,"user_id":2527458,"user_type":"registered","accept_rate":36,"profile_image":"https://i.stack.imgur.com/fYtXY.jpg?s=128&g=1","display_name":"majid hajibaba","link":"https://stackoverflow.com/users/2527458/majid-hajibaba"},"is_accepted":false,"score":0,"last_activity_date":1623245330,"creation_date":1623245330,"answer_id":67905131,"question_id":67903994,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":712,"user_id":9010859,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/524fca838730d14d33ed041b3f42ca0b?s=128&d=identicon&r=PG&f=1","display_name":"JagaSrik","link":"https://stackoverflow.com/users/9010859/jagasrik"},"is_answered":false,"view_count":22,"answer_count":2,"score":0,"last_activity_date":1623259299,"creation_date":1623241055,"last_edit_date":1623259299,"question_id":67903994,"share_link":"https://stackoverflow.com/q/67903994","body_markdown":"Consider my source table as given below i.e customer.\r\n\r\nHow can i get the required output as shown using sql (oracle or mysql)\r\n\r\ncustomer :\r\n\r\n customer id Purchase_id cashback \r\n 123\t\tabc111\t\t\t5\r\n 123\t\tabc112\t\t\t5\r\n 123\t\tabc113\t\t\t2\r\n 345\t\tabc311\t\t\t0\r\n 345\t\tabc312\t\t\t2\t\r\n 678\t\tabc611\t\t\t4\t\r\n 678\t\tabc612\t\t\t3\t\r\n 678\t\tabc613\t\t\t5\t\r\n\r\nOutput Needed:\r\n\r\n ID \tpurchare_id_1 purchare_id_2 purchare_id_3 cashback_1 cashback_2 cashback_3 \r\n 123 \tabc111\t\t\tabc112\t\tabc113\t\t\t5\t\t\t5\t\t\t2\r\n 345\tabc311\t\t\tabc312\t\t\t\t\t\t0\t\t\t2\t\t\t\r\n 678\tabc611\t\t\tabc612\t\tabc613\t\t\t4\t\t\t3\t\t\t5\t\r\n\r\n\r\nDML and DDL:\r\n\r\n create table cust_table (\r\n customer_id int, Purchase_id varchar(100), cashback int\r\n );\r\n \r\n insert into cust_table values\r\n (123 , &#39;abc111&#39; , 5),\r\n (123 , &#39;abc112&#39; , 5),\r\n (123 , &#39;abc113&#39; , 2),\r\n ( 345 , &#39;abc311&#39; , 0),\r\n (345 , &#39;abc312&#39; , 2),\r\n (678 , &#39;abc611&#39; , 4),\r\n (678 , &#39;abc612&#39; , 3),\r\n (678 , &#39;abc613&#39; , 5);\r\n \r\n commit;\r\n\r\nPS:\r\nData might be not static, it can change.","link":"https://stackoverflow.com/questions/67903994/how-can-i-get-this-pivot-kind-of-output-in-sql","title":"How can I get this pivot kind of output in sql","body":"<p>Consider my source table as given below i.e customer.</p>\n<p>How can i get the required output as shown using sql (oracle or mysql)</p>\n<p>customer :</p>\n<pre><code> customer id Purchase_id cashback \n 123 abc111 5\n 123 abc112 5\n 123 abc113 2\n 345 abc311 0\n 345 abc312 2 \n 678 abc611 4 \n 678 abc612 3 \n 678 abc613 5 \n</code></pre>\n<p>Output Needed:</p>\n<pre><code> ID purchare_id_1 purchare_id_2 purchare_id_3 cashback_1 cashback_2 cashback_3 \n 123 abc111 abc112 abc113 5 5 2\n 345 abc311 abc312 0 2 \n 678 abc611 abc612 abc613 4 3 5 \n</code></pre>\n<p>DML and DDL:</p>\n<pre><code>create table cust_table (\ncustomer_id int, Purchase_id varchar(100), cashback int\n);\n\ninsert into cust_table values\n (123 , 'abc111' , 5),\n (123 , 'abc112' , 5),\n (123 , 'abc113' , 2),\n ( 345 , 'abc311' , 0),\n (345 , 'abc312' , 2),\n (678 , 'abc611' , 4),\n (678 , 'abc612' , 3),\n (678 , 'abc613' , 5);\n \n commit;\n</code></pre>\n<p>PS:\nData might be not static, it can change.</p>\n"},{"tags":["java","arrays","char"],"comments":[{"owner":{"reputation":430,"user_id":2587373,"user_type":"registered","accept_rate":75,"profile_image":"https://i.stack.imgur.com/J1TaD.jpg?s=128&g=1","display_name":"T. Sar","link":"https://stackoverflow.com/users/2587373/t-sar"},"edited":false,"score":0,"creation_date":1623259204,"post_id":67908687,"comment_id":120030624,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":691,"user_id":9901515,"user_type":"registered","profile_image":"https://i.stack.imgur.com/sASPI.png?s=128&g=1","display_name":"csalmhof","link":"https://stackoverflow.com/users/9901515/csalmhof"},"is_accepted":false,"score":2,"last_activity_date":1623259292,"last_edit_date":1623259292,"creation_date":1623258600,"answer_id":67908772,"question_id":67908687,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":111,"user_id":11057391,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/06497cd1e589611aa9863dc56786060c?s=128&d=identicon&r=PG&f=1","display_name":"Saravanan","link":"https://stackoverflow.com/users/11057391/saravanan"},"is_accepted":false,"score":1,"last_activity_date":1623258759,"creation_date":1623258759,"answer_id":67908819,"question_id":67908687,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":80,"user_id":15156924,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/99f9cac5ba5ba23f9da2125bb308b70a?s=128&d=identicon&r=PG&f=1","display_name":"Denes Garda","link":"https://stackoverflow.com/users/15156924/denes-garda"},"is_accepted":true,"score":1,"last_activity_date":1623259132,"last_edit_date":1623259132,"creation_date":1623258773,"answer_id":67908824,"question_id":67908687,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":49,"user_id":15393275,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/5bb1dc9724fcc8822a160be3fd44d773?s=128&d=identicon&r=PG&f=1","display_name":"Ciro Mertens","link":"https://stackoverflow.com/users/15393275/ciro-mertens"},"is_answered":true,"view_count":20,"accepted_answer_id":67908824,"answer_count":3,"score":0,"last_activity_date":1623259292,"creation_date":1623258207,"last_edit_date":1623259071,"question_id":67908687,"share_link":"https://stackoverflow.com/q/67908687","body_markdown":"I have a char array called data. \r\n\r\nI should write a method that makes it possible to return the array but with a starting point that is an integer variable called beginIndex.\r\n\r\nExample: array contains &#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39; and beginIndex = 2. Then it should return &#39;B&#39;, &#39;C&#39;, &#39;D&#39; (yes the index himself in this case the 2nd letter should be included as well!)\r\n\r\nHow do I do this? Or is it wiser to change it into a String and later change it back into a char array?\r\n","link":"https://stackoverflow.com/questions/67908687/start-a-char-array-from-a-certain-index","title":"start a char array from a certain index","body":"<p>I have a char array called data.</p>\n<p>I should write a method that makes it possible to return the array but with a starting point that is an integer variable called beginIndex.</p>\n<p>Example: array contains 'A', 'B', 'C', 'D' and beginIndex = 2. Then it should return 'B', 'C', 'D' (yes the index himself in this case the 2nd letter should be included as well!)</p>\n<p>How do I do this? Or is it wiser to change it into a String and later change it back into a char array?</p>\n"},{"tags":["c#","asp.net-core","signalr","unity-container"],"owner":{"reputation":1,"user_id":16178248,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJw7D1-n5lwZJ9LuOjMOj0uuNo91hdXWJkpGd-aK=k-s128","display_name":"Dhiren Bhatia","link":"https://stackoverflow.com/users/16178248/dhiren-bhatia"},"is_answered":false,"view_count":2,"answer_count":0,"score":0,"last_activity_date":1623259290,"creation_date":1623259290,"question_id":67908936,"share_link":"https://stackoverflow.com/q/67908936","body_markdown":"I am migrating my current code which is in .NET framework 4.8 to new .NET Core 5.0.\r\nFollowing is my original Startup.cs and additional file which I use to self host.\r\n\r\n \r\n namespace NHSHub.Core\r\n {\r\n using Owin;\r\n using Microsoft.Owin.Cors;\r\n using Microsoft.Owin.Host.HttpListener;\r\n using Microsoft.AspNet.SignalR;\r\n \r\n using Microsoft.AspNet.SignalR.Transports;\r\n using Unity;\r\n using NHSHub.CMS;\r\n \r\n using System.Net;\r\n \r\n public class Startup\r\n {\r\n public void Configuration(IAppBuilder app)\r\n {\r\n var container = new UnityContainer();\r\n var unityConfiguration = new UnityConfiguration();\r\n unityConfiguration.RegisterTypes(container);\r\n \r\n GlobalHost.DependencyResolver = new UnityDependencyResolver(container);\r\n \r\n GlobalHost.HubPipeline.AddModule(new SessionIdCheckModule());\r\n \r\n app.UseCors(new CorsOptions\r\n {\r\n PolicyProvider = new WildcardCorsPolicyProvider()\r\n });\r\n \r\n var listener = (HttpListener)app.Properties[typeof(HttpListener).FullName];\r\n listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm | AuthenticationSchemes.Negotiate;\r\n \r\n //Throttling of http.sys to prevent too many requests being accepted at once.\r\n var maxAccepts = 25;\r\n var maxRequests = 25;\r\n var queueLimit = 25;\r\n var owinListener = (OwinHttpListener)app.Properties[typeof(OwinHttpListener).FullName];\r\n owinListener.SetRequestProcessingLimits(maxAccepts, maxRequests);\r\n owinListener.SetRequestQueueLimit(queueLimit);\r\n \r\n TurnOffWebSocket(GlobalHost.DependencyResolver);\r\n \r\n app.MapSignalR();\r\n }\r\n \r\n //Have to use Ajax long polling as the transport, to get around mixed content blocking in browsers.\r\n public void TurnOffWebSocket(IDependencyResolver resolver)\r\n {\r\n var transportManager = resolver.Resolve&lt;ITransportManager&gt;() as TransportManager;\r\n transportManager.Remove(&quot;webSockets&quot;);\r\n transportManager.Remove(&quot;serverSentEvents&quot;);\r\n transportManager.Remove(&quot;foreverFrame&quot;);\r\n }\r\n }}\r\n\r\nand Other file\r\n\r\n public class ServerStarter : IServerStarter\r\n {\r\n private static readonly Logger Logger = LogManager.GetCurrentClassLogger();\r\n private IDisposable _signalR;\r\n private readonly object _lockObject = new object();\r\n private bool _started = false;\r\n private string UrlAclPrefix = &quot;http://127.0.0.1:&quot;;\r\n private ServerSettings _settings = null;\r\n\r\n public void StartServer()\r\n {\r\n Logger.Debug(&quot;StartServer()&quot;);\r\n\r\n try\r\n {\r\n lock (_lockObject) //Necessary check in case 2 threadpool threads call this method in immediate succession.\r\n {\r\n if (_started == false) //Necessary check to see if webapp is already started. (Can&#39;t check if _signalR is null here - doesn&#39;t work in locking / unlocking scenarios.)\r\n {\r\n\r\n Logger.Info(&quot;Initializing Hub Core.&quot;);\r\n\r\n //Needed to find hubs in separate projects...\r\n AppDomain.CurrentDomain.Load(typeof(TicketApiHub).Assembly.FullName);\r\n AppDomain.CurrentDomain.Load(typeof(CmsHub).Assembly.FullName);\r\n\r\n ListenToPort();\r\n\r\n Logger.Info($&quot;Started listening for connections on &#39;{UrlAclPrefix + _settings?.PortNo + &quot;/&quot;}&#39;.&quot;);\r\n _started = true;\r\n }\r\n }\r\n }\r\n catch (Exception ex)\r\n {\r\n Logger.Info($&quot;WebApp.Start failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\r\n MessageBox.Show(&quot;Application failed to start. Please see system administrator.&quot;, &quot;NHS Credential Management&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error);\r\n Application.Exit();\r\n }\r\n }\r\n\r\n //This method can be called by multiple threadpool threads at the same time.\r\n public void StopServer()\r\n {\r\n Logger.Debug(&quot;StopServer()&quot;);\r\n\r\n lock (_lockObject)\r\n {\r\n if (_signalR != null)\r\n {\r\n Logger.Debug(&quot;Stop listening on the port()&quot;);\r\n ReleasePortNumber();\r\n _signalR.Dispose();\r\n _signalR = null;\r\n _started = false;\r\n }\r\n }\r\n }\r\n\r\n // Request to release the port number from the NHS Port Service using the client proxy.\r\n private void ReleasePortNumber()\r\n {\r\n Logger.Debug(&quot;ReleasePortNumber()&quot;);\r\n\r\n try\r\n {\r\n Logger.Info(&quot;Releasing port number from NHS Port Service&quot;);\r\n var proxy = new ProxyClient();\r\n proxy.DeAllocatePortNumber();\r\n }\r\n catch (FaultException ex)\r\n {\r\n Logger.Info($&quot;Port number release failed from NHS Port Service. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\r\n }\r\n catch (Exception ex)\r\n {\r\n Logger.Info($&quot;Port number release failed from NHS Port Service. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\r\n }\r\n }\r\n\r\n //This should always work first time unless there&#39;s a very unusual circumstance where PRS assigns a port number and then it is taken \r\n //by something else before NHS Credential Management gets chance to start.\r\n //In that circumstance, loop and get another port from PRS.\r\n //Keep looping until successfully started. (In theory, if it gets through the entire range of ports in PRS and none work, \r\n //then you&#39;ll get a NoPortNumberAvailable exception and then put up a message saying NHS Credential Management failed to start. This should never happen though.)\r\n private void ListenToPort()\r\n {\r\n var response = false;\r\n\r\n while (!response)\r\n {\r\n try\r\n {\r\n var portNumber = GetPortNumber();\r\n var url = UrlAclPrefix + portNumber + &quot;/&quot;;\r\n _signalR = WebApp.Start&lt;Startup&gt;(url);\r\n response = true;\r\n }\r\n catch (FaultException ex)\r\n {\r\n if (ex.Code == PRSExceptions.ServiceNotAvailable || ex.Code == PRSExceptions.NoPortNumberAvailable)\r\n {\r\n //Nothing we can do if PRS is down - just throw exception and put up message saying failed to start NHS Credential Management.\r\n throw;\r\n }\r\n }\r\n catch (Exception ex)\r\n {\r\n //If it is a TargetInvocationException - keep looping and trying again.\r\n //Should only get a TargetInvocationException if the port is in use by something else.\r\n //If PRS is working properly, this would only happen if the port has started being used by something else in the very short period\r\n //of time since PRS assigned this port to this session.\r\n //In that rare circumstance, loop and get a different port number from PRS, and try again to start NHS Credential Management.\r\n\r\n //If it is any other exception, throw it and put up a message saying failed to start NHS Credential Management.\r\n if (!CatchTargetInvocationException(ex))\r\n {\r\n throw;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Request the port number from the NHS Port Service using a client proxy. Client proxy returns the port number which is available from the configured range.\r\n // Once the port number is received, the NHSHub will start listening on that port.\r\n public int GetPortNumber()\r\n {\r\n Logger.Debug(&quot;GetPortNumber()&quot;);\r\n\r\n try\r\n {\r\n Logger.Info(&quot;Getting the port number from the NHS Port Service&quot;);\r\n var proxy = new ProxyClient();\r\n var portNo = proxy.GetPortNumber();\r\n Logger.Info($&quot;Port no. received from the NHS Port Service {portNo}&quot;);\r\n _settings = new ServerSettings();\r\n _settings.PortNo = Convert.ToString(portNo);\r\n\r\n return portNo;\r\n }\r\n catch (FaultException ex)\r\n {\r\n Logger.Info($&quot;Getting Port Number from NHS Port Service failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\r\n throw;\r\n }\r\n catch (Exception ex)\r\n {\r\n Logger.Info($&quot;Getting Port Number from NHS Port Service failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\r\n throw;\r\n }\r\n }\r\n\r\n private bool CatchTargetInvocationException(Exception ex)\r\n {\r\n return (ex is TargetInvocationException &amp;&amp; ex.InnerException.Message.Contains(&quot;Failed to listen on prefix&quot;) &amp;&amp;\r\n ex.InnerException.Message.Contains(&quot;because it conflicts with an existing registration on the machine&quot;));\r\n }\r\n}}\r\n\r\n\r\n\r\n\r\n\r\n\r\nCan anyone suggest on following.\r\n 1. What is the replacement of Globalhost.Dependency resolver?\r\n 2. I want to keep using Unity for DI and not in build DI of asp.net core. How can I achieve that ?\r\n \r\n\r\n","link":"https://stackoverflow.com/questions/67908936/replace-globalhost-dependency-resolver-in-the-new-asp-net-core-signalr","title":"Replace Globalhost.Dependency resolver in the new Asp.net Core SignalR","body":"<p>I am migrating my current code which is in .NET framework 4.8 to new .NET Core 5.0.\nFollowing is my original Startup.cs and additional file which I use to self host.</p>\n<pre><code>namespace NHSHub.Core\n{\n using Owin;\n using Microsoft.Owin.Cors;\n using Microsoft.Owin.Host.HttpListener;\n using Microsoft.AspNet.SignalR;\n\n using Microsoft.AspNet.SignalR.Transports;\n using Unity;\n using NHSHub.CMS;\n\n using System.Net;\n\n public class Startup\n {\n public void Configuration(IAppBuilder app)\n {\n var container = new UnityContainer();\n var unityConfiguration = new UnityConfiguration();\n unityConfiguration.RegisterTypes(container);\n\n GlobalHost.DependencyResolver = new UnityDependencyResolver(container);\n\n GlobalHost.HubPipeline.AddModule(new SessionIdCheckModule());\n\n app.UseCors(new CorsOptions\n {\n PolicyProvider = new WildcardCorsPolicyProvider()\n });\n\n var listener = (HttpListener)app.Properties[typeof(HttpListener).FullName];\n listener.AuthenticationSchemes = AuthenticationSchemes.Ntlm | AuthenticationSchemes.Negotiate;\n\n //Throttling of http.sys to prevent too many requests being accepted at once.\n var maxAccepts = 25;\n var maxRequests = 25;\n var queueLimit = 25;\n var owinListener = (OwinHttpListener)app.Properties[typeof(OwinHttpListener).FullName];\n owinListener.SetRequestProcessingLimits(maxAccepts, maxRequests);\n owinListener.SetRequestQueueLimit(queueLimit);\n\n TurnOffWebSocket(GlobalHost.DependencyResolver);\n\n app.MapSignalR();\n }\n\n //Have to use Ajax long polling as the transport, to get around mixed content blocking in browsers.\n public void TurnOffWebSocket(IDependencyResolver resolver)\n {\n var transportManager = resolver.Resolve&lt;ITransportManager&gt;() as TransportManager;\n transportManager.Remove(&quot;webSockets&quot;);\n transportManager.Remove(&quot;serverSentEvents&quot;);\n transportManager.Remove(&quot;foreverFrame&quot;);\n }\n }}\n</code></pre>\n<p>and Other file</p>\n<pre><code>public class ServerStarter : IServerStarter\n{\n private static readonly Logger Logger = LogManager.GetCurrentClassLogger();\n private IDisposable _signalR;\n private readonly object _lockObject = new object();\n private bool _started = false;\n private string UrlAclPrefix = &quot;http://127.0.0.1:&quot;;\n private ServerSettings _settings = null;\n\npublic void StartServer()\n{\n Logger.Debug(&quot;StartServer()&quot;);\n\n try\n {\n lock (_lockObject) //Necessary check in case 2 threadpool threads call this method in immediate succession.\n {\n if (_started == false) //Necessary check to see if webapp is already started. (Can't check if _signalR is null here - doesn't work in locking / unlocking scenarios.)\n {\n\n Logger.Info(&quot;Initializing Hub Core.&quot;);\n\n //Needed to find hubs in separate projects...\n AppDomain.CurrentDomain.Load(typeof(TicketApiHub).Assembly.FullName);\n AppDomain.CurrentDomain.Load(typeof(CmsHub).Assembly.FullName);\n\n ListenToPort();\n\n Logger.Info($&quot;Started listening for connections on '{UrlAclPrefix + _settings?.PortNo + &quot;/&quot;}'.&quot;);\n _started = true;\n }\n }\n }\n catch (Exception ex)\n {\n Logger.Info($&quot;WebApp.Start failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\n MessageBox.Show(&quot;Application failed to start. Please see system administrator.&quot;, &quot;NHS Credential Management&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error);\n Application.Exit();\n }\n}\n\n//This method can be called by multiple threadpool threads at the same time.\npublic void StopServer()\n{\n Logger.Debug(&quot;StopServer()&quot;);\n\n lock (_lockObject)\n {\n if (_signalR != null)\n {\n Logger.Debug(&quot;Stop listening on the port()&quot;);\n ReleasePortNumber();\n _signalR.Dispose();\n _signalR = null;\n _started = false;\n }\n }\n}\n\n// Request to release the port number from the NHS Port Service using the client proxy.\nprivate void ReleasePortNumber()\n{\n Logger.Debug(&quot;ReleasePortNumber()&quot;);\n\n try\n {\n Logger.Info(&quot;Releasing port number from NHS Port Service&quot;);\n var proxy = new ProxyClient();\n proxy.DeAllocatePortNumber();\n }\n catch (FaultException ex)\n {\n Logger.Info($&quot;Port number release failed from NHS Port Service. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\n }\n catch (Exception ex)\n {\n Logger.Info($&quot;Port number release failed from NHS Port Service. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\n }\n}\n\n//This should always work first time unless there's a very unusual circumstance where PRS assigns a port number and then it is taken \n//by something else before NHS Credential Management gets chance to start.\n//In that circumstance, loop and get another port from PRS.\n//Keep looping until successfully started. (In theory, if it gets through the entire range of ports in PRS and none work, \n//then you'll get a NoPortNumberAvailable exception and then put up a message saying NHS Credential Management failed to start. This should never happen though.)\nprivate void ListenToPort()\n{\n var response = false;\n\n while (!response)\n {\n try\n {\n var portNumber = GetPortNumber();\n var url = UrlAclPrefix + portNumber + &quot;/&quot;;\n _signalR = WebApp.Start&lt;Startup&gt;(url);\n response = true;\n }\n catch (FaultException ex)\n {\n if (ex.Code == PRSExceptions.ServiceNotAvailable || ex.Code == PRSExceptions.NoPortNumberAvailable)\n {\n //Nothing we can do if PRS is down - just throw exception and put up message saying failed to start NHS Credential Management.\n throw;\n }\n }\n catch (Exception ex)\n {\n //If it is a TargetInvocationException - keep looping and trying again.\n //Should only get a TargetInvocationException if the port is in use by something else.\n //If PRS is working properly, this would only happen if the port has started being used by something else in the very short period\n //of time since PRS assigned this port to this session.\n //In that rare circumstance, loop and get a different port number from PRS, and try again to start NHS Credential Management.\n\n //If it is any other exception, throw it and put up a message saying failed to start NHS Credential Management.\n if (!CatchTargetInvocationException(ex))\n {\n throw;\n }\n }\n }\n}\n\n// Request the port number from the NHS Port Service using a client proxy. Client proxy returns the port number which is available from the configured range.\n// Once the port number is received, the NHSHub will start listening on that port.\npublic int GetPortNumber()\n{\n Logger.Debug(&quot;GetPortNumber()&quot;);\n\n try\n {\n Logger.Info(&quot;Getting the port number from the NHS Port Service&quot;);\n var proxy = new ProxyClient();\n var portNo = proxy.GetPortNumber();\n Logger.Info($&quot;Port no. received from the NHS Port Service {portNo}&quot;);\n _settings = new ServerSettings();\n _settings.PortNo = Convert.ToString(portNo);\n\n return portNo;\n }\n catch (FaultException ex)\n {\n Logger.Info($&quot;Getting Port Number from NHS Port Service failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\n throw;\n }\n catch (Exception ex)\n {\n Logger.Info($&quot;Getting Port Number from NHS Port Service failed. Error description is: {ex?.Message}. InnerException Message is: {ex?.InnerException?.Message}&quot;);\n throw;\n }\n}\n\nprivate bool CatchTargetInvocationException(Exception ex)\n{\n return (ex is TargetInvocationException &amp;&amp; ex.InnerException.Message.Contains(&quot;Failed to listen on prefix&quot;) &amp;&amp;\n ex.InnerException.Message.Contains(&quot;because it conflicts with an existing registration on the machine&quot;));\n}\n</code></pre>\n<p>}}</p>\n<p>Can anyone suggest on following.</p>\n<ol>\n<li>What is the replacement of Globalhost.Dependency resolver?</li>\n<li>I want to keep using Unity for DI and not in build DI of asp.net core. How can I achieve that ?</li>\n</ol>\n"},{"tags":["sqlite"],"answers":[{"owner":{"reputation":118033,"user_id":10498828,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a1360dd652f1e970ba098d1d5b63c14d?s=128&d=identicon&r=PG&f=1","display_name":"forpas","link":"https://stackoverflow.com/users/10498828/forpas"},"is_accepted":false,"score":0,"last_activity_date":1623259289,"creation_date":1623259289,"answer_id":67908935,"question_id":67908652,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":87,"user_id":11704346,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/44942af2f7847e6a6a0ba38e0a10ecbd?s=128&d=identicon&r=PG&f=1","display_name":"UncommentedCode","link":"https://stackoverflow.com/users/11704346/uncommentedcode"},"is_answered":false,"view_count":6,"answer_count":1,"score":0,"last_activity_date":1623259289,"creation_date":1623258069,"question_id":67908652,"share_link":"https://stackoverflow.com/q/67908652","body_markdown":"In my SQLite database, I have a query that selects records where a string is present in one of several columns - i.e with the following\r\n\r\n|Column1|Column2|\r\n|---|---|\r\n|String|StringString|\r\n\r\nI have the following query: \r\n```SQLITE\r\nWHERE Column1 LIKE &#39;String&#39; OR Column2 LIKE &#39;%String%&#39;\r\n```\r\n\r\nHow can I make it so that the results are ordered based on which column they matched with? I.e. put items that matched from Column1 before items that were matched with Column2, or vice versa?","link":"https://stackoverflow.com/questions/67908652/sqlite-sort-by-source-column","title":"SQLite Sort by Source Column","body":"<p>In my SQLite database, I have a query that selects records where a string is present in one of several columns - i.e with the following</p>\n<div class=\"s-table-container\">\n<table class=\"s-table\">\n<thead>\n<tr>\n<th>Column1</th>\n<th>Column2</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>String</td>\n<td>StringString</td>\n</tr>\n</tbody>\n</table>\n</div>\n<p>I have the following query:</p>\n<pre><code>WHERE Column1 LIKE 'String' OR Column2 LIKE '%String%'\n</code></pre>\n<p>How can I make it so that the results are ordered based on which column they matched with? I.e. put items that matched from Column1 before items that were matched with Column2, or vice versa?</p>\n"},{"tags":["odoo","odoo-13"],"comments":[{"owner":{"reputation":11147,"user_id":3146213,"user_type":"registered","profile_image":"https://i.stack.imgur.com/IbhfG.jpg?s=128&g=1","display_name":"CZoellner","link":"https://stackoverflow.com/users/3146213/czoellner"},"edited":false,"score":0,"creation_date":1623175758,"post_id":67892116,"comment_id":120002256,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":309,"user_id":14012215,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1d23d92690c36b86e57f1f829bff0f8f?s=128&d=identicon&r=PG&f=1","display_name":"hedgethenight","link":"https://stackoverflow.com/users/14012215/hedgethenight"},"reply_to_user":{"reputation":11147,"user_id":3146213,"user_type":"registered","profile_image":"https://i.stack.imgur.com/IbhfG.jpg?s=128&g=1","display_name":"CZoellner","link":"https://stackoverflow.com/users/3146213/czoellner"},"edited":false,"score":0,"creation_date":1623176411,"post_id":67892116,"comment_id":120002529,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":11147,"user_id":3146213,"user_type":"registered","profile_image":"https://i.stack.imgur.com/IbhfG.jpg?s=128&g=1","display_name":"CZoellner","link":"https://stackoverflow.com/users/3146213/czoellner"},"edited":false,"score":0,"creation_date":1623223537,"post_id":67892116,"comment_id":120014229,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":309,"user_id":14012215,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1d23d92690c36b86e57f1f829bff0f8f?s=128&d=identicon&r=PG&f=1","display_name":"hedgethenight","link":"https://stackoverflow.com/users/14012215/hedgethenight"},"is_accepted":false,"score":0,"last_activity_date":1623259287,"creation_date":1623259287,"answer_id":67908934,"question_id":67892116,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":309,"user_id":14012215,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1d23d92690c36b86e57f1f829bff0f8f?s=128&d=identicon&r=PG&f=1","display_name":"hedgethenight","link":"https://stackoverflow.com/users/14012215/hedgethenight"},"is_answered":false,"view_count":16,"answer_count":1,"score":0,"last_activity_date":1623259287,"creation_date":1623174339,"question_id":67892116,"share_link":"https://stackoverflow.com/q/67892116","body_markdown":"I am having some issues with the Odoo scheduler. I am running Odoo 13. \r\n\r\n\r\n actions = models.execute_kw(db, uid, password, &#39;ir.cron&#39;, &#39;search&#39;, [[[&#39;name&#39;, &#39;=&#39;, &#39;Procurement: run scheduler&#39;]]])\r\n print(actions)\r\n \r\n schedule = models.execute_kw(db, uid, password, &#39;ir.cron&#39;, &#39;method_direct_trigger&#39;, [actions])\r\n print(schedule )\r\n\r\nI have attempted to change my config multiple times, increasing the time-outs. But the issue still keeps happening. \r\n\r\nThe error is \r\n\r\n xmlrpc.client.ProtocolError: &lt;ProtocolError for ip.adress/xmlrpc/2/object: 504 Gateway Time-out&gt;","link":"https://stackoverflow.com/questions/67892116/how-to-prevent-odoo-scheduler-from-timing-out","title":"How to prevent Odoo scheduler from timing out?","body":"<p>I am having some issues with the Odoo scheduler. I am running Odoo 13.</p>\n<pre><code>actions = models.execute_kw(db, uid, password, 'ir.cron', 'search', [[['name', '=', 'Procurement: run scheduler']]])\nprint(actions)\n\nschedule = models.execute_kw(db, uid, password, 'ir.cron', 'method_direct_trigger', [actions])\nprint(schedule )\n</code></pre>\n<p>I have attempted to change my config multiple times, increasing the time-outs. But the issue still keeps happening.</p>\n<p>The error is</p>\n<pre><code>xmlrpc.client.ProtocolError: &lt;ProtocolError for ip.adress/xmlrpc/2/object: 504 Gateway Time-out&gt;\n</code></pre>\n"},{"tags":["swift","uitableview","dynamic","uicollectionviewcell","collectionview"],"owner":{"reputation":11,"user_id":2365952,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ec5faf624a22319099a8acfd794d4e96?s=128&d=identicon&r=PG","display_name":"Aparna","link":"https://stackoverflow.com/users/2365952/aparna"},"is_answered":false,"view_count":16,"answer_count":0,"score":0,"last_activity_date":1623259280,"creation_date":1623057193,"last_edit_date":1623259280,"question_id":67868933,"share_link":"https://stackoverflow.com/q/67868933","body_markdown":"I have a collection view inside the table view cell, both are dynamic and collection view cells size are also dynamically based on label text size. When I land on that screen the collection view cell frame is not proper. And it becomes correct only after reload. I am using a custom layout for the collection view cell frames. ","link":"https://stackoverflow.com/questions/67868933/collectionview-dynamic-cell-size-proper-only-after-reload","title":"Collectionview dynamic cell size proper only after reload","body":"<p>I have a collection view inside the table view cell, both are dynamic and collection view cells size are also dynamically based on label text size. When I land on that screen the collection view cell frame is not proper. And it becomes correct only after reload. I am using a custom layout for the collection view cell frames.</p>\n"},{"tags":["c#","image","unity3d"],"comments":[{"owner":{"reputation":54,"user_id":11131159,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-_i-WsOTCCvQ/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reu5zJqQeeEVeVRz5C33Ksjur1WPw/mo/photo.jpg?sz=128","display_name":"Jahan","link":"https://stackoverflow.com/users/11131159/jahan"},"edited":false,"score":0,"creation_date":1623256341,"post_id":67908196,"comment_id":120029454,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":54,"user_id":11131159,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-_i-WsOTCCvQ/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reu5zJqQeeEVeVRz5C33Ksjur1WPw/mo/photo.jpg?sz=128","display_name":"Jahan","link":"https://stackoverflow.com/users/11131159/jahan"},"edited":false,"score":0,"creation_date":1623256489,"post_id":67908196,"comment_id":120029534,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"edited":false,"score":1,"creation_date":1623256679,"post_id":67908196,"comment_id":120029629,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":54,"user_id":11131159,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-_i-WsOTCCvQ/AAAAAAAAAAI/AAAAAAAAAAA/ACHi3reu5zJqQeeEVeVRz5C33Ksjur1WPw/mo/photo.jpg?sz=128","display_name":"Jahan","link":"https://stackoverflow.com/users/11131159/jahan"},"edited":false,"score":0,"creation_date":1623256777,"post_id":67908196,"comment_id":120029674,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":731,"user_id":1679220,"user_type":"registered","accept_rate":92,"profile_image":"https://www.gravatar.com/avatar/8c48d48053758cff69118a29655c3675?s=128&d=identicon&r=PG","display_name":"hijinxbassist","link":"https://stackoverflow.com/users/1679220/hijinxbassist"},"edited":false,"score":0,"creation_date":1623256781,"post_id":67908196,"comment_id":120029678,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16177838,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gho0yBawmPfIte9U6-A4YybtrStO8yWDcgZ7uetBg=k-s128","display_name":"Jorara99","link":"https://stackoverflow.com/users/16177838/jorara99"},"is_answered":false,"view_count":11,"answer_count":0,"score":-1,"last_activity_date":1623259280,"creation_date":1623256169,"last_edit_date":1623259280,"question_id":67908196,"share_link":"https://stackoverflow.com/q/67908196","body_markdown":"i am building a quiz program and i want to adding the image in the options\r\n\r\nhere is my code\r\n \r\n public class QuizManager : MonoBehaviour{\r\n public List&lt;QuestionAndAnswer&gt; QnA;\r\n public GameObject[] options;\r\n public int currentQuestion;\r\n public Text QuestionTxt;\r\n public Image QuestionImg;}\r\n\r\n\r\n\r\n void SetAnswers()\r\n {\r\n for (int i = 0; i &lt; options.Length; i++)\r\n {\r\n options[i].GetComponent&lt;Answer&gt;().isCorrect = false;\r\n options[i].transform.GetChild(0).GetComponent&lt;Image&gt;().Image = QnA[currentQuestion].Answers[i];\r\n\r\n if(QnA[currentQuestion].CorrectAnswer == i+1)\r\n {\r\n options[i].GetComponent&lt;Answer&gt;().isCorrect = true;\r\n }\r\n\r\n }\r\n }\r\n\r\n\r\nAnd i got this error\r\n\r\nImage&#39; does not contain a definition for &#39;Image&#39; and no accessible extension method &#39;Image&#39; accepting a first argument of type &#39;Image&#39; could be found (are you missing a using directive or an assembly reference?)\r\n\r\nplease help me :D","link":"https://stackoverflow.com/questions/67908196/how-do-i-add-image-in-unity","title":"How do i add image in unity","body":"<p>i am building a quiz program and i want to adding the image in the options</p>\n<p>here is my code</p>\n<pre><code> public class QuizManager : MonoBehaviour{\n public List&lt;QuestionAndAnswer&gt; QnA;\n public GameObject[] options;\n public int currentQuestion;\n public Text QuestionTxt;\n public Image QuestionImg;}\n\n\n\nvoid SetAnswers()\n {\n for (int i = 0; i &lt; options.Length; i++)\n {\n options[i].GetComponent&lt;Answer&gt;().isCorrect = false;\n options[i].transform.GetChild(0).GetComponent&lt;Image&gt;().Image = QnA[currentQuestion].Answers[i];\n\n if(QnA[currentQuestion].CorrectAnswer == i+1)\n {\n options[i].GetComponent&lt;Answer&gt;().isCorrect = true;\n }\n\n }\n }\n</code></pre>\n<p>And i got this error</p>\n<p>Image' does not contain a definition for 'Image' and no accessible extension method 'Image' accepting a first argument of type 'Image' could be found (are you missing a using directive or an assembly reference?)</p>\n<p>please help me :D</p>\n"},{"tags":["assembly","x86"],"owner":{"reputation":1,"user_id":15886177,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a576a4dfa1cd04f74c5afd0f8e223dbf?s=128&d=identicon&r=PG&f=1","display_name":"Amit Lior ","link":"https://stackoverflow.com/users/15886177/amit-lior"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259279,"creation_date":1623258653,"last_edit_date":1623259279,"question_id":67908785,"share_link":"https://stackoverflow.com/q/67908785","body_markdown":"In the proc section, before the start but in the code segment I wrote 2 procs, &#39;proc CheckYInput&#39; and proc &#39;CheckXInput&#39;, which are supposed to find out which button I pressed, compare it to the numbered cell and if it is one of the 8 random cell, print over it. \r\nIt&#39;s basically a very bad &#39;mine sweeper&#39;\r\n\r\n IDEAL\r\n MODEL small\r\n STACK 100h\r\n DATASEG\r\n \r\n \r\n ; random \r\n Clock equ es:6Ch\r\n \r\n \r\n ; after change \r\n \r\n \r\n \r\n ;for opening screen\r\n HTS DB &quot;mine sweeper&quot;\r\n PAKTC DB &quot;[Press space to continue]&quot;\r\n \r\n \r\n empty DB &quot; &quot;\r\n \r\n \txStart dw 1 ; x coordinate of line start\r\n \r\n yStart dw 0 ; y coordinate of line start\r\n \r\n length1 dw 1278 ; length1 of line1\r\n \r\n \tyStart2 dw 25 ; y coordinate of line2 start\r\n \t\r\n \tyStart3 dw 50 ; y coordinate of line3 start\r\n \r\n \tyStart4 dw 75 ; y coordinate of line4 start\r\n \r\n \tyStart5 dw 100 ; y coordinate of line5 start\r\n \r\n \tyStart6 dw 125 ; y coordinate of line6 start\r\n \r\n \tyStart7 dw 150 ; y coordinate of line7 start\r\n \r\n \tyStart8 dw 175 ; y coordinate of line8 start\r\n \t\r\n \t;for random\r\n \r\n Random1X db (?)\r\n Random2X db (?)\r\n Random3X db (?)\r\n Random4X db (?)\r\n Random5X db (?)\r\n Random6X db (?)\r\n Random7X db (?)\r\n Random8X db (?)\r\n Random1Y db (?)\r\n Random2Y db (?)\r\n Random3Y db (?)\r\n Random4Y db (?)\r\n Random5Y db (?)\r\n Random6Y db (?)\t\r\n Random7Y db (?)\r\n Random8Y db (?) \r\n \r\n CODESEG\r\n \r\n ;======================================\r\n ;=============cursor mode==============\r\n ;======================================\r\n \r\n \r\n \r\n proc ScreenClear \r\n \tmov ax,0600h \r\n mov bh,99h ;color of backround \r\n mov cx,0000h ;start position\r\n mov dx,184fh ;end position \r\n int 10h ;screenprint \r\n \t\r\n \t\r\n \tret\r\n endp ScreenClear\t\r\n \r\n \r\n proc modulo\r\n \r\n \r\n \tmov ax, 40h\r\n mov es, ax\r\n mov cx, 1\r\n mov bx, 0\r\n \r\n mov ax, [Clock] ;read timer counter\r\n mov ah, [byte cs:bx] ;read one byte from memory\r\n xor al, ah ;xor memory and counter\r\n and al, 00000101b ;leave result between 0-7\r\n \t\r\n ret \r\n endp modulo \r\n \r\n proc modulo2\r\n \r\n \tmov ax, 40h\r\n mov es, ax\r\n mov cx, 1\r\n mov bx, 0\r\n \r\n mov ax, [Clock] ;read timer counter\r\n mov ah, [byte cs:bx] ;read one byte from memory\r\n xor al, ah ;xor memory and counter\r\n and al, 00000100b ;leave result between 0-4\r\n ret\t\r\n endp modulo2\r\n \r\n proc CheckXInput\r\n IdkLOOP:\r\n \tmov ah, 1h\r\n \tint 21h\r\n \tcmp al,31h\r\n \tje RandomLoopX\r\n \tcmp al,32h\r\n \tje RandomLoopX\r\n \tcmp al,33h \r\n \tje RandomLoopX\r\n \tcmp al,34h \r\n \tje RandomLoopX\r\n \tcmp al,35h\r\n \tje RandomLoopX\r\n \tcmp al,36h\r\n \tje RandomLoopX\r\n \tcmp al,37h\r\n \tje RandomLoopX\r\n \tcmp al,38h\r\n \tje RandomLoopX\r\n \tjmp IdkLOOP; loops untill i hit left click \r\n \t\r\n \t\r\n RandomLoopX: ; starts a loop that checks each Y cordinate \r\n \tsub al,31h\r\n \tcmp al,[Random1X]\r\n \tje RandomLOOPX2\r\n \t\r\n \tcmp al,[Random2X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random3X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random4X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random5X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random6X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random7X]\r\n \tje RandomLoopX2\r\n \t\r\n \tcmp al,[Random8X]\r\n \tje RandomLoopX2\r\n \t\r\n \tjmp IdkLOOP\r\n \t\r\n RandomLoopX2:\r\n \tinc al\r\n \tdec al\r\n \tmov bl, 64\r\n \tmul bl ; mul 64 by the number of the cell and stores the answer in bx\r\n \tmov ax,bx ; moves the number of the cell in pixels to ax\r\n \tadd bx,64 ; the end of the cell in pixels \r\n \r\n \tjmp RandomLoopX3\r\n RandomLoopX3:\r\n \tmov bh,55h ;color of backround \r\n mov dx,ax\r\n \tdec bx\r\n int 10h ;screenprint\r\n \tcmp bx,ax\r\n \tja RandomLoopX3\r\n \t\r\n ret \r\n \tendp CheckXInput\r\n \t\r\n \t\r\n \t\r\n \tproc CheckYInput \r\n IdkLOOP2:\r\n \tmov ah, 1h\r\n \tint 21h\r\n \tcmp al,31h\r\n \tje RandomLoopY\r\n \tcmp al,32h\r\n \tje RandomLoopY\r\n \tcmp al,33h \r\n \tje RandomLoopY\r\n \tcmp al,34h \r\n \tje RandomLoopY\r\n \tcmp al,35h\r\n \tje RandomLoopY\r\n \tjmp IdkLOOP2\r\n \t\r\n \tRandomLoopY: ; starts a loop that checks each Y cordinate \r\n \tsub al,31h\r\n \tcmp al,[Random1Y]\r\n \tje RandomLOOPY2\r\n \t\r\n \tcmp al,[Random2Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random3Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random4Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random5Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random6Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random7Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tcmp al,[Random8Y]\r\n \tje RandomLoopY2\r\n \t\r\n \tjmp IdkLOOP2\r\n \t\r\n \t\r\n RandomLoopY2: ; starts a loop that checks each x cordinate\r\n \tmov cl,al \r\n \tmov bl, 25\r\n \tmul bl\r\n \tmov ax,bx\r\n \tadd bx,25\r\n \tjmp RamdomLoopY3\r\n RamdomLoopY3:\r\n \tmov bh,55h ;color of backround \r\n mov dx,ax ; start \r\n \tdec bx\r\n int 10h ;screenprint\r\n \tcmp bx,ax ;checks if reached end, if not it will keep printing \r\n \tja RamdomLoopY3\r\n ret \r\n \tendp CheckYInput\r\n \t\r\n proc callmodulo \r\n \tcall modulo \r\n mov [Random1X],al\r\n call modulo\r\n mov [Random2X],al\r\n call modulo\r\n mov [Random3X],al\r\n call modulo\r\n mov [Random4X],al\r\n call modulo\r\n mov [Random5X],al\r\n call modulo\r\n mov [Random6X],al\r\n call modulo\r\n mov [Random7X],al\r\n call modulo\r\n mov [Random8X],al\r\n \r\n ret\r\n endp callmodulo\r\n \r\n proc callmodulo2\r\n call modulo2\r\n mov [Random1Y],al\r\n call modulo2\r\n mov [Random2Y],al\r\n call modulo2\r\n mov [Random3Y],al\r\n call modulo2\r\n mov [Random4Y],al\r\n call modulo2\r\n mov [Random5Y],al\r\n call modulo2\r\n mov [Random6Y],al\r\n call modulo2\r\n mov [Random7Y],al\r\n call modulo2\r\n mov [Random8Y],al\r\n \r\n \r\n ret\r\n \r\n endp callmodulo2\r\n \t\r\n \t\r\n ;===================================\r\n ;============start=================\r\n ;===================================\r\n \r\n \r\n start:\r\n \tmov ax, @data\r\n \tmov ds, ax\r\n \t\r\n \t; Graphic mode\r\n \tmov ax, 13h\r\n \tint 10h\r\n \t\r\n \r\n \t\r\n \t\r\n \t;first text for first screen \r\n \tmov al, 1 ;color \r\n \tmov bh, 0 \r\n \tmov bl, 15 ;brightness \r\n \tmov cx, 12 ;PAKTC1end - offset PAKTC ; calculate message number of letters plus spaces, ect... \r\n \tmov dl, 11 ;position start X\r\n \tmov dh, 10 ;position start Y \r\n \tpush ds \r\n \tpop es\r\n \tmov bp, offset HTS\r\n \tmov ah, 13h ;graphic font \r\n \tint 10h ; print\r\n \r\n \t\r\n \t;second text for first screen\r\n \tmov al, 1 ; color \r\n \tmov bh, 27 \r\n \tmov bl, 15 ; brightness \r\n \tmov cx, 26 ;PAKTC1end - offset PAKTC ; calculate message number of letters plus spaces, ect... \r\n \tmov dl, 7 ; position start X\r\n \tmov dh, 15 ; position start Y \r\n \tpush ds\r\n \tpop es\r\n \tmov bp, offset PAKTC\r\n \tmov ah, 13h\r\n \tint 10h\r\n \t\r\n \t\r\n ;space press\r\n checkTitleSpace: \r\n \tmov ah, 1h\r\n \tint 21h\r\n \tcmp al, 20h ;space ascii\r\n \tjne checkTitleSpace\r\n \t\r\n \tcall ScreenClear ; calls the proc ScreenClear\r\n \r\n \t\r\n \r\n \r\n ;========================================\r\n ;=============after opening==============\r\n ;========================================\r\n \r\n \r\n \t;useless title \r\n \t;space press\r\n \tDraw2:\r\n \tmov ah, 1h\r\n \tint 21h \r\n \tcmp al, 20h ;space ascii \r\n \tjne Draw2 \r\n \t;first draw\r\n \r\n \tmov ah,0h\r\n \tmov al,13h\r\n \tint 10h\r\n \r\n ;The above three lines just switch to 320x200 256-color VGA.\r\n \tmov ax, 0a000h\r\n \tmov es, ax\t\r\n \tmov bx, 0 \r\n loopClear:\r\n \tmov [byte ptr es:bx], 11h\r\n \tinc bx\r\n \tcmp bx, 320 * 200\r\n \tjb loopClear\r\n \t\r\n ;=============================================\t\r\n ;==============lines start here===============\r\n ;============================================= \t\r\n \r\n \tmov cx, [xStart]\r\n add cx, [length1]\r\n \r\n \r\n ; loop from (xStart+length1) to xStart to draw a horizontal line\r\n \r\n LoopStart: \r\n \r\n ; draw a pixel\r\n mov al, 50 ; color\r\n mov dx, [yStart] \r\n mov ah, 0ch ; set sub function value in ah to draw a pixel \r\n int 10h ; and invoke the interrupt \t\t\t\t\t\t \r\n dec cx ; decrement the x coord \r\n cmp cx, [xStart] ; test to see if x coord has reached start value \r\n jae LoopStart ; continue loop if cx &gt;= xStart\r\n \r\n mov dx, [ystart]\r\n add dx, [length1]\r\n \r\n ; loop from (ystart+length1) to ystart and add length1\r\n \r\n LoopStart2:\r\n ; draw a pixel\r\n ; set color in al, x in cx, y in dx\r\n mov al,50 ;color\r\n mov cx, [xStart] \r\n mov ah, 0ch \r\n int 10h\r\n dec dx ; decrement the y coord\r\n cmp dx, [yStart] ; test to see if y coord has reached start value\r\n \r\n jne LoopStart2 ; continue loop if dx &gt;= yStart\t\r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart3:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart2] \t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart3\r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart4:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart3]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart4\r\n \r\n \t\r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart5:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart4]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart5\r\n \r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart6:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart5]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart6\r\n \r\n \r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart7:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart6]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart7\r\n \r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart8:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart7]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart8\r\n \r\n \r\n \r\n \r\n \tmov cx, [xStart]\r\n \tadd cx, [length1]\r\n \tLoopStart9:\r\n mov al, 50 ;color \r\n \t\tmov dx, [yStart8]\t\r\n mov ah, 0ch \r\n int 10h \r\n dec cx ; decrement the y coord\r\n cmp cx, [xStart] ; test to see if y coord has reached start value\t\t\r\n \tjne LoopStart9\r\n \r\n \r\n \r\n ;===================================================\r\n ;========lines end here (thank god)=================\r\n ;===================================================\r\n \r\n ;==============================\r\n ;=========for random===========\r\n ;==============================\r\n \r\n \r\n \r\n call callmodulo\r\n call callmodulo2\r\n call CheckXInput\r\n call CheckYInput\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \t\r\n \r\n exit:\r\n \tmov ax, 4c00h\r\n \tint 21h\r\n END start \r\n\r\n\r\n\r\nThis is the code, I know I know it&#39;s bad. But please help me figure out the problem. \r\n\r\nThank you. \r\n","link":"https://stackoverflow.com/questions/67908785/i-am-trying-to-code-a-game-but-i-ran-into-an-issue-my-print-commands-do-not-wor","title":"I am trying to code a game but I ran into an issue. My print commands do not work, I am sure I wrote it wrong, but I cant find the problem","body":"<p>In the proc section, before the start but in the code segment I wrote 2 procs, 'proc CheckYInput' and proc 'CheckXInput', which are supposed to find out which button I pressed, compare it to the numbered cell and if it is one of the 8 random cell, print over it.\nIt's basically a very bad 'mine sweeper'</p>\n<pre><code> IDEAL\nMODEL small\nSTACK 100h\nDATASEG\n\n\n; random \nClock equ es:6Ch\n\n\n; after change \n\n\n\n;for opening screen\nHTS DB &quot;mine sweeper&quot;\nPAKTC DB &quot;[Press space to continue]&quot;\n\n\nempty DB &quot; &quot;\n\n xStart dw 1 ; x coordinate of line start\n\n yStart dw 0 ; y coordinate of line start\n\n length1 dw 1278 ; length1 of line1\n \n yStart2 dw 25 ; y coordinate of line2 start\n \n yStart3 dw 50 ; y coordinate of line3 start\n \n yStart4 dw 75 ; y coordinate of line4 start\n\n yStart5 dw 100 ; y coordinate of line5 start\n\n yStart6 dw 125 ; y coordinate of line6 start\n\n yStart7 dw 150 ; y coordinate of line7 start\n\n yStart8 dw 175 ; y coordinate of line8 start\n \n ;for random\n\nRandom1X db (?)\nRandom2X db (?)\nRandom3X db (?)\nRandom4X db (?)\nRandom5X db (?)\nRandom6X db (?)\nRandom7X db (?)\nRandom8X db (?)\nRandom1Y db (?)\nRandom2Y db (?)\nRandom3Y db (?)\nRandom4Y db (?)\nRandom5Y db (?)\nRandom6Y db (?) \nRandom7Y db (?)\nRandom8Y db (?) \n\nCODESEG\n\n;======================================\n;=============cursor mode==============\n;======================================\n\n\n\nproc ScreenClear \n mov ax,0600h \n mov bh,99h ;color of backround \n mov cx,0000h ;start position\n mov dx,184fh ;end position \n int 10h ;screenprint \n \n \n ret\nendp ScreenClear \n\n\nproc modulo\n\n\n mov ax, 40h\n mov es, ax\n mov cx, 1\n mov bx, 0\n\n mov ax, [Clock] ;read timer counter\n mov ah, [byte cs:bx] ;read one byte from memory\n xor al, ah ;xor memory and counter\n and al, 00000101b ;leave result between 0-7\n \nret \nendp modulo \n\nproc modulo2\n\n mov ax, 40h\n mov es, ax\n mov cx, 1\n mov bx, 0\n\n mov ax, [Clock] ;read timer counter\n mov ah, [byte cs:bx] ;read one byte from memory\n xor al, ah ;xor memory and counter\n and al, 00000100b ;leave result between 0-4\nret \nendp modulo2\n\nproc CheckXInput\nIdkLOOP:\n mov ah, 1h\n int 21h\n cmp al,31h\n je RandomLoopX\n cmp al,32h\n je RandomLoopX\n cmp al,33h \n je RandomLoopX\n cmp al,34h \n je RandomLoopX\n cmp al,35h\n je RandomLoopX\n cmp al,36h\n je RandomLoopX\n cmp al,37h\n je RandomLoopX\n cmp al,38h\n je RandomLoopX\n jmp IdkLOOP; loops untill i hit left click \n \n \nRandomLoopX: ; starts a loop that checks each Y cordinate \n sub al,31h\n cmp al,[Random1X]\n je RandomLOOPX2\n \n cmp al,[Random2X]\n je RandomLoopX2\n \n cmp al,[Random3X]\n je RandomLoopX2\n \n cmp al,[Random4X]\n je RandomLoopX2\n \n cmp al,[Random5X]\n je RandomLoopX2\n \n cmp al,[Random6X]\n je RandomLoopX2\n \n cmp al,[Random7X]\n je RandomLoopX2\n \n cmp al,[Random8X]\n je RandomLoopX2\n \n jmp IdkLOOP\n \nRandomLoopX2:\n inc al\n dec al\n mov bl, 64\n mul bl ; mul 64 by the number of the cell and stores the answer in bx\n mov ax,bx ; moves the number of the cell in pixels to ax\n add bx,64 ; the end of the cell in pixels \n \n jmp RandomLoopX3\nRandomLoopX3:\n mov bh,55h ;color of backround \n mov dx,ax\n dec bx\n int 10h ;screenprint\n cmp bx,ax\n ja RandomLoopX3\n \nret \n endp CheckXInput\n \n \n \n proc CheckYInput \nIdkLOOP2:\n mov ah, 1h\n int 21h\n cmp al,31h\n je RandomLoopY\n cmp al,32h\n je RandomLoopY\n cmp al,33h \n je RandomLoopY\n cmp al,34h \n je RandomLoopY\n cmp al,35h\n je RandomLoopY\n jmp IdkLOOP2\n \n RandomLoopY: ; starts a loop that checks each Y cordinate \n sub al,31h\n cmp al,[Random1Y]\n je RandomLOOPY2\n \n cmp al,[Random2Y]\n je RandomLoopY2\n \n cmp al,[Random3Y]\n je RandomLoopY2\n \n cmp al,[Random4Y]\n je RandomLoopY2\n \n cmp al,[Random5Y]\n je RandomLoopY2\n \n cmp al,[Random6Y]\n je RandomLoopY2\n \n cmp al,[Random7Y]\n je RandomLoopY2\n \n cmp al,[Random8Y]\n je RandomLoopY2\n \n jmp IdkLOOP2\n \n \nRandomLoopY2: ; starts a loop that checks each x cordinate\n mov cl,al \n mov bl, 25\n mul bl\n mov ax,bx\n add bx,25\n jmp RamdomLoopY3\nRamdomLoopY3:\n mov bh,55h ;color of backround \n mov dx,ax ; start \n dec bx\n int 10h ;screenprint\n cmp bx,ax ;checks if reached end, if not it will keep printing \n ja RamdomLoopY3\nret \n endp CheckYInput\n \nproc callmodulo \n call modulo \nmov [Random1X],al\ncall modulo\nmov [Random2X],al\ncall modulo\nmov [Random3X],al\ncall modulo\nmov [Random4X],al\ncall modulo\nmov [Random5X],al\ncall modulo\nmov [Random6X],al\ncall modulo\nmov [Random7X],al\ncall modulo\nmov [Random8X],al\n\nret\nendp callmodulo\n\nproc callmodulo2\ncall modulo2\nmov [Random1Y],al\ncall modulo2\nmov [Random2Y],al\ncall modulo2\nmov [Random3Y],al\ncall modulo2\nmov [Random4Y],al\ncall modulo2\nmov [Random5Y],al\ncall modulo2\nmov [Random6Y],al\ncall modulo2\nmov [Random7Y],al\ncall modulo2\nmov [Random8Y],al\n\n\nret\n\nendp callmodulo2\n \n \n;===================================\n;============start=================\n;===================================\n\n\nstart:\n mov ax, @data\n mov ds, ax\n \n ; Graphic mode\n mov ax, 13h\n int 10h\n \n\n \n \n ;first text for first screen \n mov al, 1 ;color \n mov bh, 0 \n mov bl, 15 ;brightness \n mov cx, 12 ;PAKTC1end - offset PAKTC ; calculate message number of letters plus spaces, ect... \n mov dl, 11 ;position start X\n mov dh, 10 ;position start Y \n push ds \n pop es\n mov bp, offset HTS\n mov ah, 13h ;graphic font \n int 10h ; print\n\n \n ;second text for first screen\n mov al, 1 ; color \n mov bh, 27 \n mov bl, 15 ; brightness \n mov cx, 26 ;PAKTC1end - offset PAKTC ; calculate message number of letters plus spaces, ect... \n mov dl, 7 ; position start X\n mov dh, 15 ; position start Y \n push ds\n pop es\n mov bp, offset PAKTC\n mov ah, 13h\n int 10h\n \n \n;space press\ncheckTitleSpace: \n mov ah, 1h\n int 21h\n cmp al, 20h ;space ascii\n jne checkTitleSpace\n \n call ScreenClear ; calls the proc ScreenClear\n\n \n\n\n;========================================\n;=============after opening==============\n;========================================\n\n\n ;useless title \n ;space press\n Draw2:\n mov ah, 1h\n int 21h \n cmp al, 20h ;space ascii \n jne Draw2 \n ;first draw\n\n mov ah,0h\n mov al,13h\n int 10h\n\n;The above three lines just switch to 320x200 256-color VGA.\n mov ax, 0a000h\n mov es, ax \n mov bx, 0 \nloopClear:\n mov [byte ptr es:bx], 11h\n inc bx\n cmp bx, 320 * 200\n jb loopClear\n \n;============================================= \n;==============lines start here===============\n;============================================= \n\n mov cx, [xStart]\n add cx, [length1]\n\n\n ; loop from (xStart+length1) to xStart to draw a horizontal line\n\n LoopStart: \n\n ; draw a pixel\n mov al, 50 ; color\n mov dx, [yStart] \n mov ah, 0ch ; set sub function value in ah to draw a pixel \n int 10h ; and invoke the interrupt \n dec cx ; decrement the x coord \n cmp cx, [xStart] ; test to see if x coord has reached start value \n jae LoopStart ; continue loop if cx &gt;= xStart\n \n mov dx, [ystart]\n add dx, [length1]\n\n ; loop from (ystart+length1) to ystart and add length1\n\n LoopStart2:\n ; draw a pixel\n ; set color in al, x in cx, y in dx\n mov al,50 ;color\n mov cx, [xStart] \n mov ah, 0ch \n int 10h\n dec dx ; decrement the y coord\n cmp dx, [yStart] ; test to see if y coord has reached start value\n \n jne LoopStart2 ; continue loop if dx &gt;= yStart \n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart3:\n mov al, 50 ;color \n mov dx, [yStart2] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart3\n \n mov cx, [xStart]\n add cx, [length1]\n LoopStart4:\n mov al, 50 ;color \n mov dx, [yStart3] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart4\n \n \n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart5:\n mov al, 50 ;color \n mov dx, [yStart4] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart5\n \n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart6:\n mov al, 50 ;color \n mov dx, [yStart5] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart6\n \n\n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart7:\n mov al, 50 ;color \n mov dx, [yStart6] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart7\n \n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart8:\n mov al, 50 ;color \n mov dx, [yStart7] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart8\n \n\n\n\n mov cx, [xStart]\n add cx, [length1]\n LoopStart9:\n mov al, 50 ;color \n mov dx, [yStart8] \n mov ah, 0ch \n int 10h \n dec cx ; decrement the y coord\n cmp cx, [xStart] ; test to see if y coord has reached start value \n jne LoopStart9\n \n\n\n;===================================================\n;========lines end here (thank god)=================\n;===================================================\n\n;==============================\n;=========for random===========\n;==============================\n\n\n\ncall callmodulo\ncall callmodulo2\ncall CheckXInput\ncall CheckYInput\n\n\n\n\n\n\n\n \n\nexit:\n mov ax, 4c00h\n int 21h\nEND start \n</code></pre>\n<p>This is the code, I know I know it's bad. But please help me figure out the problem.</p>\n<p>Thank you.</p>\n"},{"tags":["imagej","fiji","imagej-macro"],"owner":{"reputation":1905,"user_id":8713450,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ed61e21ec072346277da9569f1c9f966?s=128&d=identicon&r=PG&f=1","display_name":"ceno980","link":"https://stackoverflow.com/users/8713450/ceno980"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259277,"creation_date":1623259277,"question_id":67908933,"share_link":"https://stackoverflow.com/q/67908933","body_markdown":"I am new to ImageJ macros and I want to use a macro in Fiji. The code for the macro is from this [source][1]. I have downloaded the code and saved it as a text file. I have then run the macro through going to Plugins &gt; Macros &gt; Run. The version of ImageJ I am using is 1.53j.\r\n\r\nHowever, when I run the macro, I am getting the following error:\r\n\r\n[![enter image description here][2]][2]\r\n\r\n\r\n [1]: https://gist.github.com/mutterer/7901a5444920e4da568adeafb58338f1/revisions\r\n [2]: https://i.stack.imgur.com/ozMz5.png\r\n\r\nI have seen online that this macro works for other people. But I am not sure why I am getting this error or how to resolve it. Any help is appreciated.","link":"https://stackoverflow.com/questions/67908933/undefined-variable-error-when-running-macro-in-imagej","title":"Undefined variable error when running macro in ImageJ","body":"<p>I am new to ImageJ macros and I want to use a macro in Fiji. The code for the macro is from this <a href=\"https://gist.github.com/mutterer/7901a5444920e4da568adeafb58338f1/revisions\" rel=\"nofollow noreferrer\">source</a>. I have downloaded the code and saved it as a text file. I have then run the macro through going to Plugins &gt; Macros &gt; Run. The version of ImageJ I am using is 1.53j.</p>\n<p>However, when I run the macro, I am getting the following error:</p>\n<p><a href=\"https://i.stack.imgur.com/ozMz5.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/ozMz5.png\" alt=\"enter image description here\" /></a></p>\n<p>I have seen online that this macro works for other people. But I am not sure why I am getting this error or how to resolve it. Any help is appreciated.</p>\n"},{"tags":["google-apps-script","google-sheets"],"owner":{"reputation":376,"user_id":6394306,"user_type":"registered","profile_image":"https://lh4.googleusercontent.com/-UBKCbm7LRbk/AAAAAAAAAAI/AAAAAAAAAGM/2Bh2xU_ZZVo/photo.jpg?sz=128","display_name":"arul selvan","link":"https://stackoverflow.com/users/6394306/arul-selvan"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259273,"creation_date":1623259273,"question_id":67908932,"share_link":"https://stackoverflow.com/q/67908932","body_markdown":"I have the minimum order qty in H1\r\nI have the multiplier in H2 (multiplier means in multiples of)\r\n\r\nIf minimum order qty is 10 and multiplier is 2, in cell H5 to H100, the user can type anything equal to or more than 10 and in multiples of 2, which means he can type 10,12,14,16,18,....\r\n\r\nI don&#39;t want a drop down.\r\n\r\nIs it possible to achieve by data validation? Or &quot;onEdit(e)&quot; will be better? Will &quot;onEdit(e)&quot; work on mobile device? ","link":"https://stackoverflow.com/questions/67908932/minimum-order-and-multiples-in-data-validation","title":"Minimum order and multiples in data validation","body":"<p>I have the minimum order qty in H1\nI have the multiplier in H2 (multiplier means in multiples of)</p>\n<p>If minimum order qty is 10 and multiplier is 2, in cell H5 to H100, the user can type anything equal to or more than 10 and in multiples of 2, which means he can type 10,12,14,16,18,....</p>\n<p>I don't want a drop down.</p>\n<p>Is it possible to achieve by data validation? Or &quot;onEdit(e)&quot; will be better? Will &quot;onEdit(e)&quot; work on mobile device?</p>\n"},{"tags":["python"],"comments":[{"owner":{"reputation":20860,"user_id":5193536,"user_type":"registered","profile_image":"https://i.stack.imgur.com/ZGlox.png?s=128&g=1","display_name":"nbk","link":"https://stackoverflow.com/users/5193536/nbk"},"edited":false,"score":0,"creation_date":1623257667,"post_id":67908542,"comment_id":120030060,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16178054,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/fde7dcbe9d2b1e5d56e8fafaafc9a971?s=128&d=identicon&r=PG&f=1","display_name":"JCVar","link":"https://stackoverflow.com/users/16178054/jcvar"},"reply_to_user":{"reputation":20860,"user_id":5193536,"user_type":"registered","profile_image":"https://i.stack.imgur.com/ZGlox.png?s=128&g=1","display_name":"nbk","link":"https://stackoverflow.com/users/5193536/nbk"},"edited":false,"score":0,"creation_date":1623258846,"post_id":67908542,"comment_id":120030485,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16178054,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/fde7dcbe9d2b1e5d56e8fafaafc9a971?s=128&d=identicon&r=PG&f=1","display_name":"JCVar","link":"https://stackoverflow.com/users/16178054/jcvar"},"is_answered":false,"view_count":18,"answer_count":0,"score":0,"last_activity_date":1623259272,"creation_date":1623257524,"last_edit_date":1623259272,"question_id":67908542,"share_link":"https://stackoverflow.com/q/67908542","body_markdown":"I&#39;m was pre-processing some HDF files using the Semi-Automatic Classif Plugin in Qgis. Usual procedure.\r\n\r\nThis time, the process stopped and an error popped up. SCP freezes and does not record the log file, nor process the images. This is what the error says:\r\n\r\nCode:\r\n\r\n**An error has occurred while executing Python code:** \r\n\r\n&gt;**TypeError: unsupported operand type(s) for /: &#39;float&#39; and &#39;str&#39;** \r\nTraceback (most recent call last):\r\n File &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\maininterface\\asterTab.py&quot;, line 428, in performASTERCorrection\r\n self.ASTER(cfg.ui.label_143.text(), o)\r\n File &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\maininterface\\asterTab.py&quot;, line 230, in ASTER\r\n tPMDN = cfg.utls.createTempVirtualRaster(inputList, bandList, &#39;Yes&#39;, &#39;Yes&#39;, 0, self.rSr, &#39;No&#39;, xyResList = [pSize, pSize, float(uLX), float(uLY), float(lRX), float(lRY)], aster = &#39;Yes&#39;)\r\n File &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\core\\utils.py&quot;, line 2253, in createTempVirtualRaster\r\n output = cfg.utls.createVirtualRaster(inputRasterList, tPMD1, bandNumberList, quiet, NoDataVal, relativeToVRT, projection, intersection, boxCoordList, xyResList, aster)\r\n File &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\core\\utils.py&quot;, line 2380, in createVirtualRaster\r\n rX = abs(int(round((iRight - iLeft) / pXSize)))\r\n***TypeError: unsupported operand type(s) for /: &#39;float&#39; and &#39;str&#39;***\r\n\r\n\r\nI have tried old HDF files and reinstall SCP, etc. Same error message.\r\nCould anyone guide me to fix this please?\r\nThanks.\r\n","link":"https://stackoverflow.com/questions/67908542/did-anyone-have-this-typeerror-on-python-using-the-spc-in-qgis","title":"Did anyone have this TypeError on Python using the SPC in QGIS?","body":"<p>I'm was pre-processing some HDF files using the Semi-Automatic Classif Plugin in Qgis. Usual procedure.</p>\n<p>This time, the process stopped and an error popped up. SCP freezes and does not record the log file, nor process the images. This is what the error says:</p>\n<p>Code:</p>\n<p><strong>An error has occurred while executing Python code:</strong></p>\n<blockquote>\n<p><strong>TypeError: unsupported operand type(s) for /: 'float' and 'str'</strong>\nTraceback (most recent call last):\nFile &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\maininterface\\asterTab.py&quot;, line 428, in performASTERCorrection\nself.ASTER(cfg.ui.label_143.text(), o)\nFile &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\maininterface\\asterTab.py&quot;, line 230, in ASTER\ntPMDN = cfg.utls.createTempVirtualRaster(inputList, bandList, 'Yes', 'Yes', 0, self.rSr, 'No', xyResList = [pSize, pSize, float(uLX), float(uLY), float(lRX), float(lRY)], aster = 'Yes')\nFile &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\core\\utils.py&quot;, line 2253, in createTempVirtualRaster\noutput = cfg.utls.createVirtualRaster(inputRasterList, tPMD1, bandNumberList, quiet, NoDataVal, relativeToVRT, projection, intersection, boxCoordList, xyResList, aster)\nFile &quot;C:/Users/miner/AppData/Roaming/QGIS/QGIS3\\profiles\\default/python/plugins\\SemiAutomaticClassificationPlugin\\core\\utils.py&quot;, line 2380, in createVirtualRaster\nrX = abs(int(round((iRight - iLeft) / pXSize)))\n<em><strong>TypeError: unsupported operand type(s) for /: 'float' and 'str'</strong></em></p>\n</blockquote>\n<p>I have tried old HDF files and reinstall SCP, etc. Same error message.\nCould anyone guide me to fix this please?\nThanks.</p>\n"},{"tags":["rust","ownership","reference-counting","refcell"],"comments":[{"owner":{"reputation":419,"user_id":8511998,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/75ba0bfcb6db605366849e45c3d41ffd?s=128&d=identicon&r=PG&f=1","display_name":"L. Riemer","link":"https://stackoverflow.com/users/8511998/l-riemer"},"edited":false,"score":0,"creation_date":1623251319,"post_id":67899965,"comment_id":120027092,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":118,"user_id":8562400,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Rr3tS.jpg?s=128&g=1","display_name":"Rom&#225;n C&#225;rdenas","link":"https://stackoverflow.com/users/8562400/rom%c3%a1n-c%c3%a1rdenas"},"reply_to_user":{"reputation":419,"user_id":8511998,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/75ba0bfcb6db605366849e45c3d41ffd?s=128&d=identicon&r=PG&f=1","display_name":"L. Riemer","link":"https://stackoverflow.com/users/8511998/l-riemer"},"edited":false,"score":0,"creation_date":1623251710,"post_id":67899965,"comment_id":120027275,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":419,"user_id":8511998,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/75ba0bfcb6db605366849e45c3d41ffd?s=128&d=identicon&r=PG&f=1","display_name":"L. Riemer","link":"https://stackoverflow.com/users/8511998/l-riemer"},"edited":false,"score":0,"creation_date":1623251965,"post_id":67899965,"comment_id":120027416,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":419,"user_id":8511998,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/75ba0bfcb6db605366849e45c3d41ffd?s=128&d=identicon&r=PG&f=1","display_name":"L. Riemer","link":"https://stackoverflow.com/users/8511998/l-riemer"},"is_accepted":false,"score":0,"last_activity_date":1623259271,"last_edit_date":1623259271,"creation_date":1623253712,"answer_id":67907571,"question_id":67899965,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":118,"user_id":8562400,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Rr3tS.jpg?s=128&g=1","display_name":"Rom&#225;n C&#225;rdenas","link":"https://stackoverflow.com/users/8562400/rom%c3%a1n-c%c3%a1rdenas"},"is_answered":false,"view_count":36,"answer_count":1,"score":1,"last_activity_date":1623259271,"creation_date":1623225594,"last_edit_date":1623254297,"question_id":67899965,"share_link":"https://stackoverflow.com/q/67899965","body_markdown":"I&#39;m trying to understand how to work with interior mutability. This question is strongly related to [my previous question](https://stackoverflow.com/questions/67870844/rust-implementing-an-iterator-from-a-vector-of-stdrc-smart-pointers).\r\n\r\nI have a generic struct `Port&lt;T&gt;` that owns a `Vec&lt;T&gt;`. We can &quot;chain&quot; port B to port A so, when reading the content of port A, we are able to read the content of port B. However, this chaining is hidden to port A&#39;s reader. That is why I implemented the `iter(&amp;self)` method:\r\n\r\n```rust\r\nuse std::rc::Rc;\r\n\r\npub struct Port&lt;T&gt; {\r\n values: Vec&lt;T&gt;,\r\n ports: Vec&lt;Rc&lt;Port&lt;T&gt;&gt;&gt;,\r\n}\r\n\r\nimpl &lt;T&gt; Port&lt;T&gt; {\r\n pub fn new() -&gt; Self {\r\n Self { values: vec![], ports: vec![] }\r\n }\r\n\r\n pub fn add_value(&amp;mut self, value: T) {\r\n self.values.push(value);\r\n }\r\n\r\n pub fn is_empty(&amp;self) -&gt; bool {\r\n self.values.is_empty() &amp;&amp; self.ports.is_empty()\r\n }\r\n\r\n pub fn chain_port(&amp;mut self, port: Rc&lt;Port&lt;T&gt;&gt;) {\r\n if !port.is_empty() {\r\n self.ports.push(port)\r\n }\r\n }\r\n\r\n pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\r\n self.values.iter().chain(\r\n self.ports.iter()\r\n .flat_map(|p| Box::new(p.iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;)\r\n )\r\n }\r\n\r\n pub fn clear(&amp;mut self) {\r\n self.values.clear();\r\n self.ports.clear();\r\n }\r\n}\r\n```\r\n\r\nThe application has the following pseudo-code behavior:\r\n\r\n* create ports\r\n* loop:\r\n * fill ports with values\r\n * chain ports\r\n * iterate over ports&#39; values\r\n * clear ports\r\n\r\nThe `main` function should look like this:\r\n\r\n```rust\r\nfn main() {\r\n let mut port_a = Rc::new(Port::new());\r\n let mut port_b = Rc::new(Port::new());\r\n\r\n loop {\r\n port_a.add_value(1);\r\n port_b.add_value(2);\r\n\r\n port_a.chain_port(port_b.clone());\r\n\r\n for val in port_a.iter() {\r\n // read data\r\n };\r\n\r\n port_a.clear();\r\n port_b.clear();\r\n }\r\n}\r\n```\r\n\r\nHowever, the compiler complains:\r\n\r\n```none\r\nerror[E0596]: cannot borrow data in an `Rc` as mutable\r\n --&gt; src/modeling/port.rs:46:9\r\n |\r\n46 | port_a.add_value(1);\r\n | ^^^^^^ cannot borrow as mutable\r\n |\r\n = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc&lt;Port&lt;i32&gt;&gt;`\r\n```\r\n\r\nI&#39;ve been reading several posts etc., and it seems that I need to work with `Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;` to be able to mutate the ports. I changed the implementation of `Port&lt;T&gt;`:\r\n\r\n```rust\r\nuse std::cell::RefCell;\r\nuse std::rc::Rc;\r\n\r\npub struct Port&lt;T&gt; {\r\n values: Vec&lt;T&gt;,\r\n ports: Vec&lt;Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;&gt;,\r\n}\r\n\r\nimpl&lt;T&gt; Port&lt;T&gt; {\r\n\r\n // snip\r\n\r\n pub fn chain_port(&amp;mut self, port: Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;) {\r\n if !port.borrow().is_empty() {\r\n self.ports.push(port)\r\n }\r\n }\r\n\r\n pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\r\n self.values.iter().chain(\r\n self.ports\r\n .iter()\r\n .flat_map(|p| Box::new(p.borrow().iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;),\r\n )\r\n }\r\n\r\n // snip\r\n}\r\n```\r\n\r\nThis does not compile either:\r\n\r\n```none\r\nerror[E0515]: cannot return value referencing temporary value\r\n --&gt; src/modeling/port.rs:35:31\r\n |\r\n35 | .flat_map(|p| Box::new(p.borrow().iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;),\r\n | ^^^^^^^^^----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n | | |\r\n | | temporary value created here\r\n | returns a value referencing data owned by the current function\r\n```\r\n\r\nI think I know what the problem is: `p.borrow()` returns a reference to the port being chained. We use that reference to create the iterator, but as soon as the function is done, the reference goes out of scope and the iterator is no longer valid.\r\n\r\nI have no clue on how to deal with this. I managed to implement the following unsafe method:\r\n\r\n```rust\r\n pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\r\n self.values.iter().chain(self.ports.iter().flat_map(|p| {\r\n Box::new(unsafe { (&amp;*p.as_ref().as_ptr()).iter() }) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;\r\n }))\r\n }\r\n```\r\n\r\nWhile this works, it uses unsafe code, and there must be a safe workaround.\r\n\r\nI set a [playground](https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=0323b4f4f8d3411c1be5f9a0feb23687) for more details of my application. The application compiles and outputs the expected result (but uses unsafe code).","link":"https://stackoverflow.com/questions/67899965/how-do-i-implement-an-iterator-from-a-vector-of-stdrcstdrefcellt-smart-p","title":"How do I implement an iterator from a vector of std::Rc&lt;std::RefCell&lt;T&gt;&gt; smart pointers?","body":"<p>I'm trying to understand how to work with interior mutability. This question is strongly related to <a href=\"https://stackoverflow.com/questions/67870844/rust-implementing-an-iterator-from-a-vector-of-stdrc-smart-pointers\">my previous question</a>.</p>\n<p>I have a generic struct <code>Port&lt;T&gt;</code> that owns a <code>Vec&lt;T&gt;</code>. We can &quot;chain&quot; port B to port A so, when reading the content of port A, we are able to read the content of port B. However, this chaining is hidden to port A's reader. That is why I implemented the <code>iter(&amp;self)</code> method:</p>\n<pre class=\"lang-rust prettyprint-override\"><code>use std::rc::Rc;\n\npub struct Port&lt;T&gt; {\n values: Vec&lt;T&gt;,\n ports: Vec&lt;Rc&lt;Port&lt;T&gt;&gt;&gt;,\n}\n\nimpl &lt;T&gt; Port&lt;T&gt; {\n pub fn new() -&gt; Self {\n Self { values: vec![], ports: vec![] }\n }\n\n pub fn add_value(&amp;mut self, value: T) {\n self.values.push(value);\n }\n\n pub fn is_empty(&amp;self) -&gt; bool {\n self.values.is_empty() &amp;&amp; self.ports.is_empty()\n }\n\n pub fn chain_port(&amp;mut self, port: Rc&lt;Port&lt;T&gt;&gt;) {\n if !port.is_empty() {\n self.ports.push(port)\n }\n }\n\n pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\n self.values.iter().chain(\n self.ports.iter()\n .flat_map(|p| Box::new(p.iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;)\n )\n }\n\n pub fn clear(&amp;mut self) {\n self.values.clear();\n self.ports.clear();\n }\n}\n</code></pre>\n<p>The application has the following pseudo-code behavior:</p>\n<ul>\n<li>create ports</li>\n<li>loop:\n<ul>\n<li>fill ports with values</li>\n<li>chain ports</li>\n<li>iterate over ports' values</li>\n<li>clear ports</li>\n</ul>\n</li>\n</ul>\n<p>The <code>main</code> function should look like this:</p>\n<pre class=\"lang-rust prettyprint-override\"><code>fn main() {\n let mut port_a = Rc::new(Port::new());\n let mut port_b = Rc::new(Port::new());\n\n loop {\n port_a.add_value(1);\n port_b.add_value(2);\n\n port_a.chain_port(port_b.clone());\n\n for val in port_a.iter() {\n // read data\n };\n\n port_a.clear();\n port_b.clear();\n }\n}\n</code></pre>\n<p>However, the compiler complains:</p>\n<pre class=\"lang-none prettyprint-override\"><code>error[E0596]: cannot borrow data in an `Rc` as mutable\n --&gt; src/modeling/port.rs:46:9\n |\n46 | port_a.add_value(1);\n | ^^^^^^ cannot borrow as mutable\n |\n = help: trait `DerefMut` is required to modify through a dereference, but it is not implemented for `Rc&lt;Port&lt;i32&gt;&gt;`\n</code></pre>\n<p>I've been reading several posts etc., and it seems that I need to work with <code>Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;</code> to be able to mutate the ports. I changed the implementation of <code>Port&lt;T&gt;</code>:</p>\n<pre class=\"lang-rust prettyprint-override\"><code>use std::cell::RefCell;\nuse std::rc::Rc;\n\npub struct Port&lt;T&gt; {\n values: Vec&lt;T&gt;,\n ports: Vec&lt;Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;&gt;,\n}\n\nimpl&lt;T&gt; Port&lt;T&gt; {\n\n // snip\n\n pub fn chain_port(&amp;mut self, port: Rc&lt;RefCell&lt;Port&lt;T&gt;&gt;&gt;) {\n if !port.borrow().is_empty() {\n self.ports.push(port)\n }\n }\n\n pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\n self.values.iter().chain(\n self.ports\n .iter()\n .flat_map(|p| Box::new(p.borrow().iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;),\n )\n }\n\n // snip\n}\n</code></pre>\n<p>This does not compile either:</p>\n<pre class=\"lang-none prettyprint-override\"><code>error[E0515]: cannot return value referencing temporary value\n --&gt; src/modeling/port.rs:35:31\n |\n35 | .flat_map(|p| Box::new(p.borrow().iter()) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;),\n | ^^^^^^^^^----------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n | | |\n | | temporary value created here\n | returns a value referencing data owned by the current function\n</code></pre>\n<p>I think I know what the problem is: <code>p.borrow()</code> returns a reference to the port being chained. We use that reference to create the iterator, but as soon as the function is done, the reference goes out of scope and the iterator is no longer valid.</p>\n<p>I have no clue on how to deal with this. I managed to implement the following unsafe method:</p>\n<pre class=\"lang-rust prettyprint-override\"><code> pub fn iter(&amp;self) -&gt; impl Iterator&lt;Item = &amp;T&gt; {\n self.values.iter().chain(self.ports.iter().flat_map(|p| {\n Box::new(unsafe { (&amp;*p.as_ref().as_ptr()).iter() }) as Box&lt;dyn Iterator&lt;Item = &amp;T&gt;&gt;\n }))\n }\n</code></pre>\n<p>While this works, it uses unsafe code, and there must be a safe workaround.</p>\n<p>I set a <a href=\"https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=0323b4f4f8d3411c1be5f9a0feb23687\" rel=\"nofollow noreferrer\">playground</a> for more details of my application. The application compiles and outputs the expected result (but uses unsafe code).</p>\n"},{"tags":["ios","swift","xcode","macos","react-native"],"owner":{"reputation":1799,"user_id":9050437,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/82812bec265f3bf589beb39a5a76f47a?s=128&d=identicon&r=PG&f=1","display_name":"Syed","link":"https://stackoverflow.com/users/9050437/syed"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259265,"creation_date":1623259265,"question_id":67908931,"share_link":"https://stackoverflow.com/q/67908931","body_markdown":"I&#39;m developing an react-native application on M1 Mac.\r\n\r\nI recently updated my mac os to beta version Monterey(version 12.0 beta)\r\n\r\nAfter installing the beta version of the mac os i also installed the Xcode(13.0 beta)\r\n\r\nNow my app is installed to the iPad simulator but when i open the app, i get the following error.\r\n\r\n[![error log][1]][1]\r\n\r\n\r\nCan someone help me.\r\n\r\nThanks in advance!\r\n\r\n [1]: https://i.stack.imgur.com/r9vPt.png","link":"https://stackoverflow.com/questions/67908931/macos-update-raised-exc-bad-access-sigsegv","title":"MacOS update raised EXC_BAD_ACCESS (SIGSEGV)","body":"<p>I'm developing an react-native application on M1 Mac.</p>\n<p>I recently updated my mac os to beta version Monterey(version 12.0 beta)</p>\n<p>After installing the beta version of the mac os i also installed the Xcode(13.0 beta)</p>\n<p>Now my app is installed to the iPad simulator but when i open the app, i get the following error.</p>\n<p><a href=\"https://i.stack.imgur.com/r9vPt.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/r9vPt.png\" alt=\"error log\" /></a></p>\n<p>Can someone help me.</p>\n<p>Thanks in advance!</p>\n"},{"tags":["ios","swift","facebook","facebook-events"],"owner":{"reputation":613,"user_id":7970235,"user_type":"registered","profile_image":"https://i.stack.imgur.com/5rOpA.jpg?s=128&g=1","display_name":"M. Mansueli","link":"https://stackoverflow.com/users/7970235/m-mansueli"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259260,"creation_date":1623259260,"question_id":67908930,"share_link":"https://stackoverflow.com/q/67908930","body_markdown":"I have updated the **FBSDKAppEvents** to **11.0.0 version**, and the function AppEvents.activateApp() in AppDelegate is now deprecated. I have searched in the Facebook documentation, and unfortunately I didn&#39;t found any information about that, and I don&#39;t understand what&#39;s method I want to use to replace the deprecated:\r\n\r\n[![Deprecated function][1]][1]\r\n\r\nThe message is: \r\n&quot;&#39;activateApp()&#39; is deprecated: The class method `activateApp` is deprecated. It is replaced by an instance method of the same name.&quot;\r\n\r\nDid anyone know what code I have to put to replace the deprecated one?\r\n\r\n [1]: https://i.stack.imgur.com/Rp6pO.png\r\n","link":"https://stackoverflow.com/questions/67908930/how-to-use-appevents-activateapp-in-11-0-0-version","title":"How to use AppEvents.activateApp() in 11.0.0 version","body":"<p>I have updated the <strong>FBSDKAppEvents</strong> to <strong>11.0.0 version</strong>, and the function AppEvents.activateApp() in AppDelegate is now deprecated. I have searched in the Facebook documentation, and unfortunately I didn't found any information about that, and I don't understand what's method I want to use to replace the deprecated:</p>\n<p><a href=\"https://i.stack.imgur.com/Rp6pO.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/Rp6pO.png\" alt=\"Deprecated function\" /></a></p>\n<p>The message is:\n&quot;'activateApp()' is deprecated: The class method <code>activateApp</code> is deprecated. It is replaced by an instance method of the same name.&quot;</p>\n<p>Did anyone know what code I have to put to replace the deprecated one?</p>\n"},{"tags":["c++","zlib"],"comments":[{"owner":{"reputation":22810,"user_id":5494370,"user_type":"registered","profile_image":"https://graph.facebook.com/10152989584621642/picture?type=large","display_name":"Alan Birtles","link":"https://stackoverflow.com/users/5494370/alan-birtles"},"edited":false,"score":1,"creation_date":1623140027,"post_id":67883805,"comment_id":119987125,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":41,"user_id":5426329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/758853f857d0e2dc097a533981a9db9d?s=128&d=identicon&r=PG&f=1","display_name":"valeriot90","link":"https://stackoverflow.com/users/5426329/valeriot90"},"reply_to_user":{"reputation":22810,"user_id":5494370,"user_type":"registered","profile_image":"https://graph.facebook.com/10152989584621642/picture?type=large","display_name":"Alan Birtles","link":"https://stackoverflow.com/users/5494370/alan-birtles"},"edited":false,"score":0,"creation_date":1623140724,"post_id":67883805,"comment_id":119987365,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":22810,"user_id":5494370,"user_type":"registered","profile_image":"https://graph.facebook.com/10152989584621642/picture?type=large","display_name":"Alan Birtles","link":"https://stackoverflow.com/users/5494370/alan-birtles"},"edited":false,"score":0,"creation_date":1623141643,"post_id":67883805,"comment_id":119987722,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":41,"user_id":5426329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/758853f857d0e2dc097a533981a9db9d?s=128&d=identicon&r=PG&f=1","display_name":"valeriot90","link":"https://stackoverflow.com/users/5426329/valeriot90"},"reply_to_user":{"reputation":22810,"user_id":5494370,"user_type":"registered","profile_image":"https://graph.facebook.com/10152989584621642/picture?type=large","display_name":"Alan Birtles","link":"https://stackoverflow.com/users/5494370/alan-birtles"},"edited":false,"score":0,"creation_date":1623250136,"post_id":67883805,"comment_id":120026545,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":22810,"user_id":5494370,"user_type":"registered","profile_image":"https://graph.facebook.com/10152989584621642/picture?type=large","display_name":"Alan Birtles","link":"https://stackoverflow.com/users/5494370/alan-birtles"},"is_accepted":false,"score":1,"last_activity_date":1623259258,"last_edit_date":1623259258,"creation_date":1623254249,"answer_id":67907715,"question_id":67883805,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":41,"user_id":5426329,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/758853f857d0e2dc097a533981a9db9d?s=128&d=identicon&r=PG&f=1","display_name":"valeriot90","link":"https://stackoverflow.com/users/5426329/valeriot90"},"is_answered":true,"view_count":26,"answer_count":1,"score":0,"last_activity_date":1623259258,"creation_date":1623139793,"last_edit_date":1623233135,"question_id":67883805,"share_link":"https://stackoverflow.com/q/67883805","body_markdown":"The zlib uncompress() return -3 (z_data_error) when I decompress data.\r\nFrom doc: returns Z_DATA_ERROR if the input data was corrupted or incomplete,\r\n\r\n uncompress((Bytef*)uncompressbuffer, &amp;uncompressbuffersize, (const Bytef*)compressbuffer, &amp;compressbuffersize)\r\n\r\nIn another application, where I use deflate/inflate I get the same error.\r\n\r\n strm.zalloc = Z_NULL;\r\n strm.zfree = Z_NULL;\r\n strm.opaque = Z_NULL;\r\n strm.avail_in = inputLength;\r\n strm.next_in = (unsigned char*) inputBuffer;\r\n\r\n ret = inflateInit(&amp;strm);\r\n if (ret != Z_OK)\r\n {\r\n \tdelete[] uncompressedData;\r\n \treturn ERROR;\r\n }\r\n /******************************************************/\r\n \r\n \r\n strm.avail_out = unusedData; \r\n strm.next_out = (uncompressedData + MIN_CHUNK) - unusedData;\r\n \r\n /* run inflate() on input until output buffer not full */\r\n do {\r\n \tret = inflate(&amp;strm, Z_NO_FLUSH);\r\n \tassert(ret != Z_STREAM_ERROR); /* state not clobbered */\r\n \r\n \tswitch (ret)\r\n \t{\r\n \tcase Z_NEED_DICT:\r\n\t \tret = Z_DATA_ERROR; /* and fall through */\r\n \tcase Z_DATA_ERROR:\r\n \tcase Z_MEM_ERROR:\r\n \t\t(void)inflateEnd(&amp;strm);\r\n \t\treturn ret;\r\n \t}\r\n\r\n } while (strm.avail_out != 0 &amp;&amp; ret == Z_OK);\r\n\r\nbut\r\n\r\nthis error happens only with x64 version of my software. A x86 working properly. The unzipped data is intact. The buffer size of compressed and uncompressed data are correct.\r\nZlib is correctly compiled to x64.\r\nWhat else could be causing this problem? Any hint?\r\n\r\nSample code with &quot;uncompress&quot;:\r\n\r\n #include &lt;iostream&gt;\r\n #include &lt;fstream&gt;\r\n #include &lt;cstdio&gt;\r\n #include &lt;vector&gt;\r\n #include &lt;zlib.h&gt;\r\n #include &lt;assert.h&gt;\r\n #include &lt;cstdlib&gt;\r\n \r\n #define CHUNK 16384\r\n \r\n const int BUFFERSIZE = 4096;\r\n \r\n using namespace std;\r\n \r\n void compress(FILE* fin, FILE* fout) {\r\n \r\n \tchar buffer[BUFFERSIZE];\r\n \t\r\n \tint byte_read = fread(buffer, sizeof(char), BUFFERSIZE, fin);\r\n \r\n \t\r\n \tz_stream strm;\r\n \tint ret;\r\n \tunsigned have;\r\n \tunsigned char* tmp = new unsigned char[CHUNK];\r\n \r\n \tstrm.zalloc = Z_NULL;\r\n \tstrm.zfree = Z_NULL;\r\n \tstrm.opaque = Z_NULL;\r\n \tstrm.next_in = (unsigned char*)buffer;\r\n \tstrm.avail_in = byte_read;\r\n \tstrm.next_out = tmp;\r\n \tstrm.avail_out = CHUNK;\r\n \r\n \tret = deflateInit(&amp;strm, Z_DEFAULT_COMPRESSION);\r\n \r\n \t//first loop: compress input data stream and write on RTDB file\r\n \tdo\r\n \t{\r\n \r\n \t\tret = deflate(&amp;strm, Z_NO_FLUSH);\r\n \t\tassert(ret != Z_STREAM_ERROR);\r\n \r\n \t\thave = BUFFERSIZE - strm.avail_out;\r\n \t\tfwrite(tmp, sizeof(char), BUFFERSIZE, fout);\r\n \r\n \t} while (strm.avail_out == 0);\r\n \t//assert(strm.avail_in == 0);\r\n \r\n \t//second loop: all input data consumed. Flush everything...\r\n \tdo\r\n \t{\r\n \t\tstrm.next_out = tmp;\r\n \t\tstrm.avail_out = BUFFERSIZE;\r\n \r\n \t\tret = deflate(&amp;strm, Z_FINISH);\r\n \t\tassert(ret != Z_STREAM_ERROR);\r\n \r\n \t\thave = BUFFERSIZE - strm.avail_out;\r\n \t\tfwrite(tmp, sizeof(char), BUFFERSIZE, fout);\r\n \r\n \t} while (ret != Z_STREAM_END);\r\n \r\n \t(void)deflateEnd(&amp;strm);\r\n \tdelete tmp;\r\n }\r\n \r\n void decompress(FILE* fin, FILE* fout) {\r\n \r\n \tint status;\r\n \r\n \tchar buffer[BUFFERSIZE];\r\n \r\n \tint byte_read = fread(buffer, sizeof(char), BUFFERSIZE, fin);\r\n \r\n \tvoid* compressedBuffer;\r\n \tvoid* uncompressedBuffer;\r\n \tuLongf\tcompressedBufferSize = BUFFERSIZE;\r\n \tuLongf\tuncompressedBufferSize = BUFFERSIZE;\r\n \r\n \tcompressedBuffer = malloc(compressedBufferSize);\r\n \tuncompressedBuffer = malloc(uncompressedBufferSize);\r\n \r\n \tstatus = uncompress((Bytef*)uncompressedBuffer, &amp;uncompressedBufferSize, (const Bytef*)buffer, compressedBufferSize);\r\n \r\n \tfwrite(uncompressedBuffer, sizeof(char), BUFFERSIZE, fout);\r\n \r\n \tcout &lt;&lt; &quot;Status &quot; &lt;&lt; status &lt;&lt; endl;\r\n }\r\n \r\n int main(int argc, char *argv[]) {\r\n \t\r\n \t//if (argc == 2)\r\n \t//{\r\n \t//\tif (strcmp(argv[1], &quot;/?&quot;) == 0 || strcmp(argv[1], &quot;--help&quot;) == 0)\r\n \t//\t{\r\n \t//\t\tcout &lt;&lt; &quot;Please give me 1 argument&quot; &lt;&lt; endl;\r\n \t//\t\t//getchar();\r\n \t//\t\treturn -1;\r\n \t//\t}\r\n \t//}\r\n \t//else\r\n \t//{\r\n \t//\tcout &lt;&lt; &quot;Please give me 1 argument&quot; &lt;&lt; endl;\r\n \t//\t//getchar();\r\n \t//\treturn -1;\r\n \t//}\r\n \t//char *inputdata = argv[1];\r\n \t\r\n \t//const char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\P0000P0000_no_com-alt.rtdb&quot;;\r\n \tconst char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\AAA.txt&quot;;\r\n \t//const char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\P0000P0000_no_com-alt.rtdb&quot;;\r\n \t\r\n \tcout &lt;&lt; inputdata &lt;&lt; endl;\r\n \tFILE *fin, *fout, *fdec;\r\n \tfopen_s(&amp;fin, inputdata, &quot;r+&quot;);\r\n \r\n \tfopen_s(&amp;fout, &quot;output.txt&quot;, &quot;w+&quot;);\r\n \r\n \tcompress(fin, fout);\r\n \r\n \tfclose(fin);\r\n \tfclose(fout);\r\n \r\n \tfopen_s(&amp;fout, &quot;output.txt&quot;, &quot;r&quot;);\r\n \r\n \tfopen_s(&amp;fdec, &quot;dec.txt&quot;, &quot;w&quot;);\r\n \r\n \tdecompress(fout, fdec);\r\n \t\r\n \tfclose(fout);\r\n \tfclose(fdec);\r\n }","link":"https://stackoverflow.com/questions/67883805/zlib-decompression-return-3-z-data-error","title":"zlib decompression return -3 (z_data_error)","body":"<p>The zlib uncompress() return -3 (z_data_error) when I decompress data.\nFrom doc: returns Z_DATA_ERROR if the input data was corrupted or incomplete,</p>\n<pre><code>uncompress((Bytef*)uncompressbuffer, &amp;uncompressbuffersize, (const Bytef*)compressbuffer, &amp;compressbuffersize)\n</code></pre>\n<p>In another application, where I use deflate/inflate I get the same error.</p>\n<pre><code>strm.zalloc = Z_NULL;\nstrm.zfree = Z_NULL;\nstrm.opaque = Z_NULL;\nstrm.avail_in = inputLength;\nstrm.next_in = (unsigned char*) inputBuffer;\n\nret = inflateInit(&amp;strm);\nif (ret != Z_OK)\n{\n delete[] uncompressedData;\n return ERROR;\n}\n/******************************************************/\n\n\nstrm.avail_out = unusedData; \nstrm.next_out = (uncompressedData + MIN_CHUNK) - unusedData;\n\n/* run inflate() on input until output buffer not full */\ndo {\n ret = inflate(&amp;strm, Z_NO_FLUSH);\n assert(ret != Z_STREAM_ERROR); /* state not clobbered */\n\n switch (ret)\n {\n case Z_NEED_DICT:\n ret = Z_DATA_ERROR; /* and fall through */\n case Z_DATA_ERROR:\n case Z_MEM_ERROR:\n (void)inflateEnd(&amp;strm);\n return ret;\n }\n\n} while (strm.avail_out != 0 &amp;&amp; ret == Z_OK);\n</code></pre>\n<p>but</p>\n<p>this error happens only with x64 version of my software. A x86 working properly. The unzipped data is intact. The buffer size of compressed and uncompressed data are correct.\nZlib is correctly compiled to x64.\nWhat else could be causing this problem? Any hint?</p>\n<p>Sample code with &quot;uncompress&quot;:</p>\n<pre><code>#include &lt;iostream&gt;\n#include &lt;fstream&gt;\n#include &lt;cstdio&gt;\n#include &lt;vector&gt;\n#include &lt;zlib.h&gt;\n#include &lt;assert.h&gt;\n#include &lt;cstdlib&gt;\n\n#define CHUNK 16384\n\nconst int BUFFERSIZE = 4096;\n\nusing namespace std;\n\nvoid compress(FILE* fin, FILE* fout) {\n\n char buffer[BUFFERSIZE];\n \n int byte_read = fread(buffer, sizeof(char), BUFFERSIZE, fin);\n\n \n z_stream strm;\n int ret;\n unsigned have;\n unsigned char* tmp = new unsigned char[CHUNK];\n\n strm.zalloc = Z_NULL;\n strm.zfree = Z_NULL;\n strm.opaque = Z_NULL;\n strm.next_in = (unsigned char*)buffer;\n strm.avail_in = byte_read;\n strm.next_out = tmp;\n strm.avail_out = CHUNK;\n\n ret = deflateInit(&amp;strm, Z_DEFAULT_COMPRESSION);\n\n //first loop: compress input data stream and write on RTDB file\n do\n {\n\n ret = deflate(&amp;strm, Z_NO_FLUSH);\n assert(ret != Z_STREAM_ERROR);\n\n have = BUFFERSIZE - strm.avail_out;\n fwrite(tmp, sizeof(char), BUFFERSIZE, fout);\n\n } while (strm.avail_out == 0);\n //assert(strm.avail_in == 0);\n\n //second loop: all input data consumed. Flush everything...\n do\n {\n strm.next_out = tmp;\n strm.avail_out = BUFFERSIZE;\n\n ret = deflate(&amp;strm, Z_FINISH);\n assert(ret != Z_STREAM_ERROR);\n\n have = BUFFERSIZE - strm.avail_out;\n fwrite(tmp, sizeof(char), BUFFERSIZE, fout);\n\n } while (ret != Z_STREAM_END);\n\n (void)deflateEnd(&amp;strm);\n delete tmp;\n}\n\nvoid decompress(FILE* fin, FILE* fout) {\n\n int status;\n\n char buffer[BUFFERSIZE];\n\n int byte_read = fread(buffer, sizeof(char), BUFFERSIZE, fin);\n\n void* compressedBuffer;\n void* uncompressedBuffer;\n uLongf compressedBufferSize = BUFFERSIZE;\n uLongf uncompressedBufferSize = BUFFERSIZE;\n\n compressedBuffer = malloc(compressedBufferSize);\n uncompressedBuffer = malloc(uncompressedBufferSize);\n\n status = uncompress((Bytef*)uncompressedBuffer, &amp;uncompressedBufferSize, (const Bytef*)buffer, compressedBufferSize);\n\n fwrite(uncompressedBuffer, sizeof(char), BUFFERSIZE, fout);\n\n cout &lt;&lt; &quot;Status &quot; &lt;&lt; status &lt;&lt; endl;\n}\n\nint main(int argc, char *argv[]) {\n \n //if (argc == 2)\n //{\n // if (strcmp(argv[1], &quot;/?&quot;) == 0 || strcmp(argv[1], &quot;--help&quot;) == 0)\n // {\n // cout &lt;&lt; &quot;Please give me 1 argument&quot; &lt;&lt; endl;\n // //getchar();\n // return -1;\n // }\n //}\n //else\n //{\n // cout &lt;&lt; &quot;Please give me 1 argument&quot; &lt;&lt; endl;\n // //getchar();\n // return -1;\n //}\n //char *inputdata = argv[1];\n \n //const char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\P0000P0000_no_com-alt.rtdb&quot;;\n const char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\AAA.txt&quot;;\n //const char *inputdata = &quot;C:\\\\Users\\\\Francesco\\\\source\\\\repos\\\\zlibtest\\\\P0000P0000_no_com-alt.rtdb&quot;;\n \n cout &lt;&lt; inputdata &lt;&lt; endl;\n FILE *fin, *fout, *fdec;\n fopen_s(&amp;fin, inputdata, &quot;r+&quot;);\n\n fopen_s(&amp;fout, &quot;output.txt&quot;, &quot;w+&quot;);\n\n compress(fin, fout);\n\n fclose(fin);\n fclose(fout);\n\n fopen_s(&amp;fout, &quot;output.txt&quot;, &quot;r&quot;);\n\n fopen_s(&amp;fdec, &quot;dec.txt&quot;, &quot;w&quot;);\n\n decompress(fout, fdec);\n \n fclose(fout);\n fclose(fdec);\n}\n</code></pre>\n"},{"tags":["angular"],"owner":{"reputation":103,"user_id":11941232,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ec01acf4c3656d74fab3c4d3060a1eb2?s=128&d=identicon&r=PG&f=1","display_name":"Gamoxion","link":"https://stackoverflow.com/users/11941232/gamoxion"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259249,"creation_date":1623259249,"question_id":67908929,"share_link":"https://stackoverflow.com/q/67908929","body_markdown":"I have an Angular application in which I used to ask the user through a prompt to update the app whenever a new version was published. However, now I need to force the update without the user input. For updating I&#39;ve been using Angular Service Worker and the SwUpdate class.\r\n\r\nMy problem is that when I publish a new version with code that supposedly forces auto-updates, users with the old version of the app keep seeing the prompt that asks them to update. If they do update the app works fine, but if they don&#39;t the old version is no longer compatible with the new implemented functionalities.\r\n\r\nThis is the code of auto-updating on my new version:\r\n\r\n public checkForUpdates() {\r\n // console.log(&quot;checkForUpdates&quot;);\r\n // console.log(this.updates.isEnabled);\r\n if (this.updates.isEnabled) {\r\n this.updates.available.subscribe((event) =&gt; {\r\n console.log(&quot;current version is&quot;, event.current);\r\n console.log(&quot;available version is&quot;, event.available);\r\n \r\n this.updates.activateUpdate().then(() =&gt; document.location.reload());\r\n \r\n //document.location.reload();\r\n //this.promptUser(event);\r\n });\r\n this.updates.activated.subscribe((event) =&gt; {\r\n console.log(&quot;old version was&quot;, event.previous);\r\n console.log(&quot;new version is&quot;, event.current);\r\n });\r\n }\r\n }\r\n\r\nHow could I make the existing old version users to update without their input? It seems that if they don&#39;t refresh or manually update the app, they won&#39;t get the new version.","link":"https://stackoverflow.com/questions/67908929/how-to-update-old-versions-service-worker-in-angular-without-refreshing-the-page","title":"How to update old versions Service Worker in Angular without refreshing the page?","body":"<p>I have an Angular application in which I used to ask the user through a prompt to update the app whenever a new version was published. However, now I need to force the update without the user input. For updating I've been using Angular Service Worker and the SwUpdate class.</p>\n<p>My problem is that when I publish a new version with code that supposedly forces auto-updates, users with the old version of the app keep seeing the prompt that asks them to update. If they do update the app works fine, but if they don't the old version is no longer compatible with the new implemented functionalities.</p>\n<p>This is the code of auto-updating on my new version:</p>\n<pre><code> public checkForUpdates() {\n // console.log(&quot;checkForUpdates&quot;);\n // console.log(this.updates.isEnabled);\n if (this.updates.isEnabled) {\n this.updates.available.subscribe((event) =&gt; {\n console.log(&quot;current version is&quot;, event.current);\n console.log(&quot;available version is&quot;, event.available);\n\n this.updates.activateUpdate().then(() =&gt; document.location.reload());\n\n //document.location.reload();\n //this.promptUser(event);\n });\n this.updates.activated.subscribe((event) =&gt; {\n console.log(&quot;old version was&quot;, event.previous);\n console.log(&quot;new version is&quot;, event.current);\n });\n }\n }\n</code></pre>\n<p>How could I make the existing old version users to update without their input? It seems that if they don't refresh or manually update the app, they won't get the new version.</p>\n"},{"tags":[".net","asp.net-core"],"owner":{"reputation":3,"user_id":9551458,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ff0ad13b2d83752d5b3532c760aebd58?s=128&d=identicon&r=PG&f=1","display_name":"beiduoan","link":"https://stackoverflow.com/users/9551458/beiduoan"},"is_answered":false,"view_count":11,"answer_count":0,"score":0,"last_activity_date":1623259249,"creation_date":1623258145,"question_id":67908676,"share_link":"https://stackoverflow.com/q/67908676","body_markdown":"I hope get week datetime list by datetime range,I tried the following code get number of weeks per month.\r\n\r\n var start = new DateTime(2021, 6, 09);\r\n var end = new DateTime(2021, 7, 01);\r\n\r\n end = new DateTime(end.Year, end.Month, DateTime.DaysInMonth(end.Year, end.Month));\r\n\r\n var diff = Enumerable.Range(0, Int32.MaxValue)\r\n .Select(e =&gt; start.AddMonths(e))\r\n .TakeWhile(e =&gt; e &lt;= end)\r\n .Select(e =&gt; Convert.ToDateTime(e.ToString(&quot;yyyy-MM&quot;)));\r\n\r\n foreach (var item in diff)\r\n {\r\n\r\n DateTime dateTime = item;\r\n Calendar calendar = CultureInfo.CurrentCulture.Calendar;\r\n IEnumerable&lt;int&gt; daysInMonth = Enumerable.Range(1, calendar.GetDaysInMonth(dateTime.Year, dateTime.Month));\r\n List&lt;Tuple&lt;DateTime, DateTime&gt;&gt; weeks = daysInMonth.Select(day =&gt; new DateTime(dateTime.Year, dateTime.Month, day))\r\n .GroupBy(d =&gt; calendar.GetWeekOfYear(d, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday))\r\n .Select(g =&gt; new Tuple&lt;DateTime, DateTime&gt;(g.First(), g.Last()))\r\n .ToList();\r\n }\r\nBut,I hope get DateTime(2021, 6, 09) between Week starting on the 9th and DateTime(2021, 7, 01) Week ending on the 1th of weeks time, like this.\r\n\r\n 2021-06-09 2021-06-13\r\n .....\r\n 2021-06-28 2021-07-01\r\nhow to changed my code","link":"https://stackoverflow.com/questions/67908676/net-core-how-to-get-week-datetime-list-by-datetime-range","title":".net core how to get week datetime list by datetime range","body":"<p>I hope get week datetime list by datetime range,I tried the following code get number of weeks per month.</p>\n<pre><code>var start = new DateTime(2021, 6, 09);\n var end = new DateTime(2021, 7, 01);\n\n end = new DateTime(end.Year, end.Month, DateTime.DaysInMonth(end.Year, end.Month));\n\n var diff = Enumerable.Range(0, Int32.MaxValue)\n .Select(e =&gt; start.AddMonths(e))\n .TakeWhile(e =&gt; e &lt;= end)\n .Select(e =&gt; Convert.ToDateTime(e.ToString(&quot;yyyy-MM&quot;)));\n\n foreach (var item in diff)\n {\n\n DateTime dateTime = item;\n Calendar calendar = CultureInfo.CurrentCulture.Calendar;\n IEnumerable&lt;int&gt; daysInMonth = Enumerable.Range(1, calendar.GetDaysInMonth(dateTime.Year, dateTime.Month));\n List&lt;Tuple&lt;DateTime, DateTime&gt;&gt; weeks = daysInMonth.Select(day =&gt; new DateTime(dateTime.Year, dateTime.Month, day))\n .GroupBy(d =&gt; calendar.GetWeekOfYear(d, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday))\n .Select(g =&gt; new Tuple&lt;DateTime, DateTime&gt;(g.First(), g.Last()))\n .ToList();\n }\n</code></pre>\n<p>But,I hope get DateTime(2021, 6, 09) between Week starting on the 9th and DateTime(2021, 7, 01) Week ending on the 1th of weeks time, like this.</p>\n<pre><code>2021-06-09 2021-06-13\n.....\n2021-06-28 2021-07-01\n</code></pre>\n<p>how to changed my code</p>\n"},{"tags":["r","shiny","r-markdown","flexdashboard","bootswatch"],"owner":{"reputation":37,"user_id":7885168,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/7ecb244d8a9605d9d6a61412d9ad7234?s=128&d=identicon&r=PG&f=1","display_name":"Wolkuz","link":"https://stackoverflow.com/users/7885168/wolkuz"},"is_answered":false,"view_count":5,"answer_count":0,"score":0,"last_activity_date":1623259247,"creation_date":1623259247,"question_id":67908927,"share_link":"https://stackoverflow.com/q/67908927","body_markdown":"Maybe it&#39;s something very easy to solve, but I haven&#39;t found the problem yet.\r\n\r\nI started to develop a Dashboard in ```Rmarkdown```, ```Flexdashboard``` and ```Shiny```. At some point I tried the **dark theme** and it seems that the navigation bar is in **dark mode** always, and everything else is in **&quot;light&quot; mode**, since I see it in purple color, and it seems to me that it should be orange.\r\n\r\nI attach a reference image.\r\n\r\n[![Flexdashboard][1]][1]\r\n\r\nI am using the **&quot;United&quot;** theme: https://bootswatch.com/united/\r\n\r\nHere is the YAML header:\r\n\r\n[![YAML][2]][2]\r\n\r\nDoes anyone know how to fix it? I don&#39;t see where the problem is.\r\n\r\n\r\nI remain attentive, best regards.\r\n\r\n\r\n [1]: https://i.stack.imgur.com/kwXJH.png\r\n [2]: https://i.stack.imgur.com/RR637.png","link":"https://stackoverflow.com/questions/67908927/a-part-of-a-flexdashboard-is-permanently-in-dark-mode-while-the-entire-dashboa","title":"A part of a flexdashboard is permanently in &quot;Dark Mode&quot; while the entire dashboard is in &quot;Light Mode&quot;. How can I change it?","body":"<p>Maybe it's something very easy to solve, but I haven't found the problem yet.</p>\n<p>I started to develop a Dashboard in <code>Rmarkdown</code>, <code>Flexdashboard</code> and <code>Shiny</code>. At some point I tried the <strong>dark theme</strong> and it seems that the navigation bar is in <strong>dark mode</strong> always, and everything else is in <strong>&quot;light&quot; mode</strong>, since I see it in purple color, and it seems to me that it should be orange.</p>\n<p>I attach a reference image.</p>\n<p><a href=\"https://i.stack.imgur.com/kwXJH.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/kwXJH.png\" alt=\"Flexdashboard\" /></a></p>\n<p>I am using the <strong>&quot;United&quot;</strong> theme: <a href=\"https://bootswatch.com/united/\" rel=\"nofollow noreferrer\">https://bootswatch.com/united/</a></p>\n<p>Here is the YAML header:</p>\n<p><a href=\"https://i.stack.imgur.com/RR637.png\" rel=\"nofollow noreferrer\"><img src=\"https://i.stack.imgur.com/RR637.png\" alt=\"YAML\" /></a></p>\n<p>Does anyone know how to fix it? I don't see where the problem is.</p>\n<p>I remain attentive, best regards.</p>\n"},{"tags":["javascript","html","css"],"owner":{"reputation":1,"user_id":16178312,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/9041a8090d7aaca35694e6d18699a9a8?s=128&d=identicon&r=PG&f=1","display_name":"jb12","link":"https://stackoverflow.com/users/16178312/jb12"},"is_answered":false,"view_count":7,"answer_count":0,"score":0,"last_activity_date":1623259246,"creation_date":1623259246,"question_id":67908926,"share_link":"https://stackoverflow.com/q/67908926","body_markdown":"the last tab titled contact me does not display any of its content when I click it. \r\n \r\n &lt;body&gt;\r\n &lt;ul class=&quot;tabs&quot;&gt;\r\n &lt;li data-tab-target=&quot;#home&quot; class=&quot;active tab&quot;&gt;Home&lt;/li&gt;\r\n &lt;li data-tab-target=&quot;#pricing&quot; class=&quot;tab&quot;&gt;Pricing&lt;/li&gt;\r\n &lt;li data-tab-target=&quot;#about&quot; class=&quot;tab&quot;&gt;About&lt;/li&gt;\r\n &lt;li data-tab-target=&quot;#Contact Me&quot; class=&quot;tab&quot;&gt;Contact Me&lt;/li&gt;\r\n &lt;/ul&gt;\r\n \r\n &lt;div class=&quot;tab-content&quot;&gt;\r\n &lt;div id=&quot;home&quot; data-tab-content class=&quot;active&quot;&gt;\r\n &lt;h1&gt;Home&lt;/h1&gt;\r\n &lt;p&gt;This is the home&lt;/p&gt;\r\n &lt;/div&gt;\r\n &lt;div id=&quot;pricing&quot; data-tab-content&gt;\r\n &lt;h1&gt;Pricing&lt;/h1&gt;\r\n &lt;p&gt;Some information on pricing&lt;/p&gt;\r\n &lt;/div&gt;\r\n &lt;div id=&quot;about&quot; data-tab-content&gt;\r\n &lt;h1&gt;About&lt;/h1&gt;\r\n &lt;p&gt;Let me tell you about me&lt;/p&gt;\r\n &lt;/div&gt;\r\n &lt;div id=&quot;Contact Me&quot; data-tab-content&gt;\r\n &lt;h1&gt;Contact&lt;/h1&gt;\r\n &lt;p&gt;hello let me tell&lt;/p&gt;\r\n &lt;/div&gt;\r\n &lt;/div&gt;\r\n \r\n &lt;/body&gt;\r\n &lt;/html&gt;\r\n \r\n \r\n JS: This is where the error(Uncaught TypeError: Cannot read property &#39;classList&#39; of null) is and I am not sure what I am doing wrong. \r\n \r\n const tabs = document.querySelectorAll(&#39;[data-tab-target]&#39;)\r\n const tabContents = document.querySelectorAll(&#39;[data-tab-content]&#39;)\r\n \r\n tabs.forEach(tab =&gt; {\r\n tab.addEventListener(&#39;click&#39;, () =&gt; {\r\n const target = document.querySelector(tab.dataset.tabTarget)\r\n tabContents.forEach(tabContent =&gt; {\r\n tabContent.classList.remove(&#39;active&#39;)\r\n })\r\n tabs.forEach(tab =&gt; {\r\n tab.classList.remove(&#39;active&#39;)\r\n })\r\n tab.classList.add(&#39;active&#39;)\r\n target.classList.add(&#39;active&#39;)\r\n \r\n })\r\n })\r\n","link":"https://stackoverflow.com/questions/67908926/why-do-i-keep-getting-this-error-uncaught-typeerror-cannot-read-property-clas","title":"Why do I keep getting this error? Uncaught TypeError: Cannot read property &#39;classList&#39; of null","body":"<p>the last tab titled contact me does not display any of its content when I click it.</p>\n<pre><code>&lt;body&gt;\n &lt;ul class=&quot;tabs&quot;&gt;\n &lt;li data-tab-target=&quot;#home&quot; class=&quot;active tab&quot;&gt;Home&lt;/li&gt;\n &lt;li data-tab-target=&quot;#pricing&quot; class=&quot;tab&quot;&gt;Pricing&lt;/li&gt;\n &lt;li data-tab-target=&quot;#about&quot; class=&quot;tab&quot;&gt;About&lt;/li&gt;\n &lt;li data-tab-target=&quot;#Contact Me&quot; class=&quot;tab&quot;&gt;Contact Me&lt;/li&gt;\n &lt;/ul&gt;\n \n &lt;div class=&quot;tab-content&quot;&gt;\n &lt;div id=&quot;home&quot; data-tab-content class=&quot;active&quot;&gt;\n &lt;h1&gt;Home&lt;/h1&gt;\n &lt;p&gt;This is the home&lt;/p&gt;\n &lt;/div&gt;\n &lt;div id=&quot;pricing&quot; data-tab-content&gt;\n &lt;h1&gt;Pricing&lt;/h1&gt;\n &lt;p&gt;Some information on pricing&lt;/p&gt;\n &lt;/div&gt;\n &lt;div id=&quot;about&quot; data-tab-content&gt;\n &lt;h1&gt;About&lt;/h1&gt;\n &lt;p&gt;Let me tell you about me&lt;/p&gt;\n &lt;/div&gt;\n &lt;div id=&quot;Contact Me&quot; data-tab-content&gt;\n &lt;h1&gt;Contact&lt;/h1&gt;\n &lt;p&gt;hello let me tell&lt;/p&gt;\n &lt;/div&gt;\n &lt;/div&gt;\n\n&lt;/body&gt;\n&lt;/html&gt;\n</code></pre>\n<p>JS: This is where the error(Uncaught TypeError: Cannot read property 'classList' of null) is and I am not sure what I am doing wrong.</p>\n<pre><code>const tabs = document.querySelectorAll('[data-tab-target]')\nconst tabContents = document.querySelectorAll('[data-tab-content]')\n\ntabs.forEach(tab =&gt; {\n tab.addEventListener('click', () =&gt; {\n const target = document.querySelector(tab.dataset.tabTarget)\n tabContents.forEach(tabContent =&gt; {\n tabContent.classList.remove('active')\n })\n tabs.forEach(tab =&gt; {\n tab.classList.remove('active')\n })\n tab.classList.add('active')\n target.classList.add('active')\n \n })\n})\n</code></pre>\n"},{"tags":["javascript","jquery","ajax"],"owner":{"reputation":123,"user_id":11420295,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/28b47334053d432b7db43f2fcb94170f?s=128&d=identicon&r=PG&f=1","display_name":"master_j02","link":"https://stackoverflow.com/users/11420295/master-j02"},"is_answered":false,"view_count":6,"answer_count":0,"score":0,"last_activity_date":1623259244,"creation_date":1623259244,"question_id":67908925,"share_link":"https://stackoverflow.com/q/67908925","body_markdown":"I am using Ajax to populate a global list of employees, which are able to be selected to use in a form. Now Everything works fine, but the only thing I would like to do is access a variable inside the Ajax request, to use in another function. The variable is a JavaScript object, which I would like to use to pre-populate the fields of the form with the employees data. I will shorten the HTML for better readability, and show the only field that I&#39;m concerned about. \r\n\r\nThe `&lt;input&gt;` tag in the Ajax function calls the `addEmployee` function to add the employee in the backend. \r\n\r\n\r\n $(&quot;#email, #phone&quot;).change(function () {\r\n let phone = $(&#39;#phone&#39;).val();\r\n let email = $(&#39;#email&#39;).val();\r\n \r\n \r\n $.ajax({\r\n url: &#39;/employee/add/&#39;,\r\n data: {\r\n &#39;phone&#39;: phone,\r\n &#39;email&#39;: email,\r\n },\r\n dataType: &#39;json&#39;,\r\n success: function (data) {\r\n if (data) {\r\n $(&#39;#employee_list&#39;).html(&quot;&quot;);\r\n let res = data.emp_list;\r\n if (res.length &gt; 0) {\r\n for (let i = 0; i &lt; res.length; i++) {\r\n let html_string = &#39;&#39;;\r\n let data = res[i];\r\n //I would like to access this ^^ data variable in the addEmployee function\r\n \r\n html_string += &#39;&lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=&quot;&#39; + data.id + &#39;&quot; name=&quot;remember_me&quot; value=&quot;&#39; + data.id + &#39;&quot;&#39; + (data.selected ? &#39;checked&#39; : &#39;&#39;) + &#39;&gt;&#39;\r\n\r\n // There are a bunch of other html strings that just populate the list with the \r\n //data variable, and access that object properties, such as data.first_name, data.last_name etc.\r\n\r\n \r\n\r\n html = $.parseHTML(html_string);\r\n $(&#39;#employee_list&#39;).append(html);\r\n }\r\n \r\n } else {\r\n $(&quot;#emp-list-head&quot;).hide();\r\n \r\n }\r\n }\r\n }\r\n \r\n });\r\n \r\n });\r\n \r\n \r\n function addEmployee(checkbox) {\r\n if ($(checkbox).is(&#39;:checked&#39;)) {\r\n $(&quot;&lt;input&gt;&quot;).attr({\r\n name: &quot;hidden_id&quot;,\r\n id: &quot;hidden_id&quot;,\r\n type: &quot;hidden&quot;,\r\n value: checkbox.value\r\n }).appendTo($(&#39;#add_employee_form&#39;));\r\n // Down here I would like to access the data variable from the ajax function to prepopulate my form\r\n $(&#39;#emp_first_name&#39;).val(where I would like to access data.first_name);\r\n }\r\n } \r\n\r\n\r\nis this something that is possible, or would complete extra functionality be needed to access the `data` variable from the ajax function to use in the `addEmployee` function?\r\n\r\nI even tried adding the `data` object itself in a custom html `data-value` attribute like so, \r\n\r\n html_string += &#39;&lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=&quot;&#39; + data.id + &#39;&quot; name=&quot;remember_me&quot; data-value=&quot;&#39; + data + &#39;&quot;&#39; + value=&quot;&#39; + data.id + &#39;&quot;&#39; + (data.selected ? &#39;checked&#39; : &#39;&#39;) + &#39;&gt;&#39;\r\n\r\nthis returned the `data-value` as an [object Object] like so, \r\n\r\n &lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=3 name=&quot;remember_me&quot; data-value=&quot;[object Object]&quot; value=3&gt;\r\n\r\nAny help is greatly appreciated!\r\n\r\n\r\n","link":"https://stackoverflow.com/questions/67908925/access-a-javascript-variable-in-an-ajax-request-to-use-inside-another-function","title":"Access a JavaScript variable in an Ajax request, to use inside another function?","body":"<p>I am using Ajax to populate a global list of employees, which are able to be selected to use in a form. Now Everything works fine, but the only thing I would like to do is access a variable inside the Ajax request, to use in another function. The variable is a JavaScript object, which I would like to use to pre-populate the fields of the form with the employees data. I will shorten the HTML for better readability, and show the only field that I'm concerned about.</p>\n<p>The <code>&lt;input&gt;</code> tag in the Ajax function calls the <code>addEmployee</code> function to add the employee in the backend.</p>\n<pre><code> $(&quot;#email, #phone&quot;).change(function () {\n let phone = $('#phone').val();\n let email = $('#email').val();\n\n\n $.ajax({\n url: '/employee/add/',\n data: {\n 'phone': phone,\n 'email': email,\n },\n dataType: 'json',\n success: function (data) {\n if (data) {\n $('#employee_list').html(&quot;&quot;);\n let res = data.emp_list;\n if (res.length &gt; 0) {\n for (let i = 0; i &lt; res.length; i++) {\n let html_string = '';\n let data = res[i];\n //I would like to access this ^^ data variable in the addEmployee function\n\n html_string += '&lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=&quot;' + data.id + '&quot; name=&quot;remember_me&quot; value=&quot;' + data.id + '&quot;' + (data.selected ? 'checked' : '') + '&gt;'\n\n // There are a bunch of other html strings that just populate the list with the \n //data variable, and access that object properties, such as data.first_name, data.last_name etc.\n\n \n\n html = $.parseHTML(html_string);\n $('#employee_list').append(html);\n }\n\n } else {\n $(&quot;#emp-list-head&quot;).hide();\n\n }\n }\n }\n\n });\n\n});\n\n\nfunction addEmployee(checkbox) {\n if ($(checkbox).is(':checked')) {\n $(&quot;&lt;input&gt;&quot;).attr({\n name: &quot;hidden_id&quot;,\n id: &quot;hidden_id&quot;,\n type: &quot;hidden&quot;,\n value: checkbox.value\n }).appendTo($('#add_employee_form'));\n // Down here I would like to access the data variable from the ajax function to prepopulate my form\n $('#emp_first_name').val(where I would like to access data.first_name);\n }\n} \n</code></pre>\n<p>is this something that is possible, or would complete extra functionality be needed to access the <code>data</code> variable from the ajax function to use in the <code>addEmployee</code> function?</p>\n<p>I even tried adding the <code>data</code> object itself in a custom html <code>data-value</code> attribute like so,</p>\n<pre><code>html_string += '&lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=&quot;' + data.id + '&quot; name=&quot;remember_me&quot; data-value=&quot;' + data + '&quot;' + value=&quot;' + data.id + '&quot;' + (data.selected ? 'checked' : '') + '&gt;'\n</code></pre>\n<p>this returned the <code>data-value</code> as an [object Object] like so,</p>\n<pre><code>&lt;input onchange=&quot;addEmployee(this)&quot; type=&quot;checkbox&quot; id=3 name=&quot;remember_me&quot; data-value=&quot;[object Object]&quot; value=3&gt;\n</code></pre>\n<p>Any help is greatly appreciated!</p>\n"},{"tags":["c","command-line-arguments"],"comments":[{"owner":{"reputation":10409,"user_id":1216776,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/504692de390dabd9ca22fd716e178993?s=128&d=identicon&r=PG","display_name":"stark","link":"https://stackoverflow.com/users/1216776/stark"},"edited":false,"score":1,"creation_date":1623258095,"post_id":67908589,"comment_id":120030217,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":298,"user_id":7242485,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8f1e2b806fd878ae104d6435ffe001ad?s=128&d=identicon&r=PG&f=1","display_name":"zBeeble","link":"https://stackoverflow.com/users/7242485/zbeeble"},"is_accepted":false,"score":0,"last_activity_date":1623258221,"creation_date":1623258221,"answer_id":67908690,"question_id":67908589,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":70259,"user_id":3422102,"user_type":"registered","accept_rate":100,"profile_image":"https://i.stack.imgur.com/Tg0Gt.png?s=128&g=1","display_name":"David C. Rankin","link":"https://stackoverflow.com/users/3422102/david-c-rankin"},"is_accepted":false,"score":0,"last_activity_date":1623259237,"creation_date":1623259237,"answer_id":67908924,"question_id":67908589,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16178169,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyGO2dy6KfymSm1J9AnFDkqcRib7NgpRr8YPxMM=k-s128","display_name":"Rakesh Sharma chemist","link":"https://stackoverflow.com/users/16178169/rakesh-sharma-chemist"},"is_answered":false,"view_count":23,"answer_count":2,"score":0,"last_activity_date":1623259237,"creation_date":1623257778,"question_id":67908589,"share_link":"https://stackoverflow.com/q/67908589","body_markdown":"i have been searched for this issue but didn&#39;t found any solution.\r\nActually i want to create a Compiled in C, and if i enter ant argument to that file then it forwards the argument to another command via system()\r\nLet me explain,\r\nsuppose, growkl is my C compiled file.\r\nand in terminal, i wrote this :\r\n\r\n growkl TRYNEW /etc/cron.d ./grill/mk\r\n\r\nand then, the growkl file will forward all these arguments ( TRYNEW /etc/cron.d ./grill/mk ) to the command **/usr/bin/gkbroot**\r\nIn this way :\r\n\r\n /usr/bin/gkbroot TRYNEW /etc/cron.d ./grill/mk\r\n\r\n\r\nI&#39;m a newbie with these things, so I&#39;m not getting how to do this.\r\nCan anyone tell me","link":"https://stackoverflow.com/questions/67908589/how-to-get-list-of-all-command-line-argument-and-forward-all-of-those-arguments","title":"How to get list of all command line argument and forward all of those arguments to another command in C","body":"<p>i have been searched for this issue but didn't found any solution.\nActually i want to create a Compiled in C, and if i enter ant argument to that file then it forwards the argument to another command via system()\nLet me explain,\nsuppose, growkl is my C compiled file.\nand in terminal, i wrote this :</p>\n<pre><code>growkl TRYNEW /etc/cron.d ./grill/mk\n</code></pre>\n<p>and then, the growkl file will forward all these arguments ( TRYNEW /etc/cron.d ./grill/mk ) to the command <strong>/usr/bin/gkbroot</strong>\nIn this way :</p>\n<pre><code>/usr/bin/gkbroot TRYNEW /etc/cron.d ./grill/mk\n</code></pre>\n<p>I'm a newbie with these things, so I'm not getting how to do this.\nCan anyone tell me</p>\n"},{"tags":["google-apps-script","mathematical-optimization","or-tools"],"comments":[{"owner":{"reputation":2021,"user_id":7810777,"user_type":"registered","profile_image":"https://i.stack.imgur.com/EadKV.jpg?s=128&g=1","display_name":"Stradivari","link":"https://stackoverflow.com/users/7810777/stradivari"},"edited":false,"score":0,"creation_date":1623250719,"post_id":67904711,"comment_id":120026805,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":10974726,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Xpeou.jpg?s=128&g=1","display_name":"A. Albinus","link":"https://stackoverflow.com/users/10974726/a-albinus"},"is_answered":false,"view_count":23,"answer_count":0,"score":0,"last_activity_date":1623259237,"creation_date":1623243748,"last_edit_date":1623259237,"question_id":67904711,"share_link":"https://stackoverflow.com/q/67904711","body_markdown":"I need to solve an assignment problem with Google Apps Script. The [LinearOptimizationService][1] seemed to be promising so what I tried is to port a corresponding [example from the google or-tools][2] .\r\n\r\nUnfortunately, I couldn&#39;t find out a way how I set up the constraint that each worker is assigned to exactly one task.\r\n\r\n\r\nThe working code (without the constraint) is as follows:\r\n\r\n```\r\nfunction myFunction() {\r\n // Create the variables\r\n var engine = LinearOptimizationService.createEngine();\r\n \r\n const costMatrix = [[7,5,3,8,3]\r\n ,[2,5,6,7,1]\r\n ,[1,8,9,5,9]]\r\n\r\n const capacities = [1,1,1,1,1]\r\n\r\n // initialize the decision variables\r\n x = new Array(costMatrix.length);\r\n for (let i=0; i&lt;costMatrix.length; i++){\r\n x[i] = new Array(costMatrix[0].length);\r\n for (let j=0; j&lt;costMatrix[0].length; j++){\r\n x[i][j] = engine.addVariable(`x${i}${j}`, 0, 1, LinearOptimizationService.VariableType.INTEGER, costMatrix[i][j]);\r\n }\r\n }\r\n\r\n // Each worker is assigned to at most one task.\r\n for (let i = 0; i &lt; costMatrix.length; ++i) {\r\n constraint = engine.addConstraint(1, 1);\r\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\r\n let contraintVar = engine.addVariable(x[i][j],0,1)\r\n constraint.setCoefficient(contraintVar, 1);\r\n }\r\n }\r\n\r\n // Each task is assigned to exactly one worker.\r\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\r\n constraint = engine.addConstraint(1, 1);\r\n for (let i = 0; i &lt; costMatrix.length; ++i) {\r\n let contraintVar = engine.addVariable(x[i][j],0,1)\r\n Logger.log(contraintVar)\r\n constraint.setCoefficient(contraintVar, 1);\r\n }\r\n }\r\n\r\n for (let i = 0; i &lt; costMatrix.length; ++i) {\r\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\r\n engine.setObjectiveCoefficient(x[i][j], costMatrix[i][j]);\r\n }\r\n }\r\n\r\n engine.setMinimization()\r\n\r\n // Solve the linear program\r\n var solution = engine.solve();\r\n if (!solution.isValid()) {\r\n throw &#39;No solution &#39; + solution.getStatus();\r\n }\r\n Logger.log(&#39;ObjectiveValue: &#39; + solution.getObjectiveValue());\r\n for (let i=0; i&lt;costMatrix.length; i++){\r\n for (let j=0; j&lt;costMatrix[0].length; j++){\r\n Logger.log(`Value of: x${i}${j} ` + solution.getVariableValue(`x${i}${j}`));\r\n }\r\n }\r\n}\r\n```\r\nAny help is appreciated.\r\n\r\nThanks\r\n\r\n\r\n [1]: https://developers.google.com/apps-script/reference/optimization\r\n [2]: https://developers.google.com/optimization/assignment/assignment_example","link":"https://stackoverflow.com/questions/67904711/adding-constraints-in-google-apps-script-linear-optimization-service","title":"Adding Constraints in Google Apps Script Linear Optimization Service","body":"<p>I need to solve an assignment problem with Google Apps Script. The <a href=\"https://developers.google.com/apps-script/reference/optimization\" rel=\"nofollow noreferrer\">LinearOptimizationService</a> seemed to be promising so what I tried is to port a corresponding <a href=\"https://developers.google.com/optimization/assignment/assignment_example\" rel=\"nofollow noreferrer\">example from the google or-tools</a> .</p>\n<p>Unfortunately, I couldn't find out a way how I set up the constraint that each worker is assigned to exactly one task.</p>\n<p>The working code (without the constraint) is as follows:</p>\n<pre><code>function myFunction() {\n // Create the variables\n var engine = LinearOptimizationService.createEngine();\n \n const costMatrix = [[7,5,3,8,3]\n ,[2,5,6,7,1]\n ,[1,8,9,5,9]]\n\n const capacities = [1,1,1,1,1]\n\n // initialize the decision variables\n x = new Array(costMatrix.length);\n for (let i=0; i&lt;costMatrix.length; i++){\n x[i] = new Array(costMatrix[0].length);\n for (let j=0; j&lt;costMatrix[0].length; j++){\n x[i][j] = engine.addVariable(`x${i}${j}`, 0, 1, LinearOptimizationService.VariableType.INTEGER, costMatrix[i][j]);\n }\n }\n\n // Each worker is assigned to at most one task.\n for (let i = 0; i &lt; costMatrix.length; ++i) {\n constraint = engine.addConstraint(1, 1);\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\n let contraintVar = engine.addVariable(x[i][j],0,1)\n constraint.setCoefficient(contraintVar, 1);\n }\n }\n\n // Each task is assigned to exactly one worker.\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\n constraint = engine.addConstraint(1, 1);\n for (let i = 0; i &lt; costMatrix.length; ++i) {\n let contraintVar = engine.addVariable(x[i][j],0,1)\n Logger.log(contraintVar)\n constraint.setCoefficient(contraintVar, 1);\n }\n }\n\n for (let i = 0; i &lt; costMatrix.length; ++i) {\n for (let j = 0; j &lt; costMatrix[0].length; ++j) {\n engine.setObjectiveCoefficient(x[i][j], costMatrix[i][j]);\n }\n }\n\n engine.setMinimization()\n\n // Solve the linear program\n var solution = engine.solve();\n if (!solution.isValid()) {\n throw 'No solution ' + solution.getStatus();\n }\n Logger.log('ObjectiveValue: ' + solution.getObjectiveValue());\n for (let i=0; i&lt;costMatrix.length; i++){\n for (let j=0; j&lt;costMatrix[0].length; j++){\n Logger.log(`Value of: x${i}${j} ` + solution.getVariableValue(`x${i}${j}`));\n }\n }\n}\n</code></pre>\n<p>Any help is appreciated.</p>\n<p>Thanks</p>\n"},{"tags":["amazon-dynamodb","amazon-cloudformation","aws-cli"],"comments":[{"owner":{"reputation":16555,"user_id":2933177,"user_type":"registered","accept_rate":50,"profile_image":"https://i.stack.imgur.com/LRuRW.jpg?s=128&g=1","display_name":"Charles","link":"https://stackoverflow.com/users/2933177/charles"},"edited":false,"score":0,"creation_date":1623259224,"post_id":67908480,"comment_id":120030634,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":16555,"user_id":2933177,"user_type":"registered","accept_rate":50,"profile_image":"https://i.stack.imgur.com/LRuRW.jpg?s=128&g=1","display_name":"Charles","link":"https://stackoverflow.com/users/2933177/charles"},"is_accepted":false,"score":0,"last_activity_date":1623259237,"creation_date":1623259237,"answer_id":67908923,"question_id":67908480,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":80,"user_id":1671640,"user_type":"registered","accept_rate":88,"profile_image":"https://www.gravatar.com/avatar/31ab2686bf849ad0e31bbea0f78aa421?s=128&d=identicon&r=PG","display_name":"Patrick Taylor","link":"https://stackoverflow.com/users/1671640/patrick-taylor"},"is_answered":false,"view_count":8,"answer_count":1,"score":0,"last_activity_date":1623259237,"creation_date":1623257278,"question_id":67908480,"share_link":"https://stackoverflow.com/q/67908480","body_markdown":"I&#39;m trying to implement a DynamoDB `get_item` call using &lt;https://github.com/aws/aws-sdk-ruby/blob/0465bfacbf87e6bc78c38191961ed860413d85cd/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L697&gt; via our Ruby on Rails app, [dr-recommends](https://github.com/lampo/dr-recommends).\r\n\r\nFrom reviewing this DynamoDB CloudFormation stack that I wrote, I expect the following `get_item` call to work, so I&#39;m a little lost as to how to proceed.\r\n\r\n```yml\r\nType: &#39;AWS::DynamoDB::Table&#39;\r\nProperties:\r\n AttributeDefinitions:\r\n - AttributeName: &#39;pk&#39;\r\n AttributeType: &#39;S&#39;\r\n - AttributeName: &#39;sk&#39;\r\n AttributeType: &#39;S&#39;\r\n KeySchema:\r\n - KeyType: &#39;HASH&#39;\r\n AttributeName: &#39;pk&#39;\r\n - KeyType: &#39;RANGE&#39;\r\n AttributeName: &#39;sk&#39;\r\n BillingMode: &#39;PAY_PER_REQUEST&#39;\r\n```\r\n\r\nDo you see anything here that would explain why the following call might not work?\r\n\r\n```bash\r\naws dynamodb get-item --table-name actual-table-name --key &quot;{\\&quot;pk\\&quot;:{\\&quot;S\\&quot;:\\&quot;77119f89-d5bc-4662-91bb-f3e81e1d9b21\\&quot;}}&quot; --projection-expression sk\r\n# An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema\r\n```","link":"https://stackoverflow.com/questions/67908480/dynamodb-get-item-the-provided-key-element-does-not-match-the-schema","title":"DynamoDB get_item &quot;The provided key element does not match the schema&quot;","body":"<p>I'm trying to implement a DynamoDB <code>get_item</code> call using <a href=\"https://github.com/aws/aws-sdk-ruby/blob/0465bfacbf87e6bc78c38191961ed860413d85cd/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L697\" rel=\"nofollow noreferrer\">https://github.com/aws/aws-sdk-ruby/blob/0465bfacbf87e6bc78c38191961ed860413d85cd/gems/aws-sdk-dynamodb/lib/aws-sdk-dynamodb/table.rb#L697</a> via our Ruby on Rails app, <a href=\"https://github.com/lampo/dr-recommends\" rel=\"nofollow noreferrer\">dr-recommends</a>.</p>\n<p>From reviewing this DynamoDB CloudFormation stack that I wrote, I expect the following <code>get_item</code> call to work, so I'm a little lost as to how to proceed.</p>\n<pre class=\"lang-yaml prettyprint-override\"><code>Type: 'AWS::DynamoDB::Table'\nProperties:\n AttributeDefinitions:\n - AttributeName: 'pk'\n AttributeType: 'S'\n - AttributeName: 'sk'\n AttributeType: 'S'\n KeySchema:\n - KeyType: 'HASH'\n AttributeName: 'pk'\n - KeyType: 'RANGE'\n AttributeName: 'sk'\n BillingMode: 'PAY_PER_REQUEST'\n</code></pre>\n<p>Do you see anything here that would explain why the following call might not work?</p>\n<pre class=\"lang-sh prettyprint-override\"><code>aws dynamodb get-item --table-name actual-table-name --key &quot;{\\&quot;pk\\&quot;:{\\&quot;S\\&quot;:\\&quot;77119f89-d5bc-4662-91bb-f3e81e1d9b21\\&quot;}}&quot; --projection-expression sk\n# An error occurred (ValidationException) when calling the GetItem operation: The provided key element does not match the schema\n</code></pre>\n"},{"tags":["c#","html","regex","string","replace"],"comments":[{"owner":{"reputation":2839,"user_id":470096,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c88080fb2ed07fc23209593063e224ed?s=128&d=identicon&r=PG","display_name":"Mark PM","link":"https://stackoverflow.com/users/470096/mark-pm"},"edited":false,"score":1,"creation_date":1623251940,"post_id":67906850,"comment_id":120027404,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":503,"user_id":12107765,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/6dd4d1f63f1845902b761281f462226e?s=128&d=identicon&r=PG&f=1","display_name":"Klamsi","link":"https://stackoverflow.com/users/12107765/klamsi"},"edited":false,"score":0,"creation_date":1623252739,"post_id":67906850,"comment_id":120027814,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":86677,"user_id":880990,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/123d02be3a4fb6074b72b7e28bc05bad?s=128&d=identicon&r=PG","display_name":"Olivier Jacot-Descombes","link":"https://stackoverflow.com/users/880990/olivier-jacot-descombes"},"edited":false,"score":0,"creation_date":1623256716,"post_id":67906850,"comment_id":120029648,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16176386,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/045e7356a66ea114e0bef422764b8358?s=128&d=identicon&r=PG&f=1","display_name":"Buckweed","link":"https://stackoverflow.com/users/16176386/buckweed"},"edited":false,"score":0,"creation_date":1623258297,"post_id":67906850,"comment_id":120030286,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":1,"user_id":16176386,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/045e7356a66ea114e0bef422764b8358?s=128&d=identicon&r=PG&f=1","display_name":"Buckweed","link":"https://stackoverflow.com/users/16176386/buckweed"},"is_accepted":false,"score":0,"last_activity_date":1623259237,"creation_date":1623259237,"answer_id":67908922,"question_id":67906850,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16176386,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/045e7356a66ea114e0bef422764b8358?s=128&d=identicon&r=PG&f=1","display_name":"Buckweed","link":"https://stackoverflow.com/users/16176386/buckweed"},"is_answered":false,"view_count":26,"answer_count":1,"score":-1,"last_activity_date":1623259237,"creation_date":1623251027,"last_edit_date":1623256251,"question_id":67906850,"share_link":"https://stackoverflow.com/q/67906850","body_markdown":"I would like to replace words in a html string with another word, but it must only replace the exact word and not if it is part of the spelling of part of a word. The problem that I am having is that the html open or closing tags or other html elements are affecting what words are matched in the regex or it is replacing parts of words.\r\n```\r\nPostTxt = “&lt;div&gt;The &lt;b&gt;cat&lt;/b&gt; sat on the mat, what a catastrophe.\r\n The &lt;span&gt;cat&lt;/span&gt; is not allowed on the mat. This makes things complicated; the cat&amp;nbsp must go! \r\n&lt;/div&gt;&lt;p&gt;cat cat cat&lt;/p&gt;”; \r\n\r\n\tstring pattern = &quot;cat&quot;;\r\n\r\n\t//replacement string to use\r\n\tstring replacement = &quot;******&quot;;\r\n\r\n\t//Replace words\r\n\tPostTxt = Regex.Replace(PostTxt, pattern, replacement, RegexOptions.IgnoreCase);\r\n}\r\n```\r\nI would like it to return.\r\n\r\n```&lt;div&gt;The &lt;b&gt;***&lt;/b&gt; sat on the mat, what a catastrophe. The &lt;span&gt;***&lt;/span&gt; is not allowed on the mat. This makes things complicated; the ***&amp;nbsp must go! &lt;/div&gt;&lt;p&gt;*** *** ***&lt;/p&gt;```\r\n\r\nAny suggestions and help will be greatly appreciated.\r\n\r\n","link":"https://stackoverflow.com/questions/67906850/using-regex-replace-to-replace-words-in-html-string-without-affecting-html-tags","title":"Using regex.replace to replace words in html string without affecting html tags and parts of words","body":"<p>I would like to replace words in a html string with another word, but it must only replace the exact word and not if it is part of the spelling of part of a word. The problem that I am having is that the html open or closing tags or other html elements are affecting what words are matched in the regex or it is replacing parts of words.</p>\n<pre><code>PostTxt = “&lt;div&gt;The &lt;b&gt;cat&lt;/b&gt; sat on the mat, what a catastrophe.\n The &lt;span&gt;cat&lt;/span&gt; is not allowed on the mat. This makes things complicated; the cat&amp;nbsp must go! \n&lt;/div&gt;&lt;p&gt;cat cat cat&lt;/p&gt;”; \n\n string pattern = &quot;cat&quot;;\n\n //replacement string to use\n string replacement = &quot;******&quot;;\n\n //Replace words\n PostTxt = Regex.Replace(PostTxt, pattern, replacement, RegexOptions.IgnoreCase);\n}\n</code></pre>\n<p>I would like it to return.</p>\n<p><code>&lt;div&gt;The &lt;b&gt;***&lt;/b&gt; sat on the mat, what a catastrophe. The &lt;span&gt;***&lt;/span&gt; is not allowed on the mat. This makes things complicated; the ***&amp;nbsp must go! &lt;/div&gt;&lt;p&gt;*** *** ***&lt;/p&gt;</code></p>\n<p>Any suggestions and help will be greatly appreciated.</p>\n"},{"tags":["python","pygame"],"owner":{"reputation":1,"user_id":15963877,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJxIc502NFoQSWNOy5jJfL3qKmiIxqPRbDs5x5e1=k-s128","display_name":"Purple Purple","link":"https://stackoverflow.com/users/15963877/purple-purple"},"is_answered":false,"view_count":8,"answer_count":0,"score":0,"last_activity_date":1623259229,"creation_date":1623259229,"question_id":67908921,"share_link":"https://stackoverflow.com/q/67908921","body_markdown":"I was wondering how I could end the game or stop the game from running after the player sprite touches the other sprite or the variable platform12. The following is what I have done so far:\r\n\r\n``` \r\n platform12 = gameSprites.GameObject(pygame.Vector2(2600, 500), pygame.Vector2(150, 50), &quot;diamond_ore.png&quot;)\r\n\r\n self.platforms.add(self.ground, platform1, platform2, platform3, platform4, platform5, platform6, platform7, platform8, platform9, platform10, platform11, platform12)\r\n\r\n #PLAYER\r\n self.player = gameSprites.Player(pygame.Vector2(0, 450), pygame.Vector2(30, 40), pygame.Vector2(0, 0), &quot;steve.png&quot;)\r\n self.player_objects.add(self.player)","link":"https://stackoverflow.com/questions/67908921/how-to-end-the-game-once-it-has-touched-an-image-in-pygame","title":"How to end the game once it has touched an image in pygame","body":"<p>I was wondering how I could end the game or stop the game from running after the player sprite touches the other sprite or the variable platform12. The following is what I have done so far:</p>\n<pre><code> platform12 = gameSprites.GameObject(pygame.Vector2(2600, 500), pygame.Vector2(150, 50), &quot;diamond_ore.png&quot;)\n\n self.platforms.add(self.ground, platform1, platform2, platform3, platform4, platform5, platform6, platform7, platform8, platform9, platform10, platform11, platform12)\n\n #PLAYER\n self.player = gameSprites.Player(pygame.Vector2(0, 450), pygame.Vector2(30, 40), pygame.Vector2(0, 0), &quot;steve.png&quot;)\n self.player_objects.add(self.player)\n</code></pre>\n"},{"tags":["reactjs","svg"],"comments":[{"owner":{"reputation":46038,"user_id":1264804,"user_type":"registered","accept_rate":61,"profile_image":"https://i.stack.imgur.com/oYX71.png?s=128&g=1","display_name":"isherwood","link":"https://stackoverflow.com/users/1264804/isherwood"},"edited":false,"score":0,"creation_date":1623255994,"post_id":67908128,"comment_id":120029295,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":7110,"user_id":2520800,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/60edc4072807728bf0f69a8af73f716c?s=128&d=identicon&r=PG","display_name":"Danny &#39;365CSI&#39; Engelman","link":"https://stackoverflow.com/users/2520800/danny-365csi-engelman"},"is_accepted":false,"score":0,"last_activity_date":1623259228,"creation_date":1623259228,"answer_id":67908920,"question_id":67908128,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":179,"user_id":14838495,"user_type":"registered","profile_image":"https://graph.facebook.com/10160508779911982/picture?type=large","display_name":"Jon","link":"https://stackoverflow.com/users/14838495/jon"},"is_answered":false,"view_count":16,"answer_count":1,"score":0,"last_activity_date":1623259228,"creation_date":1623255899,"question_id":67908128,"share_link":"https://stackoverflow.com/q/67908128","body_markdown":"I am using a git repository to display a chessboard:\r\n\r\nhttps://github.com/shaack/cm-chessboard\r\n\r\nAn example of the displayed chessboard can be found here:\r\n\r\nhttps://shaack.com/projekte/cm-chessboard/\r\n\r\nMy goal is to display some text over a square of my choice, which would display over the piece if it is present. So I presume that involves some kind of z-index on the svg.\r\n\r\nI&#39;ve done inspect on the chessboard to see what the source code looks like, but I am at a loss for how to add a function that works like this:\r\n\r\n`function(coordinate,text)`, where coordinate could be something like c2.\r\n\r\nHow would you go about creating this function? \r\n\r\nI am at a loss of where to start. I&#39;ve been looking at the source code in the git file and commenting the code to get a better understanding. Ideally I would like a function that doesn&#39;t alter the git repository, because then if they do an update, my code won&#39;t break. Maybe I need to add a function that modifies the instance of the board object.\r\n\r\nAny help is greatly appreciated.","link":"https://stackoverflow.com/questions/67908128/placing-text-over-svg-image","title":"Placing text over svg image","body":"<p>I am using a git repository to display a chessboard:</p>\n<p><a href=\"https://github.com/shaack/cm-chessboard\" rel=\"nofollow noreferrer\">https://github.com/shaack/cm-chessboard</a></p>\n<p>An example of the displayed chessboard can be found here:</p>\n<p><a href=\"https://shaack.com/projekte/cm-chessboard/\" rel=\"nofollow noreferrer\">https://shaack.com/projekte/cm-chessboard/</a></p>\n<p>My goal is to display some text over a square of my choice, which would display over the piece if it is present. So I presume that involves some kind of z-index on the svg.</p>\n<p>I've done inspect on the chessboard to see what the source code looks like, but I am at a loss for how to add a function that works like this:</p>\n<p><code>function(coordinate,text)</code>, where coordinate could be something like c2.</p>\n<p>How would you go about creating this function?</p>\n<p>I am at a loss of where to start. I've been looking at the source code in the git file and commenting the code to get a better understanding. Ideally I would like a function that doesn't alter the git repository, because then if they do an update, my code won't break. Maybe I need to add a function that modifies the instance of the board object.</p>\n<p>Any help is greatly appreciated.</p>\n"},{"tags":["c"],"comments":[{"owner":{"reputation":97663,"user_id":189205,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/c60305494593d556e57a3cf8e4a8c163?s=128&d=identicon&r=PG","display_name":"interjay","link":"https://stackoverflow.com/users/189205/interjay"},"edited":false,"score":2,"creation_date":1623259036,"post_id":67908856,"comment_id":120030560,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":359,"user_id":5921662,"user_type":"registered","profile_image":"https://i.stack.imgur.com/tE9oj.jpg?s=128&g=1","display_name":"Sudipto","link":"https://stackoverflow.com/users/5921662/sudipto"},"edited":false,"score":1,"creation_date":1623259057,"post_id":67908856,"comment_id":120030568,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":108926,"user_id":364696,"user_type":"registered","profile_image":"https://i.stack.imgur.com/7eBCp.jpg?s=128&g=1","display_name":"ShadowRanger","link":"https://stackoverflow.com/users/364696/shadowranger"},"edited":false,"score":1,"creation_date":1623259060,"post_id":67908856,"comment_id":120030569,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":2133,"user_id":14215102,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/ab57304b45cb91a383bcca55e5a23d77?s=128&d=identicon&r=PG&f=1","display_name":"dratenik","link":"https://stackoverflow.com/users/14215102/dratenik"},"edited":false,"score":0,"creation_date":1623259142,"post_id":67908856,"comment_id":120030596,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":15387772,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gi-5nN1YGyxyaKYJqKwvLHjIZNmsqUO5ApR2LjTnA=k-s128","display_name":"CodeBeginner","link":"https://stackoverflow.com/users/15387772/codebeginner"},"edited":false,"score":0,"creation_date":1623259160,"post_id":67908856,"comment_id":120030608,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":108926,"user_id":364696,"user_type":"registered","profile_image":"https://i.stack.imgur.com/7eBCp.jpg?s=128&g=1","display_name":"ShadowRanger","link":"https://stackoverflow.com/users/364696/shadowranger"},"edited":false,"score":2,"creation_date":1623259247,"post_id":67908856,"comment_id":120030642,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":598476,"user_id":1491895,"user_type":"registered","accept_rate":69,"profile_image":"https://www.gravatar.com/avatar/82f9e178a16364bf561d0ed4da09a35d?s=128&d=identicon&r=PG","display_name":"Barmar","link":"https://stackoverflow.com/users/1491895/barmar"},"edited":false,"score":1,"creation_date":1623259252,"post_id":67908856,"comment_id":120030645,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":49503,"user_id":13422,"user_type":"registered","accept_rate":50,"profile_image":"https://www.gravatar.com/avatar/94b309d78a1253a334e9b82643a8dc97?s=128&d=identicon&r=PG","display_name":"Zan Lynx","link":"https://stackoverflow.com/users/13422/zan-lynx"},"edited":false,"score":0,"creation_date":1623259407,"post_id":67908856,"comment_id":120030707,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":2879,"user_id":9829403,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/-RvgmsYSS48c/AAAAAAAAAAI/AAAAAAAAAAw/pUPnPAhmDec/photo.jpg?sz=128","display_name":"Tim Randall","link":"https://stackoverflow.com/users/9829403/tim-randall"},"is_accepted":false,"score":1,"last_activity_date":1623259213,"creation_date":1623259213,"answer_id":67908915,"question_id":67908856,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":15387772,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gi-5nN1YGyxyaKYJqKwvLHjIZNmsqUO5ApR2LjTnA=k-s128","display_name":"CodeBeginner","link":"https://stackoverflow.com/users/15387772/codebeginner"},"is_answered":true,"view_count":27,"closed_date":1623259223,"answer_count":1,"score":0,"last_activity_date":1623259226,"creation_date":1623258902,"last_edit_date":1623259226,"question_id":67908856,"share_link":"https://stackoverflow.com/q/67908856","body_markdown":"Why does C doesn&#39;t accept 08 and 09 as an integer? Are there ways that I could still validate the 08 and 09 as an integer?\r\n\r\n```\r\nint main(){\r\nint a;\r\nscanf(&quot;%i&quot;, &amp;a);\r\n\r\nif (a== 8 || a==08){\r\n printf(&quot;Octagon&quot;);\r\n}\r\nelse if (a== 9 || a==09){\r\n printf(&quot;Nonagon&quot;);\r\n}\r\n\r\nreturn 0;\r\n}","link":"https://stackoverflow.com/questions/67908856/invalid-integer-in-c","closed_reason":"Duplicate","title":"Invalid integer in C","body":"<p>Why does C doesn't accept 08 and 09 as an integer? Are there ways that I could still validate the 08 and 09 as an integer?</p>\n<pre><code>int main(){\nint a;\nscanf(&quot;%i&quot;, &amp;a);\n\nif (a== 8 || a==08){\n printf(&quot;Octagon&quot;);\n}\nelse if (a== 9 || a==09){\n printf(&quot;Nonagon&quot;);\n}\n\nreturn 0;\n}\n</code></pre>\n"},{"tags":["python","regex","pandas"],"answers":[{"owner":{"reputation":970,"user_id":2271478,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/1e6d2741f690d245b2786ac0f6e8dde8?s=128&d=identicon&r=PG","display_name":"xyzjayne","link":"https://stackoverflow.com/users/2271478/xyzjayne"},"is_accepted":false,"score":0,"last_activity_date":1623259017,"creation_date":1623259017,"answer_id":67908876,"question_id":67908812,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":486914,"user_id":3832970,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/64323e6cf08401474da3bf770ea13b58?s=128&d=identicon&r=PG&f=1","display_name":"Wiktor Stribiżew","link":"https://stackoverflow.com/users/3832970/wiktor-stribi%c5%bcew"},"is_accepted":false,"score":0,"last_activity_date":1623259225,"creation_date":1623259225,"answer_id":67908919,"question_id":67908812,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16177905,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyWv8uOc571fGG9CVREGPBIHMYemsc9IdqhsfI=k-s128","display_name":"MountainFish","link":"https://stackoverflow.com/users/16177905/mountainfish"},"is_answered":false,"view_count":17,"answer_count":2,"score":0,"last_activity_date":1623259225,"creation_date":1623258727,"last_edit_date":1623258888,"question_id":67908812,"share_link":"https://stackoverflow.com/q/67908812","body_markdown":"The following string is a typical example of the format of strings that I need to convert to a PD DataFrame. My attempted work flow is to:\r\n\r\n1. Split String into List (see string below, note this represents an individual row)\r\n2. Convert each list to a dictionary\r\n3. Convert dictionary to a PD DataFrame\r\n4. Merge DataFrames together\r\n\r\n**String:** (Representing one row of Data)\r\n```\r\n&quot;PN_#&quot;:9999,&quot;Item&quot;:&quot;Pear, Large&quot;,&quot;Vendor&quot;:[&quot;Farm&quot;],&quot;Class&quot;:[&quot;Food&quot;,&quot;Fruit&quot;],&quot;Sales Group&quot;:&quot;59&quot;,&quot;Vendor ID (from Vendor)&quot;:[78]\r\n```\r\n**Desired Output:**\r\n```\r\n{&#39;PN_#&#39;:9999,\r\n&#39;Item&#39;:&quot;Pear, Large&quot;,\r\n&#39;Vendor&#39;:&quot;Farm&quot;,\r\n&#39;Class&#39;:&quot;Food,Fruit&quot;,\r\n&#39;Sales Group&#39;:59,\r\n&#39;```\r\nVendor ID (from Vendor)&#39;:78}\r\n```\r\n\r\n**Attempt:**\r\nI have been using re.split to attempt this. For most cases this is not an issue, however the items such as *&quot;Class&quot;:[&quot;Food&quot;,&quot;Fruit&quot;]* and `&quot;Item&quot;:&quot;Pear, Large&quot;` are proving to be challenging to account for.\r\n\r\nThis regex solves the issues of the later case, however it obviously does not work for the former:\r\n\r\n```\r\nre.split(&quot;(?=[\\S]),(?=[\\S])&quot;,data)\r\n```\r\n\r\nI have tried a multitude of expressions to completely satisfy my requirements. The following expression is generally representative of what I have attempted unsuccessfully:\r\n\r\n```\r\nregex.split(&quot;(?!\\[.+?\\s),(?=[\\S])(?!.+?\\])&quot;, data)\r\n```\r\n\r\nAny suggestion or solutions for how to accomplish this, or suggestion if I am going about this the wrong way?\r\n\r\nRegards\r\n\r\n\r\n","link":"https://stackoverflow.com/questions/67908812/regex-match-for-variable-string-issue-regarding-look-ahead-and-quantifiers","title":"Regex Match for Variable String - Issue Regarding Look Ahead and Quantifiers","body":"<p>The following string is a typical example of the format of strings that I need to convert to a PD DataFrame. My attempted work flow is to:</p>\n<ol>\n<li>Split String into List (see string below, note this represents an individual row)</li>\n<li>Convert each list to a dictionary</li>\n<li>Convert dictionary to a PD DataFrame</li>\n<li>Merge DataFrames together</li>\n</ol>\n<p><strong>String:</strong> (Representing one row of Data)</p>\n<pre><code>&quot;PN_#&quot;:9999,&quot;Item&quot;:&quot;Pear, Large&quot;,&quot;Vendor&quot;:[&quot;Farm&quot;],&quot;Class&quot;:[&quot;Food&quot;,&quot;Fruit&quot;],&quot;Sales Group&quot;:&quot;59&quot;,&quot;Vendor ID (from Vendor)&quot;:[78]\n</code></pre>\n<p><strong>Desired Output:</strong></p>\n<pre><code>{'PN_#':9999,\n'Item':&quot;Pear, Large&quot;,\n'Vendor':&quot;Farm&quot;,\n'Class':&quot;Food,Fruit&quot;,\n'Sales Group':59,\n'```\nVendor ID (from Vendor)':78}\n</code></pre>\n<p><strong>Attempt:</strong>\nI have been using re.split to attempt this. For most cases this is not an issue, however the items such as <em>&quot;Class&quot;:[&quot;Food&quot;,&quot;Fruit&quot;]</em> and <code>&quot;Item&quot;:&quot;Pear, Large&quot;</code> are proving to be challenging to account for.</p>\n<p>This regex solves the issues of the later case, however it obviously does not work for the former:</p>\n<pre><code>re.split(&quot;(?=[\\S]),(?=[\\S])&quot;,data)\n</code></pre>\n<p>I have tried a multitude of expressions to completely satisfy my requirements. The following expression is generally representative of what I have attempted unsuccessfully:</p>\n<pre><code>regex.split(&quot;(?!\\[.+?\\s),(?=[\\S])(?!.+?\\])&quot;, data)\n</code></pre>\n<p>Any suggestion or solutions for how to accomplish this, or suggestion if I am going about this the wrong way?</p>\n<p>Regards</p>\n"},{"tags":["microsoft-graph-api","sharepoint-online"],"owner":{"reputation":115,"user_id":8706053,"user_type":"registered","profile_image":"https://i.stack.imgur.com/nCWrM.jpg?s=128&g=1","display_name":"Dave Guenther","link":"https://stackoverflow.com/users/8706053/dave-guenther"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259224,"creation_date":1623259224,"question_id":67908918,"share_link":"https://stackoverflow.com/q/67908918","body_markdown":"After watching the Microsoft video on [this page][1], I decided that I should start testing for server-side pagination by looking for @odata.nextLink fields in all my Graph API (v1.0) query responses, particularly on SharePoint resources. [In the video at about 1:38s][2], one of the presenters says that the nextLink is &quot;typically&quot; placed next to the collection in the response. So far, this is what I have encountered when I analyze the json response of the queries: the collection field is placed immediately after the @odata.nextLink field in the json object. However, I am a little concerned about the presenters choice of words (&quot;typically&quot;). &lt;b&gt;Can I expect this to always be the case though with Graph API?&lt;/b&gt;\r\n\r\nI would like to know if I can build my query algorithm such that whenever I encounter a nextLink, I look to the next field to be the collection that I&#39;ll perform concatenation on when visiting the nextLink fields, or if there are cases that will break the algorithm.\r\n\r\nThank you.\r\n\r\n\r\n [1]: https://docs.microsoft.com/en-us/graph/paging\r\n [2]: https://youtu.be/DB_NoC9a1JI?t=98","link":"https://stackoverflow.com/questions/67908918/can-i-expect-when-handling-pagination-in-ms-graph-that-a-nextlink-will-always","title":"Can I expect when handling pagination in MS Graph, that a &#39;nextLink&#39; will always be directly before the collection in a json object response?","body":"<p>After watching the Microsoft video on <a href=\"https://docs.microsoft.com/en-us/graph/paging\" rel=\"nofollow noreferrer\">this page</a>, I decided that I should start testing for server-side pagination by looking for @odata.nextLink fields in all my Graph API (v1.0) query responses, particularly on SharePoint resources. <a href=\"https://youtu.be/DB_NoC9a1JI?t=98\" rel=\"nofollow noreferrer\">In the video at about 1:38s</a>, one of the presenters says that the nextLink is &quot;typically&quot; placed next to the collection in the response. So far, this is what I have encountered when I analyze the json response of the queries: the collection field is placed immediately after the @odata.nextLink field in the json object. However, I am a little concerned about the presenters choice of words (&quot;typically&quot;). <b>Can I expect this to always be the case though with Graph API?</b></p>\n<p>I would like to know if I can build my query algorithm such that whenever I encounter a nextLink, I look to the next field to be the collection that I'll perform concatenation on when visiting the nextLink fields, or if there are cases that will break the algorithm.</p>\n<p>Thank you.</p>\n"},{"tags":["python"],"comments":[{"owner":{"reputation":98575,"user_id":2296458,"user_type":"registered","accept_rate":90,"profile_image":"https://i.stack.imgur.com/wbG2s.png?s=128&g=1","display_name":"Cory Kramer","link":"https://stackoverflow.com/users/2296458/cory-kramer"},"edited":false,"score":3,"creation_date":1623249071,"post_id":67906180,"comment_id":120026022,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":3,"user_id":16176693,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyqKSiBG8oTXM3MUAUA1Wzcrt6hB2zaUXMy1tle=k-s128","display_name":"Mike Little","link":"https://stackoverflow.com/users/16176693/mike-little"},"reply_to_user":{"reputation":98575,"user_id":2296458,"user_type":"registered","accept_rate":90,"profile_image":"https://i.stack.imgur.com/wbG2s.png?s=128&g=1","display_name":"Cory Kramer","link":"https://stackoverflow.com/users/2296458/cory-kramer"},"edited":false,"score":0,"creation_date":1623256535,"post_id":67906180,"comment_id":120029555,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":98575,"user_id":2296458,"user_type":"registered","accept_rate":90,"profile_image":"https://i.stack.imgur.com/wbG2s.png?s=128&g=1","display_name":"Cory Kramer","link":"https://stackoverflow.com/users/2296458/cory-kramer"},"is_accepted":true,"score":3,"last_activity_date":1623249469,"last_edit_date":1623249469,"creation_date":1623249001,"answer_id":67906239,"question_id":67906180,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":55,"user_id":16131339,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GjMn92qyd_7sDPFAMqkgAHEvRlcsk9trV6xYqmm=k-s128","display_name":"Danish Khan","link":"https://stackoverflow.com/users/16131339/danish-khan"},"is_accepted":false,"score":-2,"last_activity_date":1623259224,"last_edit_date":1623259224,"creation_date":1623249251,"answer_id":67906310,"question_id":67906180,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":24,"user_id":13748961,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/7ef91c6837324a72ac72953e6ce23c4b?s=128&d=identicon&r=PG&f=1","display_name":"Mayank","link":"https://stackoverflow.com/users/13748961/mayank"},"is_accepted":false,"score":-1,"last_activity_date":1623249417,"creation_date":1623249417,"answer_id":67906354,"question_id":67906180,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":3,"user_id":16176693,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyqKSiBG8oTXM3MUAUA1Wzcrt6hB2zaUXMy1tle=k-s128","display_name":"Mike Little","link":"https://stackoverflow.com/users/16176693/mike-little"},"is_answered":true,"view_count":44,"accepted_answer_id":67906239,"answer_count":3,"score":0,"last_activity_date":1623259224,"creation_date":1623248828,"last_edit_date":1623248935,"question_id":67906180,"share_link":"https://stackoverflow.com/q/67906180","body_markdown":"How can I convert a date into a numeric date?\r\n\r\nFor example, I want to convert `&#39;06-Jun-2021&#39;` to `&#39;20210609&#39;` and then turn it into a string i can use in a webpage eg. `baseball.theater/games/20210609` so that i can automate the process daily.\r\n\r\nusing datetime i&#39;ve managed to do :\r\n\r\n print (todays_date.year,todays_date.month,todays_date.day,sep=&quot;&quot;)\r\n\r\nwhich can print the output i need (without the trailing 0&#39;s) but i cannot make this into a string which i can use.\r\n\r\nobviously i am a COMPLETE newcomer to python, so be gentle please.","link":"https://stackoverflow.com/questions/67906180/convert-a-date-into-numeric-string","title":"convert a date into numeric string","body":"<p>How can I convert a date into a numeric date?</p>\n<p>For example, I want to convert <code>'06-Jun-2021'</code> to <code>'20210609'</code> and then turn it into a string i can use in a webpage eg. <code>baseball.theater/games/20210609</code> so that i can automate the process daily.</p>\n<p>using datetime i've managed to do :</p>\n<pre><code>print (todays_date.year,todays_date.month,todays_date.day,sep=&quot;&quot;)\n</code></pre>\n<p>which can print the output i need (without the trailing 0's) but i cannot make this into a string which i can use.</p>\n<p>obviously i am a COMPLETE newcomer to python, so be gentle please.</p>\n"},{"tags":["mqtt","mosquitto"],"comments":[{"owner":{"reputation":41290,"user_id":504554,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/006ffde9ed3fac6396222405fc5e9bf0?s=128&d=identicon&r=PG","display_name":"hardillb","link":"https://stackoverflow.com/users/504554/hardillb"},"edited":false,"score":1,"creation_date":1623181382,"post_id":67891825,"comment_id":120004496,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":41290,"user_id":504554,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/006ffde9ed3fac6396222405fc5e9bf0?s=128&d=identicon&r=PG","display_name":"hardillb","link":"https://stackoverflow.com/users/504554/hardillb"},"edited":false,"score":1,"creation_date":1623181481,"post_id":67891825,"comment_id":120004531,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16009708,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/039a40b7aaea93d5a3da1a23e0402eee?s=128&d=identicon&r=PG&f=1","display_name":"KevinAle21","link":"https://stackoverflow.com/users/16009708/kevinale21"},"reply_to_user":{"reputation":41290,"user_id":504554,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/006ffde9ed3fac6396222405fc5e9bf0?s=128&d=identicon&r=PG","display_name":"hardillb","link":"https://stackoverflow.com/users/504554/hardillb"},"edited":false,"score":0,"creation_date":1623254775,"post_id":67891825,"comment_id":120028757,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":1,"user_id":16009708,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/039a40b7aaea93d5a3da1a23e0402eee?s=128&d=identicon&r=PG&f=1","display_name":"KevinAle21","link":"https://stackoverflow.com/users/16009708/kevinale21"},"reply_to_user":{"reputation":41290,"user_id":504554,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/006ffde9ed3fac6396222405fc5e9bf0?s=128&d=identicon&r=PG","display_name":"hardillb","link":"https://stackoverflow.com/users/504554/hardillb"},"edited":false,"score":0,"creation_date":1623255196,"post_id":67891825,"comment_id":120028935,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":41290,"user_id":504554,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/006ffde9ed3fac6396222405fc5e9bf0?s=128&d=identicon&r=PG","display_name":"hardillb","link":"https://stackoverflow.com/users/504554/hardillb"},"edited":false,"score":0,"creation_date":1623258142,"post_id":67891825,"comment_id":120030235,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16009708,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/039a40b7aaea93d5a3da1a23e0402eee?s=128&d=identicon&r=PG&f=1","display_name":"KevinAle21","link":"https://stackoverflow.com/users/16009708/kevinale21"},"is_answered":false,"view_count":21,"answer_count":0,"score":0,"last_activity_date":1623259219,"creation_date":1623173164,"last_edit_date":1623259219,"question_id":67891825,"share_link":"https://stackoverflow.com/q/67891825","body_markdown":"I am struggling with a weird issue on my Mosquitto Broker that occurs after I enable logging using the configuration below.\r\nI&#39;m using MQTT explorer to monitor my broker; after changing the configuration I started experiencing problems, monitor constantly said this: \r\n\r\n![enter image description here][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/KTaVI.png\r\n\r\n\r\nIf I delete the line `log_dest file C:\\Archivos de programa\\mosquitto\\mosquitto.log` it seems to be fixed. \r\n\r\nI was adding the `log_dest` because I can not find the log file, please help me locate it.\r\n\r\nConfiguration File:\r\n```\r\n# Note that if the broker is running as a Windows service it will default to\r\n# &quot;log_dest none&quot; and neither stdout nor stderr logging is available.\r\n# Use &quot;log_dest none&quot; if you wish to disable logging.\r\n#log_dest none \r\nlog_dest topic \r\nlog_dest syslog \r\nlog_dest file C:\\Archivos de programa\\mosquitto\\mosquitto.log \r\n```\r\n\r\n","link":"https://stackoverflow.com/questions/67891825/mosquitto-configuration-log-issues","title":"Mosquitto configuration log issues","body":"<p>I am struggling with a weird issue on my Mosquitto Broker that occurs after I enable logging using the configuration below.\nI'm using MQTT explorer to monitor my broker; after changing the configuration I started experiencing problems, monitor constantly said this:</p>\n<p><img src=\"https://i.stack.imgur.com/KTaVI.png\" alt=\"enter image description here\" /></p>\n<p>If I delete the line <code>log_dest file C:\\Archivos de programa\\mosquitto\\mosquitto.log</code> it seems to be fixed.</p>\n<p>I was adding the <code>log_dest</code> because I can not find the log file, please help me locate it.</p>\n<p>Configuration File:</p>\n<pre><code># Note that if the broker is running as a Windows service it will default to\n# &quot;log_dest none&quot; and neither stdout nor stderr logging is available.\n# Use &quot;log_dest none&quot; if you wish to disable logging.\n#log_dest none \nlog_dest topic \nlog_dest syslog \nlog_dest file C:\\Archivos de programa\\mosquitto\\mosquitto.log \n</code></pre>\n"},{"tags":["autodesk-forge","autodesk-viewer"],"owner":{"reputation":1,"user_id":5257876,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/22d0eba133c308f160f7d3dbf908840d?s=128&d=identicon&r=PG","display_name":"M.A.T","link":"https://stackoverflow.com/users/5257876/m-a-t"},"is_answered":false,"view_count":3,"answer_count":0,"score":0,"last_activity_date":1623259218,"creation_date":1623259218,"question_id":67908916,"share_link":"https://stackoverflow.com/q/67908916","body_markdown":"Is there any way to disable the Thumbnails tab of `Autodesk.DocumentBrowser` extension?","link":"https://stackoverflow.com/questions/67908916/disabling-thumbnails-tab-of-document-browser-in-autodesk-forge","title":"Disabling Thumbnails tab of Document Browser in Autodesk Forge","body":"<p>Is there any way to disable the Thumbnails tab of <code>Autodesk.DocumentBrowser</code> extension?</p>\n"},{"tags":["java","oop","copy-constructor","deep-copy"],"answers":[{"owner":{"reputation":6678,"user_id":464306,"user_type":"registered","accept_rate":92,"profile_image":"https://i.stack.imgur.com/W8KCe.png?s=128&g=1","display_name":"gdejohn","link":"https://stackoverflow.com/users/464306/gdejohn"},"is_accepted":false,"score":2,"last_activity_date":1623259210,"last_edit_date":1623259210,"creation_date":1623258227,"answer_id":67908691,"question_id":67908455,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":25,"user_id":14979447,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/34c21cf9285487947fa462425695309d?s=128&d=identicon&r=PG&f=1","display_name":"eeelll","link":"https://stackoverflow.com/users/14979447/eeelll"},"is_answered":true,"view_count":23,"answer_count":1,"score":1,"last_activity_date":1623259210,"creation_date":1623257191,"question_id":67908455,"share_link":"https://stackoverflow.com/q/67908455","body_markdown":"I am working in Java and I want to make a deep copy of a MoleculeDTO object. I tried to make a copy constructor too, but it is not working and it is refering to the initial object.\r\n\r\n```\r\npublic class MoleculeDTO {\r\n private int ID;\r\n private String name;\r\n private List&lt;AtomDTO&gt; atoms = new ArrayList&lt;&gt;();\r\n private int nrAtoms =0;\r\n\r\n public MoleculeDTO(String name, List&lt;AtomDTO&gt; atoms, int nrAtoms) {\r\n this.name = name;\r\n this.atoms = atoms;\r\n this.nrAtoms = nrAtoms;\r\n }\r\n\r\n public MoleculeDTO(MoleculeDTO molecule) {\r\n this(molecule.getName(), molecule.getAtoms(), molecule.getNrAtoms());\r\n }\r\n...getter, setter\r\n}\r\n```\r\n\r\nHere is class AtomDTO.\r\n\r\n```\r\npublic class AtomDTO{\r\n private int ID;\r\n private String name;\r\n private String symbol;\r\n private int nrOfBonds;\r\n private List&lt;BondDTO&gt; bonds = new ArrayList&lt;&gt;();\r\n private int type;\r\n private AnchorNode anchorNode;\r\n\r\n\r\n public AtomDTO(String name, String symbol, int nrOfBonds, List&lt;BondDTO&gt; bonds, int type) {\r\n this.name = name;\r\n this.nrOfBonds = nrOfBonds;\r\n this.bonds = bonds;\r\n this.type = type;\r\n }\r\n\r\n public AtomDTO(AtomDTO copyAtom) {\r\n this(copyAtom.getName(),copyAtom.getSymbol(), copyAtom.getNrOfBonds(), copyAtom.getBonds(), copyAtom.getType());\r\n }\r\n...getter, setter\r\n}\r\n```\r\nHere is class BondDTO.\r\n\r\n```\r\npublic class BondDTO {\r\n private int ID;\r\n private int otherAtomID;\r\n private int otherAtomType;\r\n private int bondType;\r\n\r\n public BondDTO(int otherAtomID, int otherAtomType, int bondType) {\r\n this.otherAtomID = otherAtomID;\r\n this.otherAtomType = otherAtomType;\r\n this.bondType = bondType;\r\n }\r\n\r\n public BondDTO(BondDTO copyBond) {\r\n this(copyBond.getOtherAtomID(), copyBond.otherAtomType, copyBond.bondType);\r\n }\r\n...getter, setter\r\n}\r\n```","link":"https://stackoverflow.com/questions/67908455/how-to-make-a-deep-copy-of-an-object-with-a-list-variable-in-java","title":"How to make a deep copy of an object with a List variable in Java?","body":"<p>I am working in Java and I want to make a deep copy of a MoleculeDTO object. I tried to make a copy constructor too, but it is not working and it is refering to the initial object.</p>\n<pre><code>public class MoleculeDTO {\n private int ID;\n private String name;\n private List&lt;AtomDTO&gt; atoms = new ArrayList&lt;&gt;();\n private int nrAtoms =0;\n\n public MoleculeDTO(String name, List&lt;AtomDTO&gt; atoms, int nrAtoms) {\n this.name = name;\n this.atoms = atoms;\n this.nrAtoms = nrAtoms;\n }\n\n public MoleculeDTO(MoleculeDTO molecule) {\n this(molecule.getName(), molecule.getAtoms(), molecule.getNrAtoms());\n }\n...getter, setter\n}\n</code></pre>\n<p>Here is class AtomDTO.</p>\n<pre><code>public class AtomDTO{\n private int ID;\n private String name;\n private String symbol;\n private int nrOfBonds;\n private List&lt;BondDTO&gt; bonds = new ArrayList&lt;&gt;();\n private int type;\n private AnchorNode anchorNode;\n\n\n public AtomDTO(String name, String symbol, int nrOfBonds, List&lt;BondDTO&gt; bonds, int type) {\n this.name = name;\n this.nrOfBonds = nrOfBonds;\n this.bonds = bonds;\n this.type = type;\n }\n\n public AtomDTO(AtomDTO copyAtom) {\n this(copyAtom.getName(),copyAtom.getSymbol(), copyAtom.getNrOfBonds(), copyAtom.getBonds(), copyAtom.getType());\n }\n...getter, setter\n}\n</code></pre>\n<p>Here is class BondDTO.</p>\n<pre><code>public class BondDTO {\n private int ID;\n private int otherAtomID;\n private int otherAtomType;\n private int bondType;\n\n public BondDTO(int otherAtomID, int otherAtomType, int bondType) {\n this.otherAtomID = otherAtomID;\n this.otherAtomType = otherAtomType;\n this.bondType = bondType;\n }\n\n public BondDTO(BondDTO copyBond) {\n this(copyBond.getOtherAtomID(), copyBond.otherAtomType, copyBond.bondType);\n }\n...getter, setter\n}\n</code></pre>\n"},{"tags":["java","split","awt"],"comments":[{"owner":{"reputation":46721,"user_id":3890632,"user_type":"registered","profile_image":"https://i.stack.imgur.com/hNkgF.png?s=128&g=1","display_name":"khelwood","link":"https://stackoverflow.com/users/3890632/khelwood"},"edited":false,"score":1,"creation_date":1623257048,"post_id":67908388,"comment_id":120029792,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":676524,"user_id":335858,"user_type":"registered","accept_rate":81,"profile_image":"https://www.gravatar.com/avatar/4af3541c00d591e9a518b9c0b3b1190a?s=128&d=identicon&r=PG","display_name":"Sergey Kalinichenko","link":"https://stackoverflow.com/users/335858/sergey-kalinichenko"},"edited":false,"score":0,"creation_date":1623257359,"post_id":67908388,"comment_id":120029916,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":609,"user_id":12764490,"user_type":"registered","profile_image":"https://i.stack.imgur.com/nATZu.jpg?s=128&g=1","display_name":"Tim Hunter","link":"https://stackoverflow.com/users/12764490/tim-hunter"},"edited":false,"score":0,"creation_date":1623257780,"post_id":67908388,"comment_id":120030109,"content_license":"CC BY-SA 4.0"},{"owner":{"reputation":11,"user_id":14603352,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-DDu8Hn64Gf0/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuck79kly9Wf0I6tmJuo2ncRJdrglnA/s96-c/photo.jpg?sz=128","display_name":"Aishwarya Roy","link":"https://stackoverflow.com/users/14603352/aishwarya-roy"},"reply_to_user":{"reputation":609,"user_id":12764490,"user_type":"registered","profile_image":"https://i.stack.imgur.com/nATZu.jpg?s=128&g=1","display_name":"Tim Hunter","link":"https://stackoverflow.com/users/12764490/tim-hunter"},"edited":false,"score":0,"creation_date":1623258619,"post_id":67908388,"comment_id":120030402,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":609,"user_id":12764490,"user_type":"registered","profile_image":"https://i.stack.imgur.com/nATZu.jpg?s=128&g=1","display_name":"Tim Hunter","link":"https://stackoverflow.com/users/12764490/tim-hunter"},"is_accepted":false,"score":0,"last_activity_date":1623259209,"creation_date":1623259209,"answer_id":67908914,"question_id":67908388,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":11,"user_id":14603352,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-DDu8Hn64Gf0/AAAAAAAAAAI/AAAAAAAAAAA/AMZuuck79kly9Wf0I6tmJuo2ncRJdrglnA/s96-c/photo.jpg?sz=128","display_name":"Aishwarya Roy","link":"https://stackoverflow.com/users/14603352/aishwarya-roy"},"is_answered":false,"view_count":13,"answer_count":1,"score":0,"last_activity_date":1623259209,"creation_date":1623256908,"last_edit_date":1623258857,"question_id":67908388,"share_link":"https://stackoverflow.com/q/67908388","body_markdown":"Whenever I write \\\\\\S (caps S) , then I get output 13, \r\nCan anyone tell me how this count 13, I mean why it just remove the last word?\r\n\r\n \r\n\r\n public void actionPerformed(ActionEvent e){\r\n String Text = area.getText();\r\n String words[]=Text.split(&quot;\\\\S&quot;);\r\n l1.setText(&quot;Words : &quot;+words.length);\r\n l2.setText(&quot;Character : &quot;+Text.length());\r\n }\r\n\r\n\r\nI use ActionListener for a AWT program,\r\n\r\nThis code has the counting for words and characters, \r\nBut I just want to know why it shows 13 words, I mean, \\\\\\\\S split the words, but why it do not count the last word, and just count the all character without the last word?","link":"https://stackoverflow.com/questions/67908388/counting-mechanism-of-capital-s-in-split-function-in-java","title":"Counting mechanism of Capital S in split function in Java","body":"<p>Whenever I write \\\\S (caps S) , then I get output 13,\nCan anyone tell me how this count 13, I mean why it just remove the last word?</p>\n<pre><code>public void actionPerformed(ActionEvent e){\n String Text = area.getText();\n String words[]=Text.split(&quot;\\\\S&quot;);\n l1.setText(&quot;Words : &quot;+words.length);\n l2.setText(&quot;Character : &quot;+Text.length());\n}\n</code></pre>\n<p>I use ActionListener for a AWT program,</p>\n<p>This code has the counting for words and characters,\nBut I just want to know why it shows 13 words, I mean, \\\\S split the words, but why it do not count the last word, and just count the all character without the last word?</p>\n"},{"tags":["docker","dockerfile"],"owner":{"reputation":1,"user_id":16178284,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/94db5172a27f96bc548a4ed14928c84f?s=128&d=identicon&r=PG&f=1","display_name":"usamawaqar","link":"https://stackoverflow.com/users/16178284/usamawaqar"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259204,"creation_date":1623259204,"question_id":67908912,"share_link":"https://stackoverflow.com/q/67908912","body_markdown":"Whenever i try to build a simple container of c++ hello world file through remote container following error show up which is in the link below.\r\n[1]: https://i.stack.imgur.com/8wzXJ.png\r\n\r\nIt does not allow to build a simple c++ hello world file as a container. I am ubuntu 20.04.2.0 and vscode as a development tool.\r\nThanks for your help.\r\n\r\n\r\n","link":"https://stackoverflow.com/questions/67908912/remote-container-failed-to-build","title":"Remote Container failed to build","body":"<p>Whenever i try to build a simple container of c++ hello world file through remote container following error show up which is in the link below.\n[1]: <a href=\"https://i.stack.imgur.com/8wzXJ.png\" rel=\"nofollow noreferrer\">https://i.stack.imgur.com/8wzXJ.png</a></p>\n<p>It does not allow to build a simple c++ hello world file as a container. I am ubuntu 20.04.2.0 and vscode as a development tool.\nThanks for your help.</p>\n"},{"tags":["java","anylogic"],"answers":[{"owner":{"reputation":581,"user_id":13755144,"user_type":"registered","profile_image":"https://i.stack.imgur.com/Zcx5k.jpg?s=128&g=1","display_name":"Emile Zankoul","link":"https://stackoverflow.com/users/13755144/emile-zankoul"},"is_accepted":false,"score":0,"last_activity_date":1623241340,"creation_date":1623241340,"answer_id":67904057,"question_id":67903692,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16175331,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00ee132e91d16dfd59f62038bb190039?s=128&d=identicon&r=PG&f=1","display_name":"Msterup","link":"https://stackoverflow.com/users/16175331/msterup"},"is_answered":false,"view_count":22,"answer_count":1,"score":0,"last_activity_date":1623259202,"creation_date":1623239874,"last_edit_date":1623259202,"question_id":67903692,"share_link":"https://stackoverflow.com/q/67903692","body_markdown":"I am working on an model where a plane must move to a gate.\r\nThe plane has its destination gate set as its parameter.\r\n\r\nWhen I try to programmatically assign the gate to the `moveTo`&#39;s `self.DEST_NODE`, I get what I think is a type error. \r\n\r\nI&#39;m quite new to Java, and think the problem might be in the code.\r\n\r\nAdditional information: when I add no program but simply fill the node field with `p_Gate1` then the program works.\r\n\r\nI am very interested in converting the `PointNode` type to a `moveTo.Destination` type or something similar.\r\n\r\nPs. Thanks to Benjamin Schumann, I can now select between two options, but I would like all five gates enabled. (`agent.gate==1 ? p_Gate1 : p_Gate2`)\r\n\r\nPlease see attached screenshot. Thanks in advance.\r\n\r\n![Screenshot with errors][1]\r\n\r\n\r\n [1]: https://i.stack.imgur.com/nGoFw.png","link":"https://stackoverflow.com/questions/67903692/programatically-selection-destination-nodes-for-moveto-block","title":"Programatically selection destination nodes for moveTo block","body":"<p>I am working on an model where a plane must move to a gate.\nThe plane has its destination gate set as its parameter.</p>\n<p>When I try to programmatically assign the gate to the <code>moveTo</code>'s <code>self.DEST_NODE</code>, I get what I think is a type error.</p>\n<p>I'm quite new to Java, and think the problem might be in the code.</p>\n<p>Additional information: when I add no program but simply fill the node field with <code>p_Gate1</code> then the program works.</p>\n<p>I am very interested in converting the <code>PointNode</code> type to a <code>moveTo.Destination</code> type or something similar.</p>\n<p>Ps. Thanks to Benjamin Schumann, I can now select between two options, but I would like all five gates enabled. (<code>agent.gate==1 ? p_Gate1 : p_Gate2</code>)</p>\n<p>Please see attached screenshot. Thanks in advance.</p>\n<p><img src=\"https://i.stack.imgur.com/nGoFw.png\" alt=\"Screenshot with errors\" /></p>\n"},{"tags":["google-cloud-platform","mqtt","esp32","google-cloud-iot","root-certificate"],"owner":{"reputation":1,"user_id":14903154,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/b8f6f3e6107e38a53fa73a6150eb425f?s=128&d=identicon&r=PG&f=1","display_name":"Aaryaa Padhyegurjar","link":"https://stackoverflow.com/users/14903154/aaryaa-padhyegurjar"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259202,"creation_date":1623259202,"question_id":67908911,"share_link":"https://stackoverflow.com/q/67908911","body_markdown":"I&#39;m trying to connect ESP32 to Google Cloud IoT Core using the **google-cloud-iot-arduino** and the **arduino-mqtt (lwmqtt)** libraries. \r\n\r\n1. I followed all necessary steps as given in this blog: [https://www.survivingwithandroid.com/cloud-iot-core-esp32/?unapproved=16731&amp;moderation-hash=eeb8406949900a6f926ac15fdb54c7b6#comment-16731] --My code is the same as given here, just the WiFi SSID and other details are different.\r\nI also referred to these blogs:\r\n2. [https://ludovic-emo.medium.com/how-to-send-esp32-telemetry-to-google-cloud-iot-core-caf1a952020d]\r\n3. [https://medium.com/@gguuss/accessing-cloud-iot-core-from-arduino-838c2138cf2b]\r\n4. I also started a course on LinkedIn learning called &quot;Learning Cloud IoT Core&quot; by Lee Assam.\r\n\r\nBut I kept getting this message on the serial monitor:\r\n```\r\nSettings incorrect or missing a cyper for SSL\r\nConnect with mqtt.2030.ltsapis.goog:8883\r\n```\r\n\r\nI&#39;m certain that the device ID and every other detail is correct. I suppose the root certificate is wrong. I tried several methods to generate the root certificate, the most common one being the last certificate we get from after executing this command:\r\n```openssl s_client -showcerts -connect mqtt.2030.ltsapis.goog:8883```\r\n\r\nI also tried using any of the root certificate bytes for the certificates with Google Trust Services (GTS) as the certificate authority (CA). Using this command:\r\n```curl pki.goog/roots.pem``` But that document has so many root certificates! Which one do I choose?\r\n\r\nI&#39;m also not able to specify a binary root cert static as given here: https://github.com/Nilhcem/esp32-cloud-iot-core-k8s/blob/master/02-esp32_bme280_ciotc_arduino/ciotc_config.h\r\n\r\nHowever, they all give the same message on the serial monitor. So my questions are:\r\n1. Where am I going wrong?\r\n2. How to generate root certificate?\r\n3. How to specify a binary root cert static ?\r\n4. The example universal-lwmqtt form Google Cloud IoT Core JWT library specifies 2 root certificates, primary and backup. How to obtain those? [https://github.com/GoogleCloudPlatform/google-cloud-iot-arduino/blob/master/examples/universal-lwmqtt/ciotc_config.h]\r\n\r\nI have noticed that there were many others who had faced the exact same problem, however it was never resolved. I&#39;m posting the links to those queries as well.\r\n1. https://stackoverflow.com/questions/62417204/esp32-connection-to-google-cloud-error-settings-incorrect-or-missing-a-cyper\r\n2. https://stackoverflow.com/questions/66799859/esp32-not-connecting-to-google-cloud-iot-core\r\n3. https://stackoverflow.com/questions/61608318/google-cloud-mqtt-with-esp32-reusing-jwt-error ","link":"https://stackoverflow.com/questions/67908911/esp32-and-google-cloud-iot-core-connection-settings-incorrect-or-missing-a-cype","title":"ESP32 and Google Cloud IoT Core connection: Settings incorrect or missing a cyper for SSL","body":"<p>I'm trying to connect ESP32 to Google Cloud IoT Core using the <strong>google-cloud-iot-arduino</strong> and the <strong>arduino-mqtt (lwmqtt)</strong> libraries.</p>\n<ol>\n<li>I followed all necessary steps as given in this blog: [https://www.survivingwithandroid.com/cloud-iot-core-esp32/?unapproved=16731&amp;moderation-hash=eeb8406949900a6f926ac15fdb54c7b6#comment-16731] --My code is the same as given here, just the WiFi SSID and other details are different.\nI also referred to these blogs:</li>\n<li>[https://ludovic-emo.medium.com/how-to-send-esp32-telemetry-to-google-cloud-iot-core-caf1a952020d]</li>\n<li>[https://medium.com/@gguuss/accessing-cloud-iot-core-from-arduino-838c2138cf2b]</li>\n<li>I also started a course on LinkedIn learning called &quot;Learning Cloud IoT Core&quot; by Lee Assam.</li>\n</ol>\n<p>But I kept getting this message on the serial monitor:</p>\n<pre><code>Settings incorrect or missing a cyper for SSL\nConnect with mqtt.2030.ltsapis.goog:8883\n</code></pre>\n<p>I'm certain that the device ID and every other detail is correct. I suppose the root certificate is wrong. I tried several methods to generate the root certificate, the most common one being the last certificate we get from after executing this command:\n<code>openssl s_client -showcerts -connect mqtt.2030.ltsapis.goog:8883</code></p>\n<p>I also tried using any of the root certificate bytes for the certificates with Google Trust Services (GTS) as the certificate authority (CA). Using this command:\n<code>curl pki.goog/roots.pem</code> But that document has so many root certificates! Which one do I choose?</p>\n<p>I'm also not able to specify a binary root cert static as given here: <a href=\"https://github.com/Nilhcem/esp32-cloud-iot-core-k8s/blob/master/02-esp32_bme280_ciotc_arduino/ciotc_config.h\" rel=\"nofollow noreferrer\">https://github.com/Nilhcem/esp32-cloud-iot-core-k8s/blob/master/02-esp32_bme280_ciotc_arduino/ciotc_config.h</a></p>\n<p>However, they all give the same message on the serial monitor. So my questions are:</p>\n<ol>\n<li>Where am I going wrong?</li>\n<li>How to generate root certificate?</li>\n<li>How to specify a binary root cert static ?</li>\n<li>The example universal-lwmqtt form Google Cloud IoT Core JWT library specifies 2 root certificates, primary and backup. How to obtain those? [https://github.com/GoogleCloudPlatform/google-cloud-iot-arduino/blob/master/examples/universal-lwmqtt/ciotc_config.h]</li>\n</ol>\n<p>I have noticed that there were many others who had faced the exact same problem, however it was never resolved. I'm posting the links to those queries as well.</p>\n<ol>\n<li><a href=\"https://stackoverflow.com/questions/62417204/esp32-connection-to-google-cloud-error-settings-incorrect-or-missing-a-cyper\">ESP32 connection to Google cloud, Error : Settings incorrect or missing a cyper for SSL Connect with mqtt.2030.ltsapis.goog:8883</a></li>\n<li><a href=\"https://stackoverflow.com/questions/66799859/esp32-not-connecting-to-google-cloud-iot-core\">ESP32 not connecting to Google Cloud IoT Core</a></li>\n<li><a href=\"https://stackoverflow.com/questions/61608318/google-cloud-mqtt-with-esp32-reusing-jwt-error\">Google cloud MQTT with Esp32 Reusing JWT error</a></li>\n</ol>\n"},{"tags":["c++","linux"],"comments":[{"owner":{"reputation":195168,"user_id":87189,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/98e7d6edce863e7a1bf8199b082eb25e?s=128&d=identicon&r=PG","display_name":"tadman","link":"https://stackoverflow.com/users/87189/tadman"},"edited":false,"score":0,"creation_date":1623259338,"post_id":67908909,"comment_id":120030679,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16178302,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14Gj4jJiaoIP9b_k0opM94qrOewvtS_fj6g7AJ-mb=k-s128","display_name":"ifxandy","link":"https://stackoverflow.com/users/16178302/ifxandy"},"is_answered":false,"view_count":10,"answer_count":0,"score":0,"last_activity_date":1623259200,"creation_date":1623259200,"question_id":67908909,"share_link":"https://stackoverflow.com/q/67908909","body_markdown":"I am trying to create a program that would change the ip header of packets sent to a specific host. To do this, I intercept packets using libtins.\r\n\r\nHere is my `capture.hpp` file\r\n\r\n #pragma once\r\n \r\n #include &lt;tins/tins.h&gt;\r\n using namespace Tins;\r\n \r\n namespace capturing {\r\n \r\n \tbool capture (PDU &amp;pdu);\r\n \r\n }\r\nthis is my `capture.cpp`\r\n\r\n #include &lt;iostream&gt;\r\n #include &quot;headers/capturing.hpp&quot;\r\n #include &lt;tins/tins.h&gt;\r\n \r\n using namespace Tins;\r\n using namespace std;\r\n \r\n namespace capturing {\r\n \r\n \tbool capture (PDU &amp;pdu) {\r\n \r\n \t\tIP &amp;ip = pdu.rfind_pdu&lt;IP&gt;();\r\n \t\t// ip.src_addr(&quot;127.0.0.1&quot;);\r\n \r\n \t\tcout &lt;&lt; ip.src_addr() &lt;&lt; endl;\r\n \t\tcout &lt;&lt; ip.dst_addr() &lt;&lt; endl;\r\n \t\tcout &lt;&lt; ip.id() &lt;&lt; endl;\r\n \r\n \t\treturn false;\r\n \r\n \t}\r\n \r\n }\r\nI tried working with pointers to pdu and IP, but it didnt work, the packet sent didnt change. Just no ideas about it.\r\n","link":"https://stackoverflow.com/questions/67908909/is-there-a-way-to-intercept-and-modify-packet","title":"Is there a way to intercept and modify packet","body":"<p>I am trying to create a program that would change the ip header of packets sent to a specific host. To do this, I intercept packets using libtins.</p>\n<p>Here is my <code>capture.hpp</code> file</p>\n<pre><code>#pragma once\n\n#include &lt;tins/tins.h&gt;\nusing namespace Tins;\n\nnamespace capturing {\n\n bool capture (PDU &amp;pdu);\n\n}\n</code></pre>\n<p>this is my <code>capture.cpp</code></p>\n<pre><code>#include &lt;iostream&gt;\n#include &quot;headers/capturing.hpp&quot;\n#include &lt;tins/tins.h&gt;\n\nusing namespace Tins;\nusing namespace std;\n\nnamespace capturing {\n\n bool capture (PDU &amp;pdu) {\n\n IP &amp;ip = pdu.rfind_pdu&lt;IP&gt;();\n // ip.src_addr(&quot;127.0.0.1&quot;);\n\n cout &lt;&lt; ip.src_addr() &lt;&lt; endl;\n cout &lt;&lt; ip.dst_addr() &lt;&lt; endl;\n cout &lt;&lt; ip.id() &lt;&lt; endl;\n\n return false;\n\n }\n\n}\n</code></pre>\n<p>I tried working with pointers to pdu and IP, but it didnt work, the packet sent didnt change. Just no ideas about it.</p>\n"},{"tags":["cuda","reduction"],"answers":[{"owner":{"reputation":121094,"user_id":1695960,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/7f9f557c03db19232aa410540af2f966?s=128&d=identicon&r=PG","display_name":"Robert Crovella","link":"https://stackoverflow.com/users/1695960/robert-crovella"},"is_accepted":false,"score":0,"last_activity_date":1623259195,"creation_date":1623259195,"answer_id":67908908,"question_id":67907772,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":366,"user_id":741646,"user_type":"registered","accept_rate":100,"profile_image":"https://www.gravatar.com/avatar/5acffcfc1c672d0a7901ede6d19f45f0?s=128&d=identicon&r=PG","display_name":"Kai","link":"https://stackoverflow.com/users/741646/kai"},"is_answered":false,"view_count":11,"answer_count":1,"score":0,"last_activity_date":1623259195,"creation_date":1623254457,"last_edit_date":1623254776,"question_id":67907772,"share_link":"https://stackoverflow.com/q/67907772","body_markdown":"I am somewhat confused, I have used the warp reduction as outlined by the online tutorial for quite a while now and it never caused problems. These are the snippets:\r\n\r\n while (r &lt; total_rotations){\r\n \t\trot_index(d_refinements, h_num_refinements, abg,&amp;rot_linear_index, r,s);\r\n \t\tconcat[threadIdx.x] = min(concat[threadIdx.x],score_offset[rot_linear_index]);\r\n \t\tr += blockDim.x;\r\n \t}\r\n \t__syncthreads();\r\n \tif (BLOCKSIZE &gt;= 1024){if (tid &lt; 512) { concat[tid] = min(concat[tid],concat[tid + 512]);} __syncthreads();}\r\n \tif (BLOCKSIZE &gt;= 512){if (tid &lt; 256) { concat[tid] = min(concat[tid],concat[tid + 256]);} __syncthreads();}\r\n \tif (BLOCKSIZE &gt;= 256){if (tid &lt; 128) { concat[tid] = min(concat[tid],concat[tid + 128]);} __syncthreads();}\r\n \tif (BLOCKSIZE &gt;= 128){if (tid &lt; 64) { concat[tid] = min(concat[tid],concat[tid + 64]);} __syncthreads();}\r\n \tif (tid &lt; 32) min_warp_reduce&lt;float,BLOCKSIZE&gt;(concat,tid); __syncthreads();\r\n \tif (tid==0){\r\n \t\tmin_offset[0] = concat[0];\r\n \t}\r\n\r\nAnd the `__device__` code.\r\n\r\n template &lt;class T, unsigned int blockSize&gt;\r\n\r\n __device__\r\n void min_warp_reduce(volatile T * sdata, int tid){\r\n \tif (blockSize &gt;= 64) sdata[tid] = min(sdata[tid],sdata[tid + 32]);\r\n \tif (blockSize &gt;= 32) sdata[tid] = min(sdata[tid],sdata[tid + 16]);\r\n \tif (blockSize &gt;= 16) sdata[tid] = min(sdata[tid],sdata[tid + 8]);\r\n \tif (blockSize &gt;= 8) sdata[tid] = min(sdata[tid],sdata[tid + 4]);\r\n \tif (blockSize &gt;= 4) sdata[tid] = min(sdata[tid],sdata[tid + 2]);\r\n \tif (blockSize &gt;= 2) sdata[tid] = min(sdata[tid],sdata[tid + 1]);\r\n }\r\n\r\nTo me I have copied the tutorial code faithfully, yet a race condition check tells me that there are several conflicts. What am I missing?","link":"https://stackoverflow.com/questions/67907772/cuda-min-warp-reduction-produces-race-condition","title":"Cuda min warp reduction produces race condition","body":"<p>I am somewhat confused, I have used the warp reduction as outlined by the online tutorial for quite a while now and it never caused problems. These are the snippets:</p>\n<pre><code>while (r &lt; total_rotations){\n rot_index(d_refinements, h_num_refinements, abg,&amp;rot_linear_index, r,s);\n concat[threadIdx.x] = min(concat[threadIdx.x],score_offset[rot_linear_index]);\n r += blockDim.x;\n }\n __syncthreads();\n if (BLOCKSIZE &gt;= 1024){if (tid &lt; 512) { concat[tid] = min(concat[tid],concat[tid + 512]);} __syncthreads();}\n if (BLOCKSIZE &gt;= 512){if (tid &lt; 256) { concat[tid] = min(concat[tid],concat[tid + 256]);} __syncthreads();}\n if (BLOCKSIZE &gt;= 256){if (tid &lt; 128) { concat[tid] = min(concat[tid],concat[tid + 128]);} __syncthreads();}\n if (BLOCKSIZE &gt;= 128){if (tid &lt; 64) { concat[tid] = min(concat[tid],concat[tid + 64]);} __syncthreads();}\n if (tid &lt; 32) min_warp_reduce&lt;float,BLOCKSIZE&gt;(concat,tid); __syncthreads();\n if (tid==0){\n min_offset[0] = concat[0];\n }\n</code></pre>\n<p>And the <code>__device__</code> code.</p>\n<pre><code>template &lt;class T, unsigned int blockSize&gt;\n\n__device__\nvoid min_warp_reduce(volatile T * sdata, int tid){\n if (blockSize &gt;= 64) sdata[tid] = min(sdata[tid],sdata[tid + 32]);\n if (blockSize &gt;= 32) sdata[tid] = min(sdata[tid],sdata[tid + 16]);\n if (blockSize &gt;= 16) sdata[tid] = min(sdata[tid],sdata[tid + 8]);\n if (blockSize &gt;= 8) sdata[tid] = min(sdata[tid],sdata[tid + 4]);\n if (blockSize &gt;= 4) sdata[tid] = min(sdata[tid],sdata[tid + 2]);\n if (blockSize &gt;= 2) sdata[tid] = min(sdata[tid],sdata[tid + 1]);\n}\n</code></pre>\n<p>To me I have copied the tutorial code faithfully, yet a race condition check tells me that there are several conflicts. What am I missing?</p>\n"},{"tags":["r","auc"],"comments":[{"owner":{"reputation":1083,"user_id":9093302,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/0821de7ead2f25daaf27accb90524b98?s=128&d=identicon&r=PG&f=1","display_name":"Brian Fisher","link":"https://stackoverflow.com/users/9093302/brian-fisher"},"edited":false,"score":0,"creation_date":1623258433,"post_id":67908515,"comment_id":120030333,"content_license":"CC BY-SA 4.0"}],"answers":[{"owner":{"reputation":19765,"user_id":13095326,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/8c21c17926c0d5674359e99f6aab7735?s=128&d=identicon&r=PG&f=1","display_name":"Ian Campbell","link":"https://stackoverflow.com/users/13095326/ian-campbell"},"is_accepted":false,"score":0,"last_activity_date":1623259195,"last_edit_date":1623259195,"creation_date":1623258557,"answer_id":67908764,"question_id":67908515,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16176963,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a-/AOh14GgGy4Hd4T8V96BsIBYyYlU3dw2jshxzwaQeLTpOBSA=k-s128","display_name":"shinyhill","link":"https://stackoverflow.com/users/16176963/shinyhill"},"is_answered":false,"view_count":17,"answer_count":1,"score":-2,"last_activity_date":1623259195,"creation_date":1623257430,"last_edit_date":1623258153,"question_id":67908515,"share_link":"https://stackoverflow.com/q/67908515","body_markdown":"I&#39;m a beginner who just started using R.\r\n\r\nI am trying to obtain the AUC for each time section using the trapezoid method with the results measured at 0,10,20,30,40, 50, 60 minutes for each ID.\r\nWhat should I do?\r\n\r\n```\r\n CASET0\tT10\tT20\tT30\tT40\tT50\tT60\r\n1\t 88\t89\t91\t105\t107\t139\t159\r\n2 \t 92\tNA\t102\tNA\tNA\t189\t144\r\n3\t 79\tNA\t82\t98\t106\t140\t118\r\n5\t 81\t81\t82\t92\t86\t101\t124\r\n8\t 90\t89\t89\t106\t115\t134\t101\r\n9\t 91\t77\t87\t82\t95\t133\t156\r\n```","link":"https://stackoverflow.com/questions/67908515/auc-by-trapezoid-method-in-r","title":"AUC by trapezoid method in R","body":"<p>I'm a beginner who just started using R.</p>\n<p>I am trying to obtain the AUC for each time section using the trapezoid method with the results measured at 0,10,20,30,40, 50, 60 minutes for each ID.\nWhat should I do?</p>\n<pre><code> CASET0 T10 T20 T30 T40 T50 T60\n1 88 89 91 105 107 139 159\n2 92 NA 102 NA NA 189 144\n3 79 NA 82 98 106 140 118\n5 81 81 82 92 86 101 124\n8 90 89 89 106 115 134 101\n9 91 77 87 82 95 133 156\n</code></pre>\n"},{"tags":["ios","swift","ibeacon","beacon"],"answers":[{"owner":{"reputation":59229,"user_id":1461050,"user_type":"registered","accept_rate":89,"profile_image":"https://i.stack.imgur.com/c8IhJ.jpg?s=128&g=1","display_name":"davidgyoung","link":"https://stackoverflow.com/users/1461050/davidgyoung"},"is_accepted":false,"score":0,"last_activity_date":1623259191,"creation_date":1623259191,"answer_id":67908907,"question_id":67907906,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1112,"user_id":2811242,"user_type":"registered","accept_rate":92,"profile_image":"https://i.stack.imgur.com/XtrQv.png?s=128&g=1","display_name":"Luciano","link":"https://stackoverflow.com/users/2811242/luciano"},"is_answered":false,"view_count":12,"answer_count":1,"score":1,"last_activity_date":1623259191,"creation_date":1623255045,"question_id":67907906,"share_link":"https://stackoverflow.com/q/67907906","body_markdown":"I&#39;m trying to monitoring region and detecting beacons when the app is killed (in foreground everything works fine). I&#39;ve read that it should be sufficient to set `allowsBackgroundLocationUpdates=true` and `pausesLocationUpdatesAutomatically=false` to wake up the app, but only if an enter/exit event is detected.\r\n\r\nNow, my problem is that when I turn off the beacon, `didDetermineState` and `didExitRegion` are never called. And if I request the state explicitly, it return that it is still inside the region. What am I missing?\r\n\r\nThis is my code, entirely in the AppDelegate.\r\n\r\n func requestLocationPermissions() {\r\n locationManager = CLLocationManager()\r\n locationManager.delegate = self\r\n locationManager.requestAlwaysAuthorization()\r\n locationManager.allowsBackgroundLocationUpdates = true\r\n locationManager.pausesLocationUpdatesAutomatically = false\r\n \r\n startMonitoring()\r\n }\r\n \r\n func startMonitoring() {\r\n let constraint = CLBeaconIdentityConstraint(uuid: Config.Beacons.uuid, major: Config.Beacons.major, minor: Config.Beacons.minor)\r\n let beaconRegion = CLBeaconRegion(beaconIdentityConstraint: constraint, identifier: Config.Beacons.beaconID)\r\n beaconRegion.notifyEntryStateOnDisplay = true\r\n \r\n locationManager.startMonitoring(for: beaconRegion) \r\n locationManager.startRangingBeacons(satisfying: constraint)\r\n }\r\n \r\n func locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) {\r\n if state == .inside {\r\n print(&quot;AppDelegate: inside beacon region&quot;)\r\n } else {\r\n print(&quot;AppDelegate: outside beacon region&quot;)\r\n }\r\n }\r\n \r\n func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {\r\n print(&quot;AppDelegate: entered region&quot;)\r\n }\r\n \r\n func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {\r\n print(&quot;AppDelegate: exited region&quot;)\r\n }\r\n \r\n func locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) {\r\n guard beacons.count &gt; 0 else {\r\n let constraint = CLBeaconIdentityConstraint(uuid: Config.Beacons.uuid, major: Config.Beacons.major, minor: Config.Beacons.minor)\r\n locationManager.requestState(for: CLBeaconRegion(beaconIdentityConstraint: constraint, identifier: Config.Beacons.beaconID))\r\n return\r\n }\r\n \r\n // Other stuff\r\n }","link":"https://stackoverflow.com/questions/67907906/ibeacon-diddeterminestate-never-called-when-exiting-a-region","title":"iBeacon: didDetermineState never called when exiting a region","body":"<p>I'm trying to monitoring region and detecting beacons when the app is killed (in foreground everything works fine). I've read that it should be sufficient to set <code>allowsBackgroundLocationUpdates=true</code> and <code>pausesLocationUpdatesAutomatically=false</code> to wake up the app, but only if an enter/exit event is detected.</p>\n<p>Now, my problem is that when I turn off the beacon, <code>didDetermineState</code> and <code>didExitRegion</code> are never called. And if I request the state explicitly, it return that it is still inside the region. What am I missing?</p>\n<p>This is my code, entirely in the AppDelegate.</p>\n<pre><code>func requestLocationPermissions() {\n locationManager = CLLocationManager()\n locationManager.delegate = self\n locationManager.requestAlwaysAuthorization()\n locationManager.allowsBackgroundLocationUpdates = true\n locationManager.pausesLocationUpdatesAutomatically = false\n \n startMonitoring()\n}\n\nfunc startMonitoring() {\n let constraint = CLBeaconIdentityConstraint(uuid: Config.Beacons.uuid, major: Config.Beacons.major, minor: Config.Beacons.minor)\n let beaconRegion = CLBeaconRegion(beaconIdentityConstraint: constraint, identifier: Config.Beacons.beaconID)\n beaconRegion.notifyEntryStateOnDisplay = true\n\n locationManager.startMonitoring(for: beaconRegion) \n locationManager.startRangingBeacons(satisfying: constraint)\n}\n\nfunc locationManager(_ manager: CLLocationManager, didDetermineState state: CLRegionState, for region: CLRegion) {\n if state == .inside {\n print(&quot;AppDelegate: inside beacon region&quot;)\n } else {\n print(&quot;AppDelegate: outside beacon region&quot;)\n }\n}\n \nfunc locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {\n print(&quot;AppDelegate: entered region&quot;)\n}\n \nfunc locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {\n print(&quot;AppDelegate: exited region&quot;)\n}\n \nfunc locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) {\n guard beacons.count &gt; 0 else {\n let constraint = CLBeaconIdentityConstraint(uuid: Config.Beacons.uuid, major: Config.Beacons.major, minor: Config.Beacons.minor)\n locationManager.requestState(for: CLBeaconRegion(beaconIdentityConstraint: constraint, identifier: Config.Beacons.beaconID))\n return\n }\n \n // Other stuff\n }\n</code></pre>\n"},{"tags":["python","time-complexity","space-complexity"],"owner":{"reputation":1516,"user_id":6630012,"user_type":"registered","profile_image":"https://lh5.googleusercontent.com/-Anrtu1035o8/AAAAAAAAAAI/AAAAAAAAAQQ/-dlTGZC7fxA/photo.jpg?sz=128","display_name":"gsb22","link":"https://stackoverflow.com/users/6630012/gsb22"},"is_answered":false,"view_count":28,"bounty_amount":50,"bounty_closes_date":1623863989,"answer_count":0,"score":0,"last_activity_date":1623259189,"creation_date":1623063782,"last_edit_date":1623077142,"question_id":67870431,"share_link":"https://stackoverflow.com/q/67870431","body_markdown":"So I was solving this LeetCode question - https://leetcode.com/problems/palindrome-partitioning-ii/ and have come up with the following most naive brute force recursive solution. Now, I know how to memoize this solution and work my way up to best possible with Dynamic Programming. But in order to find the time/space complexities of further solutions, I want to see how much worse this solution was and I have looked up in multiple places but haven&#39;t been able to find a concrete T/S complexity answer. \r\n\r\n\r\n```\r\ndef minCut(s: str) -&gt; int:\r\n def is_palindrome(start, end):\r\n while start &lt; end:\r\n if not s[start] == s[end]:\r\n return False\r\n start += 1\r\n end -= 1\r\n return True\r\n\r\n def dfs_helper(start, end):\r\n if start &gt;= end:\r\n return 0\r\n\r\n if is_palindrome(start, end):\r\n return 0\r\n curr_min = inf\r\n \r\n # this is the meat of the solution and what is the time complexity of this\r\n for x in range(start, end):\r\n curr_min = min(curr_min, 1 + dfs_helper(start, x) + dfs_helper(x + 1, end))\r\n return curr_min\r\n\r\n return dfs_helper(0, len(s) - 1)\r\n```","link":"https://stackoverflow.com/questions/67870431/time-and-space-complexity-of-palindrome-partitioning-ii","title":"Time and Space complexity of Palindrome Partitioning II","body":"<p>So I was solving this LeetCode question - <a href=\"https://leetcode.com/problems/palindrome-partitioning-ii/\" rel=\"nofollow noreferrer\">https://leetcode.com/problems/palindrome-partitioning-ii/</a> and have come up with the following most naive brute force recursive solution. Now, I know how to memoize this solution and work my way up to best possible with Dynamic Programming. But in order to find the time/space complexities of further solutions, I want to see how much worse this solution was and I have looked up in multiple places but haven't been able to find a concrete T/S complexity answer.</p>\n<pre><code>def minCut(s: str) -&gt; int:\n def is_palindrome(start, end):\n while start &lt; end:\n if not s[start] == s[end]:\n return False\n start += 1\n end -= 1\n return True\n\n def dfs_helper(start, end):\n if start &gt;= end:\n return 0\n\n if is_palindrome(start, end):\n return 0\n curr_min = inf\n \n # this is the meat of the solution and what is the time complexity of this\n for x in range(start, end):\n curr_min = min(curr_min, 1 + dfs_helper(start, x) + dfs_helper(x + 1, end))\n return curr_min\n\n return dfs_helper(0, len(s) - 1)\n</code></pre>\n"},{"tags":["python","cluster-computing","dask"],"comments":[{"owner":{"reputation":21408,"user_id":3821154,"user_type":"registered","accept_rate":40,"profile_image":"https://i.stack.imgur.com/RYr9X.jpg?s=128&g=1","display_name":"mdurant","link":"https://stackoverflow.com/users/3821154/mdurant"},"edited":false,"score":0,"creation_date":1623259250,"post_id":67907882,"comment_id":120030643,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":16138604,"user_type":"registered","profile_image":"https://lh3.googleusercontent.com/a/AATXAJyJsJWcYp6gvqn4vsmGIu6IxJnc4hlBJMkWdsOQ=k-s128","display_name":"iti1801","link":"https://stackoverflow.com/users/16138604/iti1801"},"is_answered":false,"view_count":8,"answer_count":0,"score":0,"last_activity_date":1623259185,"creation_date":1623254970,"last_edit_date":1623259185,"question_id":67907882,"share_link":"https://stackoverflow.com/q/67907882","body_markdown":"I tried the following code:\r\n\r\n```\r\nimport numpy as np \r\nfrom dask.distributed import Client \r\nfrom dask.jobqueue import PBSCluster \r\nimport dask.array as da\r\n\r\ncluster = PBSCluster(processes=1, cores=8, memory=&quot;40GB&quot;, \r\n local directory=&#39;$TMPDIR&#39;, \r\n walltime=&#39;1:00:00&#39;, interface=&#39;ib0&#39;) \r\n\r\ntask = client.submit(lambda: np.random.uniform(size=(623000, 73, 41)))\r\narr = da.from_delayed(task, shape=(623000, 73, 41), dtype=np.float32)\r\nres = client.compute(arr)\r\n\r\nres.result()\r\n```\r\n\r\nThe process is not finished. It is always restarted and is only performed by one worker. \r\n\r\nWhat is wrong with the code?\r\nIs it possible to distribute it to all the cores? ","link":"https://stackoverflow.com/questions/67907882/dask-computation-never-ending","title":"Dask computation never ending","body":"<p>I tried the following code:</p>\n<pre><code>import numpy as np \nfrom dask.distributed import Client \nfrom dask.jobqueue import PBSCluster \nimport dask.array as da\n\ncluster = PBSCluster(processes=1, cores=8, memory=&quot;40GB&quot;, \n local directory='$TMPDIR', \n walltime='1:00:00', interface='ib0') \n\ntask = client.submit(lambda: np.random.uniform(size=(623000, 73, 41)))\narr = da.from_delayed(task, shape=(623000, 73, 41), dtype=np.float32)\nres = client.compute(arr)\n\nres.result()\n</code></pre>\n<p>The process is not finished. It is always restarted and is only performed by one worker.</p>\n<p>What is wrong with the code?\nIs it possible to distribute it to all the cores?</p>\n"},{"tags":["eigen","openblas"],"owner":{"reputation":1,"user_id":16178379,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/dfd11e3f9244cdf6e8218fdf42c36207?s=128&d=identicon&r=PG&f=1","display_name":"tstjohn","link":"https://stackoverflow.com/users/16178379/tstjohn"},"is_answered":false,"view_count":4,"answer_count":0,"score":0,"last_activity_date":1623259172,"creation_date":1623259172,"question_id":67908906,"share_link":"https://stackoverflow.com/q/67908906","body_markdown":"I&#39;m trying to run Eigen&#39;s benchmark using OpenBLAS. However, it doesn&#39;t appear that OpenBLAS is actually being used.\r\n\r\nThe script that I&#39;m running is based on the example provided on the Eigen website (https://eigen.tuxfamily.org/index.php?title=How_to_run_the_benchmark_suite).\r\n\r\nIs there anything else that needs to be done to properly use OpenBLAS?\r\n\r\nHere is a copy of the script that I&#39;m running.\r\n\r\n```export OPENBLASDIR=/root/OpenBLAS\r\nOPENBLAS_LIBRARIES=$OPENBLASDIR/build/lib/libopenblas.so\r\nOPENBLAS_INCLUDES=$OPENBLASDIR/build/include\r\n\r\nexport EIGEN3DIR=/root/eigen-3.3.9\r\nexport BUILDDIR=/root/eigen-tests\r\n\r\nmkdir $BUILDDIR\r\ncd $BUILDDIR\r\n\r\ncmake $EIGEN3DIR -DEIGEN_BUILD_BTL=ON -DEIGEN3_INCLUDE_DIR=$EIGEN3DIR -DCMAKE_B\\\r\nUILD_TYPE=Release -DOPENBLAS_LIBRARIES=$OPENBLAS_LIBRARIES -DOPENBLAS_INCLUDES=\\\r\n$OPENBLAS_INCLUDES\r\ncd bench/btl\r\nmake -j8\r\nOMP_NUM_THREADS=1 ctest -V```","link":"https://stackoverflow.com/questions/67908906/attempting-to-run-eigen-benchmark-with-openblas-backend","title":"Attempting to Run Eigen Benchmark with OpenBLAS Backend","body":"<p>I'm trying to run Eigen's benchmark using OpenBLAS. However, it doesn't appear that OpenBLAS is actually being used.</p>\n<p>The script that I'm running is based on the example provided on the Eigen website (<a href=\"https://eigen.tuxfamily.org/index.php?title=How_to_run_the_benchmark_suite\" rel=\"nofollow noreferrer\">https://eigen.tuxfamily.org/index.php?title=How_to_run_the_benchmark_suite</a>).</p>\n<p>Is there anything else that needs to be done to properly use OpenBLAS?</p>\n<p>Here is a copy of the script that I'm running.</p>\n<pre><code>OPENBLAS_LIBRARIES=$OPENBLASDIR/build/lib/libopenblas.so\nOPENBLAS_INCLUDES=$OPENBLASDIR/build/include\n\nexport EIGEN3DIR=/root/eigen-3.3.9\nexport BUILDDIR=/root/eigen-tests\n\nmkdir $BUILDDIR\ncd $BUILDDIR\n\ncmake $EIGEN3DIR -DEIGEN_BUILD_BTL=ON -DEIGEN3_INCLUDE_DIR=$EIGEN3DIR -DCMAKE_B\\\nUILD_TYPE=Release -DOPENBLAS_LIBRARIES=$OPENBLAS_LIBRARIES -DOPENBLAS_INCLUDES=\\\n$OPENBLAS_INCLUDES\ncd bench/btl\nmake -j8\nOMP_NUM_THREADS=1 ctest -V```\n</code></pre>\n"},{"tags":["kubernetes","cron","kubernetes-cronjob"],"owner":{"reputation":51,"user_id":12874621,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/e9737ad85d83fda9bffa2aa987790ce0?s=128&d=identicon&r=PG&f=1","display_name":"girlcoder1","link":"https://stackoverflow.com/users/12874621/girlcoder1"},"is_answered":false,"view_count":5,"answer_count":0,"score":0,"last_activity_date":1623259172,"creation_date":1623258394,"last_edit_date":1623259172,"question_id":67908726,"share_link":"https://stackoverflow.com/q/67908726","body_markdown":"I have this cron job set up to run every 2 hours. Sometimes the job runs and sometimes it doesn&#39;t run consistently. Any ideas as to what I can add/change to make it consistently run every 2 hours even if it fails?\r\n\r\n apiVersion: batch/v1beta1\r\n kind: CronJob\r\n metadata:\r\n name: {{ .Values.metadata.name }}\r\n namespace: {{ .Values.metadata.namespace }}\r\n spec:\r\n schedule: &quot;0 11,23 * * *&quot;\r\n schedule: &quot;0 11,13,15,17,19,21,23 * * *&quot;\r\n jobTemplate:\r\n spec:\r\n template:\r\n spec:\r\n containers:\r\n - name: {{ .Values.metadata.name }}\r\n image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag }}&quot;\r\n imagePullPolicy: Always\r\n env:\r\n {{ range .Values.envVars }}\r\n - name: &quot;{{ .name }}&quot;\r\n valueFrom:\r\n secretKeyRef:\r\n name: job\r\n key: {{ .name }}\r\n optional: {{ .optional }}\r\n {{ end }}\r\n resources:\r\n limits:\r\n cpu: 512m\r\n memory: 1024Mi\r\n requests:\r\n cpu: 200m\r\n memory: 256Mi\r\n restartPolicy: Never\r\n restartPolicy: OnFailure\r\n backoffLimit: 4","link":"https://stackoverflow.com/questions/67908726/cronjob-is-not-running-consistently","title":"CronJob Is not running consistently","body":"<p>I have this cron job set up to run every 2 hours. Sometimes the job runs and sometimes it doesn't run consistently. Any ideas as to what I can add/change to make it consistently run every 2 hours even if it fails?</p>\n<pre><code>apiVersion: batch/v1beta1\nkind: CronJob\nmetadata:\n name: {{ .Values.metadata.name }}\n namespace: {{ .Values.metadata.namespace }}\nspec:\n schedule: &quot;0 11,23 * * *&quot;\n schedule: &quot;0 11,13,15,17,19,21,23 * * *&quot;\n jobTemplate:\n spec:\n template:\n spec:\n containers:\n - name: {{ .Values.metadata.name }}\n image: &quot;{{ .Values.image.repository }}:{{ .Values.image.tag }}&quot;\n imagePullPolicy: Always\n env:\n {{ range .Values.envVars }}\n - name: &quot;{{ .name }}&quot;\n valueFrom:\n secretKeyRef:\n name: job\n key: {{ .name }}\n optional: {{ .optional }}\n {{ end }}\n resources:\n limits:\n cpu: 512m\n memory: 1024Mi\n requests:\n cpu: 200m\n memory: 256Mi\n restartPolicy: Never\n restartPolicy: OnFailure\n backoffLimit: 4\n</code></pre>\n"},{"tags":["python","pdf","flask","web","pythonanywhere"],"owner":{"reputation":1,"user_id":16178277,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/a2b8008af86a0c27f62ffb4b394e7a17?s=128&d=identicon&r=PG&f=1","display_name":"JW30","link":"https://stackoverflow.com/users/16178277/jw30"},"is_answered":false,"view_count":5,"answer_count":0,"score":0,"last_activity_date":1623259167,"creation_date":1623259167,"question_id":67908905,"share_link":"https://stackoverflow.com/q/67908905","body_markdown":"I am trying to host a website via Pythonanywhere that allows me to extract 8 digit product numbers from pdf files. The extracting is done by the textract module. \r\n\r\nWhen I try to extract certain pdf files I get a UnicodeDecodeError like you can see here: https://codeshare.io/WdNz6E. The problem is, if I run the website locally via the development server, the same pdf files are no problem for textract and the program runs without errors. The versions of Python, Flask and Textract are the same.\r\n\r\nThis is the function used to extract the pdf files:\r\n\r\n def get_numbers(file_path):\r\n output = &#39;&#39;\r\n pdf_string = str(textract.process(file_path))\r\n numbers_list = re.sub(&#39;\\D&#39;, &#39; &#39;, pdf_string).split()\r\n for x in numbers_list:\r\n if len(x) == 8 and x not in output:\r\n output += f&#39;{x} &#39;\r\n return output.rstrip()","link":"https://stackoverflow.com/questions/67908905/pythonanywhere-textract-unicodedecodeerror-only-on-website","title":"Pythonanywhere Textract UnicodeDecodeError ONLY on website","body":"<p>I am trying to host a website via Pythonanywhere that allows me to extract 8 digit product numbers from pdf files. The extracting is done by the textract module.</p>\n<p>When I try to extract certain pdf files I get a UnicodeDecodeError like you can see here: <a href=\"https://codeshare.io/WdNz6E\" rel=\"nofollow noreferrer\">https://codeshare.io/WdNz6E</a>. The problem is, if I run the website locally via the development server, the same pdf files are no problem for textract and the program runs without errors. The versions of Python, Flask and Textract are the same.</p>\n<p>This is the function used to extract the pdf files:</p>\n<pre><code>def get_numbers(file_path):\n output = ''\n pdf_string = str(textract.process(file_path))\n numbers_list = re.sub('\\D', ' ', pdf_string).split()\n for x in numbers_list:\n if len(x) == 8 and x not in output:\n output += f'{x} '\n return output.rstrip()\n</code></pre>\n"},{"tags":["node.js","heroku","npm"],"comments":[{"owner":{"reputation":40163,"user_id":740553,"user_type":"registered","accept_rate":46,"profile_image":"https://i.stack.imgur.com/s5cOX.jpg?s=128&g=1","display_name":"Mike &#39;Pomax&#39; Kamermans","link":"https://stackoverflow.com/users/740553/mike-pomax-kamermans"},"edited":false,"score":0,"creation_date":1623259310,"post_id":67908635,"comment_id":120030669,"content_license":"CC BY-SA 4.0"}],"owner":{"reputation":1,"user_id":10585293,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/fbff431b23df962bd4ea668ee946afe7?s=128&d=identicon&r=PG&f=1","display_name":"Dominik","link":"https://stackoverflow.com/users/10585293/dominik"},"is_answered":false,"view_count":10,"answer_count":0,"score":0,"last_activity_date":1623259160,"creation_date":1623258017,"last_edit_date":1623259160,"question_id":67908635,"share_link":"https://stackoverflow.com/q/67908635","body_markdown":"I try to deploy my app from github but I get these errors:\r\n...........................................................\r\n...........................................................\r\n...........................................................\r\n```\r\napp[web.1]: &gt; node app.js\r\napp[web.1]:\r\nheroku[web.1]: State changed from starting to up\r\napp[web.1]: Serving on port 14885\r\napp[web.1]: Database connected\r\napp[web.1]: /app/node_modules/mongodb/lib/utils.js:698\r\napp[web.1]: throw error;\r\napp[web.1]: ^\r\napp[web.1]:\r\napp[web.1]: MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017\r\napp[web.1]: at Timeout._onTimeout (/app/node_modules/mongodb/lib/core/sdam/topology.js:438:30)\r\napp[web.1]: at listOnTimeout (internal/timers.js:555:17)\r\napp[web.1]: at processTimers (internal/timers.js:498:7) {\r\napp[web.1]: reason: TopologyDescription {\r\napp[web.1]: type: &#39;Single&#39;,\r\n app[web.1]: setName: null,\r\napp[web.1]: maxSetVersion: null,\r\napp[web.1]: maxElectionId: null,\r\napp[web.1]: servers: Map(1) {\r\napp[web.1]: &#39;localhost:27017&#39; =&gt; ServerDescription {\r\napp[web.1]: address: &#39;localhost:27017&#39;,\r\napp[web.1]: error: Error: connect ECONNREFUSED 127.0.0.1:27017\r\napp[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {\r\napp[web.1]: name: &#39;MongoNetworkError&#39;\r\napp[web.1]: },\r\napp[web.1]: roundTripTime: -1,\r\napp[web.1]: lastUpdateTime: 81704897,\r\napp[web.1]: lastWriteDate: null,\r\napp[web.1]: opTime: null,\r\napp[web.1]: type: &#39;Unknown&#39;,\r\napp[web.1]: topologyVersion: undefined,\r\napp[web.1]: minWireVersion: 0,\r\napp[web.1]: maxWireVersion: 0,\r\napp[web.1]: hosts: [],\r\napp[web.1]: passives: [],\r\napp[web.1]: arbiters: [],\r\napp[web.1]: tags: []\r\napp[web.1]: }\r\napp[web.1]: },\r\napp[web.1]: stale: false,\r\napp[web.1]: compatible: true,\r\napp[web.1]: compatibilityError: null,\r\napp[web.1]: logicalSessionTimeoutMinutes: null,\r\napp[web.1]: heartbeatFrequencyMS: 10000,\r\napp[web.1]: localThresholdMS: 15,\r\napp[web.1]: commonWireVersion: null\r\napp[web.1]: }\r\napp[web.1]: }\r\napp[web.1]: npm ERR! code ELIFECYCLE\r\napp[web.1]: npm ERR! errno 1\r\napp[web.1]: npm ERR! serwis-ogloszeniowy@ start: `node app.js`\r\napp[web.1]: npm ERR! Exit status 1\r\napp[web.1]: npm ERR!\r\napp[web.1]: npm ERR! Failed at the serwis-ogloszeniowy@ start script.\r\napp[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\napp[web.1]:\r\napp[web.1]: npm ERR! A complete log of this run can be found in:\r\napp[web.1]: npm ERR! /app/.npm/_logs/2021-06-09T17_07_14_026Z-debug.log\r\nheroku[web.1]: Process exited with status 1\r\nheroku[web.1]: State changed from up to crashed\r\n```\r\n...................................................................\r\nI have no idea what&#39;s going wrong. \r\nPlease help.","link":"https://stackoverflow.com/questions/67908635/heroku-errors-when-trying-to-deploy","title":"Heroku errors when trying to deploy","body":"<p>I try to deploy my app from github but I get these errors:\n...........................................................\n...........................................................\n...........................................................</p>\n<pre><code>app[web.1]: &gt; node app.js\napp[web.1]:\nheroku[web.1]: State changed from starting to up\napp[web.1]: Serving on port 14885\napp[web.1]: Database connected\napp[web.1]: /app/node_modules/mongodb/lib/utils.js:698\napp[web.1]: throw error;\napp[web.1]: ^\napp[web.1]:\napp[web.1]: MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017\napp[web.1]: at Timeout._onTimeout (/app/node_modules/mongodb/lib/core/sdam/topology.js:438:30)\napp[web.1]: at listOnTimeout (internal/timers.js:555:17)\napp[web.1]: at processTimers (internal/timers.js:498:7) {\napp[web.1]: reason: TopologyDescription {\napp[web.1]: type: 'Single',\n app[web.1]: setName: null,\napp[web.1]: maxSetVersion: null,\napp[web.1]: maxElectionId: null,\napp[web.1]: servers: Map(1) {\napp[web.1]: 'localhost:27017' =&gt; ServerDescription {\napp[web.1]: address: 'localhost:27017',\napp[web.1]: error: Error: connect ECONNREFUSED 127.0.0.1:27017\napp[web.1]: at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {\napp[web.1]: name: 'MongoNetworkError'\napp[web.1]: },\napp[web.1]: roundTripTime: -1,\napp[web.1]: lastUpdateTime: 81704897,\napp[web.1]: lastWriteDate: null,\napp[web.1]: opTime: null,\napp[web.1]: type: 'Unknown',\napp[web.1]: topologyVersion: undefined,\napp[web.1]: minWireVersion: 0,\napp[web.1]: maxWireVersion: 0,\napp[web.1]: hosts: [],\napp[web.1]: passives: [],\napp[web.1]: arbiters: [],\napp[web.1]: tags: []\napp[web.1]: }\napp[web.1]: },\napp[web.1]: stale: false,\napp[web.1]: compatible: true,\napp[web.1]: compatibilityError: null,\napp[web.1]: logicalSessionTimeoutMinutes: null,\napp[web.1]: heartbeatFrequencyMS: 10000,\napp[web.1]: localThresholdMS: 15,\napp[web.1]: commonWireVersion: null\napp[web.1]: }\napp[web.1]: }\napp[web.1]: npm ERR! code ELIFECYCLE\napp[web.1]: npm ERR! errno 1\napp[web.1]: npm ERR! serwis-ogloszeniowy@ start: `node app.js`\napp[web.1]: npm ERR! Exit status 1\napp[web.1]: npm ERR!\napp[web.1]: npm ERR! Failed at the serwis-ogloszeniowy@ start script.\napp[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.\napp[web.1]:\napp[web.1]: npm ERR! A complete log of this run can be found in:\napp[web.1]: npm ERR! /app/.npm/_logs/2021-06-09T17_07_14_026Z-debug.log\nheroku[web.1]: Process exited with status 1\nheroku[web.1]: State changed from up to crashed\n</code></pre>\n<p>...................................................................\nI have no idea what's going wrong.<br />\nPlease help.</p>\n"},{"tags":["pycharm"],"owner":{"reputation":647,"user_id":10765455,"user_type":"registered","profile_image":"https://www.gravatar.com/avatar/00bcaf19329c0b70f2b8c18479a092f1?s=128&d=identicon&r=PG&f=1","display_name":"Tristan Tran","link":"https://stackoverflow.com/users/10765455/tristan-tran"},"is_answered":false,"view_count":10,"answer_count":0,"score":0,"last_activity_date":1623259157,"creation_date":1623258689,"last_edit_date":1623259157,"question_id":67908800,"share_link":"https://stackoverflow.com/q/67908800","body_markdown":"I installed Pycharm in Windows. I also have WSL2 Ubuntu. My projects are in WSL2 Ubuntu. I have 2 users in WSL2 Ubuntu. One user, ```user1```, I have been using for a while, including projects that I have edited with Pycharm. Recently, I created a 2nd user,```user2```, to run Kafka separately. My Kafka-related project is stored in ```user2```.\r\n\r\nI also execute files in ```user2``` project in ```user2``` terminals (after switching from ```user1``` with ```su -ls user2```).\r\n\r\nNow, I want to edit Python files in project under ```user2``` in Pycharm. But I got this error:\r\n```\r\nCannot save \\\\wsl\\Ubuntu\\home\\user2\\xxx\\xxx.py\r\nUnable to create a backup file (xxx.py~)\r\nThe file left unchanged.\r\n```\r\n\r\nAlso, at the bottom right of Pycharm IDE, there is an ```Event Log``` notice\r\n\r\n```\r\nFailed to save settings. Please restart Pycharm.\r\n```\r\n\r\nRestarting Pycharm leads me to the same situation over.\r\n\r\nWhat should I do to deal with Python projects sitting on and 2nd user? Note that, if I edit files under ```user1```, everything works fine (I can save files without any error notifications).\r\n\r\n","link":"https://stackoverflow.com/questions/67908800/unable-to-save-files-in-pycharm","title":"Unable to save files in Pycharm","body":"<p>I installed Pycharm in Windows. I also have WSL2 Ubuntu. My projects are in WSL2 Ubuntu. I have 2 users in WSL2 Ubuntu. One user, <code>user1</code>, I have been using for a while, including projects that I have edited with Pycharm. Recently, I created a 2nd user,<code>user2</code>, to run Kafka separately. My Kafka-related project is stored in <code>user2</code>.</p>\n<p>I also execute files in <code>user2</code> project in <code>user2</code> terminals (after switching from <code>user1</code> with <code>su -ls user2</code>).</p>\n<p>Now, I want to edit Python files in project under <code>user2</code> in Pycharm. But I got this error:</p>\n<pre><code>Cannot save \\\\wsl\\Ubuntu\\home\\user2\\xxx\\xxx.py\nUnable to create a backup file (xxx.py~)\nThe file left unchanged.\n</code></pre>\n<p>Also, at the bottom right of Pycharm IDE, there is an <code>Event Log</code> notice</p>\n<pre><code>Failed to save settings. Please restart Pycharm.\n</code></pre>\n<p>Restarting Pycharm leads me to the same situation over.</p>\n<p>What should I do to deal with Python projects sitting on and 2nd user? Note that, if I edit files under <code>user1</code>, everything works fine (I can save files without any error notifications).</p>\n"}],"has_more":true,"quota_max":300,"quota_remaining":268}