How to show the same exact form again after hiding it?

Question: I am creating a windows form program. That uses a login screen first then it proceeds to the main window, with the option to logout from there and login as another user.
When I use the logout option, how would I show the same hidden login form from before? I feel like it's a waste of memory to create a new LogInForm from scratch.
Comment: Usually, you never want to keep a form in memory if it is not used...
Comment: _" it's a waste of memory"_, more specifically _GDI resources_, to keep GUI objects laying about if you aren't using them.  Regardless to the amount of RAM in your computer, there is a set limit for GDI.  Maybe you mean _waste of CPU_ to recreate the window?  (it would have to be a pretty hefty login window though)
Answer: LoginForm.Show() works fine but it will load the previously entered details if you did not dispose the form after a successful login.
Also, there is no "waste of memory" in calling a form or creating it again.
Comment: You have to be careful with that last statement. If the developer creates a few forms and keeps retaining their references after closing, the objects will not be disposed for the lifecycle of the app potentially resulting in OutOfMemoryException's.
Comment: @zaitsman thats why i asked him to dispose. If the form is disposed and created it have no tie to memory consumption. Obviously there are differences between .close() and .dispose()
Answer: Well you can simply call .Show() again on the first form (provided you retain a reference to it somewhere within the app). Of course, practically speaking, you need to look at how frequently the users will perform this specific functionality. At a guess, creating a new login form maybe totally fine.
Answer: Use this In your MainForm:
Form2 f2;
public void Form1()
{
    InitializeComponent();
    f2 = new Form2();
}

Wherever you want (In form1) use f2.Show(); or f2.ShowDialog();
In Form2, when you close the form, use this.Hide();
Hope this help!


How import XML data into Wordpress programatically?

Question: Wordpress offers an easy way to import and export its data using XML. It's done with a GUI-based built-in importer. What I'd like to do however, is to be able to import certain XML files from within my theme (upon activation or after executing a function).
My case:
While there are a few plugins that can create dummy content for you, I couldn't find any way to do what I'm trying to do - import a set of ACF fields stored in XML file.
Is there any way to do it?
Comment: Down voting the question without any comment or pointer what's wrong with it hardly contributes to its solution.
Comment: it's been closed as off-topic but nobody thought to mention the wordpress SE? wordpress.stackexchange.com.
Answer: Update: This function is meant to deal with XML data and is limited to ACF up to version 4. ACF 5 exports its fields as JSON data.
The solution turned into a Wordpress plugin.
Here's the solution to my problem.
function insert_acf_field( $xml_string, $allow_duplicates = false ) {

// Parse ACF post's XML
$content = simplexml_load_string( $xml_string, 'SimpleXMLElement', LIBXML_NOCDATA);

// Parse XML post attributes containing fields
$wp_post_attributes = $content->channel->item->children('wp', true);

# Copy basic properties from the exported field
$wp_post_data = array(
    'post_type'   => 'acf',
    'post_title'  => $content->channel->item->title,
    'post_name'   => $wp_post_attributes->post_name,
    'post_status' => 'publish',
    'post_author' => 1

);

$the_post = get_page_by_title($content->channel->item->title, 'OBJECT', 'acf');

# Execute only if doesn't exist already
if ( !$the_post || $allow_duplicates == true ) {
    $post_id = wp_insert_post( $wp_post_data );
}
else {
    $post_id = $the_post->ID;
}

$wp_post_meta = $content->channel->item->children('wp', true);

if( $wp_post_meta ) {
    foreach ( $wp_post_meta as $row) {

        // Choose only arrays (postmeta)
        if( count($row) > 0) {
            // using addlashes on meta values to compensate for stripslashes() that will be run upon import
            update_post_meta( $post_id, $row->meta_key, addslashes( $row->meta_value ) );
        }

    }
}
}

Here's how to use it:
Function expects at least $xml_string parameter to be passed. It should contain the contents of the XML file that is produced by ACF plugin upon export of an ACF field (post of acf type).
The function will try to create one new ACF post unless one already exists, and then populate it with fields. To insert more than one field (a clone) with the same title, you should pass true as a second parameter.
There are a few issues still to be addressed, but the function in its current state should be usable


containsMatchingElement returns false when react component contains function

Question: I have a child component which contains a method as props. This child component renders Radio Group. When I click these radio buttons based on the value of radio another component gets rendered. I have two issues.

I'm not able to invoke child component props method (setSeverityLevel)
containsMatchingElement() returns false even though debug shows the component available.

import * as React from "react";
import { SelectSeverityLevel } from "components/Common/SelectSeverityLevel";
import Sev1Confirmation from "../Sev1Confirmation";

interface State {
  issueSummary: string;
  description: string;
  createIncidentRequested: boolean;
  selectedSeverity: TicketSeverityEnum;
  errorMessage: JSX.Element;
}

export class TechnicalSRCreate extends React.Component<Props, State> {
    constructor(props: Props) {
    super(props);
    this.state = {
      issueSummary: undefined,
      description: undefined,
      createIncidentRequested: false,
      selectedSeverity: "HIGH",
      errorMessage: undefined
    };
  }
  private sev1Confirmation = (): JSX.Element => {
    return (
      <Sev1Confirmation
        checked={this.props.sev1Confirmed}
        confirm={(value: boolean) => {
          this.props.setSev1Confirmed(value);
        }}
      />);
  }
  private onSelectSeverity = (value: string): void => {
    console.log("onSelectSeverity>>>");
    console.log(value);
    this.props.setSeverity(value as TicketSeverityEnum);
  }

  private internalRender(): JSX.Element {
    return (
        <>
        <SelectSeverityLevel
          defaultSeverity={this.props.severity}
          fieldName={SeverityLevelFieldName}
          setSeverityLevel={this.onSelectSeverity}
        />
        {this.props.severity === "HIGHEST" ?
          this.sev1Confirmation()
        : null}
        </>
    )
  }

  public render(): JSX.Element {
    return (
        <>
        <Form>
            .....

{this.internalRender()}

        </Form>
        </>

    )
  }
}
export default TechnicalSRCreate;

what am I missing here?
Answer: The shallow render is not meant for this purposes, quoting from the docs:

Shallow rendering is useful to constrain yourself to testing a component as a unit, and to ensure that your tests aren't indirectly asserting on behavior of child components.

You should use mount(...) instead to test child-parent behavior. Also, a good rule of thumb is to always test components using mount instead of shallow as the latter allows you to break your application without the tests failing; and maintaining the App must be the longterm ambition. Read more about this here
Comment: I tried with mount as well and still tests fails.

const parent = mount();
expect(parent.containsMatchingElement()).toBe(true);

 Expected: true
 Received: false
Comment: Without a reproducible example, there's really not a lot I can tell from that.
Comment: Updated the question with reproducible example


Nested for loop is incorrect for the second number

Question: I am testing a simple nested for loop that combines year and month
year_time = range(2014, 2016)
month_time = [
    '0101', '0201', '0301', '0401',
    '0501', '0601', '0701', '0801',
    '0901', '1001', '1101', '1201'
]
for year_time in year_time:
    for month_time in month_time:
        print (str(year_time) + month_time)

The ideal output is 20140101, 20140201 ... 20151101, 20151201. However, the actual output is 20140101, 20140201 ... 20151.
Where do I get wrong?
Answer: Your for-loop variable (month_time) is shadowing the list after first iteration of outer loop (after year is changed), so the second iteration of inner loop iterates over string '1201'.
What you need is to change names:
years = range(2014, 2016)
months = ['0101', '0201', '0301', '0401', '0501', '0601', '0701', '0801', '0901', '1001', '1101', '1201']
for year in years:
    for month in months:
        print("".join([str(year), month]))

(I also replaced concatenation with a .join, that's a more pythonic way to join strings, especially if you have more than two of them)
Answer: That worked for me, you should try to use 'step', like range(1,10,2)
or ,instead, multiple range()...
year_time = range(2014,2016)
year_time_2 = range(2015,2017)

month_time = ['0101', '0201', '0301', '0401', '0501', '0601', '0701', '0801', '0901', '1001',
              '1101', '1201']

# Range for 2014
for x in year_time:
        for month in month_time:
            print(str(x) + month)

# Range for 2015-2016
for n in year_time_2:
    for month in month_time:
        print(str(n) + month)

Comment: This doesn't explain what the problem was.
Comment: Because there wasn't an error, just add a new range and that's done ! :)
Comment: No, there was no error, but there was unexpected behaviour which was caused by a very specific mistake in the code.


SQL Most Efficient Way to Select another query

Question: I have the following table setup:
TableA
Name    Loc
Bob     US
Bill    CA

TableB
Name    Phone    Updated
Bob     123      121011
Bob     321      121150

I have table A and B where I want to run a query that joins the two and gets the most recently updated (highest value in Updated (whichever number is larger)) phone number from table B and only returns one line. I currently am using this query:
select
      A.Name,
      A.Loc,
      B.Phone
   from
      TableA A
         INNER JOIN TableB B
            on A.Name = B.Name
   where
      A.Name = 'Bob'

I'm not sure how I can sort only B.Phone by column updated and return only the line containing in one query:
Bob, US, 321 (321 because it is the highest value updated)

Any help or insight would be much appreciated.
Comment: Please do not link pictures, but add queries and data as text to your question. It makes it a lot easier to copy and paste for answerers trying to help you. Which DBMS are you using?
Comment: sql server, sorry
Answer: You have a couple things going on.  I edited the post and manually put the text of the sample data and the sql query (you did not have commas after each column per the image).
Also, your data shows an updated column, but unclear what it is... You mention the 123 record is the highest update value, but not sure on context.  Does not look like a DATE field.  If it IS, then you should always use proper data types such as a datetime field.  It will be easier in the long run when you need to query things on date ranges vs some fixed text format that needs to be restructured to get what is intended.
Please EDIT your post and put the clarification in there and you can comment me back to review.  Dont try to put long-winded/content in a comment.  Edit and update your actual post.
REVISED QUERY.
Another clarification on a bad sample data.  By using just a name, what if there were 100 "Bob" names in Canada.  Use an auto-increment ID key to tie things together, not just a name.  What if Bob changes the name to Robert, then you are all messed-up.  For secondary tables from their respective primary, use the ID that ties back to the original.
To get what you want, you will need a sub-query to find what the most recent date IS for the phone lookup secondary table for the person in question.
select
      A.Name,
      A.Loc,
      B.Phone
   from
      TableA A
         INNER JOIN
         ( select
                  B1.Name,
                  max( B1.Updated ) LatestRecord
              from TableB B1
              where B1.Name = 'Bob'
              group by B1.Name ) MostRecentPhone
            on A.Name = MostRecentPhone.Name
            JOIN TableB B
               on MostRecentPhone.Name = B.Name
               AND MostRecentPhone.LatestRecord = B.Updated
   where
      A.Name = 'Bob'

So, the first FROM and WHERE clause gets your "Bob" requirement.
The inner join to the sub-query gets the name and the most recent updated stamped record regardless of the phone PER name, but also filters only on "Bob", but again, issue if dealing with IDs vs name matches.
So now I have the subquery returning Bob with the Updated value = 121150
Now, can join again to the FINAL TableB instance based on the matched name, AND the updated value matching that of the subquery.
Comment: I edited and updated my post. I am using Julian Dates in the updated column.  Basically the larger number is the most recently updated in this case.
Comment: @jadenohiokan, if you EVER want easier querying, filtering, reporting in the future, dont use that, stick with proper date/time columns.  Also, confirm the Julian sample data as I pasted from the image.  321 appears to be the highest number you ACTUALLY want... Is that correct?
Comment: Yes, I wrote it down wrong the first time.
Comment: @jadenohiokan, revised answer to show query.
Answer: Perhaps a CROSS APPLY (SELECT TOP 1...) approach would be simplest.
select
    A.Name,
    A.Loc,
    LATEST_B.Phone
from TableA A
cross apply (
    select top 1 B.*
    from TableB B
    where B.Name = A.Name
    order by B.Updated desc
) LATEST_B
where
      A.Name = 'Bob'

For best performance with big data, ensure that you have an index on TableB(Name,Updated).
Answer: You can use the Rank() function to generate the results you are looking for:
Select
  Name,
  Loc,
  Phone
From ( Select
         A.Name,
         A.Loc,
         B.Phone,
         Rank() Over (Partition By A.Name Order By B.Updated Desc) as Rank
       From TableA A Inner Join TableB B On A.Name = B.Name
       Where A.Name = 'Bob') As DataTable
Where Rank = 1


Does a refrigerator compressor need settling time after being laid on its back or side?

Question: A friend of mine mentioned that after laying my fridge on its side or back, that I need to let it sit for several hours before plugging it in.
In the discussion, he said that it was to allow the lubricants and refrigerants settle back toward the compressor so that it doesn't dry-pump, causing potential damage.
Now this does make a degree of sense, but is this actually necessary or standard practice? I've moved many times in my life and I can't think of a single time that we've ever done that... so is it actually needed?
I doubt it makes any large difference, but I have a Frigidaire that is about 5 years old.
Comment: You've been lucky.
Comment: I have moved refrigerators before, and tilted them on a refrigerator dolly, but never laid one horizontal. I have read that one should wait 24 hrs before turning on a refrigerator after it has been laid horizontal.
Comment: "several hours" Please advice your friend 'several' may not even be enough, depending on how rough it was handled, size and exact type of system. The 24h mentioned in one of the answers should be considered a minimum. You simply don't want to risk it.
Answer: As a certified HVAC person I can tell you it might work after standing back up and plugging in but depending on the system the oil drains from the compressor. On many units it takes time to make its way back to the compressor (if it can at all). I have seen brand new window AC units that were shipped on their side and turned on after several hours that blew the breaker. The oil went into the coils, and because of the design, the oil was trapped enough so when the unit was plugged in it destroyed the compressor.
Comment: "doesn't require messing with glasses and window-frames (just making a hole in the wall and covering it)"  Opening a hole in the wall is a fairly big deal, if you don't want it to cause leaks when it rains, and colder climates you may need to do something special in the winter.  Not to mention that altering the structure of the building (the hole in the wall) will certainly require permits and possible inspection.  Or I can buy a $200 window unit.
Comment: @einpoklum And the window units don't require putting holes in the wall to connect an indoor and outdoor unit (which most people would hire someone to do that part). Trade offs. I think the window units have also been around a lot longer.
Comment: @jpmc26: Split/"ductless" models  - which don't sit smack in the middle of your view, and doesn't require messing with glasses and window-frames (just making a hole in the wall and covering it) - are pretty cheap where I'm from (Israel/Palestine); $400 gets you something reputable and basic.
Comment: Those window ACs you have in the US are the weirdest things...
Comment: @einpoklum -- the caveat is true for anything that uses compression-refrigeration and a hermetic compressor though
Comment: @einpoklum They're a relatively cheap way to improve on rooms/buildings that lack AC. Sure, they're not the greatest thing ever and don't make a lot of sense if your build has AC that works well, but adding or fixing an entire building's AC can be quite costly. Free market at work for you. ;)
Comment: I think that second sentence is key. I've never seen those things in Europe or back home.
Comment: @Andy did you comment on another post? This one is about a fridge?
Comment: Sorry that was in response to one of @einpoklum comments
Comment: One thing I'll note is the standalone units with a hot air hose to the window are significantly louder than the window mount ones. It makes a big difference for bedroom use.
Answer: Instruction manuals for refrigerators and freezers typically tell you to transport upright, or if not possible to allow to stand 24 hours upright before using.
Answer: AFAIK this is to let the coolant and the oil settle back into place.  The system contains refrigerant as gas and liquid, also liquid oil.  Pumping one when the motor should be pumping the other is not going to go well.  Either the pump will be trying to compress a liquid (very difficult) or will have insufficient liquid (could overheat, overspeed, wear rapidly, run out of oil.)  If the oil is in the pipes when it should be in the motor, lubrication will suffer and the motor will be damaged.  For all the times you get away with it, either the general reliability is reduced or you were just fortunate.
My son works for a domestic appliance company's support line and he gets this regularly.  Day after day, he has to tell the customers that they should have read the instructions.  Unfortunately, they have generally not followed these instructions and are expecting that his company will replace their "faulty on arrival" refrigerator, which ain't going to happen.  Of course, he has to have a broad back....
Answer: I have a portable A/C. The manual states that if ever tipped on its side e.g. for transport, it must be left upright for some number of hours (I forget how much) before starting, so that liquids can settle so they won't enter the compressor.
Whether for a fridge or an A/C, the compressor is designed to compress gas, not pump liquid. Compressed refrigerant condenses to a liquid in the (aptly named) condenser where heat is removed from the system, and evaporates in the (again aptly named) evaporator where it picks up heat to cool your food, your room, or your house, before returning to the compressor. Liquid, whether refrigerant or oil, is incompressible, so if any enters the compressor (other than a trace of oil to keep things lubricated), there's likely to be a problem.
It's possible that some refrigeration devices are designed in such a way that tipping won't cause liquid to arrive at the compressor, or the compressor is designed to be tolerant of liquid. But, I'd never assume so.
Comment: WRT your last paragraph, we run a boat fridge (12/24V compressor) in our campervan.  That can tolerate a lot of tipping without needing settling time, but still less than 90°
Answer: We just got a new refrigerator.  The old was moved elsewhere in the house.  The installers said it was fine to turn the new one on right away (new design) even though they had tipped it on it's side, but the old one we were supposed to wait 2 hours before plugging it in.  Note that it never tipped more than about 15 degrees from vertical in the move.


BigQuery: extract date from datetime with timezone

Question: I am trying to return a column in BigQuery with the extracted date from the column start_time.
The values in the column are of the format: 11/27/2019 14:40:15 CET +0100
I've written following code:
SELECT EXTRACT(DATE FROM TIMESTAMP(start_time))
  AS date
  FROM `cc_raw.cc_exp`

However I am getting the error message: Invalid timestamp: '11/27/2019 14:40:15 CET +0100'
How do I go about here?
Many thanks,
Janine
Answer: Below is for BigQuery Standard SQL
#standardSQL
SELECT
  EXTRACT(DATE FROM PARSE_TIMESTAMP('%m/%d/%Y %H:%M:%S %Z %z', start_time)) AS date
FROM `cc_raw.cc_exp`

You use PARSE_TIMESTAMP function with '%m/%d/%Y %H:%M:%S %Z %z' to handle timestamps presented as strings formatted as '11/27/2019 14:40:15 CET +0100'
You can do quick test by running below
#standardSQL
SELECT
  EXTRACT(DATE FROM PARSE_TIMESTAMP('%m/%d/%Y %H:%M:%S %Z %z', '11/27/2019 14:40:15 CET +0100')) AS date


How to configure Postman so it will generate curl code for Windows

Question: Postman generates curl code that is not compatible with Windows console. For example, it will generate following curl code for GET https://google.com?q=test:
curl -X GET \
  'http://google.com?q=test' \
  -H 'Cache-Control: no-cache'
This code cannot be simply copied and pasted into Windows command console as-is. I have to remove backslashes, carriage returns and replace ' with "
Is it possible to configure Postman so it will generate curl code like below?
curl -X GET "http://google.com?q=test" -H "Cache-Control: no-cache"
I'm using Postman application for Windows-64 version 6.1.4
Answer: On the "Generate code snippets" modal, there's a "Settings" option.
In order to not have the backslashes/ generate the snippet as oneliner, you need to disable Generate multiline snippet.
There is no option to choose if single or double quotation marks.


Name an Armor Stand using the Standard Galactic Alphabet

Question: The Standard Galactic Alphabet is what appears in the Enchanting Table. Is there a way to give a name to an Armor Stand using these character.
I know there is a LingoJam Translator that give ASCII characters that look like the SGA, but that is not what I'm looking for. Can I use the same characters as the Enchanting Table?
Answer: What the enchanting table uses is just a different font. The text in it is just a random arrangement of words listed here (archive).
So the way to write with it would be a resource pack that replaces the font or to use Unicode characters that look similar, which you have denied for some reason.
Answer: Unfortunately, there is no way to name any entity using the Standard Galactic Alphabet. The closest you will get is to use the LingoJam translator characters. You can only name an entity with Unicode characters so you can not name an armor stand with Standard Galactic Alphabet characters. You could create a texture pack and change some of the Unicode characters to look like Standard Galactic Alphabet Characters. Here is some more information on that. https://minecraft.wiki/w/Resource_pack#Fonts
Answer: You can name an amorstand with a custom font by using the "font" parameter. You can also give yourself a nametag with the font you want.
Here are few exemples with commands:
<code>/summon minecraft:armor_stand ~ ~ ~ {CustomName: '{"italic":false,"font":"minecraft:alt","text":"custom name"}'}
</code>

This command spawn an armorstand with a custom name

<code>/give @s minecraft:name_tag{display:{Name:'[{"text":"your text here","italic":false,"font":"alt"}]'}} 1
</code>

This command give you a nametag with a custom name, you can rename an armor stand with it

<code>/data merge entity @e[type=minecraft:armor_stand,sort=nearest,limit=1] {CustomNameVisible:1}
</code>

This make the armor stand name visible because it's not normally
Comment: These commands work. Thank you. This was a very helpful answer.


Mock Static Methods in JUnit5 using PowerMockito

Question: Need help for Mocking Static methods using JUnit5 with PowerMockito framework.
Powermock junit5 and mockito2.x not working RunnerTestSuiteChunker not found
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;

import static org.mockito.Mockito.*;

@PrepareForTest(EnvironmentUtils.class)
@RunWith(PowerMockRunner.class)
public class RuleControllerTest {

        @Before
        public void setup() {
            PowerMockito.mockStatic(EnvironmentUtils.class);
        }

        @Test
        public void test_rule_create_rule() throws IOException {
            when(EnvironmentUtils.isCF()).thenReturn(true);

        }
}

and pom.xml

<dependency>
    <groupId>org.mockito</groupId>
    <artifactId>mockito-core</artifactId>
    <version>2.23.4</version>
    <scope>test</scope>
</dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>5.4.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>5.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>5.4.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>2.0.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito2</artifactId>
            <version>2.0.2</version>
            <scope>test</scope>
        </dependency>

I followed Junit5 sample from here,
1) https://www.baeldung.com/junit-5
2) Junit5 mock a static method
But facing an issue as, I know there is an existing issue for Junit5 with powermock but any one knows any other way to Mock static methods using JUnit5 using powermock.
Comment: @Progman i see a clear question here, along w/ how he tried to resolve. I disagree with your comment :(
Comment: Please see: [Why is "Can someone help me?" not an actual question?](http://meta.stackoverflow.com/q/284236).
Answer: With mockito v 3.4.0 we can simply use mockStatic() method without powermock library :
 try (MockedStatic mocked = mockStatic(Foo.class)) {
   mocked.when(Foo::method).thenReturn("bar");
   assertEquals("bar", Foo.method());
   mocked.verify(Foo::method);
 }

assertEquals("foo", Foo.method());

Latest documentation and example :
https://javadoc.io/static/org.mockito/mockito-core/3.5.10/org/mockito/Mockito.html#static_mocks
Comment: but with that you can mock only one method in context, right?
Answer: As your link suggests, still you can't do power mock stuff with junit-5 directly, simply because there's no PowerMockRunner (Extension) still available for junit-5.
However, In your above code possibly what has gone wrong is this line.
when(EnvironmentUtils.isCF()).thenReturn(true);

Here, note that you are using when of mockito (by import static org.mockito.Mockito.*;)
Instead, you have to use the one of PowerMockito. So
Remove this line import static org.mockito.Mockito.*;
Instead, add this. import static org.powermock.api.mockito.PowerMockito.*;
Answer: You're using @Before which is a JUnit4 annotation. JUnit5 in turn has @BeforeEach / @BeforeAll (whichever suits your requirement). Also, your import for @Test is from JUnit4 but not from JUnit5 which should be org.junit.jupiter.api.Test ;)
Comment: Tests are run with `junit-vintage-engine`. This doesn't address PowerMock or the static method question


Upgraded to Ubuntu 16.04. Extremely slow boot now. Any suggestions?

Question: I don't know why I updated lol. My 14.04 booted in about 3-10 seconds. Now it takes about 3-5 minutes to boot after I upgraded to 16.04.
Any suggestions to speed up the boot time?
I ran systemd-analyze blame and this is what i get
5.636s NetworkManager-wait-online.service
      1.306s apache2.service
      1.055s mysql.service
       791ms apparmor.service
       732ms plymouth-read-write.service
       651ms winbind.service
       651ms nmbd.service
       639ms dev-sda5.device
       592ms systemd-backlight@backlight:intel_backlight.service
       539ms samba-ad-dc.service
       380ms smbd.service
       283ms ModemManager.service
       276ms upower.service
       266ms accounts-daemon.service
       250ms thermald.service
       219ms systemd-logind.service
       218ms NetworkManager.service
       188ms gpu-manager.service
       181ms irqbalance.service
       179ms ondemand.service
       166ms speech-dispatcher.service
       159ms grub-common.service
       148ms apport.service
       130ms lm-sensors.service
       124ms console-setup.service
       122ms binfmt-support.service
       115ms alsa-restore.service
       100ms lightdm.service
        95ms console-kit-log-system-start.service
        90ms systemd-rfkill.service
        88ms systemd-udev-trigger.service
        87ms iio-sensor-proxy.service
        87ms pppd-dns.service
        86ms systemd-localed.service
        81ms keyboard-setup.service
        72ms systemd-user-sessions.service
        72ms rsyslog.service
        55ms systemd-update-utmp.service
        54ms udisks2.service
        50ms networking.service
        48ms wpa_supplicant.service
        48ms systemd-journald.service
        44ms console-kit-daemon.service
        39ms polkitd.service
        38ms avahi-daemon.service
        37ms systemd-tmpfiles-setup.service
        37ms colord.service
        37ms plymouth-start.service
        37ms systemd-fsck@dev-disk-by\x2duuid-F607\x2dBE56.service
        33ms systemd-modules-load.service
        32ms email@example.com
        31ms bluetooth.service
        28ms resolvconf.service
        25ms dns-clean.service
        24ms systemd-hostnamed.service
        23ms proc-sys-fs-binfmt_misc.mount
        21ms systemd-udevd.service
        19ms dev-mqueue.mount
        17ms systemd-journal-flush.service
        14ms boot-efi.mount
        13ms systemd-timesyncd.service
        12ms systemd-tmpfiles-setup-dev.service
        12ms sys-kernel-debug.mount
        10ms rtkit-daemon.service
         9ms dev-sda6.swap
         9ms kmod-static-nodes.service
         8ms dev-hugepages.mount
         7ms systemd-remount-fs.service
         7ms ufw.service
         7ms systemd-sysctl.service
         7ms systemd-update-utmp-runlevel.service
         5ms ureadahead-stop.service
         5ms rc-local.service
         4ms systemd-random-seed.service
         3ms plymouth-quit-wait.service
         3ms sys-fs-fuse-connections.mount
         3ms setvtrgb.service
         1ms snapd.socket

Answer: Well I fixed it. My /etc/fstab file had the wrong uuid for the swap partition so it was looking for something that did not exist.
I used Disks to see in what partition it was in and then
sudo blkid /dev/sda6

to get the correct uuid and changed it on my fstab
Comment: This was a great insight for my problem. I had a similar issue with fstab, it was using device names instead of UUIDs (my RAID'd device names changed when upgrading from 14.04 to 16.04).
Comment: @TLin glad I could help. Thats why is always good to post an answer, even to your own question :)


ASP.NET create excel file fails

Question: I have the following method to create a excel file.
Private Sub ExportToExcel()

    Dim dv As DataView = CType(SqlDataSourceExel.Select(DataSourceSelectArguments.Empty), DataView)

    Dim dt As DataTable = dv.ToTable()

    Dim query = From r In dt.AsEnumerable()
               Select New With {
                   .callid = r.Field(Of Decimal)("callid"),
                   .Problem = r.Field(Of String)("Problem"),
                   .Details = r.Field(Of String)("Details"),
                   .Entered_Date = r.Field(Of DateTime)("Entered_Date"),
                   .Name = r.Field(Of String)("Name"),
                   .comments = ""
                   }

    Dim sb As StringBuilder = New StringBuilder()
    Dim fileName As String = "list.xls"

    'sb.Append("Call Id \t Problem \t Details \t Entered_Date & \t Logged by \t Comments")

    For Each row In query
        sb.Append(row.callid & "\t" & row.Problem & "\t" & row.Details & "\t" & row.Entered_Date & "\t" & row.Name & "\t" & row.comments & "\n")

    Next

    HttpContext.Current.Response.Clear()
    HttpContext.Current.Response.ContentType = "Application/x-msexcel"
    HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + fileName)
    HttpContext.Current.Response.Write(sb.ToString())
    HttpContext.Current.Response.End()

End Sub

I'm getting following error when the code is executed. How can I fix it?
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
Answer: You can use the code below:
DataTable DtReqDetails = (DataTable)ViewState["DtReqDetails"];
        if (DtReqDetails != null)
        {
            string attachment = "attachment; filename=History.xls";
            Response.ClearContent();
            Response.AddHeader("content-disposition", attachment);
            Response.ContentType = "application/vnd.ms-excel";
            string tab = "";
            foreach (DataColumn dc in DtReqDetails.Columns)
            {
                Response.Write(tab + dc.ColumnName);
                tab = "\t";
            }
            Response.Write("\n");
            int i;
            foreach (DataRow dr in DtReqDetails.Rows)
            {
                tab = "";
                for (i = 0; i < DtReqDetails.Columns.Count; i++)
                {
                    Response.Write(tab + dr[i].ToString());
                    tab = "\t";
                }
                Response.Write("\n");
            }
            Response.End();
        }

ASP.NET create excel file fails


Specifying an Upper Bound for a Monotonically Increasing Sequence

Question: I would like to specify an upper bound of a sequence where $a_1=\sqrt2$ and each subsequent term is given by $a_{n}=\sqrt{2+ a_{n-1}}$
I know this sequence converges to 2 from a separate proof and also that it is monotonically increasing (one can prove this with induction), so any number larger than 2 works for an upper bound. That being said, I would like to approach this by showing a contradiction in the negation statement for boundedness. In other words, I want to explicitly state a $u$ so that there does not exist a $n$ where the $n^{th}$ term of the sequence is larger than $u$, and show that this is the true with some sort of algebraic manipulation.
I have looked at a few similar questions on this site and elsewhere, but I have not yet found an instance where one shows boundedness in this way.
Answer: Use induction. (I've taken $u = 4$ below.)
We have $a_1 = \sqrt{2} < 4$. Now, let $n \in \mathbb{N}$, and suppose $a_n < 4$. Then
$$
a_{n+1} = (2+\sqrt{a_n}\,)^{1/2} < (2 + \sqrt{4} \,)^{1/2} = 2 < 4.
$$
Therefore, $a_n < 4$ for all $n$, by mathematical induction.
(I could have taken $2$ for $u$, but I chose $4$ for $u$ to make things nicer.)
Comment: Exactly what I was looking for. With the edited definition of the sequence, for u=4, we have a_{n+1}<sqrt(2+4)<4 and reach the same conclusion.


Passing non serializable object between screens in react native

Question: I am working on ble related app. I am supposed to persist ble connection with device while navigating in app. I tried passing deviceObject which i am getting from ble connection using react-native-navigation passProps functionality, but it is not working for non-serializable object.
I am using 'react-native-ble-plx' library for ble connection.
Can anyone help me with this?
Comment: then it will good just store your connected device in redux store..it 'll help you a lot .. then you can get it in all of your app
Comment: are you using Redux/Saga lib for managing app state ??
Comment: yes.. i am using redux  @tahirmahmood
Comment: Thanks... @tahirmahmood
It is working.
Answer: As per suggested by @tahirmanmood, best possible solution is to store your connected device in redux store.. so you can use it anywhere in your app later.


Cartesian Product of a normal set and a set with an element which is a set.

Question: What is the Cartesian product of A and C?
Where:
A = {0, 1, {2, 3, 4}}
C = {1, 5}
Pretty standard for the first 2 elements of A.
So far I have {(0,1), (0,5), (1,1), (1,5).... }
But for the last element of A, is it {((2,3,4),1), ((2,3,4),5)}, or do I have to make a pair for each element in {2,3,4}?
Comment: Observe that $\{2,3,4\}$ is an element of $A$.  Therefore you have to treat it like an element.  Therefore, you at least have some ordered pair $(\{2,3,4\}, 1) \in A \times C$.
Answer: Here's a way to get around the confusion. Write $x=\{2,3,4\},$ so that $A=\{0,1,x\}.$
You should easily be able to see that $$A\times C=\bigl\{(0,1),(0,5),(1,1),(1,5),(x,1),(x,5)\bigr\}.$$ Now, replace each instance of $x$ with $\{2,3,4\},$ and you're done.
As a side note, try not to worry too much about sets that have sets as elements--that happens quite a lot.


Are comments allowed on the same line as preprocessor directives and what is their meaning in such case?

Question: I am thinking about something like this:
<code>#include <iostream> // Comment
</code>
Well, cppreference.com ( http://en.cppreference.com/w/cpp/preprocessor ) claims that:

The preprocessing directives control the behavior of the preprocessor. Each directive occupies one line and has the following format:
# character
     preprocessing instruction (one of define, undef, include, if, ifdef, ifndef, else, elif, endif, line, error, pragma)
     arguments (depends on the instruction)
     line break

So well, a complete specification for the entire line is given, and there's no place for a comment there. Suggesting comments are disallowed on such lines.
However, both g++ and clang++ accept such intput even with -Wall -Wextra -Wpedantic. Also cplusplus.com provides examples of such comments: http://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
I am even more confused by the fact that somebody told me that "It's still valid to put comments in # lines, but they might not mean what you want". I'm not sure how this could be the case, since according to http://en.cppreference.com/w/cpp/language/translation_phases comments are replaced by space characters before the preprocessor is launched – so if they are allowed on # lines, how could they interfere with the semantics of such a # line?
Answer: As stated in the translation phases document you linked to: Comments are replaced with a space in step 3 of phase 3. The preprocessor is executed in phase 4.
So by the time the preprocessor processes <code>#</code> lines, comments have been turned into whitespace, which generally have no impact on the behavior of the preprocessing directives.


Cakephp images from css using themes

Question: im using themes in an app im doing, and need a global css/img/js folder
i have tried using app/webroot as this folder, but cant get any css from a theme to show the images.
I have a setup like :: /app/views/themed/my_theme/webroot/css/file.css
With some css that looks like:
...
body{
     background-image: url('../img/file.jpg');
}
...

if i have the image in /app/views/themed/my_theme/webroot/img/file.jpg everything works 100%  but when i put the image in /app/webroot/img/file.jpg it will not show. i have tried all sorts of combinations for the
i have also tried using a plugin dir like app/plugins/my_plugin/webroot/img/file.jpg but the various paths ive tried will not show the image either.
any ideas how i can get the image to show? i dont mind if its for webroot/ or in plugins/xyz/, just as long as i can use the same image in many different themes with out having to duplicate the images
when the image is in /webroot/img i can use the full path like url(http://locahost/my_app/img/file.jpg) and it works.
things that dont work
url("img/file.jpg")
url("/img/file.jpg")
url("../img/file.jpg")
url("/../img/file.jpg")
url("../../img/file.jpg")
thanks.
Comment: steve and fahad19 had it right, ended up adding vhosts to my apache config so that there is no subfolders and then everything was good again
Answer: In your CSS file
body{
     background-image: url('/img/file.jpg');
}
This will use the root area to find the image in /app/webroot/img/file.jpg
Answer: CSS has urls for images relative to the path it is placed in.
CSS files from my_theme are linked like site.com/theme/my_theme/css/style.css in the browser. So if you want to use an image from app/webroot/img in your theme's CSS, use url(../../../img/image.png)
Answer: I have not tried that but the cookbook says:

If you want to keep your theme assets
  inside app/webroot it is recommended
  that you rename app/webroot/themed to
  app/webroot/theme.

Cakephp images from css using themes


Wall switch not working anymore after ceiling fan replaced

Question: We had to replace a ceiling fan that previously operated from 2 switches (1 fan, 1 light). When we took it down all we saw was 1 main wire with a black, white & ground coming out of ceiling.  New fan with light hooked up (no remote so connections were grounds, whites and blue/black from fan to black in ceiling).  Now only 1 of the switches powers both light & fan and the other switch is dead.  I'm worried that there was another wire that we missed up in the ceiling that made both switches to operate independently before.
Is there a reason this would happen?
Comment: Turn off the breaker and pull both switches away from the box/es with the wires attached.  take pictures and post/edit them in your question.  I do believe you should have more than one main wire/cable  in the ceiling.
Answer: Take a good look in the ceiling box. There's probably another wire, more that likely a red one up in there. It was probably jammed up in the box and when you removed the ceiling fan, the small light wire connection broke before pulling the other wire down with the rest.


Windows compact framework 3.5 combobox dropdown

Question: I'm updating an existing application that scans barcodes and is written in VB.net running on windows compact framework 3.5. The scanner is a POCKETPC running windows mobile handheld 6.5. I have a combobox DropDownStyle='DropDown'. I want to programmatically drop down the box.
I have coded the following:
 <DllImport("coredll.dll", SetLastError:=True)> _
    Public Shared Function SendMessage(ByVal hWnd As IntPtr, _
                                      ByVal Msg As Integer, _
                                      ByVal wParam As Integer, _
                                      ByVal lParam As Integer) As IntPtr
    End Function
  Const CB_SHOWDROPDOWN As Int32 = &H14F
  SendMessage(cmbVisitoringUnit.Handle, CB_SHOWDROPDOWN, 1, 0)

The return code is 1 but no dropdown takes place. What am I missing?
Answer: Based on a lot more testing I have done, let me answer my own question. In order for the dropdown message to the combobox to work the combobox must have focus, so the code must first set focus to the control and then send the message to dropdown. There is another quirk with the combobox. If it is dropped down and it losses focus for any reason the control cancels the dropdown and then destroys the event. This leads to an impression that the program is not responding and the user needs to repeat the action again. The only fix I could come up with is to always cancel the dropdown where possible.


Installing a ceiling fan into a socket with 3 wires jammed into the socket

Question: I recently purchased a ceiling fan thinking it would be a fun DIY project but when I went to install it, I came across many problems. I have attached a photo of my ceiling fan socket on the ceiling below.

It appears as if there are 4 wires (fan only calls for 3) and not only that, but 3 of the 4 are jammed up into the left hole. If you look, the red wire is the only one free, the yellow black and grey are jammed up into the left hole. I have tried tugging on the jammed wires and they seem to budge an inch at max. I am afraid that if I pull too much I will break the wires and then I would be in a really bad position. Is there a way for me to unscrew the whole wall plate to see what is going on with the wires? I am confidant that I can install the fan once I get all the wires unstuck and have the leads exposed. I have a multimeter handy to measure voltage if necessary. I live in the U.S. and this house was built 25 or so years ago (this socket's wiring hasn't been touched since then).
Answer: I have a couple of observations and concerns.  First, it looks like this is a shallow box with conduit or EMT connectors. The looping conductors are usually a sign of continuous run THHN.  I also suspect this could be a 3-way switched circuit or the yellow is being used as grounding/bonding conductor.  However testing must be done to confirm these suspicions.
The other concern I have is the ability of this box to support the weight and torque of a fan. Depending on how strong the mounting is, you may want to consider a weight rated fan mounting box. If the box is not securely mounted, your fan will be unbalanced and wobble, at worse, it will pull the box out of the ceiling and drop. Perhaps they don't show in your pic, but I don't see any screws mounting the box to a framing member. If it is secured in place by the conduit only or a flimsy side ear mount, it will not work well for a fan.  Check it out carefully.  Good Luck.
Comment: Does that screw in the middle go into a joist or ceiling member? If so, that might be sufficient for support.
Comment: I think it screws into the socket directly. I think I might have to hire somebody on this one. Thanks for the advice.
Answer: Pulling will get you nowhere, I suspect - those wires are not just stuffed up there, they are actually going through this box on their way elsewhere.
The red one that is loose - was that capped or anything? Or was it just hanging out?
Was there ever any kind of fixture on this box (I'm gonna guess no).
Also, could the 'grey' actually be white? And might the yellow be green? There's enough over-spray that I'm betting it's hard to be sure. Black/white/green/red would at least be a sensible set of wire colors (though the red hanging loose wouldn't make sense).
Comment: It had a yellow twisty cap on it. There was no fixture on it either. I got a brighter light and it seems as if that wire is defiantly the colors I mentioned. The red could be orange though. I am as confused as you are with the coloring... I am going to get a tool I have to trace wires and see if it is linked to other sockets.


How to connect with Flash One 1x EVDO CDMA (type st804) Modem

Question: How to connect with Flash One 1x EVDO Modem? I cannot connecting with this modem. So, i cannot do apt-get updates. Please, i need it.
Comment: whats the output of lsusb ?
Comment: st-804 type of modem. I am newbie of Ubuntu/Linux.
Answer: connect the modem to your usb port . then click at network applet that will exists at top panel of your desktop . after clicking selectedit  connections . then there create a connection to your modem at mobile broadband with new option . give enough feta details like apn and all. then save it and click at  your network applets and select your connection .
Comment: Doing from mobile . some one please put in format . thank you .
Comment: It's doesn't work.
Comment: whats the problem you're getting ?
Comment: Ubuntu don't detect my device.
Comment: connect the modem to your usb port . then click at network applet that will exists at top panel of your desktop . after clicking selectedit connections . then there create a connection to your modem at mobile broadband with new option . give enough feta details like apn and all. then save it and click at your network applets and select your connection .

This step isn't work. My modem not detected.
Comment: give me output of lsusb


TeamCity pull-request-triggered build with merge

Question: I've been trying to configure our TC installation to work with the following scenario:
We have multiple developers working on multiple bugs in parallel. Our source code is stored in github and we are using pull requests. I'd like Teamcity to trigger a build on pull request as described here: http://blog.jetbrains.com/teamcity/2013/02/automatically-building-pull-requests-from-github-with-teamcity/ which seems quite easy to do. Unfortunately it looks like such configuration doesn't MERGE the pull request, but simply PULL it from the repository.
Let me give you an example:
Developer A opens pull request nr 1 (based on code version 0010). Developer B opens a pull request nr 2 also based on code version 0010. Current code version in the repository is 0015. Our TeamCity server for each pull request should first checkout the version 0015 of the source code, then merge changes in pull nr 1. If this merge is successful, then it should try and compile the code. Similar should be done for pull nr 2.
Mind you that I need TC to merge against the CURRENT version of the code in the branch, not just pull the version from the pull request.
Pull request nr 1 is reviewed and accepted, and merged into the production repository. This should trigger a rebuild of pull request nr 2, as now the current branch is not 0015, but 0015 with the code from pull nr 1.
I understand that with many pull requests, every merge triggers an avalanche of builds/rebuilds. But this is exactly what I need TC for. Part of the Continuous Integration process should be making sure that the source code from a pull request should merge with the current head without any conflicts.
After configuring the TC server as described in the link, it doesn't really merge against the HEAD, but simply performs git pull and compile. Which is not helpful at all, as this should always work (provided that the developer is compiling the code on their machine before they commit changes).
I'd appreciate any hints or ideas on how to set our CI environment co we can test an actual merge against the most current code, not just a simple compilation.
Answer: TeamCity can do this. Directions are in the link you pointed to:  (https://blog.jetbrains.com/teamcity/2013/02/automatically-building-pull-requests-from-github-with-teamcity/)
In short, use +:refs/pull/*/merge as the branch specification to have TeamCity use the merged PR branch. Using +:refs/pull/*/head just builds the unmerged branch as you are describing.
Answer: I don't believe teamcity can do that out of the box. You might be able to achieve it with making your own plugin but you're probably better off using a webhook.
Take a look at http://blogs.atlassian.com/2013/05/git-automatic-merges-with-server-side-hooks-for-the-win/ it describes something similar and has a script that you can repurpose to you needs.
Answer: TeamCity 8.1 introduced Automatic Merge functionality to merge a branch into another after a successful build.
https://confluence.jetbrains.com/display/TCD9/Automatic+Merge


Can't resolve com.google.android.gms.plus.Plus class

Question: I can't seem to resolve the Plus class from the Google Play services library. I've already imported the Google Play library into the project as an Android Library project through Eclipse. I'm also following the basic example from the getting started page.
My onCreate is currently this:
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this)
    .addApi(Plus.API, null)
    .addScope(Plus.SCOPE_PLUS_LOGIN)
    .build();
}

Eclipse flags the Plus class names because it can't resolve them so the code doesn't build.
Comment: I'm wondering if this needs you to check for updates in the SDK and maybe rebuild the Play Services library project. I notice that link was updated only yesterday. I'm not in a position to check for updates myself at the moment.
Answer: Thank you NickT. I just updated Google Play Services and the Plus class came with the library.
Comment: Make sure that you have the Google Play Services Version 15 or higher in your SDK manager.
Answer: This might sort out the issue
mGoogleApiClient = new GoogleApiClient.Builder(this)
        .addConnectionCallbacks(this)
        .addOnConnectionFailedListener(this)
        .addApi(Plus.API)
        .addScope(Plus.SCOPE_PLUS_LOGIN)
        .build();
Comment: It did. At the time, the constant Plus.API and Plus.SCOPE_PLUS_LOGIN wasn't available. I ran an update later that evening and it worked.
Answer: Have you set the meta-data in the manifest?
The all steps indicated in the getting started guide should be everything you need.
Comment: This right? -->
I had an xml error with it at one point but that's because I didn't import the library. The getting started guide should have everything I need.
Comment: Yes that is correct. You've cleaned and rebuilt? You have the correct imports? Seems like you're on the right path.
Comment: I even imported "import com.google.android.gms.plus.*;". The class I'm  looking for is "import com.google.android.gms.plus.Plus", but I can't seem to retrieve it.
Answer: Add this in your app/build.gradle:
compile 'com.google.android.gms:play-services:8.1.0'


Paste an object in addition to superscripts in ggplot labels

Question: I'm trying to achieve two things in a ggplot label, being to paste an assigned character variable as well as some text with superscript into the same label. However, I've only been able to do either of those two things but I can't seem to do both at the same time.
name = "Mary"
ggplot() + ylab(expression(paste(name~"BMI"~kg/mm^2))) #this can only do the superscript but not get the name
ggplot() + ylab(paste(name,expression("BMI"~kg/mm^2))) #this can get the name but not the superscript

Any help is appreciated, thanks!
Answer: Use bquote
ggplot() + ylab(bquote(.(name)~BMI~kg/mm^2))


How to receive click events on a div covered by an empty cell of a html table?

Question: In a web page, I have several overlapping html tables (set by using css style position:absolute). In the cell of one of these tables, there is a div element defined, with a click event on it (using jquery).
Here is the problem : if a div element is covered by an empty cell of another overlapping table, the div element wont receive click events anymore. One of the conditions to make this happened is that the covered div have to be set in DOM structure before the covering table.
See this jsfiddle for a better example. As you can see, red element dont receive click events anymore (because covered by the top empty cell of table containing blue element).
I know it sounds strange to have a page like this, but the reason is that in the real application these tables are ui-draggable (thus they can overlap), and the table structure is used to display small organizational charts).
Notes :
I cannot just exchange tables position in DOM or add a z-index on one of the tables to solve the issue, because as said earlier the tables are draggable (using jquery-ui) thus user can change the situation (blue can overlap red or red can overlap blue).
Comment: Here is a great solution to the same issue http://stackoverflow.com/questions/3680429/click-through-a-div-to-underlying-elements
Answer: The only way to do this with CSS, without modifying HTML, is to set pointer-events:none; to the overlapping table, and then pointer-events: all; to the specific TD that is blue.
See this fiddle.
Comment: Not supported by Opera or Internet Explorer but yes this is correct.
Comment: I confirm it works. I would have prefer a solution that works everywhere but that's acceptable. One other idea i had in mind was to catch click event from document mouseup event (that always occurs) and then check myself if that click occurs in one of the div's. if so, i would then fake a click event on div (using jquery trigger() method). anyway that solution sounds pretty complex and maybe wont work very well with jquery-ui.
Comment: Click the tick button then :)


Xcelium simulator in endless loop using Tcl for/while

Question: Could someone help me to understand why the below code hangs (i.e. stuck in an endless loop) in Xcelium simulator, and what should be the correct one?
for {set i 0} {$i < 2} {incr $i} { puts "i is $i"; }

set i 0
while {$i < 2} { puts "i is $i"; incr $1; }

The result for either for or while loop above is just an endless: i is 0
Comment: `incr i`, not `incr $i`
Comment: Yes, it's supposed to be ```incr i```. Now the thing works. Thanks a lot!
Answer: incr takes a variable name as input argument, so it should be incr i.
incr $i increments instead the variable 0. What happens if the variable does not exist depends on Tcl version. From the manual page:

Starting with the Tcl 8.5 release, the variable varName passed to incr may be unset, and in that case, it will be set to the value increment or to the default increment value of 1.


Run-time error 424: 'Object Required' error in VBA

Question: I am trying to stack data from several sheets in one mastershhet (the sheet where I am running this Macros). So its essentially the same code replicated a few times. I also want to highlight duplicates in the first column and thus last bit is about that. Can't figure out why do I keep getting 'Object Required' Error. Any help will be greatly appreciated.
Sub Stackdata()
Dim emptyrow As Long, lastrow As Long, lastcolumn As Long

Workbooks.Open "Declined.csv"
Worksheets(1).Select
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
lastcolumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(2, 1), Cells(lastrow, lastcolumn)).Copy
ActiveWorkbook.Close

Worksheets(1).Select
emptyrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(emptyrow, 1).Select
ActiveSheet.Paste

Workbooks.Open "Offersbutwithdrawn.csv"
Worksheets(1).Select
lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
lastcolumn = ActiveSheet.Cells(1, Columns.Count).End(xlToLeft).Column
Range(Cells(2, 1), Cells(lastrow, lastcolumn)).Copy
ActiveWorkbook.Close

Worksheets(1).Select
emptyrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Cells(emptyrow, 1).Select
ActiveSheet.Paste

Dim iWarnColor As Integer
Dim rng As Range
Dim rngCell As Variant

Set rng = Range("A1:A200") ' area to check '
iWarnColor = xlThemeColorAccent2
For Each rngCell In rng.Cells
    vVal = rngCell.Text
    If (WorksheetFunction.CountIf(rng, vVal) = 1) Then
        rngCell.Interior.Pattern = xlNone
    Else
        rngCell.Interior.ColorIndex = iWarnColor
End If
Next rngCell

End Sub

Comment: Please read this https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba. Also, refer to a wb & ws for each Range object
Comment: Note that the fancy quotes you used `" "` are not allowed in VBA you need to replace them with the normal ones `" "`. • Also `Workbooks.Open` needs the full path of the file.
Comment: Please tell us the line you are getting the error on
Comment: If you are using the same code repeatedly to do the same things to different files like this, then consider either using a Loop (with an Array of inputs) or a Subroutine that can be called with the File Name.
Comment: Hi Tim, the error is in 'Workbooks.Open "Declined.csv"' line.
Comment: @Ronnie You should read my comment again. It tells you why you get an error there.
Answer: I did shorten your code and deleted anything related to .Select to avoid errors. Thought I can't see where the error comes from, Let me know if this code works for you. If it doesn't come back after you debug the error line and tell us:
Option Explicit
Sub Stackdata()

    Dim emptyrow As Long, lastrow As Long, lastcolumn As Long, i As Long
    Dim wb As Workbook, wbSource As Workbook, arrWorkbooks, ws As Worksheet, wsSource As Worksheet

    arrWorkbooks = Array("Declined.csv", "Offersbutwithdrawn.csv") 'here you can add as many workbooks as you need

    'reference and declare workbooks and worksheets to avoid .Select
    Set wb = ThisWorkbook
    Set ws = wb.Sheets(1)

    'A loop through all your workbooks on the variable arrWorkbooks
    For i = 0 To UBound(workbooks)
        Set wbSource = workbooks.Open(arrWorkbooks(i), ReadOnly:=True) 'thought you need the full path before the file name
        Set wsSource = wbSource.Sheets(1)
        emptyrow = ws.Cells(ws.Rows.Count, 1).End(xlUp).Row + 1
        With wsSource
            lastrow = .Cells(.Rows.Count, 1).End(xlUp).Row
            lastcolumn = .Cells(1, .Columns.Count).End(xlToLeft).Column
            .Range(.Cells(2, 1), .Cells(lastrow, lastcolumn)).Copy ws.Cells(emptyrow, 1)
        End With
    Next i

    Dim iWarnColor As Integer
    Dim rng As Range
    Dim rngCell As Variant

    With ws
        lastrow = .Cells(.Rows.Count, 1).End(xlUp).Row
        Set rng = .Range("A1:A" & lastrow) ' area to check ' now it gets to the last row always
        iWarnColor = xlThemeColorAccent2
        For Each rngCell In rng.Cells
            vVal = rngCell.Text
            If (WorksheetFunction.CountIf(rng, vVal) = 1) Then
                rngCell.Interior.Pattern = xlNone
            Else
                rngCell.Interior.ColorIndex = iWarnColor
            End If
        Next rngCell
    End With

End Sub

Comment: This code returns a runtime error 1004: 'Declined.csv' can't be found. Its a bit odd that I am getting this error because that workbook is in the same folder and under the name exactly as defined in this code.
The error is in 'Set wbSource = Workbooks.Open(arrWorkbooks(i), ReadOnly:=True)' line.
Comment: Like the comment says... you need to reference the path... If it's in the same path a simple `wb.Path & "\" & arrWorkbooks(i)` would do it.


Playthrough 2 (TVHM) re-scaling?

Question:
Possible Duplicate:
How do subsequent playthroughs work?

I finished Playthrough 1 at Level 37. Then I (accidentally) went into Playthrough 2 (True Vault Hunter Mode) and barely progressed beyond a few minutes of wandering around. I believe Palythrough 2 would then scale to the same Level 37.
Then I went back to Playthrough 1 and killed the Warrior a number of times for loot and then went to the Pirate DLC. Say after I finished all these, I am at Level 41 and then I go into Playthrough 2 (again) for all the missions proper.

Will Playthrough 2 re-scale to my Level 41?
If not, will the subsequent missions catch up with my Level 41?

It is pretty boring already and not challenging with the Pirate DLC at Level 30 and not scaling to my Level 37.
Thanks in advance for your answers.
Answer: No They are not going to scale with your level.. the enemy level is dependent on area (map)
but don't worry because in later maps of TVHM you will find enemies up to level 52.
If you feel its boring then Kill Terramorphus the invincible & Vermivorus the invincible :D. I think its impossible if you don't have bee shield.
Comment: @Anto Its a booster kind of shield dropped by hunter hellquist  (orange drop). Best part of this shield is that it doesnt take away your shield with booster shot so you can keep firing booster shots. For terra I used conference call(shotgun) with lvl 60 bee shield(+50k Dmg). lets calculate per shot damage (6X3X(50000 + 5000)) = 990000 Damage pershot, It take 3-4 mags to finish him off.
Comment: "Bee shield" ?  What's that ?
Comment: Ok, it sounds crazy (and scary) :D
Comment: oops its level 50 bee shield
Comment: Yeah, I farmed Hunter for the Bee for more than 2 hours before getting one at Lvl 29 and then another at Lvl 30. I was like Lvl 36. But good enough for me to kill Warrior without Conference Call.
Comment: The DLC scale was capped at Lvl 30 for me. :(  I think quite a few would be above that at PT1 if the side quests were completed (and some farming), not to mention those already at TVHM when the DLC was released.
Comment: @wujoo Killing warrior is easy I am talking about Terrramorphus the invincible and vermivorus the invincible :D vermi gives a class mod having 6 skills with +5

Playthrough 2 (TVHM) re-scaling?


How to access the shared folder between two computers running ubuntu

Question: I have to computers running Ubuntu and I want to share files between those computer. these computers are already connected through a cross cable and sharing internet connection using firestarter. Both computers have samba installed.
In Desktop computer I have a shared folder How do I access it on the other one.
Answer: Option 1
Under Places, Connect to Server... Set Service type to Windows share, and fill in the details.
Option 2
In Nautilus, press CTRL-L, type smb://serverip/, e.g. smb://192.168.0.2, and press Enter.
Comment: Why do I need to use Samba/WindowsShare to connect two Linux computers?
Comment: when I do this, I see a folder written printer on it (I dont have any printer in the network). how do I change to the directory which is in ~/Desktop
Comment: If you have given the shared folder a share name then it should be accessible using, e.g. smb://serverip/sharename
Comment: Good question feeela. The choice of SSH are a much better solution for most Ubuntu-users (also in Files/Connect to server...). SSH are more modern and secure than the old and clunky Windows SMB-protocoll.
Comment: If SSH server is installed then this would indeed be the easiest solution. In this case, you can use ssh://serverip/.


Make a 'width: 100%' image placed below navigation become a background of navbar on mobiles

Question: If you look at what happens here when you reduce the screen width is that the big photo becomes shorter and shorter, still filling in the full 100% of the width:
https://mmistakes.github.io/minimal-mistakes/
Now, I don't find that appealing and would like to make that photo disappear and become a background of the whole top (navbar) part once the navigation bar becomes the button. However, I would like only a certain part of the photo to show up, not the whole width.
Any hints on how to achieve that?
Update: the tricky part here is that each page has its own image. Since this is jekyll, in theory, I could add a css entry in the  of each generated page for setting the background image of the navbar, but I'm not sure whether there is a more elegant solution.
Comment: background-width and position?
Answer: Put the picture as a background for your nav-bar and use the css background-position attributes.
Use viewport and let the image (the img-tag) disappear


Documentation of XPath Elements for NReco Videoinfo

Question: I wanna use NReco Videoinfo to access all information of a media file. You get a special attribute by calling a function GetAttrValue(xpath).
It wants a xpath for example "streams\audio\channels" (this is not the correct one I know) - but I don't find any documentation about all available attributes and their corresponding xpaths.
Does anyone can help?
Thanks a lot,
Ewald.
Answer: NReco.VideoInfo is a wrapper for 'ffprobe' command line utility (part of ffmpeg distribution) and as result you get everything that is returned by it with -print_format xml option.
You also can access this raw XML with MediaInfo.Result property which returns XPathDocument instance:
var ffProbe = new NReco.VideoInfo.FFProbe();
var videoInfo = ffProbe.GetMediaInfo(pathToVideoFile);
var rawXml = videoInfo.Result.CreateNavigator().OuterXml;


WiFi adapter not working on XPS 13 9310, Ubuntu 20.04

Question: I recently received an XPS 13 9310 from my new employer and replaced its operating system with Ubuntu 20.04.
I haven't been able to get the WiFi working correctly - sometimes the adapter will show up and work for a bit, and sometimes it won't.
Ethernet seems to work fine.
All the threads I've found by googling have similar issues but not quite the same and their solutions haven't worked for me - they mostly seem to be using older versions of Ubuntu and fix the problem by upgrading to a later version or the latest kernel. I've tried Ubuntu 21.04 and 18.04 and it didn't change anything.
I've also experienced an issue where the screen will randomly freeze, mouse and keyboard stop responding and I'm forced to power off and on again. I don't know if this is related.
Here are the outputs of various commands that may be helpful:
lshw -c network
*-network UNCLAIMED
       description: Network controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 14.3
       bus info: pci@0000:00:14.3
       version: 20
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix bus_master cap_list
       configuration: latency=0
       resources: iomemory:600-5ff memory:60531dc000-60531dffff
  *-network
       description: Ethernet interface
       physical id: 3
       bus info: usb@2:3
       logical name: enx00e04c68090d
       serial: 00:e0:4c:68:09:0d
       size: 1Gbit/s
       capacity: 1Gbit/s
       capabilities: ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8152 driverversion=v1.11.11 duplex=full firmware=rtl8153a-4 v2 02/07/20 ip=192.168.1.183 link=yes multicast=yes port=MII speed=1Gbit/s

dmesg | grep iwlwifi when the wifi is NOT working
[    2.256709] iwlwifi 0000:00:14.3: enabling device (0000 -> 0002)
[    2.259992] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-59.ucode failed with error -2
[    2.260085] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-58.ucode failed with error -2
[    2.260188] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-57.ucode failed with error -2
[    2.260201] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-56.ucode failed with error -2
[    2.261462] iwlwifi 0000:00:14.3: api flags index 2 larger than supported by driver
[    2.261473] iwlwifi 0000:00:14.3: TLV_FW_FSEQ_VERSION: FSEQ Version: 126.96.36.199
[    2.261475] iwlwifi 0000:00:14.3: Found debug destination: EXTERNAL_DRAM
[    2.261476] iwlwifi 0000:00:14.3: Found debug configuration: 0
[    2.261653] iwlwifi 0000:00:14.3: loaded firmware version 55.d9698065.0 QuZ-a0-hr-b0-55.ucode op_mode iwlmvm
[    2.313551] iwlwifi 0000:00:14.3: Detected Intel(R) Wi-Fi 6 AX203, REV=0x354
[    2.493386] iwlwifi 0000:00:14.3: base HW address: dc:41:a9:a9:29:8c
[    2.528071] iwlwifi 0000:00:14.3 wlp0s20f3: renamed from wlan0
[   16.126871] iwlwifi 0000:00:14.3: Error sending SCAN_ABORT_UMAC: time out after 2000ms.
[   16.126880] iwlwifi 0000:00:14.3: Current CMD queue read_ptr 26 write_ptr 27
[   16.128245] iwlwifi 0000:00:14.3: Loaded firmware version: 55.d9698065.0 QuZ-a0-hr-b0-55.ucode
[   16.128249] iwlwifi 0000:00:14.3: 0x00000000 | ADVANCED_SYSASSERT
[   16.128251] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status0
[   16.128253] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status1
[   16.128255] iwlwifi 0000:00:14.3: 0x00000000 | branchlink2
[   16.128258] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink1
[   16.128260] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink2
[   16.128262] iwlwifi 0000:00:14.3: 0x00000000 | data1
[   16.128264] iwlwifi 0000:00:14.3: 0x00000000 | data2
[   16.128266] iwlwifi 0000:00:14.3: 0x00000000 | data3
[   16.128268] iwlwifi 0000:00:14.3: 0x00000000 | beacon time
[   16.128270] iwlwifi 0000:00:14.3: 0x00000000 | tsf low
[   16.128272] iwlwifi 0000:00:14.3: 0x00000000 | tsf hi
[   16.128274] iwlwifi 0000:00:14.3: 0x00000000 | time gp1
[   16.128276] iwlwifi 0000:00:14.3: 0x00000000 | time gp2
[   16.128279] iwlwifi 0000:00:14.3: 0x00000000 | uCode revision type
[   16.128281] iwlwifi 0000:00:14.3: 0x00000000 | uCode version major
[   16.128283] iwlwifi 0000:00:14.3: 0x00000000 | uCode version minor
[   16.128285] iwlwifi 0000:00:14.3: 0x00000000 | hw version
[   16.128287] iwlwifi 0000:00:14.3: 0x00000000 | board version
[   16.128289] iwlwifi 0000:00:14.3: 0x00000000 | hcmd
[   16.128291] iwlwifi 0000:00:14.3: 0x00000000 | isr0
[   16.128293] iwlwifi 0000:00:14.3: 0x00000000 | isr1
[   16.128295] iwlwifi 0000:00:14.3: 0x00000000 | isr2
[   16.128297] iwlwifi 0000:00:14.3: 0x00000000 | isr3
[   16.128299] iwlwifi 0000:00:14.3: 0x00000000 | isr4
[   16.128301] iwlwifi 0000:00:14.3: 0x00000000 | last cmd Id
[   16.128303] iwlwifi 0000:00:14.3: 0x00000000 | wait_event
[   16.128305] iwlwifi 0000:00:14.3: 0x00000000 | l2p_control
[   16.128307] iwlwifi 0000:00:14.3: 0x00000000 | l2p_duration
[   16.128309] iwlwifi 0000:00:14.3: 0x00000000 | l2p_mhvalid
[   16.128311] iwlwifi 0000:00:14.3: 0x00000000 | l2p_addr_match
[   16.128313] iwlwifi 0000:00:14.3: 0x00000000 | lmpm_pmg_sel
[   16.128316] iwlwifi 0000:00:14.3: 0x00000000 | timestamp
[   16.128318] iwlwifi 0000:00:14.3: 0x00000000 | flow_handler
[   16.128743] iwlwifi 0000:00:14.3: Start IWL Error Log Dump:
[   16.128746] iwlwifi 0000:00:14.3: Status: 0x00000040, count: 7
[   16.128748] iwlwifi 0000:00:14.3: 0x20000066 | NMI_INTERRUPT_HOST
[   16.128750] iwlwifi 0000:00:14.3: 0x00000000 | umac branchlink1
[   16.128753] iwlwifi 0000:00:14.3: 0x80465D2E | umac branchlink2
[   16.128755] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink1
[   16.128757] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink2
[   16.128759] iwlwifi 0000:00:14.3: 0x01000000 | umac data1
[   16.128761] iwlwifi 0000:00:14.3: 0x80480EC8 | umac data2
[   16.128763] iwlwifi 0000:00:14.3: 0x00000000 | umac data3
[   16.128765] iwlwifi 0000:00:14.3: 0x00000037 | umac major
[   16.128768] iwlwifi 0000:00:14.3: 0xD9698065 | umac minor
[   16.128770] iwlwifi 0000:00:14.3: 0x00BAC57B | frame pointer
[   16.128772] iwlwifi 0000:00:14.3: 0xC0886270 | stack pointer
[   16.128774] iwlwifi 0000:00:14.3: 0x0019010D | last host cmd
[   16.128776] iwlwifi 0000:00:14.3: 0x00000000 | isr status reg
[   16.128946] iwlwifi 0000:00:14.3: Fseq Registers:
[   16.128972] iwlwifi 0000:00:14.3: 0x60000000 | FSEQ_ERROR_CODE
[   16.129026] iwlwifi 0000:00:14.3: 0x00290033 | FSEQ_TOP_INIT_VERSION
[   16.129081] iwlwifi 0000:00:14.3: 0x00090006 | FSEQ_CNVIO_INIT_VERSION
[   16.129135] iwlwifi 0000:00:14.3: 0x0000A482 | FSEQ_OTP_VERSION
[   16.129189] iwlwifi 0000:00:14.3: 0x00000003 | FSEQ_TOP_CONTENT_VERSION
[   16.129244] iwlwifi 0000:00:14.3: 0x4552414E | FSEQ_ALIVE_TOKEN
[   16.129298] iwlwifi 0000:00:14.3: 0x20000302 | FSEQ_CNVI_ID
[   16.129353] iwlwifi 0000:00:14.3: 0x01300504 | FSEQ_CNVR_ID
[   16.129407] iwlwifi 0000:00:14.3: 0x20000302 | CNVI_AUX_MISC_CHIP
[   16.129464] iwlwifi 0000:00:14.3: 0x01300504 | CNVR_AUX_MISC_CHIP
[   16.129520] iwlwifi 0000:00:14.3: 0x05B0905B | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
[   16.129577] iwlwifi 0000:00:14.3: 0x0000025B | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
[   16.131389] iwlwifi 0000:00:14.3: WRT: Collecting data: ini trigger 4 fired.
[   16.131637]  iwlmvm dcdbas snd_pcm i915 serio_raw efi_pstore snd_seq_midi snd_seq_midi_event mac80211 dell_privacy_wmi dell_wmi_sysman ledtrig_audio dell_wmi_descriptor snd_rawmidi wmi_bmof snd_seq libarc4 snd_seq_device hid_sensor_als snd_timer hid_sensor_trigger industrialio_triggered_buffer drm_kms_helper kfifo_buf snd hid_multitouch hid_sensor_iio_common industrialio cec iwlwifi soundcore rc_core i2c_algo_bit fb_sys_fops syscopyarea sysfillrect mei_me ucsi_acpi processor_thermal_device mei intel_rapl_common typec_ucsi cros_ec_ishtp cfg80211 cros_ec sysimgblt power_ctrl_logic intel_soc_dts_iosf typec int3403_thermal int340x_thermal_zone int3400_thermal intel_hid acpi_thermal_rel sparse_keymap acpi_pad acpi_tad mac_hid sch_fq_codel parport_pc ppdev lp drm parport ip_tables x_tables autofs4 hid_sensor_hub intel_ishtp_loader intel_ishtp_hid hid_generic rtsx_pci_sdmmc crc32_pclmul psmouse i2c_i801 rtsx_pci i2c_smbus nvme intel_lpss_pci intel_lpss i2c_hid idma64 thunderbolt intel_ish_ipc
[   23.295143] iwlwifi 0000:00:14.3: SecBoot CPU1 Status: 0x5d68, CPU2 Status: 0x3
[   23.295264] iwlwifi 0000:00:14.3: UMAC PC: 0x80480ec8
[   23.295281] iwlwifi 0000:00:14.3: LMAC PC: 0x163b6
[   23.295287] iwlwifi 0000:00:14.3: WRT: Collecting data: ini trigger 13 fired.
[   23.296360] iwlwifi 0000:00:14.3: Loaded firmware version: 55.d9698065.0 QuZ-a0-hr-b0-55.ucode
[   23.296363] iwlwifi 0000:00:14.3: 0x00000000 | ADVANCED_SYSASSERT
[   23.296366] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status0
[   23.296368] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status1
[   23.296370] iwlwifi 0000:00:14.3: 0x00000000 | branchlink2
[   23.296372] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink1
[   23.296374] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink2
[   23.296376] iwlwifi 0000:00:14.3: 0x00000000 | data1
[   23.296378] iwlwifi 0000:00:14.3: 0x00000000 | data2
[   23.296380] iwlwifi 0000:00:14.3: 0x00000000 | data3
[   23.296382] iwlwifi 0000:00:14.3: 0x00000000 | beacon time
[   23.296384] iwlwifi 0000:00:14.3: 0x00000000 | tsf low
[   23.296386] iwlwifi 0000:00:14.3: 0x00000000 | tsf hi
[   23.296388] iwlwifi 0000:00:14.3: 0x00000000 | time gp1
[   23.296390] iwlwifi 0000:00:14.3: 0x00000000 | time gp2
[   23.296393] iwlwifi 0000:00:14.3: 0x00000000 | uCode revision type
[   23.296395] iwlwifi 0000:00:14.3: 0x00000000 | uCode version major
[   23.296397] iwlwifi 0000:00:14.3: 0x00000000 | uCode version minor
[   23.296399] iwlwifi 0000:00:14.3: 0x00000000 | hw version
[   23.296401] iwlwifi 0000:00:14.3: 0x00000000 | board version
[   23.296403] iwlwifi 0000:00:14.3: 0x00000000 | hcmd
[   23.296405] iwlwifi 0000:00:14.3: 0x00000000 | isr0
[   23.296407] iwlwifi 0000:00:14.3: 0x00000000 | isr1
[   23.296409] iwlwifi 0000:00:14.3: 0x00000000 | isr2
[   23.296411] iwlwifi 0000:00:14.3: 0x00000000 | isr3
[   23.296413] iwlwifi 0000:00:14.3: 0x00000000 | isr4
[   23.296415] iwlwifi 0000:00:14.3: 0x00000000 | last cmd Id
[   23.296417] iwlwifi 0000:00:14.3: 0x00000000 | wait_event
[   23.296419] iwlwifi 0000:00:14.3: 0x00000000 | l2p_control
[   23.296421] iwlwifi 0000:00:14.3: 0x00000000 | l2p_duration
[   23.296423] iwlwifi 0000:00:14.3: 0x00000000 | l2p_mhvalid
[   23.296425] iwlwifi 0000:00:14.3: 0x00000000 | l2p_addr_match
[   23.296427] iwlwifi 0000:00:14.3: 0x00000000 | lmpm_pmg_sel
[   23.296429] iwlwifi 0000:00:14.3: 0x00000000 | timestamp
[   23.296432] iwlwifi 0000:00:14.3: 0x00000000 | flow_handler
[   23.296866] iwlwifi 0000:00:14.3: Start IWL Error Log Dump:
[   23.296869] iwlwifi 0000:00:14.3: Status: 0x00000010, count: 7
[   23.296871] iwlwifi 0000:00:14.3: 0x20000066 | NMI_INTERRUPT_HOST
[   23.296874] iwlwifi 0000:00:14.3: 0x00000000 | umac branchlink1
[   23.296876] iwlwifi 0000:00:14.3: 0x80465D2E | umac branchlink2
[   23.296878] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink1
[   23.296880] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink2
[   23.296882] iwlwifi 0000:00:14.3: 0x01000000 | umac data1
[   23.296885] iwlwifi 0000:00:14.3: 0x80480EC8 | umac data2
[   23.296887] iwlwifi 0000:00:14.3: 0x00000000 | umac data3
[   23.296889] iwlwifi 0000:00:14.3: 0x00000037 | umac major
[   23.296891] iwlwifi 0000:00:14.3: 0xD9698065 | umac minor
[   23.296893] iwlwifi 0000:00:14.3: 0x000FAA4C | frame pointer
[   23.296895] iwlwifi 0000:00:14.3: 0xC0886270 | stack pointer
[   23.296897] iwlwifi 0000:00:14.3: 0x00000000 | last host cmd
[   23.296899] iwlwifi 0000:00:14.3: 0x00000000 | isr status reg
[   23.297071] iwlwifi 0000:00:14.3: Fseq Registers:
[   23.297096] iwlwifi 0000:00:14.3: 0x60000000 | FSEQ_ERROR_CODE
[   23.297150] iwlwifi 0000:00:14.3: 0x80290033 | FSEQ_TOP_INIT_VERSION
[   23.297205] iwlwifi 0000:00:14.3: 0x00090006 | FSEQ_CNVIO_INIT_VERSION
[   23.297260] iwlwifi 0000:00:14.3: 0x0000A482 | FSEQ_OTP_VERSION
[   23.297314] iwlwifi 0000:00:14.3: 0x00000003 | FSEQ_TOP_CONTENT_VERSION
[   23.297369] iwlwifi 0000:00:14.3: 0x4552414E | FSEQ_ALIVE_TOKEN
[   23.297423] iwlwifi 0000:00:14.3: 0x20000302 | FSEQ_CNVI_ID
[   23.297478] iwlwifi 0000:00:14.3: 0x01300504 | FSEQ_CNVR_ID
[   23.297510] iwlwifi 0000:00:14.3: 0x20000302 | CNVI_AUX_MISC_CHIP
[   23.297568] iwlwifi 0000:00:14.3: 0x01300504 | CNVR_AUX_MISC_CHIP
[   23.297603] iwlwifi 0000:00:14.3: 0x05B0905B | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
[   23.297660] iwlwifi 0000:00:14.3: 0x0000025B | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
[   23.297695] iwlwifi 0000:00:14.3: Firmware error during reconfiguration - reprobe!
[   23.297700] iwlwifi 0000:00:14.3: Failed to start RT ucode: -110
[   23.297703] iwlwifi 0000:00:14.3: Failed to start RT ucode: -110
[   28.303539]  iwlmvm dcdbas snd_pcm i915 serio_raw efi_pstore snd_seq_midi snd_seq_midi_event mac80211 dell_privacy_wmi dell_wmi_sysman ledtrig_audio dell_wmi_descriptor snd_rawmidi wmi_bmof snd_seq libarc4 snd_seq_device hid_sensor_als snd_timer hid_sensor_trigger industrialio_triggered_buffer drm_kms_helper kfifo_buf snd hid_multitouch hid_sensor_iio_common industrialio cec iwlwifi soundcore rc_core i2c_algo_bit fb_sys_fops syscopyarea sysfillrect mei_me ucsi_acpi processor_thermal_device mei intel_rapl_common typec_ucsi cros_ec_ishtp cfg80211 cros_ec sysimgblt power_ctrl_logic intel_soc_dts_iosf typec int3403_thermal int340x_thermal_zone int3400_thermal intel_hid acpi_thermal_rel sparse_keymap acpi_pad acpi_tad mac_hid sch_fq_codel parport_pc ppdev lp drm parport ip_tables x_tables autofs4 hid_sensor_hub intel_ishtp_loader intel_ishtp_hid hid_generic rtsx_pci_sdmmc crc32_pclmul psmouse i2c_i801 rtsx_pci i2c_smbus nvme intel_lpss_pci intel_lpss i2c_hid idma64 thunderbolt intel_ish_ipc
[   28.303740]  iwlmvm dcdbas snd_pcm i915 serio_raw efi_pstore snd_seq_midi snd_seq_midi_event mac80211 dell_privacy_wmi dell_wmi_sysman ledtrig_audio dell_wmi_descriptor snd_rawmidi wmi_bmof snd_seq libarc4 snd_seq_device hid_sensor_als snd_timer hid_sensor_trigger industrialio_triggered_buffer drm_kms_helper kfifo_buf snd hid_multitouch hid_sensor_iio_common industrialio cec iwlwifi soundcore rc_core i2c_algo_bit fb_sys_fops syscopyarea sysfillrect mei_me ucsi_acpi processor_thermal_device mei intel_rapl_common typec_ucsi cros_ec_ishtp cfg80211 cros_ec sysimgblt power_ctrl_logic intel_soc_dts_iosf typec int3403_thermal int340x_thermal_zone int3400_thermal intel_hid acpi_thermal_rel sparse_keymap acpi_pad acpi_tad mac_hid sch_fq_codel parport_pc ppdev lp drm parport ip_tables x_tables autofs4 hid_sensor_hub intel_ishtp_loader intel_ishtp_hid hid_generic rtsx_pci_sdmmc crc32_pclmul psmouse i2c_i801 rtsx_pci i2c_smbus nvme intel_lpss_pci intel_lpss i2c_hid idma64 thunderbolt intel_ish_ipc
[   28.303930]  iwlmvm dcdbas snd_pcm i915 serio_raw efi_pstore snd_seq_midi snd_seq_midi_event mac80211 dell_privacy_wmi dell_wmi_sysman ledtrig_audio dell_wmi_descriptor snd_rawmidi wmi_bmof snd_seq libarc4 snd_seq_device hid_sensor_als snd_timer hid_sensor_trigger industrialio_triggered_buffer drm_kms_helper kfifo_buf snd hid_multitouch hid_sensor_iio_common industrialio cec iwlwifi soundcore rc_core i2c_algo_bit fb_sys_fops syscopyarea sysfillrect mei_me ucsi_acpi processor_thermal_device mei intel_rapl_common typec_ucsi cros_ec_ishtp cfg80211 cros_ec sysimgblt power_ctrl_logic intel_soc_dts_iosf typec int3403_thermal int340x_thermal_zone int3400_thermal intel_hid acpi_thermal_rel sparse_keymap acpi_pad acpi_tad mac_hid sch_fq_codel parport_pc ppdev lp drm parport ip_tables x_tables autofs4 hid_sensor_hub intel_ishtp_loader intel_ishtp_hid hid_generic rtsx_pci_sdmmc crc32_pclmul psmouse i2c_i801 rtsx_pci i2c_smbus nvme intel_lpss_pci intel_lpss i2c_hid idma64 thunderbolt intel_ish_ipc
[   28.605186] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-59.ucode failed with error -2
[   28.605213] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-58.ucode failed with error -2
[   28.605232] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-57.ucode failed with error -2
[   28.605252] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-56.ucode failed with error -2
[   28.605922] iwlwifi 0000:00:14.3: api flags index 2 larger than supported by driver
[   28.605941] iwlwifi 0000:00:14.3: TLV_FW_FSEQ_VERSION: FSEQ Version: 220.127.116.11
[   28.605946] iwlwifi 0000:00:14.3: Found debug destination: EXTERNAL_DRAM
[   28.605948] iwlwifi 0000:00:14.3: Found debug configuration: 0
[   28.606528] iwlwifi 0000:00:14.3: loaded firmware version 55.d9698065.0 QuZ-a0-hr-b0-55.ucode op_mode iwlmvm
[   28.606592] iwlwifi 0000:00:14.3: Detected Intel(R) Wi-Fi 6 AX203, REV=0x354
[   29.631158] iwlwifi 0000:00:14.3: SecBoot CPU1 Status: 0x5db8, CPU2 Status: 0x3
[   29.631398] iwlwifi 0000:00:14.3: UMAC PC: 0x80480ec8
[   29.631415] iwlwifi 0000:00:14.3: LMAC PC: 0x163b6
[   29.631421] iwlwifi 0000:00:14.3: WRT: Collecting data: ini trigger 13 fired.
[   29.631625] iwlwifi 0000:00:14.3: Loaded firmware version: 55.d9698065.0 QuZ-a0-hr-b0-55.ucode
[   29.631629] iwlwifi 0000:00:14.3: 0x00000000 | ADVANCED_SYSASSERT
[   29.631632] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status0
[   29.631634] iwlwifi 0000:00:14.3: 0x00000000 | trm_hw_status1
[   29.631636] iwlwifi 0000:00:14.3: 0x00000000 | branchlink2
[   29.631638] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink1
[   29.631641] iwlwifi 0000:00:14.3: 0x00000000 | interruptlink2
[   29.631643] iwlwifi 0000:00:14.3: 0x00000000 | data1
[   29.631645] iwlwifi 0000:00:14.3: 0x00000000 | data2
[   29.631647] iwlwifi 0000:00:14.3: 0x00000000 | data3
[   29.631650] iwlwifi 0000:00:14.3: 0x00000000 | beacon time
[   29.631652] iwlwifi 0000:00:14.3: 0x00000000 | tsf low
[   29.631654] iwlwifi 0000:00:14.3: 0x00000000 | tsf hi
[   29.631656] iwlwifi 0000:00:14.3: 0x00000000 | time gp1
[   29.631659] iwlwifi 0000:00:14.3: 0x00000000 | time gp2
[   29.631661] iwlwifi 0000:00:14.3: 0x00000000 | uCode revision type
[   29.631663] iwlwifi 0000:00:14.3: 0x00000000 | uCode version major
[   29.631666] iwlwifi 0000:00:14.3: 0x00000000 | uCode version minor
[   29.631668] iwlwifi 0000:00:14.3: 0x00000000 | hw version
[   29.631670] iwlwifi 0000:00:14.3: 0x00000000 | board version
[   29.631672] iwlwifi 0000:00:14.3: 0x00000000 | hcmd
[   29.631675] iwlwifi 0000:00:14.3: 0x00000000 | isr0
[   29.631677] iwlwifi 0000:00:14.3: 0x00000000 | isr1
[   29.631679] iwlwifi 0000:00:14.3: 0x00000000 | isr2
[   29.631681] iwlwifi 0000:00:14.3: 0x00000000 | isr3
[   29.631683] iwlwifi 0000:00:14.3: 0x00000000 | isr4
[   29.631686] iwlwifi 0000:00:14.3: 0x00000000 | last cmd Id
[   29.631688] iwlwifi 0000:00:14.3: 0x00000000 | wait_event
[   29.631690] iwlwifi 0000:00:14.3: 0x00000000 | l2p_control
[   29.631692] iwlwifi 0000:00:14.3: 0x00000000 | l2p_duration
[   29.631695] iwlwifi 0000:00:14.3: 0x00000000 | l2p_mhvalid
[   29.631697] iwlwifi 0000:00:14.3: 0x00000000 | l2p_addr_match
[   29.631699] iwlwifi 0000:00:14.3: 0x00000000 | lmpm_pmg_sel
[   29.631701] iwlwifi 0000:00:14.3: 0x00000000 | timestamp
[   29.631704] iwlwifi 0000:00:14.3: 0x00000000 | flow_handler
[   29.632168] iwlwifi 0000:00:14.3: Start IWL Error Log Dump:
[   29.632171] iwlwifi 0000:00:14.3: Status: 0x00000000, count: 7
[   29.632173] iwlwifi 0000:00:14.3: 0x20000066 | NMI_INTERRUPT_HOST
[   29.632176] iwlwifi 0000:00:14.3: 0x00000000 | umac branchlink1
[   29.632178] iwlwifi 0000:00:14.3: 0x80465D2E | umac branchlink2
[   29.632180] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink1
[   29.632182] iwlwifi 0000:00:14.3: 0x80480EC8 | umac interruptlink2
[   29.632184] iwlwifi 0000:00:14.3: 0x01000000 | umac data1
[   29.632186] iwlwifi 0000:00:14.3: 0x80480EC8 | umac data2
[   29.632189] iwlwifi 0000:00:14.3: 0x00000000 | umac data3
[   29.632191] iwlwifi 0000:00:14.3: 0x00000037 | umac major
[   29.632193] iwlwifi 0000:00:14.3: 0xD9698065 | umac minor
[   29.632195] iwlwifi 0000:00:14.3: 0x000F6017 | frame pointer
[   29.632197] iwlwifi 0000:00:14.3: 0xC0886270 | stack pointer
[   29.632199] iwlwifi 0000:00:14.3: 0x00000000 | last host cmd
[   29.632202] iwlwifi 0000:00:14.3: 0x00000000 | isr status reg
[   29.632372] iwlwifi 0000:00:14.3: Fseq Registers:
[   29.632398] iwlwifi 0000:00:14.3: 0x60000000 | FSEQ_ERROR_CODE
[   29.632451] iwlwifi 0000:00:14.3: 0x80290033 | FSEQ_TOP_INIT_VERSION
[   29.632506] iwlwifi 0000:00:14.3: 0x00090006 | FSEQ_CNVIO_INIT_VERSION
[   29.632539] iwlwifi 0000:00:14.3: 0x0000A482 | FSEQ_OTP_VERSION
[   29.632593] iwlwifi 0000:00:14.3: 0x00000003 | FSEQ_TOP_CONTENT_VERSION
[   29.632648] iwlwifi 0000:00:14.3: 0x4552414E | FSEQ_ALIVE_TOKEN
[   29.632703] iwlwifi 0000:00:14.3: 0x20000302 | FSEQ_CNVI_ID
[   29.632758] iwlwifi 0000:00:14.3: 0x01300504 | FSEQ_CNVR_ID
[   29.632813] iwlwifi 0000:00:14.3: 0x20000302 | CNVI_AUX_MISC_CHIP
[   29.632870] iwlwifi 0000:00:14.3: 0x01300504 | CNVR_AUX_MISC_CHIP
[   29.632905] iwlwifi 0000:00:14.3: 0x05B0905B | CNVR_SCU_SD_REGS_SD_REG_DIG_DCDC_VTRIM
[   29.632940] iwlwifi 0000:00:14.3: 0x0000025B | CNVR_SCU_SD_REGS_SD_REG_ACTIVE_VDIG_MIRROR
[   29.632996] iwlwifi 0000:00:14.3: Failed to start RT ucode: -110
[   34.764528] iwlwifi 0000:00:14.3: Failed to run INIT ucode: -110

dmesg | grep iwlwifi when the wifi IS working
[    2.450034] iwlwifi 0000:00:14.3: enabling device (0000 -> 0002)
[    2.452349] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-59.ucode failed with error -2
[    2.452428] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-58.ucode failed with error -2
[    2.452505] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-57.ucode failed with error -2
[    2.452514] iwlwifi 0000:00:14.3: Direct firmware load for iwlwifi-QuZ-a0-hr-b0-56.ucode failed with error -2
[    2.453823] iwlwifi 0000:00:14.3: api flags index 2 larger than supported by driver
[    2.453836] iwlwifi 0000:00:14.3: TLV_FW_FSEQ_VERSION: FSEQ Version: 18.104.22.168
[    2.453840] iwlwifi 0000:00:14.3: Found debug destination: EXTERNAL_DRAM
[    2.453841] iwlwifi 0000:00:14.3: Found debug configuration: 0
[    2.454073] iwlwifi 0000:00:14.3: loaded firmware version 55.d9698065.0 QuZ-a0-hr-b0-55.ucode op_mode iwlmvm
[    2.527880] iwlwifi 0000:00:14.3: Detected Intel(R) Wi-Fi 6 AX203, REV=0x354
[    2.711487] iwlwifi 0000:00:14.3: base HW address: dc:41:a9:a9:29:8c
[    2.727934] iwlwifi 0000:00:14.3 wlp0s20f3: renamed from wlan0

Comment: It's interesting that `iwlwifi` reports the wireless device as an AX203 when *most* 9310 models ship with an AX500-series. Does `sudo lspci` also show the wireless device as an AX203? If so, you may need to use a 21.10 daily to use the wireless device, as support was added in kernel 5.11.4 ...
Comment: @matigo it actually doesn't list a device when I do `sudo lspci`: ```00:14.3 Network controller: Intel Corporation Device a0f0 (rev 20)
```
Comment: According to `lshw`, wifi has no driver. you need to determine your card type and find a driver. Sometimes this is easy, other times not so much..
Comment: try `sudo apt install iwlwifi-firmware` to see if that helps. This is a troubleshooting process, so it may or may not. I am guessing that you will need to dig up a driver off the internet, but it is best to try the simple stuff first. XD Btw I am getting this from the -2 error code. It is a sometimes-fix.
Comment: Suggestions: Update UEFI -and- disable Fast Boot.
Answer: This is a known issue with older kernels. I was able to fix this by installing a newer kernel with apt install linux-image-generic-hwe-20.04-edge or apt install linux-image-5.13.0-1009-oem
You can see a full list of available kernels with apt list linux-image*
Ensure that linux-firmware is up to date also, or experiment with the latest wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/iwlwifi-QuZ-a0-jf-b0-63.ucode -O /usr/lib/firmware/iwlwifi-QuZ-a0-jf-b0-63.ucode
Other things you can experiment with:

Update the firmware on the device with fwupdmgr refresh --force && fwupdmgr upgrade
Change wifi.powersave to 2 in /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf
Experiment with kernel cmdline options such as pcie_aspm=off, full list available here: https://www.kernel.org/doc/html/v5.11/admin-guide/kernel-parameters.html
sudo add-apt-repository ppa:canonical-hwe-team/backport-iwlwifi && sudo apt-get update && sudo apt install backport-iwlwifi-dkms
Comment: Thanks - I've yet to try everything listed here and test it (testing is difficult because it only doesn't work *sometimes*) but I'm marking this as the best answer for all your helpful suggestions.


Where to configure unattended-upgrades

Question: Regarding configuration of Unattended-Upgrades:

Which are the appropriate files for configuring each option of Unattended-Upgrades?

I have seen three files mentioned, see below.
I am not certain others could also be used.
Can any of the files above be used for any of the options, or there is a restriction on this? (There is some overlap, for sure, see below).
Which has precedence for repeated options?

PS: These are actually different questions, but intimately related, so it would be possibly less convenient to separate them into different posts.
What I see in my 18.04LTS:
$ cat /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
$ cat /etc/apt/apt.conf.d/10periodic
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "0";
APT::Periodic::AutocleanInterval "0";
$ cat /etc/apt/apt.conf.d/50unattended-upgrades
(long output)

PS2:
As for how to configure or disable, these are related
Limiting the time Unattended-Upgrade keeps the lock on `/var/lib/dpkg/`
Ubuntu 16.04: Unattended-upgrades runs at random times
Unattended-upgrades running for hours
Disable automatic updates ubuntu 18.04
disable updates from command line in Ubuntu 16.04
Disable Software Updater Notification?
How to Enable/Disable Unattended Upgrades in Ubuntu 16.04
Terminate and disable/remove unattended upgrade before command returns
Comment: Seems clear to me what each does, and dpkg will happily tell you which packages provide each file. Files are processed in numeric order - later files overrule earlier. You can place any option anywhere you wish. Do you have a specific question?
Comment: @user535733 - I have specific questions, and your helped better ordering them, please see edit.
Your answer (in a comment) was concise. If I understand correctly, this is what you mean, please comment:
1) You didn't specify all configuration files associated with Unattended-Upgrade.
2) Yes. In fact, strictly speaking any file under `/etc/apt/apt.conf.d` could contain any configuration option for unattended-upgrade, and they would be equally processed. The decision on where to place them helps organization, and accounting for the precedence.
3) Files are processed in alphabetical order.
Answer: As for the precedence of the configurations files, see this question
/etc/apt/apt.conf.d/10periodic is related to update-notifier-common package.
Same setting variables that are set in /etc/apt/apt.conf.d/20auto-upgrades will override those settings. You can setup the 20auto-upgrades file by running sudo dpkg-reconfigure unattended-upgrades. If you use the GUI way i.e. "Software & Updates" dialog i.e. /usr/bin/software-properties-gtk (its Updates tab), it will change both files. As for scheduling unattended-upgrades, I suppose it goes the same way as with Debian; see this question.
You should not modify /etc/apt/apt.conf.d/50unattended-upgrades. Instead, use files starting with e.g. "51" to override some of the settings:

To override the configuration it is recommended to create an other APT
configuration file fragment which overrides the shipped default value
because updates to to shipped configuration file may conflict with the
local changes blocking updating unattended-upgrades itself. The new
file should sort later than 50unattended-upgrades to be parsed later
than the one shipping the default values, it can be e.g.
52unattended-upgrades-local.

Reference: https://github.com/mvo5/unattended-upgrades/blob/master/README.md

Where to configure unattended-upgrades