text:
Q: What is alternative of AppCompat.Button.Borderless in MaterialComponents? Because of some requirement in my project, I must use MaterialComponents, so my previous UI is became messy, and I need to change it.
previous Image with AppCompat:

new Image with MaterialComponents:

Code:
<style name="ButtonBorderless" parent="Base.Widget.AppCompat.Button.Borderless">
    <item name="android:minHeight">0dp</item>
    <item name="android:minWidth">0dp</item>
    <item name="android:textSize">14sp</item>
</style>

MainStyle:
<style name="DayTheme" parent="Theme.MaterialComponents.Light.NoActionBar">

Button:
<Button
                                    android:id="@+id/btn_interval_decrease"
                                    style="@style/ButtonBorderless"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:paddingLeft="10dp"
                                    android:paddingTop="5dp"
                                    android:paddingRight="10dp"
                                    android:paddingBottom="5dp"
                                    android:text="-"
                                    android:textColor="?attr/icon_color"
                                    android:textSize="20dp" />

Please note: There are two problems in this image:
1. borderless button
2.check the WE button, it's last part is cutting
Complete XML:
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    app:cardCornerRadius="8dp"
    android:background="?attr/cardbackgroundColor"
    app:cardElevation="4dp">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="?attr/cardbackgroundColor">

        <LinearLayout
            android:id="@+id/main_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="?attr/cardbackgroundColor"
            android:padding="15dp">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/cardbackgroundColor"
                android:padding="15dp">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:text="@string/repeat"
                    android:textColor="?attr/day_colorDarkGray_night_colorWhite"
                    android:textSize="16sp"
                    android:textStyle="bold" />

                <Switch
                    android:id="@+id/switch_repeat"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:checked="true"
                    android:paddingLeft="18dp"
                    android:paddingRight="16dp" />
            </LinearLayout>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="?attr/cardbackgroundColor">

                <LinearLayout
                    android:id="@+id/layout_repeat"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentLeft="true"
                    android:background="?attr/cardbackgroundColor"
                    android:orientation="vertical"
                    android:padding="15dp">

                    <androidx.cardview.widget.CardView
                        android:id="@+id/card_layout"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:layout_marginBottom="10dp"
                        android:background="@drawable/selector_tab_reminder_type"
                        app:cardElevation="0dp">

                        <RelativeLayout
                            android:id="@+id/tab_relative_layout"
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:background="@drawable/selector_tab_reminder_type">

                            <com.google.android.material.tabs.TabLayout
                                android:id="@+id/tablayout"
                                android:layout_width="match_parent"
                                android:layout_height="30dp"
                                android:clipToPadding="true"
                                app:tabBackground="@drawable/selector_tab_reminder_type"
                                app:tabGravity="fill"
                                app:tabIndicatorColor="@null"
                                app:tabMode="fixed"
                                app:tabPaddingBottom="0dp"
                                app:tabPaddingEnd="0dp"
                                app:tabPaddingStart="0dp"
                                app:tabPaddingTop="0dp"
                                app:tabSelectedTextColor="@color/colorWhite"
                                app:tabTextAppearance="@style/TabLayoutTextAppearance">

                                <com.google.android.material.tabs.TabItem
                                    android:id="@+id/tab_daily"
                                    style="@style/tabItem"
                                    android:text="@string/tab_daily" />

                                <com.google.android.material.tabs.TabItem
                                    android:id="@+id/tab_weekly"
                                    style="@style/tabItem"
                                    android:text="@string/tab_weekly" />

                                <com.google.android.material.tabs.TabItem
                                    android:id="@+id/tab_monthly"
                                    style="@style/tabItem"
                                    android:text="@string/tab_monthly" />

                                <com.google.android.material.tabs.TabItem
                                    android:id="@+id/tab_yearly"
                                    style="@style/tabItem"
                                    android:text="@string/tab_yearly" />
                            </com.google.android.material.tabs.TabLayout>
                        </RelativeLayout>

                    </androidx.cardview.widget.CardView>

                    <include
                        android:id="@+id/weekdays_error"
                        layout="@layout/row_error_textview" />

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:background="?attr/cardbackgroundColor">

                        <TextView
                            android:id="@+id/tv_repeat_interval"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentLeft="true"
                            android:layout_centerVertical="true"
                            android:text="@string/repeat_daily"
                            android:textColor="?attr/day_colorDarkGray_night_colorWhite"
                            android:textSize="16sp" />

                        <androidx.cardview.widget.CardView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentRight="true"
                            app:cardBackgroundColor="?attr/cardbackgroundColor"
                            app:cardCornerRadius="5dp"
                            app:cardElevation="0dp">

                            <LinearLayout
                                android:layout_width="68dp"
                                android:layout_height="match_parent"
                                android:background="@drawable/bg_repeat_reminder"
                                android:orientation="horizontal">

                                <Button
                                    android:id="@+id/btn_interval_increase"
                                    style="@style/ButtonBorderless"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:paddingLeft="10dp"
                                    android:paddingTop="5dp"
                                    android:paddingRight="10dp"
                                    android:paddingBottom="5dp"
                                    android:text="+"
                                    android:textColor="?attr/icon_color"
                                    android:textSize="20dp" />

                                <View
                                    android:layout_width="1dp"
                                    android:layout_height="fill_parent"
                                    android:background="?attr/toolbar_color" />

                                <Button
                                    android:id="@+id/btn_interval_decrease"
                                    style="@style/ButtonBorderless"
                                    android:layout_width="wrap_content"
                                    android:layout_height="wrap_content"
                                    android:layout_weight="1"
                                    android:paddingLeft="10dp"
                                    android:paddingTop="5dp"
                                    android:paddingRight="10dp"
                                    android:paddingBottom="5dp"
                                    android:text="-"
                                    android:textColor="?attr/icon_color"
                                    android:textSize="20dp" />

                            </LinearLayout>
                        </androidx.cardview.widget.CardView>

                    </RelativeLayout>

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:background="?attr/cardbackgroundColor">

                        <Spinner
                            android:id="@+id/spin_list"
                            style="@style/Widget.AppCompat.Spinner.Underlined"
                            android:layout_width="150dp"
                            android:layout_height="wrap_content"
                            android:layout_alignParentLeft="true"
                            android:layout_marginEnd="8dp"
                            android:backgroundTint="?attr/icon_color"
                            android:dropDownVerticalOffset="17dp"
                            android:spinnerMode="dropdown" />

                        <TextView
                            android:id="@+id/tv_end_date"
                            style="@style/ButtonBorderless"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_alignParentEnd="true"
                            android:layout_alignParentRight="true"
                            android:layout_centerVertical="true"
                            android:hint="YYYY-MM-DD"
                            android:text=""
                            android:textColor="?attr/day_colorDarkGray_night_colorWhite"
                            android:visibility="visible" />

                    </RelativeLayout>

                    <TextView
                        android:id="@+id/error_view"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="2dp"
                        android:layout_marginBottom="8dp"
                        android:orientation="vertical"
                        android:textColor="@color/colorRed"
                        android:visibility="gone" />

                    <LinearLayout
                        android:id="@+id/layout_days"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="?attr/cardbackgroundColor"
                        android:orientation="vertical"
                        android:visibility="gone">

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginTop="10dp"
                            android:background="?attr/cardbackgroundColor">

                            <ToggleButton
                                android:id="@+id/toggleSunday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="SU"
                                android:textOn="SU"
                                android:textSize="16dp" />

                            <ToggleButton
                                android:id="@+id/toggleMonday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="MO"
                                android:textOn="MO"
                                android:textSize="16dp" />

                            <ToggleButton
                                android:id="@+id/toggleTuesday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="TU"
                                android:textOn="TU"
                                android:textSize="16dp" />

                            <ToggleButton
                                android:id="@+id/toggleWednesday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="WE"
                                android:textOn="WE"
                                android:textSize="16dp" />
                        </LinearLayout>

                        <LinearLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_gravity="center_horizontal"
                            android:layout_marginTop="10dp">

                            <ToggleButton
                                android:id="@+id/toggleThursday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="TH"
                                android:textOn="TH"
                                android:textSize="16dp" />

                            <ToggleButton
                                android:id="@+id/toggleFriday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="FR"
                                android:textOn="FR"
                                android:textSize="16dp" />

                            <ToggleButton
                                android:id="@+id/toggleSaturday"
                                android:layout_width="45dp"
                                android:layout_height="45dp"
                                android:layout_marginLeft="8dp"
                                android:layout_marginRight="8dp"
                                android:background="@drawable/selector_day_toggle"
                                android:gravity="center"
                                android:padding="8dp"
                                android:textColor="@color/selector_day_text"
                                android:textOff="SA"
                                android:textOn="SA"
                                android:textSize="16dp" />
                        </LinearLayout>
                    </LinearLayout>

                    <View style="@style/view_style" />

                </LinearLayout>

                <FrameLayout
                    android:id="@+id/layoutOverlay"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignTop="@id/layout_repeat"
                    android:layout_alignBottom="@id/layout_repeat"
                    android:background="@color/colorWhiteTransparent"
                    android:visibility="visible" />
            </RelativeLayout>

        </LinearLayout>

    </RelativeLayout>

</androidx.cardview.widget.CardView>

A: I found out that this is the equivalent of borderless button.
style="@style/Widget.MaterialComponents.Button.TextButton"

A: You have to use MaterialButtonToggleGroup for best practice if you use Material Components
https://medium.com/over-engineering/hands-on-with-material-components-for-android-buttons-76fa1a92ec0a
      <com.google.android.material.button.MaterialButtonToggleGroup
          android:id="@+id/toggleGroup2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="center"
          app:checkedButton="@id/btnA"
          app:layout_constraintBottom_toBottomOf="parent"
          app:layout_constraintEnd_toEndOf="parent"
          app:layout_constraintStart_toStartOf="parent"
          app:layout_constraintTop_toTopOf="parent"
          app:singleSelection="true">

          <com.google.android.material.button.MaterialButton
              android:id="@+id/btnA"
              style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:strokeColor="@color/colorPrimary"
              app:backgroundTint="@android:color/transparent"
              android:text="+" />

          <com.google.android.material.button.MaterialButton
              android:id="@+id/btnS"
              style="@style/Widget.MaterialComponents.Button.OutlinedButton.Icon"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              app:strokeColor="@color/colorPrimary"
              android:text="-" />

      </com.google.android.material.button.MaterialButtonToggleGroup>


text:
Q: ElasticSearch: Search across multiple fields with input strings (NumberFormatException) I am searching across multiple fields in a query using the * asterisk notation (Ex: I want all fields startings with source so I specify fields source.*) and I specify a query of foobar as string. I am using a Query String type query.
I keep getting a NumberFormatException and I have some fields in there with a mapping type of long and double.
Any idea how to go about this? I need to do a multi-field search.
My query is posted below:
{
    "query": {
        "bool": {
            "must": [{
                "query_string": {
                    "default_field": "source.*",
                    "query": "foobar"
                }
            }],
            "must_not": [],
            "should": []
        }
    },
    "from": 0,
    "size": 100000,
    "sort": [],
    "facets": {}
}

A: set lenient to true to ignore format based failures
example :
"query_string":
 {
      "default_field": "source.*",
      "query": "foobar",
      "lenient": true

 }

redpajama_set_name: RedPajamaStackExchange


text:
Q: r - grepl matches with perl and spaces this example from here (r- grepl to find multiple strings exists)  helps me match combinations of words:
pat <- c("instance", "percentage", "element", "character")

longperl <- grepl(paste0("(?=.*", pat, ")", collapse=""), Text2, perl=TRUE)

However I'm trying to match the word table (along with other words) and using the above is also returning words that contain the pattern table, e.g., marketable.
How do I force the grepl snippet to only include the whole word table and not where table is part of another word?
I've tried these without success:
pat <- c(" table", "instance", "percentage", "element", "character") # add literal space before `table`

pat <- c("\\stable", "instance", "percentage", "element", "character") # add whitespace regex before `table`


text:
Q: Generating PDF using JS PDF library I have a below JS method
generatePdf() {
        const { jsPDF } = window.jspdf;
        const doc = new jsPDF({
            encryption: {
                userPassword: "user",
                ownerPassword: "owner",
                userPermissions: ["print", "modify", "copy", "annot-forms"]
                // try changing the user permissions granted
            }
        });

        doc.text("Hi I'm Matt", 20, 20);
        doc.table(30, 30, this.contactList, this.headers, { autosize: true });
        doc.save("demo.pdf");
    }

it successfully downloads the PDF file but instead of downloading it, I am trying to display it on the web page using iframe if possible. I tried to do the same but it didn't work.
below is JS library that I am using.
https://unpkg.com/jspdf@latest/dist/jspdf.umd.min.js


text:
Q: N power n i-e n^n is polynomial or not ? Is there any polynomial difference between n^2 and n^n? Is n to the power n (i-e n^n) a polynomial? Can   T(n) = 2T(n/2) + n^n be solved using the master method?

A: It's not only not polynomial, it's also worse than factiorial. O(n^n) dominates O(n!). Also in the masters method f(n) must be polynomial, so you can not use it.


text:
Q: SVN: How to tell revision number? We have a web application deployed to a server, which was done via an svn update. Now, I want to know what revision number was deployed to that server. What command do I use to get this information?
Also, once I get this revision number, I want to deploy that revision to another server. How do I do an svn update and specify a revision number?

A: Try to launch svn info on the source directory:
svn info path/to/source | grep revision

And:
svn update -r revision

A: svnversion is another option. In addition to showing you the current version of the checkout, it will also tell you whether any files are modified or if you have a mixed revision working copy (ie not all files are at the same revision).


text:
Q: Memory leak due to return statement in `puts "Hello World"` method Trying to port Ruby 1.8.7 to emscripten, I have an infinite loop that does some things with ruby, using the C API, by rb_eval_string. Now, if I do just a puts "Hello World" in the loop, there is no leak. Next, if I call my_func_one from the main loop, there is still no memory leak, but for my_func_two, memory usage keeps increasing continuously. These functions are defined as
def my_func_one
    puts "Hello World"
end

def my_func_two
    puts "Hello World"
    return
end

Is this a  bug or am I doing something wrong?
EDIT: My C code is on the lines of
void main_update_loop() {
    rb_eval_string("my_func_one");
}

where the main loop is set with emscripten_set_main_loop(main_update_loop, 0, 1);. I'm measuring memory usage with memoryprofiler.js


text:
Q: Sequence of multiple left joins SELECT * FROM test_youtube Y
LEFT JOIN test_youtubelike L ON youtubelike_videoId = youtube_videoId
LEFT JOIN test_youtubeview V ON youtubeview_videoId = youtube_videoId
GROUP BY Y.id
Showing rows 0 - 29 ( 714 total, Query took 0.0062 sec)

SELECT * FROM test_youtube Y
LEFT JOIN test_youtubeview V ON youtubeview_videoId = youtube_videoId
LEFT JOIN test_youtubelike L ON youtubelike_videoId = youtube_videoId
GROUP BY Y.id
Showing rows 0 - 29 ( 714 total, Query took 0.0169 sec)

The only difference in the above queries, is the sequence of left joins (L first, V latter versus V first L latter). I would think since both are independent left joins, it would not have mattered which left join is done first. However, the queries' speed differ vastly. Any insights please?


text:
Q: Handling unknown commands with the boost command line parser I want to handle (note, not use in any way) the unknown options.
So there is this:
http://www.boost.org/doc/libs/1_54_0/doc/html/program_options/howto.html#idp123440592
That can be used to collect and use any unknown options, so I could do:
po::variables_map vm;
po::parsed_options parsed = po::command_line_parser(ac,av).options(desc).allow_unregistered().run();

{
  vector<string> to_pass_further = collect_unrecognized(parsed.options, po::include_positional);
  if (to_pass_further.size())
  {
    cout << "Unrecognized options:" << endl;
    for (auto i = to_pass_further.cbegin(); i != to_pass_further.cend(); ++i)
    {
      cout << std::left << std::setw(2) << ' ' << *i;
    return -1;
    }
  }
}

But since I would think people do this all the time and the library is supposed to handle all the things we do all the time, am I missing some cleaner what of doing it?

A: try
{
  po::options_description desc("Allowed options");

  desc.add_options()
    ("help,h", "produce help message")
    ("compression", po::value<int>()->required(), "set compression level")
    ;

  po::variables_map vm;
  po::store(po::parse_command_line(ac, av, desc), vm);
  po::notify(vm);
}
catch(std::exception& e)
{
  std::cerr << "Error: " << e.what() << "\n";
  return -1;
}
catch(...)
{
  std::cerr << "Unknown error!" << "\n";
  return -1;
}


text:
Q: question about a Rosenthal inequality What is the usefulness of Rosenthal inequalities in (kernel) density estimation

where $\xi _i .... \xi _n$ are independent random variables, $\mathbb{E}\xi_{i} =0$ and $c(p)=15p/lnp$ for $p>2$
Why we say that $c(p)=15p/lnp$ is ''the best-know constant'' ?
Some help would be appreciated

A: I do not know about kernel density estimation, but Rosenthal inequality is very useful in getting bounds on the following type of probabilities:
$$P\left(\left|\sum_{i=1} X_{i}\right|>\varepsilon\right).$$
Combining Markov inequality with Rosenthal you get
\begin{align}
P\left(\left|\sum_{i=1}^n X_{i}\right|>\varepsilon\right)\le \frac{c(p)^p}{\varepsilon^p}\left(\sum_{i=1}^nE|X_i|^p+\left(\sum_{i=1}^nEX_i^2 \right)^{p/2}\right)
\end{align}
If you control $E|X_i|^p$  and $EX_i^2=1$ you might get a useful bound. As some commenters noted it depends on the context, so this inequality is just another tool in the box. But it can be very useful: for example, I used it extensively in my Ph.D. thesis.


text:
Q: How to link input button display:none behavior with the label I want to link an input display: none button to a label so that when I click on the label, it has the same behavior of my hidden input button. How can I do this?
Below is my HTML5 code:
File...
<input id="model1" type="file" name="model1" class="model1" style="display:none;" th:required="true"  />

A: If you want the label to trigger a click event on the input type=file, then use:
$('.uploadFile').click(function() {
  $("#model1").unbind('click').bind('click');
})

I've also added how to add the file name to the label:
$('#model1').change(function() {
 var filename = $(this).val().split('\\').pop();
 $('.uploadFile').text(filename)
})

$('.uploadFile').click(function() {
  $("#model1").unbind('click').bind('click');
})

$('#model1').change(function() {
 var filename = $(this).val().split('\\').pop();
 $('.uploadFile').text(filename)
})

File...
   <input id="model1"  type="file"    name="model1" class="model1"
style="display:none;" th:required="true"  />

A: You could use javascript, and have something like:
File...

and then define a handleclick() function which will process what you need to do with the button press.
The handleclick() could be as simple as:
$('#element').click();

or
$('#element').trigger('click');


text:
Q: cors request fetch on react Ok, so odd error. I have a react app that gets data via a fetch function
fetch('https://port.abendago.com/index.php?controller=departments&route=getAll')

the app is located on a firebase server so a different domain etc...
https://vanport-debba.web.app/

Now, in the console, I see the request go out, and the server responds. If I view the response, I see the data (json data) in the response. BUT, the console still gives a CORS error and my app doesn't do anything with the data.
On the server I've added all the various CORS headers (which you can see in the response headers on the above URLS). My server team says I need to change something on my react server? or the react app? I've been trying all sorts of stuff and nothing is working.
The webserver (end point server) is running plesk and apache and nginx

A: The reason might still be server related.
I tried cors requesting to the above url and got response headers as these:
Access-Control-Allow-Origin: '*'
Access-Control-Allow-Origin: 'https://vanport-debba.web.app/'
Access-Control-Allow-Origin: 'https://vanport-debba.web.app'
Access-Control-Allow-Origin: https://vanport-debba.web.app/
Access-Control-Allow-Origin: https://vanport-debba.web.app
Access-Control-Allow-Origin: *

As you can see, it's sending multiple response headers for Access-Control-Allow-Origin which is precisely what the cors error that I got had:

Access to fetch at 'http://port.abendago.com/index.php?controller=departments&route=getAll' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:3000, '*', 'https://vanport-debba.web.app/', 'https://vanport-debba.web.app', https://vanport-debba.web.app/, https://vanport-debba.web.app, *', but only one is allowed. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

i.e.

The 'Access-Control-Allow-Origin' header contains multiple values
Have the server send the header with a valid value

If you look at the Mozilla developer docs, its mentioned

More than one Access-Control-Allow-Origin header was sent by the server. This isn't allowed.

Have your server team revisit this and take a look at the cors configuration. It should simply return Access-Control-Allow-Origin: *


text:
Q: Generic trait for u8 iterators with function that returns a bool iterator I have this code:
pub trait BytesToBits<T>: Iterator<Item = u8>
where
    T: Iterator<Item = bool>,
{
    fn bits(&mut self) -> T;
}

impl<T> BytesToBits<T> for dyn Iterator<Item = u8>
where
    T: Iterator<Item = bool>,
{
    fn bits(&mut self) -> T {
        self.flat_map(|byte| (0..8).map(move |offset| byte & (1 << offset) != 0))
    }
}

However, compiling it results in:
error[E0308]: mismatched types
  --> src/bitstream.rs:13:9
   |
8  | impl<T> BytesToBits<T> for dyn Iterator<Item = u8>
   |      - this type parameter
...
12 |     fn bits(&mut self) -> T {
   |                           - expected `T` because of return type
13 |         self.flat_map(|byte| (0..8).map(move |offset| byte & (1 << offset) != 0))
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found struct `FlatMap`
   |
   = note: expected type parameter `T`
                      found struct `FlatMap<&mut (dyn Iterator<Item = u8> + 'static), Map<std::ops::Range<{integer}>, [closure@src/bitstream.rs:13:41: 13:54]>, [closure@src/bitstream.rs:13:23: 13:29]>`

I am new to Rust and do not know what I exactly did wrong there and how to resolve the issue.
My goal is to have a trait BytesToBits that extends all Iterator<Item = u8> by providing them with a method bits() that returns an Iterator<Item = bool>.

A: I think that this solves your problem:
pub trait BytesToBits<T>: Iterator<Item=u8>
    where
        T: Iterator<Item=bool>,
{
    fn bits(&mut self) -> Box<dyn Iterator<Item=bool> + '_>;
}

impl<T> BytesToBits<T> for dyn Iterator<Item=u8>
    where
        T: Iterator<Item=bool>,
{
    fn bits(&mut self) -> Box<dyn Iterator<Item=bool> + '_> {
        Box::new(self.flat_map(|byte| (0..8).map(move |offset| byte & (1 << offset) != 0)))
    }
}

But if someone will find explanation why the first approach is wrong I will be grateful :D

A: Thanks for the comments and the answer.
I think my issue again boiled down to the fact, that you cannot return traits from functions of traits [1].
I solved it now with a custom iterator:
pub trait BytesToBits<T>
where
    T: Iterator<Item = bool>,
{
    fn bits(self) -> T;
}

impl<T> BytesToBits<BytesToBitsIterator<T>> for T
where
    T: Iterator<Item = u8>,
{
    fn bits(self) -> BytesToBitsIterator<T> {
        BytesToBitsIterator::from(self)
    }
}

pub struct BytesToBitsIterator<T>
where
    T: Iterator<Item = u8>,
{
    bytes: T,
    current: Option<u8>,
    index: u8,
}

impl<T> From<T> for BytesToBitsIterator<T>
where
    T: Iterator<Item = u8>,
{
    fn from(bytes: T) -> Self {
        Self {
            bytes,
            current: None,
            index: 0,
        }
    }
}

impl<T> Iterator for BytesToBitsIterator<T>
where
    T: Iterator<Item = u8>,
{
    type Item = bool;

    fn next(&mut self) -> Option<Self::Item> {
        if self.index > 7 {
            self.current = None;
            self.index = 0;
        }

        let current = match self.current {
            None => match self.bytes.next() {
                None => {
                    return None;
                }
                Some(byte) => {
                    self.current = Some(byte);
                    byte
                }
            },
            Some(byte) => byte,
        };

        let bit = current & (1 << self.index) != 0;
        self.index += 1;
        Some(bit)
    }
}

[1] Implement trait that has function which return traits


text:
Q: GoogleBigQuery How to exclude null values from a specific column in a union query? I would like to filter out null values from a specific column in this case "Account" on a union query how can i do this?
The query that I am working on is this:
SELECT
Account,
Campaign_name,
Ad_group_name,
Date,
Keyword,
Impressions,
Clicks,
Cost__GBP_,
Conversions
FROM
table1
UNION ALL
SELECT
Account,
Campaign_name,
Ad_group_name,
Date,
Keyword,
Impressions,
Clicks,
Cost__GBP_,
Conversions
FROM
table2
Someone can help me in this?
Thanks

A: Each query is evaluated separately in a union query.
So you should add WHERE filters to each of them.
SELECT Account, Campaign_name, Ad_group_name, Date, Keyword, Impressions, Clicks, Cost__GBP_, Conversions
FROM table1
WHERE Account is not NULL

UNION ALL

SELECT Account, Campaign_name, Ad_group_name, Date, Keyword, Impressions, Clicks, Cost__GBP_, Conversions
FROM table2
WHERE Account is not NULL


text:
Q: Accessing Vuex Store Before Page Load NuxtJS Context:  I am trying to get Google Maps place data via the place_id on the beforeEnter() route guard. Essentially, I want the data to load when someone enters the url exactly www.example.com/place/{place_id}. Currently, everything works directly when I use my autocomplete input and then enter the route but it does not work when I directly access the url from a fresh tab. I've been able to solve this using the beforeEnter() route guard in traditional Vue, but cannot solve for this using Nuxt.  Please help!
Question: How can I access the Vuex Store before a page loads in Nuxt?
Error: Any solution I try (see below) I either end up with a blank page or the page will not load (I think it is stuck in a loop and cannot resolve the Promise).
Attempted Solutions:

*

*Using Middleware like below:

  middleware({ store, params }) {
    return store.dispatch('myModule/fetchLocation', params.id)
  }

*Using asyncData like below:

data(){
  return{
    filteredLocation: {}
  }
}

// snip

async asyncData({ store, params }) {
  const { data } = await store.dispatch('myModule/fetchLocation', params.id)
  return filteredLocation = data
}

*I tried looking into fetch, but apparently you no longer have access to context
Example Code:
In one of my store modules:
/* global google */

import Vue from 'vue'
import * as VueGoogleMaps from '~/node_modules/vue2-google-maps/src/main'

Vue.use(VueGoogleMaps, {
  load: {
    key: process.env.VUE_APP_GMAP_KEY,
    libraries: 'geometry,drawing,places'
  }
})

export const state = () => ({
  selectedLocation: {}
})

export const actions = {
  fetchLocation({ commit }, params) {
    return new Promise((resolve) => {
      Vue.$gmapApiPromiseLazy().then(() => {
        const request = {
          placeId: params,
          fields: [
            'name',
            'rating',
            'formatted_phone_number',
            'geometry',
            'place_id',
            'website',
            'review',
            'user_ratings_total',
            'photo',
            'vicinity',
            'price_level'
          ]
        }
        const service = new google.maps.places.PlacesService(
          document.createElement('div')
        )
        service.getDetails(request, function(place, status) {
          if (status === 'OK') {
            commit('SET_PLACE', place)
            resolve()
          }
        })
      })
    })
  }
}

export const mutations = {
  SET_PLACE: (state, selection) => {
    state.selectedInstructor = selection
  }
}

EDIT: I already have it in a plugin named google-maps.js and in my nuxt.config.js file I have:
  plugins: [
    { src: '~/plugins/google-maps.js' }
  ]
//
//
  build: {
    transpile: [/^vue2-google-maps.js($|\/)/],
    extend(config, ctx) {}
  }

A: Using Middleware is how we can access Vuex before page loads. try putting the configuration part in a custom Nuxt plugin.
Create a file in Plugins folder (you can name it global.js).
Put this
import Vue from 'vue'
import * as VueGoogleMaps from '~/node_modules/vue2-google-maps/src/main'

Vue.use(VueGoogleMaps, {
 load: {
  key: process.env.VUE_APP_GMAP_KEY,
libraries: 'geometry,drawing,places'
}
})

in global.js.
Then add the plugin in nuxt.config.js like this.
 plugins: [
  '~/plugins/global.js'
 ]

Also, make sure you're using underscore before 'page_id' name in your folder structure.


text:
Q: Jquery Mobile Panel styling issues Hello there i am using the code bellow to load a sliding panel to my page and load the
 content inside of it from an external html file. The problem is that when i am loading the data from external html file the styling doesn't applying.
If i move the code inside my primary html file it works fine.
In external html file i also loaded the .css files
Here is my full working code and bellow i will post and what i am trying to do.
//Loading the jquery css
<link rel="stylesheet" href="css/themes/default/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="_assets/css/jqm-demos.css">

//Loading jquery and jquery mobile

//Before open i am loading the external file with content

And inside my body

//at this was the code bellow and works great

Close menu

Menu one

Menu two

If i remove the two lines and put it in my external.php file the style is not apply.

Menu one

Menu two

Thank you all!
Screenshots bellow will help you what i mean:

And from external file:

A: You need to enhance elements that are dynamically injected. To enhance/initialize all items in spite of their type, you need to call .enhanceWithin() on parent div.
Although .enhanceWithin() should do the job, however, it looks like it failed here. Anyway, all you need to re-enhance listview widget by calling .listview("refresh"); after successfully loading external elements.
$( "#nav-panelz" ).on( "panelbeforeopen", function( event, ui ) {
  $("#loadexternal").load("external.php", function () {
     $("#loadexternal").listview("refresh");
  });
});


text:
Q: Undefined symbol error when using tensorflow addons image transform I am trying to use tensorflow addons to do image affine transformation and I'm getting strange errors.
I installed tensorflow 2.1 using anaconda, then pip install tensorflow addons in the same environment as it is not yet available on conda. The error might come from that fact...
So here is the code, can anyone try it?
some_image_path = '/path/to/an/image'
with open(some_image_path, 'rb') as f:
    image = tf.io.decode_image(f.read())

ops = tfa.image.transform_ops.angles_to_projective_transforms(90, image.shape[0], image.shape[1])
image = tfa.image.transform(image, ops)

Here the log trace:
Traceback (most recent call last):
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3331, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-24-2e958d55097f>", line 1, in <module>
    tfa.image.transform(image, ops)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 568, in __call__
    result = self._call(*args, **kwds)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 615, in _call
    self._initialize(args, kwds, add_initializers_to=initializers)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 497, in _initialize
    *args, **kwds))
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2389, in _get_concrete_function_internal_garbage_collected
    graph_function, _, _ = self._maybe_define_function(args, kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2703, in _maybe_define_function
    graph_function = self._create_graph_function(args, kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/function.py", line 2593, in _create_graph_function
    capture_by_value=self._capture_by_value),
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 978, in func_graph_from_py_func
    func_outputs = python_func(*func_args, **func_kwargs)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/eager/def_function.py", line 439, in wrapped_fn
    return weak_wrapped_fn().__wrapped__(*args, **kwds)
  File "/home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/func_graph.py", line 968, in wrapper
    raise e.ag_error_metadata.to_exception(e)
tensorflow.python.framework.errors_impl.NotFoundError: in converted code:
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/image/transform_ops.py:110 transform  *
        output = _image_so.ops.addons_image_projective_transform_v2(
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/utils/resource_loader.py:49 ops
        self._ops = tf.load_op_library(get_path_to_datafile(self.relative_path))
    /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_core/python/framework/load_library.py:57 load_op_library
        lib_handle = py_tf.TF_LoadLibrary(library_filename)
    NotFoundError: /home/nicolas/.anaconda3/envs/posenet/lib/python3.7/site-packages/tensorflow_addons/custom_ops/image/_image_ops.so: undefined symbol: _ZNK10tensorflow15shape_inference16InferenceContext11DebugStringEv

A: Ok, sorry it was actually an error of mixing pip package with conda.
So the solution is to use pip instead of conda until tensorflow addons get released on conda!


text:
Q: Can I use display none for rel statements in jquery or javascript, or just css I have a piece of code

Is there an automatic way of finding all statements were rel="default", and either stop this from firing, or remove via css.
Would I need to use livequery, or jquery live.

A: Just try something like the following to find elements with rel=default:
$('[rel=default]')

To remove all elements with rel=default, call remove():
$('[rel=default]').remove();

To hide
You can use jQuery .hide() method like:
$('[rel=default]').hide();

A: Found out that rel satements can be used in css. ie li[rel~='default'] {display: none ;}, any li that contains rel statement = to default will not be displayed. –


text:
Q: VAE reconstruction loss does not get calculated right I wanted to implement a variational autoencoder and train it on my texture dataset which consists of colored images of the size 512x512.
For the VAE implementation, I took the Keras-VAE from https://keras.io/examples/generative/vae/ as an example and changed the layer-structure. After training, I looked at some reconstruction images and they were really blurry. I then looked at how the reconstruction loss was calculated and found it in this piece of the code:
def train_step(self, data):
        if isinstance(data, tuple):
            data = data[0]
        with tf.GradientTape() as tape:
            z_mean, z_log_var, z = encoder(data)
            reconstruction = decoder(z)
            reconstruction_loss = tf.reduce_mean(
                keras.losses.binary_crossentropy(data, reconstruction)
            )
            reconstruction_loss *= 28 * 28
            kl_loss = 1 + z_log_var - tf.square(z_mean) - tf.exp(z_log_var)
            kl_loss = tf.reduce_mean(kl_loss)
            kl_loss *= -0.5
            total_loss = reconstruction_loss + kl_loss

Since the example VAE is used on the mnist-dataset (image size is 28x28) I intuitively thought that I had to change the reconstruction loss to
reconstruction loss *= 512*512  #since my images are of the size 512x512

When I train the VAE now the total_loss often rockets to numbers like 904815524.6657 in the first training epoch even though the reconstruction loss in the same first epoch is around 15000 and also the average total_loss is around 15000. After a while, the total_loss and kl_loss sometimes also display nan after a while of training. Also, the reconstructed images with the reconstruction_loss * = 28 * 28 seemed better than with 512*512...
Did I implement the loss the right way and how can I solve this problem with the absurdly high total_loss?
Edit:
Model summary for encoder and decoder:
Model: "encoder"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
input_1 (InputLayer)            [(None, 512, 512, 3) 0
__________________________________________________________________________________________________
conv2d (Conv2D)                 (None, 256, 256, 64) 1792        input_1[0][0]
__________________________________________________________________________________________________
activation (Activation)         (None, 256, 256, 64) 0           conv2d[0][0]
__________________________________________________________________________________________________
batch_normalization (BatchNorma (None, 256, 256, 64) 256         activation[0][0]
__________________________________________________________________________________________________
conv2d_1 (Conv2D)               (None, 128, 128, 64) 36928       batch_normalization[0][0]
__________________________________________________________________________________________________
activation_1 (Activation)       (None, 128, 128, 64) 0           conv2d_1[0][0]
__________________________________________________________________________________________________
batch_normalization_1 (BatchNor (None, 128, 128, 64) 256         activation_1[0][0]
__________________________________________________________________________________________________
conv2d_2 (Conv2D)               (None, 64, 64, 128)  73856       batch_normalization_1[0][0]
__________________________________________________________________________________________________
activation_2 (Activation)       (None, 64, 64, 128)  0           conv2d_2[0][0]
__________________________________________________________________________________________________
batch_normalization_2 (BatchNor (None, 64, 64, 128)  512         activation_2[0][0]
__________________________________________________________________________________________________
flatten (Flatten)               (None, 524288)       0           batch_normalization_2[0][0]
__________________________________________________________________________________________________
dense (Dense)                   (None, 512)          268435968   flatten[0][0]
__________________________________________________________________________________________________
z_mean (Dense)                  (None, 512)          262656      dense[0][0]
__________________________________________________________________________________________________
z_log_var (Dense)               (None, 512)          262656      dense[0][0]
__________________________________________________________________________________________________
sampling (Sampling)             (None, 512)          0           z_mean[0][0]
                                                                 z_log_var[0][0]
==================================================================================================
Total params: 269,074,880
Trainable params: 269,074,368
Non-trainable params: 512
__________________________________________________________________________________________________````

Model: "decoder"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
input_3 (InputLayer)         [(None, 512)]             0
_________________________________________________________________
dense_2 (Dense)              (None, 524288)            268959744
_________________________________________________________________
reshape_1 (Reshape)          (None, 64, 64, 128)       0
_________________________________________________________________
conv2d_transpose_4 (Conv2DTr (None, 128, 128, 128)     147584
_________________________________________________________________
batch_normalization_6 (Batch (None, 128, 128, 128)     512
_________________________________________________________________
conv2d_transpose_5 (Conv2DTr (None, 256, 256, 64)      73792
_________________________________________________________________
batch_normalization_7 (Batch (None, 256, 256, 64)      256
_________________________________________________________________
conv2d_transpose_6 (Conv2DTr (None, 512, 512, 64)      36928
_________________________________________________________________
batch_normalization_8 (Batch (None, 512, 512, 64)      256
_________________________________________________________________
conv2d_transpose_7 (Conv2DTr (None, 512, 512, 3)       1731
=================================================================
Total params: 269,220,803
Trainable params: 269,220,291
Non-trainable params: 512
_________________________________________________________________


text:
Q: query_posts() should be avoided? I am reading that query_posts() should be avoided in favor of wp_query() and pre_get_posts(). I am not confident with messing with the Loop and do not fully understand the codex.
Does the code below use query_posts() ? If yes and since query_posts() should be avoided, can you suggest a method that does not use query_posts() but still accomplish the same thing?
This code in functions.php is used to sort posts by random or by price.
function my_custom_query($query){
 if ( $query->is_home() && $query->is_main_query() ) {

   $sort= $_GET['sort'];

   if($sort == "pricelow"){
     $query->set( 'meta_key', 'price' );
     $query->set( 'orderby', 'meta_value_num' );
     $query->set( 'order', 'ASC' );
    }

  if($sort == "random"){
     $query->set( 'orderby', 'rand' );
    }

 }
}
add_action( 'pre_get_posts', 'my_custom_query' );

.
Link A (Random) and Link B (Price) are posted in my menu by using this code. Thus the visitor to the website can sort the posts simply by clicking a link.
Random
Price

A: I have done a very detailed explanation on this very topic on WPSE, and for the sake of the value and benefit it might have for SO users, here is the complete post copied from that question on WPSE. For interest sake, here is a link to the complete post on WPSE: Some doubts about how the main query and the custom query works in this custom theme?
Your actual question is basically when to run a custom query and when to make use of the main query. Lets break it down in three parts
PART ONE
When to run a custom query (This is not a definitive list)

*

*To create custom content sliders

*To create a featured content area in a page

*On page.php templates if you need to display posts

*If you require custom content on a static front page

*Display related, popular or informational posts

*Any other secondary or supplementary content outside the scope of the main query
When to make use of the main query.
To display the primary content on

*

*On your homepage and the page set as a blogpage in the backend

*All archive pages which includes templates like archive.php, category.php, author.php, taxonomy.php, tag.php and date.php
PART TWO

To select all the featured posts I use this line that create a new WP_Query object that define a query having the specific tag featured:
So, from what I have understand, this is not the WordPres main query but it is a new query created by me. From what I have understand it is better create a new query (as done) and not use the main query when I want perform this kind of operations

Correct. This falls out of scope for the main query. This is secondary or supplementary content which cannot be created with the main query. You SHOULD ALWAYS use either WP_Query or get_posts to create your custom queries.
NEVER USE query_posts to create custom queries, or even any other query. My emphasis.

Note: This function isn't meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of the query. It is inefficient (re-runs SQL queries) and will outright fail in some circumstances (especially often when dealing with posts pagination).

Moving on

Ok, going on I show all the posts that have not the featured tag, to do this I use this code snippet that on the contrary modify the main query:
query_posts( array( 'tag__not_in' => array ( $term->term_id )));

So I think that this is pretty horrible. Is it true?

That is all wrong and your statement is unfortunately true. As said before, NEVER use query_posts. It runs a complete new query, which is bad for performance, and it most cases breaks pagination which is an integral part of the main query for pagination to work correctly.
This is your primary content, so you should be using the main query with the default loop, which should look like this, and this is all you need
<?php
    if (have_posts()) :
        // Start the Loop.
        while (have_posts()) : the_post();
get_template_part('content', get_post_format());

        endwhile;
    else :
        // If no content, include the "No posts found" template.
        get_template_part('content', 'none');

    endif;
?>

You can completely get rid of this part, delete it, burn it and forget about it
<?
// get the term using the slug and the tag taxonomy
$term = get_term_by( 'slug', 'featured', 'post_tag' );
// pass the term_id to tag__not_in
query_posts( array( 'tag__not_in' => array ( $term->term_id )));
?>

OK, once you've done that, you'll see that posts from the feature tag appear in your home page using the main query and default loop.
The correct way of removing this tag from the homepage is with pre_get_posts. This is the proper way to alter the main query and the hook you should always use to make changes to your primary content loop.
So, the code with pre_get_posts is correct and this is the function that you should use. Just one thing, always do a check that you are not on an admin page because pre_get_posts alters the back end as well. So this is the proper code to use in functions.php to remove posts tagged featured from the homepage
function exclude_featured_tag( $query ) {
    if ( !is_admin() && $query->is_home() && $query->is_main_query() ) {
        $query->set( 'tag__not_in', 'array(ID OF THE FEATURED TAG)' );
    }
}
add_action( 'pre_get_posts', 'exclude_featured_tag' );

PART THREE
Extra reading material which will be helpful in future

*

*Conditional tags

*When should you use WP_Query vs query_posts() vs get_posts()?

*When to use WP_query(), query_posts() and pre_get_posts

*Query Overview

*Guidance with The Loop for CMS

A: Creating a new WP_Query() object is always fine.
$sort= $_GET['sort'];

   if($sort == "pricelow"){
     $sort_args = array('meta_key' => 'price', 'orderby' => 'meta_value_num', 'order', 'ASC');
     $new_query = new WP_Query($sort_args);
    }

    blah blah blah...

No no no sorry about that. I didn't see the pre_get_posts hook.
The code in your question is good for hooking queries. As in described in WordPress Plugin API/Action Reference/pre_get_posts:

pre_get_posts runs before WP_Query has been setup.

So it hooks the default WP_Query() where you want (in your code, it changes WP_Query on GET request).
In your template files, use new WP_Query($args).


text:
Q: Compiler Error C3646 'unknown override specifier' in auto generated .tlh when using importlib in idl I use Visual Studio 2015 and I have a C# Application-Project that defines a COM-Interface and generates a .tlb file on compilation. Now I want to import that Csharp.tlb into an idl.
MyLibrary.idl:
import "oaidl.idl";
import "ocidl.idl";
import "Cplusplus.idl";

library MyLibrary
{
  importlib("stdole32.tlb");
  importlib("stdole2.tlb");
  importlib("Csharp.tlb");

  interface IMyCOM : IDispatch
  {
    [propget, id(1)]
    HRESULT CpluplusObject
    (
      [out,retval] ICplusplusObject** cplusplusObject
    );

    [propget, id(2)]
    HRESULT CsharpObject
    (
      [out, retval] ICsharpObject** csharpObject
    );
  }

  coclass MyCOM
  {
    [default] interface IMyCOM;
  };
}

During compilation I get an error
C3646 'csharpObject': unknown override specifier in MyLibrary.tlh
MyLibrary.tlh was auto generated by the compilation and looks as the following
MyLibrary.tlh:
#pragma once
#pragma pack(push, 8)

#include <comdef.h>

namespace MyLibrary {

  struct __declspec(uuid("8e664998-bc93-48e7-adcc-84fc8598cd5d"))
  /* dual interface */ ICplusplusObject;

  _COM_SMARTPTR_TYPEDEF(ICplusplusObject, __uuidof(ICplusplusObject));

  struct __declspec(uuid("388ebf11-05c8-4b86-b2bd-60f0ef38695e"))
  IMyLibrary : IDispatch
  {
    __declspec(property(get=GetCplusplusObject))
    ICplusplusObjectPtr cplusplusObject;
    __declspec(property(get=GetCsharpObject))
    ICsharpObjectPtr csharpObject;

    ICplusplusObjectPtr GetCplusplusObject ( );
    ICsharpObjectPtr GetCsharpObject ( );

    virtual HRESULT __stdcall get_CplusplusObject (
      /*[out,retval]*/ struct ICplusplusObject * * cplusplusObject ) = 0;
    virtual HRESULT __stdcall get_CsharpObject (
      /*[out,retval]*/ struct ICsharpObject * * csharpObject ) = 0;
  }

  __declspec(implementation_key(1)) ICplusplusObjectPtr IMyLibrary::GetcplusplusObject ( );
  __declspec(implementation_key(2)) ICsharpObjectPtr IMyLibrary::GetcsharpObject ( );
}

The error means that ICsharpObjectPtr or ICsharpObject respectively is not known which I understand so far. ICplusplusObjectPtr is known because import "ICplusplus.idl" added the definitions into the .tlh and importlib("ICsharp.tlb"); did not obviously.
For Test reasons I generated the ICsharp.idl out of the .tlb by using OLE/COM Object Viewer and made an import of that idl. The error was gone after that.
But why does the importlib of the .tlb not work directly? I do not want to generate an idl file every time out of the .tlb.
I think that there is an #include "ICsharp.tlh" missing or something to make the type known for the .tlh. But how to tell the idl or the compiler to properly reference the ICsharpObject?
Thank you so much in advance for your help.

A: This is an error due to wrong order of tlb-imports. The #import directive tries to generate the primary (.tlh) and secondary (.tli) header files on compilation. If a tlb uses a type of another typelib which was not imported first this error will occur. In this case the following solved the error
Importer.cpp
#import "CplusplusLibrary.tlb"
#import "CsharpLibrary.tlb"
#import "MyLibrary.tlb"

Thank you so much Igor.


text:
Q: csv file generated with Perl broken I created a csv file using the perl module Text::CSV_XS.
Here is the relevant code:
open (my $csv_fh, '>', $tmp_file) or die("Unable to open CSV '$tmp_file' for write");

my $csv = Text::CSV_XS->new({'binary' => 1, 'sep_char' => $config->{'csv'}->{'sep_char'}, 'eol' => "\015\012"}) or die(Text::CSV->error_diag());

$csv->print($csv_fh, ["ID", "ASEITE", "ERDAT", "QUELLE", "AUSGABE", "RESSORT", "AUTNR", "NAME", "ANZHLZEIL", "ANZHLZEICH", "UEBER", "TEXTSP", "ART", "BETRAG", "GRUND", "FEST", "STATUS", "SLEVEL"]);

$csv->print($csv_fh, ["A","1","AB","A-5","01","12345","12345","NAME","0","0","Testtext","Testtext2","1","45","","","0",""]);

close $csv_fh;

When i try to open the file using Microsoft Excel i get the message that the filename extension (csv) does not match the format/structure of the file.
I get asked if i trusted the source. After klicking 'ok' i receive the information that there was an error. Again i click 'ok'. After that i can see the csv headline plus the only line of the file. Everything looks as expected.
My question: Why do i get this error message opening the file? What is wrong with the file i created?

A: When you open a text file whose first 2 characters are "ID" in Excel, it thinks it's a SYLK file, and so gives this warning. This is a very old issue with Excel. See this Microsoft Support page for example. The error will go away if you put quotes around ID or change its case.


text:
Q: Destroy event, or linking external DOM item to Backbone model I'm creating a drag & drop element for Weebly. Weebly wraps each element in a Backbone JS view, as explained here.
// My js file. PlatformElement is a Weebly-controlled object exposed to me.
PlatformElement.extend({
    initialize: function() {
        // Weebly calls this method automatically at element creation time.
        // This is where I add a new menu item to an external navigation menu.
    }
});

When the Backbone view is initialized, I add a new DOM node to an external navigation menu. My issue begins here: when my model is destroyed, the DOM node I've created persists.
Weebly destroys/recreates the view each time a user re-configures my element in the web designer interface. My external menu node doesn't get destroyed because it's not part of the model, and my JS doesn't have awareness of the destory event to manually remove the menu node.
Of course, that means each change to my element creates another duplicate menu nodes.
Question:

*

*Is there an event Weebly exposes to me, or native Backbone functionality exposes to me, to let me know that my model is being destroyed?

*Or, is there a way to "link" my external menu node to my model so that when my model is destroyed, so is the menu node?

A: Backbone does provide ways to listen to events happened to Backbone object (Model, View, Collection, ...). To listen to destroy event of a model, you could:
const model = new Model({/*...*/});

// solution 1
model.on('destroy', () => console.log('model is destroyed'));

// soluction 2
const view = new View({/*...*/});
view.listenTo(model, 'destroy', () => console.log('model is destroyed'));

model.destroy(); // this will trigger two callbacks above


text:
Q: Error while running Jenkins in Docker when I try to build a Job I am trying to running a Jenkins into a Docker using a Docker compose and when i try to build a job Jenkins shows me the next error:
Salida de consola
Started by user admin
Running as SYSTEM
Building in workspace C:\Users\cpaez\Documents\Automation\MOM\JSFiles
java.nio.file.AccessDeniedException: /C:\Users\cpaez\Documents\Automation\MOM\JSFiles
    at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
    at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
    at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
    at java.nio.file.Files.createDirectory(Files.java:674)
    at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
    at java.nio.file.Files.createDirectories(Files.java:767)
    at hudson.FilePath.mkdirs(FilePath.java:3260)
    at hudson.FilePath.access$1300(FilePath.java:211)
    at hudson.FilePath$Mkdirs.invoke(FilePath.java:1251)
    at hudson.FilePath$Mkdirs.invoke(FilePath.java:1247)
    at hudson.FilePath.act(FilePath.java:1075)
    at hudson.FilePath.act(FilePath.java:1058)
    at hudson.FilePath.mkdirs(FilePath.java:1243)
    at hudson.model.AbstractProject.checkout(AbstractProject.java:1200)
    at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:574)
    at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:499)
    at hudson.model.Run.execute(Run.java:1880)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE

This is Docker compose:
version: '2'
services:
  master:
    build: .
    image: jenkins/jenkins:latest
    restart: unless-stopped
    hostname: jenkins
    ports:
      - "8080:8080"
      - "50000:50000"
    volumes:
      - jenkins_home:/var/jenkins_home

volumes:
  jenkins_home:

And this is my Docker file:
FROM jenkins/jenkins

USER SYSTEM
RUN apt-get -y update && apt-get install -y maven

USER jenkins
COPY plugins.txt /usr/share/jenkins/ref/plugins.txt
RUN /usr/local/bin/install-plugins.sh < /usr/share/jenkins/ref/plugins.txt

Anyone can help me? Thank you in advance.

A: User jenkins in your container does not have access to folder C:\Users\cpaez\Documents\Automation\MOM\JSFiles on your host. Given your docker-compose.yml  it's probably caused by either:

*

*This directory does not exists in your container (as per the volume you are mounting), you may try to add

    volumes:
       - jenkins_home:/var/jenkins_home
       - /c/Users/cpaez/Documents/Automation/MOM/JSFiles:/c/Users/cpaez/Documents/Automation/MOM/JSFiles

*

*Ensure this folder has enough permission for jenkins user in your container to write this directory (your container will run as this user as per the USER jenkins instruction)


text:
Q: Correct way to create and remove/destroy DOM element using Javascript Explanation:
I have an ASP.NET application, where I can retrieve Vehicle information with a click of a button. The Vehicle detail is then displayed in a modal screen with the following data: ID, VEHICLENAME,YEAR, and VEHICLE_DOCUMENTATION.
The VEHICLE_DOCUMENTATION is displayed in anchor tags, which is created using JavaScript. The expectation is when I retrieve Vehicle detail, their relevant VEHICLE_DOCUMENTATION would be displayed, and created in an anchor tag. If another Vehicle detail is retrieved, their relevant VEHICLE_DOCUMENTATION would also be created in an anchor tag.
The problem I'm encountering is when anchor tag are created for a Vehicle detail, I can not create anchor tags for the next time I retrieve another Vehicle detail. I have outlined the errors I keep getting below.
I've provided the full working code below, including the error message I encounter. Hopefully someone could assist me.
DetailController:
DetailController:

[HttpPost]
public ActionResult GetDetail(int? id)
{
  return _context.Vehicle.Where(v => v.ID == id).Select(x => new VehicleModel(){
     ID = x.ID,
     VEHICLENAME = x.VEHICLENAME,
     YEAR = x.YEAR,
     VEHICLE_DOCUMENTATION = x.VEHICLE_DOCUMENTATION
  }).FirstOrDefault();
}

Detail Razor Page:
Button
------
<button type="button" data-toggle="modal" data-target="#detailModal" onclick="postData(id)"></button>

Modal window appears when button is clicked
-------------------------------------------

Vehicle Detail

                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    ×
                </button>

                ID:

                VEHICLE NAME:

                YEAR:

                VEHICLE DOCUMENTATION:

AJAX POST to GetDetail method:
------------------------------

Browser error message:
Uncaught TypeError: Cannot read property 'appendChild' of null
    at Object.success (...)
    at fire (jquery.js:3240)
    at Object.fireWith [as resolveWith] (jquery.js:3370)
    at done (jquery.js:9061)
    at XMLHttpRequest.<anonymous> (jquery.js:9303)

A: when you put:
 document.getElementById("VEHICLE_DOCUMENTATION").outerHTML = "";

What you are doing is to erase the label element, so when you call it from
const list = document.getElementById('VEHICLE_DOCUMENTATION');

It will return null as the element do not exist anymore
Instead of using "outerHTML" you should use "innerHTML", here it is the difference between them:

console.log(document.getElementById("VEHICLE_DOCUMENTATION").outerHTML);

console.log(document.getElementById("VEHICLE_DOCUMENTATION").innerHTML);

something


text:
Q: MySql: How quotes around date(string) affects the results? Difference between two queries marked with ^
SELECT COUNT(*)
FROM customers_reports AS cr
JOIN customers_docs on customers_docs.customerId=cr.customerId
WHERE cr.firstDepositDate >= 2015-12-01  AND customers_docs.docs = "None";

This query returns 2 results.
SELECT COUNT(*)
FROM customers_reports AS cr
JOIN customers_docs on customers_docs.customerId=cr.customerId
WHERE cr.firstDepositDate >='2015-12-01' AND customers_docs.docs = "None";
                            ^          ^

While this query returns 30,000 results.
May someone explain why?

A: Without single quotes the date value becomes the arithmetic expression and 2015-12-01 is 2002 which is obviously affect the result

A: Because when you do not quote the date, MySQL thinks it's an integer.
2015-12-01 evaluates to 2002.


text:
Q: Why the range of x axis is plotted from 0 to 600 in the following Python code using pyplot? Should it be expected from 0 to 2*np.pi? Why the range of x axis is plotted from 0 to 600 in the following Python code using pyplot? Should it be expected from 0 to 2*np.pi?
import numpy as np
import matplotlib.pyplot as plt

# Create arrays of sine and cosine values
A = np.arange(0, 2 * np.pi, 0.01) # range:0 - 2pi,step length: 0.01
B = np.sin(A)

# Create a figure and axis
fig, ax = plt.subplots(1, 1)

# Plot the sine values on the y-axis
ax.plot(B, color='red', linewidth=3.0, linestyle='--', label="sin(x)")

# Show the plot
plt.show()

A: Find the solution:
ax.plot(A, B, color='red', linewidth=3.0, linestyle='--', label="sin(x)")


text:
Q: how to handle axios onError in nuxtjs plugin and show appropriate error message to user I have a nuxt single page application. The api that I work with has a list of codes for various errors. So, in onError interceptor, the error has to be checked in a dictionary or in a more desired way in a json file. For this, I added a error-handler.js plugin in my nuxt project. But, I don't know how to read from json file.
1) Loading of the json file would occur every time an error thrown?
2) What is the best practice to show the error message to the user? Is this plugin only responsible to create the error-message and in the page try-catch is needed to toast that message?
export default function ({ $axios, store, app, redirect }) {

  $axios.onError(error => {

    if (error.config.hasOwnProperty('errorHandle') && error.config.errorHandle === false) {
      return Promise.reject(error);
    }

    if (error.message === 'Network Error') {
      error.message = 'check the Internet connection';
      return
    }

    const code = parseInt(error.response && error.response.status)
    if (error.response)
      console.log('error.response', error.response.status, error.response)

    if (error.response.data.Errors) {
      let errMessage = ''
      error.response.data.Errors.forEach(item => {

        switch (item.Message.MessageText) {

             case 'OrganizationNotFound':
             errMessage = 'the organization that you are looking for does not exists'
            break
        }
      })
     }
   }
}

A: In Nuxt, plugin code is loaded once or twice per user visit, after that in universal mode it is not executed (of course your onError handler will be). It's once if you make it a client/server-side only plugin, or twice if you need it both on client and server. In your case client-side only plugin sounds like a good choice - just make sure that loading of JSON goes outside of the onError function.
As for how to show it, it depends on your design. We are using Vuetify and have v-snackbar in default layout so it's on every page. Snackbar is bound to VueX value. Then your error plugin can populate that value as appropriate as it will have access to store. This keeps the "raising the error" (dispatch to store) and "showing the error" reasonably decoupled, whilst very reusable (components can also dispatch to store if they face a problem).


text:
Q: How to create a new BibDesk export template Where do I find the current "Minimal BibTex" template for exporting a library? I want to (a) create a new version that includes URLs and DOIs, (b) name it "MinPlus BibTex", and (c) save it to wherever it needs to be saved so that it appears on the Mac, BibDesk File/Export... menu.

A: You can't edit the Minimal BiBTeX template directly, but you can make your own template and then choose that when you export or copy items.
To do this, create a plain text file with minimal-URL.txt with the following content:
<$publications>
@<$pubType/>{<$citeKey/>,
<$requiredFields>
    <$name/> = <$bibTeXString/>,
</$requiredFields>
<$optionalFields.@nonEmpty>
    <$name/> = <$bibTeXString/>,
</$optionalFields.@nonEmpty>
<$fields.url?>
    URL = {<$fields.url/>},
</$fields.url?>
<$fields.doi?>
    DOI = {<$fields.doi/>}
</$fields.doi?>
}
</$publications>

Save this in ~/Library/Application Support/BibDesk/Templates (to get to this folder when you save you can type Command-G at the file save dialogue box and it will allow you to enter the entire path.)
Now in your BibDesk preferences, go to the Templates panel, and click on the + to add a new template file.  Choose .txt as the file type.  You should see the following:

Double click to choose the file, and then navigate to ~/Library/Application Support/BibDesk/Templates and choose your minimal-URL.txt file.
Now your template is available.  If you just want to use it occasionally, for individual items or groups of items,  you can always access it via the Edit menu -> Copy As -> Template -> minimal-URL.
If you want to use that as your default action for copying bib items, then you can set that in the Citation panel of the Preferences: choose Template and then pick your minimal-URL template.
It will also be available in the File -> Export menu as a possible output format:


text:
Q: get url for a manually uploaded image file to Firebase Storage I'm wring a kotlin android app.
I want to show some images in a recycle-view.
I have uploaded them in Firebase Storage.
I have cloud Firebase collection which has a field "image".
I normally use Glide to load images from Firebase, but it uses a URL.
I have the file location:
"gs://myapp.appspot.com/image.png"
How would I be able to convert this to be able to use it in Glide?
Glide
.with(context)
.load(model.image)
.centerCrop()
.placeholder(R.drawable.holder)
.into(holder.itemView.iv_image)

A: If you use FirebaseUI for Storage, you can load the image into a view with:
StorageReference ref = FirebaeStorage.instance.getReferenceFromUrl("gs://myapp.appspot.com/image.png");
Glid.with(context).load(ref).centerCrop().placeholder(R.drawable.holder).into(holder.itemView.iv_image)

If you don't want to use FirebaseUI, you'll have to translate the path you have to a download URL yourself by calling ref.downloadUrl as shown in the documentation on downloading data from a URL (that Doug also linked).


text:
Q: Changing RouteData in Asp.Net Core 3.1 in Middleware I've recently updated my .Net Core 2.1 application to 3.1 and there is one part that has not upgraded as expected.
I'd written code to map subdomains to areas as described here
I now realise that the method of using app.UseMvc() should be replaced with app.UseEndpoints() but I can't find anywhere in the 3.1 framework that will allow me to write to the RouteData before app.UseEndpoints()
//update RouteData before this
app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(
        "admin", "{area:exists}/{controller=Home}/{action=Index}/{id?}");
    endpoints.MapControllerRoute(
        "default", "{controller=Home}/{action=Index}/{id?}");
});

Is there a way to write to RouteData using Middleware?
I've tried going back to app.UseMvc() as it's still in the framework but MvcRouteHandler doesn't seem to exist anymore
app.UseMvc(routes =>
{
    routes.DefaultHandler = new MvcRouteHandler(); //The type of namespace could not be found
    routes.MapRoute(
        "admin",
        "{area:exists}/{controller=Home}/{action=Index}/{id?}");
    routes.MapRoute(
        "default",
        "{controller=Home}/{action=Index}/{id?}");
});

A: Try to use custom middleware.
Add a reference to using Microsoft.AspNetCore.Routing and use Httpcontext.GetRouteData() method to achieve RouteData
app.UseRouting();

app.Use(async (context, next) =>
{

    string url = context.Request.Headers["HOST"];
    var splittedUrl = url.Split('.');

    if (splittedUrl != null && (splittedUrl.Length > 0 && splittedUrl[0] == "admin"))
    {
        context.GetRouteData().Values.Add("area", "Admin");
    }

    // Call the next delegate/middleware in the pipeline
    await next();
});

app.UseEndpoints(endpoints =>
{
    endpoints.MapControllerRoute(
        "admin", "{area:exists}/{controller=Home}/{action=Index}/{id?}");
    endpoints.MapControllerRoute(
        "default", "{controller=Home}/{action=Index}/{id?}");
});


text:
Q: Mongoose Connection Keeps Closing I have a Node.js app that should run forever and am creating a single mongodb connection. However the connection keeps closing after a few seconds and crashing the app. I've stripped all the code back to just the create connection method. App code:
var mongoose = require('mongoose'),
    db = mongoose.createConnection("mongodb://localhost:28017/mwa");

Then after a few seconds I get:
node.js:201
    throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: connection closed
    at [object Object].<anonymous> (/home/gavin/mwa/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:557:24)
    at [object Object].emit (events.js:88:20)
    at [object Object].<anonymous> (/home/gavin/mwa/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:109:15)
    at [object Object].emit (events.js:70:17)
    at Socket.<anonymous> (/home/gavin/mwa/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:427:12)
    at Socket.emit (events.js:67:17)
    at Array.0 (net.js:335:10)
    at EventEmitter._tickCallback (node.js:192:40)

A: Check MongoDB's log file to see if it's hitting any issues that are making it kill your connection.  As you mention, restarting MongoDB would be a good thing to try if there's nothing in the log.


text:
Q: wget localhost - connection refused - Atlassian Installation on AWS I am trying to debug why I get a connection error when trying to setup Confluence on an AWS Instance.
I tried to do a simple test command on the CLI and got an error "Connection Refused" which makes me think perhaps its a Ubuntu Firewall issue, but I disabled UFW and it doesn't seem to have FirewallD. What other culprits/things could I try to disable/configure?
root@confluence:/usr/src# wget http://localhost:8090
--2018-05-16 01:03:37--  http://localhost:8090/
Resolving localhost (localhost)... 127.0.0.1
Connecting to localhost (localhost)|127.0.0.1|:8090... failed: Connection refused.

root@confluence:/usr/src# free -m
              total        used        free      shared  buff/cache   available
Mem:            990         191         145          11         653         627
Swap:             0           0           0

root@confluence:/usr/src# systemctl status confluence
● confluence.service
   Loaded: loaded (/etc/init.d/confluence; bad; vendor preset: enabled)
   Active: active (exited) since Wed 2018-05-16 01:03:25 UTC; 1min 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 22595 ExecStart=/etc/init.d/confluence start (code=exited, status=0/SUCCESS)

May 16 01:03:25 confluence confluence[22595]: To run Confluence in the foreground, start the server with start-confluence.sh -fg
May 16 01:03:25 confluence confluence[22595]: executing using dedicated user: confluence
May 16 01:03:25 confluence runuser[22602]: pam_unix(runuser:session): session opened for user confluence by (uid=0)
May 16 01:03:25 confluence confluence[22595]: If you encounter issues starting up Confluence, please see the Installation guide at http://confluence.atlassian.com/display/DO
May 16 01:03:25 confluence confluence[22595]: Server startup logs are located in /opt/atlassian/confluence/logs/catalina.out
May 16 01:03:25 confluence confluence[22595]: Existing PID file found during start.
May 16 01:03:25 confluence confluence[22595]: Removing/clearing stale PID file.
May 16 01:03:25 confluence confluence[22595]: Tomcat started.
May 16 01:03:25 confluence runuser[22602]: pam_unix(runuser:session): session closed for user confluence
May 16 01:03:25 confluence systemd[1]: Started confluence.service.

A: I was using a low powered server. I literally had to leave it over night and it was working the next day. I'm not 100% sure this was the issue but please try that approach.


text:
Q: Equivalent condition for an open set in a metric space I'm reviewing for a first-year exam in introductory topology.  I've run across this question:
Let $X$ be a metric space.  Prove that a subset $U$ of $X$ is open iff for every $z\in U$ and every sequence $\{x_n\}_{n\in\omega}$ that converges to $z$, there exists an $N\in\omega$ such that for all $n\geq N$, $x_n\in U$.
The forward direction is easy.  The converse has always, \textit{always} given me trouble, for some reason.  I can't figure out how to construct an open ball completely contained in $U$ to show that the interior of $U$ is all of $U$.  I would like to make a sequence that encompasses all of the points in such an open ball, but I can only capture finite or countable subsets.  This should be super basic, but can anyone give me a hint on how to proceed?
Also, apologies if this is a duplicate.  I couldn't figure out how to parse the question for Google.
Thank you!

A: If $U$ is not open then it must contain an element $z$ that does not belong to the interior of $U$.
So for $n=1,2,\dots$ the open ball having $z$ as center and $\frac1n$ as radius has a nonempty intersection with $U^c$.
Choose $x_n$ as an element of that intersection. Then $x_n\to z\in U$ while $x_n\notin U$ for each $n$.

A: If $U$ is not open, then $U^c$ is not closed and hence not sequentially closed (use that $X$ is metric space), so there is a sequence of elements $x_n \to x \in X$ with $x_n \in U^c$ but $x \in U$.


text:
Q: How do I append SQL statements within a cursor using dynamic SQL? I am trying to execute the following script (SQL Server 2008) but it seems that the first portion of the script is always missing when I do the final PRINT(@sql) at the bottom. Am I somehow overwriting the first portion of the script?
I think the issue is with declaring the @sql variable within the CURSOR. When I move the declaration above the OPEN @tableCursor I receive different output. What is the implication of setting the @sql variable within a table cursor?
OPEN @tableCursor
FETCH NEXT FROM @tableCursor INTO @constituentId, @internalName, @fieldName, @value
WHILE (@@fetch_status = 0)
BEGIN

SET @sql = ''
IF (@fieldName = 'MARKET_SECTOR_DES')
BEGIN
-- this is the section that is missing when I do the PRINT(@sql) below
SELECT @sql = @sql + '
    -- Update BloombergMarketSector
    UPDATE dbo.Constituent
    SET BloombergMarketSector = ''' + @value + ''',
        ModifiedDate = GETDATE()
    WHERE id = ' + @constituentId + '
    '
PRINT (@sql) -- this works
END

PRINT (@sql) -- this works - it seems the issue is happening with this SELECT statement
SELECT @sql = @sql + '
    -- Update the Column
    -- The Column Exists - update
    IF NOT EXISTS (
                SELECT TOP 1 *
                FROM dbo.ConstituentBloombergAttribute AS cba
                WHERE cba.ConstituentId = ' + @constituentId + ')
    BEGIN
        INSERT
        INTO dbo.ConstituentBloombergAttribute (ConstituentId, ModifiedBy, ModifiedDate, CreatedBy, CreatedDate)
        VALUES (' + @constituentId + ', ''admin'', GETDATE(), ''admin'', GETDATE())
    END

    UPDATE dbo.ConstituentBloombergAttribute
    SET ' + @internalName + ' = ''' + @value + ''',
        ModifiedDate = GETDATE()
    WHERE ConstituentId = ' + @constituentId + '
    '

PRINT @sql
FETCH NEXT FROM @tableCursor INTO @constituentId, @internalName, @fieldName, @value
END

A: One of your variables is null, try this:
SELECT @sql = @sql + '
    -- Update BloombergMarketSector
    UPDATE dbo.Constituent
    SET BloombergMarketSector = ''' + isnull(@value,'V MISSING') + ''',
        ModifiedDate = GETDATE()
    WHERE id = ' + isnull(@constituentId,'C MISSING') + '
    '

Could be a database setting: When SET CONCAT_NULL_YIELDS_NULL is ON, concatenating a null value with a string yields a NULL result. For example, SELECT 'abc' + NULL yields NULL. When SET CONCAT_NULL_YIELDS_NULL is OFF, concatenating a null value with a string yields the string itself (the null value is treated as an empty string). For example, SELECT 'abc' + NULL yields abc.


text:
Q: What can I do to reduce temperature using various throttling techniques in 10.04? Currently all I'm doing is to use sysfs to force both Cores into Powersave mode, however I'm curious if there are other ways to throttle various parts of the Laptop.
The specification is
Dell Inspiron 640m
Core Duo T5600 (1.83Ghz / 2mb cache)
Centrino (if that gives any indication to the chipset/graphics/etc)
Intel Onboard Graphics
1Gb Memory
250Gb Hitachi HDD (I assume it's 5400rpm since it was low priced, unless all 2.5" drives are 7200rpm now?)
Currently, Ubuntu is allowing me to select 1 / 1.33 / 1.83Ghz profiles for my CPU, can this be dropped lower or are these simply all the CPU provides?
Other steps I'm considering to drop the temperature (please let me know if they are worthwhile) are,

*

*switching to SSD

*getting a laptop cooling pad

Thanks for any advice :)
EDIT: Just some background info, I want to turn this into a server to run all day/night, and living in HK, ambient temps might get as high as 40C, as I'm not going to leave the air conditioning on while I'm at work.
I left it on overnight, it was about 30C last night I think, and this morning awoke to 50C internal/CPU and 45C HDD, with the lid closed and essentially idle. Opening the lid seems to drop the temp back down to 40-45C all around, so I guess I'll be leaving the lid up.

A: You could try different things including leaving space behind and under the laptop to let air flow.
You could try also powertop, which is a tool for Intel platforms that helps saving Watts. See LessWatts.org, i guess it is already included in the repositories.

Hope it helps


text:
Q: Invoke process of replacing  to the  in angular 4 How can we invoke process of replacing(which is invoked by angular at the start of app) component-selector with the component template html in angular 4. I want to work on Angular and Ext 4.2.2 together in my project. for more details you can refer How can I put my Extjs 4.2.x project inside latest Angular App. I am successfully able to integrate both the framework together. Now I want one of the new tab development in Angular instead of ExtJS.
To get those two framework together I have gone through following steps:

*

*I have put root component selector <app-root> inside
index.html of Ext app.

*I have initialized Ext app inside angular
component's ngOnInit method.

*Now My Ext app loads inside Angular component's template HTML.

*Now inside Ext app I create a new test tab with Html containing a selector app-panel of one of the angular component.

*When I click on the test tab app-panel is not replaced by component's template html.
So I want this app-panel should work as normal angular component i.e. should be replaced with its associated template html. for this to work i have to invoke the process of replacing app-panel with its template. Any genius out here might have done similar thing please let me know or just let me know your valuable suggestions on this. Thanks in advance.


text:
Q: Weblogic server lib VS instance libext I use weblogic 10.
Its provide an Oracle JDBC driver 10.2.0.2 (in the server/lib on weblogic home).
Actually someone at work put a long time ago a 10.2.0.3 driver in instance libext folder.
But in production we got a jdbc driver stack (nullpointer :O) and by reverse engineering it seems we are using driver 10.2.0.2.
We know that we could change the driver in the server/lib of weblogic but i want to understand.
Isn't libext supposed to override server libs like META-INF libs override libext?
By the way we are in a strange situation:
- We have 2 EAR, and for the exact same treatment in those 2, one will sometime throw the oracle driver nullpointer while the other doesn't
- I wonder if one ear isn't using 10.2.0.2 while the other is using 10.2.0.3 (i saw a bug fixed that could fit to our problem for this version).
- I need to look better but at first sight both ear use the exact same datasource set in weblogic JNDI resources
Any idea?

A: No one should be putting anything into the lib/ext directory, especially not JDBC driver JARs.  That directory is for library extensions.  I'd remove that JAR from lib/ext immediately.
As you say, if the 10.2.0.3 version is a bug fix, the correct place to put it would be server/lib, not lib/ext.
Two EARs means two separate servers or two different ports?  I'm not sure why WebLogic would pick one driver up over the other for the same configuration.

A: As @duffymo and Oracle docs state: http://download.oracle.com/docs/cd/E11035_01/wls100/jdbc_admin/third_party_drivers.html#wp1048361 the driver location should be server/lib.
Can you run this from a JSP on each EAR - this should give you the jar file from  where the driver is loaded.
try {
  String candidate = "oracle.jdbc.driver.OracleDriver";
  Class clazz = Class.forName(candidate);
  java.security.ProtectionDomain dom = clazz.getProtectionDomain();
  java.security.CodeSource cs = dom.getCodeSource();
  java.net.URL url = cs.getLocation();
  out.println("<TITLE>" + candidate + "</TITLE></head><body>");
  out.println("Path for " + candidate + " = " + url.getFile());
} catch (Exception t) {
  t.printStackTrace(response.getWriter());
}


text:
Q: How to launch swing app with jetbrains layouts in Netbeans I've created app in IDEA with some swing layouts. I want to launch it in Netbeans in order to profile. But I get:
Exception in thread "main" java.awt.IllegalComponentStateException: contentPane cannot be set to null.
    at javax.swing.JRootPane.setContentPane(JRootPane.java:603)
    at javax.swing.JDialog.setContentPane(JDialog.java:991)
    at TransTest.<init>(TransTest.java:44)
    at TransTest.main(TransTest.java:284)

What files etc I should supply in order to run it?

A: As can be read on the UI designer webpage

Unique Byte-code instrumentation techniques allow you to get rid of complicated Swing code in your Java sources. IntelliJ IDEA's GUI-compiler transparently generates all necessary code needed to create and lay out form components. The GUI-compiler has been integrated into IntelliJ IDEA's make functionality, and is also available as a separate Ant task delivered together with the IntelliJ IDEA distribution. There is also an option to generate Java source code instead of using the byte-code instrumentation approach.

So generate Java source code and use that in NetBeans, or simply hand-code your layouts rather then using a UI designer.


text:
Q: Unable to run Airflow DAGs with KubernetesExecutor - AirflowException: dag_id could not be found I am new to Airflow and have been trying for a while now to get a task ran using the KubernetesPodOperator class without any luck.
The pod gets created and synchronizes the DAGs from a git repo, I don't see any errors retrieving the DAGs but the pod fails quickly with this error:
[2020-07-16 23:55:16,593] {__init__.py:51} INFO - Using executor LocalExecutor
[2020-07-16 23:55:16,594] {dagbag.py:396} INFO - Filling up the DagBag from /opt/airflow/dags/kubernetes_executor.py
Traceback (most recent call last):
  File "/home/airflow/.local/bin/airflow", line 37, in <module>
    args.func(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/utils/cli.py", line 75, in wrapper
    return f(*args, **kwargs)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 523, in run
    dag = get_dag(args)
  File "/home/airflow/.local/lib/python3.6/site-packages/airflow/bin/cli.py", line 149, in get_dag
    'parse.'.format(args.dag_id))
airflow.exceptions.AirflowException: dag_id could not be found: kubernetes_sample. Either the dag did not exist or it failed to parse.

I am deploying Airflow 1.10.10 on EKS using Helm. Below is my airflow config file. I noticed this is the same issue as Airflow- dag_id could not be found issue when using kubernetes executor and I have tried different combinations for AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT and AIRFLOW__KUBERNETES__GIT_SYNC_ROOT with no luck.
Any ideas? I am completely stuck.
airflow:
  executor: KubernetesExecutor
  config:
    AIRFLOW__CORE__EXECUTOR: KubernetesExecutor
    AIRFLOW__CORE__LOGGING_LEVEL: INFO
    AIRFLOW__CORE__SQL_ALCHEMY_CONN: "postgresql+psycopg2://postgres:airflow@airflow-postgresql:5432/airflow"
    AIRFLOW__CORE__DAGS_FOLDER: /opt/airflow/dags
    AIRFLOW__KUBERNETES__WORKER_CONTAINER_REPOSITORY: "apache/airflow"
    AIRFLOW__KUBERNETES__WORKER_CONTAINER_TAG: "1.10.10-python3.6"
    AIRFLOW__KUBERNETES__NAMESPACE: airflow
    AIRFLOW__KUBERNETES__WORKER_SERVICE_ACCOUNT_NAME: airflow
    AIRFLOW__KUBERNETES__DELETE_WORKER_PODS: false
    AIRFLOW__KUBERNETES__RUN_AS_USER: 50000
    AIRFLOW__KUBERNETES__FS_GROUP: 65533
    AIRFLOW__KUBERNETES__GIT_REPO: ssh://git@github.com/rootstrap/champz-extractor.git
    AIRFLOW__KUBERNETES__GIT_BRANCH: seba
    AIRFLOW__KUBERNETES__GIT_DAGS_FOLDER_MOUNT_POINT: /opt/airflow/dags
    AIRFLOW__KUBERNETES__GIT_SYNC_DEST: ""
    AIRFLOW__KUBERNETES__GIT_SYNC_ROOT: /opt/airflow/dags
    AIRFLOW__KUBERNETES__GIT_SSH_KEY_SECRET_NAME: airflow-secrets

workers:
  enabled: false
flower:
  enabled: false
redis:
  enabled: false

dags:

  git:
    url: ssh://git@github.com/rootstrap/champz-extractor.git
    repoHost: github.com
    repoPort: 22
    ref: seba
    secret: airflow-git-keys
    privateKeyName: id_rsa

    gitSync:
      enabled: true
      refreshTime: 60

  initContainer:
    enabled: true

  installRequirements: true

ingress:
  enabled: true