text:
Q: Necesito marcar más de una checkbox, pero el código me da error Esta es una modificación para marcar más de una categoría personalizada en wordpress.
Me gustaría poder marcar más de una opción con la casilla de verificación, el fragmento que me permite hacerlo es comentado. El problema es que si descomente el código toda la web cae.
La clase de walker, lo que hace es permitirme cambiar el formato por radio.
function wpse_woothemes_sensei_term_radio_checklist( $args ) {

if ( ! empty( $args['taxonomy'] ) && ( $args['taxonomy'] === 'lesson-category' || $args['taxonomy'] === 'course-category' ) /* <== Change to your required taxonomy */ ) {

 if ( empty( $args['walker'] ) || is_a( $args['walker'], 'Walker' ) ) { // Don't override 3rd party walkers.
    if ( ! class_exists( 'WPSE_Woothemes_Sensei_Walker_Category_Radio_Checklist' ) ) {
        /**
         * Custom walker for switching checkbox inputs to radio.
         *
         * @see Walker_Category_Checklist
         */
        class WPSE_Woothemes_Sensei_Walker_Category_Radio_Checklist extends Walker_Category_Checklist {
            public $count = 0;
            function walk( $elements, $max_depth, $args = array() ) {
                $output = parent::walk( $elements, $max_depth, $args );

                if($args['taxonomy'] !== 'lesson-category') {

                    $output = str_replace(
                        array( 'type="checkbox"', "type='checkbox'" ),
                        array( 'type="radio"', "type='radio'" ),
                        $output
                    );

                    if( $this->count == 1 ) { ?>
                        <script type="text/javascript">
                            jQuery(document).ready(function(){
                                var radio = jQuery("div#course-category-all li.popular-category:first").find('input');
                                radio.attr('checked','checked');
                            });
                        </script>

                    <?php }

                } else {
                    $output = str_replace(
                        array( 'type="radio"', "type='radio'" ),
                        array( 'type="checkbox"', "type='checkbox'" ),
                        $output
                    );
                   echo ' <script type="text/javascript">
                        jQuery(document).ready(function(){
                            jQuery("ul#lesson-categorychecklist li:last").remove();
                            var checkboxes = jQuery("ul#lesson-categorychecklist li").find("input");
                            var checked = false;
                            jQuery.each(checkboxes, function(i,v){
                                if( !checked )
                                    checked = jQuery(v).is(":checked");

                                //console.log(checked);
                            });

                            if( checked === false ) {
                                jQuery("ul#lesson-categorychecklist li:first").find("input").attr("checked","checked");
                            }

                        });
                    </script>';

                }

                $this->count++;

                return $output;
            }
        }
    }

    $args['walker'] = new WPSE_Woothemes_Sensei_Walker_Category_Radio_Checklist;
}
}
return $args;}`

A: Prueba abriendo y cerrando las llaves {} en la linea siguiente por por que quizas no lo reconozca, sigo sin entender que parte comentada de código te hace la función.
if( !checked )
   checked = jQuery(v).is(":checked");

Quede asi:
if( !checked ) {
   checked = jQuery(v).is(":checked");
}


text:
Q: Activity indicator not loading after performSegue to a ViewController I'm a beginner in Swift and I have a problem about my activity indicator. I've been using NVActivityIndicatorView and I never have any problem until now. I have a LoginViewController which directs to another viewcontroller called ContainerViewController once the user successfully logs in.
LoginViewController:
    self.networkManager.getConfig(url: url) { (success, message, response) in
    self.stopAnimating()
        if success {
            print(response)

            if (response[APIKey.error] == nil){
                StoreManager.mainview = Definition(definitionDict: response[APIKey.definition] as! NSDictionary)

                let logoutContextMenu = ContextMenu()
                logoutContextMenu.displayName = Constants.logout
                logoutContextMenu.viewName = Constants.logout
                StoreManager.mainview.contextmenu.append(logoutContextMenu)

                Endpoints.org = StoreManager.mainview.org

                self.performSegue(withIdentifier: Constants.containerViewController , sender: self)
            }

            else{
                self.authenticate()
            }
        }else{
            print(message)
            self.showToast(message: Constants.commonErrorMessage)
        }

    }

My problem is once the segue is done, the activityindicator I have in ContainerViewController is not showing while loading the API. This only happens once the user logs in.
In ContainerViewController, I have a function in viewWillLoad called setupUI that will call another function called viewConfig. Inside the viewConfig function is the activity indicator that will start to animate every time the API is loading.
ContainerViewController:
override func viewDidLoad() {
    super.viewDidLoad()

    self.setUpUI()
}

func setUpUI(){
    switch StoreManager.mainview.menuLayout.mobile {
    case Constants.dashboardmenu:
        setUpSideBarMenu()
        if (otherViewNameSelected){
            print(selectedViewName)
            if selectedViewName == ""{
                selectedViewName = StoreManager.mainview.solutions[0].views[0].viewName
            }
            self.getViewConfig(solutionName: StoreManager.mainview.solutions[0].solutionName, viewName: selectedViewName)
        }

        break

    default:
        self.navigationItem.leftBarButtonItem = nil
        break
    }
}

func getViewConfig(){
    let url: String =  Endpoints.view + Endpoints.version + Endpoints.org + "/" + solutionName + "/" + Endpoints.views + viewName + Endpoints.token
    startAnimating()
    networkManager.getConfig(url: url) { (success, message, response) in
        self.stopAnimating()
        if success {
            self.parseViewConfig(response)
        }else{
            print(message)
        }
    }
}

parseViewConfig is a function with a tableView inside which loads data.
How can I make the activityindicator show up once the user logs in and ContainerViewController is shown?

A: Try this
func getViewConfig(){
    let url: String =  Endpoints.view + Endpoints.version + Endpoints.org + "/" + solutionName + "/" + Endpoints.views + viewName + Endpoints.token
    DispatchQueue.main.async {
        self.startAnimating()
    }
    networkManager.getConfig(url: url) { (success, message, response) in
        DispatchQueue.main.async {
            self.stopAnimating()
        }
        if success {
            self.parseViewConfig(response)
        }else{
            print(message)
        }
    }
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: Stationarity of the sum of an ARMA processes I've seen somewhat similar questions, but nothing that is quite like what I am concerned with currently.
Given that $ X_t=0.3X_{t-1}+e_{1t}+0.3e_{1,t-1} $ and $z_t=X_t+X_{t-1}$ ; is $z_t$ (weakly) stationary and/or invertible?
So,  I've tried to do this using the stationarity conditions, starting with a mean independent of time.
Note: $e_{1t}$~$WN(0,1)$
$$z_t=0.3X_{t-1}+0.3X_{t-2}+e_{1t}+1.3e_{1,t-1}+0.3e_{1,t-2}$$
Take expectation:
\begin{align*}E(z_t)&=E(0.3X_{t-1}+0.3X_{t-2}+e_{1t}+1.3e_{1,t-1}+0.3e_{1,t-2})
%
\\&=0.3E(X_{t-1})+0.3E(X_{t-2})
\\&= 0.3E(z_{t-1})
\end{align*}
And what I initially though is that because $z_t$ is dependent on time (due to the lags) then it is non-stationary. But I realised that this means that any model with an AR lag would be non-stationary, so my interpretation here is clearly incorrect.
Using the Unit root method:
Given that $z_t=X_t+X_{t-1}$,
\begin{align*}
z_t&=0.3X_{t-1}+0.3X_{t-2}+e_{1t}+1.3e_{1,t-1}+0.3e_{1,t-2}
\\
&=0.3(X_{t-1}+X_{t-2} )+e_{1t}+1.3e_{1,t-1}+0.3e_{1,t-2}
\\
&=0.3z_{t-1}+e_{1t}+1.3e_{1,t-1}+0.3e_{1,t-2}
\end{align*}
From here I can find the AR and MA polynomials. However, I am unsure if this method will provide correct results given the unchanged error terms..
My two questions

*

*Is the working out I have done for the stationarity conditions methods correct? Because, it implies that any model with any ar lags will be non-stationary.

*Can I simply use the unit root method after writing the equation in terms of $z_t$ to find stationarity/invertability?

A: 1.
Your work is correct but intermediate. You do not know anything about the expectation of $z_{t-1}$ (yet). However, if you reiterate a couple of times, you may realize that $z_t$ can be written on the form
$$
z_t = e_t + 2(\phi+1) e_{t-1} + 2(\phi + 1) \sum_{j = 1}^\infty \phi^j e_{t-1-j}
$$
for $\phi = 0.3 (<1)$. To show that the process is a mean-zero process, it suffices to show that
$$
2(\phi + 1) E\left[
 \sum_{j = 1}^\infty \phi^j e_{t-1-j}
\right] = 0.
$$
By a dominated convergence argument, using that $\phi<1$, we may interchange sum and expectation, giving the result.
To show that the autocorrelation function is independent of time, follow similar arguments.
2.
The problem with using the unit root method in this case is that the MA polynomial has a root on the unit disc $S = \{z \in \mathbb C : \lvert z \rvert = 1\}$, so the method is inconclusive.


text:
Q: How are nullable fields handled in pyodbc parameter markers? I am using pyodbc to access a MSSQL database
I have a table with nullable fields. I want to pass variables into an insert statement with parameter markers.
I have tried values of None and NULL
foo= "NULL"    #this field is sometimes nullable
baz =152

sql_query = "insert into my_table(field1, field2)(?,?)"
cursor.execute(baz, foo)
cnxn.commit()

foo= None
sql_query = "insert into my_table(field1, field2)(?,?)"
cursor.execute(sql_query , baz, foo)
cnxn.commit()

I'm getting this data error:

('22018', '[22018] [Microsoft][ODBC SQL Server Driver]Invalid
  character value for cast specification (0) (SQLExecDirectW)')

Is there another way I can represent a null value that can be passed in to pyodbc?


text:
Q: Can we infer convergence in total variation distance from a Poincaré inequality? Let $(E,\mathcal E,\mu)$ be a probability space, $\lambda>0$ and $\kappa_t$ be a Markov kernel on $(E,\mathcal E)$ with$^1$ $$\operatorname{Var}_\mu\left[\kappa_tf\right]\le\operatorname{Var}_\mu\left[f\right]e^{-2\lambda t}\;\;\;\text{for all }f\in L^2(\mu)\tag1$$ for $t\ge0$.

Assume $\mu$ is invariant with respect to $\kappa_t$, i.e.$^2$ $\mu\kappa_t=\mu$, for all $t\ge0$. We are able to conclude $$\left\|(\kappa_t-\mu)f\right\|_{L^2(\mu)}\xrightarrow{t\to\infty}0\tag2$$ from $(1)$. Are we able to infer any other mode of convergence of $\kappa_t$ to $\mu$ as $t\to\infty$?

For example, I would like to show convergence in total variation distance, i.e. if $\nu$ is a probability measure on $(E,\mathcal E)$, then $$|\nu\kappa_t-\mu|\xrightarrow{t\to\infty}0\tag3$$ (where $|\operatorname P|$ denotes the total variation distance of a probability measure $\operatorname P$ on $(E,\mathcal E)$). I'm willing to assume that $\mu$ is reversible with respect to $\kappa_t$, i.e. $$\int_A\mu({\rm d}x)\kappa_t(x,B)=\int_B\mu({\rm d}x)\kappa_t(x,A)\;\;\;\text{for all }A,B\in\mathcal E\tag4,$$ for all $t\ge0$. Moreover, if necessary, assume that $\mu$ and $\nu$ admit a density with respect to a common reference measure $\lambda$ on $(E,\mathcal E)$.

$^1$ As usual, $\kappa_tf:=\int\kappa_t(\;\cdot\;,{\rm d}y)f(y)$ and, analogously, $\mu f:=\int f\:{\rm d}\mu$.
$^2$ $\mu\kappa_t$ denotes the composition of $\mu$ and $\kappa_t$.


text:
Q: SQL Server Conditional Foreign Key I have two tables in my SQL Server database, Foo and Bar. Table Foo is like so:
+-------+
|  Foo  |
+-------+
| Id    |
| Type  |
| Value |
+-------+

The table has values like:
+----+--------+-----------+
| Id |  Type  |   Value   |
+----+--------+-----------+
|  1 | Status | New       |
|  2 | Status | Old       |
|  3 | Type   | Car       |
|  4 | State  | Inventory |
|  5 | State  | Sold      |
+----+--------+-----------+

The table Bar is like so:
+----------+
|   Bar    |
+----------+
| Id       |
| TypeId   |
| StatusId |
| StateId  |
+----------+

Where TypeId, StatusId and StateId are all foreign key'ed to the Foo table.
But I want to put a condition on each foreign key where they can only key to the Foo
ids related to it's type. For example, the TypeId column can ONLY foreign key to id
3 on the Foo table. Or the StatusId column can ONLY foreign key to ids 1 or 2.
I know there is a check function in SQL Server but I'm unsure on how to use it correctly. I
tried to do something like this:
CREATE TABLE TEST.dbo.Bar
(
    Id int PRIMARY KEY NOT NULL IDENTITY,
    TypeId int NOT NULL CHECK (Type='Type'),
    CONSTRAINT FK_Bar_Foo_Type FOREIGN KEY (TypeId) REFERENCES Foo (Id, Type)
)
CREATE UNIQUE INDEX Bar_Id_uindex ON TEST.dbo.Bar (Id)

But this didn't work. What am I doing wrong?

A: The check constraints you are referring to are only used to limit the type of information stored in a key or non key column. So, if you don't want a key column to have a negative value (lets say its a price column, and there is never a negative price) you will use Check constraint.
To better understand the concept of primary and foreign keys:
Primary key uniquely identifies each record in a table.
Foreign key is a value in some table which is a unique identifier (and can also be a primary key) in another table. This means that Foreign key can repeat many times in the table in which it is a foreign key in, and it will definitely be unique in the table that it is created from ( in the table that gives meaning to it).
Now coming to your question, you probably need to use the concept of composite keys. A composite key is basically a group of two or more values that uniquely identify a record, because you cannot enforce limitations on foreign keys in the way you are intending to do, because that defeats the very purpose of a key.  Handle some issues with type of data stored in your keys at the application layer instead of database layer.
Looking at the problem in this manner will conceptually resolve some design flaws with your tables as as well.


text:
Q: Dexie DB: How to save an array to a database? The database has the toArray method, how to save the array to the database (toDB)?

A: Use Table.bulkAdd() or Table.bulkPut(). For example:
var db = new Dexie("testdb");
db.version(1).stores({friends: 'id,name,age'});
db.friends.bulkPut([
    {id: 1, name: "Foo", age: 33},
    {id: 2, name: "Bar", age: 34}
]).then(result => {
    alert ("Successfully stored the array");
}).catch(error => {
    alert ("Error: " + error);
});


text:
Q: Dynamic "next" and "previous" step with jquery in a multistep form I'm using this code down below to go to the next or previous section of my form (only one step is visible, others are hide):
$(".next").click(function(){
   if (form.valid() === true){
        if ($('#one').is(":visible")){
            current_fs = $('#one');
            next_fs = $('#two');
        }else if($('#two').is(":visible")){
            current_fs = $('#two');
            next_fs = $('#three');
        }

   next_fs.show();
   current_fs.hide();
   }
 });

 $('#previous').click(function(){
    if($('#two').is(":visible")){
        current_fs = $('#two');
        next_fs = $('#one');
    }else if ($('#three').is(":visible")){
        current_fs = $('#three');
        next_fs = $('#two');
    }
    next_fs.show();
    current_fs.hide();
 });

This code working well if i have a 3-step form, but i want to modify my code using an array to go to next or previous step.
I've tried to use an array like this var pages = ["#one","#two","#three"] and use, for example if ($(pages[0]).is(":visible")) instead of if ($('#one').is(":visible"))
How can i modify this code to make it scalable (for example, if i want to add more pages)
thank you

A: You don't need any arrays to store your steps. It's better to base on your HTML and CSS. Look at my solution: JSFiddle
So when you add new steps you don't need to modify your JavaScript at all. Just add new step to your HTML:

    1

    2

    3

    4

<button id="prev" disabled="disabled">Prev</button>
<button id="next">Next</button>

Use CSS to hide all steps except active:
.step {
  display: none;
}

.step.active {
  display: block;
}

JavaScript in my case:
var index = $(".step.active").index(".step"),
    stepsCount = $(".step").length,
    prevBtn = $("#prev"),
    nextBtn = $("#next");

prevBtn.click(function() {
    nextBtn.prop("disabled", false);

    if (index > 0) {
        index--;
        $(".step").removeClass("active").eq(index).addClass("active");
    };

    if (index === 0) {
        $(this).prop("disabled", true);
    }
});

nextBtn.click(function() {
    prevBtn.prop("disabled", false);

    if (index < stepsCount - 1) {
        index++;
        $(".step").removeClass("active").eq(index).addClass("active");
    };

    if (index === stepsCount - 1) {
        $(this).prop("disabled", true);
    }
});

A: This should work, I'd add some error handling in case the next or previous indexes don't exist in your pages array.
$('#next').click(function(){
    if(form.valid() === true){
        var current_page = $(pages.join(",")).find(':visible');
        var current_index = pages.indexOf('#'+current_page.attr('id');
        current_page.hide();
        $(pages[current_index+1]).show();
    }
});
$('#previous').click(function(){
    var current_page = $(pages.join(",")).find(':visible');
    var current_index = pages.indexOf('#'+current_page.attr('id');
    current_page.hide();
    $(pages[current_index-1]).show();
});

A: I have updated my code please check it. It is working. I have done some changes to jquery code. Please use it.

   var form = $("#form");
         var pages = ["#one","#two","#three","#four","#five"];
         $(".next").click(function(){
            if (form.valid() === true){
             var temp = 0;
             var nextElementFound = false;
             pages.forEach(function(element) {
            temp++;
                     if ($(element).is(":visible")){
                   current_fs =$(element);
             if(pages.length > temp){
             next_fs =$(pages[temp]);
             nextElementFound = true;
             }
            }
                 });
           if(nextElementFound){
                 next_fs.show();
                 current_fs.hide();
           }
            }
          });

          $('#previous').click(function(){
             var temp = 0;
          var previousElementFound = false;
          pages.forEach(function(element) {
             if ($(element).is(":visible")){
                   current_fs =$(element);
             if(temp != 0){
             previousElementFound= true;
             next_fs =$(pages[temp-1]);
             }
            }
             temp++;
             });
          if(previousElementFound){
             next_fs.show();
             current_fs.hide();
          }
          });
 #previous {
      border: 1px solid;
      float: left;
      margin-right: 10px;
      margin-top: 10px;
      padding: 10px;
      }
      .next {
      border: 1px solid;
      float: left;
      margin-left: 10px;
      margin-top: 10px;
      min-width: 50px;
      padding: 10px;
      text-align: center;
      }
      .customElement {
      background-color: gray;
      border: 1px solid;
      color: white;
      font-size: 35px;
      min-height: 30px;
      padding: 10px;
      text-align: center;
      width: 148px;
      }

         <form id="form">

               one

               two

               three

               four

               five

         </form>

            Previous

            Next

A: *

*Instead of checking if ('#x') is visible I would keep a variable with the active page.

*I would name the different form parts with a number convention such as '#form-part-1' instead of '#one'.
and last I would do
$(".next").click(function(){
   $("#form-part-"+activeIndex).hide();
   activeIndex++;
   $("#form-part-"+activeIndex).show();
});

$(".prev").click(function(){
   $("#form-part-"+activeIndex).hide();
   activeIndex--;
   $("#form-part-"+activeIndex).show();
});


text:
Q: list all files with extension .log except one I would like to list all files with extension .log except the file backup.log.
I have tried using this command:
ls *.log -I "backup.log"

But all the log files are listed, even backup.log!
How could I list all the log files except backup.log?

A: One possibility would be:
 find . -maxdepth 1 -mindepth 1 -name \*.log -a -not -name backup.log

i.e. find all files in the current directory or below, with an exact depth of 1 (so really only in the current directory and not the name of the current directory itself) with name matching the pattern *.log and not backup.log

A: The shell expands the wildcard, so ls gets backup.log as one of the parameters.
Use an extended pattern (enabled by shopt -s extglob):
ls !(backup).log

A: TXR:
$ ls *.patch
install-tests.patch  match.patch  netbsd.patch  specials.patch  wlist.patch
$ txr -t '(glob "*.patch")'
install-tests.patch
match.patch
netbsd.patch
specials.patch
wlist.patch
$ txr -t '(set-diff (glob "*.patch") (glob "[mn]*.patch"))'
install-tests.patch
specials.patch
wlist.patch

A: you can skip Backup keyword from  shell expansion by using !(keyword)
ubuntu@vm-ubuntu:~$ ls *.log

1.log  2.log  backup.log

ubuntu@vm-ubuntu:~$ ls  !(backup).log

1.log  2.log

A: What about parsing the output of ls through grep:
ls -l *.log | grep -v backup.log


text:
Q: Class or function components in react-native to inject store? I'm new to react-native and trying to set up my app with mobx for state management, when trying to inject rootStore into my HomeScreen component I get the following error:
Error: C:\xampp\htdocs\second-try\screens\HomeScreen.js: Leading decorators must be attached to a class declaration

This is my component, as you see I'm suing function based component and I get a warning, but how can I use components ass Class and inject mobx stre into my react-native component.
My HomeScreen file:
import * as React from 'react';
import { StatusBar } from 'expo-status-bar';
import { View, Text, StyleSheet } from 'react-native';

@inject(stores => ({
  postStore: rootStore.postStore,
  //authStore: rootStore.authStore,
  })
)

//ERROR IS RIGHT
@observer
const HomeScreen = function()
{
  return (
    <View style={styles.container}>
      <Text>{postStore.postMessage}</Text>
      <StatusBar style="auto" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

export default HomeScreen;


text:
Q: excel vba codes user form I have created a user form for my work book. I would like the user to navigate their way around the workbook using the button on this user form. Is there any code that I can use to limit the user by only allow them to click on buttons on the user form?.

A: *

*Lock the cells to prevent Selection or Modify

*Protect the worksheet

*Have the UserForm code:

a. unprotect the worksheet
b. unlock the cell
c. update the cell
d. relock the cell
e. reprotect the worksheet.

A: Here is how you will write your code to make it so your userform appears as soon as the workbook is open and then closes the entire form once it is closed, which will basically keep the user to only using the userform.
Keep in mind you can't edit VBA while a userform is open so be careful not to trap yourself out of editing code. Maybe you can have a separate button or something for this reason.
1) Create your form. Press Alt F11 to view VBA.  Click Insert > Userform as I am sure you have figured out already.  Do whatever you want with the form for the rest of your functionality.
2) Double click on the form in VBA view to view the code for it.  Here we will insert our close statement which will close the workbook upon close of the form:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

ThisWorkbook.Close SaveChanges:=False

End Sub

3) Now we need to make it so the userform appears immediately upon opening the workbook. Double click on "ThisWorkbook" in your tree view for VBA. Paste this code:
Private Sub Workbook_Open()
UserForm1.Show
End Sub

Hope this helps you along your way.


text:
Q: Xorg labeling devices as keyboards I have an inputclass section in /etc/X11/xorg.conf.d/10-keyboard.conf as follows:
Section "InputClass"
        Identifier "kinesis keyboard"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        MatchUSBID "29ea:0102"
        Driver "libinput"
        Option "Xkbmodel" "kinesis"
        Option "Xkblayout" "us"
        Option "XkbOptions" "caps:ctrl_modifier,terminate:ctrl_alt_backspace,compose:sclk"
EndSection

However, this section seems to be getting overridden in my log file since udev appears to detect "Intel HID events" as a keyboard as well, and applies the libinput catchall section to it, set in /usr/share/X11/xorg.conf/40-libinput.conf as follows:
Section "InputClass"
        Identifier "libinput keyboard catchall"
        MatchIsKeyboard "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
EndSection

My logfile looks like this:
[    29.049] (**) Intel HID events: Applying InputClass "libinput keyboard catchall"
[    29.049] (II) Using input driver 'libinput' for 'Intel HID events'
[    29.049] (**) Intel HID events: always reports core events
[    29.049] (**) Option "Device" "/dev/input/event8"
[    29.049] (**) Option "_source" "server/udev"
[    29.049] (II) event8  - Intel HID events: is tagged by udev as: Keyboard
[    29.049] (II) event8  - Intel HID events: device is a keyboard
[    29.049] (II) event8  - Intel HID events: device removed
[    29.066] (**) Option "config_info" "udev:/sys/devices/platform/INTC1070:00/input/input8/event8"
[    29.066] (II) XINPUT: Adding extended input device "Intel HID events" (type: KEYBOARD, id 13)
[    29.066] (**) Option "xkb_model" "pc105"
[    29.066] (**) Option "xkb_layout" "us"
[    29.066] (**) Option "xkb_options" "ctrl:nocaps"
[    29.077] (II) event8  - Intel HID events: is tagged by udev as: Keyboard
[    29.077] (II) event8  - Intel HID events: device is a keyboard

Is there anyway to avoid this behavior? Is there some quirk in udev that is making it label these devices as keyboards? Where is the code that says that these devices should be labeled as keyboards, and all keyboards should be given the xkb_model "pc105" and options "ctrl:nocaps".


text:
Q: Create a file in terminal using swift script I'm now playing with swift scripts and have bumped into something I cannot seem to find an answer to. Cutting to the chase, I'm trying to run an image comparison script that compares two images and outputs a file showing the differences. However, the problem is, I cannot seem to be able to force Xcode to create any sort of files, even a simple text ones as it prompts me an error:
touch: /Users/CurrentUser/Desktop/TestExport/somethingelse.txt: Operation not permitted
I've tried giving this folder a full permission access using "chmod 777" terminal line, sadly, with no avail.
The initial code I'm trying to execute is this:
@discardableResult
func shell(_ args: String...) -> Int32 {
    let task = Process()
    task.launchPath = "/usr/bin/env"
    task.arguments = args
    task.launch()
    task.waitUntilExit()
    return task.terminationStatus
}

shell("touch", "/Users/CurrentUser/Desktop/TestExport/somethingelse.txt")

Do you have any ideas what can be done towards solving this? Thanks in advance!


text:
Q: Laravel composer install error Hi I create server on Centos 7. i am used php 7 and Httpd server. But when i running composer install am i getting this error. any idea?
To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php.ini
    - /etc/php.d/20-bz2.ini
    - /etc/php.d/20-calendar.ini
    - /etc/php.d/20-ctype.ini
    - /etc/php.d/20-curl.ini
    - /etc/php.d/20-dom.ini
    - /etc/php.d/20-exif.ini
    - /etc/php.d/20-fileinfo.ini
    - /etc/php.d/20-ftp.ini
    - /etc/php.d/20-gettext.ini
    - /etc/php.d/20-iconv.ini
    - /etc/php.d/20-json.ini
    - /etc/php.d/20-mysqlnd.ini
    - /etc/php.d/20-pdo.ini
    - /etc/php.d/20-phar.ini
    - /etc/php.d/20-simplexml.ini
    - /etc/php.d/20-sockets.ini
    - /etc/php.d/20-sqlite3.ini
    - /etc/php.d/20-tokenizer.ini
    - /etc/php.d/20-xml.ini
    - /etc/php.d/20-xmlwriter.ini
    - /etc/php.d/20-xsl.ini
    - /etc/php.d/20-zip.ini
    - /etc/php.d/30-mysqli.ini
    - /etc/php.d/30-pdo_mysql.ini
    - /etc/php.d/30-pdo_sqlite.ini
    - /etc/php.d/30-wddx.ini
    - /etc/php.d/30-xmlreader.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

A: Try to install all laravel php requirements first.
You have to install this requirements exactly to php7.
https://laravel.com/docs/5.4/installation


text:
Q: Peg Solitaire / Senku solution algorithm I need to program a solver for the game of Peg solitaire / Senku
There's already a question here but the proposed answer is a brute force algorithm with backtracking, which is not the solution I'm looking for.
I need to find some heuristic to apply an A* algorithm. The remaining pegs is not a good heuristic as every move discards one peg so the cost is always uniform.
Any ideas?

A: I was reading a paper talking about this problem link,
and they propose 3 heuristics:
1 - The number of nodes are available for the next step, considering which more available next's steps, better the node.
2 - Number of isolated peg's - as few isolated peg's better the node.
3 - Less peg's in the board better the node.
This may be not the better heuristics for this problem, but seems to be a simple approach.

A: You can do as rossum suggested. Another option would be to use the sum of distances (or some other function of the distances) from the center. Or you could combine the two.


text:
Q: Fetch Images from assets folder and fill gridview in android I am developing one small application and i have little knowledge in android. so i need your help. Actually i put some bulk of images in assets sub folder. now what i want is, i want to read that all images which i had put into the assets sub folder for example "images" folder and then i want to fill all images in grid view. please friends please help me to fill images in grid view.
I had tried following link but i did not get satisfaction from this site
Loading Images from assets to GridView with smooth Scrolling.

A: I actually found this answer on https://xjaphx.wordpress.com/2011/10/02/store-and-use-files-in-assets/
public void loadFromAsset() {
    InputStream is = getAssets().open("filename.extension");

    //Load image as drawable
    Drawable draw = Drawable.createFromStream(is, null);

    //Once you get the drawable, set the image to imageView
    imageView.setImageDrawable(draw);
}

A: Then paste Below code in the CustomAdapter GridViewAdapter
public class  GridViewAdapter extends BaseAdapter {
    Context context;
    int layoutResourceId;
    private ArrayList<String> griRowItems;
    LayoutInflater vi;
    ImageLoader imageLoader;
    String[] imageUrls;
    ArrayList<String> imagePath;
    DisplayImageOptions options;
    ViewHolder holder = null;

    public GridViewAdapter(Context context,
            int layoutResourceId, ArrayList<String> mApps) {
        this.context = context;
        this.griRowItems = mApps;
        this.layoutResourceId = layoutResourceId;

        imageLoader = ImageLoader.getInstance();
        this.imageLoader.init(ImageLoaderConfiguration.createDefault(context));

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        vi = (LayoutInflater) context
                .getSystemService(Service.LAYOUT_INFLATER_SERVICE);
        if (convertView == null) {
            convertView = vi.inflate(R.layout.grid_double, parent,
                    false);
            holder = new ViewHolder();
        }

        holder.imageView = (ImageView) convertView.findViewById(R.id.thumbImage);
        // holder.progressBar = (ProgressBar) convertView
        // .findViewById(R.id.progress);

        String tempStr = "assets://" +  griRowItems.get(position);
        lazyLoading(imageLoader, tempStr, holder.imageView,
                options);
        return convertView;
    }

    @Override
    public int getCount() {
        return griRowItems.size();
    }

    @Override
    public Object getItem(int position) {
        return griRowItems.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    public static void lazyLoading(ImageLoader imageLoader, String tempStr, ImageView imageView,DisplayImageOptions options) {
        imageLoader.displayImage(tempStr, imageView, options,
                new SimpleImageLoadingListener() {
                    @Override
                    public void onLoadingStarted(String imageUri, View view) {
                    }

                    @Override
                    public void onLoadingFailed(String imageUri, View view,FailReason failReason) {
                    }

                    @Override
                    public void onLoadingComplete(String imageUri, View view,Bitmap loadedImage) {
                    }
                }, new ImageLoadingProgressListener() {
                    @Override
                    public void onProgressUpdate(String imageUri, View view,int current, int total) {
                    }
                });
    }

    static class ViewHolder {
        ImageView imageView;
        // ProgressBar progressBar;
        //TextView tvTitle;
        // DisplayImageOptions options;
    }

A: public class Flower_Mahendi extends Activity {
ArrayList<String> listPath;
GridViewAdapter adp;// = new GridViewAdapter(null, 0, listPath);
GridView gridView;
//Bitmap listBitmap;
@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.flower_mahendi);
    AssetManager assetManager = getResources().getAssets();
    gridView  = (GridView) findViewById(R.id.gridView1);
    try {

        String[] files = assetManager.list("kids");
        listPath = new ArrayList<String>();
        for (String strImageName : files) {
            String pathAssets = "kids" + File.separator
                    + strImageName;
            listPath.add(pathAssets);

        }
    } catch (Exception e) {
        // TODO: handle exception
    }

    try {
        if (listPath!= null) {
        adp = new GridViewAdapter(this,R.layout.grid_double, listPath);
        gridView.setAdapter(adp);
       }
    } catch (Exception e) {
                e.printStackTrace();
    }
}


text:
Q: How can I control file compression parameters in Java to decompress objects faster? I am writing to a file some large Java object I created, and later reading it back. I am using compression since the object is pretty large and I have around 600 different instances of it (each one in a separate file). I am currently using bzip2 with Apache's org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream:
import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream;
import org.apache.commons.lang3.SerializationUtils;

InputStream in = new BZip2CompressorInputStream(new FileInputStream("myfile.bz2"));
Document doc = (Document) SerializationUtils.deserialize(in);

The problem is that currently decompression takes a long time (over 10 seconds), so reading all 600 objects takes around two hours. I would like to either use a faster compression class, or control the current class's parameters so that decompression would be faster (I am most worried about decompression time as it occurs many times, slow compression is bearable). I am also willing to pay the price of a larger compressed file, for decompression speed.
When compressing using different software you can usually choose "compression level", with values like "Fastest", "Fast", "Normal", "Best". Sometimes you even get more parameters like "Compression Method", "Dictionary Size", "Word Size", etc.
Does anybody know how to control these parameters via code, and what are some recommended values? Or just knows of fast-decompression classes?

A: BZip2 gets very good compression ratios, but at the expense of being quite slow. At the other end of the spectrum is something like snappy, which is incredibly fast, but does not get as good of compression ratios. GZip is in the middle.
Here is a list of some compression benchmarks in java.


text:
Q: Passing ref down to child in React + Typescript I have an app, where I need to manage focus on the inputs and for that purpose I use React ref.
I have two inputs that I want to move into a separate component. Now they look like following:
<input
  onChange={this.handleChangeOne}
  ref={refOne => (this.refOne = refOne as HTMLInputElement)}
  type="text"
/>
<input
  onChange={this.handleChangeTwo}
  ref={refTwo => (this.refTwo = refTwo as HTMLInputElement)}
  type="text"
/>

I am having trouble to make the them work in a separate component while it involves passing down ref prop. I've tried something like this:
<InputBlock

          handleChangeOne={() => this.handleChangeOne}
          handleChangeTwo={() => this.handleChangeTwo}
          refOne=(refOne => (this.refOne = refOne as HTMLInputElement)}
          refTwo={refTwo => (this.refTwo = refTwo as HTMLInputElement)}
        />

And the components itself
class InputBlock extends React.Component<IProps> {
  public render() {
    return (
      <React.Fragment>
        <input
          ref={refOne}
          onChange={handleChangeOne}
          type="text"
        />
        <input
          ref={refTwo}
          onChange={handleChangeTwo}
          type="text"
        />
      </React.Fragment>
    );
  }
}

export default InputBlock;

For the sake of example I want handleChangeOne to focus on input two, and handleChangeTwo to focus on input one

A: I don't know what went wrong for you, but the following is working for me:
import * as React from "react";
import * as ReactDOM from "react-dom";

class OuterComponent extends React.Component<{}, {}> {
  refOne: null | HTMLInputElement = null;
  refTwo: null | HTMLInputElement = null;
  render() {
    return <InputBlock
      handleChangeOne={this.handleChangeOne}
      handleChangeTwo={this.handleChangeTwo}
      refOne={refOne => (this.refOne = refOne)}
      refTwo={refTwo => (this.refTwo = refTwo)}
    />;
  }

  handleChangeOne = () => {
    console.log("handleChangeOne", this.refOne, this.refTwo);
  }
  handleChangeTwo = () => {
    console.log("handleChangeTwo", this.refOne, this.refTwo);
  }
}

interface IProps {
  refOne: React.Ref<HTMLInputElement>;
  refTwo: React.Ref<HTMLInputElement>;
  handleChangeOne: React.ChangeEventHandler<HTMLInputElement>;
  handleChangeTwo: React.ChangeEventHandler<HTMLInputElement>;
}
class InputBlock extends React.Component<IProps> {
  public render() {
    return (
      <React.Fragment>
        <input
          ref={this.props.refOne}
          onChange={this.props.handleChangeOne}
          type="text"
        />
        <input
          ref={this.props.refTwo}
          onChange={this.props.handleChangeTwo}
          type="text"
        />
      </React.Fragment>
    );
  }
}

ReactDOM.render(<OuterComponent/>, document.getElementById("root"));


text:
Q: font size and image size not respected when converting to pdf using itextsharp I've got some code that will convert HTML into PDF using iTextSharp, however, when I view the PDF, the font sizes and the size of images are different to what has been specified in the HTML.
My code is as below - any help would be appreciated:
Public Function RenderPdf() As MemoryStream

    Dim file As New MemoryStream()
    Dim document As New iTextSharp.text.Document(Me.PageSize)
    Dim writer As PdfWriter = PdfWriter.GetInstance(document, file)
    document.Open()

    Dim tagProcessors As DefaultTagProcessorFactory = Tags.GetHtmlTagProcessorFactory()
    tagProcessors.RemoveProcessor(HTML.Tag.IMG) 'remove the default processor
    tagProcessors.AddProcessor(HTML.Tag.IMG, New CustomImageTagProcessor()) 'use our new processor

    Using document
        'render each page that has been added
        For Each page As HtmlPdfPage In Me._Pages
            document.NewPage()

            'generate this page of text
            Dim output As New MemoryStream()
            Dim html As New StreamWriter(output, Encoding.UTF8)

            Dim sr As New StringReader(page._Html.ToString())

            Dim cssFiles As New CssFilesImpl()
            cssFiles.Add(XMLWorkerHelper.GetInstance().GetDefaultCSS())
            Dim cssResolver As New StyleAttrCSSResolver(cssFiles)
            Dim charset = Encoding.UTF8

            Dim hpc As New HtmlPipelineContext(New CssAppliersImpl(New XMLWorkerFontProvider()))
            hpc.SetAcceptUnknown(True).AutoBookmark(True).SetTagFactory(tagProcessors) 'inject the tagProcessors
            Dim htmlPipeline As New pipeline.html.HtmlPipeline(hpc, New PdfWriterPipeline(document, writer))
            Dim pipeline As New CssResolverPipeline(cssResolver, htmlPipeline)
            Dim worker As New XMLWorker(pipeline, True)
            Dim xmlParser As New iTextSharp.tool.xml.parser.XMLParser(True, worker, charset)
            xmlParser.Parse(sr)

        Next

        'return the rendered PDF
        Return file
    End Using

End Function

Public Class CustomImageTagProcessor
        Inherits iTextSharp.tool.xml.html.Image
        Public Overrides Function [End](ctx As IWorkerContext, tag As Tag, currentContent As IList(Of IElement)) As IList(Of IElement)
            Dim attributes As IDictionary(Of String, String) = tag.Attributes
            Dim src As String
            If Not attributes.TryGetValue(HTML.Attribute.SRC, src) Then
                Return New List(Of IElement)(1)
            End If

            If String.IsNullOrEmpty(src) Then
                Return New List(Of IElement)(1)
            End If

            If src.StartsWith("data:image/", StringComparison.InvariantCultureIgnoreCase) Then
                ' data:[<MIME-type>][;charset=<encoding>][;base64],<data>
                Dim base64Data = src.Substring(src.IndexOf(",") + 1)
                Dim imagedata = Convert.FromBase64String(base64Data)
                Dim image = iTextSharp.text.Image.GetInstance(imagedata)

                Dim list = New List(Of IElement)()
                Dim htmlPipelineContext = GetHtmlPipelineContext(ctx)
                list.Add(GetCssAppliers().Apply(New Chunk(DirectCast(GetCssAppliers().Apply(image, tag, htmlPipelineContext), iTextSharp.text.Image), 0, 0, True), tag, htmlPipelineContext))
                Return list
            Else
                Return MyBase.[End](ctx, tag, currentContent)
            End If
        End Function
    End Class

Example HTML is:

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="http://localhost:60699/Scripts/tinymce/skins/lightgray/content.min.css"
        rel="stylesheet" type="text/css" />

    <link href="http://localhost:59372/Call_Scripter/Scripts/tinymce/skins/lightgray/content.min.css"
        rel="stylesheet" type="text/css" data-mce-href="http://localhost:59372/Call_Scripter/Scripts/tinymce/skins/lightgray/content.min.css" />

                    Company Name

                        ABN: 65 999 999 999

                        PO Box 999

                        Suburb, State, Postcode Australia

                        Phone: 02 9999 9999 Fax: 02 9999 9999

                        Email: anemailaddress@blahblah.com.au

                        Web: www.blahblah.com.au

                     Tax Invoice

                                    Invoice Number:

                                    Sales Order:

                                    Invoice Date:

                                    ABN:

                                    65 090 839 197

                                    Your Reference:

                                    Page 1 of 1

                    Australia

                                    Product

                                    Item Description

                                    Qty

                                    Unit Price (Ex GST)

                                    Unit

                                    Discount

                                    Net Amount

                                    GST

                                    Total

                                    1

                                    Total Page 1

                                    Grand Total AUD

                                    Balance Owing

                                    $0.00

                                    PAID IN FULL

A: I ended up ditching iTextSharp for HTML to PDF conversion, and instead, I went with this solution https://github.com/gmanny/Pechkin - it means I can generate my PDF with 1 line of code and the PDF comes out perfectly !


text:
Q: How to update a row with a substring of a string in that particular row? I need an SQLite statement for this example:
There is a path with filename like:
/home/user/files/filename.ext

Now I need to update all rows to this:
/home/user/files/filename/filename.ext

The filename without extension needs to be inserted between files/ and filename.ext

A: For MySQL:
update filelist set filepath= CONCAT(substr(filepath,1,17),right(left(filepath,length(filepath)-4),length(filepath)-21),'/',right(left(filepath,length(filepath)-4),length(filepath)-21),substr(filepath,-4))

For SQLite:
update filelist
set filepath= substr(filepath,1,17)||substr(filepath,length(filepath)-3,21-length(filepath))||'/'||substr(filepath,length(filepath)-3,21-length(filepath))||substr(filepath,-4)

Hope this work for you.
Use stuff function if you use MS SQL to insert text into text:
update filelist
set filepath=stuff(filepath,17,1,'gggg')
;

A: You can use the in-build REPLACE() function to get the desired result.

The replace(X,Y,Z) function returns a string formed by substituting
  string Z for every occurrence of string Y in string X. The BINARY
  collating sequence is used for comparisons. If Y is an empty string
  then return X unchanged. If Z is not initially a string, it is cast to
  a UTF-8 string prior to processing.

UPDATE table_name
SET pathColumn = replace(pathColumn, '/home/user/files/', '/home/user/files/filename/')
-- Where column = some condition ---- THIS IS OPTIONAL, if you dont want to modify all rows

you can add the WHERE clause, if sub set of tables rows needs to be modified


text:
Q: Dynamically Rendering MapView Marker React Native This is  how my Map View Looks like :
<MapView
                style={styles.mapStyle}
                initialRegion={{
                latitude: 51.524300,
                longitude: -0.037790,
                latitudeDelta: 0.0122,
                longitudeDelta: 0.0421,

            }}
            >
            <Marker
                coordinate={{
                    latitude:51.524464,
                    longitude:-0.036285,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 1"}
                description={customData.text1}
            />
            <Marker
                coordinate={{
                    latitude:51.524310,
                    longitude:-0.037798,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 2"}
                description={customData.text2}
            />
            <Marker
                coordinate={{
                    latitude:51.523174,
                    longitude:-0.039332,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 3"}
                description={customData.text3}
            />

            </MapView>

As you can see I have hard-coded 3 markers just to make sure that the MapViews works properly. Now, I use an external API which tells the parking spaces based on the user's input. So for example if the user enter's a certain postcode/ ZIP code, the api returns an array where I have various information about the parking space such as longitude and latitude. I want to represent these parking spaces with markers on the map. I use a FlatList for that:
<FlatList
                data = {parkingSpaces}
                renderItem={({ item }) => {
                    return <MapView.Marker
                    coordinate={{
                    latitude: parseInt(item.latitude),
                    longitude:parseInt(item.longitude)
                    }}

                    title = {"parking markers"}

                    />

                }}
                keyExtractor={item => item.unique_identifier}

            />

I don't get any errors, however I can't see the markers on the map. Below is my full code
import React ,{Component,useState,useEffect} from 'react'
import {View,Text,StyleSheet,Dimensions,Button,Alert,FlatList} from 'react-native'
import MapView , {Marker}from 'react-native-maps'
import axios from 'axios'
import { TextInput } from 'react-native-gesture-handler'
import camdenParking from '../api/camdenParking'
import SearchBar from '../components/SearchBar'

/// Key Secret : 5ulg30lagu2o493uwsmn24rxklsg0ivb05k2zl6xqhiz8js9e7
/// App Secret Token : NTEX14nQLbrS8MIz4RmC6riUV6K2aQ_j687H

const HomeScreen = ()=>

{

    const [parkingSpaces,setparkingSpaces] = useState([])
    const[term,setTerm] = useState('')
    let userLatitude = 0
    let userLongitude = 0

    const customData = require("./MarkersText.json")

      const searchApi = async() => {

        const response = await camdenParking.get("",{

            params:{
                //longitude:-0.115444,
                //latitude:51.517597
                postcode: term

            }

        }) // you can change this later on
        console.log(response.data)
        setparkingSpaces(response.data)
        console.log(term)
      }

      const findCoordinates = () => {
        navigator.geolocation.getCurrentPosition(
          position => {
            const locationString = JSON.stringify(position); // Here we get the JSON object but it needs to be parsed
            var longLat = JSON.parse(locationString); // Here we parse the JSON object

             userLatitude=longLat.coords.latitude
             userLongitude=longLat.coords.longitude

             console.log(userLatitude) // This prints the current latitude from the user
             console.log(userLongitude) // This prints the longitude

          },
          error => Alert.alert(error.message),
          { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }
        );
      };

     //useEffect(()=>{
       // searchApi()
     //},[])

    return(

        <View style={styles.container}>
            <SearchBar
                term={term}
                onTermChange={newTerm=>setTerm(newTerm)}
                onTermSubmit={()=> searchApi(term)}
                />
            <MapView
                style={styles.mapStyle}
                initialRegion={{
                latitude: 51.524300,
                longitude: -0.037790,
                latitudeDelta: 0.0122,
                longitudeDelta: 0.0421,

            }}
            >
            <Marker
                coordinate={{
                    latitude:51.524464,
                    longitude:-0.036285,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 1"}
                description={customData.text1}
            />
            <Marker
                coordinate={{
                    latitude:51.524310,
                    longitude:-0.037798,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 2"}
                description={customData.text2}
            />
            <Marker
                coordinate={{
                    latitude:51.523174,
                    longitude:-0.039332,
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                }}
                title={"Marker 3"}
                description={customData.text3}
            />

            </MapView>
            <Text>We have found {parkingSpaces.length} results</Text>
            <Button onPress={searchApi} title=" Click Here To Get Parking Spaces" />
            <Button onPress={findCoordinates} title=" Click Here To Get User's Location" />
            <Text>Parking Spaces found around {term}</Text>

            <FlatList
                data = {parkingSpaces}
                renderItem={({ item }) => {
                    return <MapView.Marker
                    coordinate={{
                    latitude: parseInt(item.latitude),
                    longitude:parseInt(item.longitude)
                    }}

                    title = {"parking markers"}

                    />

                }}
                keyExtractor={item => item.unique_identifier}

            />

            <FlatList
                data = {parkingSpaces}
                renderItem={({ item }) => {
                    return <Text> {item.road_name} | Possible Available Spaces:{item.parking_spaces} </Text>

                }}
            keyExtractor={item => item.unique_identifier}

            />

        </View>
    );
};

const styles = StyleSheet.create(
    {
     container:{
         flex:1,
         backgroundColor: '#fff',
         //alignItems: 'center',
         //justifyContent: 'center',
         //...StyleSheet.absoluteFillObject,
         //marginLeft:0,
         //height:400,
         //width:400,
         //justifyContent:"flex-end",
         //alignItems:"center",
     },

     mapStyle: {
        width: 400,
        height:400,
        //width: Dimensions.get('window').width,
        //height: Dimensions.get('window').height,
      },
    }

)

export default HomeScreen

UPDATE
This is how my code looks like now:
import React ,{Component,useState,useEffect} from 'react'
import {View,Text,StyleSheet,Dimensions,Button,Alert,FlatList} from 'react-native'
import MapView , {Marker}from 'react-native-maps'
import axios from 'axios'
import { TextInput } from 'react-native-gesture-handler'
import camdenParking from '../api/camdenParking'
import SearchBar from '../components/SearchBar'

/// Key Secret : 5ulg30lagu2o493uwsmn24rxklsg0ivb05k2zl6xqhiz8js9e7
/// App Secret Token : NTEX14nQLbrS8MIz4RmC6riUV6K2aQ_j687H

const HomeScreen = ()=>

{

    const [parkingSpaces,setparkingSpaces] = useState([])
    const[term,setTerm] = useState('')
    let userLatitude = 0
    let userLongitude = 0

    const customData = require("./MarkersText.json")

      const searchApi = async() => {

        const response = await camdenParking.get("",{

            params:{
                //longitude:-0.115444,
                //latitude:51.517597
                postcode: term

            }

        }) // you can change this later on
        console.log(response.data)
        setparkingSpaces(response.data)
        console.log(term)
      }

      const findCoordinates = () => {
        navigator.geolocation.getCurrentPosition(
          position => {
            const locationString = JSON.stringify(position); // Here we get the JSON object but it needs to be parsed
            var longLat = JSON.parse(locationString); // Here we parse the JSON object

             userLatitude=longLat.coords.latitude
             userLongitude=longLat.coords.longitude

             console.log(userLatitude) // This prints the current latitude from the user
             console.log(userLongitude) // This prints the longitude

          },
          error => Alert.alert(error.message),
          { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }
        );
      };

     //useEffect(()=>{
       // searchApi()
     //},[])

    return(

        <View style={styles.container}>
            <SearchBar
                term={term}
                onTermChange={newTerm=>setTerm(newTerm)}
                onTermSubmit={()=> searchApi(term)}
                />
            <MapView
                style={styles.mapStyle}
                initialRegion={{
                latitude: 51.524300,
                longitude: -0.037790,
                latitudeDelta: 0.0122,
                longitudeDelta: 0.0421,
                }}
                >
                {parkingSpaces.map((val, index) => {
                return (<MapView.Marker
                        coordinate={{
                        latitude: parseInt(val.latitude),
                        longitude:parseInt(val.longitude)
                        }}
                        key={index}
                        title = {"parking markers"}
                        />);

                })}

            </MapView>

            <Text>We have found {parkingSpaces.length} results</Text>
            <Button onPress={searchApi} title=" Click Here To Get Parking Spaces" />
            <Button onPress={findCoordinates} title=" Click Here To Get User's Location" />
            <Text> WC2A 3PD</Text>
            <Text>Parking Spaces found around {term}</Text>

            <FlatList
                data = {parkingSpaces}
                renderItem={({ item }) => {
                    return <MapView.Marker
                    coordinate={{
                    latitude: parseInt(item.latitude),
                    longitude:parseInt(item.longitude),
                    latitudeDelta:0.0,
                    longitudeDelta:0.0
                    }}

                    title = {"parking markers"}
                    description = {"parking"}

                    />

                }}
                keyExtractor={item => item.unique_identifier}

            />

            <FlatList
                data = {parkingSpaces}
                renderItem={({ item }) => {
                    return <Text> {item.road_name} | Possible Available Spaces:{item.parking_spaces} </Text>

                }}
            keyExtractor={item => item.unique_identifier}

            />

        </View>
    );
};

const styles = StyleSheet.create(
    {
     container:{
         flex:1,
         backgroundColor: '#fff',
         //alignItems: 'center',
         //justifyContent: 'center',
         //...StyleSheet.absoluteFillObject,
         //marginLeft:0,
         //height:400,
         //width:400,
         //justifyContent:"flex-end",
         //alignItems:"center",
     },

     mapStyle: {
        width: 400,
        height:400,
        //width: Dimensions.get('window').width,
        //height: Dimensions.get('window').height,
      },
    }

)

export default HomeScreen

A: The first problem is the use of FlatList as container for your markers. The solution is to map over your parkingSpaces array in between your MapView. The second problem is that you call parseInt on your coordinates, which causes the map to not render your markers at all. In addition you would lose precision.
Code:
<MapView
 style={styles.mapStyle}
 initialRegion={{
 latitude: 51.524300,
 longitude: -0.037790,
 latitudeDelta: 0.0122,
 longitudeDelta: 0.0421,
}}
 >
 {parkingSpaces.map((val, index) => {
  return (<MapView.Marker
          coordinate={{
          latitude: val.latitude,
          longitude: val.longitude
          }}
          key={index}
          title = {"parking markers"}
         />);
 })}

</MapView>

Working Demo:
https://snack.expo.io/@tim1717/mature-croissant


text:
Q: JS - Why must I predefine the key for a hash counter? I've been fiddling with a hash counter in js, and I'm having trouble understanding why predefining the key to be null makes the accumulator work.
var totCounts = {};
Object.keys(repoCollection).forEach((x) => {
    Object.keys(repoCollection[x]).forEach((y) => {
        // If I remove this totCounts becomes a collection of Nans
        // why do I need this
        if(!totCounts[y]){
            console.log('undef');
            totCounts[y] = null;
        }
        totCounts[y] += repoCollection[x][y]
    });
});

repoCollection looks like this, in this case many times abbreviated:
{
  "HSchmale16/AccelLib": {
    "C++": 4915,
    "Arduino": 1580,
    "Makefile": 786
  },
  "HSchmale16/better-nfsn-dotfiles": {
    "Shell": 459,
    "VimL": 241
  },
  "HSchmale16/CustomComputerChair": {
    "C": 62477,
    "C++": 52760,
    "Assembly": 11862,
    "Eagle": 10410,
    "Prolog": 1297,
    "Arduino": 500,
    "Shell": 120
  },
  "HSchmale16/CalculusProject": {
    "C++": 7661,
    "TeX": 5870,
    "Makefile": 828
  },
  "HSchmale16/econsim": {},
  "HSchmale16/BoostVpthread": {
    "C++": 2527,
    "Perl": 2124,
    "Makefile": 770
  },
  "HSchmale16/ConsoleMP": {
    "C": 12525,
    "Shell": 2109,
    "C++": 1854,
    "Makefile": 1359
  },
  "HSchmale16/ElectronChargeSim": {
    "C++": 14588,
    "C": 3188,
    "Makefile": 736
  },
  "HSchmale16/GenericMakefile": {
    "Makefile": 12223,
    "C++": 164,
    "C": 147
  }
}

A: Because a number plus undefined is NaN, but a number plus null is the number. JS coerces null into 0, but undefined into NaN.
See What exactly is Type Coercion in Javascript? for more information.

console.log( undefined + 1 );
console.log( null + 1 );

It'd make more sense to initialize your value to 0 instead of null, but JS treats them the same (in this scenario).


text:
Q: how to apply search filter on foreign key in django?     def get_queryset(self):
        search_query = self.request.GET.get("student", None)
        if search_query != None:

return Student.objects.filter(name__contains=search_query)
return Student.objects.all()

A: You can do something like this:
def get_queryset(self):
    search_query = self.request.GET.get("student", None)
    if search_query:
        return self.queryset.filter(student=search_query)
    return self.queryset


text:
Q: Strange behaviour of ArrayList in jsf i'm developing web app using jsf. I trying display property "brandName" of element with index 0 in ArrayList "materialsSummaryBean.electrolyserMaterialLotList" and this property for all elements using "c:forEach".

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            #{materialsSummaryBean.electrolyserMaterialLotList.get(0).material.material.brandName}

            <c:forEach
                    items="#{materialsSummaryBean.electrolyserMaterialLotList}"
                    var="item" varStatus="loop">
                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                        #{item.material.material.brandName}

                </c:forEach>

In result i have absolutly randomize list of values for element with index 0:
ШБ-5
ЗШБ класс 4
МШ-39
ЗШБ класс 4
МШ-39
КПД-400И
ШБ-5
МШ-39

For all elements in list:
                        ЗШБ класс 4
                        ЗШБ класс 4
                        КПД-400И
                        ЗШБ класс 4
                        ШБ-5
                        МШ-39
                        ЗШБ класс 4

                        ЗШБ класс 4
                        ЗШБ класс 4
                        МШ-39
                        КПД-400И
                        ЗШБ класс 4
                        ШБ-5
                        МШ-39

                        МШ-39
                        КПД-400И
                        ЗШБ класс 4
                        КПД-400И
                        ЗШБ класс 4
                        ШБ-5
                        МШ-39

                        ШБ-5
                        ЗШБ класс 4
                        МШ-39
                        МШ-39
                        ШБ-5
                        КПД-400И
                        МШ-39

And i don't have any idea what is it and what is the problem.
MaterialsSummaryBean method "getElectrolyserMaterialLotList":
public List<MaterialLotSummaryData> getElectrolyserMaterialLotList() {
    MaterialLotFilter materialLotFilter = new MaterialLotFilter();
    materialLotFilter.setElectrolyserId(id);
    return materialService.getMaterialLotByElectrolyserId(materialLotFilter);
}

And "getMaterialLotByElectrolyserId" method:
public List<MaterialLotSummaryData> getMaterialLotByElectrolyserId(MaterialLotFilter materialLotFilter) {
    Long electrolyserId = materialLotFilter.getElectrolyserId();
    if (electrolyserId == null) {
        throw new IllegalArgumentException("Electrolyser id cannot be null.");
    }

    TypedQuery<Unit> queryUnit = em.createQuery(
            "select u from Unit u where u.electrolyser.id = :selectedElectrolyser",
            Unit.class)
            .setParameter("selectedElectrolyser", electrolyserId);

    List<Unit> unitList = queryUnit.getResultList();
    HashSet<MaterialLot> materialLotList = new HashSet<MaterialLot>();

    HashMap<Long, Double> materialLotUsageMap = new HashMap<Long, Double>();

    for (Unit unit : unitList) {
        MaterialLot currentMaterialLot = unit.getMaterialLot();

        if (currentMaterialLot == null) continue;

        materialLotList.add(currentMaterialLot);

        Double usage = unit.getActualMaterial().getAmount();
        if (!materialLotUsageMap.containsKey(currentMaterialLot.getId())) {
            materialLotUsageMap.put(currentMaterialLot.getId(), (usage == null) ? 0 : usage);
        } else {
            if(usage == null) continue;
            Double currentUsage = materialLotUsageMap.get(currentMaterialLot.getId());
            materialLotUsageMap.put(currentMaterialLot.getId(), currentUsage + usage);
        }
    }

    List<MaterialLotData> result = mapper.createList(materialLotList, MaterialLotData.class);

    MaterialLotSummaryData summaryData;
    ArrayList<MaterialLotSummaryData> summaries = new ArrayList<MaterialLotSummaryData>();
    for (MaterialLotData materialLot : result) {
        if (materialLotUsageMap.containsKey(materialLot.getId())) {
            summaryData = new MaterialLotSummaryData();
            summaryData.setId(materialLot.getId());
            summaryData.setAcceptanceDate(materialLot.getAcceptanceDate());
            summaryData.setLotNumber(materialLot.getLotNumber());
            summaryData.setMaterial(materialLot.getActualMaterial());
            summaryData.setNumber(materialLot.getNumber());
            summaryData.setManufacturer(materialLot.getManufacturer());

            Double usage = materialLotUsageMap.get(materialLot.getId());
            summaryData.setUsage(usage);
            summaries.add(summaryData);

            materialLotUsageMap.remove(materialLot.getId());
        }
    }

    return summaries;
}

A: Service method is called each access of electrolyserMaterialLotList and the list prepared by accessing to database and doing same operations again even  for single item access. You should avoid doing so. Basically, you can use null check in getter method.
public List<MaterialLotSummaryData> getElectrolyserMaterialLotList() {
    if(electrolyserMaterialLotList == null)
    {
          MaterialLotFilter materialLotFilter = new MaterialLotFilter();
          materialLotFilter.setElectrolyserId(id);
         electrolyserMaterialLotList  = materialService.getMaterialLotByElectrolyserId(materialLotFilter);
    }
     return electrolyserMaterialLotList;
}


text:
Q: How to reinitialize an array to null in .net? I have a double() and once I'm done using it I want to use it again by setting the array to null. Apparently that's a terrible practice to do in .net so what's the right way to reinitialize an array back to nothing?
Array.clear leaves me with an array of zeros. This variable can be used by the entire class so creating a new array doesn't answer the question either. The code below shows how the variable is used. It's used in multiple methods. I hope this example explains what I'm trying to ask.
class foo
    private dim myArray as new double()

    public sub createArrayFromFile()
        If(not isNothing(myArray))
           //set myarray to null. what's this code?
        End If
        //Add data to myArray by parsing a file

    end sub

    public sub createArrayFromMachine()
        If(not isNothing(myArray))
           //set myarray to null. what's this code?
        End If
        //Add data to the array from a machine
    end sub

    public sub sendToDB()
        if(not isNothing(myarray)
           //code that puts the data into the database
        end if
    end sub
end class

A: You can either simply create a new array and let the garbage collector do its work:
my_array = {} ' create a new, empty array '

or, if you want to reuse and clear your array, use the Array.Clear method:

Array.Clear Method
Sets a range of elements in an array to the default value of each element type.

or change its size:
ReDim my_array(-1) ' delete all elements and set size to 0 or whatever '

A: You do not need to worry about managing memory in .NET in this case (and in most other cases as well). If you leave an array full of data when your program ends, it will be released automatically by the garbage collector.
Learn about managing the scope of your variables. Always declare your variables at the right level, to let garbage collector release the associated memory as soon as possible.
If you need to reuse the same variable for a different purpose, think again. In most cases it's best to declare a different variable instead. If you are looping, and need a new array every time, declare an array inside the loop, so when it goes to next iteration, it's cleaned up automatically.
EDIT: Regarding your question edit, here is how you can do it:
class foo
  private dim myArray as new double()

  public function foobar() as new double()
    Dim myArrayLocal1 As new double()
    'Add some stuff to the myArrayLocal1
    If smth then Return myArrayLocal1

    Dim myArrayLocal2 As new double()
    'Add some stuff to the myArrayLocal2
    Return myArrayLocal2
  end sub

  'then do this myArray = foobar
end class

The function can also probably be declared Shared. Although it really looks like you need two separate functions in this case. For me to give you a more concrete example, please add more detail about the actual "some stuff" code.

A: This was exactly what I was looking for
myArray = nothing


text:
Q: Store a Linked list or a transformed version (array) I created a doubly Linked List, now I want to send it to my Backend and from there to my database. Should I store the whole linked list, or should I transform it from a linked list to smth like an array before sending to Backend?
What is the common approach?


text:
Q: How do I refresh a page with a hash? I refresh pages by writing window.location = window.location;. However this doesn't work on a page like /page#c22. It will just jump to whereever c22 is. How do I refresh the page?
It does not need to use go to #c22 once refreshed but I am sure there is a more dependable way than window.location = window.location.

A: You may want to try:
window.location.reload(true);

reload(forceget): Reload the document from the current URL. forceget is a boolean, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache. (Source)

A: You can use this:
window.location.reload();

The spec for this is here, at the W3C

This function forces the host application to reload the resource identified by the Location.

A: Try:
location.reload(true)

A: "Page auto reload with parameters" is one tried to preserve get parameters.
Probably you wanted to use location.pathname.


text:
Q: What is the function of "pretty" in "pretty inefficient"? Could you tell me what is the role of the word in bold in the following sentence :

Worrying is pretty inefficient.

A: Pretty is an adverb in this sentence, meaning quite, fairly. See Google/Oxford Dictionary:

Adverb
to a moderately high degree; fairly.
  "he looked pretty fit for his age"

Note that this usage of "pretty" is informal in register.


text:
Q: How to properly build keycloak from source code I need to build a custom version of Keycloak in order to perform another action when password reset happens.
In order to do this, I followed the steps described in the Readme file on the git repository:

*

*Check java version, maven version, git version (openjdk 11, amazon corretto, maven 3.6.3)

*Run "git clone https://github.com/keycloak/keycloak.git"

*Switch to the newly created directory

*Run "mvn install"

Some tests failed in module keycloak-saml-core:
org.keycloak.saml.processing.core.parsers.saml.SAMLParserTest
[ERROR] testSaml20AuthnResponseNonAsciiNameDefaultLatin2(org.keycloak.saml.processing.core.parsers.saml.SAMLParserTest)  Time elapsed: 0.008 s  <<< ERROR!
ParsingException [location=null]org.keycloak.saml.common.exceptions.ParsingException: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[9,91]
Message: Invalid byte 2 of 3-byte UTF-8 sequence.
    at org.keycloak.saml.common.DefaultPicketLinkLogger.parserException(DefaultPicketLinkLogger.java:420)
    at org.keycloak.saml.common.util.StaxParserUtil.getElementText(StaxParserUtil.java:492)
    at org.keycloak.saml.processing.core.parsers.util.SAMLParserUtil.parseNameIDType(SAMLParserUtil.java:57)
    at org.keycloak.saml.processing.core.parsers.saml.assertion.SAMLSubjectParser.processSubElement(SAMLSubjectParser.java:58)
    at org.keycloak.saml.processing.core.parsers.saml.assertion.SAMLSubjectParser.processSubElement(SAMLSubjectParser.java:36)
    at org.keycloak.saml.common.parsers.AbstractStaxParser.parse(AbstractStaxParser.java:97)
    at org.keycloak.saml.processing.core.parsers.saml.assertion.SAMLAssertionParser.processSubElement(SAMLAssertionParser.java:69)
    at org.keycloak.saml.processing.core.parsers.saml.assertion.SAMLAssertionParser.processSubElement(SAMLAssertionParser.java:34)
    at org.keycloak.saml.common.parsers.AbstractStaxParser.parse(AbstractStaxParser.java:97)
    at org.keycloak.saml.processing.core.parsers.saml.protocol.SAMLResponseParser.processSubElement(SAMLResponseParser.java:77)
    at org.keycloak.saml.processing.core.parsers.saml.protocol.SAMLResponseParser.processSubElement(SAMLResponseParser.java:38)
    at org.keycloak.saml.common.parsers.AbstractStaxParser.parse(AbstractStaxParser.java:97)
    at org.keycloak.saml.processing.core.parsers.saml.SAMLParser.parse(SAMLParser.java:123)
    at org.keycloak.saml.common.parsers.AbstractParser.parse(AbstractParser.java:98)
    at org.keycloak.saml.common.parsers.AbstractParser.parse(AbstractParser.java:102)
    at org.keycloak.saml.processing.api.saml.v2.response.SAML2Response.getSAML2ObjectFromStream(SAML2Response.java:389)
    at org.keycloak.saml.processing.core.parsers.saml.SAMLParserTest.assertParsed(SAMLParserTest.java:141)
    at org.keycloak.saml.processing.core.parsers.saml.SAMLParserTest.testSaml20AuthnResponseNonAsciiNameDefaultLatin2(SAMLParserTest.java:262)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:239)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[9,91]
Message: Invalid byte 2 of 3-byte UTF-8 sequence.
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
    at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getElementText(XMLStreamReaderImpl.java:902)
    at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.getElementText(XMLEventReaderImpl.java:187)
    at java.xml/javax.xml.stream.util.EventReaderDelegate.getElementText(EventReaderDelegate.java:110)
    at org.keycloak.saml.common.util.StaxParserUtil.getElementText(StaxParserUtil.java:490)
    ... 44 more

After this, I tried running the project directly from Intellij, but received the following error:
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/keycloak/adapters/tomcat/KeycloakAuthenticatorValve
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:139) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:124) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.keycloak.SpringBootAdapterApplication.main(SpringBootAdapterApplication.java:10) [classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tomcatEmbeddedServletContainerFactory' defined in class path resource [org/springframework/boot/autoconfigure/web/EmbeddedServletContainerAutoConfiguration$EmbeddedTomcat.class]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/keycloak/adapters/tomcat/KeycloakAuthenticatorValve
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:562) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:201) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:136) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    ... 8 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/keycloak/adapters/tomcat/KeycloakAuthenticatorValve
    at org.keycloak.adapters.springboot.KeycloakAutoConfiguration$1.customize(KeycloakAutoConfiguration.java:59) ~[classes/:na]
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:73) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizerBeanPostProcessor.postProcessBeforeInitialization(EmbeddedServletContainerCustomizerBeanPostProcessor.java:59) ~[spring-boot-1.5.20.RELEASE.jar:1.5.20.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:407) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1622) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.23.RELEASE.jar:4.3.23.RELEASE]
    ... 16 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.keycloak.adapters.tomcat.KeycloakAuthenticatorValve
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_191]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_191]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) ~[na:1.8.0_191]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_191]
    ... 22 common frames omitted

Process finished with exit code 1

I also tried skipping the tests with mvn install -DskipTests and the build succeeded, but I am not aware of the location of the newly created jar file containing the result of the build.
Also, changing java version from 11 to 8 did not seem to affect the errors that would occur.
Switching to a fresh linux virtual machine did not really affect things, but tests would still fail for some unknown/unspecified reason, but in the test suites, not in the saml package.
Please note that this is the version as-is from the repository, with no changes done by me.

A: Probably maven profile is missing.
Documentation: Building from source

*

*You need Java JDK8 and Maven installed and configured;

*In temrinal, change direcotry to project's root;

*Run maven command:

mvn -Pdistribution -pl distribution/server-dist -am -Dmaven.test.skip clean install
Resulting release distribution will be in ./distribution/server-dist/target/

A: The issue is in test and by skipping test will move you forward (https://github.com/keycloak/keycloak/blob/master/docs/building.md). However there is clearly an issue with test file probably with encoding that need to be fixed.

A: I found a maven command that reliably solves this issue for me:
mvn clean install -Pdistribution -DskipTests

A: *

*the entrance in testsuite folder  keycloakserver class

*and idea add  a jboss(wildfly) server

*config as jar debug

*debug

url in chinese blog by me
https://blog.csdn.net/xiaohelong2005/article/details/118932623
I hope this will help you a lot
note:mvn uses golang-mvn-wrapper which visit the google server ,if you behind gfw or other firewall block the google service,you need proxy
the tool v2ray and proxifier need to be used.


text:
Q: How to extend Memcached item lifetime without getting it? Can I extend a lifetime of a Memcached item without actually getting it?
Sure, I can get the item, set it again and increase a lifetime.
However, this way I'll have to copy the object to script's memory first, which is not good from the perfomance prospective.

A: It sounds like you probably just want to not set a TTL at all (use 0) and let the LRU evict things that you aren't accessing.  If you don't intend to access the items at all, then why do you care if they're there?


text:
Q: Using 2 wifi adapers to increase speed I have a modem from my provider with wireless and a wireless router.
Both work on a different channel and are on a different floor.
But no matter which channels I choose, sometimes the wireless signal just drops in speed.
Relocating the modem and router also does not help.
Just too many other devices from neighbours seems to be the problem.
I have a build-in wifi adaptor and a usb wifi adaptor.
What is the best way to bundle these connections?
I download a lot from Usenet, so manual switching is no option.

A: There is no way, as far as I know, to use multiple dongles for one connection. You could use two dongles to connect your PC to two different Wifi signals (like 1 on your WiFi and the other on your neithbor's WiFi), but that's not what you asked.
Therefore, you will have to use the most performant adapter you own.
In general, your USB WiFi dongle will have better results. You can monitor your wireless connection with the command :
iwlist scanning

First, use this command while your are connected with the built-in chips.
Then use it again with your USB adapter connected, when the built-in one is not used.
Choose the most performant one.

How-to : read the iwlist scanning results

*

*Go to the wlan section (wlan0 by default), that means "WiFi".

*Cell 01 is the first signal recieved, Cell 02 is the second one, etc.

*To have a "human-readable" name, check the ESSID line, for each Cell. That is the name your WiFi has, the same name you must clic on to connect with Ubuntu.

*Once you have identified your signal section, check the Quality line, and mainly the Signal level line, expressed in Decibels (dBm)

-> This is what we were looking for ! The signal strength in dBm represents the quality of your reception, thus the quality of your WiFi Adapter.
In dBm, the higher is better. Note that the dBm number is a NEGATIVE number, so -68 is higher than -91 (so : -68 dBm is a better quality than -91 dBm).

Another thing :  You will notice the Frequency line in the iwlist scanning results. If you leave near other people who also have a Wifi connection (your neightbors for example, or other people living in the same building, ...) and use the same Frequency as you do, you may want to change the frequency you are using.
Why ? Because using the same frequency as others can mess up your transmission, other WiFi acting like parasites to you, and you acting like a parasite to other's signal.
You can change easily the frequency of your WiFi by choosing another Channel or another Frequency in your Internet Box options (not sure of the english name for Internet Box... I mean the electronical device where your WiFi signal come from, the thing that's plugged into the wall in your house).


text:
Q: Mixing libstdc++ versions There are 2 software teams developing C++ applications for the same OS (Scientific Linux 6.5):
Team_A uses the OS provided compiler and libraries (GCC 4.4.7, GLIBC_2.12, GLIBCXX_3.4.13), to build its C++98 application and various shared libraries.
Team_B uses a newer GCC version (4.8.3) which has been built from source. It's a native compiler, it links against the OS libc, and uses the OS standard headers, but has its own version of stdc++ (GLIBCXX_3.4.19). Team_B uses this compiler in C++11 mode to build its application (AppB), and deploys libstdc++ and libgcc_s along with it.
Team_A provides services to Team_B in form of a shared library (.so, .hpp): LibA. The API of the library is a set of C++ classes (declaration in the header, implementation in the .so), and the methods take std::string and other stdc++ classes as arguments.
At this point we arrive to the problem: AppB constructs GLIBCXX_3.4.19 C++11 style std::whatever objects and passes them to LibA who interprets them as GLIBCXX_3.4.13 C++98 style objects, and this might not be forward compatible.
Is this a problem? Can it lead to an application crash? Are the std::whatever implementations compatible among versions (same memory layout)? What about c++98 vs C++11?
Some plot twists which make me more confused:

*

*AFAICT, when AppB runs there's only one libstdc++ loaded, the newer
one. Even if LibA links against the older, it won't be loaded.

*But symbols in libstdc++ are versioned. So, if LibA explicitly uses an
older version of a symbol it will be linked against that. This means
2 different implementations of the same function will be used by AppB
and LibA.

*std::string and containters are template classes, this means
part of their implementation end up where it's generated, part of it
in libstdc++.so. Even if the newer libstdc++ is loaded, the generated
template code in LibA is from the older version.

I would like to understand what's exactly happens in this case, if it is risky, and void problems. Getting the teams on the same development environment is not an option. Removing std:: classes from the API would also be very hard to make.
Any pointers welcome! :)

A: Unlike C, there is no defined ABI for C++.  That means ....

*

*The C++ mangling may change wikipedia : name mangling.  Note how Alpha name mangling changed.

*The structure of a class may be different.  There may be different decisions for laying out protected:, private: and public: parts of the structure.  The location and meaning of the vtable may be moved between compilers.  There may be different pre-defined functions such as the typeinfo in the vtable between the different compiler versions.

*The implementation of a structure in the STL may be different between versions of C++ (e.g. string sharing was done in earlier Visual studio implementations, but has been banned in C++11).

*In Windows, different runtimes may manage their memory differently (bind to different malloc/free).  When passing full objects or pointers, this can result in the incorrect free implementation being called.

What can you do to mitigate these problems?
Source sharing
Instead of providing a compiled library, deliver the services as source code to be compiled on the same environment.
Standardize on libstdc++
The source built compiler, can be re-built with the older stdC++.  This would limit the impact of point 3).
Create a facade
There is an interface between the two teams, which needs to speak a common language.  This language probably ought to be C.
Team A => C++ facade/stub =>  C interface => C++ facade/proxy => Team B.
The facade should be built in the environment where it will be used.


text:
Q: Rewrite rules not working in WordPress I'm trying to add the new rewrite rules using the rewrite API:
 add_rewrite_rule('product/([A-Z0-9]{10})', 'index.php/product/?asin=$1', 'bottom');
 add_rewrite_rule('product/(([A-Za-z0-9_])*)', 'index.php/product/?product=$1', 'bottom');
 add_rewrite_rule('compare/((([A-Z0-9]{10}),?)*)', 'index.php/compare/?asin=$1', 'bottom');
 add_rewrite_rule('categories/(([A-Za-z0-9]|\-|\_)*)', 'index.php/categories/?subcategory=$1', 'bottom');

After the permalink is updated it adds the following lines to the .htaccess file:
RewriteRule ^product/([A-Z0-9]{10}) /index.php/product/?asin=$1 [QSA,L]
RewriteRule ^product/(([A-Za-z0-9_])*) /index.php/product/?product=$1 [QSA,L]
RewriteRule ^compare/((([A-Z0-9]{10}),?)*) /index.php/compare/?asin=$1 [QSA,L]
RewriteRule ^categories/(([A-Za-z0-9]|\-|\_)*) /index.php/categories/?subcategory=$1 [QSA,L]

resulting to the following .htaccess file:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteRule ^product/([A-Z0-9]{10}) /index.php/product/?asin=$1 [QSA,L]
RewriteRule ^product/(([A-Za-z0-9_])*) /index.php/product/?product=$1 [QSA,L]
RewriteRule ^compare/((([A-Z0-9]{10}),?)*) /index.php/compare/?asin=$1 [QSA,L]
RewriteRule ^categories/(([A-Za-z0-9]|\-|\_)*) /index.php/categories/?subcategory=$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

But when I tried to access the following URL:
http://example.com/product/ABCDE324AB

It doesn't seem to work. I always get a page not found page. Any ideas?

A: What I understand from the above is you have .htaccess file and also correct code written in to the same file but still getting 404 issue. Let me tell you why. Your server not allowing .htaccess file to read or override permission. So how can you give this permission? Open your Apache httpd.conf file serch for AllowOverride now you can see it is present several times. check for below comment in to the same file:
# AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

Just replace AllowOverride None by AllowOverride All
Now restart APACHE and it should work


text:
Q: Web scraping in Selenium Python

O

1.28926

H

1.29054

L

1.28844

C

1.28871

1.28871

−0.00055 (−0.04%)

I would like to scrape 1.28926, 1.29054, 1.28844, 1.28871, +0.00040 (+0.03%) from the HTML code above.
Here is my code:
total_data = []
count_elements = [i.text for i in WebDriverWait(browser, 20).until(
    EC.presence_of_all_elements_located((By.XPATH, "//div[@class='valueItem-3JDGGSt_-']//div["
                                                   "@class='valueValue-3kA0oJs5-']")))]
for e in count_elements:
    total_data.append(e)
print(total_data)

But my result is
['n/a', 'n/a', 'n/a', '1.28871', '+0.00040 (+0.03%)']

How can I make my code work?

A: Try change the Expected Condition to presence_of_all_elements_located() to visibility_of_all_elements_located() and with python logic fetch the first three records.
total_data = []
count_elements = [i.text for i in WebDriverWait(browser, 20).until(
    EC.visibility_of_all_elements_located((By.XPATH, "//div[@class='valueItem-3JDGGSt_-']//div["
                                                  "@class='valueValue-3kA0oJs5-']")))]
for e in count_elements[:3]:
    total_data.append(e)
print(total_data)


text:
Q: Are there performance benefits in storing HTML in javascript? We are using an Oracle product with a built-in form designer. This form designer allows the user to create a form definition, basically a collection of sections with sections containing lines. This generates a schema which is then converted using XSLT into HTML.
Recently Oracle changed this XSLT to so that the HTML for each section is stored in javascript arrays so that it can be hidden/shown.
Example:
 section_html['registrationDetails'] =

    '
'+
        '
'+
            '
'+
                ''+
                   '
'+
                        '
'+
                            '
'+
                                ''+

                                    ''+
                                '	'+
                                ''+
                                   ''+
                                '	'+
                            '
'+
                        '
'+
                   '
'+
               '	'+
            '
'+

This makes it difficult to read, edit and customize! Hiding and showing sections are not really difficult otherwise.
Forms tend to have anything from between 30 to 200 lines with maybe 15 sections max.
Are there real performance advantages to doing it this way? Or is there a better way of doing this?