Q: laravel livewire wire:change does not fire So i have a filter with mutliple tags.
but whenever i select a 'tag' it wont fire to the function.
And it does not matter where i put the wire:change, it just does not work.
First i had a basic Select dropdown, but then i changed it so i can select multiple tags to filter on.
blade code:
        <form >

      <select>
        <option>Select an option</option>
      </select>

      @foreach($categories as $category)

        <input type="checkbox" value="{{$category->id}}" /> {{ $category->name}}

      @endforeach

</form>

javascript for the dropdown:

css for the dropdown:

It used to work before i altered the dropdown to multiselect

A: Your wire:model and wire:change are not on your select tag, but on the div below it. Move it to your select tag:
<select wire:model="tag_id" wire:change="filter">
    <option>Select an option</option>
</select>


Q: Postfix, relay emails to next server with X port I'm working on migrating my smtp relay from sendmail to postfix.  One special thing I did with sendmail was to get around ISP port 25 blocks by creating another esmtp definition in sendmail to send to another port.
In /etc/mail/sendmail.cf I added the following
Mesmtp143,  P=[IPC], F=mDFMuXa, S=EnvFromSMTP/HdrFromSMTP, R=EnvToSMTP, E=\r\n, L=990,
            T=DNS/RFC822/SMTP,
            A=TCP $h 143

That allowed me to define an relay for a certain domain like this in /etc/mail/mailertable
domain.com esmtp143:[domain.com]
I'm looking for the equivalent in postfix.  I've looked through the docs and walkthroughs, but can't seem to find this setting.
The best I can come up with is editing the /etc/postfix/transport file too have a line
domain.com  smtp:[domain.com:143]

A: Answer is almost what I thought.
In /etc/postfix/transport you need to put the following to deliver to anything other than port 25
domain.com smtp:domain.com:143


Q: How to read a JSON file using Nix? How can I read a JSON file that exists in the filesystem with Nix? Is this natively supported?

A: If we have a file example.json like:
{
  "rev": "fcc9a7714053acb1aaf6913b99b6f49e0d13b1b7"
}

We can use the following where fromJSON will return an attribute set:
nix-repl> v = builtins.fromJSON (builtins.readFile "/path/to/example.json")
nix-repl> v.rev
"fcc9a7714053acb1aaf6913b99b6f49e0d13b1b7"


Q: How to load @Configuration classes from separate Jars I have a SpringBoot main application, as well as a separate Maven module project that compiles as a separate Jar. The module has a Spring config class annotated with @Configuration, which I want to get loaded, when the main app loads.
Apparently, this does not happen out of the box (by just including the module to the main app). What else do I need to do, to get the module configuration class also get loaded by the main app?

A: @ComponentScan annotation will scan all classes with @Compoment or @Configuration annotation.
Then spring ioc will add them all to spring controlled beans.
If you want to only add specific configurations, you can use @import annotation.
example:
@Configuration
@Import(NameOfTheConfigurationYouWantToImport.class)
public class Config {

}

@Import Annotation Doc

A: The easiest way is to scan the package that the @Configuration class is in.
@ComponentScan("com.acme.otherJar.config")

or to just load it as a spring bean:
 @Bean
 public MyConfig myConfig() {
     MyConfig myConfig = new MyConfig ();
     return myConfig;
 }

Where MyConfig is something like:
 @Configuration
 public class MyConfig {
     // various @Bean definitions ...
 }

See docs


Q: Cached plan must not change result type Our service team is getting the error Cached plan must not change result type sometimes when I modify the length of a column or add a new column in the table.
I tried solutions mentioned on Stack Overflow like Postgres: "ERROR: cached plan must not change result type"
I have tried autosave=conservative to resolve this issue but still, I am able to reproduce this issue. I used below JDBC connection string
jdbc-url: jdbc:postgresql://172.16.244.10:5432/testdb?autosave=conservative

why is this property not working in my case?
Also, I tested with prepareThreshold=0 and its working fine. But I think it will impact performance because it will never use client-side prepared statements.
I just want to know the best solution to avoid this error.


Q: Does Tensorflow support Python 3.8.5? I was just looking into Tensorflow for Python, and they say they support python version 3.5-3.8. What I can't understand is, does "3.8" mean strictly 3.8.0 OR 3.8.x(so 3.8.5 works)?
I know it can vary for different software.
I just want to make sure that IF 3.8.5 is supported, that I use that since it's a newer version.
Thanks in advance!

A: Yes, it does. I'm on Python 3.8.5 and using tensorflow==2.3.0.
Usually when a version is given as "3.5-3.8", it includes the patch versions as well. (Sometimes there could be issues that pop up but it's intended to include all patch version of the 'from' & 'to', inclusive.)

A: I would think it works in 3.8.5, but it would be safer to use 3.8.0.


Q: ERROR 1349 (HY000): View's SELECT contains a subquery in the FROM clause I do not want to create two separate views.
create view fg_voted as (
  select *
    from (select f1.foto, count(f1.vote) stars,f1.vote, f1.voted
            from fg_foto_bewertung f1
           where f1.vote >= 3 group by f1.foto, f1.vote) vi_foto
   where stars > 3);

How can I write it in a single query to create view?

A: How about this instead?
create view fg_voted as (

  SELECT f1.foto,
         count(f1.vote) stars,
         f1.vote,
         f1.voted
  FROM   fg_foto_bewertung f1
  WHERE  f1.vote >= 3
  GROUP BY f1.foto,
           f1.vote,
           f1.voted
  HAVING count(f1.vote) > 3
 );


Q: React Native build release apk have issue " Process 'command 'npx'' finished with non-zero exit value 1 " My project use react native. When I build release apk my app on Android Studio 3.5.2, I sometime have an issue:
Process 'command 'npx'' finished with non-zero exit value 1

and here version react-native and node
System:
OS: macOS 10.15.2
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 1.91 GB / 16.00 GB
Shell: 5.7.1 - /bin/zsh

Binaries:
Node: 12.13.0 - /usr/local/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.12.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman

SDKs:
iOS SDK:
  Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1

IDEs:
Xcode: 11.3/11C29 - /usr/bin/xcodebuild

npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.5 => 0.61.5

npmGlobalPackages:
react-native-cli: 2.0.1

i don't know why? Please Help me!!! thanks you.

A: error's screenshot
In my case, it happened after installing react-native-gifted-chat, so link to the instructions:

*

*go to node_modules/react-native-parsed-text/babel.config.js

*coomment second line // api.cache(true);

*close Metro Bundler run yarn run ios,

*you may need to run it twice // "ios": "react-native run-ios"


Q: $U(n)^2$ is a proper subgroup of $U(n)$ I'm trying to show that $U(n)^2$ is a proper subgroup of $U(n)$. Here
$$ U(n)^2 = \{x^2 \mid x \in U(n)\}$$
where $U(n)$ is the group of units modulo $n$.
My idea was to argue as follows:
Consider all elements of orders that are powers of $2$ in $U(n)$. Say these orders are $2^{k_1}, \dots, 2^{k_n}$ where $k_1 < \dots < k_n$. Then $U(n)^2$ does not contain an element of order $2^{k_n}$ (it will have elements of at most $2^{k_n - 1}$ for powers of $2$).

Is this correct?

I looked at the solution and it said that $1 = (n-1)^2$ implies it is a proper subgroup. But I don't think this works just like that: $n-1$ is minus one and there could be some $x \in U(n)$ such that $x^2 = -1$. So $U(n)^2$ could still contain $-1$.

What am I missing?

A: First we need to realize that the statement does not hold for $n = 1,2$.
To make your proof work you need that $U(n)$ contains an element of order $2^\ell$ with $\ell > 1$, which amounts to showing that the order of $U(n)$ is even. This is not the case for $n = 1,2$ because $U(1)$ and $U(2)$ are the trival group. For $n > 2$ this is the statement that $\phi(n)$ is even for $n > 2$.
The method which the solutions hints at is much easier: You are right in arguing that $U(n)$ can contain $-1$, this happens for example for $n = 5$. The point is that $\varphi \colon U(n) \to U(n), x \mapsto x^2$ is a group homomorphism (because $U(n)$ is abelian) with image $U(n)^2$. Hence $U(n)^2 = U(n)$ if and only if $\varphi$ is surjective. Because $U(n)$ is finite this is equivalent to $\varphi$ being injective. Because $\varphi(1) = 1 = \varphi(-1)$ this is not the case for $n > 2$.

A: $x\mapsto x^2$ is a group homomorphism $U(n)\to U(n)$. You want to show that it is not surjective. As the group is finite, this is equivalent to not beinng injective. And this can be seen from $1\ne -1$ but $1^2=(-1)^2$. (This works only for $n>2$)


Q: Get column collation without flags CI, CS, AI, AS Is it possible get the column collation string without flags CI, CS, AI, AS?
For example:
If we have "Latin1_General_100_CS_AS" I need "Latin1_General_100" without "_CS_AS".
Thanks.

A: CS = Case Sensitive CI= Case Insensitive you need to have one or the other.
AS = Accent sensitive, AI = Accent Insensitive.
These codes specify how to sort. You need to select CI or CS and  AS or AI
https://msdn.microsoft.com/en-us/library/ms143726.aspx

A: You can use the SQL replace function to remove instances of '_CI' in your query.
For example, the code below will remove _CI and _AI from collation names. You can use similar logic to remove the other characters you don't want.
SELECT name, REPLACE(REPLACE(name, '_CI',''), '_AI','') description FROM sys.fn_helpcollations();

A: Here you are a customable solution to exlude any falg you want from a table of names (for example collation names). If you want you can prepare a procedure or function to do it easier in your batches.
-- declaration of the input table
declare @input as table (name varchar(max));

-- declaration of the output table
declare @output as table (name varchar(max));

-- declaration of the table with flags you want to exclude from names
declare @exclude as table (flag varchar(max));

-- put flags you want to exclude into array
insert into @exclude (flag)
values ('CI'), ('CS'), ('AI'), ('AS');

-- put some collations into input table (as example for testing)
insert into @input
select distinct name
from sys.fn_helpcollations();

-- now we need to loop over all value in exclude table
declare @excludeCursor as cursor;
declare @flag as varchar(max);

set @excludeCursor = cursor for
select flag
from @exclude;

open @excludeCursor;

fetch next from @excludeCursor INTO @flag;
while @@FETCH_STATUS = 0
begin
    update @input
    set name = replace(name, concat('_', @flag), '')
    where name like concat('%_', @flag)
    or name like concat('%_', @flag, '_%')

    -- The where clause above ensure that you replace exactly the flag added to your exclude table.
    -- Without this caluse if you want to excldue for example a BIN flag and you have a BIN and BIN2 flags in your names
    -- then the '2' character from the BIN2 will stay as a part of your collation name.

    fetch next from @excludeCursor INTO @flag;
end

close @excludeCursor;
deallocate @excludeCursor;

-- prepare the output table with distinct values
insert into @output
select distinct name
from @input;

-- print the output
select *
from @output


Q: Syncing between Spreadsheets Currently have a working script for syncing cell format and values to another spreadsheet. I know it is very rough and ready, but it works!! I don't like that there are numbers in the For loop to achieve the correct cell numbers ... But this is needed to go from a single row by 9 columns, to the destination spreadsheet which is 9 rows by 1 column.
After talking to a colleague, the feedback is this will run quite slowly. I have rewritten this as 9 If statements but the problem is when dragging cells across it only updates the first cell, not the range.
There is the copyTo function, unfortunately, this only works inside a single spreadsheet.
The overall speed doesn't really matter, is there an alternative?
// for loop to populate all cells
  for (let i = 21; i < 30; i++){                                              // starts at volumn V (22) for 9 columns (21 to 30)
  var activeCell = registerSheet.getRange(activeRow, i + 1, 1, 1);      // Register column, i + 1 so it increases
  var registerValue = activeCell.getValue();                            // get cell value
  var registerFormat = activeCell.getBackground();                      // get cell format
  var i2 = 'C' + (33 + i)                                               // this increases the target cell range from C54 to C62 using the loop. 54 (start row on form) - 21 (start i value) = 33
  var range = form.getRange(i2);                                        // designate target cell
  range.setValue(registerValue);                                        // set target cell value
  range.setBackground(registerFormat);                                  // set target cell format
  }
  }

A: Explanation:

*

*Your code is indeed inefficient because you are calling setValue()
and setBackground() 9 times each when you can simply use
setValues() and setBackgrounds() instead once. It will get even more inefficient for a larger number of iterations.

*There is a little trick you need to do and that is to convert the data  (nrows,ncolumns) returned by getRange(activeRow,22,1,9).getValues() with a shape of (1,9) to a shape of (9,1) and do the same for the background colors as well:
var rowValues=registerSheet.getRange(activeRow,22,1,9).getValues().flat().map(r=>[r]); // V:AD
var rowBackcolors = registerSheet.getRange(activeRow,22,1,9).getBackgrounds().flat().map(r=>[r]); // V:AD

*After that you can simply set the data directly to the destination sheet:
var range = form.getRange('C54:C62'); // C54:C63
range.setValues(rowValues);
range.setBackgrounds(rowBackcolors);

Solution:
Replace the for loop with this:
var rowValues=registerSheet.getRange(activeRow,22,1,9).getValues().flat().map(r=>[r]); // V:AD
var rowBackcolors = registerSheet.getRange(activeRow,22,1,9).getBackgrounds().flat().map(r=>[r]); // V:AD
var range = form.getRange('C54:C62'); // C54:C63
range.setValues(rowValues);
range.setBackgrounds(rowBackcolors);

Related article:
What does the range method getValues() return and setValues() accept?


Q: How can place marker on an image using JavaScript that doesn't change after zooming this is our code but this code is give me the coordinates according to the body relative but when i change the zoom then its gives me different values i want to get coordinates and save in my backend that cannot be change this is my code
function FindPosition(oElement) {
    console.log(oElement);
    console.log(oElement.pageX);
    if (typeof (oElement.offsetParent) != "undefined") {
      for (var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent) {
        posX += oElement.offsetLeft;
        posY += oElement.offsetTop;
      }
      return [posX, posY];
    }
    else {
      return [oElement.x, oElement.y];
    }
  }

  function GetCoordinates(e) {
    var PosX = 0;
    var PosY = 0;
    var ImgPos;
    ImgPos = FindPosition(myImg.current);
    // console.log(document.documentElement.scrollTop);
    console.log(myImg);
    if (!e) {
      var e = window.event
    };
    if (e.pageX || e.pageY) {
      PosX = e.pageX;
      PosY = e.pageY;
    }
    else if (e.clientX || e.clientY) {
      PosX = e.clientX + document.body.scrollLeft
        + document.documentElement.scrollLeft;
      PosY = e.clientY + document.body.scrollTop
        + document.documentElement.scrollTop;
    }
    PosX = PosX - ImgPos[0];
    PosY = PosY - ImgPos[1];

  }

here is jsx which is written in react js

        <RoomIcon className="markerIcon" />

this is the css code

.map {
  /* height: 100px; */
  text-align: center;
  margin: auto;
  /* overflow: scroll; */
  margin-top: 18px;
  position: relative;
}

.mapForm .map img {
  margin-top: 18px;
  /* width: ; */
  /* width: 1900px; */
  /* zoom: 150%; */
}

.mapImage {
  width: 600px;
  /* zoom: 600%; */
}

.markerIcon {
  z-index: 5;
  position: absolute;
  color: #e24e40;
  left: 30px;
  top: 30px;
}

A: You should save the relative (i.e. in percent) position of the marker on the image.
You can use getBoundingClientRect to simplify calculations:
const imgRect = myImg.current.getBoundingClientRect(); // imgRect is relative to viewport
const {clientX, clientY} = e; // clientX and clientY are relative to viewport
// since both are relative to viewport, it's useless to try to get their absolute position to the document. Simply compute their pos differences
const posXpct = (clientX - imgRect.x)*100 / imgRect.width;
const posYpct = (clientY - imgRect.y)*100 / imgRect.height;

Then you store posXpct and posYpct. And to position your marker from the previously saved values:
marker.style.position.left = posXpct+'%';
marker.style.position.top = posYpct+'%';

The additional advantage is that your marker will stay in place even if you resize physically the map (for instance on responsive devices with a width in %).
Don't forget to place the marker tip on this exact position, with something like (assuming your "tip" is at the bottom-center of the marker):
.marker {
    transform: translate(-50%, -100%);
}

A: by using leaflet library you can change the address by the image


Q: Why does python subprocess zip fail but running at shell works? I'm on Mac OS X using Python 2.7; using subprocess.call with zip fails yet running the same command at the shell succeeds. Here's a copy of my terminal:
$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> subprocess.call(['zip', 'example.zip', 'example/*'])
    zip warning: name not matched: example/*

zip error: Nothing to do! (example.zip)
12
>>> quit()
$ zip example.zip example/*
  adding: example/file.gz (deflated 0%)

I've also tried with full paths and had the same result.

A: Martijn's advice to use glob.glob is good for general shell wildcards, but in this case it looks as if you want to add all files in a directory to the ZIP archive. If that's right, you might be able to use the -r option to zip:
directory = 'example'
subprocess.call(['zip', '-r', 'example.zip', directory])

A: Because running a command in the shell is not the same thing as running it with subprocess.call(); the shell expanded the example/* wildcard.
Either expand the list of files with os.listdir() or the glob module yourself, or run the command through the shell from Python; with the shell=True argument to subprocess.call() (but make the first argument a whitespace-separated string).
Using glob.glob() is probably the best option here:
import glob
import subprocess

subprocess.call(['zip', 'example.zip'] + glob.glob('example/*'))

A: Try shell=True. subprocess.call('zip example.zip example/*', shell=True) would work.


Q: Why is my label cutting off on the middle? WPF C# .NET So just recently when i started messing around with that blue bar thing (demo in the picture)
It started cutting off the labels for some weird reason.
In this picture you can see that it says OS: Win  Available RAM etc but it should say Windows 8.1 and Available ram "And the exact number"
I DO NOT have any stack panels or anything covering it im suspecting that it has something to do with the blue bar (Picture 2)
 im new to WPF.

PICTURE 2 ^
As you can see there is a blue bar next to the labels and Im starting to suspect hat it tis the one messing things up.
What is causing my labels to cut off?
<Page x:Class="TestApplication.systemPage"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:local="clr-namespace:TestApplication"
      mc:Ignorable="d"
      Background="White"
      d:DesignHeight="350" d:DesignWidth="525"
      Title="systemPage">

    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="0*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0*"/>
            <ColumnDefinition Width="0*"/>
        </Grid.ColumnDefinitions>
        <StackPanel Name="Stacky" Background="#03a3d2" HorizontalAlignment="Left" Height="350" VerticalAlignment="Top" Width="119" Margin="-262,-59,0,-59" Grid.RowSpan="3"/>
        <Image x:Name="image" HorizontalAlignment="Left" Height="84" Margin="160,13,-260,-97" VerticalAlignment="Top" Width="100" Source="Images/Logo.png" Grid.ColumnSpan="2" Grid.Row="1"/>
        <Label x:Name="osInfo" Content="OS:" HorizontalAlignment="Left" Margin="19,-42,-47,0" VerticalAlignment="Top" Height="26" Width="28" Grid.ColumnSpan="2"/>
        <Label x:Name="ramInfo" Content="Available RAM:" HorizontalAlignment="Left" Margin="19,-21,-108,0" VerticalAlignment="Top" Height="26" Width="89" Grid.ColumnSpan="2"/>
        <Label x:Name="systemHealth" Content="System Diagnose:" HorizontalAlignment="Left" Margin="19,72,-123,0" VerticalAlignment="Top" Height="26" Width="104" Grid.ColumnSpan="2"/>
        <Label x:Name="cpuInfo" Content="CPU:" HorizontalAlignment="Left" Margin="19,0,-54,0" VerticalAlignment="Top" Height="26" Width="35" Grid.ColumnSpan="2"/>
        <Label x:Name="CPUUsage" Content="N/A" HorizontalAlignment="Left" Margin="54,0,-85,0" VerticalAlignment="Top" Height="26" Width="31" Grid.ColumnSpan="2"/>
        <Label x:Name="RAMUsage" Content="N/A" HorizontalAlignment="Left" Margin="108,-21,-139,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Height="26" Width="31"/>
        <Label x:Name="osInfoLabel" Content="N/A" HorizontalAlignment="Left" Margin="47,-42,-78,0" VerticalAlignment="Top" Height="26" Width="31" Grid.ColumnSpan="2"/>
        <Button x:Name="startScanButton" Click="startScanButton_Click" Background="Transparent" BorderThickness="0" Content="Start Diagnose" HorizontalAlignment="Left" Margin="-143,29,0,-61" VerticalAlignment="Top" Width="137" Height="32" Grid.Row="1"/>
        <Label x:Name="connectionStateLabel" Content="N/A" HorizontalAlignment="Left" Margin="77,22,-108,0" VerticalAlignment="Top" Height="26" Width="31" Grid.ColumnSpan="2"/>
        <Label x:Name="networkLabel" Content="Network:" HorizontalAlignment="Left" Margin="19,22,-77,0" VerticalAlignment="Top" Height="26" Width="58" Grid.ColumnSpan="2"/>
        <Label x:Name="diagnoseResultLabel" Content="N/A" HorizontalAlignment="Left" Margin="123,72,-154,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Height="26" Width="31"/>

    </Grid>
</Page>

A: It's getting cut off because you dragged and dropped controls onto the form rather then hand coded the XAML. If you want it dynamic, you need to hand craft the XAML with the proper layout panels (Grid, StackPanel, etc) using proper layout techniques. The designer produced code is not dynamic at all. It's very strict.

A: It is getting cut off because you have fixed width on most of the controls. for example,
<Label x:Name="diagnoseResultLabel" Content="N/A" HorizontalAlignment="Left" Margin="123,72,-154,0" VerticalAlignment="Top" Grid.ColumnSpan="2" Height="26" Width="31"/>
Get rid of Width property (or make it Auto) and it would work. At the same time as @SledgeHammer pointed out, please craft the XAML with with some layouts.

A: What worked for me
I deleted this part from my XAMl
<Grid.RowDefinitions>
    <RowDefinition/>
    <RowDefinition Height="0*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
    <ColumnDefinition Width="0*"/>
    <ColumnDefinition Width="0*"/>
</Grid.ColumnDefinitions>

Not sure what it did but im assuming it deleted some transparent wall that was infront of it.


Q: Parsing XML with unknown structure in Snowflake I have a bunch of XML files that define tree hierarchies (relations between ID:s) via nested tags. I want to parse it to tabular format using Snowflake's SQL syntax for semi-structured data. For XML files with known structure, I know how to do it. But for these trees, the structure is unknown at parsing time, in which case I don't know how to solve it. The generic pattern that repeats is
<Nodes>
    <Node>
        ...
    </Node>
</Nodes>

See below for example data and desired output.
Is there a way to accomplish this using Snowflake's SQL syntax?
Example data:
<Nodes>
    <Node Id="1">
        <Nodes>
            <Node Id="2">
            </Node>
            <Node Id="3">
                <Nodes>
                    <Node Id="4">
                    </Node>
                    <Node Id="5">
                        <Nodes>
                            <Node Id="6">
                            </Node>
                        </Nodes>
                    </Node>
                    <Node Id="7">
                    </Node>
                </Nodes>
            </Node>
            <Node Id="8">
            </Node>
        </Nodes>
    </Node>
    <Node Id="9">
        <Nodes>
            <Node Id="10">
            </Node>
        </Nodes>
    </Node>
</Nodes>

Desired tabular output is:
|-----------|---------|
| parent_id | node_id |
|-----------|---------|
|      null |       1 |
|         1 |       2 |
|         1 |       3 |
|         3 |       4 |
|         3 |       5 |
|         5 |       6 |
|         3 |       7 |
|         1 |       8 |
|      null |       9 |
|         9 |      10 |
|-----------|---------|

A: So RECURSIVE is the property on FLATTEN you want to use here:
with data as (
    select parse_xml('<Nodes>
    <Node Id="1">
        <Nodes>
            <Node Id="2">
            </Node>
            <Node Id="3">
                <Nodes>
                    <Node Id="4">
                    </Node>
                    <Node Id="5">
                        <Nodes>
                            <Node Id="6">
                            </Node>
                        </Nodes>
                    </Node>
                    <Node Id="7">
                    </Node>
                </Nodes>
            </Node>
            <Node Id="8">
            </Node>
        </Nodes>
    </Node>
    <Node Id="9">
        <Nodes>
            <Node Id="10">
            </Node>
        </Nodes>
    </Node>
</Nodes>') as xml
)
select
    GET(f.value, '@Id') as id
    ,f.path as path
    ,len(path) as p_len
from data,
    TABLE(FLATTEN(INPUT=>get(xml,'$'), recursive=>true)) f
    where get(f.value, '@') = 'Node'
;

gives:
ID  PATH    P_LEN
1   [0] 3
2   [0]['$']['$'][0]    16
3   [0]['$']['$'][1]    16
4   [0]['$']['$'][1]['$']['$'][0]   29
5   [0]['$']['$'][1]['$']['$'][1]   29
6   [0]['$']['$'][1]['$']['$'][1]['$']['$'] 39
7   [0]['$']['$'][1]['$']['$'][2]   29
8   [0]['$']['$'][2]    16
9   [1] 3
10  [1]['$']['$']   13

from this you can now rebuild the hierarchy by find all the matches of path and taking the longest match.
OR
you can do a double nested loop like:
select
    GET(f1.value, '@Id') as id
    ,GET(f2.value, '@Id') as id
    ,f1.value
    ,f2.*
    , get(f2.value, '@')
from data,
    TABLE(FLATTEN(INPUT=>get(xml,'$'), recursive=>true)) f1,
    TABLE(FLATTEN(INPUT=>GET(xmlget(f1.value,'Nodes'), '$'))) f2
    where get(f1.value, '@') = 'Node'
;

BUT it doesn't give you the first row, and snowflake behaves differently with expanding the nodes
<node>
  <nodes>
    <node></node>
  </nodes>
<node>

and
<node>
  <nodes>
    <node></node>
    <node></node>
  </nodes>
<node>

which means you have to try handle both which is really gross.
EDIT:
So you can get closer but noting that if the second sub-case happens you can get node name get(f2.value, '@')  = 'Node' thus we have something we can stuff into IFF and in the first case, the value of the flatten is 'Node' thus we can hard code fetch the parents -> nodes -> node, thus:
select
    GET(f1.value, '@Id') as parent_id
    ,iff(get(f2.value, '@')  = 'Node', GET(f2.value, '@Id'), GET(xmlget(xmlget(f1.value,'Nodes'),'Node'), '@Id')) as child_id
from data,
    TABLE(FLATTEN(INPUT=>get(xml,'$'), recursive=>true)) f1,
    TABLE(FLATTEN(INPUT=>GET(xmlget(f1.value,'Nodes'), '$'))) f2
    where get(f1.value, '@') = 'Node'
    and (get(f2.value, '@')  = 'Node' OR f2.value = 'Node')
;

gives you:
PARENT_ID   CHILD_ID
1   2
1   3
1   8
3   4
3   5
3   7
5   6
9   10

which is only missing the NULL, 1 and NULL, 9 rows that you wanted.
EDIT 2
So going back to my original suggestion, pulling the node id's and the paths out and then doing a LEFT JOIN on the nodes with a QUALIFY to keep the longest match can be done like so, and gives the desired output:
with data as (
    select parse_xml('<Nodes>
    <Node Id="1">
        <Nodes>
            <Node Id="2">
            </Node>
            <Node Id="3">
                <Nodes>
                    <Node Id="4">
                    </Node>
                    <Node Id="5">
                        <Nodes>
                            <Node Id="6">
                            </Node>
                        </Nodes>
                    </Node>
                    <Node Id="7">
                    </Node>
                </Nodes>
            </Node>
            <Node Id="8">
            </Node>
        </Nodes>
    </Node>
    <Node Id="9">
        <Nodes>
            <Node Id="10">
                     </Node>
        </Nodes>
    </Node>
</Nodes>') as xml
), nodes AS (
select
    GET(f1.value, '@Id') as id
    ,f1.path as path
    ,len(path) as l_path
from data,
    TABLE(FLATTEN(INPUT=>get(xml,'$'), recursive=>true)) f1
    where get(f1.value, '@') = 'Node'
)
SELECT p.id as parent_id
    ,c.id as child_id
FROM nodes c
LEFT JOIN nodes p
    ON LEFT(c.path,p.l_path) = p.path AND c.id <> p.id
QUALIFY row_number() over (partition by c.id order by p.l_path desc ) = 1
;

gives:
PARENT_ID   CHILD_ID
null    1
1       2
1       3
3       4
3       5
5       6
3       7
1       8
null    9
9       10


Q: nth-child not rendering in Dreamweaver So I have a newsBox with float left that contains a picture, title and small text that contains small segments of news. I have 2 news boxes in every row, and I want every 1st newsBox to have an extra margin-right with 20px.
I have used .newsBox:nth-child(odd) { margin-right:20px; } in the css, and it works fine in Chrome but doesn't render in Dreamweaver CS6.
Is this not an officially supported rule? Or there is another more "clean" way to do this?
Thanks in advance!

A: The Dreamweaver design view sucks, it usually never gives an accurate representation of how things look in a real browser.
As an alternative and a helpful answer to your issues you can try the live view from dreamweaver that was implemented after CS5.
Here is a video explaining how to set it up.
http://tv.adobe.com/watch/creating-time/dreamweavers-live-view-helps-you-save-time/
As a final note, try not to use the design view and tey to get more into the code... once you get used to it you can read the code and visualize almost exactly (usually always better than design view) how things look. So please do not trust design view in dreamweaver for development.


Q: Create event on Facebook I am trying to create an event using graph API with following code:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   @"venue name",@"name",
                                   @"2012-01-13T17:00:00+0000",@"start_time",
                                   @"2012-01-16T01:30:00+0000",@"end_time",@"location",@"location name ch",@"1234567890",@"id", nil];
[self.facebook requestWithGraphPath:@"me/events"
                          andParams:params
                      andHttpMethod:@"POST"
                        andDelegate:self];

but when I am trying to create the event, an alert comes with "Facebook Fail bad URL". Can any one suggest what I am doing wrong or what I am missing in parameters or anywhere or is there any other method?
-Thanx in advance

A: Maybe because there is no param id.
If you want to set venue location, use location_id.

A: Try doing the same thing with the same parameters here:  https://developers.facebook.com/tools/explorer and see what the error message is.


Q: How to normalize PWM signal from RX and TX serial lines First off, I just want to apologize for any part of this question that may not be properly phrased. This is still very new area for me.
I am building an adapter for my Commodore 64 that lets it connect to a RS232 DB9 serial port over its user port. I've already made the connector and it works beautifully.
What I want to do now is get fancy and create LEDs that light up when the adapter is either sending or receiving data. I've followed the schematics used in this picture here, but the LEDs are barely visible due to high flicker when data is coming or going. I assume this is PWM and the LEDs are barely lit because the rx and tx lines on the serial adapter are turning on and off at super high rates (its a 9600 baud adapter).

I've tried connected a few different sized capacitors at different points in the circuit but I'm still not getting the desired effect, which is to see the LEDs light brightly at times of rx and tx signals going across. Is there a way to "tone down" the pwm so that the LEDs are brighter? One LED is wired to tx and another to rx.
Thanks.

A:
What I want to do now is get fancy and create LEDs that light up when the adapter is either sending or receiving data.

This implies peak detect and slow decay.
9600 baud is 960 char/s and a dwell time may be desirable from 0.1 to 1s by changing  1M to 10M (as shown.)

simulate this circuit – Schematic created using CircuitLab
Schematic fixed ( brain-phart)
With 50ohm driver in 74HCxxx @5V and 100nF RC=T=5us attack time.
 Good 'nuf.
It is possible to source 1mA current limited into ultrabright LEDs and load directly on Tx Rx.  The logic level threshold is same as TTL= 1.4V and LED needs at least 3 to 5V with 1k series which works for RS-232 ( but blinks )


Q: RDWeb Error 403 by choosing other Physical Path of Default Site the last days I tried to set up a Windows Server 2012 R2 IIS 8 Web-Server with the Laravel Framework and RDWeb.
RDWeb worked perfectly, until I tried to use Laravel.
The Problem is that I need to change the physical path of the Default Web Site form C:\inetpub\snx
to C:\inetpub\snx\public

and everytime I try this RDWeb write Error 403, if I want to open an rdp session by clicking on an item.
RDWeb Page if it does not work:
So the Error occurs every time I change the physical path to a "deeper" physical path.
Can you help me please?
Thank you
SUT_2

Here is the F12 Screenshot.
Something is forbidden - but I don't know how to solve the problem.

A: I have solved the problem - I just delted the web.config File in laravels /public-Folder.
Now, Laravel and RDWeb works - I hope I don't have further problems.
Thank you for your answers.


Q: Constraining types in Scala's generics to accept any kind of Int I want to write a function vaguely like:
def doubleit[A](a: A): A = {a + a}

But I want 'A' to mean any kind of Int, but not anything. Is there a way to give Scala a clue about what I want 'A' to mean?
def doubleit[A <: Int](a: A): A = {a + a}

is rejected by the compiler.

A: In plain Scala you can use type class Integral:
scala> def doubleit[A : Integral](a: A): A = implicitly[Integral[A]].plus(a, a)
doubleit: [A](a: A)(implicit evidence$1: Integral[A])A

scala> doubleit(2)
res0: Int = 4

scala> doubleit(BigInt(4))
res1: scala.math.BigInt = 8

Another possible syntax:
def doubleit[A](a: A)(implicit ev: Integral[A]): A = ev.plus(a, a)

ev is a commonly used name for those implicit parameters.
It is also possible to use normal operations like +, -, etc. instead of plus and minus:
def doubleit[A](a: A)(implicit ev: Integral[A]): A = {
  import ev._
  a + a
}

Or as per suggestion by @KChaloux, import from Integral.Implicits beforehand:
import Integral.Implicits._
def doubleit[A : Integral](a: A): A = a + a

If you want the function to support not only integers, but also Doubles, BigDecimals, etc. you can use Numeric instead of Integral:
import Numeric.Implcits._
def doubleit[A : Numeric](a: A): A = a + a

Explanation:
Writing [A : Integral] makes the function receive an implicit parameter of type Integral[A]. The implicits for all basic integral types are already defined in Scala, so you can use it with Int or BigInt straightaway. It is also possible to define new Integral types by defining a new implicit variable of type Integral[NewIntegralType] and implementing all the necessary methods.
The call to implicitly[Integral[A]] returns this implicit instance of Integral[A] which has method plus for addition, and other methods for performing other operations on integrals.


Q: Can you import exe4j script/project into install4j? Is it possible to import exe4j project into install4j? I have some legacy exe4j projects which I would like to import into install4j project.

A: Not directly, but you can do the following:
In your install4j project add a launcher (with arbitrary configuration) and open the project file in a text editor. Locate the launcher element and swap it out with the contents of your exe4j file.


Q: Java Initialize String array Can I initialize string array like this
String arr=new String[];/* initialize the array */

A: No, because you need to tell the compiler how big you want the array to be. Remember that arrays have a fixed size after creation. So any of these are okay, to create an empty array:
String[] array = {};
String[] array = new String[0];
String[] array = new String[] {};

Admittedly an empty array is rarely useful. In many cases you'd be better off using an ArrayList<String> instead. Of course sometimes you have to use an array - in order to return a value from a method, for example.
If you want to create an array of a specific length and then initialize it later, you can specify the length:
String[] array = new String[5];
for (int i = 0; i < 5; i++) {
    array[i] = String.valueOf(i); // Or whatever
}

One nice feature of empty arrays is that they're immutable - you can't change the length, and because then length is 0 there are no elements to mutate. So if you are going to regularly use an empty array of a particular type, you can just create it once:
private static final String[] EMPTY_STRING_ARRAY = {};

... and reuse that everywhere.

A: No you can't do that. It will produce compile error
  you shoud write
String[] arr=new String[4];  //you should declared it sized

or
String[] arr={"asgk"};

or
String[] arr=new String[]{};


Q: ComputedFactors.profitPercentage -> detectionData.aggFields.profitPrecent What is the meaning of -> in the case of SCALA code?
ComputedFactors.profitPercentage -> detectionData.aggFields.profitPrecent


Q: Infinite scroll : Sequencing post with Ajax and php I'm trying to infinite scroll my page using ajax php and jquery.
I have pasted the jquery code doe reference. I'm trying to get post in sequence using jquery and php. My jquery code sends the counta to the php script. php script then returns the result according to the number it receives. I'm trying to get the post in sequence so that they don't repeat. I get the post when the user reaches the bottom of the page.
Any other answers then this are also welcomed. But I just want to use the core of jquery meaning without inclusion of any external library.
var counta = 0;
$(document).ready(function(){

    $(window).scroll(function() {

   if($(window).scrollTop() + $(window).height() > $(document).height() - 2000) {
    //  console.log("Here");

    $.ajax({
                            type: 'post',
                            url: 'extendost.php',
                            data: '&articles='+counta,
                            success: function (data) {
                            alert(counta);
                            $("#morepost").append(data);
                            counta++;
                            },
                            error: function (data) {
                            alert(data);
                            },
          });

   }
});

A: This is what I would do:

0

$(window).data('ajaxready', true).scroll(function(e) {
    var postHeight = $('#post_content').height();
    if ($(window).data('ajaxready') == false) return;
        var start = parseInt($('#start').text());
        var limit = 30; // return 30 posts each
        if ($(window).scrollTop() >= postHeight - $(window).height() - 400) {
            var height = $(window).scrollTop();
            $(window).data('ajaxready', false);
            if (start > 0) {
                var new_start = start + limit;
                var dataString = {articles : start, limit : limit};
                $.ajax({
                    cache: false,
                    url: 'extendost.php',
                    type: 'POST',
                    data: dataString,
                    success: function(data) {
                        if ($.trim(data).indexOf('NO POST') > -1) {
                            /* stop infinite scroll when no more data */
                            $('#start').text(0);
                        } else {
                            $('#post_content').append(data);
                            $('#start').text(new_start);
                        }
                        $(window).data('ajaxready', true);
                    }
                });
            }
        }
    });

This way your #start value will change as it scroll and ready for the next scroll value
Then base on the $start (offset) and $limit, make your query like
$query = "SELECT * FROM articles LIMIT {$limit} OFFSET {$start}";
if (!$result = mysqli_query($con, $query) {
  echo 'NO POST';
} else {
  // fetch and echo your result;
}


Q: Detailed quickly tutorial Hi I kindly need a more detailed quickly tutorial that explain the python code./ For example, adding a login form to an application

A: Since you don't tell us what you already found, I will just give a list of hopefully useful links:
Quickly on the Ubuntu App Developer site
Python Gtk3
Python Gtk2
Acire Python snippets

A: Quickly seems to be dead project since 2012. No one mentions that anywhere except in some obscure bug reports.


Q: Homotopy groups of wedge of spaces Let $X$ and $Y$ be topological spaces with $\pi_{i}(X) = \pi_{i}(Y) = 0$ for $i \geqslant n$
Is it true that $\pi_{i}(X\vee Y) = 0$ for $i \geqslant n$?
If no, is it true for $CW$ complexes?

A: As Freakish mentions in the comments, there is a contractible space $X$ for which $X\vee X$ has an uncountable fundamental group.
Of course this particular example could not happen if $X$ were well-pointed, and in particular could not happen if $X$ were a CW complex. However, there still are many examples of n-anticonnected CW complexes $X,Y$ for which $X\vee Y$ has nontrivial homotopy groups in arbitrarily high dimensions.
Some simple examples can be constructed as follows. Take any well-pointed space $X$ and let $\nabla:X\vee X\rightarrow X$ be the folding map. A little dexterity computes its homotopy fibre, showing that there is a fibration sequence
$$\Sigma\Omega X\rightarrow X\vee X\xrightarrow{\nabla}X.$$
If we now take an Eilenberg-Mac Lane space $X=K(A,n)$, then $\pi_iK(A,n)=0$ for $i>n$. However, from the long exact sequence of the fibration above we extract isomorphisms
$$\pi_i(\Sigma K(A,n-1))\cong \pi_i(K(A,n)\vee K(A,n))$$
for all $i>n$. These groups will generally not be trivial.
For instance, take $X=K(\mathbb{Z},2)\simeq \mathbb{C}P^\infty$. Then $\Omega \mathbb{C}P^\infty\simeq S^1$ and we have a fibration sequence
$$S^2\rightarrow \mathbb{C}P^\infty\vee \mathbb{C}P^\infty\rightarrow \mathbb{C}P^\infty.$$
This leaves
$$\pi_i(\mathbb{C}P^\infty\vee\mathbb{C}P^\infty)\cong\pi_iS^2\cong\pi_iS^3$$
for all $i>2$.


Q: Why does my Path.expanduser keep getting this following error message? ['str' object has no attribute '_drv'] I am trying to use Path.expanduser() to extract the base directory of all of my web app users. I intend to use the base directory to locate the Downloads folder and direct all of my web app exports into their respective Downloads folder. But when I implement this function and try to test it out by checking directory it returns me, I only get the error message of ['str' object has no attribute '_drv'] instead of the base directory.
Imported pathlib into my app.py
snippet of my app.py
from flask import Flask, flash, redirect, render_template, request, session, abort, jsonify, url_for, Markup
from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField, SelectField, SelectMultipleField
from werkzeug import secure_filename
from pprint import pprint
from pathlib import Path

@app.route('/process_pt', methods = ['GET', 'POST'])
def process_pt():
    if request.method == 'POST':
        colSelection = request.form.get('selectedCol')
        cols = colSelection.split(",")
        valSelection = request.form.get('selectedVal')
        global filtered_df
        filtered_df = pd.pivot_table(filtered_df, values=[valSelection], index=cols, aggfunc=np.sum)
        filtered_df.reset_index()

        dl_path = Path.expanduser('~\\Users')
        print(str(dl_path))

        return render_template(
            'summarized_df.html',
            data = filtered_df.to_html()
        )

Expected: dl_path to return the base directory
Actual: Error Message 'str' object has no attribute '_drv'

A: You should be using os.path.expanduser for working with strings.
pathlib.Path.expanduser is a method of pathlib.Path objects. You could convert your string to such an object and do what you want with Path('~\\Users').expanduser().


Q: Wrong verbiage in error alert message while suggesting edits I was suggesting an edit to a question, while submitting it says:

Oops! Your answer couldn’t be submitted because:

Should this read as Your edit suggestion couldn’t be submitted or better verbiage?


Q: Select2 not removing id from token list I am using Select2 to assign content to other users (multiple tags). It all works great except I can not find out how to remove assignees once added.
Once I have added a user to the list of assignees in my modal, after I click the cross with class select2-search-choice-close, the corresponding list item with class select2-search-choice is deleted from the input field, but the id is not removed from assignee tokens (and is thus passed to the controller when I submit the form).
What am I missing?
NOTE: I am not 100% sure whether this is related, but I noticed that the assignee_ids passed when I submit the form sometimes contain the same id several times (e.g: assignee_ids => "12,1,4,4").
This is how I initialize the input:
    $('#assignable_item_assignment_assignee_ids').select2({
      minimumInputLength: 2
      tags: true
      tokenSeparators:[',', ' ']
      createSearchChoice: (term, data) ->
        {id: term, new_choice: true}
      multiple: true
      ajax:
        url: url
        dataType: 'json'
        quietMillis: 150
        data: (term, page) ->
          query: term
        results: (data, page) ->
          return {results: data}
      formatResult: userFormatResult
      formatSelection: userFormatSelection
      formatInputTooShort: (term, minLength) ->
        "Search existing users or assign by email"
      dropdownCssClass: 'select2'
    })

And this is the form I am using:
  <%= form_for AssignableItemAssignment.new, url: assignable_items_assignments_path, html: { class: "form-horizontal", id: "new-assignment" }  do |f| -%>
    <fieldset>

        <%= f.label :to %>

          <%= f.text_field :assignee_ids, placeholder: "Search users by name or email", class: 'select2'  %>

        <%= f.label :add_a_message %>
        <%= f.text_area :message, rows: 3, placeholder: "Add a message for your recipients (optional)" %>

      <%= f.button "Submit", disable_with: 'Submiting' %>
    </fieldset>
  <% end %>

A: I had a similar problem, which is fixed after installing latest release (3.3.2)


Q: If else condition in RecyclerView onBindViewHolder I'm trying to set up a if else statement on my onBindViewHolder() such that it checks for status, then sets text and text color depending on the status found.
I've tried but it just gives me the results of the first condition on every item in the RecyclerView.
Here is my code for the Adapter:
    public class PreviousSettingsAdapter extends RecyclerView.Adapter<PreviousSettingsAdapter.PreviousSettingsViewHolder> {
private List<Setting> SettingsModelList;
private Context context;

public PreviousSettingsAdapter(Context context, List<Setting> SettingsModelList) {
    this.SettingsModelList = SettingsModelList;
    this.context = context;
}

public class PreviousSettingsViewHolder extends RecyclerView.ViewHolder {

    @BindView(R.id.date)
    TextView date;
    @BindView(R.id.Setting_id)
    TextView SettingId;
    @BindView(R.id.status)
    TextView status;

    public PreviousSettingsViewHolder(View itemView) {
        super(itemView);
        ButterKnife.bind(this, itemView);
    }
}

@NonNull
@Override
public PreviousSettingsViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
    View itemView = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.placed_Setting_items, parent, false);
    return new PreviousSettingsViewHolder(itemView);

}

@Override
public void onBindViewHolder(@NonNull PreviousSettingsViewHolder holder, int position) {
    Setting singleSetting = SettingsModelList.get(position);
    holder.date.setText(singleSetting.getCreatedAt());
    holder.SettingId.setText("Setting Id: " + String.valueOf(singleSetting.getId()));

    boolean paymentStatus = singleSetting.getConfirmed();
    boolean fulfilledStatus = singleSetting.getProcessed();

    if (paymentStatus && !fulfilledStatus ) {
        holder.status.setText(R.string.processed);
        holder.status.getResources().getColor(R.color.colorOrange);

    } else
     if (!paymentStatus && !fulfilledStatus) {
        holder.status.setText(R.string.unchanged);
        holder.status.getResources().getColor(R.color.colorRed);

    } else if(paymentStatus && fulfilledStatus){
        holder.status.setText(R.string.delivered);
        holder.status.getResources().getColor(R.color.colorGreen);

    }else{
        holder.status.setText(" ");
    }

    }

@Override
    public int getItemCount () {
        return SettingsModelList.size();
    }
}

A: Debug and kindly see that the paymentStatus  and fulfilledStatus values.As you said, it might be going into the if loop with those conditions satisfying.


Q: How show version number in title of installation in WIX? I need to display the version number in the title along with the application name.
Currently, it looks like

Here is my wix snippet:
<Product Id="$(var.ProductId)" Name="Test Application" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Test1111 Inc"
       UpgradeCode="C9BC6B42-FCAF-4E96-8F8F-E9D0AC4F393B">

If I change it (append version number in the Name attribute) as below, it will display the version number in all the places Title, Welcome text/description but I just want to change in Title.
<Product Id="$(var.ProductId)" Name="Test Application $(var.ProductVersion)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Test1111 Inc"
       UpgradeCode="C9BC6B42-FCAF-4E96-8F8F-E9D0AC4F393B">

How we can accomplish this in Wix?

A: Localization Override: You can try to add a localization file and then override the WelcomeDlgTitle string (the WiX GUI string list / list of string identifiers can be found here (for English):

*

*Note that this assumes the Mondo dialog set:

*

*Add to WiX markup: <UIRef Id="WixUI_Mondo" />

*Add reference to %ProgramFiles(x86)%\WiX Toolset v3.11\bin\WixUIExtension.dll

*WiX Hello World Sample in Visual Studio (WiX markup with comments towards bottom is usually enough for developers to get the gist of things)

*Right click your WiX project in Visual Studio => Add => New Item...

*Select WiX v3 in the left menu. Double click Localization file (very common to add a WiX v4 file instead, double check please)

*Add the string below to the localization file:
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
  <String Id="WelcomeDlgTitle">{\WixUI_Font_Bigger}Welcome to the [ProductName] [ProductVersion] Setup Wizard</String>
</WixLocalization>

*Compile and test
Sample Dialog:

WiX GUI: I am quite confused myself with WiX GUI, hence I wrote this little overview and "check list" to remember better (uses a similar approach to change the style of a dialog entry): Changing text color to Wix dialogs.
Links:

*

*WiX UI Sources: (languages strings and dialog sources)

*

*https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib

*WiX UI English Strings:

*

*https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/WixUI_en-us.wxl

*WiX UI Norwegian Strings:

*

*https://github.com/wixtoolset/wix3/blob/develop/src/ext/UIExtension/wixlib/WixUI_nb-NO.wxl

*There are many such language files, use above link for full list

A: WiX UI extension doesn't allow this type of customization.  Your two chances would be
1) define Name="Test Application $(var.ProductVersion)"   (Side effect. version listed in programs and features twice
2)  Stop using the WiXUI extension and instead clone all the code from https://github.com/wixtoolset/wix3/tree/develop/src/ext/UIExtension/wixlib  into your project.


Q: Using 'this' in javascript function attached to object property Edit:
The question referred to as the duplicate doesn't really answer why arrow functions shouldn't be used to access a non-lexical this. It just answers that arrow functions automatically bind this. My situation is that using an arrow function rather than a normal function cause me to lose the correct reference of this. If you need this outside of the current scope, use a normal function.
I've searched around for a solution to my problem with no luck. Even if I was pointed in the right direction as to what I needed to do would be awesome! My problem essentially is that this.Favkey is undefined here:
const setFavorite = val => {
  console.log(this);
  this.Favorite = val;
  AsyncStorage.setItem(this.Favkey, JSON.stringify(val));
};

This function is getting assigned to a particular object like so:
  for (const obj of objArray) {
    obj.Favkey = `c${obj['-id=']}`;
    obj.Favorite = await getFavorite(obj.Favkey);
    obj.SetFavorite = setFavorite;
  }

And then I am calling this later on a button:
onPress={val => props.myObj.SetFavorite(val)}

In the first block of code, I want this to be the specific obj that I am attempting to enclose the function on. But this.Favkey in setFavorite is undefined. What is printed out instead on console.log(this) is what I think is the whole prototype of Object. So I'm not quite sure what I'm doing wrong here.

A: Don't use an arrow function - it loses the binding to this which is what you're trying to access. Just use a normal function:
const setFavorite = function(val) {...};


Q: How to determine if a File has finished downloading I download GB's of stuff every day. And I get all OCD and organize files and folders so many times during the day and it's driving me nuts.
So I plan on writing an app that detects when a file has finished downloading (to the Windows Downloads folder), and then places it in its relevant categorized folder.
E.g.:
I download an app. When the app detects that the file has finished downloading, it places it into Sub-folder Applciations. Or, when I finish downloading a Document, the document is then placed inside the Documents sub-folder of the Downloads folder.
The problem I have here is that I don't want to do this unless there is a definitive way to tell whether a file has finished downloading.
Things I have thought of:

*

*I have thought about implementing FileSystemWatcher on the Downloads folder, and when a new file is created there, it gets added to a list. And when FileSystemWatcher detects that the file size has changed, or has been modified, it will start a timer; the purpose of this timer is to determine after x amount of seconds whether the download is complete. It does this by assuming (wrongly) that if a file's size has not increased in a specified period of time, the download is complete.

That's all I can think of. Any ideas on how this kind of thing can be accomplished?

A: File is blocked when it is accessed. Not every file. But you could check whether the file is open by another application. If the file is not open - this should tell you, that it has downloaded completely.


Q: Generating new column of data by aggregating specific columns of dataset My dataset has a few interesting columns that I want to aggregate, and hence create a metric that I can use to do some more analysis.
The algorithm I wrote takes around ~3 seconds to finish, so I was wondering if there is a more efficient way to do this.
def financial_score_calculation(df, dictionary_of_parameters):
    for parameter in dictionary_of_parameters:
        for i in dictionary_of_parameters[parameter]['target']:
            index = df.loc[df[parameter] == i].index
            for i in index:
                old_score = df.at[i, 'financialliteracyscore']
                new_score = old_score + dictionary_of_parameters[parameter]['score']
                df.at[i, 'financialliteracyscore'] = new_score
    for i in df.index:
        old_score = df.at[i, 'financialliteracyscore']
        new_score = (old_score/27.0)*100 #converting score to percent value
        df.at[i, 'financialliteracyscore'] = new_score

    return df

Here is a truncated version of the dictionary_of_parameters:
dictionary_of_parameters = {
    # money management parameters
    "SatisfactionLevelCurrentFinances": {'target': [8, 9, 10], 'score': 1},
    "WillingnessFinancialRisk": {'target': [8, 9, 10], 'score': 1},
    "ConfidenceLevelToEarn2000WithinMonth": {'target': [1], 'score': 1},
    "DegreeOfWorryAboutRetirement": {'target': [1], 'score': 1},
    "GoodWithYourMoney?": {'target': [7], 'score': 1}
    }

EDIT: generating toy data for df
df = pd.DataFrame(columns = dictionary_of_parameters.keys())
df['financialliteracyscore'] = 0
for i in range(10):
    df.loc[i] = dict(zip(df.columns,2*i*np.ones(6)))

A: Note that in Pandas you can index in ways other than elementwisely with at. In the four-liner below, index is a list which can then be used for indexing with loc.
for parameter in dictionary_of_parameters:
    index = df[df[parameter].isin(dictionary_of_parameters[parameter]['target'])].index
    df.loc[index,'financialliteracyscore'] += dictionary_of_parameters[parameter]['score']
df['financialliteracyscore'] = df['financialliteracyscore'] /27.0*100

Here's a reference although I personally never found it useful in my earlier days of programming... https://pandas.pydata.org/pandas-docs/stable/indexing.html


Q: Better way to check bounds I am checking to see in an object is outside the bounds of a box.  If it is outside the bounds of the box, then I put it back in.
if position.left < dot_radius
    dot.css 'left', dot_radius
if position.left > display_width - dot_radius
    dot.css 'left', display_width - dot_radius
if position.top < dot_radius
    dot.css 'top', dot_radius
if position.top > display_height - dot_radius
    dot.css 'top', display_height - dot_radius

The code is a little verbose.  Is there a better way to write it?

A: You could make a simple function:
bounds = (prop, min, max) ->
    val = position[prop];
    if (val < min)
        dot.css prop, min
    if (var > max)
        dot.css prop, max

bounds 'left', dot_radius, display_width - dot_radius
bounds 'top', dot_radius, display_height - dot_radius

You even might put the dot_radius inside the function, though it gets less reusable then.


Q: how Apollo client optimisticResponse working http://dev.apollodata.com/react/mutations.html
I am trying out with optimisticResponse, but i am confused... and couldn't get it working on my local.
My questions are:

*

*will optimisticResponse update the props and hence the re-render? how important is __typename: 'Mutation' can you leave it?

*updateQueries is for new record appear? is this function trigger automatically or you need to invoke it?

is there any full example of out there which include the apollo server side?

A: Solution found:
const networkInterface = createNetworkInterface('http://localhost:8080/graphql');
    this.client = new ApolloClient({
        networkInterface,
        dataIdFromObject: r => r.id
    }
);

dataIdFromObject is the one thing i am missing during the Apolloclient initiation
dataIdFromObject (Object) => string
A function that returns a object identifier given a particular result object.

it will give unique ID for all result object.


Q: How to use slack auth running in docker from within a private IP addressed enterprise network We are deploying our application in docker within our enterprise. The host machine has an RFC1918 space in the 10/8 network and the docker containers are on 172.21/16 space.
I'm trying to use slack authentication to authenticate our node/react application which works locally in development mode, but I believe the second layer of private address space may be throwing a wrench into the communications. The redirect url for the node/react app is using the IP of the host machine, which is what you are hitting when you attempt to login to the server via the web interface. I've tried many combinations but basically you navigate to 10.1.1.4:3000 which is configured in the Slack API as our redirect URL and is also configured in the .env file for our node app. Once you click continue on the slack auth page the page doesn't load but just hangs.
I've changed the redirect URL to localhost, the gateway IP of the docker network, and the IP address of the host machine the docker container is running on, which I think is the way to go, but nothing lets me hit my app.

A: If you're using Linux docker hosts, you could try using the host network mode.


Q: Convert Doc,Docx to TIFF with delphi Hi
How can i convert doc,docx to TIFF whith delphi?

A: In short, you can't.
Doc and TIFF are two completely different things. It's not like converting from BMP to TIFF (two image formats), or WAV to MP3 (two audio formats). For very limited Word documents, I suppose you could run Word through OLE automation (or maybe even embed Word in your application for better control), then take a screenshot, but I think your problems runs deeper than that. Maybe you could provide some more info about what you try to achieve?

A: I've done it from within Word, however the code is long lost I'm sorry.
I created an Office plugin using the Add-in Express Component.
I used Word automation to convert the current document to RTF, used WP-Tools to render, which gave me the bitmap for each page.  Finally I used GDI+ to create the multi-page TIFF.

A: The standard trick is like with word to pdf: find a virtual printer that outputs tiffs, and instrument word over OLE to print to the virtual printer.
If I put "tiff printer virtual" in google, I see quite some hits. (not all free though, and of course it complicates installation to use two programs (word+printer) to do this)

A: Word is not able to save its documents to TIFF format. Your best options are to use third party software which can do that. Just google for Doc to Tiff.

A: When looking for tools to do this, you should also be aware that not all TIFF files are faxable.  TIFF files can contain a whole range of image formats and sizes.  You need to find a tool which can convert your document to monochrome bitmaps 1728 pixels wide, with the page images each in a single strip and with a compression method supported by your fax software.

A: A good fax software usually comes with a fax printer driver, check with the maker of your fax software if they have one. With a driver you can simply use OLE Automation to make Word print the document to this driver. The fax software we use expects the fax number and other parameters embedded in the text like this: @@NUMBER12345678@@


Q: What is the use case of Firebase Queue? I am doing some experiments on Firebase realtime database. Though I came across firebase-queue. This is what docs says https://github.com/firebase/firebase-queue.

A fault-tolerant, multi-worker, multi-stage job pipeline built on the Firebase Realtime Database.

What does it mean ?

A: firebase-queue lets you use Realtime Database to submit jobs to a backend server you control.  Clients write into the database, and that data is received by firebase-queue, where you can do whatever you want with it.
If you have interest in running backend code that reacts to changes in your Firebase project, you are much better off looking into Cloud Functions for Firebase, because you won't have to manage a backend server at all.   You just write and deploy code to it.


Q: How do I get how many computers I have delivered per date in SQL Server? I have a table with the following columns:
Inventory
ID,
SerialComputer,
RegistrationDate,
Deadline

I want to make a query in which the first column shows me all the dates on which computers have been delivered, and next to the amount of computers that were delivered on that date, how can I make that possible in SQL Server?
I know I get the dates this way:
SELECT DISTINCT Deadline
FROM Inventory
ORDER BY Deadline

How do I add the COUNT () with the SerialComputer column?

A: Do aggregation using GROUP BY clause :
SELECT Deadline, COUNT(*) AS [# computers delivered]
FROM Inventory
GROUP BY Deadline;

DISTINCT will remove duplicate values so, that will not help you.

A: Presumably, deadline is the delivery date.  If so, you want aggregation:
SELECT Deadline, COUNT(*)
FROM Inventory
GROUP BY Deadline
ORDER BY Deadline


Q: Strange max notation with mixed inside and outside indexes I've found a question regarding this notation on another board. I can't get it myself and decided to ask here. I don't know the source of the notation.
Usually under the $\max$ sign we have a definition of the set of the maximum search for the $\max$ argument. Here we have two indexed $x$. Is it "for each pair of such $x$"?
Furthermore, on the inside function there's an iteration over the same indices. Is it a poor choice of indices or I don't get something?
How this notation should be read? Is it widely used?
$$
\max_{(x_i),(x_{ij})} \left\{ -\sum_{i\in I} f_i x_i + \sum_{j\in J}\sum_{i\in I} p_{ij} x_{ij} \right\}.
$$

A: Looks like two different sets of decision variables, both of which are called $x$.  I think it would be clearer as follows:
$$\max_{x, y} \left\{ -\sum_{i\in I} f_i x_i + \sum_{i\in I} \sum_{j\in J}p_{ij} y_{ij} \right\}.$$
Alternatively, you could combine the two $\sum_{i\in I}$:
$$\max_{x, y} \left\{\sum_{i\in I}\left(-f_i x_i + \sum_{j\in J}p_{ij} y_{ij}\right) \right\}.$$


Q: Parallel checkout of different branches of the same repository I am trying to figure out if is possible to have on the server cloned more that one branches from the same repository. Those branches are cloned into different folders through ssh.
Let's say:
feature/feature1 -> C:\feature1 (user1)
feature/feature2 -> C:\feature2 (user2)
feature/feature3 -> C:\feature3 (user3)
feature/feature4 -> C:\feature4 (user4)

The goal is to access every folder by different user at the same time (more different checkouts at the same time are needed). Pulls, pushes, commits are in parallel proces ...
Does this solution make sense? We need to work on server as our system has access just there. There is not access to our local PCs.

A: The git worktree method described in comments will work on a Unix/Linux system, but probably not on Windows if your different users have different accounts (which they should, for sanity if nothing else).  It has some drawbacks: in particular, while each working tree gets its own index, all the working trees share one single underlying repository, which means that Git commands that must write to the repository have to wait while someone else has the repository databases busy.  How disruptive this might be in practice depends on how your users would use this.
It's usually a much better idea to give each user their own full clone, even on a shared server, and even if it's a Unix/Linux system.  They can then push to, and fetch from, one more clone on that shared server, that you designate as the "source of truth".  There is only one drawback to this method of sharing, which is that each clone occupies its own extra disk space.  However, this tends to be minor: when cloning a local repository locally, using file-oriented "URLs":
git clone /path/to/source-of-truth.git work/my-clone

Git will, to the extent possible, use "hard links" to files to save space.  These hard links work quite well, although the links "break apart" over time (as files get updated) and gradually the clones wind up taking more and more space.  This means that every once in a while—say, once a month or once a year or so, depending on activity—it may be helpful for space purposes to have your users-on-the-shared-server delete their clones and re-clone at a time that's convenient for them.  This will re-establish complete sharing.
(Of course, disk space is cheap these days, and the right way to handle this on a modern Linux server is probably to set up a ZFS pool with, say, a bunch of 8 or 12TB drives in a RAIDZ1 or RAIDZ2 configuration to get many terabytes of usable storage at around $30 per terabyte, even counting overhead and the cost of cabling and so on.  You'll probably pay more for some high end Intel CPU than you do for all the drives put together.)


Q: Using the ROLLUP function in CASE Statement I have a query where I need to dynamically change the column I perform the ROLLUPon.
So here is the sample data:
+-----------+---------+-------+--------+-------+----------------------------+
|Location_ID|PLANT    |  ...  |COUNT_IO|TIME_IO|TIME_TARGET_OEE_100_FILTERED|
+-----------+---------+-------+--------+-------+----------------------------+
|01105123000|1        |  ...  |10      |50     |75                          |
+-----------+---------+-------+--------+-------+----------------------------+
|01105123001|1        |  ...  |13      |65     |75                          |
+-----------+---------+-------+--------+-------+----------------------------+
|01105123002|1        |  ...  |15      |75     |65                          |
+-----------+---------+-------+--------+-------+----------------------------+
|01105123003|1        |  ...  |13      |65     |75                          |
+-----------+---------+-------+--------+-------+----------------------------+
|01101113001|2        |  ...  |40      |200    |400                         |
+-----------+---------+-------+--------+-------+----------------------------+
|01101113002|2        |  ...  |20      |100    |400                         |
+-----------+---------+-------+--------+-------+----------------------------+

desired output (ROLLUP on LOCATION_ID):
+-----------+---------+-------+--------+-------+
|Location_ID|PLANT    |  ...  |COUNT_IO|OEE    |
+-----------+---------+-------+--------+-------+
|01105123000|1        |  ...  |10      |66,66  |
+-----------+---------+-------+--------+-------+
|01105123001|1        |  ...  |13      |86,66  |
+-----------+---------+-------+--------+-------+
|01105123002|1        |  ...  |15      |115,38 |
+-----------+---------+-------+--------+-------+
|01105123003|1        |  ...  |13      |86,66  |
+-----------+---------+-------+--------+-------+
|NULL       |1        |  ...  |51      |87,93  |
+-----------+---------+-------+--------+-------+

desired output (ROLLUP on PLANT):
+-----------+---------+-------+--------+-------+
|Location_ID|PLANT    |  ...  |COUNT_IO|OEE    |
+-----------+---------+-------+--------+-------+
|01105123000|1        |  ...  |51      |87,93  |
+-----------+---------+-------+--------+-------+
|01105123001|1        |  ...  |51      |87,93  |
+-----------+---------+-------+--------+-------+
|01105123002|1        |  ...  |51      |87,93  |
+-----------+---------+-------+--------+-------+
|01105123003|1        |  ...  |51      |87,93  |
+-----------+---------+-------+--------+-------+
|01101113001|2        |  ...  |60      |37,5   |
+-----------+---------+-------+--------+-------+
|01101113002|2        |  ...  |60      |37,5   |
+-----------+---------+-------+--------+-------+
|...        |NULL     |  ...  |111     |50,92  |
+-----------+---------+-------+--------+-------+

sample code:
SELECT
--Dimensions:
  --VALUES_FOR_TABLEAU_METADATA:
    DISTINCT LOCATION_ID,
    CONTINENT,
    COUNTRY,
    PLANT,
    BUSINESS_UNIT,
    PRODUCT,
--Measures (KPI's):
  --Count:
    CASE
        WHEN <Parameters.BU> = '%' AND <Parameters.Plant> = '%' THEN SUM(COUNT_IO) OVER (PARTITION BY BUSINESS_UNIT)
        WHEN <Parameters.BU> != '%' AND <Parameters.Plant> = '%' THEN SUM(COUNT_IO) OVER (PARTITION BY PLANT)
        ELSE SUM(COUNT_IO) OVER (PARTITION BY LOCATION_ID)
    END AS "COUNT_IO",
  --OEE:
    CASE
        WHEN TIME_IO = 0 OR TIME_TARGET_OEE_100 = 0
        THEN 0
        ELSE
            CASE
                WHEN <Parameters.BU> = '%' AND <Parameters.Plant> = '%' THEN SUM(TIME_IO) OVER (PARTITION BY BUSINESS_UNIT) *100/SUM(TIME_TARGET_OEE_100_FILTERED) OVER (PARTITION BY BUSINESS_UNIT)
                WHEN <Parameters.BU> != '%' AND <Parameters.Plant> = '%' THEN SUM(TIME_IO) OVER (PARTITION BY PLANT) *100/SUM(TIME_TARGET_OEE_100_FILTERED) OVER (PARTITION BY PLANT)
                ELSE SUM(TIME_IO) OVER (PARTITION BY LOCATION_ID) *100/SUM(TIME_TARGET_OEE_100_FILTERED) OVER (PARTITION BY LOCATION_ID)
            END
    END AS "OEE"
FROM VALUES_FOR_TABLEAU_METADATA
WHERE
  COUNT_TARGET_OEE != 0 AND PLANT LIKE <Parameters.Plant> AND BUSINESS_UNIT LIKE <Parameters.BU> AND LOCATION_ID LIKE <Parameters.LocationID> AND WORKING_DAY BETWEEN <Parameters.WorkingDay_Start> AND <Parameters.WorkingDay_End>
GROUP BY
    CASE
        WHEN <Parameters.BU> = '%' AND <Parameters.Plant> = '%' THEN LOCATION_ID
        WHEN <Parameters.BU> != '%' AND <Parameters.Plant> = '%' THEN LOCATION_ID
        ELSE ROLLUP(LOCATION_ID)
    END,
    CASE
        WHEN <Parameters.BU> = '%' AND <Parameters.Plant> = '%' THEN PLANT
        WHEN <Parameters.BU> != '%' AND <Parameters.Plant> = '%' THEN ROLLUP(PLANT)
        ELSE PLANT
    END,
    CASE
        WHEN <Parameters.BU> = '%' AND <Parameters.Plant> = '%' THEN ROLLUP(BUSINESS_UNIT)
        WHEN <Parameters.BU> != '%' AND <Parameters.Plant> = '%' THEN BUSINESS_UNIT
        ELSE BUSINESS_UNIT
    END,
    CONTINENT, COUNTRY, PRODUCT, COUNT_IO, COUNT_TARGET_OEE, TIME_IO, TIME_TARGET_OEE_100, TIME_TARGET_OEE_100_FILTERED

I guess that the problem is caused by the ROLLUP in the CASE statement, since the code up to the GROUP BY is working fine. Also I am not quite sure if the usage of my CASE statement is used properly.
The Parameters may look quite weird, but they are for use in Tableau and work fine.
The error I get is:

ORA-00904: "ROLLUP": invalid identifier

A: The best and easiest way to work with Tableau is to let it generate optimized SQL based on what you express in Tableau. Don't use custom SQL with Tableau except in rare situations. You get a lot more flexibility and performance that way.
In this case, I recommend just connecting to VALUES_FOR_TABLEAU_METADATA from Tableau.

*

*Define a string valued parameter to allow the user to choose the dimension for his "rollup", say called Dimension_For_Rollup with a list of two possible values: "Location" and "Plant".

*Define a calculated field called Selected_Dimension defined as if [Dimension_For_Rollup] = "Location" then [Location Id] else [Plant] end

*Use Selected_Dimension on your viz as desired.

*Show the parameter control for Dimension_For_Rollup

So the user can toggle between Dimensions for Rollup as he wishes, and Tableau will generate optimized SQL, cache the query as needed.
Your Count_IO or Time_IO stats can be expressed in different ways in Tableau, possible needing Tableau's level of detail (LOD) calcs, but again -- your Tableau experience will be better if you don't try to hard code everything in SQL in advance. You can use Tableau that way, but you're making life hard on yourself and giving up a good part of the benefit.


Q: Miniforge Conda "PackagesNotFoundError" on ARM processor for PyTorch I am unable to install any packages with miniforge 3 (conda 4.11.0).
I am attempting this on a Jetson Nano Developer Kit running Jetpack. Initially it had conda installed but it seems to have gone missing, so I decided to reinstall conda. It looks like the base version of anaconda/miniconda is having issues running on ARM processors, and so I downloaded miniforge which apparently is working.
I have set up an environment successfully, but attempting to download pytorch gives the following error:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pytorch

Current channels:

  - https://conda.anaconda.org/pytorch/linux-aarch64
  - https://conda.anaconda.org/pytorch/noarch
  - https://conda.anaconda.org/abinit/linux-aarch64
  - https://conda.anaconda.org/abinit/noarch
  - https://conda.anaconda.org/matsci/linux-aarch64
  - https://conda.anaconda.org/matsci/noarch
  - https://conda.anaconda.org/conda-forge/linux-aarch64
  - https://conda.anaconda.org/conda-forge/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

This is for Python 3.7.12. It seems this issue persists no matter what version of pytorch I try to install.
I am however able to install some other packages, as I was able to install beautifulsoup4.

A: There is no linux-aarch64 version of pytorch on the default conda channel, see here
This is of course package specific. E.g. there is a linux-aarch64 version of beautifulsoup4 which is why you wre able to install it without an issue.
You can try to install from a different channel that claims to provide a pytorch for aarch64, e.g.
conda install -c kumatea pytorch


Q: Thunderbird TbSync plugin not compatible... but compatible? OS: Ubuntu/Linux 20.04
Thunderbird: 102.2.2
My calendar stopped working, and it appears that the reason for that is that the TbSync plugin is not compatible with TB 102.2.2. No updates of the plugin are available. However, when I click on "more information" I get a message saying "The add-on “TbSync” seems to be maintained and is compatible with Thunderbird 102.".
What do I do? I must have a working calendar in my e-mail app. So far I tried to reinstall everything, which took quite some time, but this did not help.
I considered going back to an earlier version of TB, 102.1 maybe, but apt policy thunderbird does not list any versions between the ancient 68.7 and 102.2.2.

A: I found a solution - sort of. I have added the mozilla ppa to my Ubuntu.
sudo add-apt-repository ppa:mozillateam/ppa
sudo apt update
sudo apt install thunderbird

When thunderbird was updated to version 102.4.1, the extensions - and my calendar – were working again.


Q: Styling a Div Class within Div ID I have a page that has the following div element:

Which of the following should I use to style the class?
#name .class_name
name .class_name
#name class_name

A: Just #name would be enough to apply the style only to that specific element:
#name {
   // your styles here
}

If you want to apply the style to all the elements using the class_name class, then you can use:
.class_name {
   // your styles here
}

A: #name .class_name will apply to the children elements of your div with the .class_name class.
There must not be any spaces between.
You should use: #name.class_name because it is the correct syntax.
But, when working with identifiers, it should be enough to use it alone.
#name {
  // some properties
}

But let's say you have a unique block, which inherits some generic styles, then you could use #idenifier.class to mix styles.
#comments {
    width: 453px;
}

#comments.links
{
   border: 0 none;
}

A: If I got your question right you use
#name .class_name

as in
#name .class_name {
    color:#000;
}

But actually you don't need to do that.
If #name and .class_name are oly used in that div you can just drop the .class_name. Otherwise, if you use multiple stuff with .class_name that don't share the same properties as div #name, you should separate them.
.class_name {
    color:#000;
}
#name {
    width:600px;
}

A: ID's should be unique, so there isn't much point in styling both the id of the div and the class_name.
Just using the ID of the div is fine if that's your goal.
#name
{
   //styles
}

If you want to style every div that has that class name, then just use
.class_name
{
   //styles
}

A: You can read about CSS selectors here:
http://reference.sitepoint.com/css/selectorref
In the CSS you can reference it by class:
.class_name { color: green; }

or by id using #id
#name { color: green; }

or by element type
div { color: green; }

//or by combinations of the above
div.class_name { color: green; }
div#name { color: green; }

A: If you already have #name and .class_name styled, but for some reason you want to style

(that is, a specific style to the element with an id of "name" AND a class of "class_name"), you can use
#name.class_name {
/* note the absence of space between the id and class selector */
    ...
}

Bear in mind that this selector is not supported by Internet Explorer 6.


Q: $S^1$ a p-local complex? Let $p$ be a prime. Is $S^1$ a p-local CW-complex? Meaning, for any reduced homology  theory $\overline{E}_*$, do we have $\overline{E}_*(S^1)=\overline{E}_*(S^1) \otimes_{\mathbb{Z}} \mathbb{Z}_{(p)}$?
Another question: If $\overline{H}_*(X, \mathbb{Z})=0$ then is $X$ $p$-local?
(Apologies if these questions indicate I am very confused about things).


Q: OrderBy List by another collection Have some problem.
Need to sort the list by another collection:
List<Books> b = new List<Books>();

Class Books:
public partial class Books
{
    public Books()
    {
        this.BookAuthors = new HashSet<BookAuthors>();
    }

    public int BookID { get; set; }
    public string BookName { get; set; }

    public virtual ICollection<BookAuthors> BookAuthors { get; set; }
}

Class BookAuthors:
public partial class BookAuthors
{
    public int Id { get; set; }
    public int AuthorID { get; set; }
    public int BookID { get; set; }

    public virtual Books Books { get; set; }
    public virtual Authors Authors { get; set; }
}

Class Authors:
public partial class Authors
{
    public Authors()
    {
        this.BookAuthors = new HashSet<BookAuthors>();
    }

    public int AuthorID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }

    public virtual ICollection<BookAuthors> BookAuthors { get; set; }
}

How i can sort b by authors last name?

A: Something like this, though with mutiple authors it remains a question which author you order by:
var sorted =
    from book in b
    let firstAuthor = book.BookAuthors.First()
    let lastName = firstAuthor.LastName
    order book by lastName
    select book

Alternatively you could apply some logic (if you had it)...
var sorted =
    from book in b
    let author = book.BookAuthors.FirstOrDefault(a=>a.Primary) ??
        book.BookAuthors.FirstOrDefault(a=>a.Editor) ??
        book.BookAuthors.First()
    let lastName = author.LastName
    order book by lastName
    select book


Q: unreachable statment error call an activity I'm developping an android application so I'm trying to call  activity1 "myown" in another activity2 "MainActivity" but I just keep getting an error "Unreachable statement" over this line of code
Intent launchActivity2 = new Intent(MainActivity.this, myown.class);
MainActivity.this.startActivity(launchActivity2);

Could you explain to me what may went wrong an tell me how to fix it?
i would be really grateful


Q: Problemas com Iframe e js Tenho o seguinte código abaixo que mostra um cronometro regressivo em minha página, a ideia é que ao zerar ele mostre um iframe(video), até mostra porem o vídeo fica piscando como se somente ele ficasse em loop de atualização eterna.
Se alguém tiver a solução agradeceria sou iniciante nesta área.
(function($) {
var launch = new Date(2018, 4, 25, 23, 42);

var message = $('#message');
var days = $('#days');
var hours = $('#hours');
var minutes = $('#minutes');
var seconds = $('#seconds');

setDate();

function setDate(){
    var now = new Date();
    if( launch < now){
        days.html('
0

Dia
');
        hours.html('
0

Hora
');
        minutes.html('
0

Minuto
');
        seconds.html('
0

Segundos
');
        message.html('');
    }
    else{

            var s = -now.getTimezoneOffset()*60 + (launch.getTime() - now.getTime())/1000;
            var d = Math.floor(s/86400);
            days.html('
'+d+'

Dia'+(d>1?'s':''),'
');
            s -= d*86400;

            var h = Math.floor(s/3600);
            hours.html('
'+h+'

Hora'+(h>1?'s':''),'
');
            s -= h*3600;

            var m = Math.floor(s/60);
            minutes.html('
'+m+'

Minuto'+(m>1?'s':''),'
');

            s = Math.floor(s-m*60);
            seconds.html('
'+s+'

Segundo'+(s>1?'s':''),'
');
            setTimeout(setDate, 1000);

            message.html('PRÓXIMO TREINO INICIA EM... ');

        /**if(d == -1){
            days.html('
0

Dia
');
            hours.html('
0

Hora
');
            minutes.html('
0

Minuto
');
            seconds.html('
0

Segundos
');
            message.html('');
        }**/
    }
}

})(jQuery);

A: O seu problema é que a função é chamada o tempo todo. Então o vídeo é renderizado a cada segundo, por isso ele 'pisca'.
O que você pode fazer é usar a função setInterval() passando a função setDate() e o valor 1000 ( significa que será executado a cada segundo) atribuindo a uma variável.
E dentro do IF você usa o clearInterval() para cancelar a execução da função.
Um pequeno exemplo para te servir como inspiração:

// Define a data limite
var countDownDate = new Date("Sep 5, 2018 15:37:25").getTime();

// Atualiza o cronometro a cada 1s
var x = setInterval(function() {

  // Pega a data e a hora de hoje
  var now = new Date().getTime();

  // Encontr a diferenca entre hoje e a data limite
  var distance = countDownDate - now;

  // Calcula dias, horas, minutos e segundos
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);

  // Mostra o resultado em id="demo"
  document.getElementById("demo").innerHTML = days + "d " + hours + "h "
  + minutes + "m " + seconds + "s ";

  // Quando o prazo termina, mostra o texto
  if (distance < 0) {
    clearInterval(x);
    document.getElementById("demo").innerHTML = "EXPIRED";
  }
}, 1000);

Boa sorte! ;)


Q: SQL to LINQ semi-complex query projecting to ViewModel I know sql well enough to get by professionally, but i'm still new to linq concepts and even less familiar with lambda syntax. below is my sql query... I successfully join 2 tables on matching id's and filter my results by a certain status and select only the newest entry based on date.
select ma.* , mnh.note
from MerchApps ma
join MerchNoteHist mnh on mnh.appid = ma.id
where ma.[Status] != 6 and mnh.CreatedDate = (select max(CreatedDate) from
MerchantNoteHistories where appid = ma.Id)

The ultimate goal is to project this query to my viewmodel.
public class ViewModelListItem
{
    public int Id { get; set; }
    public DateTime CreatedDate { get; set; }
    public ApplicationStatus Status { get; set; }
    public string RecentNote { get; set; }
   ... //other things that aren't related to the question
}

Issue is: find the correct max usage.
My best attempt at LINQ lambda syntax, what I've been able to piece together after doing research:
_db.MerchApps
            .Join(_db.MerchNoteHist,
                ma => ma.Id,
                note => note.AppId,
                (ma, note) => new { MA = ma, Note = note })
                .Include(x => x.MA.User)
                .Where(x => x.MA.Status != ApplicationStatus.Approved)
                .Include(x => x.Note.Note)
                .Where(x => x.Note.CreatedDate == Max(x.Note.CreatedDate) //<--Issue is here, because I can't find the correct max usage.
            .ProjectTo<ViewModelListItem>(_mapperConfig)
            .OrderBy(x => x.Status).ThenBy(x => x.CreatedDate).ToListAsync();

The final step is to lay it all out in a view from a foreach loop that uses the above viewmodel.
After research and trial-and-error and working through lunch to try to figure this out... I'm a solid 7 hours into this and at my wits end. Any help at all would be appreciated.

A: You should use a GroupJoin instead of Join, this will yield a set of MerchNoteHist (I'm assuming this is the same table as MerchantNoteHistories here) that match the AppId.
Then, you can use an aggregate (Max) in the resultSelector of the function.
Here's roughly what your code should look like:
_db.MerchApps
        .Where(ma => ma.User.Status != ApplicationStatus.Approved)
        .GroupJoin(
            _db.MerchNoteHist,
            ma => ma.Id,
            noteList => note.AppId,
            (ma, noteList) => new
            {
               MA = ma,
               Note = noteList.OrderByDescending(n=>n.CreatedDate).First()
            })
            //rest of your logic here

A: Alternatively you could put this in as the second Where clause:
.Where(x => x.Note.CreatedDate== _db.MerchNoteHist
    .Where(y => y.AppId == x.Note.AppId).OrderByDescending(y => y.CreatedDate)
        .First().CreatedDate)


Q: AWS: Permissions for exporting logs from Cloudwatch to Amazon S3 I am trying to export logs from one of my CloudWatch log groups into Amazon S3, using AWS console.
I followed the guide from AWS documentation but with little success. My organization does not allow me to manage IAM roles/policies, however I was able to find out that my role is allowed all log-related operations (logs:* on all resources within the account).
Currently, I am stuck on the following error message:

Could not create export task. PutObject call on the given bucket failed. Please check if CloudWatch Logs has been granted permission to perform this operation.

My bucket policy is set in the following way:
{
    [
        ...
        {
            "Sid": "Cloudwatch Log Export 1",
            "Effect": "Allow",
            "Principal": {
                "Service": "logs.eu-central-1.amazonaws.com"
            },
            "Action": "s3:GetBucketAcl",
            "Resource": "arn:aws:s3:::my-bucket"
        },
        {
            "Sid": "Cloudwatch Log Export 2",
            "Effect": "Allow",
            "Principal": {
                "Service": "logs.eu-central-1.amazonaws.com"
            },
            "Action": "s3:PutObject",
            "Resource": "arn:aws:s3:::my-bucket/*"
        }
    ]
}

Prior to editing bucket policy, my error message had been

Could not create export task. GetBucketAcl call on the given bucket failed. Please check if CloudWatch Logs has been granted permission to perform this operation.

but editing the bucket policy fixed that. I would expect allowing PutObject to do the same, but this has not been the case.
Thank you for help.

A: Please check this guide Export log data to Amazon S3 using the AWS CLI

Policy's looks like the document that you share but slight different.
Assuming that you are doing this in same account and same region, please check that you are placing the right region ( in this example is us-east-2)
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Action": "s3:GetBucketAcl",
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::my-exported-logs",
            "Principal": { "Service": "logs.us-east-2.amazonaws.com" }
        },
        {
            "Action": "s3:PutObject" ,
            "Effect": "Allow",
            "Resource": "arn:aws:s3:::my-exported-logs/*",
            "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control" } },
            "Principal": { "Service": "logs.us-east-2.amazonaws.com" }
        }
    ]
}

I think that bucket owner full control is not the problem here, the only chance is the region.
Anyway, take a look to the other two examples in case that you were in different accounts/ using role instead user.
This solved my issue, that was the same that you mention.

A: Ensure when exporting the data you configure the following aptly
S3 bucket prefix - optional This would be the object name you want to use to store the logs.
While creating the policy for PutBucket, you must ensure the object/prefix is captured adequately. See the diff for the PutBucket statement Resource:

 {
   "Version": "2012-10-17",
   "Statement": [
     {
         "Action": "s3:GetBucketAcl",
         "Effect": "Allow",
         "Resource": "arn:aws:s3:::my-exported-logs",
         "Principal": { "Service": "logs.us-east-2.amazonaws.com" }
     },
     {
         "Action": "s3:PutObject" ,
         "Effect": "Allow",
-        "Resource": "arn:aws:s3:::my-exported-logs/*",
+        "Resource": "arn:aws:s3:::my-exported-logs/**_where_i_want_to_store_my_logs_***",
         "Condition": { "StringEquals": { "s3:x-amz-acl": "bucket-owner-full-control" } },
         "Principal": { "Service": "logs.us-east-2.amazonaws.com" }
     }
   ]
 }

A: One thing to check is your encryption settings. According to https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/S3ExportTasksConsole.html

Exporting log data to Amazon S3 buckets that are encrypted by AWS KMS is not supported.

Amazon S3-managed keys (SSE-S3) bucket encryption might solve your problem. If you use SSE-KMS, Cloudwatch can't access your encryption key in order to properly encrypt the objects as they are put into the bucket.

A: I had the same situation and what worked for me is to add the bucket name itself as a resource in the Allow PutObject Sid, like:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "AllowLogsExportGetBucketAcl",
            "Effect": "Allow",
            "Principal": {
                "Service": "logs.eu-west-1.amazonaws.com"
            },
            "Action": "s3:GetBucketAcl",
            "Resource": "arn:aws:s3:::my-bucket"
        },
        {
            "Sid": "AllowLogsExportPutObject",
            "Effect": "Allow",
            "Principal": {
                "Service": "logs.eu-west-1.amazonaws.com"
            },
            "Action": "s3:PutObject",
            "Resource": [
                "my-bucket",
                "my-bucket/*"
            ]
        }
    ]
}

I also believe that all the other answers are relevant, especially using the time in milliseconds.


Q: C# Expression tree for string interpolation I have a program that reads a json file with some property names of a certain class. The values of the configured property names should compose up a key.
Lets take an example:
Class:
class SomeClass
{
    public string PropertyOne { get; set; }
    public string PropertyTwo { get; set; }
    public string PropertyThree { get; set; }
    public string PropertyFour { get; set; }
}

var someClass = new SomeClass
            {
                PropertyOne = "Value1",
                PropertyTwo = "Value2",
                PropertyThree = "Value3",
                PropertyFour = "Value4",
            };

Configuration file:
{
   "Properties": ["PropertyOne", "PropertyTwo"]
}

If I knew the properties at compile time I would have create a lambda like:
Func<SomeClass, string> keyFactory = x => $"{x.PropertyOne}|{x.PropertoTwo}"

Is there a way to compile such a lambda using expressions? Or any other suggestions maybe?

A: In Expression Tree, string interpolation is converted to string.Format. Analogue of your sample will be:
Func<SomeClass, string> keyFactory =
   x => string.Format("{0}|{1}", x.PropertyOne, x.PropertoTwo);

The following function created such delegate dynamically:
private static MethodInfo _fromatMethodInfo = typeof(string).GetMethod(nameof(string.Format), new Type[] { typeof(string), typeof(object[]) });

public static Func<T, string> GenerateKeyFactory<T>(IEnumerable<string> propertyNames)
{
    var entityParam = Expression.Parameter(typeof(T), "e");

    var args = propertyNames.Select(p => (Expression)Expression.PropertyOrField(entityParam, p))
            .ToList();

    var formatStr = string.Join('|', args.Select((_, idx) => $"{{{idx}}}"));

    var argsParam = Expression.NewArrayInit(typeof(object), args);

    var body = Expression.Call(_fromatMethodInfo, Expression.Constant(formatStr), argsParam);
    var lambda = Expression.Lambda<Func<T, string>>(body, entityParam);
    var compiled = lambda.Compile();

    return compiled;
}

Usage:
var keyFactory = GenerateKeyFactory<SomeClass>(new[] { "PropertyOne", "PropertyTwo", "PropertyThree" });


Q: Prove that a one-color $K_4$ exists in a two-color $K_{18}$ An edge coloring of a graph is an assignment of colors to the edges of the graph. I have $K_{18}$ colored with blue and red and I want to show that it contains a $K_4$ colored with just one color. Also I want to prove that it is the best possible.
I know this question is related to Ramsey-theory, but I don't want to use it.

A: We first prove $R(4,3)\leq 9$. In other words, if $K_9$ is colored red and blue there is a red $K_4$ or a blue $K_3$.
Pick a vertex $v$, it has $8$ edges coming out.
Suppose $6$ of them are red, then the $K_6$ on those six vertices contains a red $K_3$ or a blue $K_3$, if there is a red $K_3$ we get a red $K_4$ after adding vertex $v$.
Suppose $4$ of them are blue, then the $K_4$ of those $4$ vertices cannot contain a blue edge, so all its edges are red, but then there is a red $K_4$.
So each vertex has exactly $5$ red edges comming out of it. Using the hadshake lemma there are $\frac{9\cdot5}{2}$ red edges, contradiction.
So $R(3,4)\leq 9$.
We now use $R(s,t)\leq R(s-1,t)+R(s,t-1)$ to get $R(4,4)\leq 2R(3,4)=18$ as desired.