text:
Q: Get Correct Audit Detail for a particular date ok this seems like a long question but I have just put some sample SQL so that you can get a good idea of what I am looking to do.
Basically I have a Stock table with the current price. When the price changes a trigger creates a record in the audit table with the old price and sets the validTo field to the day before. So if I change the price of Apples today from 1:10 to 1:20.. I assume that price 1:10 is for the entire day forward and that the old price of 1:20 was up until midnight yesterday.
Ok all cool... so I thought.  My problem is now that I want to take all my sales and pull out what the price was for that stock item on the sale Date. Note that some prices have not changed like Mango in my example so there is no Audit record to add as the current price is the only price.
I thought I would use a Cross apply on the sales table but having problems.
Here is the sample code... so far..
    drop table #CurrentStock
    drop table #AuditTable
    drop table #Sales

    create table #CurrentStock
    (
        StockID     int identity ,
        Stock       varchar(50),
        Quantity    int,
        Price       decimal(5,2),
        Supplier    varchar(50)
    )

    go

    create table #AuditTable
    (
        AuditID int identity,
        StockID int,
        Price   decimal(5,2),
        ValidTo date
    )

    go

    create table #sales
    (
        SaleID  int identity,
        StockID int,
        AmountSold  int,
        DateSold    date
    )

    --Insert 4 stock items and the current price
    insert into #CurrentStock values ('Apple', 200, 1.50, 'Jones');
    insert into #CurrentStock values ('Banana', 300, 1.10, 'Smiths');
    insert into #CurrentStock values ('Oranges', 100, 1.75, 'Ables');
    insert into #CurrentStock values ('Pears', 400, 2.50, 'Jones');
    insert into #CurrentStock values ('Mango', 350, 3.50, 'Jacks'); -- Note this has no audit as the price hasnt changed

    --Insert the Price Changes for the stock
    -- Note the ValidTo field... is up to and including that date so for the first item for apple
    -- the price of 1:10 was valid up to and including 2014-05-01. The next price change of 1.18
    -- would then be valid from 2014-05-02 up to and including 2014-05-07

    insert into #auditTable values (1, 1.10, '2014-05-01');
    insert into #auditTable values (1, 1.18, '2014-05-07');
    insert into #auditTable values (1, 1.22, '2014-05-18');
    insert into #auditTable values (2, 1.11, '2014-05-11');
    insert into #auditTable values (2, 1.14, '2014-05-17');
    insert into #auditTable values (2, 1.16, '2014-05-23');
    insert into #auditTable values (2, 1.12, '2014-05-28');
    insert into #auditTable values (3, 1.86, '2014-05-17');
    insert into #auditTable values (3, 1.92, '2014-05-20');
    insert into #auditTable values (4, 2.62, '2014-05-11');
    insert into #auditTable values (4, 2.67, '2014-05-12');
    insert into #auditTable values (4, 2.92, '2014-05-20');

    -- Create Some Sales

    -- Apples
    insert #sales values ( 1,2,'2014-05-01');   -- price should be 1.10
    insert #sales values ( 1,3,'2014-05-03');   -- price should be 1.18
    insert #sales values ( 1,1,'2014-05-08');   -- price should be 1.22
    insert #sales values ( 1,4,'2014-05-11');   -- price should be 1.22
    insert #sales values ( 1,3,'2014-05-14');   -- price should be 1.22
    insert #sales values ( 1,4,'2014-05-20');   -- price should be current price in stock table

    -- Bananna
    insert #sales values ( 2,2,'2014-05-01');   -- price should be 1.11
    insert #sales values ( 2,5,'2014-05-10');   -- price should be 1.11
    insert #sales values ( 2,2,'2014-05-12');   -- price should be 1.14
    insert #sales values ( 2,4,'2014-05-17');   -- price should be 1.14
    insert #sales values ( 2,2,'2014-05-25');   -- price should be 1.12

    -- Now I want to get the stock that has a price change after the 2014-05-15
    -- If there is no price change like in the case of Mango then we want the current Price
    select * from
    (
        SELECT
            StockId,
            Rank() OVER (Partition By StockId Order By ValidTo Desc) as RowNum,
            Price,
            ValidTo
        FROM
            #auditTable aud
        WHERE
                ValidTo > '2014-05-15'  -- filter out the records that we dont need

        UNION

        SELECT
            StockId,
            0 as RowNum,  -- make this Row num 0 so we can group on them
            Price,
            cast(GETDATE() as DATE)
        FROM
            #CurrentStock cs
    ) stockList order by StockID,RowNum

So all good up to here pulling the prices that have changed. So now the problem is that I want to get all the sales and join to the stock and get the price that the stock was at during the time of the sale... so I need to wrap the above query in a CTE or something that I can do a cross apply on.
I reckoned maybe creating a function that took in a date and stock id and returned the price might be best and use the cross apply on that.. but I don't have the rights to create a function at the moment and need to do it the long way.
Any help greatly appreciated... regards M

A: I think this is what you are looking for. It's one option anyway ..
Used your select to get audit filter and saved into a temp table (#TempAudit) ..
            select *
        into #TempAudit    -- saved into temp table called #TempAudit
        from
        (
            SELECT
                StockId,
                Rank() OVER (Partition By StockId Order By ValidTo Desc) as RowNum,
                Price,
                ValidTo
            FROM
                #auditTable aud
            WHERE
                    ValidTo > '2014-05-15'  -- filter out the records that we dont need

            UNION

            SELECT
                StockId,
                0 as RowNum,  -- make this Row num 0 so we can group on them
                Price,
                cast(GETDATE() as DATE)
            FROM
                #CurrentStock cs
        ) stockList
         order by StockID,RowNum

Using the #TempAudit table ..
Modified:
        select *
from #Sales sales
    inner join
    (
        select  ta1.StockId, ta1.RowNum, ta1.Price
        , ta1.ValidTo as ValidDateFromInclusive
        , ISNULL(ta2.ValidTo, '9999-12-31') as ValidDateToExclusive
        from #TempAudit ta1
    left outer join
        #TempAudit ta2
    on ta1.stockId = ta2.stockid and ta1.RowNum - 1 = ta2.rownum
    union all
    select StockId, RowNum+1, Price, '1900-01-01' as ValidDateFromInclusive, ValidTo as ValidDateToExclusive
        from #tempAudit ta
        where rownum = (select max(rownum) from #tempAudit where StockId = ta.StockId)
    ) AuditWithDates
    on sales.StockId = AuditWithDates.StockId
        and (sales.DateSold >= AuditWithDates.ValidDateFromInclusive and sales.DateSold < AuditWithDates.ValidDateToExclusive)
order by sales.SaleID

A: How about something like this?
select *
from #sales s
cross apply
(
    select top 1 cs.StockID
        , cs.Stock
        , ISNULL(a.ValidTo, getdate()) as ValidTo
        , ISNULL(a.Price, cs.Price) as Price
    from #CurrentStock cs
    left join #AuditTable a on a.StockID = cs.StockID
    where s.DateSold <= ISNULL(a.ValidTo, getdate())
        and s.StockID = cs.StockID
    order by ISNULL(a.ValidTo, getdate())
) x


text:
Q: load data into table got following exception when type "load data inpath '/group/public/aa.txt' into table managed_table;"
i got the following exception,why and how to resolve it?
FAILED: Hive Internal Error: java.lang.RuntimeException(java.io.FileNotFoundException: File
does not exist: /tmp) java.lang.RuntimeException: java.io.FileNotFoundException: File does
not exist: /tmp at org.apache.hadoop.hive.ql.Context.getScratchDir(Context.java:148)

A: hive uses a temporary directory defined in hive.exec.scratchdir in hive-site.xml by default its /tmp/hive-${user.name }. I guess for some reason you don't have /tmp or don't have permissions to it.
Change the scratch dir or make it available to hive.

redpajama_set_name: RedPajamaStackExchange


text:
Q: WP - Echo img if category is ... on the homepage Im trying to echo some specific images in the homepage WordPress loop. But I got some issues and it seems that WP is not recognizing the cat of my posts on the custom front page. I just want to build a if loop, and then if the category is ('videos'), I should display a specific image, etc.
Here is my loop :

        <?php
        $the_query = new WP_Query('showposts=3');

        while ($the_query->have_posts()) :
        $the_query->the_post();

            ?>

            <article class="home-actu-article one-half column" style="background:url('<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' ); ?> <?php echo $url ?>');">

<a href="<?php the_permalink() ?>"><?php the_title();?>

                        THE IMAGE SHOULD BE HERE
                        stuff here

                    <?php the_excerpt();?>
                    <a href="<?php the_permalink() ?>">En savoir +

                        <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>&t=<?php the_title(); ?>">

        <?php  // End of the loop.
        endwhile;
        ?>

I tried many things, but none of theme worked, and Im not familiar with the WordPress syntax / functions ...
Thanks everyone !

A: You can write something like this using the slug of the category and then a switch to change image for each post category:

        <?php
        $the_query = new WP_Query('showposts=3');

        while ($the_query->have_posts()) :
        $the_query->the_post();

            ?>

            <article class="home-actu-article one-half column" style="background:url('<?php $url = wp_get_attachment_url( get_post_thumbnail_id($post->ID), 'thumbnail' ); ?> <?php echo $url ?>');">

<a href="<?php the_permalink() ?>"><?php the_title();?>

                        <?php

$categories = get_the_category();
if ( ! empty( $categories ) ) {
$slug = $categories[0]->slug;
 switch($slug)
 {
  case "slugcat":
    echo "";
  break;
  default:
  break;
 }
}

?>
                        stuff here

                    <?php the_excerpt();?>
                    <a href="<?php the_permalink() ?>">En savoir +

                        <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>&t=<?php the_title(); ?>">

        <?php  // End of the loop.
        endwhile;
        ?>

A: Thx everyone, it work if you do :
<?php
   if ($catObj[0]->name == 'Actualités et évènements') {
       echo "";
      } elseif ($catObj[0]->name == 'Témoignages') {
       echo "";
      } elseif ($catObj[0]->name == 'Vidéos'){
        echo "";
      } else {
        echo "";
      }
 ?>

Thx Kaddath for the var_dump and the get_category function, thx Ciccio for answering ;)

A: if(in_category('videos',$post->ID)){
//show image
}

https://developer.wordpress.org/reference/functions/in_category/#parameters


text:
Q: Where is ant-contrib.jar? The ant-contrib project on sourceforge seems to be in disarray.
The downloads page says the latest version is cpptasks-1.0b5.zip but that file does not contain ant-contrib-*.jar, or for that matter any other jar. Are binaries no longer available?
This cpptasks is from 2008, the latest available ant-contrib is 1.0b3, from 2006.
Is this project no longer actively developed? I guess I can work with the 2006 version, but just wondering.

A: You can download the ant-contrib binaries from Maven Central:

*

*ant-contrib
I don't know anything about the project's health, but I would recommend using an embedded script for complex logic outside of normal ANT. For example groovy.


text:
Q: ${\frak b}$ and ${\frak d}$ defined with $\leq$ instead of $\leq^*$ Let $\omega^\omega$ denote the collection of all functions $f:\omega\to\omega$. For $f,g\in\omega$ we define

*

*$f\leq g$ if $f(n)\leq g(n)$ for all $n\in\omega$;

*$f\leq^* g$ if there is $N\in\omega$ such that $f(n)\leq g(n)$ for all $n\in \omega$ with $n\geq N$.

The cardinals ${\frak b}, {\frak d}$ are defined as follows:

*

*${\frak b} = \min\{|S|: S \subseteq \omega^\omega \text{ and } \forall f\in\omega^\omega \exists s\in S(s \not \leq^* f)\}$,

*${\frak d} = \min\{|S|: S \subseteq \omega^\omega \text{ and } \forall f\in\omega^\omega \exists s\in S(f \leq^* s)\}$.

Let us define ${\frak b}', {\frak d}'$ using $\leq$ instead of $\leq^*$.
Can it be proved that ${\frak b}' = {\frak c}$ (which would imply ${\frak d}' = {\frak c}$)? If not: which of ${\frak b}' < {\frak b},  {\frak b}' > {\frak b}, {\frak d}' < {\frak d},  {\frak d}' > {\frak d}$ is consistent?

A: Using "$\le$" instead of "$\le^*$," I claim $\mathfrak{b}'=\omega$ and $\mathfrak{d}'=\mathfrak{d}$.
To see $\mathfrak{b}'=\omega$, let $f_n$ be the constant function $x\mapsto n$; then setting $S=\{f_n: n\in\omega\}$, there is clearly no function which is $\ge$ every element of $S$.
To see $\mathfrak{d}'=\mathfrak{d}$, suppose $S$ is a set of functions with $$(*)\quad\forall f\in\omega^\omega\exists s\in S(f\le^*s);$$ I'll build an $S'$, with $\vert S'\vert=\vert S\vert$, such that $$(**)\quad\forall f\in\omega^\omega\exists s\in S'(f\le s).$$
To do this we proceed as follows. For $\sigma\in\omega^{<\omega}$ and $f\in\omega^\omega$, let $f^\sigma$ be the function gotten by replacing the length-$\vert\sigma\vert$ initial segment of $f$ by $\sigma$; that is, $f^\sigma(n)=\sigma(n)$ for $n<\vert\sigma\vert$, and $f^\sigma(n)=f(n)$ otherwise.
Now, given an $S$ with the property $(*)$, let $$S'=\{f^\sigma: f\in S, \sigma\in\omega^{<\omega}\}.$$ Clearly $\vert S'\vert=\omega\times\vert S\vert=\vert S\vert$; I claim $S'$ has property $(**)$.
To see this, fix $g\in \omega^\omega$. Since $S$ has property $(*)$, we may find an $f\in S$ with $g\le^*f$. Then by definition of $\le^*$ there is a $\sigma\in\omega^\omega$ such that $g\le f^\sigma$. But this $f^\sigma$ is in $S'$.

A: ${\frak b}'=\aleph_0$ since you can take $S$ to be the collection of constant functions.
${\frak d}' = {\frak d} + \aleph_0$ since you can take any family $S$ realizing $\frak d$ and close it under finite differences, i.e., let $S'$ consist of all functions that are eventually equal to some function in $S$.


text:
Q: Firebase currentuser authentication return null value after signed in I am using Firebase authentication method to get detail info of the signed in user (i.e. displayname and photourl).
My code is as follow:
final user = FirebaseAuth.instance.currentUser!;

After succesfully signed in, I signed out to return to the login screen. However, when I tried to sign in again, I got an error referring to the code above:
"Null operator used on null value."
Any sugestion on the problem?

A: You have to listen to the auth state changes. Add this method to your Authentication class.
Future<void> initializeUser(BuildContext context) async {
    FirebaseAuth.instance.authStateChanges().listen(
      (User? user) async {
        if (user == null) {
          print('user is signed out');

          Navigator.push(
            context,
            MaterialPageRoute(
              builder: (context) => const LoginScreen(),
            ),
          );
        } else {

          await fetchUserData(); // handle fetching user data

          Navigator.push(
            context,
            MaterialPageRoute(
              builder: (context) => const MyHomePage(),
            ),
          );
          print('user has signed in');

        }
      },
    );
  }


text:
Q: Iphone, Cocos2d Does anyone know how to install cocos2d so it shows up in the new projects template window?

A: Unless there's a Project Template file included with the cocos2d distribution, you'll have to make one yourself which, sadly, I don't know how to do exactly (I could probably stumble my way through it, but that's not helpful to you...).
However, when you eventually do have your Project Template, you need to copy it into:
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates
This may be of help to you:
http://iphonesdkdev.blogspot.com/2009/01/xcode-template-for-cocos2d.html
Cheers!

A: Try placing the template in this directory:
/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/Application/
(via Jeff Lamarche's iPhone Development blog)

A: As far as i know there are no template projects.  It's however very simple to get cocos up and running with XCode.  Here's a great walkthrough link.

A: Here's a great tutorial for Cocos2D that's also got a template to get you started, from Keith Peters at Bit-101: http://www.bit-101.com/blog/?p=2115

A: 1-open cocos2d folder
2-open terminal window
3-type: sudo
4-and drag and drop file:install-templates.sh (cocos2d) folder and return
start xcode and new project


text:
Q: How do I securely create a mysql database in C# I have a C# program that I want to dynamically create databases with.  Although only privileged users will be using this application, I want to follow best practices security wise.  How do I go about doing this?  I don't think I can use a parameterized query in this case since I'm not wanting to pass in a string, I want to pass in an identifier.
Here's the insecure way I've got in there now as a placeholder:
using (MySqlConnection connection = new MySqlConnection(connectionString))
        using (MySqlCommand command = connection.CreateCommand())
        {
            connection.Open();
            command.CommandText = "DROP SCHEMA IF EXISTS " + schema;
            command.ExecuteNonQuery();
            command.CommandText = "CREATE SCHEMA " + schema;
            command.ExecuteNonQuery();
        }

Any ideas on this?

A: You can use the backtick delimiter to ensure the strings are correctly quoted and ensure that whatever is entered by the user is used as a literal identifier.
See: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html and Using backticks around field names
That way the command that is passed to the server would look like: "DROP SCHEMA IF EXISTS foo" which will tolerate using reserved words and other incorrect string values as identifiers.

A: simply run a regular expression against schema to verify that it is a valid name? (contains no spaces, colons etc). I'm not sure if you can or can't use parameterised queries in this case, but if you do, it will fail creating a database called TRANCATE TABLE users; anyway :)

A: I don't know why do you want to create databases dynamically, but I think the correct way of doing this is not to generate databases dynamically.
The only exception I can think of is if you were creating your own database management system. If that's the case, maybe you could look at the source code of some open source MySQL database manager, like phpMyAdmin. (I don't know any for .Net.)


text:
Q: searching for occurrences in access database I am trying to search in access database for some occurrence, but I found that my code miss somes when it made a search.
I found that he miss the second occurence when it found the first one.
Example: if I have the following and I am looking for T300 and I have this structure:
T200
T300
T300
it will catch first T300 and pass the second T300
enter code here
import csv
import pyodbc
from xml.dom import minidom

# *************************************

def DBAccess (Term):
 MDB = 'c:/test/mydb.mdb'
 DRV = '{Microsoft Access Driver (*.mdb)}'
 PWD = ''

 conn = pyodbc.connect('DRIVER=%s;DBQ=%s;PWD=%s' % (DRV,MDB,PWD))
 curs = conn.cursor()

 curs.execute("select * from gdo_segment")
 rows = curs.fetchall()
 for row in rows:
     T = 'T' + str(row.troncon) + '_' + row.noeud1 + '-' + row.noeud2
     if (T == Term ):
         print T

 curs.close()
 conn.close()

#*************************************

def findTerminal():

 xmldoc = minidom.parse('c:\\test\mydoc.xml')
 #printing the number of blocs in my xml file
 itemlist = xmldoc.getElementsByTagName('ACLineSegment')

 for item in itemlist:
     found = False
     for child in item.childNodes:
        if child.nodeName == 'Terminal':
            found = True
     if not found:
         Term = item.getAttribute('Name')
         DBAccess (Term)

#***********************************

findTerminal()

A: I assume it is finding the last item, and this would be because of your code indenting. Correct indenting is essential in Python. the docs
Currently, your if statement only applies after all the looping has completed, so will only check the last value of T.
def DBAccess (Term):
    MDB = 'c:/test/gdomt.mdb'
    DRV = '{Microsoft Access Driver (*.mdb)}'
    PWD = ''

    conn = pyodbc.connect('DRIVER=%s;DBQ=%s;PWD=%s' % (DRV,MDB,PWD))
    curs = conn.cursor()

    curs.execute("select * from gdo_segment")
    rows = curs.fetchall()
    for row in rows:
        T = 'T' + str(row.troncon) + '_' + row.noeud1 + '-' + row.noeud2
        if (T == Term ):
            print T

    curs.close()
    conn.close()


text:
Q: strange behavior of x86 "cmp" instruction Here is the code:
#include <iostream>
#include <time.h>

using namespace std;

#define ARR_LENGTH 1000000
#define TEST_NUM 0
typedef unsigned int uint;

uint arr[ARR_LENGTH];

uint inc_time(uint x) {
    uint y = 0, tm = clock();
    for (uint i = 0; i < x; i++) y++;
        return clock() - tm;
}

int main() {
    uint div = 0, mod = 0, tm = 0, overall = 0, inc_tm;
    srand(time(NULL));
    for (uint i = 0; i < ARR_LENGTH; i++) arr[i] = (uint)rand() + 2;

    tm = clock();
    for (uint i = 0; i < ARR_LENGTH - 1; i++)
        if (arr[i] % arr[i+1] != TEST_NUM) mod++;
    overall = clock() - tm;
    inc_tm = inc_time(mod);
    cout << "mods - " << mod << endl;
    cout << "Overall time - " << overall<< endl;
    cout << "   wasted on increment - " << inc_tm << endl;
    cout << "   wasted on condition - " << overall - inc_tm << endl << endl;

    tm = clock();
    for (uint i = 0; i < ARR_LENGTH - 1; i++)
        if (arr[i]/arr[i+1] != TEST_NUM) div++;
    overall = clock()-tm;
    inc_tm = inc_time(div);
    cout << "divs - " << div << endl;
    cout << "Overall time - " << overall << endl;
    cout << "   wasted on increment - " << inc_tm << endl;
    cout << "   wasted on condition - " << overall - inc_tm << endl << endl;

    return 0;
}

If you're using Visual Studio, just compile in DEBUG (not RELEASE) mode and if you're using GCC than disable dead code elimination (-fno-dce), otherwise some parts of code will not work.
So the question is: When you set the TEST_NUM constant to non-zero (say 5), both the conditions (modulo and division) are perfoming approximately at the same time, but when you set TEST_NUM to 0, the second condition performs slower (up to 3 times!). Why?
Here is the disassembly listing:  disassembly listing image http://img213.imageshack.us/slideshow/webplayer.php?id=wp000076.jpg
In case of 0 the test instruction is used instead of cmp X, 0 but even if you patch cmp X, 5 (in case of 5) to cmp X, 0 you'll see that it wouldn't affect the modulo operation, but would affect the division operation.
Carefully watch how the operations counts and times are changing while you change the TEST_NUM constant.
If anybody can, please explain how can this happen?
Thanks.

A: In the case of TEST_NUM == 0, the first condition is rarely true. The branch prediction will recognize this and predict the condition as always false. This prediction will be correct in most cases, so an expensive wrong predicted branch needs rarely to be executed.
Almost the same goes for the case 'TEST_NUM == 5': The first condition will rarely be true.
For the second condition abd TEST_NUM == 0, the result of the division is zero for each arr[i] < arr[i+1] which has a probability of about 0.5. This is the worst case for a branch predictor - the branch will be predicted wrong in every second case. In average, you will get half of the clock cycles needed for a wrong predicted branch (depending on the architecture this may be between 10 to 20 cycles).
If you have a value of TEST_NUM == 5, the second condition is now rarely true, the probability will be about 0.1 (not quite sure here). This is much better "predictable". Tpically the predictor will predict as (almost) always false, with some random trues in between, but that depends on the innards of the processors. But in any case, you get the additional cycles for a wrong predicted branch not so often, a worst in every fifth case.


text:
Q: ASPxGridview get row data from server-side I'm working on a DevExpress Gridview and I want to get the data of the selected row (only one row can be selected at the time). I'm working on the Server-Side and I'm using FocusedRowChanged function.
EDIT: The FocusedRowChanged fire but nothing happen and the textboxes do not change value
protected void dxgrDepartement_FocusedRowChanged(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterClientScriptBlock(GetType(), "FetchData", "<script                          language='javascript'>FetchData('4654654646')</script>");
            txtDescription.Text = "patate";
            //txtComments.Text = dxgrDepartement.GetRowValues(dxgrDepartement.FocusedRowIndex, "IdDepartment").ToString();
        }

And the "FetchData :
        function FetchData(text) {
        //ClearField();
        document.getElementById("<%= txtDescription.ClientID %>").value = text.toString();
    }

A: Use:

gridView.GetRowValues(gridView.FocusedRowIndex, columnFieldName1, columnFieldName2, ..., columnFieldNameN)

Method ASPxGridView.GetRowValues
Property ASPxGridView.FocusedRowIndex

A: grid.EnableCallback = false; solved my problems!

A: BTW - Changing the callbacks property made no difference for us.  We needed callbacks for other functionality so couldn't turn this off anyway.
The GetRowValues method did not work either.
This is a technique described on DevExpress' web site and it worked for us as long as we didnt use DevExpress' controls (ASPxDateEdit, ASPxTextBox):
ASPX page:
    <dxwgv:GridViewDataTextColumn Caption="Dist. %" FieldName="DistributionPerc" VisibleIndex="3"
        Width="50px">
        <DataItemTemplate>
            <asp:TextBox ID="txtDistPerc" runat="server" Text='<%# Eval("DistributionPercent") %>'
                Width="50px" />
        </DataItemTemplate>
    </dxwgv:GridViewDataTextColumn>

Code behind:
for (int i = 0; i < grdHistory.VisibleRowCount; i++)
{
    TextBox textbox = grdHistory.FindRowCellTemplateControl(i, grdHistory.Columns["DistributionPerc"] as GridViewDataColumn, "txtDistPerc") as TextBox;
    var anything = textbox.Text;
}


text:
Q: Do the following sentences involving "As a ____" contain dangling modifiers? I've seen sentences along the lines of the following written quite frequently, but I'm unsure whether they would be classified as dangling modifiers, considering the noun which the modifier refers to is not positioned too far from the beginning of the sentence, but it nonetheless does not immediately follow the modifier. My gut feeling tells me that the following examples are dangling modifiers, but I'm not 100% sure:

As a writer, what are some of your favorite motifs?
As a teacher, who was your most memorable student?
As president of the United States, how did Roosevelt handle the Depression?
As a student, can I tutor my classmates?

A: No

As a student, can I tutor my classmates?

As Kasa stated, this is not misplaced at all and only takes on that appearance because of the formatting of English questions.

As president of the United States, how did Roosevelt handle the Depression?

This is the same structure. It's a tiny bit awkward since it could theoretically be understood as asking a sitting president what his official position is about the job Roosevelt did. There are better ways to ask the same question: Once elected... After taking office... As president...

As a writer, what are some of your favorite motifs?
As a teacher, who was your most memorable student?

If you had a bad teacher who really didn't like you, you could get marked down for this since the clauses can be misunderstood as modifying the question words what and who. (See Kasa's answer, where s/he misunderstands them as modifying your.) Really, though, they're not misplaced at all and modify the entire sentence adverbially as part of your question to the listener. You could add speaking... in your experience... in your opinion... to the beginning to make this more explicit, but it's not necessary.
but kinda
None of these is an example of a misplaced modifier in the sense that you mean and none of them are wrong, but all of them except the teaching one sound a little more awkward when you say it this way. It's more natural to put that clause at the end of the sentence: Can I do this as a student? How did he handle it as president? What are your favorite Xs as a writer?

A: I don't think that these are dangling modifiers. Why you may it confusing is because these are actually questions.
Instead, consider them to be statements.
E.g.
As a writer, my favourite motifs are..
Now as a writer doesn't appear to be a dangling modifier as it is close to my, the pronoun it modifies.


text:
Q: print and return python I want to print and return a value, but cant seem to find my way around it.
I have this as of now:
def collatz_number(n):
# If n is not a positive integer
    if n<=0:
        return "Only positive integers please"

# Even numbers
    elif n % 2 == 0:
        return n // 2

# If n is 1
    elif n == 1:
        return 1

# Odd number
    elif n % 2 == 1:
        return 3*n+1

I want it to function like this:
>>>a = collatz_number(5)

16
>>> print(a)

16
My problem is that I either print 16 two times, if I use print under each if statement (the code would then print the same number the if statement returns), or as it is with this code that you see - I only get 16 after print(a), but not after a = collatz_number(n).
How can I make this code function as I stated above: have it print and return the collatz number of n such that it works like this(as stated above):
>>> a = collatz_number(n)

16
>>> print(a)

16
Im sorry for the bad formulation

A: You almost never want to print from a function. If you don't want the return value printed, there's nothing (easy) you can do about it. If you do want it printed, you can always do so after the function returns the value. If for some reason you must both print and return, save the return value to a variable so that you only need one return statement, which can be preceded by a single call to print.
Unrelated, but don't return strings to indicate errors from functions that otherwise return numbers. Raise an exception instead.
def collatz_number(n):
    if n <= 0:
        raise ValueError("Only positive integers please")

    if n == 1:
        rv = 1
    elif n % 2 == 0:
        rv = n // 2
    else:
        rv = 3*n+1

    # print(rv)
    return rv

Check for n==1 first, to avoid doing an unnecessary division. Also, a number is either even or odd; if n % 2 != 0, you know it is 1; you don't need to do the division again.

A: You can just print the variable inside of the function before returning it.
def foo(x):
    return_value= x+5
    print(return_value)
    return return_value
a=foo(10)

A: The 'return' statement doesn't print anything, you can only store that returned value into a variable, and then print it.
I'm not sure if I understand your question.. but the case is that, if you want to print twice, as you show in your example you have to do this:
def collatz_number(n):
# If n is not a positive integer
    if n<=0:
        print "Only positive integers please"
        return -1 #for example, you could return any other value..

# Even numbers
    elif n % 2 == 0:
        print str(n // 2)
        return n // 2

# If n is 1
    elif n == 1:
        print str(1)
        return 1

# Odd number
    elif n % 2 == 1:
        print str(3*n+1)
        return 3*n+1

observe that to print a number you have to convert it to 'str' type first... So, you cant't do print (a), but instead do print (str(a))
I hope my answer helps! Good luck!


text:
Q: Как определить текущий язык ОС? Хочу сделать программу мультиязычной. Мне нужно узнать, какой язык в ОС.
Предполагаю, что здесь копать System.Globalization.CultureInfo.
Есть ли неплохой вариант для решения этой задачи?

A:  CultureInfo.InstalledUICulture

ссылка


text:
Q: Unable to lock screen I'm using Ubuntu 18.04 with default DE on my laptop.
I have an external monitor that I used for weeks without problem.
(maybe during an update) I closed the lid and then the desktop appeared on the second screen and it didn't lock the session as expected.
From that day when I try to lock the screen (via shortcut, menu or xdg-screensaver lock), gnome freezes and restart itself after 1 minute.
Gnome extensions:

*

*system-monitor

*sound input & output device chooser; openweather
~~Disabling extensions doesn't help.~~ (Actually yes it does, see edit 2)
I don't know how to solve this problem but I can provide logs and other info if needed.
Thank you :)
EDIT 1:
Found information on syslog:
 https://pastebin.com/SXHjzdMh
It seems a crash due to a failed assertion,
May  5 19:03:57 enrico-ultrabook org.gnome.Shell.desktop[31212]: St:ERROR:../src/st/st-bin.c:186:st_bin_destroy: assertion failed: (priv->child == NULL)
EDIT 2:
Actually disabling the top switch in the extensions window in gnome-tweaks gnome freezes and restarts. So I think it's a problem related to extensions. See log https://pastebin.com/g4iWFD5Q
It seems a problem related to system-monitor May 13 16:18:25 enrico-ultrabook gnome-shell[6617]: error reading: /sys/class/hwmon/hwmon1/fan1_input
It seems a bug reported here

A: Since I restarted my system without the above extension system-monitor I dont experience the issue anymore for a week. This morning I reenabled it and the problem came back...


text:
Q: Urls Amigable con atributo id en Html y/o data-bs-target o familiares Estoy utilizando ruta amigable dónde mi archivo htacess tiene la siguiente estructura:
RewriteEngine On

RewriteRule ^([a-zA-Z0-9/]+)$ index.php?url=$1

Estoy modificando la plantilla web pero tiene un carusel al momento de darle a la flecha de direccione me marca esto en el navegador:
http://domain.com.mx/WebSite/#carouselExampleDark

No hace ningún efecto la estructura para direccionar a las vista es la siguiente:
<?php
    session_start();
    error_reporting(0);
    require './main/connect.php';
?>
<!doctype html>

    <?php require("./main/head_css.php"); ?>

        <?php require("./main/header.php"); ?>

        <?php
              if (isset($_GET['url'])) {
                    if($_GET['url'] == 'inicio'){
                        // $u = explode("/", $_GET['url']);
                        // $url = "./view/".$u[0].".php";
                        $url = "./view/".$_GET['url'].".php";
                        require($url);
                    }
              }else{
                require("./view/inicio.php");
              }
        ?>

        <?php require("./main/footer.php"); ?>

        <?php require("./main/modals.php"); ?>

    <?php require("./main/switcher.php"); ?>

    <?php require("./main/script.php"); ?>

de su amable apoyo en como estructura urls amigable y jalar id, soy nuevo en la estructura de ruta amigables


text:
Q: How you use virtualenv within python script, so we need not to activate it everytime Currently I'm running this command in terminal:
source /home/protected/env/bin/activate

And then I run this and it works:
python3 /home/protected/ethereum-wallet-generator.py

But it seems like it should be required to enter source /home/protected/env/bin/activate first.  Is it not possible to specify the path somewhere within the python script or at least a way to turn this into a one-liner instead of having to send 2 separate commands?

A: Yes, it is possible. You can just change the shebang to this
#!/home/protected/env/bin/python

Then you invoke the script like so (this is your one-liner)
/home/protected/ethereum-wallet-generator.py

Note that it needs to be executable, you can change it like this
chmod u+x /home/protected/ethereum-wallet-generator.py

If you invoke the python interpreter inside the Virtual Environment, it will act as if the activate script was first sourced. Note that you don't even need to specify "python3", but can just go "python"


text:
Q: Script DB Level Permission Before Refresh to Non Prod Environment I am looking for a script that I can use to script out all database level permissions.

*

*Script users \ permissions

*Restore DB From Prod to Non Prod

*Drop Prod Users and Run script to apply original permissions

There are a lot of scripts out there. But i am unsure which one to use. Would be great if someone can point me in the right direction.

A: You should obviously try using native SSMS functionality.
To scripts database users and their permissions use 'Generate script' context menu option of the database (right click db - tasks - generate scripts).
to restore database from Production to non-Production, again, use Script the action task and then modify it to suit your specific needs (right-click 'Databases' node - restore database - Script button on the upleft of the General tab).


text:
Q: How does Ruby's rest-client work for OAuth 2? I am trying to implement an OAuth 2 sign up for an Angular 6, using gitLab Api. Its website has some code for getting the access token based on Ruby. I will be so glad if anyone lets me know how to get this access token.
OAtuth 2 for gitLab says that I can get the secret code and YOUR_UNIQUE_STATE_HASH. I managed to follow their instruction.
To get the access token, gitLab posted some Rubi [sic] code, which I could not understand and don't know how to implement in angular.
Here is the instruction:

Once you have the authorization code you can request an access_token using the code, to do that you can use any HTTP client. In the following example, we are using Ruby's rest-client:

parameters = 'client_id=APP_ID&client_secret=APP_SECRET&code=RETURNED_CODE&grant_type=authorization_code&redirect_uri=REDIRECT_URI'
RestClient.post 'http://gitlab.example.com/oauth/token', parameters

# The response will be
{
 "access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
 "token_type": "bearer",
 "expires_in": 7200,
 "refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}

I would be so kind if somebody explains this code snippet.

A: The snippet is basically doing as denoted already. You need to generate the access token (or bearer token) using your client id and client secret with the code which was returned after successful user auth - this access token is basically the token which you will then further use on behalf of user to gitlab.
OAuth makes sure that the client code cannot be used by unauthorized attacker by making sure that you as a developer request it with your client id and client_secret.
RestClient.post 'http://gitlab.example.com/oauth/token', parameters will send that POST request and then Gitlab will return the response with access token and about it's expiry.


text:
Q: API JSON Response to CSV I am trying to take this JSON response (It is just a sample of the response)
[
    [
        {
            "session_id": "f02f8b6670a2811b2ee0cfd770a871f6",
            "url": "https://something.bob.com/courses/10546/external_tools/44",
            "context_type": "Course",
            "asset_type": null,
            "controller": "external_tools",
            "action": "show",
            "interaction_seconds": null,
            "created_at": "2021-10-25T02:43:42Z",
            "updated_at": "2021-10-25T02:43:42Z",
            "developer_key_id": null,
            "user_request": null,
            "render_time": 0.223835,
            "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36",
            "asset_user_access_id": 11535927,
            "participated": false,
            "summarized": null,
            "http_method": "get",
            "remote_ip": "184.88.22.85",
            "id": "8e40f170-1225-43c6-8796-9a8ad6f1c351",
            "contributed": false,
            "links": {
                "user": 9526,
                "context": 10546,
                "asset": null,
                "real_user": null,
                "account": 1
            },
            "app_name": null
        },

And convert it to a CSV that looks like
session_id,url,context_type
f02f8b66,google.com,course

and so on throughout the response.
Here is what I have so far
headers = {
       'Authorization': key
}

data_set = []
next_check = 'default'

r = requests.get(domain + "/api/v1/users/9526/page_views?start_time=" + start + "&end_time=" + end + "&per_page=10", headers=headers)
next_ = r.links['next']['url']
d = r.json()
data_set.append(d)

while next_check != 'null':
       r = requests.get(next_, headers=headers)
       next_d = r.json()
       data_set.append(next_d)
       next_check = r.links.get('next', 'null')
       if next_check != 'null':
              next_ = r.links['next']['url']

file = open("requests.json", "w")
file.write(json.dumps(data_set, indent=4))
file.close()

pdObj = pd.read_json("requests.json", orient="index")
print(pdObj)
csvData = pdObj.to_csv('response.csv')

And this is my response:
'list' object has no attribute 'values'
I am kinda lost on this one. I looked at the Pandas documentation and I thought I was doing it the right way.

A: actually this is a list of json.so you need to convert this list to csv by using pandas
df = pd.DataFrame(res)  #this res is the json response

csv_data = df.to_csv(index=False)


text:
Q: Perpendicular form of the straight line equation. There are $5$ to $6$ standard forms of the straight line equation. for example slope intercept form, two intercept form, point slope form and perpendicular form. I have clear visualization of all forms except the perpendicular form.
Can any one help me out to give me the concept of perpendicular form. and let me know that how to reduce an equation of straight line for example $x-2y-3=0$ into perpendicular form, i.e. $$x\cos\alpha+y\sin\beta=p$$

A: Using The Pearson Complete Guide For Aieee 2/e
 By Khattar as a point of reference for the items below.
You want to convert
$$\tag 1 x-2y-3=0$$
into normal (perpendicular) form.
We have:
$$Ax + By = -C \rightarrow (1)x + (-2)y = -(-3)$$
This means $C \lt 0$, so we divide both sides of $(1)$ by:
$$\sqrt{A^2 + B^2} = \sqrt{(1)^2 + (-2)^2} = \sqrt{5}$$
This yields:
$$\dfrac{1}{\sqrt{5}} x - \dfrac{2}{\sqrt{5}} y = -\dfrac{-3}{\sqrt{5}}$$
In normal form, this is:
$$\cos(\alpha)~x + \sin(\alpha)y = p \rightarrow \dfrac{1}{\sqrt{5}} x - \dfrac{2}{\sqrt{5}} y = -\dfrac{-3}{\sqrt{5}}$$
Note that this has a positive $x$ coordinate, and a negative $y$ coordinate, which puts us in the $4^{th}$ quadrant.
So, we have:
$$\cos(\alpha) = \dfrac{1}{\sqrt{5}}, \sin(-\alpha) = -\dfrac{2}{\sqrt{5}} , p = -\dfrac{-3}{\sqrt{5}} = \dfrac{3}{\sqrt{5}}$$
This gives us:
$$\alpha \approx 1.10714871779409 ~\mbox{radians}~ \approx 63.434948822922 {}^{\circ}$$
Since we are in the $4^{th}$ quadrant, we can write this angle as:
$$\alpha \approx 2 \pi - 1.10714871779409 ~\mbox{radians}~ \approx 5.176036589385497 ~\mbox{radians}~ \approx 296.565 {}^{\circ}$$
As another reference point, see $10.3.4$ (including examples) at Straight Lines.

A: I felt exactly same when first studying the perpendicular form. Seeing components of $p\ \mathrm{as}\ x\cos(\alpha)+y\sin(\alpha)$ line segments by means of a simple construction could burn it into your visual memory:
$$p = OL = OQ + QL = OQ + RP =x\cos(\alpha)+y\sin(\alpha)$$


text:
Q: How to hide a div based on its class Can someone please show me how I am able to hide a div based on class, or an image based on its name using CSS? I have the following code below but I am not sure how to hide it as the div doesn't have an id. I am unable to delete or modify this code, hence why I am asking how to hide it. Many thanks.

A: To hide a div with a class :
.jicons-icons {
    display: none;
}

A: http://jsfiddle.net/vnng4nf3/
img[alt="foobar"] {
    display: none;
}


text:
Q: Transformation Poincaré-coordinates to global coordinates in $\mathrm{AdS}_2$ For the two dimensional anti de-sitter space $\mathrm{AdS}_2$ one can consider the Poincaré-coordinates $\mathrm{d}s^2_P = -r^2 \mathrm{d}t^2 + \frac{1}{r^2} \mathrm{d}r^2$ which covers only half of the spacetime. Most of the time though one uses the global coordinates $\mathrm{d}s^2_{G1} = -(1+r^2) \mathrm{d}t^2 + \frac{1}{1+r^2} \mathrm{d}r^2$, or the latter with a additional transformation $r = \mathrm{sinh}(\rho)$: $\mathrm{d}s^2_{G2} = -\mathrm{cosh}^2(\rho) \mathrm{d}t^2 + \mathrm{d}\rho^2$. This question seems to be more in the trivial side, but what is the explicit coordinate transformation from $\mathrm{d}s^2_P$ to either $\mathrm{d}s^2_{G1}$ or $\mathrm{d}s^2_{G2}$?

A: The coordinate transformation from $(r,t)$ to $(\rho,\tau)$ given by
$$\rho= \cosh r \cos t+\sinh r,\;\;\tau= \frac{\cosh r \sin t }{\cosh ^2 r \sin ^2 t-1}(\sinh r-\cosh r \cos t),$$
$$\text{in the range}\;\;r>0, \;-\pi/2<t<\pi/2\Leftrightarrow\rho>0,\;-\infty<\tau<\infty,$$
converts the global metric
$$ds^2 = - \cosh^2 r \,dt^2 + dr^2,$$
into the Poincaré metric
$$ds^2 =  - \rho^2 d\tau^2+\rho^{-2} d\rho^2.$$
I searched the literature but could not find this coordinate transformation in the explicit form requested by the OP. I have verified its correctness algebraically:
$$d\rho=-dt \sin t\cosh r+ dr(\cosh r+ \sinh r \cos t),\;\;d\tau=\frac{dt(\sinh 2 r \cos t+2  \cosh ^2 r)-2 dr \sin t}{2 (\cosh r \cos t+\sinh r)^2}$$
$$\Rightarrow - \rho^2 d\tau^2+\rho^{-2} d\rho^2=- \cosh^2 r \,dt^2 + dr^2,\;\;\text{as desired}.$$

A: See chapter 2 of these lecture notes: https://sites.krieger.jhu.edu/jared-kaplan/files/2016/05/AdSCFTCourseNotesCurrentPublic.pdf
All the relevant coordinate changes for $AdS_d$ are in there, and the specialization to $d=2$ is immediate.


text:
Q: Probability question math please?
a) We have $A_1$, $A_2$ and $A_3$ which are three events. Write the event: at most one event happens.

Solution: I dont know :S

b) We have $A$, $B$ and $C$, three independent events with $P(A)=\frac{1}{4}$, $P(B)=\frac{1}{3}$, and $P(C)=\frac{1}{2}$.
  Find the probability that none of them happens.
  Find the probability that a certain event happens.

Solution : Probability=0
Solution : 1/4+1/3+1/2
Are these right, and please, can you help me with the first one?

A: a)
$$
 (A_1 \cup A_2 \cup A_3) \setminus ((A_1 \cap A_2) \cup (A_1 \cap A_3) \cup (A_2 \cap A_3))
$$
b1) the complementary of each event happens:
$$
  x=(1-1/4) (1-1/3) (1-1/2)
$$
b2) the complementary of b1
$$
1-x
$$


text:
Q: fallo de autentificación con smtplib en python estoy haciendo un pequeño algoritmo de fuerza bruta (por diversión más que nada) para lo que creé un correo falso con una contraseña simple, cuando el algoritmo dio con la clave, este no pudo ingresar, marcando la contraseña como incorrecta, cuando entré a la cuenta de gmail vi que fue porque se había bloqueado el inicio de cesión porque era sospechoso "supongo que es porque el programa lo intentó muchas veces" pensé.
#-*-coding: utf-8 -*-
import smtplib
if __name__ == '__main__':
    data = []
    user = str(raw_input("introduce el correo electronico: "))
    name = str(raw_input("introduce el nombre de la victima: "))
    data.append(name)
    year = str(raw_input("introduce el año en el que nació {}:".format(name)))
    data.append(year)
    word = str(raw_input("introduce una palabra que {} use mucho:".format(name)))
    data.append(word)
    couple = str(raw_input("{} tiene pareja? Y/N ".format(name)))
    if couple == "y" or couple == "Y":
        couple2 = str(raw_input("introduce el nombre de su pareja: "))
        data.append(couple2)
        anniversary = str(raw_input("cuando es el aniversario de {} y {}?:".format(name, couple2)))
        data.append(anniversary)
        server = smtplib.SMTP('smtp.gmail.com:587')
        server.starttls()
        for passw in data:
            for passw2 in data:
                rpass = passw + passw2
                try:
                    server.login(user,rpass)
                except Exception as e:
                    print("{} no es la clave correcta".format(rpass))
                else:
                    print("{} es la clave de {}".format(rpass, user))
                    server.quit()
                    exit()
    server.quit()

pero horas después intenté crear un programa (en python también) el cual estaría almacenado en una raspberry py que tendría un cronjob que activara el programa cada que fueran las 7 de la tarde, el programa me mandaría un mensaje por correo electrónico notificando me que debo de regar mis plantas, pero también tuve problemas de autentificación, me aseguré de que la contraseña fuera la correcta y aún así no pude.
¿alguien sabe por qué se puede dar este error?


text:
Q: Openssh on Windows server: ssh to localhost is asking for password So I have installed and configured Openssh on windows server 2016 and now I am trying to setup passwordless connection to localhost because a scripts needs it.
Login to localhost without password is not working fine despite copying the public key to the authorized_keys file. Here's the log.
C:\Users\AWSAmazonCntAppIDDEV>ssh -vvv AWSAmazonCntAppIDDEV@localhost
OpenSSH_8.3p1, OpenSSL 1.1.1g  21 Apr 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "localhost" port 22
debug2: ssh_connect_direct
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_rsa type 0
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_dsa type 0
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_xmss type -1
debug1: identity file /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_for_Windows_8.6
debug1: match: OpenSSH_for_Windows_8.6 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to localhost:22 as 'AWSAmazonCntAppIDDEV'
debug3: hostkeys_foreach: reading file "/c/Users/AWSAmazonCntAppIDDEV/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /c/Users/AWSAmazonCntAppIDDEV/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from localhost
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: peer server KEXINIT proposal
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:SHXUWbmljiMgQld335wbngd7Ooyvp/G8Q//6NqShdxE
debug3: hostkeys_foreach: reading file "/c/Users/AWSAmazonCntAppIDDEV/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /c/Users/AWSAmazonCntAppIDDEV/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from localhost
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/AWSAmazonCntAppIDDEV/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey in after 134217728 blocks
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_rsa RSA SHA256:zpgLGNnEaLGE58i9zmvxJzgrI0mkxpKr6VyHH0xDvgw
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_dsa RSA SHA256:zpgLGNnEaLGE58i9zmvxJzgrI0mkxpKr6VyHH0xDvgw
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com,webauthn-sk-ecdsa-sha2-nistp256@openssh.com>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_rsa RSA SHA256:zpgLGNnEaLGE58i9zmvxJzgrI0mkxpKr6VyHH0xDvgw
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Offering public key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_dsa RSA SHA256:zpgLGNnEaLGE58i9zmvxJzgrI0mkxpKr6VyHH0xDvgw
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa
debug3: no such identity: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa_sk
debug3: no such identity: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ecdsa_sk: No such file or directory
debug1: Trying private key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519
debug3: no such identity: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519: No such file or directory
debug1: Trying private key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519_sk
debug3: no such identity: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_ed25519_sk: No such file or directory
debug1: Trying private key: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_xmss
debug3: no such identity: /c/Users/AWSAmazonCntAppIDDEV/.ssh/id_xmss: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
AWSAmazonCntAppIDDEV@localhost's password:

Here's what I tried so far:

*

*Commented below lines in sshd_config file

#Match Group administrators
#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

*

*PubkeyAuthentication and PasswordAuthentication are set to yes

 PubkeyAuthentication yes
 PasswordAuthentication yes

*

*The %user_home/.ssh folder is only owned by system and my_ID (my account). Also inheritance is disabled. This is to make sure that .ssh folder has equivalent 700 permissions and authorized_keys file has 0600 permissions.

*Tried to recreate keys.

I still think its a permission issue because when I run ls -lart in windows its still showing the permissions as 644, as you can see. I tried to change it to 600 but its not letting me because its windows. I'd appreciate any help on this.
C:\Users\AWSAmazonCntAppIDDEV\.ssh>ls -alrt
total 26
-rw-r--r-- 1 AWSAmazonCntAppIDDEV 1049089  589 Jul 15 14:01 id_rsa.pub
-rw-r--r-- 1 AWSAmazonCntAppIDDEV 1049089 2635 Jul 15 14:01 id_dsa
-rw-r--r-- 1 AWSAmazonCntAppIDDEV 1049089  588 Jul 15 14:02 authorized_keys
-rw-r--r-- 1 AWSAmazonCntAppIDDEV 1049089  171 Jul 15 14:05 known_hosts
drwxr-xr-x 1 AWSAmazonCntAppIDDEV 1049089    0 Jul 15 14:23 ..
drwxr-xr-x 1 AWSAmazonCntAppIDDEV 1049089    0 Jul 15 14:39 .

A: I uninstalled openssh and reinstalled it using steps mentioned in the below document. Then I was able ssh to localhost without password.
https://adamtheautomator.com/openssh-windows/
I skipped the certificate Authentication section in the link, as it was irrelevant in my case.


text:
Q: SAS, only a selection of the total number of observations are included in the final dataset. How can I include all observations? I have written the following program in SAS. The program does what it is supposed to do, but in my final dataset, only 25% of my total observations are included. The program only seems to select a limited number of observations for data processing from the original dataset. How can I adjust the program so that all observations are included and not only the observations in which adjustments have been made by the program? I have tried: if else output;  at the end of the program, but this does not seem to work.
Any help would be greatly appreciated. Thanks!
Program:
    set have;
    if variable1 = "information";
    data_format = find(Variable2,'1:');
    data_format2 = find(Variable2,'2:');
    if data_format2 > 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
    else if data_format = 0 and find(Variable2,'T=na') > 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
    else if data_format = 0 and find(Variable2,'T=na') = 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
run;

A: Your code has a subsetting IF statement
if variable1 = "information";

so only these observations are kept. Maybe you need to use an if ... then do; ... end; instead. Something like:
set have;
if variable1 = "information" then do;
    data_format = find(Variable2,'1:');
    data_format2 = find(Variable2,'2:');
    if data_format2 > 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
    else if data_format = 0 and find(Variable2,'T=na') > 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
    else if data_format = 0 and find(Variable2,'T=na') = 0 then do;
        weight_start = find(Variable2,'Weight:');
        weight_end = find(Variable2,'Lengte');
        weight = strip(substr(Variable2,(weight_start+8),(weight_end-8)-weight_start));
    end;
end;
run;


text:
Q: web api start html page I have web api project and I have *.html page and I need run it after run my project but I don't know how do it.
In MVC I use MapRoute like this:
  routes.MapRoute(
        name: "Default",
        url: "{controller}/{action}/{id}",
        defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
    );

But I don't know how do it in web api. I have next routes config:
config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{action}/{id}", new { id = RouteParameter.Optional });

and how to add other config for run my html page?
Thanks.

A: This code how you add new routing:
 config.Routes.MapHttpRoute(
                    name: "ApiWithAction",
                    routeTemplate: "api/{controller}/{action}/{id}",
                    defaults: new { id = RouteParameter.Optional }
                );

     config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );

Now just write route to your static file

A: I use Like this code into the WebApi project:
public class DefaultController : ApiController
    {
        /// <summary>
        /// Default controller for render swagger UI
        /// </summary>
        /// <returns></returns>
        [HttpGet, Route("")]
        public RedirectResult Index()
        {
            var requestUri = Request.RequestUri;
            return Redirect(requestUri.AbsoluteUri + "swagger/ui/index");
        }
    }


text:
Q: Person I'm Trying to Contact Display PGP key but not their email I am trying to contact someone who displays their PGP key on their website in their 'Contact' section. But they do not state their email there. How can I email them?

A: The email is usually included, but not required, in the key itself. Import the key, or use some software to inspect it, to get the email, if its there.
Otherwise, as Sjoerd said, you probably need to search a keyserver.

A: You can search a keyserver for the key's fingerprint.


text:
Q: Show checkbox value in URL I have a page that makes a query with Ajax. Checkboxes on this page work without any URL. What I want to do is to be able to load this data with URL. So when I enter a value in the url, I want that data to come automatically.

$checkboxes = $('input[type=checkbox');
$checkboxes.change(function(){
    window.location.hash = 'marka=' + $checkboxes.filter(':checked').map(function(){
        return this.value;
    }).get().join(",");
    console.log(window.location.hash);
});

 <input class="custom-control-input common_selector marka" type="checkbox" id="marka_1" value="1">
 Value 1
 <input class="custom-control-input common_selector marka" type="checkbox" id="marka_2" value="2">
 Value 2
 <input class="custom-control-input common_selector marka" type="checkbox" id="marka_3" value="3">
 Value 3
 <input class="custom-control-input common_selector marka" type="checkbox" id="marka_4" value="4">
 Value 4

I want to load data via URL

A: If I understand correctly, you want to both save checkbox state to the hash, and then load it again when someone visits a URL with checkbox info in the hash.
You already have the code which saves the checkbox state to the hash.  You're using a simple comma-separted list like #marka=2,4.  Loading that data back is simple enough:

*

*read the hash with window.location.hash;

*remove the #;

*remove marka= so you are left only with the values of the checked checkboxes;

*create an array of the values left;

*iterate over all checkboxes and check those whose values are in that array;

Something like this:
function loadCheckboxState() {
    // Get the hash, and remove the '#', we are left with marka=2,4
    let string = window.location.hash.substring(1);

    // Remove 'marka=', so we are left with 2,4
    string.replace('marka=', '');

    // Create an array of the ids left, [2,4]
    let checked = string.split(',');

    // Now check the checkboxes whose value is in the array
    $checkboxes.prop('checked', function () {
        return checked.indexOf(this.value) >= 0;
    });
}

You could run it on page load, eg:
$(document).ready(function() {
    loadCheckboxState();
});

Note there are a few minor issues in your code:

*

*jQuery 1.9.1 is ancient (2013!), you should be using a more recent version;

*Typo: $('input[type=checkbox');

*Typo: for="marka_21";

*Use var (or let) to declare your variables;
Update
Add code as a runnable snippet - note it doesn't work here due to the way Stackoverflow snippets are embeded.

$(document).ready(function() {
    // Load checkbox state from hash on page load
    loadCheckboxState();

    // When a checkbox is changed, update the hash
    $checkboxes.change(saveCheckboxState);
});

let $checkboxes = $('input[type=checkbox]');
let $link = $('#link');
let SOurl = 'https://stackoverflow.com/questions/74428447/show-checkbox-value-in-url';

// This will save checkbox state in the hash
function saveCheckboxState() {
    window.location.hash = 'marka=' + $checkboxes.filter(':checked').map(function () {
        return this.value;
    }).get().join(",");

    // Just for debugging, show it on the page
    let link = SOurl + window.location.hash;
    $link.attr('href', link).html(link);
}

function loadCheckboxState() {
    // Get the hash, and remove the '#', we are left with marka=2,4
    let string = window.location.hash.substring(1);

    // Remove 'marka=', so we are left with 2,4
    string.replace('marka=', '');

    // Create an array of the ids left, [2,4]
    let checked = string.split(',');

    // Now check the checkboxes whose value is in the array
    $checkboxes.prop('checked', function () {
        return checked.indexOf(this.value) >= 0;
    });
}

    <input class="" type="checkbox" id="marka_1" value="1">
    Value 1
    <input class="" type="checkbox" id="marka_2" value="2">
    Value 2
    <input class="" type="checkbox" id="marka_3" value="3">
    Value 3
    <input class="" type="checkbox" id="marka_4" value="4">
    Value 4

Generated link:


text:
Q: SyntaxError: unterminated string literal (doctype?) i'm not sure what i'm doing wrong. FireBug has shown me this error:
SyntaxError: unterminated string literal
$.post(('<!DOCTYPE html>

The respective code would be:
$('#botonGuardarIngreso').on('click', function(){
        var html = $(this).html();
        $(this).html('<i class="fa fa-spin fa-spinner"></i> Cargando...');
        $.post(('{{ path('editar_proceso', {'id': procesado}) }}'), $('form').serialize(), function(data){
            $('#botonGuardarIngreso').html(html);
            if(data.exito){
                exito('El proceso disciplinario fue modificado exitosamente');
                window.location = '{{ path('index_proceso') }}';
            }else{
                error(data.errores, 'Errores, por favor reviselos', 15000);
            }
        }, 'json');
    });

A: I guess {{ path('editar_proceso', {'id': procesado}) }} generate a template.
Remove \n in this template or replace it with \\n (backslash at the end, before new line).


text:
Q: Number of ways to arrange no matches? I am trying to understand this "matching problem". given n distinct objects, number each of them. We are said to have a "match" if we permute the n objects, and the ith object is in the ith position. This books says that "the probability that there are no matches among j randomly permuted objects is defined as p_j. Then there are j!*p_j number of ways we that j objects can be permuted such that there are no matches"
How is this possible? I understand that if we take objects that are completely different from the positions, such as (6,7,8) because the positions are 1,2, and 3, and we can arrange this in 3! ways and never obtain a match because the objects themselves aren't any of the possible positions (if we had 8 objects for example, and I pulled these 3).
But if I take j objects, number them so that they are distinct, then how could there be j! ways to arrange these objects so they don't match? Wouldn't at some point they will arrange themselves in a position where they match?
(For context, this is introduction to probability theory by Hoel. The problem is the example "Two equivalent decks of cards are well shuffled and matched against each other. What is the probability of at least one match?) Thank you!

A: Let the number of ways to permute $n$ objects such that there are no matches be called the number of derangements of $n$, or $d_n$.
The probability that a random permutation is a derangement is
$$
p_n = \frac{d_n}{n!}
$$
It is now clear that
$$
n! p_n = d_n
$$


text:
Q: ASP.NET Model Binding can I give submit button a value and retrieve that value when its clicked? Is it possible to use Model binding to get value of a button in the POST action method when its clicked on. I have a complex type and I wanted to have the user click on a button and retrieve the value of that button so I can use it to update the value of the complex type in the DB.
Note that at this point I have already saved the entity into the database and all that is left is to get a way to update properties of the complex type.
  If there is a recommended way to do that am willing to adopt that.
Thanks in advance.

A: You can use multiple submit buttons with different values to specify the way of update model.
@using (Html.BeginForm("MultipleCommand", "Home", FormMethod.Post, new { id = "submitForm" }))
{
    .
    .
    .
     <button type="submit" id="btnSave" name="Command" value="create">Save</button>
     <button type="submit" id="btnSubmit" name="Command" value="update">Submit</button>
}

public ActionResult(ComplexModel model, string Command)
{
    if(Command == "create")
    {
    }
    else if(Command == "update")
    {
    }
    else
    {
        // Default action
    }
}

For more info read Handling multiple submit buttons on the same form - MVC Razor.

A: Do something like this
        public ActionResult Index(string submit)
        ////Your action while clicking the button  and in the view button name should be submit
        {
            //// The string submit will have the value of the button
        }


text:
Q: Reversing integer but getting `StringIndexOutOfBoundsException` I'm trying to write a program that reverses the integer which starts with the negative sign. For example, if the number is -123, the output should be -321. But I'm getting:
StringIndexOutOfBoundsException: String index out of range: 4
in line:
result += myString.charAt(i) + "";

What is wrong with the logic of the code?
public class ReverseInteger {

    public static void main(String[] args){

        int x = -123;
        String myString = Integer.toString(x);
        String result = "";

        if(myString.charAt(0) == '-'){
            char sign = myString.charAt(0);
            for(int i = myString.length(); i > 1; i--){
                result += myString.charAt(i) + "";
            }
            result = sign + "" + result;
        }

        System.out.println(result);
    }
}

A: Indexing a String or array in java is zero based. This means that index 0 is the first character in the string, and mystring.length() - 1 is the last character in the string. mystring.length() is past the end of the string.
Since you're accessing the array at index mystring.length() you're exceeding the bounds of the array, hence the exception.
You want to begin your loop at index mystring.length() - 1. Furthermore you'll want to continue down to index 1, instead of excluding that index as in your loop.
Like so:
for (int i = myString.length() - 1; i > 0; i--)

A: This is because you are using
for(int i = myString.length(); i > 1; i--){
    result += myString.charAt(i) + "";
}

String.length() returns a length from 1 to X. 0 is for empty strings.
you need to add -1
for(int i = myString.length() - 1; i > 0; i--){
   result += myString.charAt(i) + "";
}

A: The below line seems to be the issue
result += myString.charAt(i) + "";

Change it to:
result += myString.charAt(i-1) + "";


text:
Q: FATAL EXCEPTION: ZoomTableManager I'm getting a strange crash and I'm having trouble finding anything about it on Google. Searching ZoomTableManager returns no results at all.
E/AndroidRuntime﹕ FATAL EXCEPTION: ZoomTableManager
Process: com.xxx.yyy, PID: 22129
java.lang.IllegalMonitorStateException: object not locked by thread before notify()
        at java.lang.Object.notifyAll(Native Method)
        at com.google.maps.api.android.lib6.gmm6.m.k.a(Unknown Source)
        at com.google.maps.api.android.lib6.gmm6.m.l.run(Unknown Source)

A: Turned out that the cause of the error was an invalid Google Maps API key.
Recently we had to change our app's package name and therefore the API keys we used became invalid as you have to specify the allowed apps by signature and package name.

A: A IllegalMonitorStateException with that message happens when you call obj.notify() and you aren't holding the primitive mutex for obj.
You are supposed to do something like this:
    synchronized (someObj) {
        ...
        someObj.notify();
        ...
    }

or equivalent, but for some reasons the code that cause the problem has left out the synchronized bit.  (Or maybe, it has synchronized on a different object.)
Unfortunately, this is happening in some obfuscated code that provides the Google Maps API implementation.  And you haven't provided any context.  So it is next to impossible for us to even guess what is going on.
I suggest that you provide more detail.

A: The way to fix this problem is to apply for the google map public key for your package.
But the way to prevent this crash is to check the return value of the calling mapFragment = new MapFragment() and don't call fm.beginTransaction().replace(id, mapFragment).commit(); if the mapFragment is null.
Hope it helps.

A: In our case what changed was the key used to sign the android application (and not the API key).
Before we were using a production key (stored within a keystore). That production key was enabled in Google API Console (https://console.developers.google.com).
We set up a new development environment in a new machine and that machine wasn't using the production key as before, but was using android's default debug key (stored in android's default debug keystore in $HOME/.android/debug.keystore).
The solution was to set up android's default debug key, SHA1 and package name in Google API Console.

*

*Get the SHA1:
keytool -v -list -keystore $HOME/.android/debug.keystore

*Copy the SHA1: 27:4C:CF:A3:E9:75:4A:59:4C:EE:50:21:2B:1C:7B:48:FC:45:4F:77

*Go to the Google API Console and enter the SHA1;package name (in APIS & Auth > Credentials > Edit allowed Android applications):
27:4C:CF:A3:E9:75:4A:59:4C:EE:50:21:2B:1C:7B:48:FC:45:4F:77;com.mypackage.name
Enjoy!


text:
Q: CheckboxTree : lvl1 box | lvl2 radio All the question is in my title =).
I started with checkBox Tree exemple, add property checked:false for the first level that work i see my checkbox just on left icone folder.
But have radio in level that is so different, i tryed some change to transform checkbox in radio, but nothing *:_:*
Some topic given by broogle talk only some levels with checkbox but none with radio.
Have you an idea ?
Thx a lot, have a nice day.

A: The Example is using a JSON file to load the nodes.
In de JSON file you can set "checked" to true or false.
{"text": "Grocery List",
"cls": "folder",
"children": [{
    "text": "Bananas",
    "leaf": true,
    "checked": false
},{
    "text": "Milk",
    "leaf": true,
    "checked": false
},{
    "text": "Cereal",
    "leaf": true,
    "checked": false
},{
    "text": "Energy foods",
    "cls": "folder",
    "children": [{
        "text": "Coffee",
        "leaf": true,
        "checked": false
    },{
        "text": "Red Bull",
        "leaf": true,
        "checked": false
    }]
}]}

You can only have a checkbox in the tree but you can always write your own extension :)

A: Well, i'm brb on this thread for give a little function. put that on your tree and normaly you have checkbox with radio behavior.
            listeners: {
                'checkchange': function( n, check )
                {
                    if( check )
                    {
                        var p = n.parentNode;

                        p.eachChild( function( c )
                        {
                            if( c.isLeaf() && c.get('checked') )
                            {
                                c.set('checked', false);
                            }
                        });

                        n.set('checked', true);
                    }
                    else
                    {
                        n.set('checked', false);
                    }
                }
            }


text:
Q: Why is Next.js's compile indicator showing up in my production build? I noticed after building and deploying a Next.js website that the black compile indicator still shows up in the bottom-right of my browser like it would locally.
This indicator: https://i.stack.imgur.com/FVWEU.gif
On Next.js's website:

This indicator is only present in development mode and will not appear when building and running the app in production mode.

Even locally when I run yarn build and yarn start, the indicator displays while the page loads.
During the build process, it says:

Creating an optimized production build
Done in 20.89s.

My concern isn't so much that the indicator is displaying, because I can disable it. I'm concerned that I'm not getting an optimized build since something is displaying that should only be displaying in development mode.
Note: I can't share a link to the website as it is work-related.
Has anybody seen this issue before?
Thanks in advance!
Technical information:
Next.js Version 12.1.1
Dockerfile:
FROM node:16.13.0-alpine

# Install packages.
WORKDIR /app
COPY package.json .
COPY yarn.lock .
RUN yarn install

# Copy all other files.
COPY . .

# Build the app.
RUN yarn build

# USER node
EXPOSE 3003
CMD ["yarn", "start"]

package.json (scripts block):
"scripts": {
    "dev": "node ssr-server.js",
    "build": "next build",
    "test": "node_modules/.bin/jest",
    "test:coverage": "node_modules/.bin/jest --coverage",
    "test:watch": "node_modules/.bin/jest --watch",
    "start": "node ssr-server.js"
},

A: In the custom server JavaScript file, there should be a line that check if the environment is development or production:
const dev = process.env.NODE_ENV !== 'production'

update the start script in package.json to set that environment variable:
"scripts": {
  "dev": "node server.js",
  "build": "next build",
  "start": "NODE_ENV=production node ssr-server.js"
}


text:
Q: Realtivelayout add in tablerow Its not giving me any thing.. where i miss something any one help me to sort out it not showing the image as well the textview that i add to the relative layout
     RelativeLayout.LayoutParams tParams = new RelativeLayout.LayoutParams
                 (LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
         tParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
         tParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);

         LayoutParams rlParams = new LayoutParams(LayoutParams.FILL_PARENT
                 ,LayoutParams.FILL_PARENT);

                    for (int i=0; i < Math.ceil(MyContants.servicemodellist.size() / 2); i++) {
                        TextView txt= new TextView(RoomservicsFirstPage.this);
                        txt.setText(MyContants.servicemodellist.get(i).getOption_text_1());

                         RelativeLayout rLayout = new RelativeLayout(RoomservicsFirstPage.this);
                         txt.setLayoutParams(tParams);
                         rLayout.setLayoutParams(rlParams);
                            // Adding the TextView to the RelativeLayout as a child
                        ImageView image = new ImageView(RoomservicsFirstPage.this);

                         image.setLayoutParams(rlParams);
                         download(MyContants.servicemodellist.get(i).getImage(),image);
                         rLayout.addView(image);
                         rLayout.addView(txt);
                        rows.addView(rLayout);

}
I solve My problem.. i am not add the layout parameters when add the layout in the tow :)

A: package com.example.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class MainActivity extends Activity {
    TableRow rows;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        rows = (TableRow) findViewById(R.id.rows);
        RelativeLayout.LayoutParams tParams = new RelativeLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
        tParams.addRule(RelativeLayout.ALIGN_LEFT);

        for (int i = 0; i < 10; i++) {
            TextView txt = new TextView(this);
            txt.setText("" + i);
            txt.setId(i + 1);
            RelativeLayout rLayout = new RelativeLayout(this);
            txt.setLayoutParams(tParams);
            // Adding the TextView to the RelativeLayout as a child
            ImageView image = new ImageView(this);
            image.setImageResource(R.drawable.ic_launcher);
            RelativeLayout.LayoutParams iParams = new RelativeLayout.LayoutParams(
                    20, 20);
            iParams.addRule(RelativeLayout.RIGHT_OF, i + 1);

            image.setLayoutParams(iParams);
            rLayout.addView(image);
            rLayout.addView(txt);
            rows.addView(rLayout);
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
}


text:
Q: ANSI C: Declare a pointer of type "array of string" I have a structure like this
struct {
  int    id;
  char   str00[10];
  char   str01[10];
  char   str03[10];
  char   str04[10];
  ...
}   myStructure;

All strXX have the same size. I would like to access them via an array (strArray), like this :
strcpy(strArray[i], strValue);

How to declare strArray ?
I used this:
char   (*strArray)[][10] = (void *)&myStructure.str00;

It's working, but I have to code the strcpy like this
strcpy((*strArray)[i], strValue);

... and I don't like this :-)
Is there another way to declare strArray ?
Thanks for your ideas and help.

A: You almost had it, the correct pointer type is simply char (*ptr)[10].
Naively, you could use this pointer type to iterate over the struct members, but doing so would invoke undefined behavior. Because strictly speaking, a pointer can only point at single item or an array, and if we use pointer arithmetic to go beyond that single item/array, we invoke undefined behavior.
I'll include an example still, for the sake of demonstrating array pointer arithmetic:
// BAD CODE, it relies on undefined behavior!

#include <stdio.h>
#include <string.h>

typedef struct {
  int    id;
  char   str00[10];
  char   str01[10];
  char   str02[10];
  char   str03[10];
} myStructure;

int main(void)
{
  myStructure ms = { 0 };
  char (*ptr)[10] = &ms.str00;

  for(size_t i=0; i<4; i++)
  {
    strcpy(ptr[i], "hello ");
    strcat(ptr[i], (char[]){i+'0', '\0'});
  }

  puts(ms.str00);
  puts(ms.str01);
  puts(ms.str02);
  puts(ms.str03);

  return 0;
}

The proper solution is to instead use a union, so that you can access the members either individually, or as an array:
typedef union {
  struct              // anonymous struct, requires a standard C compiler
  {
    char str00[10];
    char str01[10];
    char str02[10];
    char str03[10];
  };
  char array[4][10];
} str_t;

typedef struct {
  int    id;
  str_t  str;
} myStructure;

strcpy(ms.str.array[i], ...); // access as array
puts(ms.str.str00); // access as individual item

A: The cleanest way to define strArray as requested would be to make it an array of pointers to the (first elements of the) arrays in myStructure:
char *strArray[] = { myStructure.str00, myStructure.str01, myStructure.str03, myStructure.Str04, … };

With this definition, strArray[i] is initialized to the corresponding member of the structure, such as myStructure.str01. Note that myStructure.str01 will be automatically converted to a pointer to its first element, so strArray[i] is a pointer to the first char in one of the arrays.
Then strArray[i][j] is char j of array i.
(Incidentally, you skip str02 in your sample code. I do not know why but have retained that in the code above.)
An alternative method would be to use a union, which can be done in various ways, one of which is:
struct
{
    int    id;
    union
    {
        struct
        {
            char   str00[10];
            char   str01[10];
            char   str03[10];
            char   str04[10];
            ...
        };
        char strArray[number of arrays][10];
    };
} myStructure;

That is generally a poor design, as it is needlessly confusing. (While this has a technical possibility of failure due to padding between the individually defined arrays, assertions can be used to ensure this does not occur, or rather to detect when it does.)
Most often, we would simply define the strings as an array of arrays:
struct
{
    int id;
    char str[number of arrays][10];
} my Structure;

Then the members would always be referred to by index, such as myStructure.str[1], and not by individual names, such as myStructure.str01.


text:
Q: For-each and assigning to a 2d array Java I'm using a for-each loop to move through a 2d array of chars in a basic java program. It works, except for a small part at the end. Here is my class:
static String letters = "abcdefghijklmnopqrstuvwxyz";

public static boolean checkIsNumeric(String s) {
    boolean haveBeenNonDigitCharacters = false;
    char[] chars = s.toCharArray();
    for(char c : chars)
        if(!Character.isDigit(c)) {
            haveBeenNonDigitCharacters = true;
            break;
        }

    if(haveBeenNonDigitCharacters)
        return false;
    else
        return true;
}

public static char[][] createArray() {
    String height;
    String width;
    Scanner s = new Scanner(System.in);
    do {
        System.out.println("How tall do you want the array to be?");
        height = s.next();
    } while(!checkIsNumeric(height));
    do {
        System.out.println("How wide do you want the array to be?");
        width = s.next();
    } while(!checkIsNumeric(width));

    int intHeight = Integer.parseInt(height);
    int intWidth = Integer.parseInt(width);

    char[][] chars = new char[intWidth][intHeight];

    for(char c[] : chars) {
        for(char d : c)
            d = ' ';
    }

    return chars;
}

public static char[][] fillArray(char[][] a) {
    int counter = 0;
    for(char c[] : a) {
        for(char d : c) {
            if(counter >= 26)
                counter = 0;
            d = letters.charAt(counter);
            counter++;
        }
    }
    return a;
}

public static void main(String[] args) {
    char[][] chars = createArray();
    chars = fillArray(chars);

    for(char c[] : chars) {
        for(char d : c) {
            System.out.print(d);
            if(d == ' ')
            System.out.print("a");
        }
        System.out.println("");
    }
}

Basically, what I want to do, is take any 2d array with user-specified dimensions, and fill it with the letters of the alphabet over and over until it is full. The checkIsNumeric method just checks to see if a String is numeric, the createArray method creates the 2d array with the user-specified dimensions, and the fillArray method fills the array with letters from the string. But when I loop through the array at the end of main and print each character, nothing gets printed. Why?

A: Change fillArray to:
public static char[][] fillArray(char[][] a) {
    int counter = 0;

    for (int i = 0; i < a.length; i++) {
        for (int j = 0; j < a[i].length; j++) {
            if(counter >= 26)
                counter = 0;
            a[i][j] = letters.charAt(counter);
            counter++;
        }
    }

    return a;
}

So that the actual array a is being modified and not the copies created by the for-each loop.
Which will give the output (which I assume is correct):
How tall do you want the array to be?
5
How wide do you want the array to be?
4
abcde
fghij
klmno
pqrst

Same goes for createArray if you want each char to be initialised to ' '. In main, if you cast d as an int and print it you'll see that each char is set to it's initial
value of 0.

A: You are assigning a char (d) the value ' ', then the scope of d goes away. You are not assigning the array's value anything.

A: In general: the problem is, that you can't assign new values to the variable defined in a for-each loop, and expect that the underlying data structure that is being iterated over gets modified. For instance this code has no effect on the array:
int[] array = {1, 2, 3};

for (int e : array)
    e = 0;          // array doesn't change!

For actually modifying the array, you need to do this:
for (int i = 0, n = array.length; i < n; i++)
    array[i] = 0;   // now all elements in array are zero


text:
Q: How do i fix a unexpected T string? - PHP My script comes on with an unexpected t string on line five how do i fix this?
<?php
include_once("../scripts/config.php");

$url = mysql_real_escape_string('$_POST['url']'); // LINE 5!

preg_match("/id=(\\d+)/", $url, $matches);
$like = $matches[1];
$current_pop = mysql_query("SELECT pop FROM likes WHERE id=$like") or die ("Query failed: " . mysql_error());

$pop = $current_pop + 1;

$update = mysql_query("UPDATE likes SET pop = ".$pop." WHERE id = ".$like."") or die ("Query failed: " . mysql_error());

?>

A: It should be:
$url = mysql_real_escape_string($_POST['url']);

Otherwise PHP sees '$_POST['url']', and thinks of it as consisting of 3 parts:

*

*'$_POST[' - a string,

*url - a token of some sort

*']' - another string

This confuses the interpreter, as it doesn't know what to do when a string is followed by an url-token.

A: Your code has SQL injection vulnerabilities. Please review this before someone steals all your customer's info off of your site: http://en.wikipedia.org/wiki/SQL_injection


text:
Q: How can we measure the coupling loss in a fused fiber Y coupler? I'm trying to understand how the (power) loss in optical fibre works and I'm having some trouble.

This is a classic 50/50 fused fibre Y coupler. The output on port 2 is the same as port 3 (so half the power of port 1 plus the losses).
The losses considered here are the coupling loss (same for each port) and the radiated loss at the point of the split. We want to measure the coupling loss.
So my first idea would be to go from port 2 and measure the loss. However, while the radiated loss might be smaller, it seems unlikely that it would completely bypass it. Going from port 3 would bring the same result.
So is there any way I can measure the coupling loss in this configuration?


text:
Q: Fedex Shipping Method Issue in Magento 1.7.0.2 I have configured fedex shipping method in admin panel,
I have entered valid account id, meter number, key, password sent from Fedex to registered Email.

There is no option showing in checkout page shipping method section after configurations. I can see below response in log file.
[result] => stdClass Object
(
    [HighestSeverity] => ERROR
    [Notifications] => stdClass Object
        (
            [Severity] => ERROR
            [Source] => crs
            [Code] => 803
            [Message] => Meter number is missing or invalid.
            [LocalizedMessage] => Meter number is missing or invalid.
        )

    [Version] => stdClass Object
        (
            [ServiceId] => crs
            [Major] => 10
            [Intermediate] => 0
            [Minor] => 0
        )
)

I have used valid credentials, I tried the websearch with above error code and error message but no solution found.
What i am doing wrong with this?
Any help much appreciation!
Thanks