text:
Q: "Other" textbox in Refiner does not work I have a refiner that maps on a taxonomy column. Teh refiner show the taxonomy items and I can "refine" them perfectly. Now I saw the input field below the taxonomy refiner

When I enter the same value like "Systembetreuung" it does not show any results. I go a way further and want to know why it does not filter correctly. It figured out that the token is different.
When it filters by the taxonomy value itself it create a filter token like "string(L0#|guid|Systembetreuung)".
http://win-ief18dunkfg/webtest/Seiten/56654654.aspx#Default={"k":"","r":[{"n":"owstaxIdesource","t":["string(\"L0|#087faa432-0001-0008-0000-e04330b12acd|Systembetreuung\")"],"o":"OR","k":false,"m":{"string(\"L0|#087faa432-0001-0008-0000-e04330b12acd|Systembetreuung\")":"Systembetreuung"}}]}

When it filters by the input field it creates a token like "equals("Systembetreuung")".
Example:
http://win-ief18dunkfg/webtest/Seiten/56654654.aspx#Default={"k":"","r":[{"n":"owstaxIdesource","t":["equals(\"Systembetreuung\")"],"o":"OR","k":false,"m":{"equals(\"Systembetreuung\")":"Systembetreuung"}}]}

I changed the URI for a test, so that it will replace the "equals" to "string", then it show mir the correct filtering.
So how I can archive that it use the correct token. Is there any setting that can do this?


text:
Q: Angular 8. Проблема с событиями между дочерним и родительским компонентами Всем привет! Не могу реализовать в Angulare 8 простейшее взаимодействие дочерних и родительских компонентов. Код писал основываясь на статье с Метанита : https://metanit.com/web/angular2/2.10.php.
Дочерний компонент:
import { Component, Input, EventEmitter, Output } from '@angular/core'
import { User } from '../user'
import {
    trigger,
    state,
    style,
    animate,
    transition
} from '@angular/animations';

@Component({
    selector: 'user-item',
    templateUrl: './user-item.component.html',
    styleUrls: ['./user-item.component.css'],
    animations: [
        // когда то была анимация
    ],
})

export class UserItemComponent {
@Input() user: User;
@Input() detailsHidden: boolean;
@Output() onSelect: EventEmitter<User> = new EventEmitter<User>();

animationState: string = 'hide';

public select() {
    this.onSelect.emit(this.user);
}

Разметка дочернего компонента:
<button class="main" (click)="select()">{{user.name}}</button>

age : {{user.age}}

country : {{user.country}}

Родительский компонент:
import { Component, Input } from '@angular/core'
import { User } from '../user'

@Component({
    selector: 'user-list',
    templateUrl: './user-list.component.html'
})

export class UserListComponent  {
    @Input() users: User[];
    @Input() selectedUser: User;

    select(data : User) {
        alert('zzz');
        //this.selectedUser = selectedUser;
    }
}

Разметка родительского компонента

Count of users : {{users.length}}

<user-item *ngFor="let user of users"
           [user]="user"
           [detailsHidden]="selectedUser != user"
           (select)="select($event)">
</user-item>

Собственно при нажатии на кнопки UserItem'a ожидаю увидеть alert('zzz');, но на деле тишина. Что делаю не правильно?
Заранее благодарен

redpajama_set_name: RedPajamaStackExchange


text:
Q: Finding current quarter of year in PowerShell to append in a filename with format "yyyyqq" I am trying to find current quarter of year in PowerShell to append in a filename with format yyyyqq.
I have already got current month and week as below:
$WeekYYYYWW = (get-date (Get-Date).AddDays(-7) -UFormat "%Y%V")
$yesterdayMMDDYY=(get-date (get-date).AddDays(-1) -uformat %m%d%Y)
$monthly=(get-date (get-date).AddDays(-1) -uformat %m%Y)

A: Another way is:
"$(Get-date -f yyyy)$("{0:00}" -f [Math]::ceiling((Get-date -f MM)/3) )"

A: one way is:
$yearYYYYQQ = "$(get-date -uformat %Y)$("{0:00}" -f [int]((get-date).month/4) )"

A: Another way:
$today = Get-Date
$YearYYYYQQ = "{0}{1:d2}" -f ($today.Year, [int][math]::Ceiling($today.Month/3))

A: "$([datetime]::Now.Year)$(([math]::Ceiling(([datetime]::Now.Month)/3)).ToString().PadLeft(2,"0"))"


text:
Q: SALE Tags not removed automatically I am trying to schedule prices for 24-26th on Max Motorsport but a SALE tag appears with no sale price.
Can I remove this tag automatically and enable it on Friday morning but have all sale prices changed as they are scheduled?

A: If the sale tag is not enabling/disabling automatically, then I think that the sale tag is being managed manually by an attribute.
To manage it automatically, you need to make it dependent on the special price of the product.
To schedule the prices automatically, you can make use of attributes special price from and special price to attributes.

Please let me know if the logic is clear to you.


text:
Q: Find the sum of numbers in an array C I have researched for over an hour on this topic and I had no luck so I decided to go ahead and ask this question here. I have been figuring out how find the sum of 10 different numbers from the array after I type numbers on program. For example, it asks you to type 10 different numbers and they would be all added up after they are typed out in an array. Here is the code. The top part is function. The bottom part is from main(). Any helps would be heavily appreciated.
void addNum(int z[])
{
    int sum = 0;
    int i;

    //scanf("%d", &z[i]);

    sum = sum + z[i];

    printf("\nThe sum of numbers you entered is %d.\n", sum);
}

...........
int z[10];
int i;
int num = 0;

printf("Please enter 10 different numbers: \n");

for(i = 0; i < 10; i++)
{
    z[i] = num;
    scanf("%d", &num);
}

printf("\nThe numbers you entered were: ");

for (i = 1; i <= 10; i++)
{
    printf("%d ", z[i]);
}
printf("\n");

//scanf("%d", z[i]);

addNum(z[i]);

A: You should do the adding in your function
void addNum(int z[], int sizeOfArray)
{
int sum = 0;

//scanf("%d", &z[i]);
for(int i = 0; i < sizeOfArray; i++){
   sum += z[i];
}
printf("\nThe sum of numbers you entered is %d.\n", sum);
}

Pass in the array in the main with the array size
addNum(z,10);

A: In your code use pass by reference and not pass by value.
When you call "addNum(z[i])"  , i is 11 and what you are passing is z[11] which will be garbage at first place but you are passing only value of one variable which is not what you wanted.
What you want to pass is the address of the array either "z" or "&z[0]" . Along with the size of array, so the function knows how many member variables in array.


text:
Q: How to send email using Sendgrid with custom domain (https) with Google App Engine I'm have a web app hosted on Google App Engine written in Codeigniter (PHP). I use sendgrid to send transactional emails.
The app was initially hosted on https://appid.appspot.com and the everything was fine.
I recently changed the app URL to https://app.domain.com and imported a SSL certificate that I purchased from godaddy. As far as the ssl certificate is concerned I do not have any issue.
However while sending transactional email I get the following error.
Severity: Warning

Message: fsockopen(): php_network_getaddresses: gethostbyname failed. errno=0

Filename: libraries/Email.php

Line Number: 1949

Backtrace:

File: /base/data/home/apps/s~chutti-app-prod/1.388253899009796980/application/controllers/Signup.php
Line: 60
Function: send

File: /base/data/home/apps/s~chutti-app-prod/1.388253899009796980/index.php
Line: 292
Function: require_once

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to smtp.sendgrid.net:587 (php_network_getaddresses: gethostbyname failed. errno=0)

Filename: libraries/Email.php

Line Number: 1949

Backtrace:

File: /base/data/home/apps/s~chutti-app-prod/1.388254166863409817/application/controllers/Signup.php
Line: 60
Function: send

File: /base/data/home/apps/s~chutti-app-prod/1.388254166863409817/index.php
Line: 292
Function: require_once

The sendgrid credentials are same as I used the same credentials in a different application hosted at https://app.appspot.com and everything is fine. The problem is only with my custom URL with https.
Code that sends email
$this->load->library('email');

$this->email->initialize(array(
              'protocol' => 'smtp',
              'smtp_host' => 'smtp.sendgrid.net',
              'smtp_user' => 'username',
              'smtp_pass' => 'password',
              'smtp_port' => 587,
              'crlf' => "\r\n",
              'newline' => "\r\n"
        ));

        $body = 'some html content';
        $this->email->set_mailtype("html");
        $this->email->from('noreply@domain.com');
        $this->email->to('to@userdomain.com');
        $this->email->subject('Please confirm your email');
        $this->email->message($body);
        $this->email->send();

It would be great if someone can help me understand what exactly is the issue.

A: The tutorial link is for Google Compute Engine.  By default, the App Engine PHP environment runs in a mode where you won't be able to open arbitrary connections.
But, check out this guide instead:
https://cloud.google.com/appengine/docs/php/mail/sendgrid


text:
Q: Adding a row with a certain value if it isn't in the table I have a table setup with a UNIQUE column called, for example, test. I want to insert a row with the column test only if there isn't already a row in the table with test. I know I could just do the INSERT query and it would throw up an error if it already existed (and wouldn't really cause any harm AFAIK), but is there a way to do this properly using only MySQL? I'm pretty sure it can be done with functions but I've never used those before and I think there's an easier way.

A: Sounds like a job for INSERT IGNORE:

If you use the IGNORE keyword, errors
  that occur while executing the INSERT
  statement are treated as warnings
  instead. For example, without IGNORE,
  a row that duplicates an existing
  UNIQUE index or PRIMARY KEY value in
  the table causes a duplicate-key error
  and the statement is aborted. With
  IGNORE, the row still is not inserted,
  but no error is issued.

A: Something like this should work
INSERT INTO TABLE(column1,column2)
SELECT value1, value2
WHERE 1 NOT IN (SELECT 1 FROM TABLE WHERE test='test')

A: You can use the IGNORE keyword, like this:
INSERT IGNORE INTO table_name (test) VALUES('my_value');

From the MySQL documentation:

If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued.

If you want to update the existing row rather than ignore the duplicate update entirely, check out the ON DUPLICATE KEY UPDATE syntax.

A: INSERT IGNORE (v,b,g) VALUES(1.2.3)
will do nothing if you hit keys (primary or unique) but you should know your keys then.
or just as John said, with preselcted data


text:
Q: Node module generating a lot of subfolders I'm running my build on jenkins but when I run npm install --color=false --loglevel warn it generate a lot of subfolders, and I can't even delete them on windows (I have to rename them before that).
It has started to happen today, we didin't manually update anything

My packages.json file
{
  "name": "contratanet-portal",
  "version": "0.1.0",
  "description": "Builder do contratanet portal",
  "private": true,
  "devDependencies": {
    "grunt": "~0.4.5",
    "grunt-shell": "~0.7.0",
    "grunt-msbuild": "~0.1.12",
    "grunt-nuget": "~0.1.3",
    "underscore": "~1.6.0",
    "karma": "^0.12.23",
    "karma-jasmine": "^0.1.5",
    "requirejs": "^2.1.15",
    "karma-chrome-launcher": "^0.1.4",
    "karma-firefox-launcher": "^0.1.3",
    "lodash": "^2.4.1",
    "karma-opera-launcher": "^0.1.0",
    "karma-safari-launcher": "^0.1.1",
    "karma-ie-launcher": "^0.1.5",
    "karma-junit-reporter": "^0.2.2",
    "karma-phantomjs-launcher": "^0.1.4",
    "grunt-karma": "^0.9.0"
  }
}


text:
Q: istringstream "get" method implementation The "method" implementation says istringstream get
int get();
Extracts a character from the stream and returns its value (casted to an integer).

I wanted to see its implementation.
Edit:Removed the part which I am trying to port

A: You will find std::istringstream in the header <sstream>. But not the get() method. The get() member is inherited from the basic_istream<_Elem, _Traits> template which you can find in the header . Here's the implementation, from my VS2005 installation:
int_type __CLR_OR_THIS_CALL get()
    {   // extract a metacharacter
    int_type _Meta = 0;
    ios_base::iostate _State = ios_base::goodbit;
    _Chcount = 0;
    const sentry _Ok(*this, true);

    if (!_Ok)
        _Meta = _Traits::eof(); // state not okay, return EOF
    else
        {   // state okay, extract a character
        _TRY_IO_BEGIN
        _Meta = _Myios::rdbuf()->sbumpc();

        if (_Traits::eq_int_type(_Traits::eof(), _Meta))
            _State |= ios_base::eofbit | ios_base::failbit; // end of file
        else
            ++_Chcount; // got a character, count it
        _CATCH_IO_END
        }

    _Myios::setstate(_State);
    return (_Meta);
    }


text:
Q: High dimensionality on data sets I have seen in many questions on SO, asking for your opinion of how do you define a huge table in a database....
I have seen that you have answered >= 1 billion of rows, etc..
Doing some research and following  Wegman and Solka they classify a huge table with more than 10^10 entries
My question is refering to a number of columns in a table, I know 1,000 columns is a very considerable number, (supposing we have 1 billion rows)...

*

*Do you know any paper where they measure or say when a table is huge depending on columns AND rows?

A: As far as SQL Server is concerned, the column limit on a normal table is 1,024. So I would consider any number of columns approaching that limit to be large. That said, you can use wide tables to extend the limit up to 30,000 but there are tradeoffs:

A wide table is a table that has defined a column set. Wide tables use sparse columns to increase the total of columns that a table can have to 30,000. The number of indexes and statistics is also increased to 1,000 and 30,000, respectively. The maximum size of a wide table row is 8,019 bytes. Therefore, most of the data in any particular row should be NULL. To create or change a table into a wide table, you add a column set to the table definition. The maximum number of nonsparse columns plus computed columns in a wide table remains 1,024.
By using wide tables, you can create flexible schemas within an application. You can add or drop columns whenever you want. Keep in mind that using wide tables has unique performance considerations, such as increased run-time and compile-time memory requirements.

According to this thread, the limit for PostgreSQL is 1,600 columns per table.
Based on these numbers, I would suggest any number of columns that approaches 1,000 to be huge.


text:
Q: Table is mutating, trigger/function may not see it ORA-06512 I have two tables called DetailRental and Video. VID_NUM is the PK of Video and the FK of DetailRental.
What this code wants to achieve is when the Detail_Returndate or Detail_Duedate from DetailRental table changes(update or insert new row), the trigger will check the value of Detail_Returndate row by row. If its value is null, then the corresponding(according to VID_NUM) attribute VID_STATUS from Video table will change to "OUT".
The trigger has been created successfully. However, when I want to update the date. Oracle gives me error:
ORA-04091: table SYSTEM2.DETAILRENTAL is mutating, trigger/function may not see it
ORA-06512: at "SYSTEM2.TRG_VIDEORENTAL_UP", line 3
ORA-04088: error during execution of trigger 'SYSTEM2.TRG_VIDEORENTAL_UP'

1. UPDATE DETAILRENTAL
2. SET DETAIL_RETURNDATE = null
3. WHERE RENT_NUM = 1006 AND VID_NUM = 61367

Below is my code:
CREATE OR REPLACE TRIGGER trg_videorental_up
  AFTER INSERT OR UPDATE OF DETAIL_RETURNDATE, DETAIL_DUEDATE ON DETAILRENTAL
  FOR EACH ROW
AS
  DECLARE
    DTRD DATE;
  BEGIN
    SELECT DETAIL_RETURNDATE
      INTO DTRD
      FROM DETAILRENTAL;
    IF DTRD IS NULL
      THEN UPDATE VIDEO
        SET VIDEO.VID_STATUS = 'OUT'
        WHERE EXISTS
          (SELECT DETAILRENTAL.VID_NUM
            FROM DETAILRENTAL
            WHERE DETAILRENTAL.VID_NUM = VIDEO.VID_NUM
          );
    END IF;
END;

Thank you very much!
problem solved here is the code:
CREATE OR REPLACE TRIGGER trg_videorental_up
AFTER INSERT OR UPDATE OF DETAIL_RETURNDATE, DETAIL_DUEDATE ON DETAILRENTAL
FOR EACH ROW
DECLARE DETAIL_RETURNDATE DATE;
BEGIN
IF :NEW.DETAIL_RETURNDATE IS NULL THEN UPDATE VIDEO SET VID_STATUS = 'OUT' WHERE VID_NUM = :NEW.VID_NUM;
ELSIF :NEW.DETAIL_RETURNDATE > SYSDATE THEN UPDATE VIDEO SET VID_STATUS = 'OUT' WHERE VID_NUM = :NEW.VID_NUM;
ELSIF :NEW.DETAIL_RETURNDATE <= SYSDATE AND TO_CHAR(DETAIL_RETURNDATE)!= '01/01/0001' THEN UPDATE VIDEO SET VID_STATUS = 'IN' WHERE VID_NUM = :NEW.VID_NUM;
ELSIF :NEW.DETAIL_RETURNDATE = '01/01/0001' THEN UPDATE VIDEO SET VID_STATUS = 'LOST' WHERE VID_NUM = :NEW.VID_NUM;
END IF;
END;

A: A good data model is one in which no redundant information is physically stored.  If you can look at one (or more) values in a table.column and figure out what value should be in another table.column, then you've got a redundancy.  In your case, a person can see a DETAILRENTAL.DETAIL_DUEDATE for VIDNUM 61367 is not null, and "know" that the VIDEO.STATUS field should be OUT.
Most easily fixed with something like:
1) Create a VIDEO_BASE table, with all VIDEO columns except VID_STATUS:
CREATE TABLE VIDEO_BASE AS
SELECT {list all columns except STATUS}
FROM VIDEO;

2)  Drop original VIDEO table and create as a view, VIDEO, which shows all columns of VIDEO_BASE, plus exposes STATUS as a derived field:
CREATE OR REPLACE VIEW VIDEO
AS
SELECT  V.*,
        CASE WHEN
            (
            SELECT COUNT(*)
            FROM
                (
                SELECT 'X'
                FROM DETAILRENTAL D
                WHERE D.VID_NUM = V.VID_NUM
                      AND DETAIL_RETURNDATE IS NOT NULL
                      AND ROWNUM <= 1
                )
            ) > 0
        THEN 'OUT'
        ELSE NULL
        END VID_STATUS
FROM VIDEO_BASE V;

In general, if you feel you need a trigger to keep two different tables in sync, you've got a data model problem.  In my 15+ years experience with Oracle, the only best way to fix problematic triggers is to fix the data model - the surest way to know that all your triggers are working properly is when the number of triggers in your database is 0.

A: After reading through @KevinKirkpatrick's answer two or three times, I realise he's right - an individual video's in/out status is derivable from other information in the database. That said, you may have pragmatic reasons for doing it this way.
The bad news is that you can't select from a table within a row trigger on that same table - that's what the "mutating table" problem means. The good news is that in this case you don't really need to.
I don't have an Oracle installation I can test this on, so I make no guarantee of syntactic correctness, but it should be close enough to get you started.
CREATE OR REPLACE TRIGGER trg_videorental_up
  AFTER INSERT OR UPDATE
    OF detail_duedate, detail_returndate
  ON detailrental
  FOR EACH ROW
AS
BEGIN
  IF :new.detail_returndate IS NULL
    AND :new.detail_duedate IS NOT NULL
  THEN
    UPDATE video
      SET status = 'OUT'
      WHERE video_num = :new.video_num;
  END IF;
END;


text:
Q: Get the currently selected item from a pull down list in concrete5 I'm trying to solve a problem using concrete5
The user wants a block to be able to display information on a book selected from a database
everything is in place up to the selection menu I can populate the drop down list with the titles in the database but when a book is selected the block simply displays the index value of the selection menu's options array.
For example if the array looked something like
0 => Harry Potter and the Goblet of Fire,
1 => Game of Thrones
and the user selects Harry Potter from the list the block simply displays "0" as the given title. I'm reasonably sure i can fix this by means of using a function to assign the correct values by querying the database. but I can't seem to get the selected item from the selection menu only it's array index value.
any thoughts?
code is as follows
add.php
    <?php defined('C5_EXECUTE') or die(_("Access Denied.")) ?>
<?php $titles = $controller -> getTitles() ?>
<div class="ccm-ui">
    <?php echo $form->select('bookselect', $titles, 1, array('style' => 'width: auto;')) ?>

</div>

I tried using $ title = $this -> $_REQUEST['bookselect']; but it didn't work and now some hours later I'm at a loss

A: Since you're already populating the list of titles from a controller function, you can simply re-use that for the "view" of your block. So in your block controller, find the view() function (or add it if it's not already there), and do this:
$titles = $this->getTitles();
$this->set('title', $titles[$bookselect]);

Now in your block's view template, you will have the $title variable available to echo, and it will contain the name of the book.

A: A HTML Select element only passes its array index (or the value attribute) it won't ever send you the value, that's just not the way HTML works.
You have a couple of options.

*

*Look up value from Index in database.

*Change index to include value eg ()

A: The documentation for the select box is as follows,
$form->select($name, $options, $selectedValue, $tagAttributes);

in your example,
$form->select('bookselect', $titles, 1, array('style' => 'width: auto;'))

This should select Game of thrones as the selected book, (assuming the value being used is an the key of the array), you could try passing the options as an associative array
array(
'Harry Potter and the Goblet of Fire'=>'Harry Potter and the Goblet of Fire',
'Game of Thrones'=>'Game of Thrones'
)

That way, the values passed would be values and passing back in the title should help select the option.
$form->select('bookselect', $titles, $title, array('style' => 'width: auto;'))

I have not tested this so some sanitation of the title may be required to use it as a key.


text:
Q: Separate the comma values in single row in sql query I have  this table structure
 id     flim_name     flim_actor_name
 1      Diwalie       Shah Rukh Khan,Kajol,Varun Dhawan
 2      Mersal        vijay, samantha,kajol

I need to convert table in to this structure
id     flim_name     Actor_name       Heroin_name  director_name
1       Diwalie      Shah Rukh Khan     Kajol       Varun Dhawan
2       Mersal       vijay              samantha       kajol

I need the sql query  to solve this

A: Use implode for this
ex.
$arr = array(Shah Rukh Khan,Kajol,Varun Dhawan);
echo implode(" ",$arr);
echo implode(" ",$arr)."
";
echo implode("+",$arr)."
";
echo implode("-",$arr)."
";
echo implode("X",$arr);

Ouput:
Shah Rukh Khan Kajol Varun Dhawan
Shah Rukh Khan+Kajol+Varun Dhawan
Shah Rukh Khan-Kajol-Varun Dhawan
Shah Rukh KhanXKajolXVarun Dhawan

A: Answer for the question is
Select id, flim_name,
substring_index(substring_index ( `flim_actor_name`,',',1 ), ',',-1)as Hero,
substring_index(substring_index ( `flim_actor_name`,',',2 ), ',', -1)as Heroin,
substring_index(substring_index(`flim_actor_name`,",",3),',',-1) as director_name
from flim_management_table

Table structure:
 id      flim_name     Hero             Heroin       director_name
  1       Diwalie      Shah Rukh Khan     Kajol       Varun Dhawan
  2       Mersal       vijay              samantha       kajol


text:
Q: Extracting two strings from quotations in Java using regex? I'm new to using patterns and looked everywhere on the internet for an explanation to this problem.
Say I have a string: String info = "Data I need to extract is 'here' and 'also here'";
How would I extract the words:
here
also here

without the single quotes using a pattern?
This is what I have so far...
Pattern p = Pattern.compile("(?<=\').*(?=\')");

But it returns ( here and 'also here ) minus the brackets, that is just for viewing. It skips over the second piece of data and goes straight to the last quote...
Thank you!
EDIT:
Thank you for your replies everyone! How would it be possible to alter the pattern so that here is stored in matcher.group(1) and also here is stored in matcher.group(2)? I need these values for different reasons, and splitting them from 1 group seems inefficient...

A: Try making your regex non-greedy:
Pattern p = Pattern.compile("(?<=')(.*?)(?=')");

EDIT:
This does not work. It gives the following matches:
here
 and
also here

This is because the lookahead/lookbehind do not consume the '.
To fix this use the regex:
Pattern p = Pattern.compile("'(.*?)'");

or even better (& faster):
Pattern p = Pattern.compile("'([^']*)'");

A: I think you're making it to complicated, try
Pattern.compile("'([^']+)'");

or
Pattern.compile("'(.*?)'");

They will both work. Then you can extract the result from the first group matcher.group(1) after performing a matcher.find().

A: This should work for you:
    Pattern p = Pattern.compile("'([\\w\\s]+)'");
    String info = "Data I need to extract is 'here' and 'also here'";
    Matcher m = p.matcher(info);
    while (m.find()) {
        System.out.println(m.group(1));
    }

Here's the printout:-
here
also here

If you want the data in 2 separate groups, you could do something like this:-
    Pattern p = Pattern.compile("^[\\w\\s]*?'([\\w\\s]+)'[\\w\\s]*?'([\\w\\s]+)'$");
    String info = "Data I need to extract is 'here' and 'also here'";
    Matcher m = p.matcher(info);
    while (m.find()) {
        System.out.println("Group 1: " + m.group(1));
        System.out.println("Group 2: " + m.group(2));
    }

Here's the printout:
Group 1: here
Group 2: also here

A: Why not using simply the following?
'.*?'


text: Q: Any technology or analysis to find the Air Transport Management to reduce the delays? Everyone in today's busy life, the most utilized transportation is Airways without any doubt. To increase airline services , and trying to predict the delays because of weather or any other inconveniences, if there is an AI App or automated ML predictive models that helps both Businesses and Passengers either way to get benefited would be great right.


text:
Q: Change Text with a setTimeout() Basically what I am trying to do is Click on a link, have it change, then by itself, change back. Below, is the current code I am using. This code was found on here but I couldn't find out how to add the setTimeout() to the function.
function changeText(idElement) {
var element = document.getElementById('element' + idElement);
if (idElement === 1) {
    if (element.innerHTML === 'Request') element.innerHTML = 'Request Submitted!';
    else {
        element.innerHTML = 'Request';
    }
  }
}

Now, That is allowing them to click on that link, change it to 'Request Submitted!' and then click it again to change it back to 'Request'. How could I put a timer on it to have it switch back to 'Request' automatically?
Thanks!

A: function changeText (idElement, reset) {
    var element = document.getElementById('element' + idElement);
    if (idElement === 1) {
        var newText = (element.innerHTML === 'Request' && !reset) ? 'Request Submitted!' : "Request";
        element.innerHTML = newText;
        if (element.timer) {
            window.clearTimeout(element.timer);
        }
        if (newText !== 'Request') {
            element.timer = window.setTimeout( function(){ changeText(idElement, true); }, 1000); };
        }
    }
}


text:
Q: LocalNofication sound in CN1 Neither on Android nor on iOS the sound file referenced by a LocalNotification instance is played (check the sample code below). On Android the system's standard sound is played. Anyone knows what I am doing wrong here?
@Override
protected void postMain(Form f) {

    Container contentPane = f.getContentPane();
    contentPane.setLayout(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
    contentPane.setUIID("ToastBar");

    Button btn = new Button("create Notification");
    btn.addActionListener((e) -> {
        scheduleNotification(Display.getInstance(), 0, "Title", "Body", "notification_sound_file.mp3", System.currentTimeMillis() + 1000);
    });

    contentPane.add(BorderLayout.CENTER, btn);
}

private void scheduleNotification(Display dsp, int nId, String nTitle, String nBody, String soundFileName, long scheduleTime) {

    LocalNotification ntf = new LocalNotification();
    ntf.setId(nId + " " + scheduleTime);
    ntf.setAlertTitle(nTitle);
    ntf.setAlertBody(nBody + " " + scheduleTime);
    ntf.setAlertSound("/" + soundFileName);
    Log.p("scheduling ntf ("+nTitle+","+ ntf.getAlertBody() +","+ ntf.getAlertSound());
    dsp.scheduleLocalNotification(ntf, scheduleTime, LocalNotification.REPEAT_NONE);
}

Note: notification_sound_file.mp3 does exist in my default package!

A: If you want to get the sound file from device storage, then it can't detect directly
Instead of using this
ntf.setAlertSound("/" + soundFileName);

Try this
ntf.setAlertSound(Environment.getExternalStorageDirectory().getAbsolutePath() + "Folder_Name/" + soundFileName);

This will locate your file and your specific sound will play. One more thing add "android.permission.READ_EXTERNAL_STORAGE" permission also in manifest.
Best of luck.

A: The sound file needs to be a path to a file in FileSystemStorage which must always be fully qualified. You need to copy the file into the filesystem ideally under the app directory see https://www.codenameone.com/how-do-i-use-storage-file-system-sql.html


text:
Q: What happens if I use a style an API version doesn't support I want to use the following style:
  <item name="android:actionBarItemBackground" tools:ignore="NewApi">@drawable/blank</item>

However, to do so, I have to use an API version above my apps minimum. If I do decide to use this style, will API's below the supporting version just ignore this style, or will this cause an application failure?

A: Your application will show errors when building. I don't think you can deploy an application to an AVD, or test device if it has active errors.
You can create though folders designated for newer-older API levels and try to bypass your issue like this.

Also, check out the official Android Docs.  click me!


text:
Q: jquery blur em inputs dinamicos Tenho um formulário onde crio dinamicamente os <inputs>
Com a seguinte estrutura:
<input class="form-control placaCss Tamanho200 text-box single-line valid" id="Veiculos_3b875035-ae1b-4b69-8ddc-462bbfd86fbd__Placa" name="Veiculos[3b875035-ae1b-4b69-8ddc-462bbfd86fbd].Placa" type="text" value="" aria-invalid="false">

<input class="form-control text-box single-line veiculo" id="Veiculos_4aa0f9aa-cbbf-4b3a-9a39-de41bed5f773__MarcaModelo" name="Veiculos[4aa0f9aa-cbbf-4b3a-9a39-de41bed5f773].MarcaModelo" type="text" value="">

Veja que no ID é injetado um Guid no qual não tenho controle.
O que eu gostaria de fazer é que quando terminar de digitar a placa ele execute minha função javascript que terá um ajax. Mas somente para o input digitado, ex: se tiver 3 apenas é executado no input digitado.
Consegui fazer via Style que criei chamado placaCss porém funciona de forma errada, pois ele até é chamado para cada input mas altera todos os outros
Meu código:
 $(document).ready(function () {
              $('.placaCss').blur('input', function () {

                  if ($(this).val() != "")
                  {
                   $('.Veiculo').val('teste');
                       alert($(this).val());
                  }
              });
          });

Rodando no fiddle
https://fiddle.jshell.net/nmcpjpss/1/

A: Acredito que é isso que precisa

$(document).ready(function() {
  $('.placaCss').blur('input', function() {
    var valor = $(this).val();
    var _this = $(this);
    // Verificando se o valor foi preenchido
    if (valor) {
      var proVeiculo = _this.nextAll('.veiculo:first');
      proVeiculo.val(valor);
      alert(valor);
    }
  });
});

Placas: <input class="form-control placaCss Tamanho200 text-box single-line valid" id="Veiculos_3b875035-ae1b-4b69-8ddc-462bbfd86fbd__Placa" name="Veiculos[3b875035-ae1b-4b69-8ddc-462bbfd86fbd].Placa" type="text" value="" aria-invalid="false">

 Modelo:
<input class="form-control text-box single-line veiculo" id="Veiculos_4aa0f9aa-cbbf-4b3a-9a39-de41bed5f773__MarcaModelo" name="Veiculos[4aa0f9aa-cbbf-4b3a-9a39-de41bed5f773].MarcaModelo" type="text" value="">

 Placas: <input class="form-control placaCss Tamanho200 text-box single-line valid" id="Veiculos_3b875035-ae1b-4b69-8ddc-462bbfd86fbd__Placa" name="Veiculos[b69-8ddc-462bbfd86fbd].Placa" type="text" value="" aria-invalid="false">

 Modelo:

<input class="form-control text-box single-line veiculo" id="Veiculos_-cbbf-4b3a-9a39-de41bed5f773__MarcaModelo" name="Veiculos[4aa0f9aa-cbbf-4b3a-9a39-de41bed5f773].MarcaModelo" type="text" value="">

A: Tenta delegação de eventos:
$( function () {
    $( ".placaCss" ).on( "blur", function () {
        var valor = $(this).val();
        if ( $(this).val() !== "" ) {
            alert( valor );
        }
    });
});


text:
Q: Computing regression between different groups I have four groups of Age data changing with altitude. I need to do the linear regression between different groups according to altitude . I wonder if using just lm is meaning for my case.
Altitude Age
100     22
100     24
100     35
200     41
200     24
200     14
300    25
300     18
300     25

model<- lm(Age~Altitude, data=DF)
summary(model1)

A: Altitude <- factor(rep(c(100, 200, 300), each = 3))
Age <- c(22, 24, 35, 41, 24, 14, 25, 18, 25)
df <- data.frame(Altitude, Age)

You can check the p-value of the significance of the Altitude factor.
model <- lm(Age ~ Altitude, data = df)
summary(model)

Or you can just see it on a boxplot.
library(ggplot2)
ggplot(df, aes(x = Altitude, y = Age)) + geom_boxplot()


text:
Q: Error using React Native hooks, facebook, firebase I have a problem with react-native, I am trying to login with facebook using the expo-facebook and firebase libraries, it loads everything well and it starts session well, but when it loads the following screen the following comes up:

Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
  See https://facebook.com/react-invalid-hook-call for tips about how to debug and fix this problem.

Code:
import React, { Component } from 'react'
import { View, Button, Text, StatusBar, LayoutAnimation, Image, StyleSheet } from 'react-native'
import { Toast } from 'native-base'

import * as Facebook from 'expo-facebook'
import * as firebase from 'firebase'

const app = {
  id: APP_ID,
  name: APP_NAME,
}

export default class LoginScreen extends Component {
  static navigationOptions = {
    header: null,
  }
  facebook = async () => {
    Facebook.initializeAsync(app.id, app.name)
    const { type, token } = await Facebook.logInWithReadPermissionsAsync(app.id, {
      permission: 'public_profile',
    })
    if ( type == "success" ) {
      const credential = firebase.auth.FacebookAuthProvider.credential( token )
      firebase.auth().signInWithCredential(credential)
      .catch(e => {
        console.log(e)
      })
    }
    this.props.navigation.navigate('App')
  }
  render() {
    LayoutAnimation.easeInEaseOut()
    return <View>
        <Button title="Log in with facebook" style={styles.button} onPress={this.facebook}>
        </Button>
      </View>
  }
}

Here is an image of error:


text:
Q: WPF Multilingual GUI Switch-on-the-fly resource files are already created.
swtich the language after a restart of the app works currently.
is it possible to switch the language of the gui(Ribbon) on the fly ?
already tried:
change cultureinfo and invoke initializecomponents doesn't work.

A: I've bounced on this topic too a while ago. What i found was that it is possible, but it will take some effort. The only solution i recall is that you quit your application. At that moment a batch starts which will relaunch your application so the user won't freak out when the app suddenly quits and disappears. When your app has relaunched, it will reload all ui elements with the appropriate culture.
I haven't used this method because i don't like having to quit my app in order to make changes. But it is possible.
What you are experiencing is that the culture does change in your app, but your controls aren't updated accordingly. A restart "fixes" this.
Hope this helped a bit.

A: I have encountered with the same problem and found a solution that works for me. It does not require converters, but a piece of code is still necessary. The  .Net 4.5 framework is used.
Two unobvious things are needed in order to switch languages on-the-fly:

*

*Use another flavour of binding to static properties, replace
<TextBlock Text="{Binding Source={x:Static p:Resources.LocalizedString}}"/> with <TextBlock Text="{Binding Path=(p:Resources.LocalizedString)}"/>. (The binding syntax with parentheses is used for attached properties and static properties. As a side effect, the XAML designer will show empty strings for  these properties.)

*Change notifications do not work with resources. To workaround that, static bindings are manually refreshed by the following code:
// ... after the current culture has changed
UpdateStaticBindings(Application.Current.MainWindow, typeof(Properties.Resources), true);

/// <summary>
/// Update all properties bound to properties of the given static class.
/// Only update bindings like "{Binding Path=(namespace:staticClass.property)}".
/// Bindings like "{Binding Source={x:Static namespace:staticClass.property}}" cannot be updated.
/// </summary>
/// <param name="obj">Object that must be updated, normally the main window</param>
/// <param name="staticClass">The static class that is used as the binding source, normally Properties.Resources</param>
/// <param name="recursive">true: update all child objects too</param>
static void UpdateStaticBindings(DependencyObject obj, Type staticClass, bool recursive)
{
    // Update bindings for all properties that are statically bound to
    // static properties of the given static class
    if (obj != null)
    {
        MarkupObject markupObject = MarkupWriter.GetMarkupObjectFor(obj);

        if (markupObject != null)
        {
            foreach (MarkupProperty mp in markupObject.Properties)
            {
                if (mp.DependencyProperty != null)
                {
                    BindingExpression be = BindingOperations.GetBindingExpression(obj, mp.DependencyProperty) as BindingExpression;

                    if (be != null)
                    {
                        // Only update bindings like "{Binding Path=(namespace:staticClass.property)}"
                        if (be.ParentBinding.Path.PathParameters.Count == 1)
                        {
                            MemberInfo mi = be.ParentBinding.Path.PathParameters[0] as MemberInfo;
                            if (mi != null && mi.DeclaringType.Equals(staticClass))
                            {
                                be.UpdateTarget();
                            }
                        }
                    }
                }
            }
        }

        // Iterate children, if requested
        if (recursive)
        {
            foreach(object child in LogicalTreeHelper.GetChildren(obj))
            {
                UpdateStaticBindings(child as DependencyObject, staticClass, true);
            }
        }
    }
}


text:
Q: GWT (Google Web Toolkit) App through USC (Ubuntu Software Center) Is it possible do deploy google web toolkit (GWT) apps through the UBUNTU software center?
I never deployed any application through the UBUNTU software center (newbie). So if yes, is there someone who can give me a short tutorial for handling this? I have nice ideas to spread the world with innovative apps and want to use the USC for this ;)

A: I think I am able to answer my own question with YES!
I can create a Web-Application with e.g, Google Web Toolkit! After I have to bundle it in an archive file (.tar.gz, .zip, etc)! For further information see: http://developer.ubuntu.com/publish/my-apps-packages/
The Web-App can be stored locally on the System. The only thing to to, is to create the application launcher with the following command: Exec=xdg-open <path to the local html-File on the System>
Thats it!


text:
Q: Problem with CSS and .load() jquery on IE Is there a known issue with IE(7 and 8) where jquery .load() doens't function properly? My CSS isn't getting loaded onto the page. Here is my code :
This is the file which is being loaded(show_profile.php) :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<link rel="stylesheet" script="text/css" href="profile.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

Contact Details

This is the code for profile.css
#tabs {
color:white;
font-family:Verdana;
font-size:14px;
}

#cd{
position:absolute;
left:0px;
top:0px;
background-color:#3172A6;
}
.tab {
position:absolute;
top:0px;
}
.tab_active {
position:absolute;
top:0px;
}

On viewing the file show_profile.php independently , everything including the CSS is alright, but it just wont work when i use .load()
Please Help :(

A: The css is coming from a header of the main document, not whatever you're loading.
You can either use inline styling on the page you're loading using load(0 or specify style in some css (or using style tags) in the document that loads it.

A: The answer provided is correct in its entirety. The issue is because you have a page (call it A.php) that is loading this page (B.php) and the style sheet you want is only listed in B.php.  This works in other browsers because they are a little more lenient on what they allow in the DOM.  IE is very strict about what it does and does not do with  this.  The answer is to include <link rel="stylesheet" script="text/css" href="profile.css" /> in A.php

A: The link element does not have a script attribute - it should be type="text/css".


text:
Q: How to read my azure functions function key in python I am having an azure function in python. I also have my key values defined in function keys.
How to read this in python program. I see i can add key value pair in Configuration of the function app.But i need these values specific to a function.
My azure function is based on python 3.7

A: From the Microsoft documentation, You can obtain function keys programmatically by using Key management APIs

Key management API
The Functions Runtime exposes a management API that
enables consumers to programmatically add, delete, and update function
keys.
Since this API is exposed by the runtime, the base URL is:
https://<functionappname>.azurewebsites.net/

Function keys collection resource: admin/functions/{functionname}/keys
GET Retrieves the function keys
Request:
GET /admin/functions/{functionname}/keys

Response
{
  "keys": [
    {
      "name": "keyname",
      "value": "keyvalue",
      "links": [
        {
          "rel": "self",
          "href": "https://baseuri/admin/functions/{functionname}/keys/{keyname}"
        }
      ]
    }
  ],
  "links": [
    {
      "rel": "self",
      "href": "http://baseuri/admin/functions/{functionname}/keys"
    }
  ]
}


text:
Q: How can I get body html element inside the template in vue.js? I need to add some styles to the body element of the whole HTML page, but it seems I can't get it from the template, there is just another body element is created inside the main HTML body. And also if I try to change it by methods like
var elem = document.body;
elem.style.backgroundColor = 'background-color: green;';

nothing happens. Is it even possible to get the elements outside the template?
I could change it in App.vue through #body, but I need to change the style only in one particular component

A: I couldn't get the outer elements because I had scoped in style tag. But removing it would add other problems.
Changing body styles in vue router
This method works but it is kinda tricky. I thought there is more convenient way to change styles for particular templates.


text:
Q: Problem renaming wireless interfaces I want to rename a wireless interface. Right now I have 4 network interfaces, 2 Wireless, 2 Cable. the order is like this:
eth0 - Cable (Realtek RTL-8169)
eth1 - Cable (Intel 82579V)
eth2 - Wireless (Broadcom BCM4321 Proprietary Drivers)
wlan0 - Wireless (RaLink RT2800)
I want to rename eth2 to wlan1. This way the wireless cards are wlan and the cable ones are eth (The way I like it). How can I do this?
Using the suggestion made by virpara I found the following:
eth1 - e1000e
wlan0 - rt2800
wlan1 - b43
eth2 - wl
# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="38:60:77:ab:5e:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1814:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:02.0 (rt2800pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:9c:05:fd:28", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/ssb0:0 (b43-pci-bridge)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0 (wl)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

Now my questions are:

*

*Why wlan1 and eth2 have the same MAC?

*If there are 2 duplicated MACS (eth2 & wlan1) where is the other NIC?

*Why is Realtek (eth0) not appearing on the list?

*Where did wlan1 come from since I can not see it using ifconfig -a, iwconfig or lshw. There is no wlan1 except in the /etc/udev/rules.d/70-persistent-net.rules file.

A:
How to reorder or rename logical interface names in Linux

http://www.science.uva.nl/research/air/wiki/LogicalInterfaceNames
https://answers.launchpad.net/ubuntu/+question/62716
http://wishmesh.com/2009/09/ubuntu-server-rename-eth1-to-eth0/

A: See the comment at the beginning of /etc/udev/rules.d/70-persistent-net.rules:

 # Entries are automatically added by the 75-persistent-net-generator.rules
 # file; however you are also free to add your own entries.
That is an auto-generated (and possibly customized file).
/lib/udev/rules.d/75-persistent-net-generator.rules is where all the action takes place. It's hard to tell right now which entries are auto and which were added by you or some other application.
Try renaming 70-..... to an extension that is not .rules (or move to another directory). Then reboot, and paste the content of the "clean generated" 70-persistent-net.rules.

A: gksudo gedit /etc/udev/rules.d/70-persistent-net.rules
you will have content as,
# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x11ab:0x4357 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:b3:7b:28:3d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3c:e0:f2:45", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

make changes accordingly in NAME=


text:
Q: Getting an error "Cannot read property 'click' of undefined" if selector or class cannot be found in the DOM I'm getting error Cannot read property 'click' of undefined. I'm currently trying to automate/emulate a click function using the code below.
$('.trigger-pdf')[0].click();
I believe the error happens if javascript cannot find the selector in the markup/DOM or if it does not exist. Is there a way to resolve an error like this.

A: As I understand, you want to call the click event on that specific element
dynamically through your code.
Your $('.trigger-pdf') doesn't exist at the time you call .click()
So first, you need to make sure it exists by something like this:
if ($.type($('.trigger-pdf')) !== 'undefined' && $('.trigger-pdf').length > 0) {
       $('.trigger-pdf').trigger('click');
}

If your element (.trigger-pdf) is something that was dynamically added to the DOM, then binding an event with .on() wouldn't help you. You need to use dynamic binding as follows:
$('body').on('click','.trigger-pdf',function() { // Do your stuff here...});

Instead of $('body'), refer to something that is physically there when your code runs.

A: You can make your code more robust by using
$('.trigger-pdf').eq(0).click()

which won't trigger any errors if the element doesn't exist.
See https://api.jquery.com/eq/

You should figure out why that appears to be the case though. Perhaps you should be wrapping your code in a document ready event handler, ie
jQuery(function($) {
  $('.trigger-pdf').eq(0).click()
})

A: Always use on() to bind events
$('static_element').on('click', '.dynamic_element', function() { // code });


text:
Q: Why won't the ServiceLoader load any implementations from another module? I have a multi-module maven project which is making use of the JPMS features. The consumer module is not loading the implementations present in the provider module.
Here's the maven project structure:
ServiceLoaderExample
├── consumer
├── distribution
├── provider
├── service

The interface TestService is defined in the "service" module. The implementation is TestServiceImpl which is defined in the "provider" module. And the main() method in the "consumer" module uses the ServiceLoader API to load up implementations of TestService. And the "distribution" module is where I create a JAR with all of the dependencies using the maven-assesmbly-plugin.
As such, here are the corresponding module-info files:
1 - "service" module (which defines org.example.service.TestService):
module org.example.service {
    exports org.example.service;
}

2 - "provider" module (which defines org.example.provider.TestServiceImpl):
module org.example.provider {
    requires org.example.service;
    provides org.example.service.TestService with org.example.provider.TestServiceImpl;
}

3 - "consumer" module (which uses the ServiceLoader API to get implementations of TestService):
module org.example.consumer {
    requires org.example.service;
    uses org.example.service.TestService;
}

I am using the maven-assesmbly-plugin, and so it's possible things are getting screwed up when the JAR is getting built. For reference, here's the plugin definition:
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>3.2.0</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>org.example.consumer.Main</mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </execution>
            </executions>
        </plugin>

I'm using Java 13 and Maven 3.6.3, and I'm running the program using the command java -jar distribution-1.0-SNAPSHOT-jar-with-dependencies.jar. What am I doing wrong?

A: I was unable to get it work with an uber-jar, however, everything does work when using JLink. So decided to just use JLink instead.


text:
Q: Conjugate in $\mathrm{SL}(2,\mathbb{R})$ and $\mathrm{SL}(2,\mathbb{C})$ When I read an answer in: An element in $\mathrm{SL}(2,\mathbb{R})$, I find a gap in the second proof (Olivier Bégassat's) of this question.
Since my reputation points are not suffencient to comment, I asked here as a new question.
I think the second proof in this link may have some problem. Although two real matrices which that are conjugate as complex matrices are conjugate as real matrices, but the transformation matrices may not in $\mathrm{SL}(2,\mathbb{R})$.
For example, $
\begin{pmatrix}
1&-1\\
0&1\\
\end{pmatrix}$ is conjugate to $
\begin{pmatrix}
1&1\\
0&1\\
\end{pmatrix}$ by $
\begin{pmatrix}
-\mathrm{i}&0\\
0&\mathrm{i}\\
\end{pmatrix}$, but it can not be conjugated in $\mathrm{SL}(2,\mathbb{R})$.
Is there someting wrong in his proof? I think conjugate in complex field and real field are equivalent can not imply the conclusion.
In fact, my own answer about this question is
If any two $\mathrm{SL}(2,\mathbb{R})$ matrix can be conjugated by a matrix in $\mathrm{SL}(2,\mathbb{C})$, then they can be conjugated by a matrix in $\mathrm{PSL}(2,\mathbb{R})$.
Motivation: In many cases, we need the transformation of some objects preserve the structure, that is why I want the conjugate matrix is also in $\mathrm{SL}(2,\mathbb{R})$.


text:
Q: How to merge this release branch to the master? I was using this project to test all types of delete operation and ended up in the current situation. Now when I try to merge from release to master, it always give me "Git apply failed with code 1: checking patch error does not exist in index" error when I try to stage the hunk.
What shall I do at this point?

A: Your branches master and release are not connected, so you cannot merge. But if the image is not misleading and the two commits on master are effectively the same commits as the first two commits on your release branch, then just reset your master branch to your release branch by doing git branch -f master release.


text:
Q: Get user date format in Windows My question is similar to this one, however, I don't want to get the date format of the locale, but the one set by the user. The reason is that I am using the pywin32 api to communicate with Outlook, specifically to filter mails by date. The format in which I have to pass the date to the application is the one set by the user, otherwise it won't work.
So the code looks like this:
inbox = outlook.Session.GetSharedDefaultFolder(user, 6)

mails = inbox.Items.Restrict(
            "[ReceivedTime] > '{}'".format(retrieve_from.strftime(local_date_fmt))
)

If anyone knows how to do this without passing the date in the user defined format, that would also solve my problem.
EDIT:
I am referring to the short date format set in the region settings in this window:

So in this case, local_date_fmt would be set to %Y-%m-%d.

A: You could use [MS.Learn]: GetDateFormatW function (datetimeapi.h), which is wrapped by [ME.TimGolden]: win32api.GetDateFormat.
Example:

>>> import time
>>> import pywintypes as pwts
>>> import win32api as wapi
>>>
>>> DATE_SHORTDATE = 0x00000001
>>> DATE_LONGDATE = 0x00000002
>>>
>>> cur_time = time.time()
>>> cur_time
1567692860.7315922
>>> time.ctime(cur_time)
'Thu Sep  5 17:14:20 2019'
>>>
>>> wapi.GetDateFormat(0, DATE_SHORTDATE, pwts.Time(cur_time))
'2019-09-05'
>>>
>>> wapi.GetDateFormat(0, DATE_LONGDATE, pwts.Time(cur_time))  # Bonus
'Thursday, 5 September, 2019'


text:
Q: Firestore document is read multiple times after a single update in Firebase emulator I am using Firestore to save users data.  Each user in my app has a stream that listens to the user's document.  I am running Firestore emulator and noticed that SOMETIMES after the user document is updated, document is read twice or more.  I have attached an image from the Firestore emulator that shows that.  Is there a reason why I am getting multiple reads after a single update.  I am not doing any read to the user document outside the stream.

I am using Flutter mobile app for watching the user document ".snapshots()".  The print statement in this code prints only one read.  But if I am reading the user document only in the stream, then how do I end up with 2 reads in the emulator?
  Stream<MyProfile?> watchMyProfile() {
    return _firestore
        .doc(PathService.user(uid))
        .withConverter<MyProfile>(
          fromFirestore: (snapshot, _) {
            return MyProfile.fromJson(snapshot.data()!);
          },
          toFirestore: (myProfile, _) => myProfile.toJson(),
        )
        .snapshots()
        .map((doc) => doc.data())
        .map(
      (myProfile) {
        // THIS ONLY PRINTS ONCE.
        debugPrint('watchMyProfile - read my profile');
        return myProfile;
      },
    );
  }

UPDATE 1:
To make sure that I am not reading any user document after update in firestore.rules file, I used something like this:
allow update: if true;
allow get: if true;
allow list: if true;

Unfortunately, I am still seeing lots of reads after an update to the user document.

A: I have reproduced the issue at my end and found the same behavior. As you can see in the image provided, reads have increased significantly.

This is due to constructing the stream inside a stream. It will get re-created on each call to build(), up to 60 times per second if there's an animation on the page.
I recommend you to construct the stream in a private variable then use it in the stream so it will not get re-created on each build method and will be called only once.
Something like this
class SomeClass extends State<Some_State>{
    final Stream<MyProfile> _usersStream =
    FirebaseFirestore.instance.collection('users').doc('ABC123').snapshots();

@override
  Widget build(BuildContext context) {
    return StreamBuilder<MyProfile>(
      stream: _usersStream,
        builder: (context, snapshot) {
        //…
  }
}

For reference,
Real time updates on a document is done by StreamBuilder as shown in here


text:
Q: Generic function to Map Datatable to List Using Custom attribute Following is my code, where I convert data table to List of class
       var cities = ds.Tables[0].AsEnumerable().Select(c => new City
                {
                    CityCode = c.Field<object>("CITY_CODE"),
                    CityMid = c.Field<object>("CITY_MID"),
                    CityName = c.Field<object>("CITY_NAME"),
                    CountryCode = c.Field<object>("COUNTRY_CODE"),
                    StateCode = c.Field<object>("STATE_CODE"),
                    ActiveFlag = c.Field<object>("ACTIVE_FLG"),
                }).ToList();

How can one create a generic class to convert data-table or map to list, In the above example, I have used the class City, but there will be any class with different properties and data-table with any column names

A: The datatype is Func<DataRow, City>, a function that takes a DataRow and returns a City:
public IEnumerable<City> GetCities(Func<DataRow, City> selector)
{
    return ds.Tables[0].AsEnumerable().Select(selector).ToList();
}

Call it like
var cities = GetCities(c => new City
{
    CityCode = c.Field<object>("CITY_CODE"),
    CityMid = c.Field<object>("CITY_MID"),
    CityName = c.Field<object>("CITY_NAME"),
    CountryCode = c.Field<object>("COUNTRY_CODE"),
    StateCode = c.Field<object>("STATE_CODE"),
    ActiveFlag = c.Field<object>("ACTIVE_FLG"),
});

or use another variable of said type:
Func<DataRow, City> myfunc = c => new City
{
    CityCode = c.Field<object>("CITY_CODE"),
    CityMid = c.Field<object>("CITY_MID"),
    CityName = c.Field<object>("CITY_NAME"),
    CountryCode = c.Field<object>("COUNTRY_CODE"),
    StateCode = c.Field<object>("STATE_CODE"),
    ActiveFlag = c.Field<object>("ACTIVE_FLG"),
};

var cities = GetCities(myfunc);

If your class is not only City but different classes, you can use generics:
public IEnumerable<T> GetCities(Func<DataRow, T> selector)
{
    return ds.Tables[0].AsEnumerable().Select(selector).ToList();
}

A:
What I have know I have to return the Expression, but I just don't understand that how can I do that with any class?

c => new City { ... } is a delegate of type Func<DataRow, City> that is somehow equivalent to a Method that gets a DataRow and returns a City. So you can create a method for it.
City ConvertToCity(DataRow row) =>
        new City
        {
            CityCode = row.Field<object>("CITY_CODE"),
            CityMid = row.Field<object>("CITY_MID"),
            CityName = row.Field<object>("CITY_NAME"),
            CountryCode = row.Field<object>("COUNTRY_CODE"),
            StateCode = row.Field<object>("STATE_CODE"),
            ActiveFlag = row.Field<object>("ACTIVE_FLG"),
        };

and then pass the method to the Select function:
var cities = ds.Tables[0].AsEnumerable().Select(ConvertToCity).ToList();


text:
Q: How to make the JBoss 5.0 shared library available? I want to share a jar file for two war in the same instance.
For test, I make the jboss folder and war file like this.
1)JBoss Folder
server/default
-- deploy/
 -- myApp.war

-- lib/
 -- test_1.2.jar(only one method to output "1.2")

2)WAR
myApp.war
-- META-INF/
-- WEB-INF/
 -- class/

    -- myservlet(reference class test to output the version)

 -- lib/

    -- test_1.1.jar(only one method to output "1.1")

I hope the shared library could override the jar file in WAR,
but i still get the version "1.1".
it means that the jar file in WAR worked, but not the jar in the "server/default/lib".

A: Have you considered packing both WARs into an EAR and moving to JAR to the lib/ folder in the EAR? This makes it portable and will also work on JBoss AS 7 and later.


text:
Q: Best Django 'CMS' component for integration into existing site So I have a relatively large (enough code that it would be easier to write this CMS component from scratch than to rewrite the app to fit into a CMS) webapp that I want to add basic Page/Menu/Media management too, I've seen several Django pluggables addressing this issue, but many seem targeted as full CMS platforms.
Does anyone know of a plugin that can easily integrate with existing templates/views and still sports a powerful/comprehensive admin interface?

A: If you do not necessarily want a finished CMS with a fixed feature set, but rather tools on top of Django to build your own CMS I recommend looking into FeinCMS. It follows a toolkit philosophy instead of trying to solve everything and (too) often failing to do so.
http://github.com/matthiask/feincms/tree/master
Disclaimer: It is my brainchild, and the result of too many frustrating experiences trying to customize another CMS for the needs of my customers.

A: There is also this one that is quite nice as well:
Django CMS page

A: If you need some more features then the simple django-page-cms just checkout django-blocks (http://code.google.com/p/django-blocks/). Has multi-language Menu, Flatpages and even has a simple Shopping Cart!!

A: There is a very nice overview of Django CMS apps on the Django wiki!
http://code.djangoproject.com/wiki/CMSAppsComparison

A: I have worked with all three (and more) and they are all built for different use cases IMHO. I would agree that these are the top-teir choices.
The grid comparison at djangopluggables.com certainly can make evaluating each of these easier.
django-cms is the most full-featured and is something you could actually hand over to clients without being irresponsible. Even though it has features for integrating other apps, it doesn't have the extensibility/integration of FeinCMS or the simplicity of django-page-cms. That being said, I think the consensus is that this is the best Open Source CMS for Django. However, it's docs are a little lacking. update: I have been told that integrating apps into DjangoCMS 2.1 has been improved.
FeinCMS - Is a great set of tools for combining and building CMS functionality into your own apps. It's not "out of the box" at all, which means that you can integrate it however you want. It doesn't want to take over your urls.py or control how you route pages. It's probably a prototype for the next-generation of truly pluggable apps in Django. - We are moving from django-page-cms to FeinCMS because our primary models is high volume eCommerce and I have custom content-types I want to integrate that aren't blogs or flash. Good documentation and support as well.
Django-page-cms - Is great if you want to just have some "About Us" pages around your principle application. Its menu system is not truly hierarchical and building your page presentation is up to you. But it's very simple, unobtrusive, and very easy to slap into your app and get a navigation going that clients can manage, or even for yourself. It has no docs that I know of, but you won't really need any. Read the code and you will get it all in 30 minutes or less.
update
Mezzanine - Is a very well designed CMS and one that I have finally settled on for most of my client work, mostly because it has an integrated eCommerce portion. But beyond that it has very extensible page models, and a custom admin interface that a client might be willing to use. It also has the best "out of the box" experience i.e. You can have a full fledged site up with one command.

A: See django-plugables website, there are few CMS components for Django listed (and some look really good).

A: I've had success with integrating django-cms.  Just include it at the end of your urlconf and it won't interfere.  (You'll just lose the the nice 404 page when DEBUG=True)
Using various combinations of context processors and custom template tags I've been able to do everything I've needed, but if you really need to insert the content into your own view, that should be easy enough.  (Perhaps call cms.views.render_page() with a template that lacks all the wrapper html?)


text: Q: IntelliJ cannot create a new project So I have been using Eclipse for about a year and decied to try put IntelliJ instead however I am having trouble setting it up. I just want to create a simple Java application. So I start IntelliJ and press New Project. Then I choose Java on the left side and then in the Project SDK dropdown, I choose my Java JDK 1.8.0_91.  From here I do not know what to do. I can add some additional libraries; Groovy, Kotlin(Java) and Kotlin(Javascript) but it does not matter which options I use because I cannot continue.


text:
Q: cloudsim: How to compile source classes? how i should compile and build classes of the sources folder!! (example datacenter.java or cloudlet.java .... )
To test ANT, I just extracted cloudsim from .zip and try to build without making any changes in any file.
I followed the instructions of readme.txt:
Compiling CloudSim: using Ant
This release contains a simple buildfile for compiling CloudSim classes.
You need to have ant installed (http://ant.apache.org/).
Ant can be used in both Windows and Unix/Linux environment.
Usage:

*

*Being in the CloudSim root directory (cloudsim/), type 'ant' to compile all
cloudsim source files, put them into the classes/ directory and to create
a cloudsim-new.jar file in the jars/ directory

*Being in the CloudSim root directory (cloudsim/), type 'ant clean' to delete
all the compiled classes and the classes/ directory itself. The generated
cloudsim-new.jar is not deleted.
Still I ended up with 20 errors, even when trying to compile and build jar of cloudsim original classes with no modifications done.
Errors are in MathUtil class


text:
Q: How to reflect local database changes to TEST environment database in entityframework database first I have a MVC4 + EntityFramework Database First application. I have made some changes in my local database (added table and columns in couple of tables). After this I updated my .edmx file and ran the custom tool. This has updated my models of the table whose schema i have changed. Everything is working fine.
I want to know, How to reflect those local database changes on my Test database?

A: Within VS you can compare the two databases and generate a change script that will bring them on par with each other.
In your case you want to do a schema compare.
Tools -> SQL Server -> New Schema Comparison.
You select your local database and then select the test database. it will compare the schema of both and show you the differences. You can select which you want to apply and either apply it directly or generate a change script and execute when you want from SSMS.
Compare and Synchronize Database Schemas

A: In SQL Server Management Studio you can export the database script to drop and recreate the tables, indexes, relationships, etc... You can also use Visual Studio to export the SQL script to create all the tables. The other way is to manually add the updated columns. I'm unsure of any other ways to do this in a database first approach.

A: Try SQL Server Data Tools for Visual studio :
https://msdn.microsoft.com/en-us/mt186501.aspx
Very easy and intuitive to use for Schema comparison and generating delta scripts.

A: I suggest you have a look at xSQL Schema Compare. It's a great tool for comparing and synchronizing database schemas. It should do the trick in your case. Also, this comes bundled with xSQL Data Compare which you can use to compare and synchronize the data as well, should the need to do so arise.


text:
Q: Numbered paragraphs in Word 2007 I have the following styles defined in Word 2007. They all have outline levels 1-6. They also correctly show up in the Table of Contents (not all, I only set the TOC up to Level 3).

1 Heading 1
  1.1 Heading 2
  1.1.1 Heading 3
  1.1.1.1 Heading 4
  1.1.1.1.1 Heading 5
  1.1.1.1.1.1 Heading 6

This is what I want

1 Heading 1
  1.1 Body text under Heading Level 1
  1.2 Body text under Heading Level 1
2 Heading 1
2.1 Heading 2
  2.1.1 Body text under Heading Level 2
  2.1.2 Body text under Heading Level 2
  2.1.3 Body text under Heading Level 2
2.2 Heading 2
  2.2.1 Body text under Heading Level 2
  2.2.2 Body text under Heading Level 2

How do I make two list sequences link to each other? Here's a {fill in the blanks} illustration:

{section number} Heading 1
  {section number}.{clause number} Body text under Heading Level 1
  {section number}.{clause number} Body text under Heading Level 1

The example above should expand to:

1 Heading 1
  1.1 Body text under Heading Level 1
  1.2 Body text under Heading Level 1

Another example:

{section number} Heading 1
  {section number}.{subsection number} Heading 2
  {section number}.{subsection number}.{clause number} Body text under Heading Level 2
  {section number}.{subsection number}.{clause number} Body text under Heading Level 2

should expand to:

2 Heading 1
2.1 Heading 2
  2.1.1 Body text under Heading Level 2
  2.1.2 Body text under Heading Level 2
  2.1.3 Body text under Heading Level 2

The numbered body text paragraphs shouldn't show up the Table of Contents. I couldn't find the right way to do that, whether in multilevel lists, fields, styles, etc. How do I do it right?
If at all possible, I would like to define just one Body Text style linked to a numbered multi-level list. The numbers in the multi-level list should adjust according to the section (or subsection, or subsubsection number) to which it belongs.
Here's a screenshot of my problem. See the body text numbering that won't adjust accordingly:

In response to DMA57361:
Unfortunately, the problem persists:

I think it's in the way that Word 2007 organizes outline lists (now called Multilevel Lists). I have the following Multilevel Lists defined and linked to the respective Styles:

Headings Multilevel List:
  Level 1 -> Heading 1
  Level 2 -> Heading 2
  Level 3 -> Heading 3
  and so on...
Clauses Multilevel List:
  Level 1 -> (none)
  Level 2 -> Clause 1
  Level 3 -> Clause 2
  and so on...

I wonder if it is possible for a Style in one Multilevel List to "get" the outline number it belongs to? For example, Clause 1 style should detect that it belongs to section 1, or section 2, then adjust its numbering accordingly. Clause 2 style should detect that it belongs under subsection 3.2, or even subsection 4.5, then adjust its numbering accordingly.
How unfortunate this is for Word 2007. Anybody help?

A: Almost, the following will do what you want except that you'll also need one body style per level (the same as you need one heading style per level), instead of one style overall. And please note that I'm doing these in Word 2003 so they actual motions may be slightly different.
Build Styles
Get up the styles pane, IIRC in Word 2007 you hit the small down arrow on the bottom-right of the styles selector on the ribbon. Click on the New Style button, on Word 2007 I think this is a pictoral button of a letter A with a gleam/star on it.
Each new style should be Based On a corresponding Heading entry, this ensures they will stay within the correct numbering pattern, because they're using exactly the same pattern. Obviously, you'll need to remove bold, adjust the font size, adjust the paragraph spacing, and whatever else you need to ensure the body text appears how you want it to.
You probably will want to create BodyText1 based on Heading2, BodyText2 based on Heading3, and so on for however many levels you will need.
Instead, you might be able to base BodyText2 (etc) on BodyText1, and just adjust the numbering level, but for some reason this caused me a problem. Not sure why, but you may wish to try so you don't have to redefine the font size/etc for each BodyText style.
Adjust Table of Contents
Because the new styles are based on the Heading ones they will appear in the table of contents. Obviously, this is not desirable.
This is where my memory of Word 2007 memory becomes hazy, the following is purely Word 2003 - if it doesn't match, let me know and I'll update for Word 2007 once I'm home and can check directly.
Right click on your current Table of Contents and select Edit field..., then click the Table of Contents button to get to the TOC window. (You can probably get here when creating a brand new TOC as well)
Click the Options button (bottom-right) and then find each BodyText style in the list; clear the TOC Level field from each of these. This ensures the BodyText items will not appear in the TOC at all. Close each window until you get back to your document, you might be asked if you want to replace the current table, if so click Yes.
Use the styles
Now just ensure you set the relevant style on each paragraph as you write.

A: This is how it worked for me. I included the numbered body text paragraphs in the multilevel list system. The downside is that I can only use up to 4 outline levels.
"Restart list after" must be set in the following manner:
Level          Restart after
1 (Heading 1)
2 (Clause 1)   1
3 (Heading 2)  1
4 (Clause 2)   3
5 (Heading 3)  3
6 (Clause 3)   5
7 (Heading 4)  5
8 (Clause 4)   7

I customized the font properties (Bold) for the numbering of the Clauses.
"Include level number from" must be set accordingly. For example, for Level 5 (Heading 3), only level numbers from 1 and 3 must be included. Similarly, for Level 6 (Clause 3), only level numbers from 1, 3 and 5 must be included.


text:
Q: Why when using lockbits it's not changing the pixels colors? LockBitmap class :
using System.Drawing.Imaging;
using System.Drawing;
using System.Runtime.InteropServices;
using System;

public class LockBitmap
{
    Bitmap source = null;
    IntPtr Iptr = IntPtr.Zero;
    BitmapData bitmapData = null;

    public byte[] Pixels { get; set; }
    public int Depth { get; private set; }
    public int Width { get; private set; }
    public int Height { get; private set; }

    public LockBitmap(Bitmap source)
    {
        this.source = source;
    }

    /// <summary>
    /// Lock bitmap data
    /// </summary>
    public void LockBits()
    {
        try
        {
            // Get width and height of bitmap
            Width = source.Width;
            Height = source.Height;

            // get total locked pixels count
            int PixelCount = Width * Height;

            // Create rectangle to lock
            Rectangle rect = new Rectangle(0, 0, Width, Height);

            // get source bitmap pixel format size
            Depth = System.Drawing.Bitmap.GetPixelFormatSize(source.PixelFormat);

            // Check if bpp (Bits Per Pixel) is 8, 24, or 32
            if (Depth != 8 && Depth != 24 && Depth != 32)
            {
                throw new ArgumentException("Only 8, 24 and 32 bpp images are supported.");
            }

            // Lock bitmap and return bitmap data
            bitmapData = source.LockBits(rect, ImageLockMode.ReadWrite,
                                         source.PixelFormat);

            // create byte array to copy pixel values
            int step = Depth / 8;
            Pixels = new byte[PixelCount * step];
            Iptr = bitmapData.Scan0;

            // Copy data from pointer to array
            Marshal.Copy(Iptr, Pixels, 0, Pixels.Length);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    /// <summary>
    /// Unlock bitmap data
    /// </summary>
    public void UnlockBits()
    {
        try
        {
            // Copy data from byte array to pointer
            Marshal.Copy(Pixels, 0, Iptr, Pixels.Length);

            // Unlock bitmap data
            source.UnlockBits(bitmapData);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    /// <summary>
    /// Get the color of the specified pixel
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <returns></returns>
    public Color GetPixel(int x, int y)
    {
        Color clr = Color.Empty;

        // Get color components count
        int cCount = Depth / 8;

        // Get start index of the specified pixel
        int i = ((y * Width) + x) * cCount;

        if (i > Pixels.Length - cCount)
            throw new IndexOutOfRangeException();

        if (Depth == 32) // For 32 bpp get Red, Green, Blue and Alpha
        {
            byte b = Pixels[i];
            byte g = Pixels[i + 1];
            byte r = Pixels[i + 2];
            byte a = Pixels[i + 3]; // a
            clr = Color.FromArgb(a, r, g, b);
        }
        if (Depth == 24) // For 24 bpp get Red, Green and Blue
        {
            byte b = Pixels[i];
            byte g = Pixels[i + 1];
            byte r = Pixels[i + 2];
            clr = Color.FromArgb(r, g, b);
        }
        if (Depth == 8)
        // For 8 bpp get color value (Red, Green and Blue values are the same)
        {
            byte c = Pixels[i];
            clr = Color.FromArgb(c, c, c);
        }
        return clr;
    }

    /// <summary>
    /// Set the color of the specified pixel
    /// </summary>
    /// <param name="x"></param>
    /// <param name="y"></param>
    /// <param name="color"></param>
    public void SetPixel(int x, int y, Color color)
    {
        // Get color components count
        int cCount = Depth / 8;

        // Get start index of the specified pixel
        int i = ((y * Width) + x) * cCount;

        if (Depth == 32) // For 32 bpp set Red, Green, Blue and Alpha
        {
            Pixels[i] = color.B;
            Pixels[i + 1] = color.G;
            Pixels[i + 2] = color.R;
            Pixels[i + 3] = color.A;
        }
        if (Depth == 24) // For 24 bpp set Red, Green and Blue
        {
            Pixels[i] = color.B;
            Pixels[i + 1] = color.G;
            Pixels[i + 2] = color.R;
        }
        if (Depth == 8)
        // For 8 bpp set color value (Red, Green and Blue values are the same)
        {
            Pixels[i] = color.B;
        }
    }
}

using it in form1 :
public void ChangeColor()
        {
            Bitmap bmp = (Bitmap)Image.FromFile("d:\\Screenshots\\testpng.png");
            LockBitmap lockBitmap = new LockBitmap(bmp);
            lockBitmap.LockBits();

            Color compareClr = Color.FromArgb(255, 0, 255, 255);
            for (int y = 0; y < lockBitmap.Height; y++)
            {
                for (int x = 0; x < lockBitmap.Width; x++)
                {
                    if (lockBitmap.GetPixel(x, y) == compareClr)
                    {
                        lockBitmap.SetPixel(x, y, Color.Red);
                    }
                }
            }
            lockBitmap.UnlockBits();
            bmp.Save("d:\\result.png");
        }

and button click event
private void button1_Click(object sender, EventArgs e)
        {
            ChangeColor();
        }

i want to change pixels that are in color blue to red so i added the condition :
if (lockBitmap.GetPixel(x, y) == compareClr)

then set this pixels to red and for sure i have a lot of blue color in the image.
i tried gif then bmp then png but the color never changed.
the saved file result.gif is the same as the source nothing colored in red.
I checked with a breakpoint and its never getting to the SetPixel line :
lockBitmap.SetPixel(x, y, Color.Red);

example if image(gif) Bit depth 8


text:
Q: Limit total number of jobs within nested or concurrent GNU Parallel invocations This is a continuation of this question and this question on nested GNU Parallel. Utlimately what I want to achieve is to leave my Makefile untouched except by changing the SHELL= variable and distribute jobs using parallel across all my machines.
Is there a way to ensure that concurrent executions of GNU Parallel respect the --jobs clause specified in the outer invocation? Or some other way to get a limit on the total number of jobs across parallel invocations? For example: I'd like the inner slot in the output below to always be 1, i.e., the slot 1-2 on line three of the output violates the condition.
~• inner_par="parallel -I // --slotreplace '/%/' --seqreplace '/#/'"
~• cmd='echo id {#}-/#/, slot {%}-/%/, arg {}-//'
~• seq 2 | parallel -j 1 "seq {} | $inner_par $cmd"
id 1-1, slot 1-1, arg 1-1
id 2-1, slot 1-1, arg 2-1
id 2-2, slot 1-2, arg 2-2
~•

A: Are you looking for sem?
parallel -j 10 parallel -j 20 sem -j 30 --id myid mycmd

This will start 200 sems, but only run 30 mycmds in parallel.


text:
Q: How can I set the path for IOFactory.php of PHPExcel Below is the my localhost directory sturcture-
htdocs\software\office_admin\exam_excel\Classes\PHPExcel.php
htdocs\software\office_admin\exam_excel\Classes\PHPExcel\IOFactory.php
htdocs\software\office_admin\includes\classes\myownclassfiles.php
htdocs\software\office_admin\includes\example.inc.php
When I use IOFactory.php in example.inc.php using
require_once 'Classes/PHPExcel.php';<br>
require_once 'Classes/PHPExcel/IOFactory.php';

I am getting list of warnings here are 2-3 samples-

Warning:
  include_once(includes/classes/class.PHPExcel_Shared_String.php):
  failed to open stream: No such file or directory in
  C:\xampp\htdocs\manazeschool\software\office_admin\index.php on line
  26
Warning: include_once(): Failed opening
  'includes/classes/class.PHPExcel_Shared_String.php' for inclusion
  (include_path='.;C:\xampp\php\PEAR') in
  C:\xampp\htdocs\manazeschool\software\office_admin\index.php on line
  26
Warning:
  include_once(includes/classes/class.PHPExcel_Reader_Excel2007.php):
  failed to open stream: No such file or directory in
  C:\xampp\htdocs\manazeschool\software\office_admin\index.php on line
  26
Warning: include_once(): Failed opening
  'includes/classes/class.PHPExcel_Reader_Excel2007.php' for inclusion
  (include_path='.;C:\xampp\php\PEAR') in
  C:\xampp\htdocs\manazeschool\software\office_admin\index.php on line
  26

My own customized class path settings-
if (!defined("INCLUDES_CLASS_PATH")) {
    define("INCLUDES_CLASS_PATH", "includes/classes");
}

$path_arr = explode('/', $_SERVER['PHP_SELF']);
$cur_foldpath =  count($path_arr)-3;
//This variable is for avoiding the unautherized page access

if (!defined('FROMINDEX')) {
   define('FROMINDEX', true);
}
if (!defined('DS')) {
   define('DS', '/');
}
include_once('includes/config.inc.php');
   //class
   function __autoload($class_name) {
    include_once INCLUDES_CLASS_PATH . DS . "class." . $class_name . '.php';
   }
   include (INCLUDES_CLASS_PATH . DS .'developer.mysql.class.php');
   include (INCLUDES_CLASS_PATH . DS . 'validation.class.php');
   include (INCLUDES_CLASS_PATH . DS . 'html_form.class.php');
   //files
   include (INCLUDES_PATH . DS .'messages.inc.php');
   include (INCLUDES_PATH . DS . 'functions.inc.php');
.....
}

How can I overcome from these warning

A: PHPExcel provides its own SPL-compliant autoloader; register your own autoloader with spl_autoload_register(), and the two should work together - see section 3.2, entitled "Lazy Loader", in the developer documentation for details
EDIT
If you modify your own autoloader to test for the existence of the classfile before including it (using file_exists()) and return false if it doesn't exist (only including it if it does exist), then that should work
function myAutoload($class_name) {
    if (!file_exists(INCLUDES_CLASS_PATH . DS . "class." . $class_name . '.php')) {
        return false;
    }
    include_once INCLUDES_CLASS_PATH . DS . "class." . $class_name . '.php';
}

 spl_autoload_register('myAutoload');

Then make sure that your include for Classes/PHPExcel/IOFactory.php is looking in the right directory to actually find the file. The PHPExcel IOFactory will register the PHPExcel autoloader with SPL.
When a class is requested for autoload, SPL should handle checking using your autoloader first, which will return a false for PHPExcel classes (and any other classes that can't be found); then SPL should call the PHPExcel autoloader, which will load any PHPExcel classes.


text:
Q: Parse downloading PDF when button is clicked. Ok so I have a Parse database holding an array of PDF files that are shown in my table view. When a user selects a file he is taken to a detail view of the chosen PDF and they are given a "Download" option button. I carry the information over a segue from my table view using the same array. Here is how the code looks like.
This is the file i want to be carried over in my segue:
detailVC.PDFfile=[[PDFArray objectAtIndex:indexPath.row]objectForKey:@"PDFFile"];

these are my declarations in for the file in detail h.
@property (retain,nonatomic) PFFile * PDFfile;
- (IBAction)Download:(id)sender;

I want to program this button to initiate download onto persons device, if anyone can help me.

A: It's just an ordinary download.
You can use NSURLConnection with a NSURLRequest. It's all very simple and the info you need is in the docs.


text:
Q: Mac stuck in partial Grayscale mode I was bored one day an thought it would be cool to follow this tutorial to make my Finder windows look like Retro Mac OS Finder http://osxdaily.com/2012/03/20/simplify-os-x-finder-retro-mac-os-classic-style/.
I thought it would add to the effect if I made my Mac Grayscale by going into System Preferences > Accessibility > Display > Use Grayscale.
And then, as usual, I got annoyed by the theme and changed everything back.
Everything switched back nicely including grayscale. But then I noticed that on login, the color of files in Finder Windows and on the Desktop, when selected, was gray, the same color when in Grayscale.  See pictures.
Grayscale Unchecked:

Grayscale Checked:

What it should be

What I've tried so far:
- Restart

*

*Reset SMC

*Reset NVRAM

*Disk Utility First Aid (Permission Errors in Plists)

*Safe Mode

*Deleted Bunch of Plists in ~/Library/Preferences
Other Info
I'm running macOS Sierra 10.12.6.
Also, when I change any of the following options it fixes the problem until next login:

*

*Accessibility > Display > Use grayscale

*Accessibility > Display > Increase contrast

*Accessibility > Display > Invert Colors

*General > Appearance
My Question: How do I completely stop grayscale so that it remains fixed even after a restart?


text:
Q: cant send params via navigation navigate i want to send parameter name from login screen to home screen via router but data object not defined

TypeError: undefined is not object (evaluating
  'navigation.state.params.name'

login screen
<TouchableOpacity
  style={styles.buttonContainer}
  onPress={() => this.props.navigation.navigate('Home', { name: 'Erry' })}>
  <Text style={styles.buttonText}>MASUK</Text>
</TouchableOpacity>

my router
export const LoginStack = SwitchNavigator({
  Login: {
    screen: Login,
  },
  Home: {
    screen: HomeStack
  }
}, {
    headerMode: 'none',
    navigationOptions: {
      headerVisible: false,
    }
  });

export const HomeStack = StackNavigator({
  Home: {
    screen: Home
  }
});

Home Screen
static navigationOptions = ({navigation}) => ({
      title: `${navigation.state.params.name}`,
      headerStyle : {
          backgroundColor: '#f39c12',
      },
      headerTitleStyle :{
          color: '#353b48',
      },
  });

any idea ?

A:
The purpose of SwitchNavigator is to only ever show one screen at a time. By default, it does not handle back actions and it resets routes to their default state when you switch away.

You'd better not use SwitchNavigator, you can see the correct example.
And you'd better judge the params is empty or not:
const params = navigation.state.params || {};
const title = params.name || 'default title';


text:
Q: What is heap table (as DB storage format)? What is heap table (as DB storage format)?
According to http://en.wikipedia.org/wiki/Heap_%28data_structure%29 heap is special data structure with properties that I can't directly map to DB performance benefits...
I found a lot of heap vs clustered discussions and understand that is clustered (there are a lot of images and definitions) but heap tables are not defined at all...

A: Quoting from this MSDN link:

A heap is a table without a clustered index.

One or more nonclustered indexes can be created on tables stored as a heap. Data is stored in the heap without specifying an order. Usually data is initially stored in the order in which is the rows are inserted into the table, but the Database Engine can move data around in the heap to store the rows efficiently; so the data order cannot be predicted

The most crucial part is that the data storage order on disk becomes non
  deterministic in heap tables as you have NOT defined any clustered
  index on it.

Once you define a clustered index on a table having a column let's say Id (of type int) you can say with guarantee that a row with id 1 will come before the row with id 2 in database page files. More useful information related to heap tables in SQL Server can be found here and here.

A: In short, a heap is a table in SQL Server without a clustered index. But..
Table scans on heaps follow the allocation order, as written in IAM pages; clustered tables follow the doubly-linked ordered list of pages (mostly to avoid some consistency problems, so if an X lock on the table or the READ UNCOMMITTED is in effect you can get the allocation order scan with clusters as well).
Heaps can be faster in an NCI seek + lookup scenario than clustered tables. The leaf level of NCIs on heaps contains the physical pointer to data, as opposed to clusters where there is a value of clustered index instead, which in most cases requires several more reads from non-leaf levels on CI to navigate the b-tree structure and find the data.
If there are variable-length columns in a heap, an update increasing the length of the columns could cause the whole row to move to some other page, leaving a forwarding pointer in place (that's to avoid updating all the NCIs with new pointers to the data). This could be very bad for the performance and the only cure is to rebuild the table.
As a rule of thumb, in SQL Server use clustered tables, unless you have a very good reason not to.


text:
Q: Is it possible to capture/redirect the standard output of a process that I did not launch, in .net? If I know the process identifier, is there some mechanism in .net (or pinvoke as last resort) to capture/redirect the standard output of a process that I did not launch?

A: You could AttachConsole your process to the console of the other process, and then use the usual console I/O functions to read and write from it.
Remember to use FreeConsole to detach from the process' current console first.

A: As far as I know you can't do this in .NET, you can redirect outputs for processes you start only via ProcessStartInfo Class.
Also as far as I know you cannot redirect I/O externally at all after a process has started, only the process itself can do it.
You can attach the calling process to the console of the specified process via AttachConsole Function.

A: EDIT: Looks like it indeed does not work, as is being pointed out by another answer in this thread.
I have not personally tried it, but it seems, since the answer was accepted, that this works.


text:
Q: SQL query to find new column I need your help. I have a table named Test_Result with 2 columns as shown below.
ID  Source_ID
10  1
20  2
30  2
40  3
50  3
60  3
70  4

I am trying to get output as below,but unable to get logic.
ID  Parent_ID   Source_ID
10   Null         1
20   Null         2
30   20           2
40   Null         3
50   40           3
60   50           3
70   Null         4

Kindly help me with this scenario. I attached question in picture for as well.
Regards,
Abhi

A: These solutions (ROW_NUMBER/LAG) will work for MySQL 8.0+ or MariaDB 10.2
You could use ROW_NUMBER() and join to previous row:
CREATE TABLE tab(ID INT  ,Source_ID INT);

INSERT INTO tab(id, Source_id)
SELECT 10,  1
UNION ALL SELECT 20 , 2
UNION ALL SELECT 30,  2
UNION ALL SELECT 40 , 3
UNION ALL SELECT 50 , 3
UNION ALL SELECT 60 , 3
UNION ALL SELECT 70 , 4;

WITH cte AS (
    SELECT *, ROW_NUMBER() OVER(ORDER BY id) AS rn
    FROM tab
)
SELECT c1.ID,
       CASE WHEN c1.Source_ID = c2.Source_ID  THEN c2.Id END AS Parent_Id,
       c1.Source_ID
FROM cte c1
LEFT JOIN cte c2
  ON c1.rn = c2.rn+1;

Rextester Demo
EDIT:
Using LAG() windowed function:
SELECT c1.ID,
  CASE
    WHEN c1.Source_ID = LAG(Source_ID) OVER w THEN LAG(ID) OVER w
  END AS Parent_Id,
  c1.Source_ID
FROM tab c1
WINDOW w AS (ORDER BY ID)
ORDER BY id;

DBFiddle

EDIT2:
Simulating LAG using variables:
SET @lag_Source_id='';
SET @lag_Id = '';

SELECT ID,
       CASE WHEN Source_Id = lag_Source_ID THEN lag_ID END AS Parent_ID
       ,Source_ID
FROM (
    SELECT ID
    , Source_ID
    , @lag_Source_id AS lag_Source_id
    , @lag_Source_id:= Source_ID AS curr_Source_ID
    , @lag_Id AS lag_ID
    , @lag_Id := ID AS curr_ID
    FROM tab
    ORDER BY id
) AS sub

RextesterDemo2

A: if you are using mysql database simply do this,
SELECT ID, (ID + Source_ID) AS Parent_ID,   Source_ID FROM tableName LIMIT 10;


text:
Q: TimeZone.getTimeZone("CST") returns GMT I'm converting time from CST to local time but getTimeZone doesn't seem to work properly.
    String cstTime = "2013-06-21 14:00:00";

    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
            "yyyy-MM-dd HH:mm:ss");
    simpleDateFormat.setTimeZone(TimeZone.getTimeZone("CST"));

    Date date = null;
    try {
        date = simpleDateFormat.parse(cstTime);
    } catch (ParseException e) {
        System.out.println("Parse time error");
        e.printStackTrace();
    }

    TimeZone destTz = TimeZone.getDefault();//here I should get EDT on my phone
    simpleDateFormat.setTimeZone(destTz);
    String convertedLocalTime = simpleDateFormat.format(date);

    //the converted time I get is  "2013-06-21 10:00:00"
    //but it should be             "2013-06-21 15:00:00"

It seems to be using GMT instead of CST and below is what I got when debugging:
String abc = TimeZone.getTimeZone("CST").toString();
System.out.println("CST:"+abc);
Output:
I/System.out(19404): CST:java.util.SimpleTimeZone[id=GMT,offset=0,dstSavings=3600000,
useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,
startTime=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0]

Is it using GMT? why..
Thanks in advance!
Edit:
Finally got it work by using
simpleDateFormat.setTimeZone(TimeZone.getTimeZone( "GMT-5")); //GMT-5 is for CDT, I found my server is actually using CDT not CST

Still don't know why using the string "CST" can't work...

A: You can use "CST6CDT" Timezone it will automatically provide you the correct time when the Central Daylight Time (CDT) switched back to CST or vice versa.

A: The following seems to have worked for me as  was facing similar issues:
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("America/Chicago"));

A: The following code helped me.
TimeZone tzone = TimeZone.getTimeZone("Singapore");
// set time zone to default
tzone.setDefault(tzone);

A: From the javadoc for getTimeZone:
Returns a TimeZone corresponding to the given id, or GMT for unknown ids.

An ID can be an Olson name of the form Area/Location, such as America/Los_Angeles.
The getAvailableIDs() method returns the supported names.

Try using getAvailableIDs?

A: for any date time conversion i would suggest using JODA date time, its help me solve a bunch of date time issues.
you can initialize a date with a time zone, and convert between them very easily
DateTimeZone zone = DateTimeZone.forID("Europe/London");

or
DateTimeZone zoneUTC = DateTimeZone.UTC;

from JODA DATE TIME API
DateTime(DateTimeZone zone)
Constructs an instance set to the current system millisecond time using ISOChronology in the specified time zone.

A: One thing I found is that Java's TimeZone doesn't recognize "+09:00", but it does recognize "GMT+09:00" and "GMT+0900".