text:
Q: Why does my battery life drops when I use a dual boot with windows? I have a very weird problem that makes absolutely no sense.
When I installed Ubuntu in dual boot for the first time on my GF's PC (Asus ROG GL... Laptop), it worked great, and battery life was excellent (4 hours on a full charge). For a few days it was all running smoothly, but as soon as she booted it into windows, and then back into Linux, the battery life sucked, less than half of what it was the day before (1h and a half on a full charge).
We accepted our fate and decided not to bother fixing that, but after the 22.10 update, the problem was fixed. The battery life got up to what it was after a fresh install. But once again, as soon as she rebooted it into windows and back into Linux, it dropped to less that half of what it was just before.
I know it shouldn't be a problem, that battery doesn't care what os it's running on, but I've had kind of similar problems with a wifi card, for which I had to disable the option "allow windows to disable this device for battery saving" (or something like that) for it to work under Ubuntu.
Do you have any idea what might be the problem?


text:
Q: Install windows 98 on my PC I want to install windows 98 on my PC. But it says that windows 98 is supported by the system. Here are the specifications of the PC
Processor - Core 2 Quad 6600
Mother Board Chip set - G 41
Ram - 4 GB DDR3
VGA - Asus 4850
How I install Windows 98 on this PC. Which hardware is the incompatible on with Win 98?

A: Install virtual machine (for example VirtualBox) in your OS.
Then install Win98 into the virtual machine and run the Win98 in virtual machine.

A: Windows 98 is from long time out of support. So you (with very high probability) will not find drivers for motherboard, videocontroller, network.
Think about install Windows 7 or 8. Or some linux distribution

redpajama_set_name: RedPajamaStackExchange


text:
Q: SharePoint Analytics to get page visit count Can anyone provide a way to get individual site page's visit count using SharePoint analytics for one year, month wise?

A: You could generate a page view report in SharePoint site.
Go to site settings->site collection administration->audit log report-> Content viewing.
It will generate the view count for the page in the report.
And you also could get the view count of one page by custom code. For more detailed information, refer to the articles below.
Step by steps on how to display Most Visited Sites with number of view count in SharePoint 2013 Web Analytics.
SharePoint 2013: Showing Page Views within a SharePoint Page.


text:
Q: How to concatenate MKVs with different tracks I have an mkv film and a separate mkv with an introduction by the director. I'm trying to use mkvmerge to concatenate them. However, the film has subtitles and the intro has no subtitles, and this seems to be causing a problem.
Specifically, the track output from mkvinfo intro.mkv is:

| + A track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 1
|  + Track type: video
|  + Default flag: 0
|  + Lacing flag: 0
|  + MinCache: 2
|  + Codec ID: V_MPEG2
|  + CodecPrivate, length 164
|  + Default duration: 33.367ms (29.970 frames/fields per second for a video track)
|  + Video track
|   + Pixel width: 720
|   + Pixel height: 480
|   + Display width: 853
|   + Display height: 480
| + A track
|  + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
|  + Track UID: 2
|  + Track type: audio
|  + Codec ID: A_AC3
|  + Default duration: 32.000ms (31.250 frames/fields per second for a video track)
|  + Name: Stereo
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 2

and mkvinfo film.mkv gives:

| + A track
|  + Track number: 1 (track ID for mkvmerge & mkvextract: 0)
|  + Track UID: 1
|  + Track type: video
|  + Default flag: 0
|  + Lacing flag: 0
|  + MinCache: 1
|  + Codec ID: V_MS/VFW/FOURCC
|  + CodecPrivate, length 74 (FourCC: 0x57564331 "WVC1": VC-1)
|  + Default duration: 41.708ms (23.976 frames/fields per second for a video track)
|  + Video track
|   + Pixel width: 1920
|   + Pixel height: 1080
|   + Display width: 1920
|   + Display height: 1080
| + A track
|  + Track number: 2 (track ID for mkvmerge & mkvextract: 1)
|  + Track UID: 2
|  + Track type: audio
|  + Codec ID: A_AC3
|  + Default duration: 32.000ms (31.250 frames/fields per second for a video track)
|  + Name: Surround 5.1
|  + Audio track
|   + Sampling frequency: 48000
|   + Channels: 6
| + A track
|  + Track number: 3 (track ID for mkvmerge & mkvextract: 2)
|  + Track UID: 4
|  + Track type: subtitles
|  + Default flag: 0
|  + Lacing flag: 0
|  + Codec ID: S_HDMV/PGS
|  + Content encodings
|   + Content encoding
|    + Content compression

I tried mkvmerge -o full.mkv intro.mkv + film.mkv but that gives me
Error: The file no. 0 ('intro.mkv') does not contain a track with
the ID 2, or that track is not to be copied. Therefore no track
can be appended to it. The argument for '--append-to' was invalid.

It's not clear to me from the man page for mkvmerge how to specify to --append-to that the intro track should just not have subtitles and the timecodes for the film subtitles can just be shifted. Is that beyond the capability of mkvmerge?
Perhaps I need to be looking into some other tool like ffmpeg to concatenate the audio/video from mkvextract and then some other tool to manipulate the PGS subs and them mkvmerge them all together again?
Am I going to run into further problems because the audio/video differ between the two files as well (e.g. stereo vs 5.1)?
Thanks

A: Your problems are caused because the two videos are fully different, not (just) because of the subs.

How to concatenate MKVs with different tracks

The quick answer is uncompress your audio tracks (to say, WAV), mux them (stitch them together) and then compress the audio (to say, AC3)
The best way to do this is to convert the soundtrack to uncompressed WAV, (to prevent out-of-sync), separately for each MKV-file.
Then concantenate and then recode them but don't recode the video stream, just the audiostream to a compressed format (MP3, AAC or AC3)
The above in steps:
1. Blow up the audio for each file, to an uncompressed format
2. Stitch them together.
3. Recode only audio to a compressed status
After 2, you should check if your audio is really sync.
You can do all of this with VirtualDub, or AviDemux 2.6.12 (set Video Output to copy), these are free and not malware.

Perhaps I need to be looking into some other tool like ffmpeg to
  concatenate the audio/video from mkvextract and then some other tool
  to manipulate the PGS subs and them mkvmerge them all together again?

If you don't have denominational issues with Windows, rather than Linux, you could also convert your subs to ".SRT" format, and use that. I'm inclined to think it's easier to work with a text based format, than with a picture based format. Up to you.

Am I going to run into further problems because the audio/video differ
  between the two files as well (e.g. stereo vs 5.1)?

In general, YES!
The 2 audio tracks should have as identical characteristics as possible, so both stereo, this is the easiest because it's the most  universal. Don't use 5.1, unless you are in a theater.
Your videos should be the same width and heigth, so either 1920 x 1080 or 720 x 480
My advice is to edit the shorter intro video. You can choose between:
- adding a border (but, it will be a tiny image)
- increase the width x height to 1920 x 1080 (but, it will be grainy)
- do both, half way, to split the difference. In your case this means:
a. increase the width x height to  1440 x 640
b. add a border of 240  - (1920-1440)/2 - left and right and a border of 220  - (1080-640)/2 to top  and bottom.


text:
Q: Print function not printing in order print('*'*11,'Welcome to Salad Bar','*'*11,'\n')
print('\t1.Order Salad')
print('\t2.checkout')
print('\t3.Quit')
option = input('Select your option(1-4): \n')
if option == 1:
    print('Salad menu\n1.Vegetarian-$10.99\n2.Seafood-16.99\n3.Protein-14.99')

When I ran the code, here is the output
Select your option(1-4):
*********** Welcome to Salad Bar ***********

    1.Order Salad
    2.checkout
    3.Quit

Not sure why the "welcome to salad bar...." is not printed first.

A: Can you specify the version of python you're running? I'm on 3.7.4 and cannot seem to recreate

*********** Welcome to Salad Bar ***********

1.Order Salad
2.checkout
3.Quit
Select your option(1-4):

A: I tried running your code in VS Code, in Jupyter Notebook, and from a Windows command prompt.  In all three cases, I got the 'Welcome to Salad Bar' line first, as you expected.  So there might be something wrong with your Python setup.
If you are not using an environment such as VS Code, that highlights tricky errors such as not-quite-right indentation and such, I suggest that you do so.  I have found this very helpful, and it might help you here.  VS Code is free and was recommended by a friend, and there are other free environments and editors out there with similar features.
There is also one small issue with your code:  The "if option == 1" clause will never be True because the input command returns a string.  It will work if you say this:
if option == str(1):

*

*Eliot

P.S.  I see that you are new to Stackoverflow.  Me too!  This is the first time I have offered an answer.  Hope it was helpful.


text:
Q: SyntaxError in Rails Why it is giving this error?
Please see the Image

    <%= f.label :category %>

    <%= f.select :category_id, Category.all.collect {|x| [x.name, x.id]}, {:include_blank => 'Select One'} class:'form-control' %>

A: You are missing a comma before class

    <%= f.label :category %>

    <%= f.select :category_id, Category.all.collect {|x| [x.name, x.id]}, {:include_blank => 'Select One'}, class:'form-control' %>


text:
Q: Circular dependency with updateValueAndValidity on dynamic validator I have an issue adding dynamic validator to form fields.
So I need to have validation on fields only if one of them has value. So if user enters value in any of the three field it should trigger requiredIf validator on all fields, but then I have:

ERROR RangeError: Maximum call stack size exceeded

But if I don't use updateValueAndValidity() it will not apply validators that I have set in setValidators();
Is there any solutions for this issue, the code is the following:
ngOnInit(): void {
    ...

    this.mainForm.get('CargoWidth').setValidators([requiredIf(this.f['CargoLength']), requiredIf(this.f['CargoHeight'])]);
    this.mainForm.get('CargoLength').setValidators([requiredIf(this.f['CargoWidth']), requiredIf(this.f['CargoHeight'])]);
    this.mainForm.get('CargoHeight').setValidators([requiredIf(this.f['CargoLength']), requiredIf(this.f['CargoWidth'])]);

    this.onApplyValidators();
}

onApplyValidators() {
    this.f['CargoLength'].valueChanges
        .subscribe(value => {
            if (value === undefined)
                return;
            this.f['CargoWidth'].updateValueAndValidity();
            this.f['CargoHeight'].updateValueAndValidity();
        });

    this.f['CargoWidth'].valueChanges
        .subscribe(value => {
            if (value === undefined)
                return;
            this.f['CargoLength'].updateValueAndValidity();
            this.f['CargoHeight'].updateValueAndValidity();
        });

    this.f['CargoHeight'].valueChanges
        .subscribe(value => {
            if (value === undefined)
                return;
            this.f['CargoWidth'].updateValueAndValidity();
            this.f['CargoLength'].updateValueAndValidity();
        });
}


text:
Q: How can I transfer a grayscale Image to depth Image My question here is I got a Grayscale Image which the grayscale stands for the depth information, so how can I transfer this grayscale information go back to depth information? Than kyou.
it's rgb mode right now, but each pixel represent a gray color with different level


text:
Q: How to do Complex Querying with Firebase? I'm creating my first app in Firebase.  I have no experience with NoSQL, so working out my data structure is proving to be a challenge.  Let's say my app is similar Reddit where users visit the site and read/write posts.  I want the app to have a list view where it sorts the post data in several ways, however it is all centered around the date posts where submitted:
Views

*

*Show the latest posts in descending order.

*Show the latest posts for a specific tag.

*Show the most liked posts in descending order for the last day (24 hours).

I assume the data structure to look this:
{
    "posts": {
        "post_0": {
            "content": "...",
            "created_at": 1497112445748,
            "likes": 100,
            "tags": {
                "tag_0": true,
                "tag_2": true
            }
        },
        "post_1": {
            "content": "...",
            "created_at": 1497112549374,
            "likes": 30,
            "tags": {
                "tag_1": true
            }
        },
        "post_2": {
            "content": "...",
            "created_at": 1497112640376,
            "likes": 70,
            "tags": {
                "tag_1": true,
                "tag_2": true
            }
        },
        ...
    }
}

View 1
This is probably the easiest to resolve.  I imagine the script to retrieve the data would be something like this:
const ref = firebase.database().ref("posts");
const query = ref.orderByChild("created_at").limitToLast(50);
query.on("child_added", (snapshot) => {
    // Do stuff like add to array for sorting
});

View 2
This is where things get tricky.  Since you can only have one orderBy* per query, the only way I can see to pull this off is to have a tags node that duplicates the date and post ID.  For example:
{
    "tags": {
        "tag_2": {
            "post_0": {
                "created_at": 1497112445748
            },
            "post_2": {
                "created_at": 1497112640376,
            }
        },
        ...
    }
}

I've read this is the whole concept of denormalization and structuring your data around your views, but isn't there a better way?
View 3
I don't know how to solve this one at all.  As the last 1 day is changing every time the view is requested and the likes are fluctuating often, how can I possibly structure my data around this view?
I've read that push keys, which would take place of the post_n key I have in my example, are sequential and can somewhat be relied on as a timestamp.  I'm not sure if there's some way to take advantage of that.

I've found a few useful videos by the Firebase team and articles on Medium, but I'm afraid they don't go far enough for me to understand how to accomplish the needs of my app.

*

*Common SQL Queries converted for the Firebase Database

*Firebase Data Structures: Pagination
I'm just find this aspect of Firebase really confusing to get my head around to have it return the data I need for my views.
If anybody can provide me with an example of how to accomplish these things, it would be much appreciated!  Thanks!


text:
Q: How to prove by induction the constructibility of a line segment of length $\sqrt{n}$? How to prove the following statement by induction?
If a line of unit length is given, then a line of length $\sqrt{n}$ can be constructed with straightedge and compass for each positive integer $n$.
The statement obviously holds for $n=1$.
Now we assume that we can construct a line of length $\sqrt{k}$ with straightedge and compass, where $k$ is a given positive integer.
How to proceed from here?
That is, how to show from this that a line of length $\sqrt{k+1}$ can also be constructed with straightedge and compass?

A: Use Pythagoras' theorem for the right-angled triangle with legs $\sqrt{k}$ and $1$.


text:
Q: Place a panel on the lower corner of page in BootstrapCSS I am using BootstrapCSS 3 in order to make a map application. I have created a panel as following:

                Legend

What I want is to place this panel on the button of the page. And when the page is autoresized to remain there (on the lower right corner). I tried to use margin-top: x% or maging-buttom but it doesn't give the result I want.
Its not responsive.

A: Try to add
bottom: 10px;
position: fixed;
float: left;

to
 in your css


text:
Q: Joomla Cant Connect to DB This sounds really easy to fix but I've been working on it for awhile.
Database Error: Unable to connect to the database:Could not connect to MySQL

I had to make a local copy of Joomla for backup and changes so I didn't mess up the live site.
I grabbed all the files off the live site via FTP.  Did a DB dump.  Put the DB on my local machine, copied the Joomla files to a subfolder of my server root.  Changed config variables to fit the current setup of PHP, Mysql, Apache.
Now I put in a test.php which connected and queried the DB fine.
$db = mysql_connect("localhost","root","sunshine") or die ('Unable to connect to Database!');
mysql_select_db("iweb");

$query = "SELECT * FROM jos_content LIMIT 0 , 30";
$results = mysql_query($query);
while($row = mysql_fetch_assoc($results)){
    echo '
'.$row['title'];
}

however when I put the same DB credentials into the configuration.php it gives the the aforementioned error.
I have been looking at the .htaccess and haven't found anything.
Anyone have an idea of what is going on here?
Joomla 1.5.4, Apache 2.2.X PHP 5.2.X on a Windows XP Professional Box.

A: Try 127.0.0.1 instead of localhost. It is the same but sometimes (and in my configuration too) only ip works fine.

A: If you still having this problem, the easiest solution is to install JoomlaPack on your live server to backup everything. Download the zip file to your local server, unzip the file, point your web browser at the unzipped folder, and follow the instructions.  If you're going to move back and forth between live and local servers, this is a must have program.

A: You don't need to connect manually to database using mysql_connect because joomla uses its own mechanism to connect to the database. All you need to do is to specify the db settings in the configuration.php file which is present in root of joomla installation. Once you have done that, you you run queries straight away, for example this is what you need:
$query = "SELECT * FROM jos_content LIMIT 0 , 30";
$results = mysql_query($query);
while($row = mysql_fetch_assoc($results)){
    echo '
'.$row['title'];
}

however when I put the same DB
  credentials into the configuration.php
  it gives the the aforementioned error.

Make sure that:

*

*You specify the correct db settings

*The configuration file is readable by Joomla, check its permissions.

A: Just replace
" var $dbtype = 'mysql';   "
with
"var $dbtype = 'mysqli';    "
in global configuration.
I think it works.


text:
Q: Can someone show me how to fix my Two-Way ANOVA Test? Here is my subset
Here is my normality test
import statsmodels.api as sm
from statsmodels.formula.api import ols

#perform two-way ANOVA
model = ols('FG% ~ C(AVG_Salary_Range) + C(AGE_Range) +
C(AVG_Salary_Range):C(AGE_Range)', data=subset).fit()
sm.stats.anova_lm(model, typ=2)

Here is the error for the ANOVA code above
Can you please comment if you need more of my code? I can edit itquickly.


text:
Q: Find a basis for the space of cubic polynomials $p$ such that $p(3) = 0$ What will be the basis for the space of cubic polynomials $p$ such that $p(3) = 0$?
I know that: A natural basis for the vector space of cubic polynomials  is $p(3)$ is $\langle 1, x, x^2, x^3 \rangle$.

A: One way to arrive at the basis proposed by André is the following: if $p(x)= ax^3 + bx^2 +cx +d$ has $3$ as a root, then
$$
0 = p(3) = 27a + 9b + 3c + d \ \qquad \Longrightarrow \qquad \ d = -27a - 9b -3c \ .
$$
This means that for polynomials of degree less than or equal to $3$ having $3$ as a root, you can choose, for instance, coefficients $a,b,c$ at will, but then you have no other choice for $d$ than $-27a-9b-3c$. So these polynomials look like:
$$
p(x)= ax^3 + bx^2 +cx -27a-9b-3c = a(x^3-27) + b(x^2 - 9) - c(x-3) \ .
$$
Remember that you can choose any $a,b,c$? Hence, this last expression means that all polynomials having degree less than or equal to $3$ and $3$ as a root are linear combinations of André's basis:
$$
x^3-27,\  x^2 - 9,\ x-3 \ .
$$
So, these ones generate all your polynomials and now you just need to prove that they're linearly independent.

A: We want to find a basis for the vector space $V$ of all polynomials $p(x)$ of degree less than or equal to $3$ such that $p(3)=0$.  (I will assume that the vector addition is ordinary addition of polynomials, and that the multiplication by scalars is the usual one. Maybe you are expected to prove that $V$ really is a vector space. I leave that part, if it is needed, to you.)
It is easy to see that $V$ is a proper subspace of the space of all polynomials $p(x)$ of degree less than or equal to $3$ (after all, $1$ is not in $V$). In particular, the dimension of $V$ is less than $4$.
We will show that
$$\{x-3, x^2-9, x^3-27\}$$
is a basis of $V$.
It is easy to verify that the vectors in our proposed basis are linearly independent (that part is left to you).  They all vanish at $x=3$. It follows that any linear combination $a(x-3)+b(x^2-9)+c(x^3-27)$ of them must also vanish at $3$.
There are $3$ vectors in our proposed basis.  Thus they generate a subspace of $V$ of dimension $3$. As we observed earlier, $V$ has dimension less than $4$. This shows that our $3$ vectors generate all of $V$.
There are many other choices of basis: any $3$ linearly independent polynomials of degree $\le 3$ that vanish at $3$ will do the job.

A: Take a basis of the space of degree at most $2$ polynomials, and multiply it by $x-3$.
More precisely, a tuple $(p_1,p_2,\dots)$ of polynomials is a basis that fits the bill, if and only if each $p_i$ is divisible by $x-3$, and the tuple of quotients is a basis of the space of degree at most $2$ polynomials.

A: The subset of $\mathbb{R}[X]$, $\mathbb{R}_3[X]=\{P\in \mathbb{R}[X], deg(P)\leq 3\}$ is a vectorial subspace of dimension 4 a basis of which is $1$, $x$, $x^2$, $x^3$. $\phi:\mathbb{R}_3[X]\rightarrow \mathbb{R}_3[X], \phi(P)= P(3)$ is a linear form on this subspace. The set we are considering is its kernel and therefore is a subspace of dimension $4-1=3$. The set $\{x-3,(x-3)^2,(x-3)^3\}$ is a free family of three polynomials such that $\phi(P)=0$ and thus the basis we are looking for.


text:
Q: Find all of the channels of all of the guilds where the bot is in I want to code a commande (/channels), I want for this command, that reply a guild name and all of the channels of this guild (the channel name and id )
here's my code :
bot.on('message', msg => {
    if(msg.content === PREFIX + "channels") {
        // var roles = bot.guilds.role/*.forEach(role => console.log(role.name));*/
        // console.log(roles)
        msg.channel.send("Servers:")

        bot.guilds.forEach((guild) => {

            msg.channel.send(" - " + guild.name)

            bot.guilds.channels.array().forEach((channels) => {

                msg.channel.send('---' + channels.id + "&" + channels.name)

            })
    })}
})

A: client.on("message", message => {
    if (message.author.bot) return false;

    if (message.content.toLowerCase() == "/channels") {
        client.guilds.cache.forEach(guild => { // Looping through the guilds.
            const Embed = new discord.MessageEmbed();
            const Channels = guild.channels.cache.map(channel => `${channel.id} | ${channel.name}`).join(", ") // Getting the channels and mapping them by ID and NAME.

            Embed.setTitle(`Channels for ${guild.name}`);
            Embed.setDescription(Channels);

            message.channel.send(Embed); // Sending an EmbedMessage for each guild.
        });
    };
});


text:
Q: Which word fits better in this case: focused, aimed or oriented?
*

*My research is focused to find life in other planets.

*My research is aimed to find life in other planets.

*My research is oriented to find life in other planets.
In formal writing, which one is better and why? Also is it better to or on?

A: The three options all sound slightly like business "buzzwords" out of place.
Perhaps this is more simple and therefore better: "The purpose of my research is to find life on other planets".

A: FumbleFingers is definitely giving you the right advice: use gerunds.
Avoid "focussed", it is an overused buzzword with so little of its original meaning left to it. You focus light and energy, not research.
But above all, David Aldridge "hits your nail on the head". If that's what you are trying to say, he's saying it perfectly.


text:
Q: Static class methods declaration in header c++ I have a static class that has a few methods called from its functions. As I can't add them to the header file as private functions and I don't want them to be seen outside the class I'm coding them in the cpp file. My question is, as I have to write the doc of the project, is there anyway I can add these functions to the header? (I don't like writing the doc in the cpp if it's not coding explanation).
example:
MyStaticClass.h

class MyStaticCLass{
 public:
 /**
 * I can write the doc here :D
 */
 static void myFunction();
}

MyStaticClass.cpp
 void MyStaticClass::myFunction(){
  myMethod1();
  myMethod2();
 }
 /**
 *I want to write the doc of this function but in the header
 */
 void myMethod1(){
 //do something 1
}
 /**
 *I want to write the doc of this function but in the header
 */
void myMethod2(){
// do something 2
}

A: First of all you're mixing up the terms "method" and "function". A method is a class member function (static or not), which is what myFunction is. The functions meMethod1 and myMethod2 are not methods, they are non-member functions, or "free" functions.
Secondly, if you want the functions myMethod1 and myMethod2 to be calable only from within the MyStaticClass.cpp source file, then I recommend you put them into its own anonymous namespace:
#include "MyStaticClass.h"

// An anonymous namespace
namespace
{
    /**
     *i want to write the doc of this function but in the header
     */
    void myMethod1(){
        //do something 1
    }

    /**
     *i want to write the doc of this function but in the header
     */
    void myMethod2(){
        // do something 2
    }
}

void MyStaticClass::myFunction(){
    myMethod1();
    myMethod2();
}

Furthermore, if you have a class with only static member function ("methods") and no member variables, then it's no different from a namespace. So in your case your header file might look like
#pragma once

namespace MyStaticClass
{
    /**
     * i can write the doc here :D
     */
    void myFunction();
}

The source file doesn't have to change from what I show above.


text:
Q: Scroll a webview in Robotium? How to automatically scroll a WebView down to bottom in Robotium?
We use a WebView to disaply EULA by the way.

A: Have you tried using the scrollDown function?

A: I've found that clicking on the view, then pressing the Down key some set number of times can do what you want.  So something like:
solo.clickOnView(getActivity().findViewById(R.id.your_eula_webview_id));
for (int i=0;i<20;i++) {
    solo.sendKey(Solo.DOWN);
}

If that doesn't work, try finding something that does using the keyboard on the emulator, and then do the same with Robotium.

A: First answer is work, but it's not flexible
I think you can override the methond
clickOnWebElement(By by, int match, boolean scroll){}

write
solo.sendkey(Solo.DOWN);

into it


text:
Q: what is unconditional self loop in promela? I am working on a project which involves SPIN Model checker.SPIN version 6.4.7 and ispin version 1.1.4 I am getting this error on ispin saying

state 76: unconditional self loop

    proctype TDMAProtocol(byte id; chan P1, P2, PR)

54  {

55       byte id_j, members_j, r_j;

56     do

57        ::nodeState[id].r == id ->
58           nodeState[id].r =  (nodeState[id].r + 1) % 4;

59
60        atomic {
61  //       printf("-- %d New round %d member %d cmembers %d\n" , id, nodeState[id].r,nodeState[id].members, nodeState[id].cmembers);

62
63           nodeState[id].r =  (nodeState[id].r + 1) % 4;

64           nodeState[id].messageLost[0] = nodeState[id].messageLost[0]+1;

65           nodeState[id].messageLost[1] = nodeState[id].messageLost[1]+1;

66           nodeState[id].messageLost[2] = nodeState[id].messageLost[2]+1;

67           nodeState[id].messageLost[id] = 0;

68  //       nodeState[id].round = 1;
69
70            // Send aloha
71            if
72            ::nodeState[id].state == ALOHA && nodeState[id].p == 0 ->
73
74  //            printf("%d --Sending \n" , id);
75                P1!id,nodeState[id].members,nodeState[id].r;
76                P2!id,nodeState[id].members,nodeState[id].r;
77                 if
78                    ::true ->  nodeState[id].p = 0;
79                    ::true ->  nodeState[id].p = 1;
80                    ::skip
81                fi;
82            ::nodeState[id].state == ALOHA && nodeState[id].p == 1 ->
83                if
84                ::true ->  nodeState[id].p = 0;
85                ::true ->  nodeState[id].p = 1
86                fi;
87  //            printf("%d --Sending with proabality %d\n" , id, nodeState[id].p);
88
89          // send TDMA
90            ::nodeState[id].state != ALOHA ->
91  //          printf("%d --Sending TDM\n" , id)
92
93              P1!id,nodeState[id].members,nodeState[id].r;
94              P2!id,nodeState[id].members,nodeState[id].r
95            ::skip
96
97            fi;
98        }
99
100      :: empty(PR) ->
101           skip
102      :: nempty(PR) ->
103        PR?id_j,members_j,r_j;
104 //     printf("%d Size of channel %d\n", id, len(PR));
105        atomic {
106          if
107           ::nodeState[id].state ==  ALOHA ->
108           nodeState[id].messageLost[id_j] = 0;
109           nodeState[id].members = nodeState[id].members | (1 << id_j);
110           if
111             ::nodeState[id].members == members_j ->
112               nodeState[id].cmembers = nodeState[id].members | (1 << id_j)
113             ::skip
114           fi;
115           if
116             ::nodeState[id].cmembers == members_j ->
117               printf("%d reaches TDMA\n", id);
118               nodeState[id].state = TDMA
119               if
120             ::nodeState[id].leader > members_j ->
121               nodeState[id].leader = members_j
122             ::skip
123               fi;
124               if
125             ::nodeState[id].leader == members_j ->
126               nodeState[id].r = r_j
127             ::skip
128               fi;
129              ::nodeState[id].cmembers != members_j ->
130             skip
131           fi;
132 //         printf("%d --Receiving in ALOHA %d from %d\n" , id,  nodeState[id].members, id_j);
133
134         ::nodeState[id].state !=  ALOHA ->
135 //      printf("%d reaches TDMA\n" , id);
136         nodeState[id].messageLost[id_j] = 0
137
138         fi;
139       }
140       //round
141          // Failure detector
142      :: nodeState[id].state == TDMA &&
143           (nodeState[id].messageLost[0] > 3 || nodeState[id].messageLost[1] > 3 || nodeState[id].messageLost[2] > 3) ->
144           atomic {
145         printf("%d ALOHA from failure Detector\n", id);
146
147         nodeState[id].state = ALOHA;
148         nodeState[id].members = 1 << id;
149         nodeState[id].cmembers = 1 << id;
150         nodeState[id].leader = id
151           }
152 //   :: nodeState[id].round > 0 ->
153 //      nodeState[id].round = (nodeState[id].round + 1) % 2
154      :: nodeState[id].r != id ->
155        // printf("%d in round %d\n" , id, nodeState[id].r);
156         nodeState[id].r =  (nodeState[id].r + 1) % 4
157
158         //nodeState[id].round = (nodeState[id].round + 1) % 2
159      :: skip
160    od;
161 }

Error is pointed at line 57.I am not sure what does this mean. when i run my code on terminal it works fine bt with ispin interface it throws this error. Someone came across this error?

A: after spending many hours wandering around the code. i tried hit and trial and removed last skip statement from the model. Seems like many possible alternative guard statements along with additional skip statement made it an unconditional self loop.
It worked when i removed the last ::skip statement from do loop.

It appears that Spin has some very simple mechanism for detecting unconditional self loops caused by some loop guard being equal to skip or true with no subsequent instruction to be executed, e.g.:
init
{
    do
        :: skip            // or true
    od;
}

prints:
~$ spin -search test.pml
error: proctype ':init:' line 4, state 2: has unconditional self-loop

pan: elapsed time 1.76e+07 seconds
pan: rate         0 states/second

The routine can be easily circumvented by adding an extra empty statement:
init
{
    do
        :: skip -> skip            // or true -> true
    od;
}

prints:
~$ spin -search test.pml

(Spin Version 6.4.3 -- 16 December 2014)
    + Partial Order Reduction

Full statespace search for:
    never claim             - (none specified)
    assertion violations    +
    cycle checks            - (disabled by -DSAFETY)
    invalid end states      +

State-vector 12 byte, depth reached 1, errors: 0
        2 states, stored
        1 states, matched
        3 transitions (= stored+matched)
        0 atomic steps
hash conflicts:         0 (resolved)

Stats on memory usage (in Megabytes):
    0.000   equivalent memory usage for states (stored*(State-vector + overhead))
    0.292   actual memory usage for states
  128.000   memory used for hash table (-w24)
    0.534   memory used for DFS stack (-m10000)
  128.730   total actual memory usage

unreached in init
    test.pml:6, state 6, "-end-"
    (1 of 6 states)

pan: elapsed time 0 seconds

Interestingly, the routine fails to consider other obvious cases in which an unconditional self-loop arises, e.g. when the guard is a number different from 0 and there is no re-entrant block of instructions.


text:
Q: Can I prioritize the same word differently in different rows of a FULLTEXT column? I have a site search that works by extracting words from several fields of my articles table (name, body, author, category), and putting all of them in a separate search table with a single FULLTEXT column.
I want to improve the accuracy of the search so that words extracted from the name field have a higher relevance than the same words extracted from the body field of the articles table.
In other words, if article 1's name field contained "Foo" once and article 2's body field contained "Foo" twice, article 1 would still be more relevant.
Is there a way to do this? I'm not referring to boolean searching, I want to attach relevance to the actual column data, not the search string.

A: You can attach weight to a keyword depending on from where it came. So give default weights to words in your table. And when you come up with a score in your query, multiple that score with the default weight you have.
Obviously, words from name part of your would have more default value.


text:
Q: Add a cumulative/running total column I'am trying to do a running total (without success) over a calculated column on sql.
My original code:
select t.codigo, t.nome, t.total
from(
select codigo, nome,  SUM(CASE When ANO = 2018 Then VLCOMPRA Else 0 End ) as total
from clientes
left join ACUMTERC on ACUMTERC.TPTERC = 2 and TPOPER = 2 AND ACUMTERC.TERCEIRO = CLIENTES.CODIGO
group by codigo, nome) as t
ORDER BY total DESC

What i tried:
select t.codigo, t.nome, t.total, SUM(t.total) OVER(PARTITION BY t.codigo ORDER BY t.codigo) RunningTotal
from( select codigo, nome, SUM(CASE When ANO = 2018 Then VLCOMPRA Else 0 End ) as total from clientes left join ACUMTERC on ACUMTERC.TPTERC = 2 and TPOPER = 2 AND ACUMTERC.TERCEIRO = CLIENTES.CODIGO group by codigo, nome) as t
ORDER BY total DESC

My result:
codigo | nome  | total | Running total
-------+-------+-------+---------------
000001 | name1 |   300 !   300
000003 | name3 |   200 |   200
000002 | name2 |   100 |   100

What i need:
codigo | nome  | total | Running total
-------+-------+-------+---------------
000001 | name1 |   300 !   300
000003 | name3 |   200 |   500
000002 | name2 |   100 |   600

Any help?
Thank you.

A: I strongly suspect that your query can be simplified:

*

*to start with, I don't understand why you need to do a conditional sum: you could just filter in the join

*there is no need for a subquery at all

When it comes to your requirement, you can do a window sum().
I would also strongly suggest to prefix each column with the table it belongs to: this makes the query unambiguous about the data structures; I made a few assumptions that you might want to check (I also used table aliases to shorten the query).
Consider:
select
    c.codigo,
    c.nome,
    coalesce(sum(a.vlcompra), 0) as total,
    sum(coalesce(sum(a.vlcompra), 0))
        over(order by coalesce(sum(a.vlcompra), 0) desc) running_total
from clientes c
left join acumterc a
    on  a.tpterc = 2
    and a.tpoper = 2
    and a.terceiro = c.codigo
    and a.ano = 2018
group by c.codigo, c.nome

A: You can do it this way, using ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT:
select t.codigo, t.nome, t.total,
SUM(t.total) OVER(ORDER BY t.codigo ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) RunningTotal

from( select codigo, nome, SUM(CASE When ANO = 2018 Then VLCOMPRA Else 0 End ) as total from clientes left join ACUMTERC on ACUMTERC.TPTERC = 2 and TPOPER = 2 AND ACUMTERC.TERCEIRO = CLIENTES.CODIGO group by codigo, nome) as t

    ORDER BY total DESC

An example with data:
 with tbl as
(
select '000001' as codigo , 'name1' as nome,   300 as total,  300 as Running_total
union select '000003' , 'name3' ,   200 ,   200
union select '000002' , 'name2' ,   100 ,   100
)

select t.codigo, t.nome, t.total,
SUM(t.total) OVER(ORDER BY t.codigo asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) RunningTotal

from tbl as t
ORDER BY codigo asc
  with tbl as
(
select '000001' as codigo , 'name1' as nome,   300 as total,  300 as Running_total
union select '000003' , 'name3' ,   200 ,   200
union select '000002' , 'name2' ,   100 ,   100
)

select t.codigo, t.nome, t.total,
SUM(t.total) OVER(ORDER BY t.codigo asc ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) RunningTotal

from tbl as t
ORDER BY codigo asc

Output:
codigo  nome    total   RunningTotal
000001  name1     300   300
000002  name2     100   400
000003  name3     200   600


text:
Q: Chrome New Tab Extension to show the latest visited URL only if it is a repeated visit Ideally, when a New Tab is opened, it would show the most recent pages that have been opened at least twice during the last 24 hours. The most visited pages during the last 24 hours before in the list.
The way I'd like the result is more or less as shown in Google Drive - Recent. I mean, as a list:

And NOT as icons:

Do you know any Google Chrome extension shows in a New Tab the most visited websites during the last 24 hours?

A: So far, the best workaround extension is Re-newtab. This is how it looks after configuring it as I wished:


text:
Q: How to write this linq query with Criteria or QueryOver API Is it possible to convert this code at below, written by using Query(linq) api to Criteria or QueryOver API in NHibernate? I'm using this to format data into DTO's also it works with just one round-trip to db.
Note: I tried transformers.aliastobean but I can only use one transformer at a time. Is it possible to use multiple transformer in one query?
     from entityType in Provider.GetSession().Query<crmEntityType>()
     .Fetch(x => x.Association)
     .Fetch(x => x.Fields)
     .AsEnumerable()
     where instanceIDs.Contains(entityType.Instance.instanceID)
     select new EntityTypeDTO()
     {
     ID = entityType.ID,
     Title = entityType.Title,
     Association = entityType.Association.Distinct().Select(asc => asc.ID).ToArray<int>(),
     Fields = entityType.Fields.Distinct().Select(fi => new CustomFieldDTO {
 ID = fi.ID,
 Name =  fi.Name,
 Value = fi.Value,
 EntityType = fi.EntityType.ID,
 Type = fi.Type
}).ToList()
     }).ToList();

A: Let's start with the QueryOver syntax:
// external filter data
instanceIDs = new int[] { 1, 2, 3 };

// aliasing
EntityTypeDTO entityDTO = null;
CustomFieldDTO fieldDTO = null;
Field field = null;

IQueryOver<EntityType, Field> query = Session.QueryOver<EntityType>()

  // filter Entity by ID's list
  .Where(Restrictions.On<EntityType>(c => c.ID).IsIn(instanceIDs))

  // Join Fields
  .JoinQueryOver<Field>(c => c.Fields, () => field)
  .SelectList(list => list

    // entity
    .Select(c => c.ID)
    .Select(c => c.Title)
    // ... more Entity properties

    // field collection
    .Select(() => field.ID)
    .Select(() => field.Name)
    // ... more Field properties
  )
  .TransformUsing(new MyTransformer()); // see below

var dtos = query.List<EntityTypeDTO>();

This QueryOver will generate the SQL statement which will contain all EntityTypes with their Fields. Now we have to extract the unique EntityType instances and fill their Fields lists
There is an overview of DTO classes (as well as QueryOver above, these contain only ver few properties as an example):
public class EntityTypeDTO
{
  public virtual int ID { get; set; }
  public virtual string Title { get; set; }
  public virtual IList<CustomFieldDTO> Fields { get; set; }
  ...
}
public class CustomFieldDTO
{
  public virtual int ID { get; set; }
  public virtual string Name { get; set; }
  ...
}

And finally the trick MyTransformer():
public class MyTransformer : IResultTransformer
{
  // rows iterator
  public object TransformTuple(object[] tuple, string[] aliases)
  {
    var entity = new EntityTypeDTO
    {
      ID = (int)tuple[0],         // aliases should be used
      Title = tuple[1] as string  // first two are belong to Entity
    };
    var field = new CustomFieldDTO
    {
      ID = (int)tuple[2],         // last 2 columns are for a Field
      Name = tuple[3] as string   // see SelectList in QueryOver
    };
    entity.Fields = new List<CustomFieldDTO> { field };
    return entity;
  }

  // convert to DISTINCT list with populated Fields
  public System.Collections.IList TransformList(System.Collections.IList collection)
  {
    var results = new List<EntityTypeDTO>();
    foreach(var item in collection)
    {
      var entity = item as EntityTypeDTO;

      // was already the same ID appended
      var existing = results.SingleOrDefault(c => c.ID.Equals(entity.ID));
      if(existing != null)
      {
        // extend fields
        existing.Fields.Add(entity.Fields.First());
        continue;
      }

      // new ID found
      results.Add(entity);
    }
    // DISTINCT list of Entities, with populated FIELDS
    return results;
  }
  ...

MyTransformer is ad hoc one, only for this purpose... but this approach could be extended


text:
Q: Unset same variable from different array I need to unset a variable from $_GET, $_POST and $_REQUEST.
As if now I do it simply by calling unset three time.
unset( $_GET['add-to-cart'] );
unset( $_POST['add-to-cart'] );
unset( $_REQUEST['add-to-cart'] );

Is there any simple code for doing this ?
Right now creating a custom function only seem to be the alternative to me, Is there any single line code for this ?
Thank You

A: You could put it in one line:
unset($_GET['add-to-cart'], $_POST['add-to-cart'], $_REQUEST['add-to-cart']);


text:
Q: Center of a group contains a normal subgroup I'm studying to an exam in abstract algebra, and I'm stuck on the following question. I will appreciate any guidance for this one.
Let $G=H\times K$ be a Group and let $N$ be a normal subgroup of G.
Assume that $N\cap K=\{1\}$ and $N\cap H=\{1\}$.
Prove that $N\subseteq Z(G)$.
Thanks.

A: If $N$ is not in the center, then there exists $(h, k) \in G$ and $(x, y) \in N$ such that $(hxh^{-1},kyk^{-1})\in N$ and either $hxh^{-1}\neq x$ or $kyk^{-1}\neq y$. Assume without loss of generality that the former is true and $k$ is the identity. Thus $(x, y), (hxh^{-1},y)\in N$, hence $(x, y) (hxh^{-1},y)^{-1}=(xhx^{-1}h^{-1},1)\in N$. Since the commutator is nontrivial, $N$ intersects nontrivially with $H$.


text:
Q: PHP date format vs Symfony RFC 3339 format As per http://php.net/manual/en/class.datetime.php
PHP follows "ATOM" date format. To produce a date like "2017-11-14" we need date format string "Y-m-d". I am able to produce it using php date function and class. It works as expected.
/////Using date function////
echo date("Y-m-d");

/////Using DateTime class////
$date = new DateTime();
echo $date->format('Y-m-d');

Now I want to use these date formats dynamically in my Symfony3 application. As per docs, format for dateType field must be according to "RFC3339" because it uses IntlDateFormatter class for formatting.
https://symfony.com/doc/current/reference/forms/types/date.html#format
So to produce date same as previous one, we need different format string
$date = new DateTime();
$dateFormat = new IntlDateFormatter(
    "en_US",
    IntlDateFormatter::NONE,
    IntlDateFormatter::NONE,
    'America/Los_Angeles',
    IntlDateFormatter::GREGORIAN,
    'yyyy-MM-dd'
);
echo $dateFormat->format($date->getTimestamp());

To render datepicker fields on my forms, I am using bootstrap datepicker (https://bootstrap-datepicker.readthedocs.io/en/stable/options.html#format). Format demand to produce same previous date here is bit different "yyyy-mm-dd".
Although I can understand datepicker format can be different from PHP one. But I am unable to understand why there is difference between PHP and symfony date format requirements.
I am not sure how to make it working, as there can be plenty of formats, user can choose from. So a user chooses his date format preferences and I need to produce same date string everywhere.
I am thinking about some converter which can transform PHP date string to symfony and javascript formats or if I can manage to change dateformatter for symfony it can help also in my opinion.

A: You are confusing the symfony format and html5 one. There is no symfony format, the rfc refers to the html specifications.
You should, for your frontend:

*

*Create a twig filter that output any datetime in the user format preference

*Use a javascript date widget instead of html date input. Mainly because the format of html date widget can't be changed and you won't be able to use the user format preference of your application. It is the format that is given to the request that is at the RFC3339 format: YYYY-mm-dd
That's all, your controllers and model should just handle Datetimes object


text:
Q: Override class in ActiveAdmin index I am  using ActiveAdmin Flat Skin as template and I want to highlight some rows of the index page depending on an attribute of the row. The index page shows even odd rows displaying even rows with a light gray. Depending on this available attribute I want to display them with a light red.
I got the following partially working:
index  row_class: ->elem { 'red' unless elem.available } do |dog|

In my active_admin.scss I have the following
.red {
  background-color: #f7b9b9 !important;
}

But the rows that have the light gray are not being displayed in red. Any ideas?
Here is how it looks right now. The ones that say "[NO EN ADOPCION]" should all be in red.

Even if I inspect the element and add an inline style="background-color: red !important" the background does not change.

A: Try changing the css to:
tr.odd, tr.even {
  &.red {
    background-color: #f7b9b9 !important;
  }
}


text:
Q: Native PHP PDO vs. Phalcon PDO Are there any advantages of using Phalcon's Framework PDO Adapter rather than the PHP's native PDO?
As there's seems to be a bit of advance functionality lacking in the Phalcon framework regarding PDO. Is it even worth it? Are there also dramatic performance differences that outweigh using PHP's native PDO?

A: First of all, Databases adapters in Phalcon are created as a layer behind Phalcon\Mvc\Model. Thanks to this you have same interfaces for MySQL, Oracle or PosgreSQL Adapter.. Or for other adapter that you and me can create. That's why, as some kind of abstraction, Phalcon PDO is a little limited. It needs to share same logic with another types of RDBMS.
So if you don't want to use Models go with simple PHP PDO. But ask yourself where is the point of using MVC framework without Model layer :)
If you need more informations, follow this link: http://docs.phalconphp.com/pl/latest/reference/db.html


text:
Q: Update existing attribute in jQuery How can update existing attribute and append it withot read att?
Forexample I want to add noreferrer in rel attribute.
FOR TEST

target:
FOR TEST

A: jQuery has no features for this (the traditional jQuery way is to read the attribute value then append a space and the new token before writing it back, but you rejected that). You need to go down to the native DOM API.
The relList property contains a DOMTokenList like the more commonly used classList.
const link = jQuery("selector")[0]; // Get the DOM element somehow
link.relList.add("noreferrer");

The documentation for DOMTokenList points to the attributes which do support that API. It should be most of the ones where appending a value is useful. For the others, you will generally have to resort to the read then replace approach.


text:
Q: Lang's proof of the fact that a finitely generated $p$-module is the direct sum of cyclic $p$-modules The question refers to a proof of the theorem that a finitely generated $p$-module is the direct sum of cyclic $p$-modules. In particular, refer to Lang's "Algebra" p. 151, right above Theorem 7.7. I can not understand what he is inducting on, even though i see that $dim\bar{E}_p < dimE_p$. I can't see how we obtain that $E$ is generated by an independent set.
Alternatively, could we not construct a proof by induction on the cardinality of a minimal generating set of $E$, instead of resorting to the vector space $E_p$ induced by $E$?
Thank you :-)

A: The excerpt in question can be viewed here.
George Bergman writes here:
P. 151, statement of Theorem III.7.7: Note where Lang above the display refers to the $R/(q_i)$ as nonzero, this is equivalent to saying that the $q_i$ are nonunits.
P. 151, next-to-last line of text: After "i = 1, ... , l" add, ", with some of these rows 'padded' with zeros on the left, if necessary, so that they all have the same length r as the longest row".
Here is the link to George Bergman's A Companion to Lang's Algebra.
And here is a statement of the main results.
Let $A$ be a principal ideal domain and $T$ a finitely generated torsion module. Then there is a unique sequence of nonzero ideals $I_1\subset I_2\subset\cdots$ such that $T\simeq A/I_1\oplus A/I_2\oplus\cdots$ (Of course we have $I_j=A$ for $j$ large enough.)
The proper ideals appearing in this sequence are called the invariant factors of $T$.
Let $P_1,\dots,P_n$ be the distinct prime ideals of $A$ which contain $I_1$, and for $1\le i\le n$ let $T_i$ be the submodule of $T$ formed by the elements annihilated by a high enough power of $P_i$. Then $T=T_1\oplus\cdots\oplus T_n$, and the sequence of invariant factors of $T_i$ has the form
$$P_i^{r(i,1)}\subset P_i^{r(i,2)}\subset\cdots$$
with $r(i,1)\ge r(i,2)\ge\cdots\ge0$. (Of course we have $r(i,j)=0$ for $j$ large enough.)
The $P_i^{r(i,j)}$ called the elementary divisors of $T$.
We clearly have $I_j=P_1^{r(1,j)}\cdots P_n^{r(n,j)}$.
Let $M$ be a finitely generated $A$-module and $T$ its torsion submodule. Then there a unique nonnegative integer $r$ satisfying $M\simeq T\oplus A^r$.
The simplest proof of these statements I know is in this answer (which I wrote without any claim of originality).


text:
Q: Python find String in XML or *.bat I have a directory that contains both xml and *.bat files. I would like to find and replace the string "-SNAPSHOT" in any xml or .bat file. I can do this in notepad ++ where I go to Find in Files, enter "-SNAPSHOT" for the Find object, and "pom.xml,.bat" in the filter type, and it does what I am trying to do. However, I'd like to be able to accomplish the same thing in a python script. What is the best approach for this? Thanks.

A: Try something like this:
import os

myfldr = "myfolder\\"
mydir = os.listdir(myfldr)
old = "-SNAPSHOT"
new = "NEW_STRING"

for file in mydir:

    tempdoc = []
    if (".xml" in file) or (".bat" in file):
        path = myfldr + file
        with open(path, "rt") as f:

            for line in f:
                line = line.replace(old, new)
                tempdoc.append(line)

        with open(path, "wt") as f:
            f.writelines(tempdoc)


text:
Q: Prove that these determinants are equal Without calculating the determinant, prove:
$
\begin{vmatrix}
0 & x & y & z \\
x & 0 & z & y \\
y & z & 0 & x \\
z & y & x & 0 \\
\end{vmatrix}
=
\begin{vmatrix}
0 & 1 & 1 & 1 \\
1 & 0 & z^2 & y^2 \\
1 & z^2 & 0 & x^2 \\
1 & y^2 & x^2 & 0 \\
\end{vmatrix}
$

A: I'll do the proof in the case $x,y,z \neq 0$. Start with the right-hand matrix, and multiply the second, third and fourth rows by $x,y,z$ respectively, and do the same with the columns. You will get
$$ \begin{vmatrix}
0 & x & y & z \\
x & 0 & z^2 xy & y^2 xz \\
y & z^2 xy & 0 & x^2 yz\\
z & y^2 xz & x^2 yz & 0 \\
\end{vmatrix}$$
Moreover, this process multiplies the determinant by $x^2 y^2 z^2$. To counteract this, let's divide the second, third, and fourth columns by $xyz$. Then we get
$$ \begin{vmatrix}
0 & 1/yz & 1/xz & 1/xy \\
x & 0 & z & y \\
y & z & 0 & x\\
z & y & x & 0 \\
\end{vmatrix}$$
Now we are off by a factor of $(xyz)^2/(xyz)^3 = 1/(xyz)$. But we can return to our original determinant by multiplying the top row by $xyz$, to get
$$ \begin{vmatrix}
0 & x & y & z \\
x & 0 & z & y \\
y & z & 0 & x\\
z & y & x & 0 \\
\end{vmatrix}$$


text:
Q: Loop through changing dataset with inlineCallbacks/yield (python-twisted) I have a defer.inlineCallback function for incrementally updating a large (>1k) list one piece at a time. This list may change at any time, and I'm getting bugs because of that behavior.
The simplest representation of what I'm doing is:-
@defer.inlineCallbacks
def _get_details(self, dt=None):
    data = self.data
    for e in data:
        if needs_update(e):
            more_detail = yield get_more_detail(e)
            do_the_update(e, more_detail)
    schedule_future(self._get_details)

self.data is a list of dictionaries which is initially populated with basic information (e.g. a name and ID) at application start. _get_details will run whenever allowed to by the reactor to get more detailed information for each item in data, updating the item as it goes along.
This works well when self.data does not change, but once it is changed (can be at any point) the loop obviously refers to the wrong information. In fact in that situation it would be better to just stop the loop entirely.
I'm able to set a flag in my class (which the inlineCallback can then check) when the data is changed.

*

*Where should this check be conducted?

*How does the inlineCallback code execute compared to a normal deferred (and indeed to a normal python generator).

*Does code execution stop everytime it encounters yield (i.e. can I rely on this code between one yield and the next to be atomic)?

*In the case of unreliable large lists, should I even be looping through the data (for e in data), or is there a better way?

A: the Twisted reactor never preempts your code while it is executing -- you have to voluntarily yield to the reactor by returning a value. This is why it is such a terrible thing to write Twisted code that blocks on I/O, because the reactor is not able to schedule any tasks while you are waiting for your disk.
So the short answer is that yes, execution is atomic between yields.
Without @inlineCallbacks, the _get_details function returns a generator. The @inlineCallbacks annotation simply wraps the generator in a Deferred that traverses the generator until it reaches a StopIteration exception or a defer.returnValue exception. When either of those conditions is reached, inlineCallbacks fires its Deferred. It's quite clever, really.
I don't know enough about your use case to help with your concurrency problem. Maybe make a copy of the list with tuple() and update that. But it seems like you really want an event-driven solution and not a state-driven one.

A: You need to protect access to shared resource (self.data).
You can do this with: twisted.internet.defer.DeferredLock.
http://twistedmatrix.com/documents/current/api/twisted.internet.defer.DeferredLock.html

Method    acquire
Attempt to acquire the lock. Returns a Deferred that fires on lock
  acquisition with the DeferredLock as the value. If the lock is locked,
  then the Deferred is placed at the end of a waiting list.
Method    release
Release the lock. If there is a waiting list, then the first Deferred in that waiting list will be called back.

A: @defer.inlineCallback
def _get_details(self, dt=None):
    data = self.data
    i = 0
    while i < len(data):
        e = data[i]
        if needs_update(e):
            more_detail = yield get_more_detail(e)
            if i < len(data) or data[i] != e:
                break
            do_the_update(e, more_detail)
        i += 1
    schedule_future(self._get_details)

Based on more testing, the following are my observations.

*

*for e in data iterates through elements, with the element still existing even if data itself does not, both before and after the yield statement.

*As far as I can tell, execution is atomic between one yield and the next.

*Looping through the data is more transparently done by using a counter. This also allows for checking whether the data has changed. The check can be done anytime after yield because any changes must have occurred before yield returned. This results in the code shown above.

A:
self.data is a list of dictionaries...once it is changed (can be at any point) the loop obviously refers to the wrong information

If you're modifying a list while you iterate it, as Raymond Hettinger would say "You're living in the land of sin and you deserve everything that happens to you." :) Scenarios like this should be avoided or the list should be immutable. To circumvent this problem, you can use self.data.pop() or DeferredQueue object to store data. This way you can add and remove elements at anytime without causing adverse effects. Example with a list:
@defer.inlineCallbacks
def _get_details(self, dt=None):
    try:
        data = yield self.data.pop()
    except IndexError:
        schedule_future(self._get_details)
        defer.returnValue(None)         # exit function

    if needs_update(e):
        more_detail = yield get_more_detail(data)
        do_the_update(data, more_detail)

    schedule_future(self._get_details)

Take a look at DeferredQueue because a Deferred is returned when the get() function is called, which you can chain callbacks to handle each element you pop from the queue.


text:
Q: Is it possible to run Teamcity on Linux and use Windows as a Build Agent? I would like to run Teamcity (with a build agent) in a Linux VM to handle our none-.net projects. But in the same breath I'd like to have a BuildAgent setup on a Windows server to handle all of the .net projects.
I can't think of any reasons why this wouldn't work but has anyone any experience and any ideas about the problems I might encounter before I spend too much real time on this?
Ta

A: It's fully supported.  TeamCity also knows which agents to route builds to.

A: This is a very normal scenario and many project I know do this without any problems. Just make sure that for the builds' Agent Requirements, you properly direct the appropriate job to the appropriate agent. One criterion can be that agent.os.name should contain Windows or Linux etc.


text:
Q: how to add or connect two project like a one project in xCode 4 or higher i have two different project i want both project or project files add or connect each other or
 in one project and when i run the one project then we excess, send or get values form connecting project if it is possible if yes then help me. Thankes

A: Use a workspace.. This allows you to use stuff from any attached project in the workspace.


text:
Q: SQL server 2017 issue with datetime datatype I have a simple table which consists of 5 records with a difference of milliseconds.
I have faced issue while upgraded my database from 2016 to 2017 SQL server.
There are two images attached here with comparing the result of 2016 and 2017 SQL server result. I am not understanding why this unwanted behavior in 2017.
Is this a bug in 2017 SQL server. ?
Table column data type is same here in both cases datetime datatype.

Here is the create table query.
    USE [Test]
    GO

    CREATE TABLE [dbo].[TestVisionBot3](
        [FileId] [varchar](50) NULL,
        [OrgId] [nchar](10) NOT NULL,
        [ProjectId] [varchar](50) NULL,
        [CreatedAt] [datetime] NULL,
        [LockedUserid] [nvarchar](50) NULL
    ) ON [PRIMARY]
    GO

Here is the sample data as well.
    1a  1           2a  2018-04-29 10:30:30.010 test
    3a  1           2a  2018-04-29 10:30:30.553 test
    2a  1           2a  2018-04-29 10:30:30.557 test
    4a  1           2a  2018-04-29 10:30:30.560 test
    5a  1           2a  2018-04-29 10:30:30.563 test

A: Background information:
Precedence rule:

When an operator combines two expressions of different data types, the rules for data type precedence specify that the data type with the lower precedence is converted to the data type with the higher precedence.

So in your case in where clause when you compared datetime with datetime2 then datetime was bumped up to datetime2 as datetime2 has higher precedence.
Now what will that change in SQL Server 2017? In new version of SQL server, the implicit conversion will follow conversion rule from datetime to datetime2 as documented below
Conversion from datetime to datetime2 rule:

When the conversion is from datetime, the date and time are copied. The fractional precision is extended to 7 digits. The following example shows the results of converting a datetime value to a datetime2 value.

DECLARE @datetime datetime = '2018-04-29 10:30:30.553';
DECLARE @datetime2 datetime2 = @datetime;

SELECT @datetime2 AS '@datetime2', @datetime AS '@datetime';

--Result
--@datetime2                  @datetime
------------------------- ---------------------------
--22018-04-29 10:30:30.5533333 2018-04-29 10:30:30.553

Now your earlier conversion was actually a string literal to datetime2 conversion. So it follows a different rule.
String literal to datetime2 conversion rule:
The string part of time is assigned to time and date to date, as is without extrapolating precision but instead right padding with 0s for extra precision.
Incidentally this was also done for datetime to datetime2 conversion in versions before sql server 2017.
More explanation:
When you convert '2018-04-29 10:30:30.553' to datetime2 to it gets to '2018-04-29 10:30:30.5530000' as it converting a string literal to datetime2
When you compare stored datetime value with datetime2 value in where clause, precedence rules apply and therefore datetime is bumped to datetime2. So when '2018-04-29 10:30:30.5530000' (a datetime value) is bumped to Datetime2 value then fractional part is enhanced and becomes greater than what was originally there.
Therefore your .553 is extended to .553333 which is greater than .533
DECLARE @datetime datetime = '2018-04-29 10:30:30.553';
DECLARE @strliteral varchar(max)='2018-04-29 10:30:30.553';
DECLARE @datetime2 datetime2 = @datetime;

SELECT
@datetime2 AS '@datetime2',
@datetime AS '@datetime',
cast(@strliteral as datetime2) AS strtoDatetime2,
cast(@datetime as datetime2) AS datetimetoDatetime2;

-- @datetime2                   @datetime               strtoDatetime2
datetimetoDatetime2
-- 2018-04-29 10:30:30.5533333  2018-04-29 10:30:30.553 2018-04-29 10:30:30.5530000 2018-04-29 10:30:30.5533333

See image below


text:
Q: Active directory rename computer that has been disconnected We named a new computer on the domain USER-2014. The computer was for someone who already had a computer on the domain called USER. We discontinued the old computer with name USER and are now looking to rename USER-2014 back to USER. When I attempt to rename I get a message "The following error occurred attempting to rename the computer to 'USER': The account already exists." Which makes sense since there is a computer in active directory called USER.
Is it ok to delete the computer called USER from active directory? I assume that would then allow me to rename USER-2014 back to USER. I'm worried that something in the Windows ecosystem is still referencing it and by deleting it there will be a dangling reference somewhere that will cause issues. If I could rename USER to USER-OLD that could also resolve my issue but I can't find a rename function in active directory.
What's a best practice here or a reasonable suggestion? Anything would be greatly appreciated. I'm pretty new to network administration.

A: You cover a number of points here, I shall try to address each of them in turn.
Is it ok to delete the computer called USER from active directory?
It depends. If the old computer has gone, never to return, then probably. Bear in mind that once you delete it (or any object in AD) then you cannot get it back just by recreating a new object with the same name. Each object has a unique security identifier (SID) associated with it and it is this SID that is used when assigning permissions on ACLs, group memberships, etc. Just because a replacement object has the same name does not mean it will inherit the same permissions.
That said, for a standard domain joined workstation it's likely to have minimal impact. I would be more worried if this were a user or group object.
Dangling references
If you have referenced the old computer account in any ACLs, groups, etc. then once it has been deleted you will find that these references just refer to the SID and not the original computer name. If you come across any references that show a SID only then it it likely this is the cause (although not the only reason, so be warned!)
Renaming of computer accounts
You cannot rename a computer account directly from the Active Directory Users & Computers snap-in. The correct method of renaming a computer account is to do this client side. You should be logged in to the client with a user account that has full access to modify the computer object in AD (e.g. a domain administrator or alternate account that has been delegated the relevant privileges).
If you attempt to rename the object directly from within Active Directory then you will encounter trust relationship issues when you next try and use the computer.
Best practice
This part is just my opinion, others may well have a different one.
I would never name a computer object with a name that is tied to a person (e.g. John Smith shouldn't have a computer named johnsPC). Instead come up with a sensible asset naming convention that you can use throughout your organisation (e.g. corppc123). Then when a computer asset is retired and replaced you don't have to worry about renaming the new object to be the same as the old; you simply replace it and move on.
However you go about naming and replacing your computers you need to ensure you keep items such as group memberships up to date (e.g. WSUS groups, SCCM groups, etc.). Also consider any scripts you have that reference computers by name, these will need updating (or better yet, changed so that they don't refer directly to PC objects). That's going somewhat beyond the scope of this question however!

A: Just delete the old computer object.

A: If the old computer is not anymore in use and has no more reason to be linked with AD, you can safely destroy the old computer object. I do that several times per year and never had any issue.

A: I would change the convention of naming objects the same as reserved names in AD, such as naming a computer object "USER".  This convention only serves to introduce confusion for future Admins.


text:
Q: Inverse element of the abelian group (P(M),symmetric difference) What would be the inverse element in this abelian group: $(P(M),\triangle)$?
I know the neutral element is the empty set and I thought the inverse element would be $A^{c}$ for every $A$. Turns out $A\triangle A^{c}=P(M)$ but it has to return the empty set.

A: Ok, I got it. The inverse element for every $A \in P(M)$ is A itself!
Because: $A \triangle A=(A\cup A)\backslash (A\cap A)=A\backslash A=\varnothing$


text:
Q: How can I pass a fixed integer value in document.getElementById Here is my code. I want to use fixed integer value instead of "package_select". How can I do this...
<script>
      paypal.Buttons({
        createOrder: function(data, actions) {
          // This function sets up the details of the transaction, including the amount and line item details.
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: document.getElementById("package_select").value
              }
            }]
          });
        },
        onApprove: function(data, actions) {
          // This function captures the funds from the transaction.
          return actions.order.capture().then(function(details) {
            // This function shows a transaction success message to your buyer.
            alert('Transaction completed by ' + details.payer.name.given_name);
          });
        }
      }).render('#paypal-button-container');
      //This function displays Smart Payment Buttons on your web page.
    </script>

A:           amount: {
            value: REPLACE_WITH_FIXED_INTEGER_VALUE
          }

See a full demo at https://developer.paypal.com/demo/checkout/#/pattern/client


text:
Q: I need to know what is triggering the Excel "Do you want to save ..." dialogue I open a certain Excel 2007 workbook then close it without making any manual changes but I get the "Do you want to save ... ?" dialogue presumably because something within in it is auto-calculating.  I put Msgbox(ThisWorkBook.Saved) during the WorkBook Open event and it shows False which indeed suggests that something somewhere is changing immediately but I've put WorksheetChange event code on each of the worksheets and none of them are triggered.
Any ideas ?

A: Any in-cell volatile function will cause this behaviour.  This includes things like RAND(), TODAY() etc., as well as any user defined functions that have been declared as volatile, i.e. have the declaration Application.Volatile.
Further reading http://www.decisionmodels.com/calcsecretsi.htm


text:
Q: Скорость выполнения MySql Мне нужно каждые 200 миллисекунд очищать таблицу в Mysql и добавлять 5-50 значений. И около 30 компьютеров каждые 0,5 секунды будут подключаться к серверу и запрашивать данные из таблиц.
function setBet($games) {
    $sth = $this->dbh->prepare("DELETE FROM bet");
    $sth->execute();

    $sth = $this->dbh->prepare("INSERT INTO bet(p1_rate,p1_name,p2_rate,p2_name) VALUES(?,?,?,?)");
    foreach ($games as $game) {
        $sth->execute(array($game->p1->count, $game->p1->name, $game->p2->count, $game->p2->name));
    }
}

Сценарий выполняется более ~0,5 секунд. Как лучше это сделать?

A: Если таблица маленькая и постоянно перезаписывается, сам бог велел выбрать для нее движок MEMORY (HEAP). Он накладывает некоторые ограничения, но попробуйте. Может быть они для вас несущественны. Будет очень-очень быстро.
https://dev.mysql.com/doc/refman/5.0/en/memory-storage-engine.html

A: *

*Не использовать MySQL.

Точнее я хотел сказать что лучше уж смотреть в строну NoSQL.
Хотел написать комментарием, но увы. Весь рейтинг пропал при переносе.

A: Вставляйте по несколько записей сразу, формируя запрос
INSERT INTO
    bet(p1_rate,p1_name,p2_rate,p2_name)
VALUES
    ($game->p1->count, $game->p1->name, $game->p2->count, $game->p2->name),
    (2-ые значения),
    (3-и значения),
    ...,
    ();

A: Во-первых, оптимизируйте логику в отношении запросов. На вскидку, мне кажется что каждый раз очищать таблицу - накладно, можно пропускать эту процедуру (экономя на этом время) и делать это раз в несколько итераций. Прав я или нет - вам могут показать только тесты. Так что придумывайте - как именно вы можете сэкономить время и как вам это организовать.
Во-вторых, настройте ваш сервер БД таким образом чтобы у вас все операции велись в памяти - выставьте необходимые величины буфферов и т.д. В вашем случае любая операция записи на диск - трата времени. Не буду вам советовать какую именно СУБД выбирать - MySQL или какую-либо другую. Это вам тоже придётся выяснить лично для себя в тестировании, или же исходя из личных предпочтений.
В третьих - продумайте детально архитектуру работы. 30 или сколько там подключающихся компьютеров - вам нужно использовать какую-то технологию чтобы у этих компьютеров 1 раз открывалось подключение и оставалось открытым всё время. Иначе вы просто не сможете получать данные так быстро как вы хотите их получать. Будете вы для этого настраивать Keep-Alive и прочее в настройках веб сервера (Apache или Nginx), или же будете использовать что-то вроде Comet - тоже зависит от вас.


text:
Q: FFMPEG - Unable to find a suitable output format for 'ffmpeg' ffmpeg: Invalid argument A lot of people asked this question, but each one with another meaning, and I couldn't understand anything.
I am trying to cut a video and save the changes to another file:
ffmpeg -i C:\Users\danie\Videos\video4.mp4 -ss 1:00 -t 3:00 -vcodec copy -acodec copy video5.mp4

When I enter this in the cmd, I get the following line:
[NULL @ 000000000318f4c0] Unable to find a suitable output format for 'ffmpeg'
ffmpeg: Invalid argument

I can't understand whats wrong. Can someone help me out with it?
EDIT: This is the log output:
ffmpeg started on 2016-10-11 at 14:14:13
Report written to "ffmpeg-20161011-141413.log"
ffmpeg version N-81960-g1bda0ee Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 32.100 / 55. 32.100
  libavcodec     57. 61.100 / 57. 61.100
  libavformat    57. 51.103 / 57. 51.103
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 63.100 /  6. 63.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  2.100 /  2.  2.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\danie\Videos\video4.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp41isom
    creation_time   : 2016-10-10T11:32:52.000000Z
    date            : 2016
  Duration: 00:06:29.00, start: 0.000000, bitrate: 44036 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt470m), 1920x1080 [SAR 1:1 DAR 16:9], 43828 kb/s, 59.70 fps, 59.94 tbr, 60k tbn, 120 tbc (default)
    Metadata:
      creation_time   : 2016-10-10T11:32:52.000000Z
      handler_name    : VideoHandler
      encoder         : AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 196 kb/s (default)
    Metadata:
      creation_time   : 2016-10-10T11:32:52.000000Z
      handler_name    : SoundHandler
[NULL @ 0000000003089540] Unable to find a suitable output format for 'ffmpeg'
ffmpeg: Invalid argument

A: This error happens often, because of wrong command.
Seems you have one more ffmpeg word before ffmpeg in your command like this one:
C:\ffmpeg-20160428-git-78baa45-win64-static\bin\ffmpeg.exe ffmpeg -i ....
Try removing it:
C:\ffmpeg-20160428-git-78baa45-win64-static\bin\ffmpeg.exe -i .... or simply ffmpeg -i ...


text:
Q: 2D coords to 3D coords resolution and camera matrix So I have a full HD webcam (LG AN VC500), looking down at a chessboard, with each square edge at 25mm.
I am trying to estimate the 3 dimensional coordinates of the camera, relative to the chessboard.
I use openCV and C++ and the following basic procedure:

*

*calibrate camera -> to get camera matrix and distortion coefficients

*findChessboardCorners -> to get imagePoints

*SolvePnP -> to get rvec and tvec

*rodrigues -> rvec to RMatrix

*transpose RMatrix

*(-RMatrix * tvec) -> to get TVector

*pose =
         [RMatrix    TVector(0)
            ...      TVector(1)
            ...      TVector(2)
          0, 0, 0,      1      ]

*Plot in openGL^
^ I am aware of the axes difference between GL and CV, the main focus is on the pose estimation, not the representation.
As far as I know, this method should work. But my translations are not giving me anywhere near the correct values. Not only in correct unit of distance, but the x, y and z values don't even make sense relative to each other. According to my results the origin of the chessboard is in some arbitrary block, not an outer corner.
I suspect the issue might be the fact that my camera is calibrated at its streaming resolution 1280 x 720, therefore giving me a camera matrix according to that resolution, while openCV only deals with a 640 x 480 image.
My questions are:

*

*Is the procedure I have followed correct? If not, what have I done wrong, and how do I get my translations in millimeters?

*Does the resolution discrepancy make a difference? Should I modify specific code, or camera matrices.

I have spent a significant amount of time trying to figure this out, most of which spent on stack overflow. My deadline is now becoming real. Any help is appreciated, and I will give more information if needed.
Thanks.

A: SolvePnP uses the camera matrix which includes the image center (from the camera calibration) if you are using it at any other resolution you will have to adjust the camera matrix.
Details will depend on whether you are taking a 640x480 window out of the image (in which case just adjust the origin) or rescaling the image (in which case you also need to change the focal length)

A: The procedure that I mentioned above is correct. The results were also correct, but I misinterpreted them. The result is the translation coordinates of the camera center perpendicular to the chess board, relative to the chessboard origin. The result is also in the units that the camera was calibrated. If calibrated in millimeters, then the translation vector given by solvepnp will also be in millimeters.
I thought it was the center principal point line w.r.t the chessboard origin.
As for the resolution discrepancy, if your camera is set (in openCV code) to a specific resolution that is compatible with the camera (check this compatibility) then openCV will handle the images at that size.


text:
Q: Is there a way to selectively import data into Oracle SQL Developer I'm new to SQL and trying to figure out an issue caused by a data cap issue. For a school project I need to load a few large tsv files but one is so large that it maxes out the space I have (10.7 million rows). Luckily, the other table in the relation is much smaller (1.1 million rows). I'm looking to do something like this,
while(large_table != EOF) {
     Check if any of the primary keys from the small table are a sub-string in the foreign keys string in the large table.

     If one of the primary keys from the small table is a sub-string in the foreign keys string in the large table, insert that row.

     Else, skip that row
}

Is this possible? Is there a INSERT CHECK option for doing this that I could put into a loop? Is there something in Oracle SQL Developer that can handle this? The issue I'm stuck with is that I can't import both datasets before writing a query to handle this. My google searches haven't yielded anything even remotely useful. Perhaps I'm not using the correct keywords? Any help/suggestions would be appreciated.


text:
Q: Multiple font types in a QML Text I need to write a text using multiple font types. I tried to do it by using rich text like this:
Text{
    id: test
    textFormat: Text.RichText
    color: "#297fca"
    text: "Text in on font. And in another"
    anchors{
        top: description.bottom
        topMargin: 40
        left: headDesign.right
        leftMargin: 75
    }
}

The text whose font I want to change becomes larger but the font is not loaded. Roboto Medium is a font that I loaded using a font loader.
So, any Ideas of what I'm doing wrong?

A: Please check did the font load correctly.
FontLoader {
    source: "riesling.ttf"
    Component.onCompleted: console.log(name)
}

Text{
    id: test
    textFormat: Text.RichText
    color: "#297fca"
    text: "
Same Text.

Same Text.
"
}

Font: https://www.1001freefonts.com/
Made them display separate line to see the difference clearly.
Qt 5.10.1 result


text:
Q: Is it possible to convert select dropdown into horizontal months list in jQuery UI Datepicker? I'm building a calendar based on jQuery UI Datepicker with a possibility to choose date range with 3 months displayed at once. Now it looks like on screenshot:

So I need to add a block above this calendar with 12 horizontally positioned months starting from current month. I think I need to convert default select dropdown with months to this horizontal list, but due to my little experience with JavaScript I wasn't able to even bring it to work with help of similar examples from internet.

When you choose a month in this block it should switch calendar to 3 chosen months. Hope you will be able to suggest me a solution.
Here is my current code:

$("#datepicker").datepicker({
numberOfMonths: 3,
showButtonPanel: false,
dateFormat: 'dd.mm.yy',
minDate: 0,
maxDate: new Date(new Date().getTime() +  365 * 24 * 60 * 60 * 1000),
beforeShowDay: function(date) {
 var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
 var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());
 if (startDate && endDate && startDate - endDate) {
  if (endDate <= date && date <= startDate) {
   if (startDate && date && (startDate.getTime() === date.getTime())) {
    console.log('from end to start - backward - red-start ');
    return [true, 'ui-red-end', ''];
   }
   if (endDate && date && (endDate.getTime() === date.getTime())) {
    console.log('from end to start - backward - red-end ');
    return [true, 'ui-red-start', ''];
   }
   console.log('from end to start - backward');
   return [true, 'ui-state-selected-range', ''];
  }
 }
 if (startDate <= date && date <= endDate) {
  console.log('from start to end - forward');
  if (startDate && date && (endDate.getTime() === date.getTime())) {
   console.log('from start to end - forward - red-end');
   return [true, 'ui-red-end', ''];
  }
  if (endDate && date && (startDate.getTime() === date.getTime())) {
   console.log('from start to end - forward - red-start');
   return [true, 'ui-red-start', ''];
  }
 }
 if (startDate <= date && date <= endDate) {
  console.log('from start to end');
  return [true, 'ui-state-selected-range', ''];
 }
 return [true, '', ''];
},
onSelect: function(dateText, inst) {
 var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
 var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());
  if (!startDate || endDate) {
   $('#start-date').val(dateText);
   $('.start-date-visible').text(dateText);
   $('#end-date').val('');
   $('.end-date-visible').text('');
   $(this).datepicker('option', dateText);
  } else {
   if (new Date(dateText) < startDate) {
    var sDate = $('#start-date').val();
    $('.start-date-visible').text(dateText);
    $('#start-date').val(dateText);
    $(this).datepicker('option', null);
    $('.end-date-visible').text(sDate);
    $('#end-date').val(sDate);

   } else {
    $('.end-date-visible').text(dateText);
    $('#end-date').val(dateText);
    $(this).datepicker('option', null);
   }
  }
}
});
// start date on default
$('#start-date').val($.datepicker.formatDate('dd.mm.yy', new Date()));
$('.start-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date()));
// end date on default
$('#end-date').val($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
  6 * 24 * 60 * 60 * 1000)));
$('.end-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
  6 * 24 * 60 * 60 * 1000)));
td.ui-state-selected-range:first-child a {
    border-radius: 20px 0 0 20px;
}
td.ui-state-selected-range:last-child a {
    border-radius: 0 20px 20px 0;
}
.ui-red-start a {
    position: relative;
    background-color: #F29676;
    border-radius: 20px;
    border: 1px solid #f29676 !important;
}
.ui-red-start a:before {
    content: '';
    right: -1px;
    left: 50%;
    top: -1px;
    bottom: -1px;
    position: absolute;
    border: 1px solid #f29676;
    border-right: none;
    background-color: #f8c3b1;
    z-index: -1;
}
.ui-red-end a {
    position: relative;
    background-color: #F29676;
    border-radius: 20px;
    border: 1px solid #f29676 !important;
}
.ui-red-end a:before {
    content: '';
    left: -1px;
    right: 50%;
    top: -1px;
    bottom: -1px;
    position: absolute;
    border: 1px solid #f29676;
    border-left: none;
    background-color: #f8c3b1;
    z-index: -1;
}

.ui-state-selected-range .ui-state-default {
    border: 1px solid #f29676 !important;
    border-left: none !important;
    border-right: none !important;
    background: #f8c3b1 !important;
    box-sizing: border-box;
}

<input type="text" id="start-date" style="visibility: hidden">
<input type="text" id="end-date" style="visibility: hidden">

A: I think, there will no default option in Jquery-ui-calendar, but you can make custom like below example,
Here I am setting top button with moment.js and on click of that increment or decrements value based on previous selected.
See below working code:-

var monthNames = ["January", "February", "March", "April", "May", "June",
  "July", "August", "September", "October", "November", "December"
];

var firstMonth = moment(new Date()).month();

function setButton() {
  for (var i = 0; i < 12; i++) {
    var classs = "months active";
    if (i > 2) {
      classs = "months";
    }
    $("#list").append("" + monthNames[firstMonth++] + "");
    if (firstMonth == 12) firstMonth = 0;
  }
}

setButton();

$(document).on("click", ".ui-datepicker-next", function() {
  $(".months").remove();
  firstMonth += 1;
  if (firstMonth > 11) {
    firstMonth = 0;
  }
  setButton();
});

$(document).on("click", ".ui-datepicker-prev", function() {
  $(".months").remove();

  firstMonth -= 1;
  if (firstMonth == -1) {
    firstMonth = 11;
  }
  setButton();
});

$(document).on("click", ".months:not(.active)", function() {
  $(".ui-datepicker-next").trigger('click');
})

$("#datepicker").datepicker({
  numberOfMonths: 3,
  showButtonPanel: false,
  dateFormat: 'dd.mm.yy',
  minDate: 0,
  maxDate: new Date(new Date().getTime() + 365 * 24 * 60 * 60 * 1000),
  beforeShowDay: function(date) {
    var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
    var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());
    if (startDate && endDate && startDate - endDate) {
      if (endDate <= date && date <= startDate) {
        if (startDate && date && (startDate.getTime() === date.getTime())) {
          // console.log('from end to start - backward - red-start ');
          return [true, 'ui-red-end', ''];
        }
        if (endDate && date && (endDate.getTime() === date.getTime())) {
          //    console.log('from end to start - backward - red-end ');
          return [true, 'ui-red-start', ''];
        }
        //  console.log('from end to start - backward');
        return [true, 'ui-state-selected-range', ''];
      }
    }
    if (startDate <= date && date <= endDate) {
      //console.log('from start to end - forward');
      if (startDate && date && (endDate.getTime() === date.getTime())) {
        // console.log('from start to end - forward - red-end');
        return [true, 'ui-red-end', ''];
      }
      if (endDate && date && (startDate.getTime() === date.getTime())) {
        //  console.log('from start to end - forward - red-start');
        return [true, 'ui-red-start', ''];
      }
    }
    if (startDate <= date && date <= endDate) {
      //    console.log('from start to end');
      return [true, 'ui-state-selected-range', ''];
    }
    return [true, '', ''];
  },
  onSelect: function(dateText, inst) {
    var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
    var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());
    if (!startDate || endDate) {
      $('#start-date').val(dateText);
      $('.start-date-visible').text(dateText);
      $('#end-date').val('');
      $('.end-date-visible').text('');
      $(this).datepicker('option', dateText);
    } else {
      if (new Date(dateText) < startDate) {
        var sDate = $('#start-date').val();
        $('.start-date-visible').text(dateText);
        $('#start-date').val(dateText);
        $(this).datepicker('option', null);
        $('.end-date-visible').text(sDate);
        $('#end-date').val(sDate);

      } else {
        $('.end-date-visible').text(dateText);
        $('#end-date').val(dateText);
        $(this).datepicker('option', null);
      }
    }
  }
});
// start date on default
$('#start-date').val($.datepicker.formatDate('dd.mm.yy', new Date()));
$('.start-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date()));
// end date on default
$('#end-date').val($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
  6 * 24 * 60 * 60 * 1000)));
$('.end-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
  6 * 24 * 60 * 60 * 1000)));
td.ui-state-selected-range:first-child a {
  border-radius: 20px 0 0 20px;
}

td.ui-state-selected-range:last-child a {
  border-radius: 0 20px 20px 0;
}

.ui-red-start a {
  position: relative;
  background-color: #F29676;
  border-radius: 20px;
  border: 1px solid #f29676 !important;
}

.ui-red-start a:before {
  content: '';
  right: -1px;
  left: 50%;
  top: -1px;
  bottom: -1px;
  position: absolute;
  border: 1px solid #f29676;
  border-right: none;
  background-color: #f8c3b1;
  z-index: -1;
}

.ui-red-end a {
  position: relative;
  background-color: #F29676;
  border-radius: 20px;
  border: 1px solid #f29676 !important;
}

.ui-red-end a:before {
  content: '';
  left: -1px;
  right: 50%;
  top: -1px;
  bottom: -1px;
  position: absolute;
  border: 1px solid #f29676;
  border-left: none;
  background-color: #f8c3b1;
  z-index: -1;
}

.ui-state-selected-range .ui-state-default {
  border: 1px solid #f29676 !important;
  border-left: none !important;
  border-right: none !important;
  background: #f8c3b1 !important;
  box-sizing: border-box;
}

.months {
  padding: 10px;
  background: #f1f1f1;
}

.months.active {
  background: #ffc2c2;
}

.months:hover {
  cursor: pointer;
}

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<input type="text" id="start-date" style="visibility: hidden">
<input type="text" id="end-date" style="visibility: hidden">

A: Hope this helps
use destroy() to set month on datepicker when you choose a month.
$("#datepicker").datepicker("destroy");
Then reinitialize datepicker passing selected month.

var today=new Date();
var newDate;
setCalender(today.getMonth());
var today=$("#datepicker").datepicker("getDate");
var todayMonth=today.getMonth();
setMonth(todayMonth);
clickMonth();
function setCalender(defaultMonth){
$("#datepicker").datepicker("destroy");
if(today.getMonth()==defaultMonth){
newDate=new Date(today.getFullYear(),today.getMonth(),today.getDate());
}
else if(today.getMonth()>defaultMonth){
newDate=new Date(today.getFullYear()+1,defaultMonth,today.getDate());
}
else{
newDate=new Date(today.getFullYear(),defaultMonth,today.getDate());
}
$("#datepicker").datepicker({
        numberOfMonths: 3,
        showButtonPanel: false,
        dateFormat: 'dd.mm.yy',
        defaultDate: newDate,
        minDate: 0,
        maxDate: new Date(new Date().getTime() + 365 * 24 * 60 * 60 * 1000),
        beforeShowDay: function(date) {
        var dates=new Date();

            var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
            var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());
            if (startDate && endDate && startDate - endDate) {
                if (endDate <= date && date <= startDate) {
                    if (startDate && date && (startDate.getTime() === date.getTime())) {
                        return [true, 'ui-red-end', ''];
                    }
                    if (endDate && date && (endDate.getTime() === date.getTime())) {
                        return [true, 'ui-red-start', ''];
                    }
                    return [true, 'ui-state-selected-range', ''];
                }
            }

            if (startDate <= date && date <= endDate) {
                if (startDate && date && (endDate.getTime() === date.getTime())) {
                    return [true, 'ui-red-end', ''];
                }
                if (endDate && date && (startDate.getTime() === date.getTime())) {
                    return [true, 'ui-red-start', ''];
                }
            }

            if (startDate <= date && date <= endDate) {
                return [true, 'ui-state-selected-range', ''];
            }

            return [true, '', ''];
        },
        onSelect: function(dateText, inst) {
            var startDate = $.datepicker.parseDate('dd.mm.yy', $('#start-date').val());
            var endDate = $.datepicker.parseDate('dd.mm.yy', $('#end-date').val());

            if (!startDate || endDate) {
                $('#start-date').val(dateText);
                $('.start-date-visible').text(dateText);
                $('#end-date').val('');
                $('.end-date-visible').text('');
                $(this).datepicker('option', dateText);
            } else {
                if (new Date(dateText) < startDate) {
                    var sDate = $('#start-date').val();
                    $('.start-date-visible').text(dateText);
                    $('#start-date').val(dateText);
                    $(this).datepicker('option', null);
                    $('.end-date-visible').text(sDate);
                    $('#end-date').val(sDate);

                } else {
                    $('.end-date-visible').text(dateText);
                    $('#end-date').val(dateText);
                    $(this).datepicker('option', null);
                }
            }
        }
    });
    // start date on default
    $('#start-date').val($.datepicker.formatDate('dd.mm.yy', new Date()));
    $('.start-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date()));
    // end date on default
    $('#end-date').val($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
      6 * 24 * 60 * 60 * 1000)));
    $('.end-date-visible').text($.datepicker.formatDate('dd.mm.yy', new Date(new Date().getTime() +
      6 * 24 * 60 * 60 * 1000)));
}
function setMonth(todayMonth){
$(".months").empty();
var month=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var after=[];
var before=[];
$.each(month,function(i,item){
 if(i>=todayMonth){
  before.push(""+month[i]+"");
 }
 else{
  after.push(""+month[i]+"");
 }
});
$.each(before,function(i,item){
 $(".months").append(before[i]);
});
$.each(after,function(i,item){
 $(".months").append(after[i]);
});
for(var j=0;j<3;j++){
 $(".months").find("label").eq(j).addClass("active");
}
}
function clickMonth(){
$(document).on("click","label",function(){
 var index=$(this).attr("data-attr");
 setMonth(index);
setCalender(index);
});
}
td.ui-state-selected-range:first-child a {
    border-radius: 20px 0 0 20px;
}
td.ui-state-selected-range:last-child a {
    border-radius: 0 20px 20px 0;
}
.ui-red-start a {
    position: relative;
    background-color: #F29676;
    border-radius: 20px;
    border: 1px solid #f29676 !important;
}
.ui-red-start a:before {
    content: '';
    right: -1px;
    left: 50%;
    top: -1px;
    bottom: -1px;
    position: absolute;
    border: 1px solid #f29676;
    border-right: none;
    background-color: #f8c3b1;
    z-index: -1;
}
.ui-red-end a {
    position: relative;
    background-color: #F29676;
    border-radius: 20px;
    border: 1px solid #f29676 !important;
}
.ui-red-end a:before {
    content: '';
    left: -1px;
    right: 50%;
    top: -1px;
    bottom: -1px;
    position: absolute;
    border: 1px solid #f29676;
    border-left: none;
    background-color: #f8c3b1;
    z-index: -1;
}

.ui-state-selected-range .ui-state-default {
    border: 1px solid #f29676 !important;
    border-left: none !important;
    border-right: none !important;
    background: #f8c3b1 !important;
    box-sizing: border-box;
}
label.active{
  font-weight:bold;
  background-color: #2795ee;
}
.ui-datepicker .ui-datepicker-prev,.ui-datepicker .ui-datepicker-next{
  display:none;
}
label.active:first-child {
border-top-left-radius: 50%;
border-bottom-left-radius: 50%;
}
label.active:nth-child(3n) {
border-top-right-radius: 50%;
border-bottom-right-radius: 50%;
}
.months>label {
    display: inline-block;
    padding: 10px;
    cursor: pointer;
}

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<input type="text" id="start-date" style="visibility: hidden">
<input type="text" id="end-date" style="visibility: hidden">


text:
Q: Windows Authentication and Forms Authentication together for ASP.NET I am developing an internally-facing application that needs to automatically authenticate users via Windows Authentication and fall back to Forms authentication.  The fall back would occur in situations where the user on a computer logged in as a group account (such as an operations center).  I'm concerned about security where a user could "spoof" the Windows Authentication account.  Do any of you all know of a design pattern and pragmatic idea that would fit this specific scenario?
Technical Constraints: .NET 3.5 on IIS 6 (IIS 7 is currently a non-starter in our environment)
Thanks!

A: There's an old article on MSDN here, which involves a custom 401 redirect set up in IIS - hopefully it's of some help.