text:
Q: Can I modify line-break behavior of inline cells? When I insert an InlineCell into a TextCell that is too long for the whole InlineCell to fit on the current line,Mathematica pushes the whole InlineCell to the beginning of the next line. That is, Mathematica seems to prefer dropping the InlineCell to the next line over inserting a line break within it. Can I force Mathematica to fit as much of an InlineCell on a line as possible and put as little as possible on the next line?
I have played around with LinebreakAdjustments for the InlineCell and the containing cell by setting various values to 0, but have not been able to produce the behavior I would like.
Edit:
If I do not modify LinebreakAdjustments for the inline cell or modify any element besides the first (leaving the first element untouched), I get results like this (blue is an InlineCell):

If I set the first element of LinebreakArguments (of the InlineCell) to 0 I obtain somewhat predictable behavior:

Below is the behavior I am trying to produce. I've just styled the text rather than use an inline cell:


text:
Q: Proving $\displaystyle rang(AB) \le \inf(rang(A),rang(B))$ Supposing $\displaystyle A\in \mathbb{M}_{np}(\mathbb{R})$ and $B\in\mathbb{M}_{pq}(\mathbb{R})$:
How can prove that: $\displaystyle rang(AB) \le \inf(rang(A),rang(B))$

A: The idea is to note that if $V$ is any subspace of $\mathbb{R}^p$, then the dimension of $W=\{Av:v\in V\}$ is at most $\dim(V)$. This follows from applying the Rank-Nullity Theorem to the restricted linear transformation $T:V\rightarrow\mathbb{R}^n$, $T(v)=Av$. Setting $V=range(B)$ and noting that $range(AB)$ then equals $W$, we get $rank(AB)\leq rank(B)$.
Since $range(AB)$ is a subspace of $range(A)$, we also have that $rank(AB)\leq rank(A)$.
Our findings give $rank(AB)\leq min(rank(A),rank(B))$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: IIS https to https I am trying to use IIS rewrite module to redirect https to another https.
This is what i have tried:
test 1:
<rewrite>
      <rules>
        <rule name="Redirect Maps Rule" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <add input="{StaticRedirects:{PATH_INFO}}" pattern="(.+)" />
          </conditions>
          <action type="Redirect" url="{C:1}" appendQueryString="True" redirectType="Permanent" />
        </rule>
      </rules>
      <rewriteMaps>
        <rewriteMap name="StaticRedirects">
          <add key="https://sub.olddomain.com/sitename" value="https://sub.newdomwain.co.uk/sitename" />
        </rewriteMap>
      </rewriteMaps>
    </rewrite>

test 2:
<rule name="https test" stopProcessing="true">
  <match url=".*" />
    <conditions logicalGrouping="MatchAny">
      <add input="{URL}" pattern="https://sub.olddomain.com/sitenam$" />
    </conditions>
    <action type="Redirect" appendQueryString="false" url="https://sub.newdomain.co.uk/sitename" redirectType="Permanent" />
</rule>

Neither worked, i currently use IIS rewrite for HTTP to HTTPS and also HTTP to HTTP which both work fine so not sure what i have got wrong here.
Both sites are using the same wildcard SSL certificate and same IP.
IIS version 7.5


text:
Q: Заголовок выходит за границы блока Добавил заголовок h3, приписал ему padding-top,а он отталкивается от границы блока, хотя в html я его прописал внутри. Что я сделал не так?

* {
    margin: 0;
    padding: 0;
}

.top {
    width: 1920px;
    height: 790px;
    background: #F4F4F4;

    .header {
        position: absolute;
        width: 1180px;
        height: 80px;
        left: 370px;
        top: 20px;
        background: #E73D66;
        border-radius: 90px;
        display: flex;
        list-style-type: none;
    }

    .logo {
        padding-top: 18px;
        padding-bottom: 18px;
        padding-left: 40px;
    }

    .logo-2 {
        padding-top: 23px;
        padding-bottom: 24px;
        padding-left: 15px;
    }

    .pages {
        padding-left: 40px;
        padding-top: 30px;
        padding-bottom: 30px;
        height: 20px;
        font-family: 'rubik';
        font-style: normal;
        font-weight: 500;
        font-size: 14px;
        line-height: 20px;
        text-transform: uppercase;
        color: #FFFFFF
    }

    .pages:nth-child(3) {
        padding-left: 141px;
    }

    .media {
        padding-left: 30px;
        padding-top: 28px;
    }

    .media:nth-child(7) {
        padding-left: 174px;
    }

    .media:last-child {
        padding-right: 40px;
    }

    .bg-dogs {
        padding-top: 359px;
        padding-left: 250px;
    }

    .top-promo {
        margin-top: 183px;
    }
}

О приюте

Питомцы

Полезные советы

Контакты

Приют для собак четыре лапы

A: Вы не должны размещать изображение при помощи padding, для этого есть абсолютное позиционирование
попробуйте что-то вроде:
.top {
    position: relative;
}
.bg-dogs {
    position: absolute;
    right: 0;
    bottom: 0;
}


text:
Q: What's the difference between "default" and "default-push" in TortoiseHg Settings > Commit? In TortoiseHg's settings, I can set "push after commit" to unspecified, default, or default-push. I understand unspecified, but what's the difference between default and default-push?
I did my Googling, but couldn't find an explanation.

A: [paths]
default = ssh://hg@example.com/path1
default-push = ssh://hg@example.com/path2

then
hg pull
hg push

do not refer to the same repo.


text:
Q: Different dash in GNOME 3.36.8 recently upgrade to Ubuntu 20.04.1 (from 18.) and then Gnome 3.36.8; i got a dash different than other same set-up in my environment: File icon is a blue drawer, Ubuntu Help is a life buoy, that's no problem but what's bothering is Files duplicating its icon when mounting another partition (icon like a logo piece in a frame) even if the partition is in a Files tab in the main icon; Gnome 3.36.8 has different flavors ? Thanks for your help

A: Yes, there are different flavors and there are a few things you can do. First, install gnome-tweaks so you can easily select different themes and icons:
sudo apt update
sudo apt install gnome-tweaks

Search for "tweaks" in your applications and the app is pretty self explanatory. You can change themes and icons from there.
It's also possible that you have regular gnome shell installed as well as the standard Ubuntu desktop.
If this is the case, you should be able to select one of the two from your login screen before you sign in (look for a gear icon or something to click on that will offer a selection of different desktop environments or flavors).

As for the extra icon for you mounted volumes, you can disable this feature by running the following command:
gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts false

Supposedly, the feature is there to offer easy access to the mounted partition or device and to also provide an easy way to unmount the volume. Also, you can re-enable the feature at any time by running the following command instead:
gsettings set org.gnome.shell.extensions.dash-to-dock show-mounts true

You can read more about the mounted drive issue here on OMG!ubuntu.


text:
Q: How to make dropbox authenticate a popup instead of redirect I'm using Dropbox JavaScript SDK and authenticating the user so I'd get an oauth token. The problem is that when using the client.authenticate(), the user gets redirected to Dropbox instead of a popup. How can it be changed to a popup instead?

A: See https://github.com/dropbox/dropbox-js/blob/stable/guides/builtin_drivers.md.
client.authDriver(new Dropbox.AuthDriver.Popup({
    receiverUrl: "https://url.to/oauth_receiver.html"}));

and run this in your oauth_receiver.html:
Dropbox.AuthDriver.Popup.oauthReceiver();


text:
Q: Explode and/or regex text to HTML link in PHP I have a database of texts that contains this kind of syntax in the middle of English sentences that I need to turn into HTML links using PHP
"text1(text1)":http://www.example.com/mypage

Notes:

*

*text1 is always identical to the text in parenthesis

*The whole string always have the quotation marks, parenthesis, colon, so the syntax is the same for each.

*Sometimes there is a space at the end of the string, but other times there is a question mark or comma or other punctuation mark.

*I need to turn these into basic links, like
text1
How do I do this? Do I need explode or regex or both?

A: "(.*?)\(\1\)":(.*\/[a-zA-Z0-9]+)(?=\?|\,|\.|$)

You can use this.
See Demo.
http://regex101.com/r/zF6xM2/2

A: You can use this regex:
"(.*?)\(.*?:(.*)

Working demo

A: An appropriate Regular Expression could be:
$str = '"text1(text1)":http://www.example.com/mypage';
preg_match('#^"([^\(]+)' .
           '\(([^\)]+)\)[^"]*":(.+)#', $str, $m);
print ''.$m[2].'' . PHP_EOL;

A: You can use this replacement:
$pattern = '~"([^("]+)\(\1\)":(http://\S+)(?=[\s\pP]|\z)~';

$replacement = '\1';

$result = preg_replace($pattern, $replacement, $text);

pattern details:
([^("]+) this part will capture text1 in the group 1. The advantage of using a negated character class (that excludes the double quote and the opening parenthesis) is multiple:

*

*it allows to use a greedy quantifier, that is faster

*since the class excludes the opening parenthesis and is immediatly followed by a parenthesis in the pattern, if in an other part of the text there is content between double quotes but without parenthesis inside, the regex engine will not go backward to test other possibilities, it will skip this substring without backtracking. (This is because the PCRE regex engine converts automatically [^a]+a into [^a]++a before processing the string)
\S+ means all that is not a whitespace one or more times
(?=[\s\pP]|\z) is a lookahead assertion that checks that the url is followed by a whitespace, a punctuation character (\pP) or the end of the string.


text:
Q: How to use PreserveReferencesHandling.Objects selectively? I have a structure of objects that I serialize to JSON, and there is one path that can have circular references. This problem can be solved using PreserveReferencesHandling.Objects, but unfortunately it creates another problem because it adds $id properties to all the objects. I don't want to clutter the serialized data, as it's supposed to be human readable and editable.
So, the question is there any way to make it add $id only to those objects that actually are included into reference loops?


text:
Q: Why is that when I add in the following bootstrap my page become white? I'm working on a class project that required me to code a website that sells something. I'm trying to create the shopping cart so that when I click add to cart it should add the product. However, when I added in a bootstrap link my page becomes white. Is the bootstrap the problem or is it something wrong with my code?
My first time using this site so I'm not sure if this is all I need to post. If any other code is required (like the js) just ask. Thank you in advance.
<!DOCTYPE html>

  <meta charset="utf-8">
  <title>Printing Prime</title>
  <link rel="icon" type="image/png" href="img/favi.png">
  <link rel="stylesheet" type="text/css" href="css/home.css">

  <link href="https://fonts.googleapis.com/css?family=Noto+Sans&display=swap" rel="stylesheet">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css'>
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css'>
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto+Condensed:100'>
  <link rel="stylesheet" href="css\splitslick\style.css">
  <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

    (problem***)
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">

Cart

Total price: $

                <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary">Order now</button>

PRODUCTS

REVIEWS

CONTACT

ABOUT US

PRINTING PRIME

PRODUCTS

THREE

ABOUT US

Sad Face Cap

$12.99

                  <input type="number" placeholder="# of items">
                  Add to cart

Signature Tee

                <input type="number" placeholder="# of items">
                <input type="submit" value="Add To Cart" id="submit">

VHS Hoodie

                <input type="number" placeholder="# of items" >
                <input type="submit" value="Add To Cart" id="submit">

A: There appear to be a few problems with the files you link:

*

*You appear to have four different jQuery versions included (3.4.1, 2.1.3, 3.1.0 and slim). You only need one reference to jQuery (making sure it is referenced before Bootstrap). Having multiple references will throw errors.

*You also appear to reference Bootstrap twice (once from the CDN at the end of your , and once at the start of your  with a local reference). Multiple Bootstrap references will also likely throw errors.

*You also appear to be missing a reference to PopperJS, which is a required dependency of Bootstrap 4.

*css\splitslick\style.css is referenced with backslashes; you'll want forrward slashes.

*Your local script.js and style.css come before Bootstrap's JS and CSS, which means that Bootstrap will overwrite your own code; you'll want your code to be loaded last.
Removing these additional references, and making sure that Bootstrap
   comes after jQuery, PopperJS and Tether should fix your problem. Shifting your own JavaScript and CSS to the bottom of each respective section should cause it to override any conflicting Bootstrap code.
Here's a modified  that should work. Take note of the following order:

*

*Bootstrap 4 CSS -> Plugins -> Fonts -> Custom CSS

*jQuery -> PopperJS -> Tether -> Bootstrap 4 JS -> Custom JS

  <meta charset="utf-8">
  <title>Printing Prime</title>
  <link rel="icon" type="image/png" href="img/favi.png">

  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css'>
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css'>
  <link href="https://fonts.googleapis.com/css?family=Noto+Sans&display=swap" rel="stylesheet">
  <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Roboto+Condensed:100'>
  <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

  <link rel="stylesheet" href="css/splitslick/style.css">
  <link rel="stylesheet" type="text/css" href="css/home.css">


text:
Q: Anime shown on TV in the mid-'90s featuring a black robot hidden under a tennis court This anime was running on TV in the mid-'90s and I don't remember much except that it included a black robot hidden under a tennis court, which had some yellow numbers on his shoulder, probably 88 or something similar. This was some time ago so unfortunately I don't remember more than that. All help much appreciated!

A: Sounds like The New Adventures of Gigantor (aka New Tetsujin-28).
From IMDB:

At the beginning of the 21st century, scientists found that with new computers and super alloys, they could build an even bigger, faster Gigantor. They built the new Gigantor.

From Wikipedia:

New Tetsujin-28 (太陽の使者 鉄人28号, Taiyō no Shisha Tetsujin Nijūhachi-gō, lit. Solar Messenger Iron Man #28) is a 1980 Japanese Mecha Animated series produced by Tokyo Movie Shinsha, and a modern style remake of Mitsuteru Yokoyama's manga Tetsujin 28-go.3 It was directed by Tetsuo Imazawa and produced by both Shigeru Akagawa and Toru Horikoshi. It aired on Nippon Television from October 3, 1980 to September 25, 1981 with a total count of 51 episodes. Fred Ladd and TMS converted the series into The New Adventures of Gigantor, which was broadcast on the Sci-Fi Channel in the United States from September 9, 1993 to June 30, 1997.

The show features a giant robot which emerges from beneath a tennis court, as shown in the video below around the 13:58 mark. The robot is mostly dark blue, with the number "28" printed on both arms in yellow.


text:
Q: Solving $\sin(6x) + \sin(4x) = 0$ I have a test in a week and this will probably be one of the tasks. So an explanation would also come in handy.
They really need to do something about the questions, though. I need to type 1000 things but all I want is a solution and an explanation. I really don't know how to put that in a 100-word essay...

A: $$\sin6x+\sin4x=2\sin5x\cos x$$
So, $\sin 5x=0$ or $\cos x=0$
Another way:
\begin{align*}
\sin6x&=-\sin 4x\\
\sin6x&=\sin (\pi+4x)\\
6x&=n\pi+(-1)^n(\pi+4x)\\
x&=\frac{[n+(-1)^n]\pi}{6-4(-1)^n}
\end{align*}


text:
Q: Expression of the error $E(f)$ according to the class of the function Sorry fory my bad english.
Let $f \in C^4([-1,1])$ a function. We want to calculate the Hermite polynomials at the points $x_0 = -1$ and $x_1 = 1$ and deduce an integration method. I found :
$\int_{-1}^1 f(x) dx \approx f(-1) + f(1) + \frac{1}{3} f'(-1) - \frac{1}{3} f'(1)$.
I would like to know how to estimate the error $E(f)$ of this method according to the class of the function f (here, f is $C^4$) ? It's a point that I didn't understand despite some lessons.
Someone could help me ? Thank you in advance.


text:
Q: How to call generic template function in a specialization version Have a problem about how to call the generic template version in a specialization version.
Here is the sample code. But the "vector::push_back(a)" calls itself recursively.
#include <iostream>
#include <vector>

using namespace std;

namespace std
{
        template<>
        void vector<int>::push_back(const int &a)
        {
                cout << "in push_back: " << a << endl;
                vector::push_back(a);               // Want to call generic version
        }
}

int main()
{
        vector<int> v;
        v.push_back(10);
        v.push_back(1);
        return 0;
}

A: When you create specialization for some template (no difference class of function), you tell to compiler to generate that one instead of general. So in fact if you have specialization you have no general version for that specialization and you can't call it, because it doesn't exists.

A: You can simply extract the code into another template function:

    template<typename T>
    void baseF(T t) { ... }

    template<typename T>
    void F(T t) { baseF<T>(t); }

    template<>
    void F<int>(int t) { baseF<int>(t); }

A: Well, to complement, I think it works for template function specification in some situations.
#include <iostream>
#include <vector>

using namespace std;

class Base
{
public:
    virtual int test() {return 0;}
};

class Derived : public Base
{
public:
    virtual int test() {return 1;}
};

template<class T>
void TestOutput(T* a)
{
    cout << a->test() << endl;
}

template<>
void TestOutput(Derived* a)
{
    cout << "something else" << endl;
    TestOutput<Base>(a);
}

int main()
{
    Derived d;
    TestOutput(&d);
}

I compiled it with visual studio 2013 and the output is:

something else
  1

Although I don't think you can always find a TestOutput function of Base to call the generic one.


text:
Q: Use of undefined constant id - assumed 'id' in laravel 5.4 What is this error?

Use of undefined constant id - assumed 'id'

public function update(Request $request)
{
    SubmitApplication::where('id', $request->get(id))->update(['approved' => true]);
    return redirect()->back();
}

A: Strings need to be wrapped in quotes, otherwise PHP assumes it's a name of a constant, hence the error.
Replace
$request->get(id)

with
$request->get('id')


text:
Q: Error when building dlib c++ example scripts in eclipse cdt I received errors when build dlib c++ example script in eclipse cdt.
I have added dlib directory into the #include search oath and dlib/all/source.cpp into the project. See picture 1.

The error message I received is like picture 2:

I would like to know where is the problem and how to solve this.
Thanks a lot for your help!


text:
Q: jQuery Validation on input-append ( Twitter Bootstrap ) I am using twitter bootstrap for a site, and we use jquery.validate.
I have a input element with button appended to input element. This is a required field within our js validation.
The code is:

    <input tabindex="1" name="url" class="input-large" id="url" type="text" placeholder="http://somewebsite.com" autocapitalize="off">
    <button class="btn" type="button" name="attach" id="attach" />Fetch</button>

Validation error class uses jquery validation rules and works perfectly on every other element. But seemingly the span for the error is appended right after the input element, which in most cases is absolutely fine. But in this instance on this input field, it cocks the display up, because it detaches the appended button.
Below is image of what I mean ( before and after )

I really need to apply a different class to the error message for this one element, but buggered if I can figure out how.
errorClass: "help-inline",
            errorElement: "span",
            highlight:function(element, errorClass, validClass) {
                $(element).parents('.control-group').addClass('error');
            },
            unhighlight: function(element, errorClass, validClass) {
                $(element).parents('.control-group').removeClass('error');
                $(element).parents('.control-group').addClass('success');
            }

For the input field the error event is:
url:{
required:true
},

and message is:
messages:{
url:{
    required:"Enter URL beginning with http"
},

A: As said by odupont you can add your own implementation of errorPlacement, but the code given will not work for your normal input-fields in the form. With the following implementation the error placement will work for both native input fields and input-append fields!
errorPlacement: function (error, element) {
   if (element.parent().is('.input-append'))
      error.appendTo(element.parents(".controls:first"));
   else
      error.insertAfter(element);
}

A: You can use the errorPlacement option.
errorPlacement: function (error, element) {
   error.appendTo(element.parents(".controls:first"));
}

In this example, the error element will be appended in the parent div .controls.

A: Exactly as said by user579089 and odupont!
I've just fixed that and ran to SO to check if someone got stuck with it. Here's my code:
  $("#myform").validate({
        highlight: function(label) {
            $(label).closest('.control-group').addClass('error');
        },
        errorPlacement: function (error, element) {
             if (element.parent().hasClass("input-append")){
                error.insertAfter(element.parent());
             }else{
                error.insertAfter(element);
             }
        },
        onkeyup: false,
        onblur: false,
        success: function(label) {
            $(label).closest('.control-group').removeClass('error');
        }
    });


text:
Q: Converting MIPS assembly into RISCV assembly I'm working on translating simple MIPS assembly programs written for the QTSPIM simulator into RISCV assembly for didactical scope. My idea is to modify the lexer and parser yacc provided by the open-source project QTSPIM.
This should be the flow:

*

*The lexer analyzes the input MIPS assembly and it creates the tokens (e.g., add, load, store..)

*A modified version of the QTSPIM parser yacc read a token and produces the related RISCV assembly as output.

Would this idea be correct? Or would be better approach the problem in another way?

A: That should work, I would think.
Here are some other ideas:

*

*use a script (like sed or awk, or other).

*I've written a simple assembler/disassembler in Excel using formulas and lookup tables.

In any case, you'll need to map registers.

*

*MIPS has 10 temporaries, whereas RISC V only 7,

*MIPS has 4 argument registers whereas RISC V has 8

*MIPS uses separate return value and argument registers whereas RISC V uses shared return and argument registers.

*MIPS has 8 saved registers, whereas RISC V has 12

If there's parameter passing, it might require more rework especially if you want to follow the RISC V calling convention.


text:
Q: How to design a layout like this: one box on top and two bottom covering the whole page
I want 3 section one cover half part of the screen to show image slider and in half part, there is two section right now that part I'm done but now I want to add half part of the screen on top but it does not show image slider section, please help me.
right now my code:

    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1" />

    <form id="form1" runat="server">

Blood Donor

Go To Registration

Blood Seeker

Go To Registration

    </form>

please help me,
Thank You for your time.

A: If you are happy using grid then is quite easy. You just need to setup a grid which with two columns and two rows.
Here is a link to a codepen, there are some other styles to make it a little easier to see what is going on but you only need to pay attention to the grid css attributes.

.container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  height: 50vh;
}

.container>div {
  display: flex;
  justify-content: center;
  align-items: center;
}

.image-slider {
  background: magenta;
  grid-column: span 2;
}

.page-link-1 {
  background: red;
}

.page-link-2 {
  background: green
}

Image Slider

Page Link 1

Page Link 2

https://codepen.io/tmcnicol/pen/PdoLpm/

A: He's a simple layout using CSS Grid (the 2D version of Flexbox):

.main {
  display: inline-grid;
  height: 200px;
  width: 400px;
  grid-template-rows: 50% 50%;
  border: green solid 2px;
}
.main .level1 {
  border: blue solid 2px;
  display: flex;
}
.main .level1 .level2 {
  border: red solid 2px;
  flex-basis: 50%;
}

A: My implementation with flex:

body,
html {
  height: 100%;
}

.wrap {
  display: flex;
  height: 100%;
  flex-direction: column;
}

.slider {
  border: 2px solid red;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bottom-wrap {
  display: flex;
  flex: 1;
}

.link {
  border: 2px solid red;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

Image slider

Page Link

Page Link

Working codepen


text:
Q: Windows programs mysteriously lost licenses and activations I have a remote desktop server that recently lost the licenses and activation information for Office, Quickbooks, and the CALs for Remote Desktops all at the same time. I went ahead and re-entered the licenses and activated them. Easily fixed, however, the issue is a bit unnerving. What could have caused this issue? Office, Quickbooks, and Terminal Services all deactivating - registry issues? Maybe a corrupted ProgramData folder?
Where are those licenses stored? <- knowing this would help in figuring out what happened.

A: Is the remote desktop server virtualized and running concurrently with the primary remote server?
In such a case, Windows and some of the programs could lost their licences and the issue will reoccur until there is only one licensed instance running.


text:
Q: MongoDB parando de inserir documentos Estou inserindo alguns registros, mas depois de um tempo, ele não deixa inserir mais. Segue o erro do console:

  java.lang.IllegalStateException: Failed to execute CommandLineRunner

        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:803) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:784) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at org.springframework.boot.SpringApplication.afterRefresh(SpringApplication.java:771) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        at hello.Application.main(Application.java:44) [classes/:na]
    Caused by: org.bson.BsonSerializationException: Size 16777950 is larger than MaxDocumentSize 16793600.
        at org.bson.BsonBinaryWriter.backpatchSize(BsonBinaryWriter.java:367) ~[mongo-java-driver-3.2.2.jar:na]
        at org.bson.BsonBinaryWriter.doWriteEndArray(BsonBinaryWriter.java:142) ~[mongo-java-driver-3.2.2.jar:na]
        at org.bson.AbstractBsonWriter.writeEndArray(AbstractBsonWriter.java:338) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.encodeIterable(DBObjectCodec.java:271) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:198) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.encodeMap(DBObjectCodec.java:220) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:196) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.encodeIterable(DBObjectCodec.java:269) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:198) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:128) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:61) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.CompoundDBObjectCodec.encode(CompoundDBObjectCodec.java:48) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.CompoundDBObjectCodec.encode(CompoundDBObjectCodec.java:27) ~[mongo-java-driver-3.2.2.jar:na]
        at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63) ~[mongo-java-driver-3.2.2.jar:na]
        at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.UpdateCommandMessage.writeTheWrites(UpdateCommandMessage.java:84) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.UpdateCommandMessage.writeTheWrites(UpdateCommandMessage.java:42) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.BaseWriteCommandMessage.encodeMessageBodyWithMetadata(BaseWriteCommandMessage.java:129) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.WriteCommandProtocol.sendMessage(WriteCommandProtocol.java:212) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:101) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.UpdateCommandProtocol.execute(UpdateCommandProtocol.java:64) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.UpdateCommandProtocol.execute(UpdateCommandProtocol.java:37) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.connection.DefaultServerConnection.updateCommand(DefaultServerConnection.java:140) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.UpdateOperation.executeCommandProtocol(UpdateOperation.java:76) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:141) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:133) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:230) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:221) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:133) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:60) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.Mongo.execute(Mongo.java:781) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.Mongo$2.execute(Mongo.java:764) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:333) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBCollection.replaceOrInsert(DBCollection.java:411) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBCollection.save(DBCollection.java:400) ~[mongo-java-driver-3.2.2.jar:na]
        at com.mongodb.DBCollection.save(DBCollection.java:373) ~[mongo-java-driver-3.2.2.jar:na]
        at org.springframework.data.mongodb.core.MongoTemplate$11.doInCollection(MongoTemplate.java:1085) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:462) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at org.springframework.data.mongodb.core.MongoTemplate.saveDBObject(MongoTemplate.java:1080) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at org.springframework.data.mongodb.core.MongoTemplate.doSave(MongoTemplate.java:1015) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at org.springframework.data.mongodb.core.MongoTemplate.save(MongoTemplate.java:961) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.save(SimpleMongoRepository.java:80) ~[spring-data-mongodb-1.9.3.RELEASE.jar:na]
        at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source) ~[na:na]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_112]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_112]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503) ~[spring-data-commons-1.12.3.RELEASE.jar:na]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488) ~[spring-data-commons-1.12.3.RELEASE.jar:na]
        at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.3.RELEASE.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
        at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.3.RELEASE.jar:na]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
        at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) ~[spring-aop-4.3.3.RELEASE.jar:4.3.3.RELEASE]
        at com.sun.proxy.$Proxy78.save(Unknown Source) ~[na:na]
        at hello.Application.run(Application.java:101) [classes/:na]
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:800) [spring-boot-1.4.1.RELEASE.jar:1.4.1.RELEASE]
        ... 6 common frames omitted

E as informações do MongoDB:

Outra coisa que está deixando pesado, é que eu estou inserindo um calendar, para manipular datas, exigência do meu chefe, e o que acontece é que ele insere o objeto inteiro, e não a data, se alguém souber uma solução para isso, também seria legal.

A: Você ultrapassou o limite do tamanho do documento máximo no mongodb, um único documento pode ter no máximo 16MB.
Seu documento está com 16777950 bytes, peguei a informação da exception, a linha onde isso aparece:
Caused by: org.bson.BsonSerializationException: Size 16777950 is larger than MaxDocumentSize 16793600.

Quanto a conversão do Calendar você tem que ver na documentação do Spring como escrever um conversor. Dá uma olhada aqui.
Sei que a pergunta é um tanto antiga, mas acho que vale a documentação.


text:
Q: How to change primary text color in Angular Material? I'm using Angular Material v13.0.1 and I'm trying to change the color of text in my button.
<button
  mat-raised-button
  color="primary"
  (click)='submit()'
  [disabled]='btnDisabled'
>Save</button>

In my theme.scss I have:
// theme.scss

$theme-primary: mat.define-palette(mat.$green-palette);
$theme-accent: mat.define-palette(mat.$pink-palette, A200, A100, A400);
$theme-foreground: mat.define-palette(mat.$green-palette);

// The warn palette is optional (defaults to red).
$theme-warn: mat.define-palette(mat.$red-palette);

// Create the theme object. A theme consists of configurations for individual theming systems such as "color" or "typography".
$theme: mat.define-light-theme((
  color: (
    primary: $theme-primary,
    accent: $theme-accent,
    warn: $theme-warn,
    foreground: $theme-foreground
  )
));

The button does turn green according to the $theme-primary but the text color is black, and I want to change it to white. I tried adding foreground in the theme definition but it doesn't seem to do anything.
Any tips on how to change the default font color of a theme?

A: Angular Material uses pallets for its theming. You can create your own pallet using this tool.
The define-palette Sass function accepts a color palette as well as four optional hue numbers. These four hues represent, in order: the "default" hue, a "lighter" hue, a "darker" hue, and a "text" hue.
In your case, you need to update your palette, to define which color from the palette you would like to use as the text color (the last argument):
$theme-primary: mat.define-palette(mat.$green-palette, A200, A100, A400);


text:
Q: Search git for a specific version of a file I have a file that was copied from a git repository at some point. I want to find what SHA the file was copied at.
Currently I'm going get a list of all the SHA's and diff the file for each SHA with the file I have, but I was hoping for a better way.

A: To me it looks like the following situation:
Say, we are talking about file foo.txt that was added to git repository (say, empty) at some point:
touch foo.txt
git add foo.txt
git commit -m "added foo.txt"
// commit '123'

Then it was changed a couple of times:
// add "hello" to foo.txt
git add foo.txt
git commit -m "Added 'hello'"
// commit '456'
// add "world" to foo.txt
git add foo.txt
git commit -m "Added 'world'"
// commit '789'

At this point the file (that contains 'hello world') gets copied aside (cp foo.txt /tmp/foo.txt) and its the reference copy.
Afterwards there were other commits that altered the content of foo.txt, say commits abc, def) so that the file now actually looks in git like:
Hello world
How are you doing?
I'm fine, and you?
I'm Ok too

So the question that is actually asked is how to find the commit after which the file foo.txt looks exactly like a reference copy, as its stored in /tmp/foo.txt: it contains only "Hello world" (commit 789 in my example)
In this case I believe you should use git bisect command, give it boundaries of the last commit and the first (initial commit) and, if there are were many commits in the project, running a binary search will be much faster than iterating over all the commits in the history of the file.
Read about it here
You should know how to take a decision whether the commit is 'good' or 'bad' in terms of git bisest (e.g. whether it contains the words 'hello' and 'world' for example)

A: git hash-object path/to/file will show you the blob id for a file in your work tree.
git log --no-abbrev --full-history --cc --raw  --pretty=format:%H -- path/to/file will dump the old and new blob ids at every change to that file in your history.
git log --no-abbrev --full-history --cc --raw --pretty=format:%H -- path/to/file \
| awk '$5==blob' RS='' blob=`git hash-object path/to/file`

will show you the commit(s) that produced the file you've got.

A: It seems you can use git describe for this.
git describe <sha>

From the git describe man page:

If the given object refers to a blob, it will be described
  as <commit-ish>:<path>, such that the blob can be found
  at <path> in the <commit-ish>, which itself describes the
  first commit in which this blob occurs in a reverse revision walk
  from HEAD.

To get the <sha> of the file, use
git ls-files -s <file>

Like Adrian Shum points out in the comments, this will only give you the first commit the file is in. You can use git log to help you find the next commit at which the file changes, giving you a range of possible commits.
For more info:

*

*git describe: Which commit has this blob?

*git ls-files: Git - finding the SHA1 of an individual file in the index


text:
Q: remove white gap from marquee There is a white gap on a marquee.
I put a long sentence (Breaking news Breaking news Breaking news Breaking news Breaking news Breaking news Breaking news) but it keeps on going then the B touches touches the edge

Breaking news Breaking news Breaking news Breaking news...

It doesn't come out from the other end until everything goes through

s

^above is the sentence almost going to come out of the other end^
I have searched all over google (I even found a hack on google(search "marquee html"))

<marquee>here is the text I repeat it over and over again it keeps going and going but the beginning wouldn't come out until I touch it</marquee>

A: You probably should not use the <marquee> tag as it is deprecated, or obsolete rather, https://developer.mozilla.org/en-US/docs/Web/HTML/Element/marquee
Maybe try for a javascript/jquery solution. There are plenty of plugins for this
Edit
I found this jQuery Marquee Plugin with an option for no gap like you are looking for. Here is an example

$('.marquee').marquee({
  direction: 'left'
});
.marquee {
  width: 300px;
  overflow: hidden;
  border: 1px solid #ccc;
  background: #ccc;
}

jQuery marquee is the best marquee plugin in the world


text:
Q: How to convert image with .png format to .jpg format in javascript Filereader? I have developed web application,I am using File reader for pick the image,In that i have to convert the image .png format to .jpeg format.Please help me anyone to complete the task. Thanks in Advance.

A: This is definitely possible through HTML5 canvas element. Just draw the image in a canvas. (Make the canvas element hidden if you want). Then use canvas.toDataURL("image/jpeg"); to get the Base64 notation of image in the required format.
Check out :
http://davidwalsh.name/convert-canvas-image


text:
Q: git cherry: How to identify equivalent commit by commit message In my project there are a stable branch and a dev branch. Commits are cherry-picked from dev branch to stable branch.
In order to filter all commits on dev that have not been merged to stable, git cherry -v stable dev looks like a good choice. However it identifies equivalence by diff, which usually changes after resolving merge conflict during cherry-pick:

The equivalence test is based on the diff, after removing whitespace
  and line numbers. git-cherry therefore detects when commits have been
  "copied" by means of git-cherry-pick(1), git-am(1) or git-rebase(1).

I was wondering that is there any command that works like git cherry, but identifies equivalent commits by commit message?

A: It seems that there is no direct way to do this, so I wrote a short script:
#!/bin/bash
git cherry -v stable dev | grep + | cut -d ' ' -f 3- > /tmp/unmerged
xargs -a /tmp/unmerged  -I{} git --no-pager log stable --pretty=oneline --grep {} | cut -d ' ' -f 2- > /tmp/cherry-picked
diff /tmp/unmerged /tmp/cherry-picked

Explanation:
git cherry -v stable dev | grep + | cut -d ' ' -f 3- > /tmp/unmerged
writes commit messages of commits that only exist on dev branch. These commits include those have been cherry-picked and changed to stable branch, and we need to filter out these commits in the next step.
xargs -a /tmp/unmerged  -I{} git --no-pager log stable --pretty=oneline --grep {} | cut -d ' ' -f 2- > /tmp/cherry-picked outputs messages of commits from (1) that appears with the same message on stable. In other words, /tmp/cherry-picked stores all commits that are cherry-picked and changed from dev to stable.
Finally, diff /tmp/unmerged /tmp/cherry-picked gives out all commits on dev where no commit with identical commit message is found on stable.

A: If commits in dev are not rebased, then you could use git cherry-pick -x, marking the source explicitly. There is no automatic use of this information, but with some bash fu it is possible to use it.

A: You want to use patch-id. This is the mechanism used by git cherry.
To find an equivalent of commit 3642151 run:
git show 3642151 | git patch-id

You should get a line with two hashes; the first is the patchid (call
it PATCHID_FROM_ABOVE)
git log -p | git patch-id | grep PATCHID_FROM_ABOVE

This should give you a list of all commits that correspond to that patchid.
Stolen from: http://git.661346.n2.nabble.com/git-cherry-to-find-equivalent-commit-IDs-td3440883.html


text:
Q: How is it possible to assign "this" pointer to field? As far as I know, "this" pointer is the parameter that is inserted into function by Compiler like below :
class Sample {
private:
    int a;
public:
    void setA(int a) {
        this->a = a;
    }
};

Sample ob;
ob.setA(5); -> ob.setA(&ob, 5);

class Sample {
private:
    int a;
public:
    void setA(Sample* this, int a) {
        this->a = a;
    }
};

Btw, I found something confusing code that assigning the "this" pointer to const field. (Consult below)
class Test {
    int data;
public:
    Test* const test = this;
    Test(int data = 1) : data(data) { }
    Test(Test &test) : data(test.data) { }
};
(It has no compile Errors and runs well!)

If it is true that "this" pointer is conveyed via function, How can it be?
I have no idea..
Could you give me some advice please? I'm appreciate for your any replies.

A: This syntax:
Test* const test = this;

comes from C++11. It means "initialize test to this inside any non-copy constructor which does not already initialize test explicitly".
As a result, this code is executed inside the constructor, and this is perfectly  valid. However, the benefit of doing this sort of initialization is unclear, and dependening on the usage of test might be dangerous.

A: The properties of the class (Test.test in this case) are initialized implicitly by code that is generated by the compiler.  There is a function, and it does receive the this pointer, but it's all generated by the compiler which is why you can't see it.


text:
Q: Eclipse or spring boot doesn't allow calling any of delete API I am using eclipse to test some small API and is strange but it doesn't allow me to call any API that deletes... I am getting this error
for this
 @RequestMapping(value = "/users/{id}", method = RequestMethod.DELETE)
 public void deleteUser(@PathVariable String id) {
      System.out.println("BLOOD HELL");
 }

the error >>>>
    GET "/users/3", parameters={}
    Request method 'GET' not supported: Completed 405 METHOD_NOT_ALLOWED
I don't understand why is there a get where I
 am using delete.

I am calling with Http
  So to be clear I know that the error means I don't have a method with that path, but what I don't understand is how is possible that there is that get when should be delete somehow the eclipse or spring boot gets this info wrong

A: You need to call this API using DELETE request.
As posted by you, you are using GET request.
Server is not able to find the API with GET request, that's why you are getting 405 error code.

A: You need to test DELETE API using postman or some other tool not from browser. If you will test from browser then method will be HTTP GET not DELETE.

A: You have a Delete mapping but you are accessing that API from GET.
If in Postman, choose DELETE instead of GET.
If you're accessing the API from a browser it will by default use GET so if you actually want to access this API call it from Postman and choose DELETE method.
If you're using http, try https or vice versa.

A: sorry i don't speak english very well i'm using google translate, try using the annotation
@DeleteMapping (value = /users/{id})

But using Postman, using the delete method


text:
Q: Bug with setting currentPageIndicatorTintColor I have custom view with scrollview and pageContoll.
let backScrollView = NSBundle.mainBundle().loadNibNamed("BackScrollView", owner: self, options: nil)[0] as! BackScrollView

i try setting currentPageIndicatorTintColor
if brightnes > 200
{
   backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
}
else
{
   backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
}

I run this code on iPhone 5S (iOS 9.2), and code works without problems, but when i run this code on iPhone 5 (iOS 8.4) i become error:

* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[__NSArrayM objectAtIndex:]: index 4294967295 beyond
  bounds for empty array'

I know that the error is in this line of code
backScrollView.pageControl.currentPageIndicatorTintColor = UIColor.blackColor()

I is calculated by using print.
What i doing wrong?

A: The most probable reason is that either your page control has numberOfPages equal to 0, or currentPage is invalid (equal to -1).
Can you try the following
let pageControl = backScrollView.pageControl

if (pageControl.numberOfPages > 0 && pageControl.currentPage >= 0 && pageControl.currentPage < pageControl.numberOfPages) {
    if brightnes > 200 {
        pageControl.currentPageIndicatorTintColor = UIColor.blackColor()
    } else {
        pageControl.currentPageIndicatorTintColor = UIColor.whiteColor()
    }
} else {
    print("Invalid pageControl state : numberOfPages = \(pageControl.numberOfPages); currentPage = \(pageControl.currentPage)")
}


text:
Q: Pulling JSON data into my app using javascript from a local JSON file I am building an application where I need to pull data from a local JSON file in my app, parse it, and generate content on my application using this data.  I already read online that due to cross origin request issues, I need to host my app on a server. I have already set it up on a working local Node server. My question now really, is how do I proceed?  I don't have a lot of experience making XMLhttp requests, do I just pass my request the file path to the local JSON file? I would like the callback function just to console log some of the data at first, just so I know that it's working.  Also, I want to try this out first using just plain javascript, no libraries or frameworks (I used Express, but just for the server), any help or nudge in the right direction would be greatly appreciated. Thanks!

A: Making XMLhttp requests from javascript is not different than requesting a web page in a browser, ie. you have to use an URL, not a file path.

A: var x = new XMLHttpRequest();
x.open('/file.json');
x.onreadystatechange = function(){
    if(x.readyState == 4){
        callback(x.responseText);
    }
};
x.send();

function callback(resp){
    console.log(resp);
}

here you still need to do more stuff for cross-browser
Hope this helps you :)


text:
Q: Timezones with Calendar I am hitting some unexpected behavior with Calendar and SimpleDateFormatter when using the UTC timezone. It looks like SimpleDateFormatter is giving the right result, but Calendar is not. I'm not sure why. I'm using the following code to generate a date using Calendar:
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
    cal.set(Calendar.YEAR, 2012);
    cal.set(Calendar.MONTH, Calendar.MARCH);
    cal.set(Calendar.DAY_OF_MONTH, 5);
    cal.set(Calendar.HOUR, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);

In other words, March 5th, 2012 at 00:00 UTC.
When I print this time in my local CST timezone, I get: Mon Mar 05 06:00:00 CST 2012 This is odd because CST is UTC-6:00, so I was expecting Sunday March 4th, 2012 18:00 CST (i.e. 6 hours before midnight in the prior day). Instead I get 6 hours after UTC.

When I use a SimpleDateFormatter like so:
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    df.setTimeZone(TimeZone.getTimeZone("UTC"));
    df.parse("2012-03-05");

I get the expected "Sunday March 4th, 2012 18:00 CST", which is 6 hours before UTC, i.e. UTC-6:00.
Why are my results wrong?

A: Calendar.HOUR sets the hour in the 12-hour format, so you are not setting it to midnight but to 12pm.
Use Calendar.HOUR_OF_DAY instead or make sure to also set the am/pm value:
cal.set(Calendar.AM_PM, Calendar.AM);


text:
Q: try/except doesn't seem to capture exceptions - Delphi Service Application I have a service written in Delphi 2007 in which I'm trying capture any unknown exceptions. Assigning a method to the on exception doesn't seem to work ('Forms.Application.OnException:=UnknownApplicationException'). The 'UnknownApplicationException' doesn't appear to get called - I attribute this to the fact that there is no form in the application so the method never actually gets assigned. Aside from this, I've also tried creating an exception on a timer (after commenting out 'Forms.Application.OnException:=UnknownApplicationException' so that it does not interfere). The timer triggers 60 seconds after the service has started up:
procedure TProcessScheduler.Timer1Timer(Sender: TObject);
begin
  try
    Raise Exception.Create('THIS GIG SUCKS');
  except
    LogEvent(Name,rsUNKNOWN_EXCEPTION,EVENTLOG_AUDIT_FAILURE,0);
    ExitCode:=-1;
    Halt;
  end;
end;

The exception never seems to get captured - the service starts up and after 60 seconds when this timer triggers, I hear a windows error sound but don't see any error dialog - perhaps this could be due to the fact that the application is a service? The 'Halt' never gets called and the application keeps running (i assume its waiting for someone to click ok on the invisible error dialog that it created). Any ideas why the code under the 'except' doesn't get called? Thanks in advance! KP

A: Reassigning Forms.Application.OnException is a bad idea, as TServiceApplication.Run() does this itself. You either do it before, then your assignment won't have an effect, or you do it afterwards, in which case you remove the exception handling mechanism that has been put into place.
If you leave the handling in place, then all exceptions will be logged to the Windows Event Logger, which seems a reasonable thing to do from a service.

A: A couple of notes:

*

*As you are raising an exception within a try-except block, it should not trigger any Application.OnException handler, simply because the exception isn't unhandled.

*How have you determined that the Halt doesn't get called? Does the exception get logged through your LogEvent?

*In a Service application ExitCode and Halt don't function the way you would expect them to in a normal windows application. A service isn't stopped by calling halt, it should be stopped by going through the Windows' Service Control Manager.

*If the except part of your try-except block is indeed not reached, it means that Windows has cut in because something has happened that it isn't happy with. That could be something in the LogEvent method you are calling. If that shows a dialog or if that raises an exception as well, the ExitCode and Halt won't be reached.

*A service doesn't normally have a desktop associated with it, so showing dialogs isn't going to work.

*If you need the service to show dialogs (bad idea by the way, services are intended to run without user interaction), you need to make it interactive and have it run under another user account than the normal "system" account that services run under. You do this through the services manager.

A: Why are you setting Forms.Application? AFAIK a service uses the Application variable declared in SvcMgr, which is declared as:
var
  Application: TServiceApplication = nil;

Moreover a service should not display any dialog, it may not have access to the user desktop, and your dialog will hang the service. There are ways to display a dialog anyway, but services could also run when no human user is watching the screen.
Log events to the event log (or if you don't like it to a file, but the event log has several useful features, including remote access).

A: I create my own version of the SvcMgr.pas file to eliminate the in-place hook to the Application global exception handler so that I can instantiate my own. I do this because 1) I could find no other simple way of doing this, and 2) since this unit is a stand-alone unit that is only included with Windows Services then the effect on other units is minimal. You can download the code from my web-site to see how this works.


text:
Q: JAVA - How to store max and minimum values in an array that's inside a loop? I need to store the min and max values in an array given, then print them out with specific characters (+ for the maximum values, "-" for the minimum value, and "*" for all the rest).
I think I have most of it completed except for the storing values appropriately so that all the values are not "++++++++++...." like they currently are when printed out.
Any ideas? Help is greatly appreciated.
      public static void main(String[] args) {
        Scanner keyboard = new Scanner(System.in);
        int numbers[] = new int[24];
        int min = Integer.MAX_VALUE;
        int max=Integer.MIN_VALUE;
        int maxhour = 0;
        int minhour = 0;
        int total = 0;
        char MAX = '+', MIN = '-', MIDDLE = '*';
        char currentchar = 0;
        for(int i=0; i< numbers.length; i++){
            numbers[i] = keyboard.nextInt();
            total = total + numbers[i];
           if(numbers[i]<min){
               min = numbers[i];
               minhour = i;
               currentchar = MIN;
           }else if (numbers[i]>max){
               max = numbers[i];
               maxhour = i;
               currentchar = MAX;
           }
        }
        for(int i=0; i< numbers.length; i++){
            System.out.print("Hour " + i + ":");
            printTimes(currentchar, numbers[i]);
            System.out.println("");
          }

        System.out.println("Largest Number of hits is : " + max + " at hour " + maxhour);
        System.out.println("Average Number of hits is : " + (total/24) + " per hour");
        System.out.println("Smallest Number of hits is : " + min + " at hour " + minhour);

    }

        public static void printTimes(char c, int times) {
        if (times >= 70) {
            for(int i=0; i< 69; i++){
            System.out.print(c);
            } System.out.print(">");
        } else if (times < 70) {
            for(int i=0; i< times; i++)
            System.out.print(c);
        }
    }

}

Example of current output:
42 29 36 7 5 3 10 13 33 40 51 49
22 58 63 102 65 58 48 24 36 48 52 42
Hour 0:++++++++++++++++++++++++++++++++++++++++++
Hour 1:+++++++++++++++++++++++++++++
Hour 2:++++++++++++++++++++++++++++++++++++
Hour 3:+++++++
Hour 4:+++++
Hour 5:+++
Hour 6:++++++++++
Hour 7:+++++++++++++
Hour 8:+++++++++++++++++++++++++++++++++
Hour 9:++++++++++++++++++++++++++++++++++++++++
....
Largest Number of hits is : 102 at hour 15
Average Number of hits is : 39 per hour
Smallest Number of hits is : 3 at hour 5

A: Just change your last for:
for (int i = 0; i < numbers.length; i++) {
    System.out.print("Hour " + i + ":");
    if (numbers[i] == min)
        currentchar = MIN;
    else if (numbers[i] == max)
        currentchar = MAX;
    else
        currentchar = MIDDLE;
    printTimes(currentchar, numbers[i]);
    System.out.println("");
}

A: I would update your code as follows -
public static void main(String[] args) {
  int numbers[] = new int[24];
  int total = 0;

  System.out.println("Enter 24 integers please");
  Scanner keyboard = null;
  try {
    keyboard = new Scanner(System.in);
    for (int i = 0; i < numbers.length; i++) {
      numbers[i] = keyboard.nextInt();
      total += numbers[i];
    }
  } finally {
    keyboard.close();
  }
  Integer min = null;
  Integer max = null;
  int maxhour = 0;
  int minhour = 0;
  char MAX = '+', MIN = '-', MIDDLE = '*';
  for (int i = 0; i < numbers.length; i++) {
    if (min == null || numbers[i] < min) {
      min = numbers[i];
      minhour = i;
    } else if (max == null || numbers[i] > max) {
      max = numbers[i];
      maxhour = i;
    }
  }
  for (int i = 0; i < numbers.length; i++) {
    char currentchar = MIDDLE;
    if (i == minhour) {
      currentchar = MIN;
    } else if (i == maxhour) {
      currentchar = MAX;
    }
    System.out.print("Hour " + i + ":");
    printTimes(currentchar, numbers[i]);
    System.out.println("");
  }

  System.out.println("Largest Number of hits is : "
    + max + " at hour " + maxhour);
  System.out.println("Average Number of hits is : "
    + (total / 24) + " per hour");
  System.out.println("Smallest Number of hits is : "
    + min + " at hour " + minhour);
}


text:
Q: mongoose database.find result return with nodejs I am trying to query using using mongoDB and send the result from nodejs to angularJs.
NodeJS Code
app.get('/mfsearch/:aId/:categ/:type', function(req, res, next) {
    var aId = parseInt(req.params.aId);
    var categ = req.params.categ;
    var type = req.params.type;
    console.log(aId+','+categ+','+type);
    MHistory.find({
        $and : [{schemeCategory :categ},{schemeType:type},{amcNumber : aId},{schemeStatus : 'Active'}]
    }, function(err, fund) {
        if (err) {
            return next(err);
        }
        console.log(fund);
        res.json(fund);
    });
});

I am getting null as the fund value.
I searched through few forums and changed code as below.
var mfResult = function(categ1,type1,aId1){
    console.log(aId1+','+categ1+','+type1);
    MHistory.find({
    $and : [{schemeCategory :categ1},{schemeType:type1},{amcNumber : aId1},{schemeStatus : 'Active'}]
}).exec(function(err, fund) {
    if (err) {
        return next(err);
    }
    console.log(fund);
    return fund;
});
};

app.get('/mfsearch/:aId/:categ/:type', function(req, res, next) {
    var amcId = parseInt(req.params.aId);
    var categ = req.params.categ;
    var type = req.params.type;
    console.log(aId+','+categ+','+type);
    res.json(mfResult(categ,type,aId));
});

Query seems to be fine as I am getting the result from the same query using Robo 3T.


text:
Q: Create an upload profile picture field in WooCommerce registration I'm using this code to add First and Last name to WooCommerce registration: How to add custom fields to WooCommerce registration form
I'm kinda lost on how to add a field for a profile picture upload. I thought I should use one of these functions (https://codex.wordpress.org/Function_Reference) but it seems I'm looking in the wrong place. Is there a meta for user profile picture?

A: Use Plugin
use YITH Woo-commerce plugin that is available with various options.check below link.
https://wordpress.org/plugins/yith-woocommerce-additional-uploads/
Main features

*

*General settings of the YITH WooCommerce Uploads. You can set a
maximum size for the upload file, one or more file extensions allowed
and the order status in which you attach a file option will be
available.

*Allow users to upload a file to the order in the cart page.

*Allow users to upload a file to the order in the checkout page.

*Allow users to upload a file to the order in the order page.

Add Upload on Registration page:
You have to code and make plugin.I assume that you aware about a plugin making step.
add_action( 'wp_ajax_wdm_upload_image_action', 'wdm_upload_image_action_callback' );
add_action( 'wp_ajax_nopriv_wdm_upload_image_action', 'wdm_upload_image_action_callback' );
function wdm_upload_image_action_callback(){
  check_ajax_referrer( 'wdm-ee4-upload', '_wdmnonce' );
  if(!empty($_FILES))
  {
    //Check if there are any errors in the upload.
    if($_FILES['fileToUpload']['error'] > 0){
      die('An error occurred when uploading.');
    }

    /* validate the file type */

    // check if a file with the same name exists
    if(file_exists('upload/' . $_FILES['fileToUpload']['name'])){
      die('File name exists.');
    }

    //get file path
    $filename=$_FILES['fileToUpload']['name'];
    $type=$_FILES['fileToUpload']['type'];
    $tmp_name=$_FILES['fileToUpload']['tmp_name'] ;
    $error=$_FILES['fileToUpload']['error'];
    $size=$_FILES['fileToUpload']['size'];

    //Upload Files to WordPress Uploads Folder
    if ( ! function_exists( 'wp_handle_upload' ) )
      require_once( ABSPATH . 'wp-admin/includes/file.php' );

    $uploadedfile = $_FILES[$fileToUpload];
    $upload_overrides = array('test_form' => false,
                              'test_size' => true,
                              'test_upload' => true,
                              );

    $movefile = wp_handle_upload( $uploadedfile, $upload_overrides );

    if ( $movefile )
    {
      //file is uploaded successfully
    }
    else
    {
      // upload error
     }
  }
}

If you want to detailed description please refer below link:
https://wisdmlabs.com/blog/5-step-guide-to-add-file-upload-in-ee4-registration-form/


text:
Q: Tunnelling HTTP over a custom protocol in Clojure/Java I want to tunnel a HTTP request stream over a custom transport protocol. Are there any Clojure or, as a fallback, Java HTTP clients that'd let me access the underlying request streams or lets me filter the serialised requests and responses?
I know clj-http wraps Apache HttpComponents, but doesn't seem to provide a lot of hooks into HC internals, and I've looked into HC itself, but have a hard time navigating the jungle of factories, interfaces and managers.

A: clj-http includes the ability to read to and write from an input stream
(client/get "http://site.com/bigrequest.html" {:as :stream})

(client/post "http://site.com/resources"
         {:body (clojure.java.io/input-stream "/tmp/foo") :length 1000})

you can then wrap this stream in your transport of choice.

A: You can have request body as stream. For that you need to set the :body value to any object that implements InputStream. Check the function wrap-input-coercion at https://github.com/dakrone/clj-http/blob/master/src/clj_http/client.clj for more details.


text:
Q: Update MYSQL table by comparing columns please I need help.
If I have a MYSQL table that looks like the one in the image below, for instance:
Full Name     Customer _ Type Referrer
Wayne Brown   Standard        Neil White
Neil White    Standard        Wayne Brown
Gordon Smith  Standard        Neil White
Rukky Dick    Standard        Neil White
Dorothy Ann   Standard        Tracy Cool
Tracy Cool    Standard        Neil White
Anthony Josh  Standard        Neil White

How do I write an UPDATE statement to change someone like Neil White's customer type to "Premium" because he has referred 5 or more people?
I have tried this code but it's not giving me the result.
Update customers set customer_type = "Premium" where full_name = (select referrer from customers having count(referrer) >= 5)

Thank you.

A: Try to do the following:
UPDATE `your_table` as t1
    INNER JOIN (select count(*) as `total`
            from `your_table` as t2
            where t2.`full_name_customer`= t1.`full_name_customer`
            group by t2.`referrer`
     ) as t3
 SET`full_name_customer`='Premium'
 WHERE t3.total >= 5


text:
Q: Facebook Product Feed Schedule using ShareFile FTP Link - curl error 56 I'm attempting to set up a scheduled fetch for a product feed in Facebook Business Manager. From what I can see, I can provide an FTP link to Facebook along with credentials and it should pick up the file.
The FTP provider I'm using is ShareFile, with the appropriate account given access to the folder the file is in. I confirmed I can use these credentials and connect to the FTP using FileZilla, so that portion should be solid. The setup in FileZilla is as follows:

*

*Host: host.sharefileftp.com

*Protocol: FTP

*Encryption: Require implicit FTP over TLS (port 990)

*User: domain\facebookfeed@host.com

*Password: ######

However, when I put the same credentials into Facebook Business Manager for the feed upload, I get the following error:

Fetching product feed from FTP server failed due to unknown reason
  (Curl error code: 56). Please help us by reporting the problem. You
  may be able to try again.

All I can find on this error is from the cURL error page:

CURLE_RECV_ERROR (56)
  Failure with receiving network data.

I saw a mention somewhere about needing to whitelist Facebook's IPs within ShareFile, but I can't for the life of me find that page.
FTP Details are set up in Facebook as follows:

*

*URL: ftp://host.sharefileftp.com:990/Path/To/File.csv

*Username: domain\facebookfeed@host.com

*Password: ######

I've been unsuccessful getting anywhere else with the Facebook documentation and I can't find a way to contact their support directly. If anyone has experience with this any help is appreciated!

EDIT: Trying this just with a direct cURL and getting the same results:
$ curl -u 'domain\facebookfeed@host.com' "ftp://host.sharefileftp.com:990/Path/To/File.csv"
Enter host password for user 'domain\facebookfeed@host.com':
curl: (56) response reading failed

So at this point it's probably just an issue with ShareFile itself, nothing to do with Facebook.

A: As @jared pointed out in the comments, using ftps did allow the cURL to work:
$ curl -u 'domain\facebookfeed@host.com' "ftps://host.sharefileftp.com:990/Path/To/File.csv"

However, Facebook doesn't support ftps. It only supports ftp or sftp, which ShareFile doesn't support.
The normal ftp I originally tried didn't work because the ShareFile account used didn't have normal ftp allowed. Once that was turned on, Facebook was able to connect to ShareFile and grab the file successfully.


text:
Q: Don't play HTML5 audio when vibrate switch is on I've writing a little web app that will target iPhone initially. One of it's functions is to play an audio file when an icon is clicked. I do this with the following code:
$('#quickSample').click( function() { $('#theSound').get(0).play(); });

Then the relevant HTML is:
<audio id="theSound" src="demo.mp3"></audio>

The problem I'm having is that it plays this audio file even when the iPhone is switched to silent or vibrate mode. I want to be nice and NOT play the sound when the phone is in vibrate mode. Can I test for vibrate mode and skip playing if it's on? Is there a better way?  I actually expected this to be default behavior.


text:
Q: Is it possible to assign F3 to search in Eclipse? I use Rclipse for Java where for used Ctrl+F for search, but F3 seems is a standard for search. I would like use F3 shortcut, but also if I assign F3 to work like Ctrl+F - it opens dialog windows for search and replace. Is it possible use F3 like in Notepad++?

A: Yes, you can. From the preference panel you have to bind F3 to Find and Replace feature :

You must avoid conflicts with other command to make it work ...

A: Here is the step
Start Eclipse
go to Window > Preferences
Select the General > Editor > Keys page
search a command "Find" from grid. which has a shortcut Ctrl + F.
click Copy command
Set Binding property to F3
That's it...

A: You can bind F3 to Incremental Find (Ctrl+J)


text:
Q: How to remove right-margin on flex wrapping? This task looks easy but I didn't find it so when trying to resolve it.
I have two flex items in column, first is 77% width with 5% right margin (to keep space between first and second item), the second is 18% width. When there 21% is not enough for second div content, it goes down to the second line, and fully fills it (flex-grow is set to 1). The first element also has grow of 1 and fills first line, but the right margin still remains.What I want - two lines fully filled with every of two items.
How to achieve this?

.container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  width: 50vw;

}

.one, .two {
  background: green;
  color: white;
  flex-grow: 1;
  margin-bottom: 1rem;
}

.one {
  flex-basis: 77%;
  margin-right: 5%;
}

.two {
  flex-basis: 18%;
}

I am one I am one I am one I am one

I am two I am two

(huh, scaling gives no effect here, see it at https://jsfiddle.net/1471djg7/3/ )


text:
Q: Does the difficulty you play on have any effect on gwent? This question got me wondering.
Does the difficulty you play on have any effect on the difficulty of gwent or other mini-games?

A: The current answer is outdated. The new patches have added a Gwent difficulty that is independent from the difficulty of the rest of the game.

A: I don't have an official source for it, but i played the game on two difficulties (bst and now death march) and the cpu doesn't seem to use other tactics or different cards.
Also, in previous Witcher games, minigames (Dice poker or arm wrestling) were unaffected by the difficulty of the game since every opponent already had his own difficulty level. I think this is still the case in Witcher 3.


text:
Q: How to join two tables Table1
Date        v1
05/01/2010  26
05/02/2010  31
05/03/2010  50

Table2
Date        v2 v3
05/01/2010  42 jkl
05/02/2010  28 mno
05/03/2010  12 pqr
05/04/2010  13 stv
05/06/2010  48 8965

How can I join the above two tables so that my result look similar to below
Date        v1   v2   v3
05/01/2010  26   42   jkl
05/02/2010  31   28   mno
05/03/2010  50   12   pqr
05/04/2010   0   13   stv
05/06/2010   0   48   8965

A: You use the JOIN keyword:
SELECT table2.Date, COALESCE(v1, 0) AS v1, v2, v3
FROM Table2
LEFT JOIN Table1
ON table1.Date = table2.Date

There are different types of join for example:

*

*INNER JOIN

*LEFT OUTER JOIN

*RIGHT OUTER JOIN

*FULL OUTER JOIN

If you don't specify which type of join you want, by default you get an INNER join. It seems here that you want a LEFT JOIN or a FULL OUTER JOIN although it isn't clear which from your question.
See this question for an explanation of the different types of joins:

*

*What is the difference between Left, Right, Outer and Inner Joins?


text:
Q: ls with directory path shows files, but ls with file pattern does not? Why is this happening?
$ sudo ls /var/lib/postgresql/9.4/pg_log/
postgresql-2015-03-23_134626.log  postgresql-2015-03-25_000000.log  postgresql-2015-03-25_095920.log
postgresql-2015-03-24_000000.log  postgresql-2015-03-25_095626.log
$ sudo ls /var/lib/postgresql/9.4/pg_log/*
ls: cannot access /var/lib/postgresql/9.4/pg_log/*: No such file or directory

ls /path/to/dir/ shows files, but ls /path/to/dir/* says no files found.
Why is this?

A: You're experiencing an aspect of the problem discussed in
sudo unable to write to /etc/profile
and How to append to a file as sudo?,
and the issue discussed in Who deals with the * in echo *?
Your primary shell interprets each command you type,
including wildcards (also known as globs or filename patterns).  If you type
some_command *
the shell enumerates the files in the current directory
and passes them to the command; e.g.,
some_command black blue brown green orange red white yellow
Well, if you don't have permission to read /var/lib/postgresql/9.4/pg_log,
then your shell
doesn't have permission to enumerate /var/lib/postgresql/9.4/pg_log/*.
The fact that, when the command runs, it runs as root, is too little,
too late — pathname expansion (i.e., wildcard interpretation) is done by then.
You can fix this with a trick discussed in the first two questions I referenced:
sudo sh -c "ls /var/lib/postgresql/9.4/pg_log/*"

This runs a privileged shell.  The privileged shell can then expand the *.

A: The wildcard is expanded by the shell before sudo is run. The current user can't access the files, so the string is passed literally to sudo and later ls. ls doesn't expand wildcards (it's the shell's duty), so it can't find the file named *.
Protect the wildcard by quoting and call a root shell to expand it:
sudo sh -c 'ls /var/lib/postgresql/9.4/pg_log/*'


text:
Q: maven-jaxb2-plugin: how to accomplish this xjc command-line in the pom.xml? Because of various issues with the XSDs I need to compile (described in other SO posts), I have a bindings file and also a local extension schema.  The following command line works correctly, but I'm having trouble figuring out the right pom.xml configuration to mimic this:
xjc -nv src/main/resources/TCIP_4_0_0_Final.xsd src/main/resources/local/ObaCcLocationReport.xsd -b src/main/resources/local/rename.xjb -d target

Mainly, how do I specify more than one XSD?  I tried:
<schemaDirectory>src/main/resources</schemaDirectory>
<schemaIncludes>
  <include>TCIP_4_0_0_Final.xsd</include>
  <include>local/ObaCcLocationReport.xsd</include>
</schemaIncludes>

but it seemed to ignore the second include.
I also tried variations on:
<schema>
  <fileset>
    <directory>src/main/resources</directory>
    <includes>
      <include>TCIP_4_0_0_Final.xsd</include>
      <include>local/ObaCcLocationReport.xsd</include>
    </includes>
  </fileset>
</schema>

without success.  Suggestions?
EDIT
This works as a workaround, but it's not ideal:
Since ObaCcLocationReport.xsd depends on schemas that get compiled as part of TCIP_4_0_0_Final.xsd, I just had to make sure it got compiled after that, and it seems to process files in filepath order.  So I put the ObaCcLocationReport.xsd into an x subfolder and changed the pom.xml to:
<schemaDirectory>src/main/resources</schemaDirectory>
<schemaIncludes>
  <include>TCIP_4_0_0_Final.xsd</include>
  <include>x/ObaCcLocationReport.xsd</include>
</schemaIncludes>

This compiled the schemas and generated the Java files correctly.

A: Disclaimer: I am the author of the maven-jaxb2-plugin.
So your compilation depends on the order of the schema files in the XJC command? Hm, interesting. Why?
Please post mvn -X clean generate-sources log in such cases.
It really seems that Maven does not maintain the order of the file patterns as I also get:
schemas=[file:/.../src/main/resources/local/ObaCcLocationReport.xsd,
         file:/.../src/main/resources/TCIP_4_0_0_Final.xsd]

Which is not what you want. Can be fixed, please file an issue. (I rely on one of the Maven libraries here, but can do it differently to maintain the order.)
You can configure it as follows:
<plugin>
    <groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <executions>
        <execution>
            <id>generate</id>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <strict>false</strict>
                <schemaIncludes/>
                <schemas>
                    <schema>
                        <fileset>
                            <includes>
                                <include>TCIP_4_0_0_Final.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                    <schema>
                        <fileset>
                            <includes>
                                <include>local/ObaCcLocationReport.xsd</include>
                            </includes>
                        </fileset>
                    </schema>
                </schemas>
            </configuration>
        </execution>
    </executions>
</plugin>

Gives you:
schemas=[file:/.../src/main/resources/TCIP_4_0_0_Final.xsd,
         file:/.../src/main/resources/local/ObaCcLocationReport.xsd]

Notes:

*

*Don't forget <schemaIncludes/> otherwise src/main/resources/*.xsd will be included by default.

*<strict>false</strict> gives you -nv.

*You can always do args/arg to configure xjc on the low level, but I won't recommend it.


text:
Q: java stream null check How to better way to check null values inside stream
List<Employee> employees1= employees.stream().filter(
                    employee -> students.stream()
                        .anyMatch(student ->
                               // checking null
                                employee!=null && student!=null &&
                                employee.getId()!=null && student.getName()!=null &&
                                employee.getId()==student.getId() &&
                                employee.getName().equals(student.getName()))
                )
                .collect(Collectors.toList());

A: I'm curious to see if your code throws a NullPointerException during execution. You are streaming your employees collection and then a students collection within the Employee object.
If your parent object, Employee, is a null value then you cannot possibly have a student collection on that object, as indicated in your inner-stream.
Consider introducing:
.map(employee -> Optional.ofNullable(employee)
.filter(Optional::isPresent)
.map(Optional::get)

before your filter. This will eliminate any null parent objects.
For your inner-stream, you still seem concerned that your student element is going to be null, so repeat these lines before your .anyMatch call.
For readability, I would consider extracting your null checks into smaller methods that describe what checks are being performed. For example you have the line:
employee.getName().equals(student.getName()

which suggests that you're looking for student elements where the employee and student names match. employeeAndStudentNamesMatch(employee, student) would suffice here.
For checking null values, you should really use the Optional API. This gives you options to wrap something that is potentially null in a safe wrapper to check if there is a value there or not. Extracting an example from your inner stream where you're checking for the presence of a student's name you can replace this with:
Optional.ofNullable(student.getName()).isPresent();

This is all the advice that I can really offer. Hope it helps you progress.


text:
Q: kB to MB using awk I have a script:

bash -c "echo \$[\$(egrep '^Commit(Limit|ted_AS): ' /proc/meminfo | awk '{ print \$2 }' | tr '\n' '-')0]"

which returns result in Kb and I need to convert it to Mb by dividing it to 1024.

A: With awk:
awk '/^Commit/{print $1,$2/1024,"Mb"}' /proc/meminfo

Output:

CommitLimit: 5536.77 Mb
Committed_AS: 13280.3 Mb


text:
Q: Stored procedure return the primary key after insert? I want a stored procedure to return the primary key of the new record after it gets executed. I think it will be returned by OUT parameter in the procedure. But how to select the newly inserted row ID ? I don't want to use select MAX(row_id) as it is a multi user environment.
Any procedure sample will be appreciated.
My platform is ISeries DB2 V5 R4. Thanks.
Edit
The row id Column is not an identity column. It uses a sequence for the key which gets generated via a trigger before insert on table.
Edit
Here is what I am trying to do
Begin Stored procedure
   Insert into Employees;
   (row id gets automatically generated by trigger)
Return row id ;

I want to avoid a select in returning row id.

A: just set the out parameter to the column that contains the PK.
CREATE PROCEDURE DB2TBL.DO_STUFF (IN Param1 INT, IN Param2 CHAR(32),OUT Param3 INT)
/* Param1 is primary key */
LANGUAGE SQL
P1: BEGIN
DECLARE OUTPARAM INT;
/* Do the stored procedure */
SET OUTPARAM = Param1;

A: --UPDATED---
Hi Popo,
First off could you give more detail on what you mean when you say the rowid is assigned by a trigger?
If you had a real identity column you would use the IDENTITY_VAL_LOCAL() function like this right after the INSERT: SELECT IDENTITY_VAL_LOCAL() INTO myrowid FROM SYSIBM.SYSDUMMY1;  I'm not 100% on that syntax because I generally use embedded SQL and it works differently there so you might have to play with it.  IBM documentation is at http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzscaidentity.htm.
However since you are doing something more complicated, I think this alternate method might work.  You'll need to re-format your INSERT to be wrapped in a SELECT.
SELECT myrowid
INTO myrowid
FROM FINAL TABLE (
   INSERT INTO myfile (myrowid, other_stuff) VALUES (default, 'blah')
)

You'll need to adjust for the proper field names and so on but I think this will do the trick.  There's not much documentation but if you want to see it go to http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/index.jsp?topic=/db2/rbafzbackup.htm and scroll all the way down to the bottom of the page.
Cheers

A: CREATE PROCEDURE ASF_InsertNewAuthorRequest
(IN @REQUESTTYPE CHAR(1), IN @UserID VARCHAR(18), IN @DATECREATED TIMESTAMP,  IN @REQUESTSTATUS CHAR(1))
    LANGUAGE SQL
    DYNAMIC RESULT SETS 1
P1: BEGIN

    DECLARE cursor1 CURSOR WITH RETURN for
    SELECT IDENTITY_VAL_LOCAL FROM SYSIBM.SYSDUMMY1;

    INSERT INTO AFS_REQUEST
        ( REQUESTTYPE, "UserID", DATECREATED, REQUESTSTATUS )
    VALUES
        ( @REQUESTTYPE, @UserID, @DATECREATED, @REQUESTSTATUS );

    OPEN cursor1;

END P1

A: INSERT INTO [User] (columns)
OUTPUT inserted.userId
VALUES (@values)

This will return the newly created userId column value... very simple.


text:
Q: Leibniz' Law and that good old riddle There exists a Theory of Identity in mathematical logic. I've encountered
it for the first time in
Principia Mathematica
by Alfred North Whitehead and Bertrand Russell (1910).
Quote: "This definition states that $x$ and $y$ are to be called identical when
every predicative function satisfied by $x$ is also satisfied by $y$".
Many contemporary philosophers call the principle which expresses this view
"Leibniz' Law".One particularly explicit statement can be found in
Introduction to Logic and to the Methodology of Deductive Sciences by
Alfred Tarski.
In chapter III, On the Theory of Identity, it is read that
"Among logical laws which involve the concept of identity, the most fundamental
is the following: $x = y$ if, and only if, $x$ and $y$ have every property in
common. This law was first stated by Leibniz (although in somewhat different terms)."
Tarski does not provide a reference to the place where, according to
him, Leibniz stated that law. Further refinements can be found on the
Internet.
But, for our purpose, it is sufficient to stick to the original definition,
as given with the Theory of Identity by Tarski / Russell and Whitehead:
$$
 (x = y) :\Longleftrightarrow
 \left[\;\forall P : P(x) \Longleftrightarrow P(y) \;\right]
$$
Where $:\Longleftrightarrow$ means: logically equivalent by definition.
Let's try something with that definition. Every property
in common, they said. We take that quite literally and have, for example:
$$
  P(x) :\Longleftrightarrow
  ( x \, \mbox{is on the left of the} \, "=" \, \mbox{sign} )
$$
With this property in mind, consider the expression:
$$
    1 = 1
$$
Then we see that the $1$ on the right in $1 = 1$ is not on the left, hence the
property $P(1)$ as defined does not hold for that one. Consequently: $1 \ne 1$.
We have run into a paradox.
Oh, you should say, but self-referential properties are of course not allowed.
Sure, I am the last one to disagree with you. This highly artificial example
stresses an important point, though:

With Leibniz's Law, almost any but not all properties are in common

The numerosity of these (not self-referential) properties can still be infinite.
Let $A$ be a set of properties $P_k$ and let's call $A$ the aspect or
scope of the equality (- anybody who knows a better name ? You're quite welcome ! -):
$$
   A := \left\{ \; P_0(x), P_1(x), P_2(x), \cdots , P_n(x) \; \cdots \right\}
$$
Then ($x = y$) shall be pronounced as $x$ is equal to $y$ with respect to
$A$, and may optionally be written as:
$$
 (x \stackrel{A}{=} y) :\Longleftrightarrow
 \left[\;\forall P_k \in A : P_k(x) \Longleftrightarrow P_k(y) \;\right]
$$
It's a matter of routine to prove that common properties of equality (reflexive,
symmetric, transitive) are not different with the above modified definition:
$$
  x \stackrel{A}{=} x \\
  (x \stackrel{A}{=} y) \Longrightarrow (y \stackrel{A}{=} x) \\
  ((x \stackrel{A}{=} y) \wedge (y \stackrel{A}{=} z))
  \Longrightarrow (x \stackrel{A}{=} z)
$$
Up to now, we have not been very clear about what sort of properties one should
have in mind, when comparing object $x$ with object $y$ in some respect $A$.
Therefore consider the decimal representation of numbers and define the following properties:
$$
  P_{c,k}(x) \; :\Longleftrightarrow \;
  \mbox{" cipher at position $k$ in the decimal representation of $x$ is $c$ "} \\
  \mbox{where} \quad c \in \{0,1,2,3,4,5,6,7,8,9\}
$$
We have the two (in)famous numbers, as announced in the header:
$$
    1.000... \quad \mbox{and} \quad 0.999...
$$
Indeed, there exist numerous proofs of the following statement ( e.g.
Wikipedia ) :
$$
    1.000... = 0.999...
$$
However, the following statement is easy to prove now as well. So we have run into some sort of a paradox:
$$
   \neg \left[1.000... \stackrel{A}{=} 0.999... \right]
$$
This raises some obvious Questions.
Maybe "common" equality in mathematics is not Leibniz' equality ?
But how can that be?Hasn't equality been rigorously defined with Russel's / Tarski's
Theory of Identity ?Or maybe, is there a difference between identity and equality in mathematics ?Should $\equiv$ and $\stackrel{A}{=}$ be identified
perhaps ? And is the following statement true then:
$$
   1.000... = 0.999... \qquad \mbox{but} \qquad 1.000... \not \equiv 0.999...
$$

A: Are you sure that you are not mixing two different concepts ? When you consider decimal representation of real numbers, you are speaking of :
1) rational numbers approximating the real number : in this case $1.000$ and $0.999$ are different rational numbers
2) two names for the same object (the real number $1$) : in this case you are dealing with names as string of symbols of infinite lenght, that are not so "standard".
Added Dec,17.
I think that there are different aspects regarding identity.
1) From a mathematical point of view, equality is not defined; it is assumed. We simply know what equality between numbers, triangles, etc. are.
2) In mathematical logic, first-order logic (see Wikipedia) :

includes the equality symbol as a primitive logical symbol which is always interpreted as the real equality relation between members of the domain of discourse, such that the "two" given members are the same member. This approach also adds certain axioms about equality These equality axioms are:
1.Reflexivity.
2.Substitution for functions.
3.Substitution for formulas.
Many other properties of equality are consequences of the axioms above, for example: symmetry and transitivity.

In second-order logic, the insight of Russell, etc, was that, assuming a formal counterpart of Leibniz's principle, it was possible to derive the aforesaid basic properties of equality. Is this a definition of identity ?
3) And now we have the philosophical issue : what is identity ? According to Quine, second (and higher)-order logic is deeply involved with "ontological committments". So we can hardly say that its definition of equality has answered the philosophical issues related with identity.
Added Dec,17 - part 2
You can read some useful comments in S.C.Kleene, Mathematical Logic (1967) , pag.163 :

In second-order predicate calculus, we can regard $x=y$ as an abbreviation for $\forall P(P(x) \leftrightarrow  P(y))$, instead of introducing it as a primitive predicate. Since conceptually the idea of equality underlies our notion of a domain and of predicates over the domain, it seems more elementary and direct to introduce equality as we do than to define it by refernce to all predicates.

You can see also Derek Goldrei, Propositional and Predicate Calculus (Springer, 2005), para.5.4: The equality axioms and non-normal structures, where the limitations of axioms for equality are discussed.

A: Thanks to some useful comments and an answer (and the downvotes)-:
I think now that one of the above definitions is wrong and should be replaced by
the following (also mind the additional '.') :
$$
  P_{c,k}(x) \; :\Longleftrightarrow \;
  \mbox{" symbol at position $k$ in the decimal representation of $x$ is $c$ "}
  \\ \mbox{where} \quad c \in \{\mbox{'.'},\mbox{'0'},\mbox{'1'},\mbox{'2'},\mbox{'3'},\mbox{'4'},\mbox{'5'},\mbox{'6'},\mbox{'7'},\mbox{'8'},\mbox{'9'}\}
$$
This would mean that the rest of my argument in the question is essentially about
character strings representing the numbers and not about the numbers "themselves".
Then, of course, it's trivial that:
$$
   \mbox{'1.000...'} \ne \mbox{'0.999...'}
$$
Update. A nice example of the non-triviality of (non)identity is the following.
Suppose $x$ and $y$ are pictures, like in well known puzzles for children,
when they say "find the differences":

Instead of a single index $(k)$, a double index $(i,j)$ may be preferred here
for the predicates $P$ :
$$
  P_{i,j}(x) \; :\Longleftrightarrow \; \mbox{"pixel in $x$ at position $(i,j)$ is black"}
$$
The aspect $A$ of the identity is finite in this case:
$$
 (x \stackrel{A}{=} y) :\Longleftrightarrow
 \left[\;\forall P_{i,j} \in A : P_{i,j}(x) \Longleftrightarrow P_{i,j}(y) \;\right]
$$
It doesn't matter though how many predicates $P$ are actually involved for the
reflexive, symmetric, transitive properties of $\,\stackrel{A}{=}\,$ to hold.
So the above pictures are in fact always equal in some respect, even if (quite)
some pixels are not the same; just remove the corresponding predicates from the
aspect $A$ and you're done.


text:
Q: getElementById & onclick Button function won't work Thanks alot to wiz kid & Axel Martinez ! Problem is solved !
works this way:
$(document).ready(function() {
    $("#info").on('click', function() {
        $(".infos").toggleClass("infos_sichtbar");
    });

i am trying to use my button with getElementById,
but it won't work :(
The script is for a WebApplikation that is going to be a native App converted by PhoneGap.
I want to change the CSS class of an element with the script, so that my div called "infos" is getting visible. It works with this script:

But the problem is, there are two buttons, one for informations that should get visible with the click and one for legal notices ...
I'm trying to get it work this way:
first attempt:
$(document).ready(function() {
        $.getElementById("info").on('click', function() {
            $(".infos").toggleClass("infos_sichtbar");
        })
    });

second attempt:
 $(document).ready(function() {
        $.getElementById("info").onclick = function() {
            $(".infos").toggleClass("infos_sichtbar");
                    }
                 /* $.getElementById("legalnotice").onclick = function() {
            $(".legalnotice").toggleClass("legalnotice_sichtbar");
        }*/
    });

When im using the script, the click on the button doesn't do anything.
Edit:
HTML Code:

Blub blub blub blub blub blub blub blub

App

welcome!

intro

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

<button id="info">Infos</button><button id="impress">Impressum</button>

The script is implemented with the app.js file.

A: Try using
$("#info")

instead of
$.getElementById("info")

i.e.
$(document).ready(function() {
        $("#info").on('click', function() {
            $(".infos").toggleClass("infos_sichtbar");
        });
});

A: If you are using jQuery, why not use the selectors like
$(document).ready(function() {
    $("#info").click(function() {
        $(".infos").toggleClass("infos_sichtbar");
    });
});


text:
Q: Photographing the night sky - How important is fixed alignment of the camera? If I set up my long exposure camera on a tripod and point it at the sky at night with the pole star in the centre we get a lovely image of concentric circles or arcs of circles depending on exposure times. Once one of the legs of the tripod went faulty (slowly collapsed a few mm) and the image was fuzzy and no longer circles. But it occurred to me that if this trivial angular movement distorted the image so much then why does the relative rotation of the earth on its axis not have the same effect on the photograph. Surely movement of the earth on its axis with a fixed camera would produce an angular displacement of the image in the same way as an accidental movement of the camera. What is the explanation for this?

A: The answer: it does.
You know those lovely concentric circles or arcs that you're photographing?  That is the result of the earth rotating about its axis.  If it were not for the earth rotating, those circles would be the point-source stars that you you see with your eye.

A: Without seeing the result, it is difficult to do anything more than make a guess. But I suspect the explanation is mechanical rather than optical. A nearby image would be shifted out of focus if the lens or photographic plate were tilted relative to each other, but such blurring would not occur for distant objects or if the whole camera were tilted smoothly.
If the motion of the tripod had been as smooth and precise as the rotation of the Earth then your photograph would not have been blurred. The fact that the tripod leg was loose meant that the camera could have wobbled slightly due to breezes. Also the leg probably collapsed jerkily, in slip-stick motion, which could have set up small vibrations in the tripod.
Advice from Photography SE :
How can I prevent blurred images when using a tripod?
Why are my night photographs always blurry?