text:
Q: Flexbox responsive cards In my current desktop markup, I'm trying to add a 800px media query. In the desktop version, I have 2 rows of cards, that in the 800px bp, I want 2 columns of 4 cards each. How can I achieve this?
.sub-section .blank-containers {
    width: 250px;
    height: 250px;
    background: rgb(197, 179, 196);
    margin: 5px;
    display: flex;
    justify-content: space-evenly;
    border-radius: 10px;
    border: 1px solid;
}
.sub-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-evenly;
    margin-top: 10px;
    border: 1px solid;
}
@media (max-width: 800px) {
    section.sub-section {
        flex-direction: column;
        flex-wrap: wrap;
    }
}

image One

image Two

image Three

..........

A: Add a common class with img1, img2, img3, ..... which will take 50% of the parent container width.
like
.img {
    width: 50%;
    display: flex;
    justify-content: center;
}

And then

image One

image Two

image Three

..........

Hope it will work for you.


text:
Q: How to make automatic backup [daily , weekly ,...] using Java and mysql database "wamp server"? I'm creating a javafx app with using wamp server for mysql database, how to make automatic backup even if database become large for a specific location, Or  what's best practice in this case?
What can I do by java for this issue?

A: I would suggest to create a cron job for this.
You can either invoke mysqldump tool directly or create a script in any language to export data you want to, which requires more work,  but is more flexible.
Alternatively you can search the Internet for some ready tool (like this which I just found, but didn't check if it works). I'm pretty sure you would find some, since it's pretty common thing to do.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Exercise that requires some ability to work with sets, cartesian product of sets, and random variables I have to solve a tricky exercise that requires some ability to work with sets and random variables. I would like your help with this because I'm unable to see how to proceed.

Construction of $\mathcal{A},\mathcal{B}, \mathcal{C}$:
Consider $3$ sets $A,B,C$ with $A\equiv \{a_1,a_2,a_3\}$, $B\equiv \{b_1,b_2,b_3\}$, $C\equiv \{c_1,c_2,c_3\}$.
Let $\mathcal{A},\mathcal{B}, \mathcal{C}$ be the collection of all subsets of $A$,$B$,$C$ excluding the empty set, i.e.,
$$
\mathcal{A}\equiv \Big\{A, \{a_1\}, \{a_2\}, \{a_3\}, \{a_1,a_2\}, \{a_2, a_3\}, \{a_1,a_3\}\Big\}
$$
$$
\mathcal{B}\equiv \Big\{B, \{b_1\},\{b_2\}, \{b_3\},\{b_1,b_2\}, \{b_2, b_3\}, \{b_1,b_3\}\Big\}
$$
$$
\mathcal{C}\equiv \Big\{C, \{c_1\},\{c_2\}, \{c_3\},\{c_1,c_2\}, \{c_2, c_3\}, \{c_1,c_3\}\Big\}
$$

Construction of $A\times B \times C$:
Let $\times$ denote the Cartesian Product.
$A\times B \times C$ is the collection of all ordered $3$-tuples from $A,B,C$, i.e.,
$$
A\times B \times C\equiv \Big\{(a_1,b_1,c_1),(a_1,b_2,c_1), (a_1,b_3,c_1),... \Big\}
$$

Construction of $\mathcal{T}$:
Consider $\mathcal{T}\equiv \mathcal{A}\times \mathcal{B}\times \mathcal{C}$. For example, an element $T\in \mathcal{T}$ is
$$
T\equiv \Big(\{a_1,a_2\}, \{b_3\} , \{c_1,c_2\}\Big)
$$
Each $T\in \mathcal{T}$ is composed of 3 "components". In the example above, the first component is $\{a_1,a_2\}$, the second is $\{b_3\}$, the third is $\{c_1,c_2\}$.
We rewrite each $T\in \mathcal{T}$ as the set of all possible ordered $3$-tuples that can be constructed from its $3$ components. Continuing the example above,
$$
T\equiv \overbrace{\Big(\{a_1,a_2\}, \{b_3\} , \{c_1,c_2\}\Big)}^{\text{Representation 1}}  \equiv \overbrace{\Big\{\overbrace{(a_1,b_3, c_1)}^{\text{ordered $3$-tuple}}, (a_2, b_3, c_1), (a_1,b_3, c_2), (a_2,b_3, c_2)\Big\} }^{\text{Representation 2}}
$$

Construction of $\mathcal{M}$:
We collect in $\mathcal{M}$ all the subsets of $A\times B\times C$  that cannot be part of $\mathcal{T}$. For example,
$$
M\equiv \Big\{(a_1,b_3, c_1), (a_2, b_2, c_1)\Big\}
$$
$M$ is not an element of $\mathcal{T}$.

Probability:
Suppose that I have a random vector  $Y$ with size $3\times 1$ taking value in $A\times B\times C$.
Suppose that I have a random set $S$ taking value in $\mathcal{T}$.
Assume that
$$
(\star)\hspace{1cm}\mathbb{P}(Y\in T)\geq \mathbb{P}(S\subseteq T ) \text{ } \forall T\in \mathcal{T}
$$
where $\mathbb{P}$ denotes probability measure.

Question: show that
$$
\mathbb{P}(Y\in M)\geq \mathbb{P}(S\subseteq M ) \text{ } \forall M\in \mathcal{M}
$$

Some clarifications: Random sets are generalisations of random variables to sets.
I believe that to show what I want we should somehow use the fact that $\mathbb{P}(S=M )=0$ $\forall M\in \mathcal{M}$. But I can't see how to proceed.
Also, I realised that every set $M\in \mathcal{M}$ can be written as
the union of all the subsets of $M$ that belong to $\mathcal{T}$. But I can't see where to use this.


text:
Q: How does browserify work with angular based app? I was mess around this for a couple of days. I was trying to get browserfiy to work well with angular based app. I have tried following options but still cannot decide on a better way to do it, it will be appreciated if anyone can give any suggestion on this.

*

*Option 1

Bundle all angular related libs, like angular, angular-animate, angular-ui-router, etc into vendor.js by using bundle.require
Bundle all app reated source files into app.js by using bundle.external
That works fine in dev environment, all modules in vendor.js could be required from app.js
But it crashed in prod environment. The minified angular files are not all CMD. Although I can browserify-shim angular.min.js and bundle.require angular-ui-router.min.js, it's kind of cubersome to do this file by file.

*

*Option 2

Leave all angular libs into <script> and only output bundle for app files. That means in app.js, I have to refer to angular as a global var which is not good.
So what's the best practise to do this?

A: Even if you do require() angularjs, it still exposes the angular namespace in the context of its environment (Window object for browsers). What I usually do is simply put all angularjs modules dependencies (e.g. ui.router, ngResource and etc) below the bundled(browserified) javascript where your angularjs application resides. In my case, I use gulp-useref to concatenate all the script provided by the gulp-inject tags(this includes scripts bundled by browserify).
As you may have noticed below, the bower components(bower:js tag) are added below the bundle(inject:js tag). Since requiring the angular module will attach the angular object in the window object, then any components external to browserify can access window.angular.
The answer I provided is somehow similar to option 2 but without the disadvantage of referring angular as a global variable within your browserified code.
e.g.
<!-- build:js({./.tmp,./}) js/index.js -->
<!-- inject:js -->
<!-- endinject -->
<!-- bower:js -->
<!-- endinject -->
<!-- endbuild -->

UPDATE:
I've create a github repo that resembles the answer provided above. Try to clone it, and see what you can do with it.


text:
Q: fetching async await data outside map function in node js / javascript

let object = [{
  id: `01`, name: `fish`, type: `marine`,
}, {
  id: `02`, name: `fish`, type: `fresh`,
}, {
  id: `03`, name: `fish`, type: `tank`,
}, {
  id: `04`, name: `animal`, type: `pet`,
}, {
  id: `05`, name: `animal`, type: `wild`,
}, {
  id: `06`, name: `animal`, type: `zoo`,
}, {
  id: `07`, name: `food`, type: `veg`,
}, {
  id: `08`, name: `food`, type: `non-veg`,
}]

let data = []
object.map((value) => {
  data.push([value.name, value.type])
})

console.log(data)

I can fetch data outside the map function in first example but in second second example i can't fetch data

let object = [{
  id: `01`, name: `fish`, type: `marine`,
}, {
  id: `02`, name: `fish`, type: `fresh`,
}, {
  id: `03`, name: `fish`, type: `tank`,
}, {
  id: `04`, name: `animal`, type: `pet`,
}, {
  id: `05`, name: `animal`, type: `wild`,
}, {
  id: `06`, name: `animal`, type: `zoo`,
}, {
  id: `07`, name: `food`, type: `veg`,
}, {
  id: `08`, name: `food`, type: `non-veg`,
}]

let data=[];
let test;
object.map(async (value) => {
  test = await getValue(value.name);
  data.push([value.name,value.type,test]);
})
console.log(data);

As in first example i can easily fetch data outside the map function fut in second function I am getting blank array how can i fetch async await data outside map function

*

*where am i doing wrong i don't get it

A: Note that the map function yields a Promise object as a return value for each item.
And the moment when data finishes collecting all the data should come after all the Promises finishes.
So to ensure the procedure finishes, use a await Promise.all() before you use the data.

let object = [{
  id: `01`, name: `fish`, type: `marine`,
}, {
  id: `02`, name: `fish`, type: `fresh`,
}, {
  id: `03`, name: `fish`, type: `tank`,
}, {
  id: `04`, name: `animal`, type: `pet`,
}, {
  id: `05`, name: `animal`, type: `wild`,
}, {
  id: `06`, name: `animal`, type: `zoo`,
}, {
  id: `07`, name: `food`, type: `veg`,
}, {
  id: `08`, name: `food`, type: `non-veg`,
}]

let data=[];
let test;
let promises = object.map(async (value) => {
  test = await getValue(value.name);
  data.push([value.name,value.type,test]);
})

// 1. This line matters
await Promise.all(promises);
console.log(data);

// 2. Or if you cannot use await here
Promise.all(promises).then(() => {
  console.log(data);
});

By the way, because the getValue function is asyncronous, so you possibly will got the data in a completely random order, if you care about the order, you may need another approach.

A: Try this you will get your response viva for loop easily.
Map function uses a callback function which to be traversed on each element for given array. For more details just go throug this async/await for Array.map fuction, can also use the promise.all for the same as mentioned in post in the given link.

let object=
    [
     {
      id:`01`,
      name:`fish`,
      type:`marine`,
     },
     {
      id:`02`,
      name:`fish`,
      type:`fresh`,
     },
     {
      id:`03`,
      name:`fish`,
      type:`tank`,
     },
     {
      id:`04`,
      name:`animal`,
      type:`pet`,
     },
     {
      id:`05`,
      name:`animal`,
      type:`wild`,
     },
     {
      id:`06`,
      name:`animal`,
      type:`zoo`,
     },
     {
      id:`07`,
      name:`food`,
      type:`veg`,
     },
     {
      id:`08`,
      name:`food`,
      type:`non-veg`,
     }
    ]

    const getData = async function(){
      let data=[];
      for (var i=0; i<object.length; i++){
        let value = object[i];
        let test= await getValue(value.name);
        data.push([value.name,value.type,test]);
      }
      return data;
    }

console.log(await getData());

A: Use Promise.all:
const data = await Promise.all(object.map(async (value) => {
  const test = await getValue(value.name);
  return [value.name,value.type,test]
}))

console.log(data)

A:

let object = [{
  id: `01`, name: `fish`, type: `marine`,
}, {
  id: `02`, name: `fish`, type: `fresh`,
}, {
  id: `03`, name: `fish`, type: `tank`,
}, {
  id: `04`, name: `animal`, type: `pet`,
}, {
  id: `05`, name: `animal`, type: `wild`,
}, {
  id: `06`, name: `animal`, type: `zoo`,
}, {
  id: `07`, name: `food`, type: `veg`,
}, {
  id: `08`, name: `food`, type: `non-veg`,
}]

async function demo(){

 let data=[];
 let test;

 for( const value of object){
   test = await getValue(value.name);
   data.push([value.name,value.type,test]);
 }

 console.log(data);
}

Try this I hope this will work as you have to write your code in for loop what you are trying to achieve it will work


text:
Q: Facebook API v2 - Friends ID i need to find all my friends's id. On www.developers.facebook.com i have 2 app. The first one have api version 1 and version2, the second one has only api version 2.
With api version 1 I can find all my friends's id with /me/friends but on api version 2 this not work.
On my new Facebook profile I want to create a new app with api version 1, is possible? If I can't how I get all id of my friends?

A: This has been discussed here dozens of times. There are also dozens of answer which you would've been able to find using the Stackoverflow Search.
See retrieve full list of friends using facebook API for example.
Creating a new app with Graph API v1.0 is not possible.


text:
Q: Add a hyperlink to excel worksheet using outlook VBA I receive a large number of emails with attachments. The attachments need to be saved, edited to add a reference (programmatically), have that new reference number logged, and the saved attachment forwarded on to various addressees. I've got all this working in outlook vba but, to make auditing easier, I need to add a hyperlink in the cell in the log that contains the newly added reference number, so I can quickly navigate to the newly saved file.
I've searched thoroughly but no joy,  and tried:
        With LogObj.Sheets("Log")
        .Hyperlinks.Add Anchor:=LogObj.Sheets("Log").Cells(LastOrderRow, 3), Address:="",   SubAddress:= _
            "SavePath", TextToDisplay:=LogObj.Sheets("Log").Cells(LastOrderRow, 3)
        End With

I've tried:
        LogObj.Sheets("Log").Cells(LastOrderRow, 3) = _
        WorksheetFunction.Hyperlink(savePath, LogObj.Sheets("Log").Cells(LastOrderRow, 3))

In desperation I tried being literal:
        OrderRef = "LogObj.Sheets("Log").Cells(LastOrderRow, 3)"
        LogObj.Sheets("Log").Cells(LastOrderRow, 3) = _
        WorksheetFunction.Hyperlink(""" & SavePath & """, OrderRef)

and many variations within the above, including adding application.worksheetfunction.
If anybody knows the correct syntax to get outlook vba to do this in excel, I'd be very grateful if they'd share it.
Many thanks.
Neva

A: The path to the file should go in the Address.  This worked for me.  Make sure you're path is valid.
With LogObj.Sheets("Log")
    Set rNext = .Cells(.Rows.Count, 1).End(xlUp).Offset(1, 0)
    rNext.Value = lReference
    .Hyperlinks.Add Anchor:=rNext, Address:=sSavePath, TextToDisplay:=CStr(lReference)
End With


text:
Q: Remove IP Address from IP Security  IIS8.0 I am using iis 8.0 and trying to remove any allowed/restricted ip address from the list, screen shot is attached. i have used the remove variable by following this link.

        var websiteName = "abc.com";
            using (var serverManager = new ServerManager())
            {
                var config = serverManager.GetApplicationHostConfiguration();
                var ipSecuritySection = config.GetSection("system.webServer/security/ipSecurity", websiteName);
                var ipSecurityCollection = ipSecuritySection.GetCollection();

                var addElement = ipSecurityCollection.CreateElement("remove");
                addElement["ipAddress"] = ipAddress;
                ipSecurityCollection.Remove(addElement);
                serverManager.CommitChanges();
            }

Guide me am i doing wrong, if yes? then what is it.

A: I have found the way to remove entry from the collection.
 var websiteName = "abc.com";
        using (var serverManager = new ServerManager())
        {
            var config = serverManager.GetApplicationHostConfiguration();
            var ipSecuritySection = config.GetSection("system.webServer/security/ipSecurity", websiteName);
            var ipSecurityCollection = ipSecuritySection.GetCollection();

            var addElement = ipSecurityCollection.CreateElement("remove");
            addElement["ipAddress"] = ipAddress;
            ipSecurityCollection.add(addElement);
            serverManager.CommitChanges();
        }

Every thing was alright only one thing was wrong in the 2nd last line.

ipSecurityCollection.remove(addElement);

Change it to

ipSecurityCollection.add(addElement);

After that it will work perfectly.


text:
Q: Syntax for using regex in ruby / watir webdriver I am able to find an element I'm looking for using an exact match on the text, as shown below, but when I try to extend this to using a regex it doesn't work.  What am I doing wrong?
>> browser.h3(:text => 'Latest News').exist?
=> true
>> browser.h3(:text, 'Latest News').exist?
=> true
>> browser.h3(:text, /Latest News/).exist?
=> false

>> p browser.h3(:text, 'Latest News')
#<Watir::Heading:0x..fcb7790992119c2b2 located=false selector={:text=>"Latest News", :tag_name=>"h3"}>
=> #<Watir::Heading:0x..fcb7790992119c2b2 located=false selector={:text=>"Latest News", :tag_name=>"h3"}>
>> p browser.h3(:text, /Latest News/)
#<Watir::Heading:0x54fac9ec99992782 located=false selector={:text=>/Latest News/, :tag_name=>"h3"}>
=> #<Watir::Heading:0x54fac9ec99992782 located=false selector={:text=>/Latest News/, :tag_name=>"h3"}>

EDIT  based on comments, found following HTML that seems to be what he's after, on the afl site.  This is the only match in the page html for a case insensitive search for "latest news'

        LATEST NEWS

      .........

A: I cannot reproduce your results given the test site. For me, all of the locators using 'Latest News' return false (ie both string and regex matches). The page text is in all caps, 'LATEST NEWS'. Using that instead of 'Latest News' allowed both the string and regex locators to return true.
require 'watir'

browser = Watir::Browser.new :chrome
browser.goto 'afl.com.au'

puts browser.h3(:text => 'Latest News').exist?
#=> false
puts browser.h3(:text, 'Latest News').exist?
#=> false
puts browser.h3(:text, /Latest News/).exist?
#=> false

puts browser.h3(:text => 'LATEST NEWS').exist?
#=> true
puts browser.h3(:text, 'LATEST NEWS').exist?
#=> true
puts browser.h3(:text, /LATEST NEWS/).exist?
#=> true


text:
Q: All Apple Internet Apps are SLOW in Yosemite A few days after upgrading to Yosemite, I started noticing that Safari was moving VERY SLOWLY. After a day or two of this it stopped loading webpages at all! So I switched to using Chrome, then my Mail app stopped receiving mail, it would send mail but again it is VERY slow. Then messages wouldn't sign into my AIM account, and I noticed that the App Store won't load any pages at all. I've searched around the web and found that some other people had the same issue, here's a link to one comment on an apple discussion thread that helped me several times, but now that doesn't even help anymore!
So the question: has anybody over here had this issue and found a solution to it?
Thanks in advance!


text:
Q: Setting Registry Value in Wix 3.11 conditionally using VBScript I am hoping to write a very small VBScript in Wix 3.11 that checks if a particular registry entry has a value.
Basically, if HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\Shell = "drive:\path\to\thisAppName.exe", we want to replace it with ours.  We only need to know that thisAppName.exe is used as the current shell.  (aka, a substring...)  The Condition XML statement doesn't seem to support substring functionality.
When debugging the VBScript, the 'value' is always empty, and the session property value is empty. as well.  This suggests to me that something is running out of sequence.
Due to small amount of scripting code, it makes sense to keep it in the Wix code.   I'm hoping not to move this into a custom module, as this seems overkill for what is needed.
<Wix>
<Product>
...
<Property Id="SHELL_KEY">
  <RegistrySearch Id="REG_SHELL_KEY" Root="HKLM"
      Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
      Name="Shell"/>
</Property>

<CustomAction Id="REGISTRYKEYCHECK" Script="vbscript" Execute="immediate" Return="ignore">
  <![CDATA[
  Dim value
  value = Session.Property("SHELL_KEY")
  IF INSTR(value, "thisAppName.exe") > 0 THEN
    Session.Property("RESET_SHELL_KEY") = "1"
  END IF
  ]]>
</CustomAction>

<InstallExecuteSequence>
  <Custom Action="REGISTRYKEYCHECK" Before="CostFinalize">1</Custom>
</InstallExecuteSequence>

...

<Directory>

  ...

  <Component Id="ResetShellExe" Guid="{....}"
    <Condition><![CDATA[RESET_SHELL_KEY]]</Condition>
    <RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon">
      <RegistryValue Type="string" Name="Shell" Value="$(var.MyProgram.TargetFileName)" KeyPath="no"/>
    </RegistryKey>
  </Component>

<Feature Id="Complete" Level="1">
   ...
  <ComponentRef Id="ResetShellExe"/>
</Feature>

...
</Product>
</Wix>

A: VBScript isn't necessary because Windows Installer does support substrings.


text:
Q: Are there any "fun" ways to learn about Languages, Grammars, Parsing and Compilers? I'm preparing for an exam concerning languages, grammars, parsing and compilers. It's not really my cup of tea and most resources I find use the language of mathematics to define the different terms of the trade and explain the different concepts I need to know rather than stick with English or French, which I would very much prefer. Therefore, I'm having some trouble both with finding the motivation to continue studying and with simply understanding the theory.
So here is my question: Do any of you know where I could find a "fun" way of learning all this? Or at the very least, maybe a more "concrete" and less "mathematical" way of handling this subject.
I need to cover the following so anything on these subjects is welcome!

*

*Parsing (LR, LL, ...)

*Grammars (Context-free, deterministic, ...)

*Syntax analysis Static flow analysis

*Impact analysis concerning software maintenance and dependency to user interfaces

*Dynamic analysis

Here are some resources which could be considered "fun" (with an emphasis on the quotation marks) ways to learn about a technical subject, just to get a sense of what I'm looking for.

*

*Why's Poignant Guide to Ruby

*Try MongoDB (type Help +
Enter)

A: If you want to learn a lot in a short time, go learn about meta compilers from Val Schorre's  1964 (yes, you read it right) Meta II paper on how to build self-compiling metacompilers.  As a freebie, they can compile conventional lanuages, too!   The paper is 10 pages, describes meta compilers (as a virtual machine beleive it or not), and contains two complete compilers.
There's a mind-blowing moment you eventually arrive at when you grok how the compiler can compile itself...   I learned compilers this way back in the early 70s and it is the most memorable compiler lesson I ever had.  This is fun.
There is an online tutorial here which implements all the ideas in JavaScript..
The author of the tutorial is Dr. James Neighbors, the guy who invented the term "domain analysis".  He used the MetaII ideas for a spectacular domain-specific code generator named Draco.  Draco was a key inspiration to compiler-like tools I've been building for the last 30 years.

A: How long do you have to prepare?  The "best" way to learn compilers is to dig into them and the best way to do that is to use the best book on compilers EVER WRITTEN: The Dragon Book  It's old, but awesome.  It's not cheap but it is, quite possibly, the most concrete and least mathematical way to learn about the magical compiler.
It doesn't have any flashing lights and it won't be in an awesome font like the Ruby guide, but it's in the top 10 Books Every Programmer Should Read


text:
Q: How can I change which icon an applet uses? I just installed the clipboard manager Diodon.
sudo add-apt-repository ppa:diodon-team/stable
sudo apt-get update
sudo apt-get install diodon

By default, it uses a dark gtk-paste icon when I use the Faenza-Dark icon theme.

Instead, I want it to use the gtk-paste icon from the Faenza-Darkest icon theme.

But rather than replace the icon inside the theme, how can I simply tell Diodon to use X icon instead? I've read all suggested questions before posting this, but they lean more towards replacing the icon rather than telling it to use different one.

A: I think you have four options:

*

*Use the Faenza-Darkest icon theme. (Is there a reason to not do this?)

*Replace the icon (which you don't want to do).

*Edit the app's configuration to change the icon.

*Make your own lightweight icon theme to set your desired icon.

Edit the app's configuration to change the icon
Edit /usr/share/applications/diodon.desktop and change Icon=gtk-paste to Icon=/usr/share/icons/Faenza-Darkest/actions/22/gtk-paste.png
Note that editing system files is generally a bad idea. You might be able to copy diodon.desktop to ~/.local/share/applications/diodon.desktop and then edit it. I'm not sure if that would work.
Make your own lightweight icon theme to set your desired icon
This is probably the best solution, but it's a little trickier. (See also this more thorough description for creating lightweight icon themes.)
Run this from a Terminal:
# Create a new theme containing the icon we want
mkdir -p ~/.icons/Faenza-Alan/actions/22
ln -s /usr/share/icons/Faenza-Darkest/actions/22/gtk-paste.png ~/.icons/Faenza-Alan/actions/22/.
# Copy the theme config and modify it for our new theme
cp /usr/share/icons/Faenza-Darkest/index.theme ~/.icons/Faenza-Alan/.
sed -i -e "s/Inherits=/Inherits=Faenza-Dark,/g" ~/.icons/Faenza-Alan/index.theme
sed -i -e "s/Faenza-Darkest/Faenza-Alan/g" ~/.icons/Faenza-Alan/index.theme

Now open Appearance and change your icon theme to Faenza-Alan.
Now your new theme will persist regardless of system upgrades. (Unless Faenza removes the gtk-paste.png icon. If you're worried about that, use cp instead of ln -s. But you won't get updates to the icon.)
My Faenza-Alan looks like this:
In testing this, I see that it's probably a bug that Faenza uses a light app-indicator icon for any of the dark themes. Anyone know where you can file a bug?

A: Go to /usr/share/icons/Faenza-Darkest/actions/22 and copy gtk-paste.png.
Paste it in /usr/share/icons/Faenza/actions/22/
That will simply put a different icon from where the themes pulls from.

A: I looked into diodon source and it just takes the icon from gtk-paste, but if that icon was white in Faenza-Dark it would not fit in Equinox's toolbars, which is the reason why it was first created.
A way around would be modifying diodon's source so it would use something like "gtk-paste-panel", if "gtk-paste-panel" is not available try "gtk-paste". After that add "gtk-paste-panel" icon to Faenza.
You can ask that to the diodon team at launchpad. It would be a nice enhancement.

A: Go into ~/.icons  Then find the icon theme you're using, go into the Status folder and add the desired icon to each of the sizes.
That way you're not replacing it in the theme. You're instead using it in your current icon set


text:
Q: How to add multiple columns to x axis? I am new to R language, and i'm trying to learn how to create a visualization for the data frame of my students degrees.
My table is somewhat like this, but bigger:

names
grade_one
grade_two
grade_three
grade_four

Ana
5.7
6.3
4.0
5.0

Beth
3.5
5.0
7.0
8.0

Rick
9.0
9.0
9.0
9.0

Zoe
8.0
8.7
8.0
9.0

etc
I want to put 'names' on y axis, and the grades 'one','two','three' and so on x axis, and thought about making a line visualization showing the evolution of the students. I would appreciate too if i can give random colors to each name of my 12 students of this classroom to improve viz.
I tried this one and other attempts without success:
ggplot(data=notas)+geom_line(mapping=aes(x=grade_one+grade_two,y=names))
I can do this on sheets but would be great learning how to make on RStudio
Would appreciate any help!
Edit:
I already saw the topic "how-to-create-a-ggplot-bar-chart-with-multiple-columns-of-data-for-y"
Maybe because i'm new to R, idk, i think its slightly different. I want to make a line chart, which each student has its own line on the chart, going from left to right, giving them random colors. I see now that values should be on y axis, the four grades on x axis; and each line showing their performance are labelled on the right side of the chart. But if it's a similar code as the other topic, idk how to adapt.
The ideia behind the line chart in this case, its to compare the evolution of the students between themselves, like "oh, look how at this point the student A exceeded the student B". The bars chart would reproduce more a isolated view of each one, which its not what i seek. Lines crossing each other would be ideal.
Also its not a school homework. I'm the teacher and i'm want to teach them graphical analysis and of course i'm practicing R too.


text:
Q: Programmatically disable Keyboard & Mouse Is there a way to disable keyboard & mouse?
Ideally I'm looking for a solution whereby I could completely disable mouse and almost disable the keyboard - bar one key combination, for example Ctrl+A. So, once Ctrl+A is pressed - the PC will go to a mute stage (no mouse/keyboard) until Ctrl+A is pressed again.

A: have a look at "BlockInput Function"
refer MSDN


text:
Q: where is php-fpm getting its config values on osx I'm trying to php-fpm on my osx by running:
php-fpm -t

and I get this error:
[30-Dec-2017 13:36:12] ERROR: failed to open error_log (/usr/var/log/php-fpm.log): No such file or directory (2)
[30-Dec-2017 13:36:12] ERROR: failed to post process the configuration
[30-Dec-2017 13:36:12] ERROR: FPM initialization failed

i don't have that file nor can I create it - even when using sudo:
$:/usr $ sudo mkdir var
Password:
mkdir: var: Operation not permitted

so my next big move is to find where exactly is this log file directory setup in php-fpm configuration (so that i can decide where the log file should go).. there seems to be many configuration files, so I refer to this question in finding the location of my php-fpm configuration file. so in the output of my php -i file I have this:
'--sysconfdir=/usr/local/etc/php/7.1'

and there I have the following files:
php-fpm.conf
// can't be coming from this file
// b/c this is telling me it's /usr/local/var/log/php-fpm.log

; If it's set to "syslog", log is sent to syslogd instead of being written
; into a local file.
; Note: the default prefix is /usr/local/var
; Default Value: log/php-fpm.log

so where is it coming from?
also when I run this:
which php-fpm
/usr/sbin/php-fpm

note sure if it helps

A: php-fpm.conf location is determined by the option
--sysconfdir=/path/to

specified when invoking $ ./confugure just before compiling php-fpm.
Usually it is /etc but may be different in your case.
Invoking $ php-fpm -i will show the options passed to configure.
Just look after Configure Command =>.
From the comments I see you have found '--sysconfdir=/private/etc' so I would look right there.

Note that you can invoke php-fpm specifying a different location for the configuration file using the -y option.

A: Because you mentioned local you must be using Homebrew and so the php-fpm config file is at:
/usr/local/etc/php/7.4/php-fpm.conf
And the www pool config is at:
/usr/local/etc/php/7.4/php-fpm.d/www.conf
Note the path version number will change in the future.
You can put your own configs in the same folder as www.conf (they must end in .conf to be included). E.g. I added one that had listen = /usr/local/var/run/php-fpm.my-username.sock which I learned here so I could use a socket instead of a port for my Site virtual server.
I found these other commands useful:
To view the logs:
tail -f /usr/local/var/log/php-fpm.log
To check the user fpm was launched as:
ps aux | egrep 'php'
And be sure to start the brew service with sudo and if you accidentally start one without sudo be sure to stop it:
sudo brew services start php

A: Up to MAC OS Catalina this one-liner works:
lsof -Pni4 | grep LISTEN | grep php
Output:
php-fpm   93649 asrar    9u  IPv4 0xd7c340d64c780f97      0t0  TCP 127.0.0.1:9073 (LISTEN)

php-fpm   94392 asrar    9u  IPv4 0xd7c340d64c780f97      0t0  TCP 127.0.0.1:9073 (LISTEN)

php-fpm   94393 asrar    9u  IPv4 0xd7c340d64c780f97      0t0  TCP 127.0.0.1:9073 (LISTEN)


text:
Q: Test-Connection output different between Windows PS 5.1 and PS Core 7.1 The result of this code is different between Windows PowerShell 5.1 and PowerShell Core 7.1.4. Is this expected? What can be done to get the same output?
C:>powershell -NoLogo -NoProfile -Command "Test-Connection 10.37.45.128 | Select-Object -Property Address,BufferSize,Latency,Status;$PSVersionTable.PSVersion.ToString()"

Address      BufferSize Latency Status
-------      ---------- ------- ------
10.37.45.128         32
10.37.45.128         32
10.37.45.128         32
10.37.45.128         32
5.1.17763.1852

C:>pwsh -NoLogo -NoProfile -Command "Test-Connection 10.37.45.128 | Select-Object -Property Address,BufferSize,Latency,Status;$PSVersionTable.PSVersion.ToString()"

Address      BufferSize Latency  Status
-------      ---------- -------  ------
10.37.45.128         32       0 Success
10.37.45.128         32       0 Success
10.37.45.128         32       0 Success
10.37.45.128         32       0 Success
7.1.4

UPDATE:
As @SantiagoSquarzon and @js2010 have noted, Test-Connection returns a different object in PS Core than it does in Windows PS.
   TypeName: System.Management.ManagementObject#root\cimv2\Win32_PingStatus
   TypeName: Microsoft.PowerShell.Commands.TestConnectionCommand+PingStatus

C:>powershell -NoLogo -NoProfile -Command "(Test-Connection -Count 1 localhost).GetType()"

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     ManagementObject                         System.Management.ManagementBaseObject

C:>pwsh -NoLogo -NoProfile -Command "(Test-Connection -Count 1 localhost).GetType()"

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
False    False    PingStatus                               System.Object

C:>powershell -NoLogo -NoProfile -Command "Test-Connection -Count 1 localhost | Get-Member"

   TypeName: System.Management.ManagementObject#root\cimv2\Win32_PingStatus

Name                           MemberType     Definition
----                           ----------     ----------
PSComputerName                 AliasProperty  PSComputerName = __SERVER
Address                        Property       string Address {get;set;}
BufferSize                     Property       uint32 BufferSize {get;set;}
NoFragmentation                Property       bool NoFragmentation {get;set;}
PrimaryAddressResolutionStatus Property       uint32 PrimaryAddressResolutionStatus {get;set;}
ProtocolAddress                Property       string ProtocolAddress {get;set;}
ProtocolAddressResolved        Property       string ProtocolAddressResolved {get;set;}
RecordRoute                    Property       uint32 RecordRoute {get;set;}
ReplyInconsistency             Property       bool ReplyInconsistency {get;set;}
ReplySize                      Property       uint32 ReplySize {get;set;}
ResolveAddressNames            Property       bool ResolveAddressNames {get;set;}
ResponseTime                   Property       uint32 ResponseTime {get;set;}
ResponseTimeToLive             Property       uint32 ResponseTimeToLive {get;set;}
RouteRecord                    Property       string[] RouteRecord {get;set;}
RouteRecordResolved            Property       string[] RouteRecordResolved {get;set;}
SourceRoute                    Property       string SourceRoute {get;set;}
SourceRouteType                Property       uint32 SourceRouteType {get;set;}
StatusCode                     Property       uint32 StatusCode {get;set;}
Timeout                        Property       uint32 Timeout {get;set;}
TimeStampRecord                Property       uint32[] TimeStampRecord {get;set;}
TimeStampRecordAddress         Property       string[] TimeStampRecordAddress {get;set;}
TimeStampRecordAddressResolved Property       string[] TimeStampRecordAddressResolved {get;set;}
TimestampRoute                 Property       uint32 TimestampRoute {get;set;}
TimeToLive                     Property       uint32 TimeToLive {get;set;}
TypeofService                  Property       uint32 TypeofService {get;set;}
__CLASS                        Property       string __CLASS {get;set;}
__DERIVATION                   Property       string[] __DERIVATION {get;set;}
__DYNASTY                      Property       string __DYNASTY {get;set;}
__GENUS                        Property       int __GENUS {get;set;}
__NAMESPACE                    Property       string __NAMESPACE {get;set;}
__PATH                         Property       string __PATH {get;set;}
__PROPERTY_COUNT               Property       int __PROPERTY_COUNT {get;set;}
__RELPATH                      Property       string __RELPATH {get;set;}
__SERVER                       Property       string __SERVER {get;set;}
__SUPERCLASS                   Property       string __SUPERCLASS {get;set;}
ConvertFromDateTime            ScriptMethod   System.Object ConvertFromDateTime();
ConvertToDateTime              ScriptMethod   System.Object ConvertToDateTime();
IPV4Address                    ScriptProperty System.Object IPV4Address {get=$iphost = [System.Net.Dns]::GetHostEntry($this.addres...
IPV6Address                    ScriptProperty System.Object IPV6Address {get=$iphost = [System.Net.Dns]::GetHostEntry($this.addres...

C:>pwsh -NoLogo -NoProfile -Command "Test-Connection -Count 1 localhost | Get-Member"

   TypeName: Microsoft.PowerShell.Commands.TestConnectionCommand+PingStatus

Name           MemberType Definition
----           ---------- ----------
Equals         Method     bool Equals(System.Object obj)
GetHashCode    Method     int GetHashCode()
GetType        Method     type GetType()
ToString       Method     string ToString()
Address        Property   ipaddress Address {get;}
BufferSize     Property   int BufferSize {get;}
Destination    Property   string Destination {get;}
DisplayAddress Property   string DisplayAddress {get;}
Latency        Property   long Latency {get;}
Ping           Property   uint Ping {get;}
Reply          Property   System.Net.NetworkInformation.PingReply Reply {get;}
Source         Property   string Source {get;}
Status         Property   System.Net.NetworkInformation.IPStatus Status {get;}

A: Well, this works if you can ping it:
test-connection yahoo.com -count 1 | select Address, BufferSize,
  @{n='Latency'; e={$_.ResponseTime}},
  @{n='Status';  e={if($_.StatusCode -eq 0){'Success'}}}

Address   BufferSize Latency Status
-------   ---------- ------- ------
yahoo.com         32      94 Success

A: This code works on Windows PS 5.1 and Core PS 7.1.4. It does it by testing if the member of the returned object is $null in order to decide it it can be used or if the other member name should be used.
Test-Connection localhost -Count 1 |
    Select-Object -Property Address, BufferSize,
        @{name='Latency'; e={
            if ($null -eq $_.Latency) {$_.ResponseTime}else{$_.Latency}}
        },
        @{name='Status'; e={
            if ($null -eq $_.Status) {
                if ($_.StatusCode -eq 0) {'Success'} else {'Not Success'}
            } else {
                $_.Status
            }
        }}

A: My problem is somehow related to yours, and as I found here the solution for my problem, I'm going to post it, just in case someone needs it:
I used to use Test-Connection's ResponseTimeToLive property, and it went away in PowerShell 7.x. So I analyzed the returned object, and found out that this property now is under Reply.Options.Ttl.


text:
Q: html on my ionic 4 app is displaying before my function is called I think I have a problem around synchronicity. I have a an array of matches(i.e. sports fixtures) that I read from firebase and display on screen. Before I want to display these I want to do some manipulation with the values by calling a function.
This function adds a 'Y' value to closestToToday field on the value that is as the name expects closest to today's date.
I'm confident my function addClosestToTodayFlag works correct based on console logs however my screen is displayed before the function is completed.
How do I explicitly make the displaying of the data on screen wait for my function to complete.
export class FixturesPage implements OnInit {

    public matches: Array<any>;
    constructor(private matchService: MatchService) {}

    ngOnInit(){
        this.matchService.getMatches().get().then(matchSnapshot => {
            this.matches = [];
            matchSnapshot.forEach(snap => {
                this.matches.push({
                    id: snap.id,
                    date: snap.data().date,
                    team: snap.data().team,
                    home: snap.data().home,
                    away: snap.data().away,
                    homeScore: snap.data().homeScore,
                    awayScore: snap.data().awayScore,
                    closestToToday: "N",
                });
                return false;
            });
            this.addClosestToTodayFlag(this.matches);
         });
    }

    private async addClosestToTodayFlag(fixtures: Array<any>)
    {
        var today = Math.floor(Date.now()/1000);
        var fixtureClosestToToday = Math.abs(today -
                 fixtures[0].date.seconds);

        fixtures[0].closetToToday = "Y";
        for (var i = 1; i < fixtures.length; i++)
        {
             var currentFixtureTimeToToday = Math.abs(today -
                 fixtures[i].date.seconds);
             /*
              * If the difference in time between today and the
                current fixture we are looping on is less than the
              * difference in time of the current shortest gap then we
                have a new fixture closest to Today
             */
             if (currentFixtureTimeToToday < fixtureClosestToToday)
                {
                    fixtureClosestToToday = currentFixtureTimeToToday;
                    fixtures[i].closetToToday="Y";
                    fixtures[i-1].closetToToday="N";
                }
            else{
                fixtures[i].closetToToday="N";
              }
        }
    }
}

A: When you push the matches to the this.matches attribute, the view gets updated immediately. So in order to only show the matches when your addClosestToTodayFlag function finished you should call it, wait for it and then update the matches array.
The way I would do it is to create a variable to store the "raw" matches and then call addClosestToTodayFlag with this, pushing the result to this.matches once it finished.
Insdead of this.matches = []; at the beginning of the function, create a temporary variable like recievedMatches, push to this variable and pass it to addClosestToTodayFlag.
inside addClosestToTodayFlag, return a promise containing the result data and
then push the result data to this.matches.
Update
Here you have a code-example (not tested but I think this should work). I would say you don't even need to make addClosestToTodayFlag async or return a promise, as it does not seem to perform any asyncronous tasks anyways.
export class FixturesPage implements OnInit {
    public matches: Array<any>;
    constructor(private matchService : MatchService) {}

    ngOnInit() {
        this.matchService.getMatches().get().then(matchSnapshot => {
            let matches = [];
            matchSnapshot.forEach(snap => {
                matches.push({
                    id: snap.id,
                    date: snap.data().date,
                    team: snap.data().team,
                    home: snap.data().home,
                    away: snap.data().away,
                    homeScore: snap.data().homeScore,
                    awayScore: snap.data().awayScore,
                    closestToToday: "N"
                });
                return false;
            });
            this.matches = this.addClosestToTodayFlag(matches);
        });
    }

    private addClosestToTodayFlag(fixtures : Array<any>): Array<any> {
        var today = Math.floor(Date.now() / 1000);
        var fixtureClosestToToday = Math.abs(today - fixtures[0].date.seconds);

        fixtures[0].closetToToday = "Y";
        for (var i = 1; i < fixtures.length; i++) {
            var currentFixtureTimeToToday = Math.abs(today - fixtures[i].date.seconds);
            /*
             * If the difference in time between today and the
               current fixture we are looping on is less than the
             * difference in time of the current shortest gap then we
               have a new fixture closest to Today
            */
            if (currentFixtureTimeToToday < fixtureClosestToToday) {
                fixtureClosestToToday = currentFixtureTimeToToday;
                fixtures[i].closetToToday = "Y";
                fixtures[i - 1].closetToToday = "N";
            } else {
                fixtures[i].closetToToday = "N";
            }
        }

        return fixtures
    }
}


text:
Q: Resolving XML entities without using lxml's "resolve_entities" option I have an XML file which has some entities that need to be resolved,
but I get the Sonar error https://rules.sonarsource.com/python/RSPEC-2755 when setting resolve_entities=True in lxml.etree.XMLParser.


text:
Q: Does anyone know of a Restlet Filter to JSONPify the response? I need to support JSONP by my Restlet JAX-RS server and the most natural and unobtrusive way to implement it is by having a dedicated Restlet Filter.
So, it occurred to me that I could not be the first one to be needing it. On the other hand google search yields nil.
Does anyone know anything about it?
P.S.
I know how to write it, in fact I am doing it right now. However, there are too much details to handle and looks like I am going to hardcode some expectations relevant to my server only. Naturally, I prefer something ready and tested.

A: There are now JsonpRepresentation and JsonpFilter classes available in the org.restlet.ext.json module, contributed by Mark.


text:
Q: Frequency counter is sorting list before I change it, when it should sort after it changes I have a frequency counter, to iterate through a list of times and tell me how often each number comes up. First, I run it through a function to remove the decimals using int(). I check this with a print statement at the bottom, it works fine. But for some reason, even though the frequency thing comes after I change the  the values with int(). Here is my code and I'll give some output.
from itertools import groupby
times = [1.23, 1.23, 2.56, 1.23, 1.23, 1.23, 1.23, 1.5, 4.32, 5.3, 2.5, 5.7, 3.4, 8.9, 8.9, 8.9]
newtimes = []
lentimes = len(times)

for time in times:
  #Rounds down every time
  time = int(time)
  #Adds time to new list
  newtimes.append(time)

setTimes = list(set(newtimes))

freqlist = [len(list(group)) for key, group in groupby(newtimes)]

print(newtimes)
print(lentimes)
print(setTimes)
print("Freqlist is " + str(freqlist))

the output looks like:
[1, 1, 2, 1, 1, 1, 1, 1, 4, 5, 2, 5, 3, 8, 8, 8]
16
[1, 2, 3, 4, 5, 8]
Freqlist is [2, 1, 5, 1, 1, 1, 1, 1, 3]

It took my a while to figure out what was up with the freqlist output, it's doing everything right, but it is doing times, not newtimes (where we drop the decimals), even though it should be after we drop the decimals. Any ideas? Thanks!

A: The problem is itertools.groupby works for consecutive similar items only. It requires a sorted input to work in the way you expect. You also don't need to create intermediary lists; instead, you can use sum with a generator expression:
freqlist = [sum(1 for _ in group) for key, group in groupby(sorted(newtimes))]

Sorting takes O(n log n) time. For an O(n) solution, you can use collections.Counter:
from collections import Counter

d = Counter(map(int, times))

Counter({1: 7, 2: 2, 4: 1, 5: 2, 3: 1, 8: 3})

Then, if you wish, extract values in a list after sorting by key:
keys, values = zip(*sorted(d.items()))

print(values)

(7, 2, 1, 1, 2, 3)


text:
Q: Error due to listener in web.xml when I am removing listener part from web.xml my project is running fine. Please let me know why?
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
      http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">

    <display-name>migration</display-name>

    <servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <listener>
        <listener-class>
           org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>
</web-app>

This is a spring web application in eclipse.

A: Only if you have two config xml files. Say,  SerivesContext.xml, ContextDAO.xml
If you have configured everything in one spring config file you don't need the
ContextLoaderListener, just the dispatcher servlet is sufficient.
If you use different ones , you can configure it as ,
   <servlet>
        <servlet-name>spring</servlet-name>
        <servlet-class>
            org.springframework.web.servlet.DispatcherServlet
        </servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:applicationContext.xml,WEB-INF/spring-security.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

A: ContextLoaderListener is optional. If all you're beans are in the (child) web context (DispatcherServlet) you can remove it.
How it works basically, Spring load a root WebApplicationContext via Spring's ContextLoaderListener and a child WebApplicationContext via Spring's DispatcherServlet. This results in a parent-child context hierarchy.
If you don't need anything in the root hierarchie then just keep the DispatcherServlet.
Further reading :

*

*Role/Purpose of ContextLoaderListener in Spring?

*ContextLoaderListener or not?

*and of course http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/

A: In Spring Web Applications, there are two types of container, each of which is configured and initialized differently. One is the Application Context and the other is the WebApplicationContext.
Purpose of ContextLoaderListener :
ContextLoaderListener is used to initialize Application Context. In this case, you will tell Spring to load all *-.context.xml files from the classpath. There is only one application context per application.
So you can configure this in web.xml as
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:*-context.xml</param-value>
</context-param>

Purpose of contextConfigLocation :
On the other hand, you have WebApplicationContext. WebApplicationContext is the child context of the Application Context. Each DispatcherServlet defined in a Spring web application will have an associated WebApplicationContext. You can initialize the WebApplicationContext as
<servlet>
    <servlet-name>dispatcher</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:dispatcher-servlet.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
</servlet>

NOTE : Here name of the XML must be like <servlet name>-servlet.xml. In our case name of servlet is dispatcher therefore, name of XML file is dispatcher-servlet.xml.
I hope this clears you when to use what & why.


text:
Q: JavaFX: how to hide empty table? I have a TableView and want to make it visible only if there is a any row in it. Is it possible to do it with css?

A: No, you can't hide the table only when it is empty by only using CSS.
In Java code, you could do:
table.managedProperty().bind(table.visibleProperty());
table.visibleProperty().bind(Bindings.isEmpty(table.getItems()).not());

The managed binding is only if you don't want your invisible table to take up layout space.
Sample App
Here is something you can play with understand how the visibility and managed settings work.

import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.*;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.VBox;
import javafx.scene.text.Font;
import javafx.stage.Stage;

public class TableViewHiding extends Application {

    private TableView<Person> table = new TableView<>();
    private final ObservableList<Person> data =
        FXCollections.observableArrayList(
            new Person("Jacob", "Smith", "jacob.smith@example.com"),
            new Person("Isabella", "Johnson", "isabella.johnson@example.com"),
            new Person("Ethan", "Williams", "ethan.williams@example.com"),
            new Person("Emma", "Jones", "emma.jones@example.com"),
            new Person("Michael", "Brown", "michael.brown@example.com")
        );

    private int addIdx = 0;

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) {
        final Label label = new Label("Address Book");
        label.setFont(new Font("Arial", 20));

        TableColumn<Person, String> firstNameCol = new TableColumn<>("First Name");
        firstNameCol.setMinWidth(100);
        firstNameCol.setCellValueFactory(
                new PropertyValueFactory<>("firstName"));

        TableColumn<Person, Boolean> highlightCol = new TableColumn<>("");
        highlightCol.setPrefWidth(10);
        highlightCol.setResizable(false);
        highlightCol.setCellValueFactory(
                new PropertyValueFactory<>("highlighted"));

        TableColumn<Person, String> lastNameCol = new TableColumn<>("Last Name");
        lastNameCol.setMinWidth(100);
        lastNameCol.setCellValueFactory(
                new PropertyValueFactory<>("lastName"));

        TableColumn<Person, String> emailCol = new TableColumn<>("Email");
        emailCol.setMinWidth(200);
        emailCol.setCellValueFactory(
                new PropertyValueFactory<>("email"));

        table.setItems(FXCollections.observableArrayList(data));
        table.getColumns().addAll(highlightCol, firstNameCol, lastNameCol, emailCol);

        final Button add = new Button("Add row");
        add.setMaxWidth(Double.MAX_VALUE);
        add.setOnAction(event -> {
            addIdx = (addIdx + 1) % data.size();
            table.getItems().add(data.get(addIdx));
        });

        final Button remove = new Button("Remove selected row");
        remove.setMaxWidth(Double.MAX_VALUE);
        remove.setOnAction(event ->
                table.getItems().remove(
                        table.getSelectionModel().getSelectedItem()
                )
        );
        remove.disableProperty().bind(
                Bindings.isEmpty(
                        table.getSelectionModel().getSelectedCells()
                )
        );
        final CheckBox manage = new CheckBox("Bind layout management and visibility");
        manage.selectedProperty().addListener((observable, wasSelected, isSelected) -> {
            if (isSelected) {
                table.setManaged(table.isVisible());
                table.managedProperty().bind(table.visibleProperty());
            } else {
                table.managedProperty().unbind();
                table.setManaged(true);
            }
        });

        table.visibleProperty().bind(Bindings.isEmpty(table.getItems()).not());

        final VBox layout = new VBox();
        layout.setAlignment(Pos.TOP_CENTER);
        layout.setSpacing(5);
        layout.setPadding(new Insets(10));
        layout.getChildren().addAll(
                label,
                table,
                remove,
                add,
                manage
        );

        Scene scene = new Scene(layout);
        stage.setScene(scene);
        stage.show();
    }

    public static class Person {
        private final SimpleStringProperty firstName;
        private final SimpleStringProperty lastName;
        private final SimpleStringProperty email;

        private Person(String fName, String lName, String email) {
            this.firstName = new SimpleStringProperty(fName);
            this.lastName = new SimpleStringProperty(lName);
            this.email = new SimpleStringProperty(email);
        }

        public SimpleStringProperty firstNameProperty() {
            return firstName;
        }

        public SimpleStringProperty lastNameProperty() {
            return lastName;
        }

        public SimpleStringProperty emailProperty() {
            return email;
        }
    }
}


text:
Q: error coming when i deploy smart contract on tronide.io Error encoding arguments: Error: invalid address (argument="address", value="", code=INVALID_ARGUMENT, version=address/5.6.1) (argument=null, value="", code=INVALID_ARGUMENT, version=abi/5.6.4)
i

i got this this error when i deploy smart contract on tronide.io please help me

please help me   xxxxx


text:
Q: Facebook Insights API + Get all metric fields (with definition) + page object with Facebook Graph Api we can get all the fields definition by adding "?metadata=1" in the query.
With Facebook Insights I don't see how to retrieve all the metric fields (with their definition, code...)
Have you any idea to get / download this list in a usable format (csv, xml, text..)
Thanks.


text:
Q: Can I disable TCP windows scaling for a single application? In Linux, can an application enable or disable TCP window scaling for TCP/IP connections created by the application? As opposed to a system-wide modification through sysctl using the net.ipv4.tcp_window_scaling parameter.

A: No you can't. There are no per-process APIs for sockets at all, just per-socket APIs and global kernel configurations.
But you don't need to modify the scale settings directly. You just need to set the socket receive buffer size you want prior to connecting. Then the appropriate window scale is negotiated during the connect handshake. If you want mo window scaling! make sure your socket receive buffer is < 64k before connecting. In the case of accepted sockets, that is set on the listening socket.


text:
Q: Openshift uploaded image via app get deleted after git push I was building an app which allows user to upload an image for their recipe. So far i dont have a problem in uploading it to the server. The only problem i encounter is that whenever i git push my app (for php files) the images i uploaded were also deleted.
I also read some answers that it is about creating a symbolic link? Something like that.

*

*I make a folder /.openshift/action-hooks/

*Im gonna create a file pre-build there and will include the code that will create a symlink there.

Im a newbie in using openshift so please bear with me just needed a brief and clear explanation on how to create a persistent storage in openshift even after a git push.
Advanced thanks for those who will kindly answer my question.


text:
Q: Execute a file using OS sampler in JMeter on a RHEL 8 Machine Have a .net core library Linux compatible on a Linux machine. I can execute it locally from terminal and getting the expected result. But while executing from JMeter using a OS sampler it is failing.
From Terminal: Running Fine

JMeter Settings:

Fetching the Response Body: (which should be 352 for example from the above terminal)

JMeter it is failing:

Check the file location and permission, everything is in place. What I have missed here any help ?
After change:
I changed as suggested and still facing the issue,

Error details,

A: I think you need to invoke a shell instead of trying to execute your command directly, something like:

Also if you open the OS Process Sampler in the View Results Tree listener you will see the output or in case of failure the failure reason
More information: How to Run External Commands and Programs Locally and Remotely from JMeter

A: I guess you misinterpret both Dimtri and User729 comment, you need to add both places and it should work.


text:
Q: SSRS expression - query from dataset, with group Let's say for each student, I have a note of an exam and I need to calculate the percentile rank... of each question, each group of question and total exam (each student).
Do to that I need, for each question, group of question, and total exam:
1) x = the score (That I have of course)
2) the count of score above x
3) the count of score equal to x
4) the count total of score
Do to that it looks like I need to use sub-select for me, in a T-SQL query. Calculate everything inside a big dataset and use it.
Is there a way to acheive that inside SSRS?

A: I found that interesting post about the percentile function in SSRS, I will give it a try.
https://www.katieandemil.com/ssrs-percentile-function-2008-r2-calculation-custom-code-example?tab=article
I had to create another function to return the rank, but the main idea was there:
Public Shared Dim values As System.Collections.ArrayList

Public Shared Function AddValue(ByVal newValue As Decimal) As Decimal
    If (values Is Nothing) Then
       values = New System.Collections.ArrayList()
    End If
    values.Add(newValue)
    AddValue = values.Count
End Function

Public Shared Function GetRankPercentile(ByVal CurrentValue As Decimal) As Decimal
    Dim countTotal As Integer = values.Count 'nombre total de données
    Dim countGreater As Integer = 0
    Dim countEqual As Integer = 0
    Dim iLoop As Integer
    Dim tmpArray as system.array
    tmpArray = values.ToArray()

    For iLoop = LBound(tmpArray) To UBound(tmpArray)
       If tmpArray(iLoop)  CurrentValue Then countGreater = countGreater + 1
       If tmpArray(iLoop) = CurrentValue Then countEqual = countEqual + 1
    Next

    GetRankPercentile = Math.Ceiling((countGreater + (countEqual / 2)) / countTotal * 5)
End Function


text:
Q: Can you get a page access token for a page you do not own, ie you are a third party ? (FB insights) Would like to use these FB Graph API insights endpoints for the Nike FB page.
https://developers.facebook.com/docs/graph-api/reference/v2.12/insights
But, every time I go to the developers.facebook.com tools and generate a new "Page Access Token" and then try to type in the endpoint, I get this error:
{
  "error": {
    "message": "(#190) This method must be called with a Page Access Token",
    "type": "OAuthException",
    "code": 190,
    "fbtrace_id": "CWg3K5qBxk+"
  }
}

A: Page Tokens are for Page owners only. Think about it this way: Would you be able to get access to Google Analytics of some website you do not own? Of course there is also no way to access the Facebook Insights of a Facebook Page you do not own.

A: I believe you cant get access to info insights.
However you can get some info from the API
For instance:
'Nike?fields=fan_count,pharma_safety_info,phone,description'
returns:
{
  "fan_count": 32788277,
  "description": "Just Do It. ",
  "id": "15087023444"
}


text:
Q: Change the Value in a Column to Change from a String to a Number on Insery I have a table which I have cut down into basic fields, it is called Customer
ID | Name   | Type
1 | Smith     | 2
I want to create a trigger on INSERT that will change the value of the inserting Type, into a number example:
INSERT INTO Customer (Name,Type) VALUES ('Jones', 'Recommended')

The Type field should be a number and it is set as an INT column. I do not want to change this away from INT.
How can I force the word Recommended to be changed to '0' a zero?

A: In Theory :
This is the trigger :
ALTER TRIGGER [dbo].[CustomersInsert] ON [dbo].[Customer]
INSTEAD OF INSERT
AS BEGIN

    INSERT Into Customer (Name,Type)
    SELECT
    inserted.[Name],
    Isnull([Types].Id, 0)
    FROM inserted
    Left Join [dbo].[Types] on inserted.[Type] = [Types].Caption
END

The [dbo].[Types] is for keep Types.
But in real :
You can't execute INSERT INTO Customer (Name,Type) VALUES ('Jones', 'Recommended')
because Type is INT and 'Recommended' is not.


text:
Q: Show that $\sqrt{1+x^2}$ is strictly convex How can I show $f(x)=\sqrt{1+x^2}$ is strictly convex? Can I use the fact that $x^2$ is strictly convex to prove this?
Additionally, is the function uniformly convex?
Edit: Although the second derivative of f(x) is always positive, is there any way to prove the convexity algebraically?

A: You can use the fact that $f$ is the Euclidean norm evaluated along a line excluding the origin.
Using the Cauchy-Schwarz inequality, you can show that for $u, v \in \mathbf{R}^n$, the triangle inequality $\lVert u + v \rVert_2 \leq \lVert u\rVert_2 + \lVert v\rVert_2 $ is strict unless $u = \kappa v$ for some $\kappa \in \mathbf{R}$.
Hence, we have that, for $\lambda \in (0, 1)$ and $x, y \in \mathbf{R}$,
\begin{align*}
f(\lambda x + (1 - \lambda)y)
&= \lVert \lambda (1, x) + (1 - \lambda)(1, y)\rVert_2 \\
&\leq \lvert\lambda\rvert \lVert(1, x)\rVert_2 + \lvert 1 - \lambda \rvert \lVert(1, y)\rVert_2 \\
&= \lambda f(x) + (1 - \lambda) f(y),
\end{align*}
where the inequality is strict unles $\lambda(1, x) = \kappa(1 - \lambda)(1, y)$ for some $\kappa \in \mathbf{R}$.
But, equating the first entries of these vectors, this can only happen when $\lambda = \kappa(1 - \lambda)$ and so $x = y$.
Thus, $f$ is strictly convex.


text:
Q: Commutativity of the Cross Product in Singular Cohomology Massey's Singular Homology Theory claims that if $X,Y$ are topological spaces, $G_1,G_2$ abelain groups, and $u \in H^p(X;G_1)$ and $v \in H^q(Y;G_2)$, then $$t^*(u \times v) = (-1)^{pq}v \times u,$$
where $t : Y \times X \to X \times Y$ is given by $(y,x) \mapsto (x,y)$. This identity doesn't make sense to me, since the left hand side is an element of $H^{p+q}(Y \times X;G_1 \otimes G_2)$ while the right hand side is an element of $H^{p+q}(Y \times X; G_2 \otimes G_1)$. Am I missing something or do we need to compose with a homomorphism $G_1 \otimes G_2 \to G_2 \otimes G_1$ somewhere to make this work?


text:
Q: How to generate diagram for multiple tables I've 4 entity Funds, Composition, Instruments, Cash
I want to design a model with it possible one composition be a fund or an instrument or a cash
tables:
Funds(id_pk,name)
Composition(id_pk, units, and fk id to others tables (funds,instrument,cash)
Instrument(id_pk,name,maturity_date)
Cash(id_pk,name,currency)
How can i design this???
@Entity
public  class Fund implements Serializable {

    @OneToMany(targetEntity=Composition.class)
    private Collection<Composition> composition1;
    public Fund(){
    }

   public Collection<Composition> getComposition1() {
        return this.composition1;
    }

  public void setComposition1 (Collection<Composition> composition1) {
        this.composition1 = composition1;
    }

@Entity
public  class Instrument implements Serializable {

    public Instrument(){

    }
}
@Entity
public  class Cash implements Serializable {

    public Cash(){

    }
}

@Entity
public  class Composition implements Serializable {

    @OneToOne(targetEntity=Fund.class)--????
    private Object position --here is my problem . may be Fund, Cash or Instrument

    public Composition(){

    }

}


text:
Q: Assign permissions to a user on tables with a certain prefix I'd like to assign a user all privileges on tables which have a specific prefix, eg. 'abc_'
I'm aware of the use of the wildcard to select all tables thus:
GRANT ALL ON dbname.* TO ...

Essentially, what I'd like to do is:
GRANT ALL ON dbname.abc_* TO ...

This doesn't work so I'm wondering if there is a solution, perhaps using LIKE? (Which I've tried; as yet to no avail).

A: Nope, sorry.  Have to do them one at a time (with, of course, the option to do so programatically).

A: $ php -f pcre_grant.php -- localhost root password database user1 abc_ ALL

pcre_grant.php will look like:

<?php

list($script, $db_host, $db_username, $db_password, $db_name, $regexp, $username, $perms) = $argv;

$link = mysql_connect($db_host, $db_username, $db_password);
mysql_select_db($db_name);

$result = mysql_query("SHOW TABLES");
while($row = mysql_fetch_row($result)){
    if(preg_match('/'.$regexp.'/',$row[0]))
        mysql_query("GRANT ".$perms." ON `".$db_name."`.`".$row[0]."` TO ".$username);
}

mysql_close($link);
?>


text:
Q: trying to insert document into my collection, but i m getting "errmsg" : "Document failed validation", code: "121" i am learning MongoDB, I have created a collection and now when i am trying to insert document its showing "errmsg" : "Document failed validation", code: "121"
Following is my collection code:
db.createCollection( "personprofiles", {
   validator: { $jsonSchema: {
      bsonType: "object",
      required: [ "PersonID", "PersonName", "Gender", "DOB", "Occupation", "Noofchildren", "ProfileType", "Purge" ],
      properties: {
         PersonID: {
            bsonType: "number",
                description: "must be an integer and is required"
         },
         PersonName: {
            bsonType: "string",
                description: "must be an string and is required"
         },
         Gender: {
            enum: [ "Male", "Female" ],
            description: "can only be one of the enum values"
         },
            MartialStatus: {
            enum: [ "Single", "Married" ],
            description: "can only be one of the enum values"
         },
            DOB : {
                bsonType: "date",
                description: "must be an date and is required"
            },
            Occupation: {
            bsonType: "string",
                description: "must be an string and is required"
         },
            Noofchildren: {
            bsonType: "number",
                description: "must be an integer and is required"
         },
            ProfileType: {
            enum: [ "Gymnast", "Judge", "CompetitionDirector", "Organizers", "Coach", "Administrator", "Volunteers" ],
            description: "can only be one of the enum values"
         },
            Purge: {
            enum: [ "Yes", "No" ],
            description: "can only be one of the enum values"
         },
            Addresses: {
                bsonType: "array",
                description: "must be an array and is required",
                required: [ "AddressID", "AddressType", "AddressLine1", "AddressLine2", "Area", "Locality","City","State","Country","PostalCode"],
                properties: {
            AddressID: {
                bsonType: "number",
                description: "must be an integer and is required"
                    },
            AddressType: {
            enum: [ "Permanent", "Temporary", "Correspondence", "Office" ],
            description: "can only be one of the enum values"
         },
            AddressLine1: {
                bsonType: "string",
                description: "must be an string and is  required"
            },
            AddressLine2: {
                bsonType: "string",
                description: "must be an string and is required"
            },
            Area: {
                bsonType: "string",
                description: "must be an string and is  required"
            },
            Locality: {
                bsonType: "string",
                description: "must be an string and is  required"
            },
            City: {
                bsonType: "string",
                description: "must be an string and isrequired"
            },
            State: {
                bsonType: "string",
                description: "must be an string and is required"
            },
            Country: {
                bsonType: "string",
                description: "must be an string and is required"
            },
            PostalCode: {
                bsonType: "string",
                description: "must be an string and is required"
            }
                }
            },
            ContactNumbers: {
                bsonType: "array",
                description: "must be an array and is required",
                required:[ "ContactID", "ContactType"],
                properties: {
                    ContactID: {
                        bsonType: "number",
                        description: "must be an integer and is required"
                    },
                ContactType: {
            enum: [ "Home", "Mobile", "Office", "CareOf", "Emergency" ],
            description: "can only be one of the enum values and is required"
         },
            ContactNumber: {
                bsonType: "object",
                description: "must be an string and is required",
                required: ["CountryCode", "RegionCode", "PhoneNumber"],
                properties:{
                    CountryCode: {
                        bsonType: "string",
                        pattern: "^[+0-9]{2,4}$",
                        description: "must be an string and is required"
                    },
                    RegionCode: {
                        bsonType: "string",
                        pattern: "^[0-9]{3}$",
                        description: "must be an string and is required"
                    },
                    PhoneNumber:
                    {
                        bsonType: "string",
                        pattern: "^[0-9]{10}$",
                        description: "must be an string and is required"
                    }
                }
            }
                }
            },
            Email:{
                bsonType: "array",
                description:"must be an array and is required",
                required:["EmailID", "EmailType"],
                properties:{
                    EmailID: {
                        bsonType: "number",
                        description:"must be an integer and is required"
                    },
                    EmailType:{
                        bsonType: "string",
                        pattern : "^([a-zA-Z0-9_\\-\\.]+)@([a-zA-Z0-9_\\-\\.]+)\\.([a-zA-Z]{2,5})$",
                        description: "must be a string and match regular expression pattern"
                    }
                }

            }
        }
   } }
} )

This is the document i am trying to insert
db.personprofiles.insert({
"PersonID": 1001,
"PersonName": "john simon",
"Gender": "Male",
"MartialStatus": "Single",
"DOB": "1997-8-1",
"Occupation": "Service",
"Noofchildren": 0,
"ProfileType": "Administrator",
"Purge": "yes",
"Addresses":[{
    "AddressID": 1,
    "AddressType":"Permanent",
    "AddressLine1": "101/4",
    "AddressLine2":"sundar nagar",
    "Area": "kalina",
    "Locality": "Santacruz(east)",
    "City": "Mumbai",
    "State": "Maharashtra",
    "Country": "India",
    "PostalCode": "400055"
}],
"ContactNumbers": [{
    "ContactID":1,
    "ContactType":"Home",
    "ContactNumber":{
        "CountryCode": "+91",
        "RegionCode": "022",
        "PhoneNumber": "700383555"
    }
}],
Email:[{
    EmailID: 1,
    EmailType: "johnxyz@gmail.com"
}]
})

collection has been created successfully, the only issue i am having to insert  a document. Unable to figure out error.
Someone can help me? Look like i forget something.


text:
Q: Weak convergence implies uniform convergence of characteristic functions on bounded sets. Let $\{\mu_n:n\in\mathbb N\}$ and $\mu$ be distributions on $\mathbb R$, and let $\{\phi_n:n\in\mathbb N\}$ and $\phi$ be their respective characteristic functions.
We can easily show using a direct application of the so called continuous mapping theorem that if $\mu_n\to\mu$ weakly, then $\phi_n\to\phi$ pointwise. I also know that if $\mu_n\to\mu$ weakly,
then for any bounded set $B\subset\mathbb R$,
we have that $\phi_n\to\phi$ uniformly. However, my attempts to understand why this is true have so far been in vain.
I've tried to find upper bounds for
\begin{align*}
\sup_{t\in[a,b]}\left|\int_{-\infty}^{\infty}e^{itx}~\mu_n(dx)-\int_{-\infty}^{\infty}e^{itx}~\mu(dx)\right|,
\end{align*}
but it always ends up being too small or too big. Any hint would be greatly appreciated.

A: Hints

*

*Show that the sequence $(\mu_n)_{n \in \mathbb{N}}$ is tight, i.e. for any $\varepsilon>0$ there exists a compact set $K \subseteq \mathbb{R}$ such that $$\mu_n(K^c) \leq \varepsilon$$ for all $n \in \mathbb{N}$.

*The tightness entails that $(\phi_n)_{n \in \mathbb{N}}$ is uniformly equicontinuous. To prove this, note that $$|\phi_n(\xi)-\phi_n(\eta)| \leq \int_K |1-e^{\imath \, (\eta-\xi) \cdot x}| \, \mu_n(dx) + \int_{K^c} |1-e^{\imath \, (\eta-\xi) \cdot x}| \, \mu_n(dx).$$ Now use that the first term is small for $|\eta-\xi|<\delta$ and the second one is bounded by $2 \mu_n(K^c)$.

*It follows from the uniformly equicontinuity and the pointwise convergence that $\phi_n \to \phi$ locally uniformly; hence, uniformly on compact sets.


text:
Q: Redirect User after succesful authenication - Flutter I am trying to redirect the user to the app home screen after a succesful authentication. In my code I tried to handle the user flow through the future class but I have not been succesful.
User repository
import 'dart:convert';
import 'package:flutter_session/flutter_session.dart';
import 'package:http/http.dart' as http;

//Authenication: confirms if password and mail matches with server.
Future<UserInfo> authenticate(String email, String password) async {
  final response = await http.post(
    Uri.parse('api url'),       //Makes the post request
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{                                    //Input values from the form given to the json of the request.
      'email': email,
      'password': password,
    })
  );

  UserInfo id = UserInfo.fromJson(jsonDecode(response.body));             //Call the function that creates the class with the output of the json

  if (response.statusCode == 200) {
    return UserInfo.fromJson(jsonDecode(response.body));
  }
  else if (response.statusCode == 200) {
    await FlutterSession().set('id', id);                                 //Saves the id to the session variables
  }
  else {
    throw Exception('Error');
  }
}

class UserInfo {

  final int id;

  UserInfo({this.id});

  factory UserInfo.fromJson(Map<String, dynamic> json) {                  //Parses through the response´s json and creates a class with that value
    return UserInfo(
      id: json['id_usuario'] as int,
    );
  }
}

In here I make a http post request and create a class that contains some of the json instances in return. I also store the instance id into the flutter_session plugin for later queries like user name.
Login page
import 'package:flutter/material.dart';
import 'package:treelife_flutter/user/repository/user_repository.dart';
import 'package:treelife_flutter/user/ui/screens/sign_in_screen.dart';
import 'package:treelife_flutter/user/ui/widgets/background.dart';
import 'package:treelife_flutter/widgets/button_back.dart';
import 'package:treelife_flutter/widgets/button_green.dart';
import 'package:treelife_flutter/widgets/text_input.dart';

import '../../../tree_life_cupertino.dart';

class LogInScreen extends StatefulWidget {

  @override
  _LogInScreenState createState() => _LogInScreenState();
}

class _LogInScreenState extends State<LogInScreen> {

  final _loginFormKey = GlobalKey<FormState>();
  final _mailController = TextEditingController();
  final _passwordController = TextEditingController();
  Future<UserInfo> _futureUserInfo;

  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        resizeToAvoidBottomInset: false,                                 // Avoid overfloww when keyboard shows
        body: Stack(
          children: [
            Background(
              height: null,
              color: Colors.white,
            ),
            Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                Column(
                  children: [
                    Row(
                      children: [
                        ButtonBack(
                          onPressed: () {
                            Navigator.push(
                              context,
                              MaterialPageRoute(builder: (context) => SignInScreen() )
                            );
                          },
                        )
                      ],
                    ),
                    Row(                                                 // Título
                      mainAxisAlignment: MainAxisAlignment.start,
                      children: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(30, 30, 30, 0),
                          child: Text(
                            "Ingresa",
                            style:  Theme.of(context).textTheme.headline1,
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
                SizedBox(
                  height: 200,
                  width: double.infinity,
                  child: Padding(
                    padding: const EdgeInsets.only(bottom: 40, top: 40),
                    child: Image.asset('assets/icons/logo_treelife.png'),
                  ),
                ),
                Form(
                  key: _loginFormKey,
                  child: Expanded(
                    child: Column(
                      children: [
                        Container(
                          width: double.infinity,
                          child: Padding(
                            padding: const EdgeInsets.fromLTRB(30, 0, 30, 30),
                            child: TextInput(
                              controller: _mailController,
                              hint: 'Email',
                              suffixIcon:'assets/icons/at.png'
                            ),
                          ),
                        ),
                        Container(                                         //  Primer campo registro: contraseña
                          width: double.infinity,
                          child: Padding(
                            padding: const EdgeInsets.fromLTRB(30, 0, 30, 30),
                            child: TextInput(
                              controller: _passwordController,
                              hint: 'Contraseña',
                              suffixIcon:'assets/icons/password.png'
                            ),
                          ),
                        ),
                        ButtonGreen(                                             // Botón Registro
                          marginTop: 30,
                          marginLeft: 30,
                          marginRight: 30,
                          marginBottom: 30,
                          text: "¡Plantemos árboles!",
                          fontColor: Colors.white,
                          fontSize: 20,
                          onPressed: () {
                            setState(() {
                              _futureUserInfo = authenticate(_mailController.text, _passwordController.text);
                            });
                          },
                          width: double.infinity,
                          height: 50,
                          boxColor: Color(0xFFD2E1BD),
                        ),
                      ],
                    ),
                  ),
                ),
                Padding(
                  padding: const EdgeInsets.only(top: 40),
                  child: Image.asset('assets/sign_in/login_illustration.png'),
                )
              ],
            )
          ],
        ),
      ),
    );
  }
  FutureBuilder<UserInfo> buildFutureBuilder() {
    return FutureBuilder<UserInfo>(
      future: _futureUserInfo,
      builder: (context, snapshot){
        if (snapshot.hasData) {
          Navigator.push(
            context,
            MaterialPageRoute(builder: (context) => TreelifeCupertino()));
        } else if (snapshot.hasError) {
          return Text('${snapshot.error}');
        }
        return CircularProgressIndicator();
      }
    );
  }
}

In here I followed the flutter send data to the internet documentation where I try to apply come logic through the buildfuture function but instead I added the navigate.of(context) to redirect if the authentication was succesful.


text:
Q: How to access UINavigationController in react native? I have created a View where the NavigationBar comes from Obj-c(Native code) and the rest of the view comes from React Native.
Now in the react native view, i have a link which should show the content in a new screen with the navigation experience. I am able to show the content but unable to find a way to change navBar title and show back button on the navBar.
Can you please let me know how we can get access to NavigationBar(Obj-c) in ReactNative?

A: I don't believe React Native supports this.  You cannot take an object created in one language and access it in another.  It would be a better idea to create your navigation bar in your JS and use it throughout your app.  That even allows you to propagate that UI to your android apps.


text:
Q: "Infinite scroll"-like. Make it fire before bottom I'm using this small script to define if the user've scrolled to the bottom
$(window).scroll(function(){

    if($(window).scrollTop() == $(document).height() - $(window).height()){
        if(!taskFired){
            taskFired = true;
            $("#loading_gif").css("display", "block");
            setTimeout(loadMoreMabs, 1500);
        }
    }

});

But I wan't it to fire the function loadMoreMabs before the bottom is reached. How would I do that? I've tried to + and - with the heights, but it's like I'm experimenting with something I don't really get.

A: What your question title suggests you want
Subtract a value from $(document).height() something like 50 to start loading 50 pixels from the bottom.
if($(window).scrollTop() <= ($(document).height() - 50) - $(window).height()){

Here is a little demo in jsfiddle, I made a dummy function to fulfill the loadMoreMabs function
http://jsfiddle.net/sg3s/UwXaw/
Fires every time you are near the bottom and the 1500ms expire.
Now to make it fire (immediatly) ONLY if it reaches the very bottom.
(since it actually suggests something else)
http://jsfiddle.net/sg3s/UwXaw/1/
The trick is probably the >= in the equation, making sure it fires if the scrollTop is the same or HIGHER than the document minus the window height...


text:
Q: Evitar mais de um cadastro no banco de dados Estou tento problemas, pois estou fazendo um sistema de comunidade onde o usuário se registra e compartilha histórias.
Mais quando fui testar cliquei em registrar 2 vezes e 2 vezes ele foi para o banco de dados mesmo com um função verificando.
MYSQL:
CAMPO    |  TIPO
ID       |  INT (AutoIncrement)
USERNAME |  VARCHAR(12)
PASSWORD |  VARCHAR(12)
EMAIL    |  TEXT

Quando se registra ele executa o seguinte código:
<?php
    include ('mysql_connector.php');

    $username = "";
    $email = "";
    $password = "";

    if(!empty($_POST)){

        if(!empty($_POST['username']) && !empty($_POST['email']) && !empty($_POST['password']) ){

            $msg = "";

            try{

                $username = $_POST['username'];
                $email = $_POST['email'];
                $password = $_POST['password'];

                if(!exite_ja_registrado()){
                    $cmd = "INSERT INTO `users`(`id`, `username`, `email`,`password`) VALUES(NULL, '$username', '$email', '$password')";
                    $result = mysql_query($cmd);
                    if(!$result){
                        echo $error = mysql_error($result);
                        echo "";
                    }
                }

                else if (exite_ja_registrado()){
                    echo "";
            }
        }
    }

?>

<?php include('google-analytics.php'); ?>

<form method="POST">
    <input type="text" placeHolder="Email" name="email" />

    <input type="text" placeHolder="usuário" name="username" />

    <input type="password" placeHolder="Senha" name="password" />

    <input type="submit" value="Registrar" />
</form>

Mas mesmo depois de pressionar inúmeras vezes ele coloca os dados novamente no mysql.
Faça o teste => http://brasilr2.net76.net/analytics/register.php
function exite_ja_registrado(){
            $cmd = "SELECT * FROM `users` WHERE `email`='$email' AND `password`='$password' AND `username`='$username'";
            $result = mysql_query($cmd);
            if(mysql_num_rows($result) == 1){ return true; }
            else { return false; }
        }

Refiz o código inteiro e agora ele não adiciona mais de um valor, mas também não avisa ao usuário que já tem os dados cadastrados:

<?php
    include ('mysql_connector.php');

    $username = "";
    $email = "";
    $password = "";

    if($_SERVER['REQUEST_METHOD'] == "POST" && !empty($_POST)){

        if(!empty($_POST['username']) && !empty($_POST['email']) && !empty($_POST['password']) ){

            $username = $_POST['username'];
            $email = $_POST['email'];
            $password = $_POST['password'];

            $existe = ExistUser($username, $email);

            if(!$existe){
                $cmd = "INSERT INTO `users`(`id`, `username`, `email`,`password`) VALUES(NULL, '$username', '$email', '$password')";
                $result = mysql_query($cmd);
                if(!$result){
                    echo "";
                }
            }

            else{
                echo "";
            }
        }
    }

    function ExistUser($u, $e){

        $cmd = "SELECT * FROM `users` (`email`, `username`) WHERE `username`='$u' AND `email`='$e'";
        $result = mysql_query($cmd);
        $rows = mysql_num_rows($result);

        if(1 == $rows){
            return true;
        }

        else{
            return false;
        }
    }
?>

<title>Registre-se para continuar...</title>

<?php include('google-analytics.php'); ?>

<form method="POST">
    <input type="text" placeHolder="Email" name="email" />

    <input type="text" placeHolder="usuário" name="username" />

    <input type="password" placeHolder="Senha" name="password" />

    <input type="submit" value="Registrar" />
</form>

E agora da esse erro:

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/a1478344/public_html/analytics/register.php on line 40

A: Consegui solucionar da seguinte maneira:
Executando a query no banco de dados para ver se o usuario e email já existem! se sim retorna true.
se não retorna false.
function ExisteUsuario($u, $e){

        $cmd = "SELECT * FROM `users` WHERE `username`='$u' AND `email`='$e'";
        $result = mysql_query($cmd);
        $rows = mysql_num_rows($result);

        if(1 == $rows){
            return true;
        }

        else{
            return false;
        }
    }

E na consulta do registro coloca-se o seguinte:
utiliza $existe = ExisteUsuario(nome de usuario, email);
se for false ele executa uma query adicionando o usuário ao DB.
se for true ele alerta dizendo que não existe.
$existe = ExisteUsuario($username, $email);

            if(!$existe){
                $cmd = "INSERT INTO `users`(`id`, `username`, `email`,`password`) VALUES(NULL, '$username', '$email', '$password')";
                $result = mysql_query($cmd);
                if(!$result){
                    echo "";
                }

                else{
                    echo "";
                }
            }

            else if($existe){
                echo "";
            }

A: Se o código da sua função exite_ja_registrado() está em outro arquivo, você precisa fazer um include dele no register.php da mesma forma que você fez com o mysql-connector.php
Para ocultar o botão você pode fazer uma chamada no jquery pra ocultar o botão


text:
Q: Using AT commands in PHP script on MacOS I'm working on a PHP script that could send and receive SMS on my mac, using a HUAWEI GSM modem.
First I tried to use AT commands directly in the Terminal and I succeeded. Here are the command lines I use to do it :
Verifying on which ports is my Huawei modem :
ls -al /dev/tty.*
Opening a AT command session :
screen /dev/tty.HUAWEIMobile-Modem 115200
Then I can use AT commands and it works fine.
But as I am a newbee with Terminal, I don't understand why I have to use a screen command to open the AT command session (I found it on a webpage and it works, but why ? ).
And what if I would like to open this AT command session without using a screen command ?
Then I switch to my PHP script. I try to use a very nice one I found on this page (http://gonzalo123.com/2011/03/21/howto-sendread-smss-using-a-gsm-modem-at-commands-and-php/) and which is known to work fine on Linux. So it should also work on MacOS isn't it ?
This script first ask for the device, so I gave it that, according to the command I used to open the AT command session in the Terminal :
$serial->deviceSet("/dev/tty.HUAWEIMobile-Modem");
When I launch the script, it returns this error :
Warning: Specified serial port is not valid in /Users/iMac1/Documents/MAMP/SMSing/solution 2/sms/serial.php on line 72
So I check line 72 where is the first command using the $device variable. Error here is logical. The command :
$this->_exec("stty -F " . $device)
I find it strange because of the -F parameter.
So I tried to change it for :
$this->_exec("stty -f " . $device)
Then when I launch my script, it does nothing and even never ends.
I get stuck here.
Could someone help me ?
Thank you in advance
Louis

A: Use phpserial class that is on  http://www.phpclasses.org/browse/file/17926.html using the code below.
But i strongly recommend using Python and Gammu for this instead of PHP. PHP is not designed for OS operations. Python does.
<?php
error_reporting(0);

$time = time();
$mensaje = "Hola este es un mensaje desde Mac ".$time;
$pais = "+58";
$numero = "00__myphone__00";

include "../php_serial.class.php";
$serial = new phpSerial();
$serial->deviceSet("/dev/tty.HUAWEIMobile-Modem");
$serial->deviceOpen('r+');
$serial->confBaudRate(9600);

$serial->sendMessage("AT+CMGF=1\r",1);
$serial->readPort();

$serial->sendMessage('AT+CMGS="'.$pais.$numero.'"'."\r",1);
echo $serial->readPort();

$serial->sendMessage($mensaje."\r",1);
echo $serial->readPort();

$serial->sendMessage("\x1a",2);
echo $serial->readPort();

// If you want to change the configuration, the device must be closed
$serial->deviceClose();

?>

A: this is a script for python to send a SMS without problems. For this you need to install Gammu and using the console configurate the USB Dongle you want to use. Solving it purely with python is not the best way. see the code below is a working sample to execute this ( python sms.py ) on the console.
sms.py
#!/usr/bin/env python

import gammu
import sys

sm = gammu.StateMachine()
sm.ReadConfig(2) #is gammu config
sm.Init()

to = '+5844444'
body = 'Your message'

message = {
   'Text': body,
   'SMSC': {'Location': 1},
   'Number': to,
}

try:
  # Send SMS if all is OK
  sm.SendSMS(message)
  print 'Success, SMS was Sent'

except gammu.ERR_UNKNOWN:
   # Show error if message not sent
   print 'Error, SMS not Sent'


text:
Q: How to export huge postgresql database in batches? I have a huge database of over 20 million rows. I can export the whole database (which takes hours), but when I try to filter the data using python (pandas) pycharm fails (due to memory issues).
Is there a way to export the database in batches of 2 million rows for an example? Export 2mil, then other 2mil and have 10 files of 2 million rows at the end? This way I can filter every file using python (pandas) and I won't have memory issues.
Thanks!

A: 20 million rows isn't that many.  Unless each individual row is quite large or you are sending over a slow network, exporting should take minutes, not hours.
If it is a single table you want to split, that is a better task for COPY, not pg_dump.
psql -c 'copy pgbench_accounts to stdout'|split -l 2000000

You would type it at a terminal command prompt, just like you would pg_dump.  It will send out the table's data just like pg_dump does (except it does just the data, and for just one table), but then the linux command split breaks it up into files of 2e6 lines each.
Well, I see you didn't specifically mention pg_dump in your post.  When you said "export", what did you mean by that?  I had assumed you meant pg_dump.

A: You can use pg_dump to only extract one or more tables or exclude tables if that is going to help


text:
Q: How to maintain records of virtual money in MySQL? I'm pretty new to PHP use of MySQL and I needed to learn about the Balance System (Virtual Money) to make my website functional so, first of all I got the inserting money system working:
 /* MySQL Begin */

$_CONFIG['mysql']['dbhost'] = 'localhost';

$_CONFIG['mysql']['dbuser'] = '********';

$_CONFIG['mysql']['dbpw'] = '*******';

$_CONFIG['mysql']['dbname'] = 'user';

$_CONFIG['mysql']['tbname'] = 'member';

$_CONFIG['mysql']['field_username'] = 'username';

$_CONFIG['TMN']['point_field_name'] = 'balance';

/* Amount received after topup */
$_CONFIG['TMN'][50]['point'] = 50;
$_CONFIG['TMN'][90]['point'] = 90;
$_CONFIG['TMN'][150]['point'] = 150;
$_CONFIG['TMN'][300]['point'] = 300;
$_CONFIG['TMN'][500]['point'] = 500;
$_CONFIG['TMN'][1000]['point'] = 1000;

/* Connecting the topup service */
define('API_PASSKEY', 'NSTPasskey01');

And now, I needed to make a shop system which means that it involves checking for user balance and if the balance is enough it triggers the minus function which subtracts user balance from certain amount and runs the command. I needed help in this part, anyone got any good way to do this?

A: Use the following code:
$_uzlang_conflig: @symbLock(3.14)
$_tty = roungR × 2
Set var sbtr = sq(R+uzlang)
If sbtr = bal(y)
Mov ad > bal()
Cre bal = "user" + "account"
Gen random() = auto.block
Block.add = ha(256) to func(D)
Wait for block(bal);
Do loop = sbtr.auto.gen