text:
Q: EF Core 6 Generating faulty SQL for interpolated stored procedures using SqlParameters I have a SQL Server stored procedure with multiple parameters
ALTER PROCEDURE [dbo].[BUP_BankUpload]
    @SPP_ProcessID uniqueidentifier,
    @SPP_FileName NVARCHAR(250) = '',
    @SPP_UploadInputType int,
    @SPP_UploadOutputType int,
    @SPP_CheckPreviousProcessing bit = 0,
    @SPP_BankPeriod NVARCHAR(100) = '',
    @SPP_BankName NVARCHAR(50) = 'Option'

I am calling it via EF Core 6 using SqlParameter and an interpolated query:
    SqlParameter[] sqlParams =
    {
          new SqlParameter("SPP_ProcessID", SqlDbType.UniqueIdentifier) { Value = Guid.NewGuid() },
          new SqlParameter("SPP_FileName", SqlDbType.NVarChar) { Value = bankFileName },
          new SqlParameter("SPP_UploadInputType", SqlDbType.Int) { Value = 1 },
          new SqlParameter("SPP_UploadOutputType", SqlDbType.Int) { Value = 1 },
          new SqlParameter("SPP_CheckPreviousProcessing", SqlDbType.Bit) { Value = true },
          new SqlParameter("SPP_BankPeriod", SqlDbType.NVarChar) { Value = bankPeriod != null ? bankPeriod : "None"},
          new SqlParameter("SPP_BankName", SqlDbType.NVarChar) { Value = bankName}
    };

List<BankUploadModel>  BankUploadSQL = applicationDbContext.BankUpload.FromSqlInterpolated($"BUP_BankUpload {sqlParams[0]}, {sqlParams[1]}, {sqlParams[2]}, {sqlParams[3]}, {sqlParams[4]}, {sqlParams[5]}, {sqlParams[6]}").ToList();

This generates the following SQL:
exec sp_executesql N'BUP_BankUpload @SPP_ProcessID, @SPP_FileName, @SPP_UploadInputType,
@SPP_UploadOutputType, @SPP_CheckPreviousProcessing, @SPP_BankPeriod, @SPP_BankName',
N'@SPP_ProcessID uniqueidentifier,@SPP_FileName nvarchar(65),@SPP_UploadInputType int,@SPP_UploadOutputType int,
@SPP_CheckPreviousProcessing bit,@SPP_BankPeriod nvarchar(4),@SPP_BankName nvarchar(5)',
@SPP_ProcessID='87DD543E-64F1-4C7A-A35B-82441B034B15',
@SPP_FileName=N'Processed_txns20060198-29Jan2022-05Feb2022_Final_(01-02-2022).csv',
@SPP_UploadInputType=1,
@SPP_UploadOutputType=1,
@SPP_CheckPreviousProcessing=1,
@SPP_BankPeriod=N'None',
@SPP_BankName=N'Bank1'

Which, when run, throws the following error:

Msg 8114, Level 16, State 1, Procedure BUP_BankUpload, Line 0 [Batch Start Line 0]
Error converting data type nvarchar to date.

Which is impossible because there is no conversion of string to date in the stored procedure.
When I modify the SQL statement by removing the parameterization metadata as follows:
exec sp_executesql N'BUP_BankUpload
@SPP_ProcessID=''87DD543E-64F1-4C7A-A35B-82441B034B15'',
@SPP_FileName=N''Processed_txns20060198-29Jan2022-05Feb2022_Final_(01-02-2022).csv'',
@SPP_UploadInputType=1,
@SPP_UploadOutputType=1,
@SPP_CheckPreviousProcessing=1,
@SPP_BankPeriod=N''None'',
@SPP_BankName=N''Bank1'''

With the same parameters, it works correctly.
Can anybody point me in the right direction as to what is going on here?,


text:
Q: How to calculate difference for only first value in a group? I have a pandas dataframe
ticket num loadtype   start                   diff                       end
2       1   FIRST   12/28/18 7:40 PM    0 days 06:05:48.928732000   12/29/18 1:45 AM
2       2   MIDDLE  12/28/18 7:40 PM    0 days 09:21:17.652138000   12/29/18 5:01 AM
2       3   LAST    12/28/18 7:40 PM    0 days 13:11:39.585263000   12/29/18 8:51 AM
4 .     4 . FIRST   12/29/18 7:00 AM .  1 days 00:00:00.000000000   12/30/18 7:00 AM

The dataframe is grouped by 'ticket', which has multiple loads. I want to only calculate the difference between end and start for the FIRST load of each ticket, and persist that through all the rest of the loads for that ticket.
So I want
ticket num loadtype   start                   diff                       end
2      1    FIRST   12/28/18 7:40 PM    0 days 06:05:48.928732000   12/29/18 1:45 AM
2      2    MIDDLE  12/28/18 7:40 PM    0 days 06:05:48.928732000   12/29/18 5:01 AM
2      3    LAST    12/28/18 7:40 PM    0 days 06:05:48.928732000   12/29/18 8:51 AM
4 .    4 .  FIRST   12/29/18 7:00 AM .  1 days 00:00:00.000000000   12/30/18 7:00 AM

How would I do this in pandas? Would I have to use a groupby followed by an apply of some sort?

A: This only works if your ticket groups appear in the given order
# preset with na Time
df['diff'] = pd.NaT

# update the FIRST loadtype
df.loc[df.loadtype.eq('FIRST'),'diff'] = (df['end'] - df['start'])

# ffill
df['diff'] = pd.to_timedelta(df['diff'].ffill())

Output:
   num loadtype               start     diff                 end
0    1    FIRST 2018-12-28 19:40:00 06:05:00 2018-12-29 01:45:00
1    2   MIDDLE 2018-12-28 19:40:00 06:05:00 2018-12-29 05:01:00
2    3     LAST 2018-12-28 19:40:00 06:05:00 2018-12-29 08:51:00

redpajama_set_name: RedPajamaStackExchange


text:
Q: css li background problem I have a vertical menu with a background. I need to shift the background to the right and in the center from top but an unable to do this.  http://www.tiikoni.com/tis/view/?id=b0b07d2
ul.nav
{
 margin:0; background-position:center;  background-image: url(../images/nav_bg.gif);font-family: "Century Gothic"; height:40px; padding-left:30px;
}
ul.nav  a{
height:19px;color:white;display:inline-block;font-family:Century Gothic,Arial;font- size:14px;padding:8px 20px 0 ;text-decoration:none !important;vertical-align:middle;
}
ul.nav  a:hover
{
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;background-image: url(../images/nav_over.gif);
background-position: center top;background-repeat: no-repeat;text-decoration:none !important;vertical-align:middle;
}
* html ul.nav a
{
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;text-decoration:none !important;vertical-align:middle;
}
 ul.nav  a.highlight{
color:white;display:inline-block;font-family:Century Gothic,Arial;font-size:14px;height:19px;text-decoration:none !important;vertical-align:middle;
}
ul.nav li{
    display: inline;
    color:#FFF;
    background-image: url(../images/white_dotline.gif);
    background-repeat: no-repeat;
    background-position:right center;
    font-size:14px;
    padding:8px 1px;
    font-family:"Century Gothic";
    height:19px;
    [height:19px;
    height:20px;]/*Google Chrome, Opera and newer Safary 4+*/
    }

A: The horizontal and vertical position is controlled by the background-position property. The first number defines the horizontal position and the second the vertical position.
Words can be used for horizontal such as left, right and center and for vertical it is top, bottom and center.  Absolute positions can be used also, such as pixels or ems, as well as percentages.
For example:
background-position: right top; /* positioned to the right and the top */
background-position: 100% 0; /* positioned 100% to the right and zero from the top (the same as above) */
background-position: 50px 200px; /* positioned 50px from the left and 100px from the top */

A: You have specified a single value for the background position, which means that it's used for horisontal positioning, and the vertical positioning is set to 50%. You should specify two values to control both positions. Example:
background-position: left center;


text:
Q: Text classifier training data not properly loaded via spacy debug-data CLI Background
I am trying to train a multiclass (Labels are mutually exclusive) text classification model in Spacy in a Google Colab notebook.
The classes are

*

*POSITIVE

*NEGATIVE

*NEUTRAL

I formed the training data to the annotation format specified here
The following is a sample of annotations I made
[.
.
["Happy #MothersDay to all ... ", {'cats': {'NEUTRAL': 1.0}}],
["Happy mothers day ..", {"cats": {"POSITIVE": 1.0}}],
.
.]

Problem
When I try to debug my data using the debug-data option in spacy CLI with the following command (done in a Jupyter notebook)
%%bash
(python -m spacy debug-data en \
    /content/drive/My\ Drive/Spacy/Pretrained/train_clas.json \
    /content/drive/My\ Drive/Spacy/Pretrained/eval_clas.json \
    -p 'textcat' \
)

I get the following output
=========================== Data format validation ===========================
✔ Corpus is loadable

=============================== Training stats ===============================
Training pipeline: textcat
Starting with blank model 'en'
0 training docs
0 evaluation docs
✘ No evaluation docs
✔ No overlap between training and evaluation data
✘ Low number of examples to train from a blank model (0)

============================== Vocab & Vectors ==============================
ℹ 0 total words in the data (0 unique)
ℹ No word vectors present in the model

============================ Text Classification ============================
ℹ Text Classification: 0 new label(s), 0 existing label(s)
ℹ The train data contains only instances with mutually-exclusive
classes.

================================== Summary ==================================
✔ 2 checks passed
✘ 2 errors

It could not read the data properly but I have checked the files and I have atleast 1000+ samples like above.
Links to train and eval jsons.
I can not find any error in my data, Can someone point to the error?, Thanks in advance!

A: The spacy debug-data command expects data in spacy's internal JSON training format, described here: https://spacy.io/api/annotation#json-input
There are some examples here: https://github.com/explosion/spaCy/tree/master/examples/training/textcat_example_data . The conversion script in the same directory shows how to convert from a JSONL format that's very similar to the TRAIN_DATA-type format used in the example scripts.

A: Adding latest debug data command for reference
!python -m spacy debug data ./config.cfg


text:
Q: server can't recognize CentOS6.5 booting USB-disk burned with `dd` command I burned a boot USBkey with the command(from CentOS wiki):
dd if=CentOS-6.5-x86_64-bin-DVD1.iso of=/dev/sdb

After the command, I found my USBkey has beened wipe all partitions and it showed entirely freespace of my USB. However, I could find the USB-booting option in my computer's BIOS after rebooting and it shows the installation UI, and thus I think it will work on server too.
So I reboot my server lenovo x3650m5(PS: I have found that RHEL6 support the server, so CentOS is supposed to support it), but it failed-it found the USB, but it couldn't load the booting system.
Did I miss anything needed for the boot operation on the server?

A: I have heard people say that some USB sticks boot after dd and some don't, and have had the same experience myself - seems some combinations of USB/motherboard work, and some don't.
Try a different USB stick.

A: It seems that it is the server can't recognize any bootinUSB burned by dd, and I finnally walked around the problem by using rufus to burn again on win10.


text:
Q: Get Form Action in a Controller Hello currently I have a html form like that:

    <form name="myForm" action="/a/url">
     ....
     </form>
     <button ng-click="next(myForm)">Klick me</button>

is there a way to access the form action ?

A: what i suggest you not to provide action name in the form, instead of that within ng-click action javascript method in JS file either use $http service or $window service.
This can happen with the following htmlcode:

     <button ng-click="next(myForm)">Klick me</button>

JS Code:
$scope.next = function (formObject) {
// whatever you want to do
}

$scope will pick all the object defined within form tag.
I am also new in ng, if anything wrong here please correct me.


text:
Q: Преобразование метода в Func Как преобразуется метод, что можно использовать Func<TResult>? И почему Func<TResult> требует статических полей или методов?
Func<int> func = () => Factorial(5);

static int Factorial(int x) {
    int result = 1;
    for(int i = 1;i <= x;i++)
        result *= i;
    return result;
}


text:
Q: Retrieving drop down box selection in php I am trying to retrieve user selection from the following:
UserInterface.php
 <form name="formname" method="post" action="index.php">
    <div id='userList'>

        <?php
        //get constants for database
        require("database.php");

        // Opens a connection to a MySQL server
        $connection = mysqli_connect ($server, $username, $password);
        if (!$connection){
            die('Not connected : ' . mysqli_error());
            }

        // Set the active MySQL database
        $db_selected = mysqli_select_db($connection, $database);
        if (!$db_selected) {
            die ('Can\'t use db : ' . mysqli_error($connection));
        }

        $query = "SELECT distinct user FROM route";
        $result = mysqli_query($connection, $query);

            echo '<select name="box" style="width:400px;">';

                $count = 1;

               while($r = mysqli_fetch_assoc($result)){
                echo "<option =".$count.">".$r['user']."</option>";
                $count++;
            }
            echo '</select>';
            ?>
        <input type="submit" id="button" value="Get Started!"/>

I wish to use it in Map.php where I will perform a sql query which in turn is used to produce XML.
Map.php
//get constants for database
require("database.php");

// Start XML file, create parent node
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);

// Opens a connection to a MySQL server
$connection = mysqli_connect ($server, $username, $password);

//$user value dependant on user selection from dropdown menu
$query = "SELECT * FROM route WHERE user ='$selected'";
$result = mysqli_query($connection, $query);
if (!$result){
  die('Invalid query: ' . mysqli_error($connection));
}

//set header to xml
\header("Content-type: text/xml");

// Iterate through the rows, adding XML nodes for each
while ($row = mysqli_fetch_assoc($result)){
  // ADD TO XML DOCUMENT NODE
  $node = $dom->createElement("marker");
  $newnode = $parnode->appendChild($node);
  $newnode->setAttribute("lat", $row['lat']);
  $newnode->setAttribute("lng", $row['lng']);
  $newnode->setAttribute("alt", $row['alt']);
  $newnode->setAttribute("id", $row['id']);
  $newnode->setAttribute("user", $row['user']);
}

echo $dom->saveXML();

Map.php is then used in index.php (my web main page where everything happens) as I use ajax to retrieve the xml from Map.php using downloadUrl method.
index.php
downloadUrl("Map.php", processXML);

I have been continually trying to get the drop down value back for use in Map.php but I cannot quite get it. I have looked at options such as:
$user = $_POST['box'];

and
session_start();
$_SESSION["user"] = $_POST['box'];

I have also tried posting the data straight to Map.php and redirecting to index.php but this did not work. I assume this may be because I am using Map.php within index.php thereby creating a loop of sorts?!
Is there a way to post the data to Map.php and then redirect to index.php only once?!
I apologise if this is incoherent and a bit of a mess, it's very late and I'm very stressed with this problem.
Any help or pointers would be truly appreciated - thanks!


text:
Q: When the reason for doing something is... Nothing I was explaining to a non-native speaker the difference between inspiration and motivation.

Inspiration - the reason for doing something comes from somewhere inside you.
Motivation - the reason for doing something comes from something outside you.

Then I was asked, "What if the reason is fear?"
So I explained, inspiration and motivation have a positive association. If the reason is because of anything negative or bad, better use motive
To which she replied, "What if there is no reason?"
I was a bit stuck. So I said, "Everything happens for a reason." I gave 2 examples:

Preservation - do it to keep what you have
Desperation - do it because of lack of other options

To which she followed up (paraphrasing here): "What if you do it because that's what you did before, even if the initial reason is now gone?"
I was stuck again. I thought maybe perseverance or persistence, but I was hoping for another -tion word ;)
So I'm here looking for thoughts on how to respond, other examples I can give, and corrections to what I've already said.

A: Your definitions are colorful but I don't think exclusive or necessarily correct.
If you cannot think of a real reason you would say that the reason remains elusive. I think fear is a motivation that comes from within, not without. The situation may threaten but it is up to you to be suitably inspired.
Reasons for doing things corresponding to Nothing are usually Habit, Tradition (via Damila) and not making waves.  You can go with Habituation if you really need a tion in it.

A:
What if you do it because that's what you did before, even if the initial reason is now gone?

That could be explained by the word conditioning:

[Merriam-Webster]
2 : a simple form of learning involving the formation, strengthening, or weakening of an association between a stimulus and a response

Ivan Pavlov became famous for his study of classical conditioning, where he trained a dog to salivate whenever a bell was rung at the same time it was given food. Eventually, the sound of the bell alone would cause the dog to salivate—even when there was no food.
It's also called a conditioned response.

Although conditioning doesn't end in tion, it does contain it, so it's at least similar in terms of structure. You might be able to use condition in a certain sentence, but it wouldn't quite fit into the simple one-word list used in the question.


text:
Q: Tar using progress bar and handling multi-volumes I'm trying to create a tar of a large LVM volume onto multiple external drives.  That part is solved.  Now, because it is a LONG process, I'd like a progress bar.  From the excellent articles here, I've gotten close.
The issue is that the PV bar quits after the first volume fills up.  I'd like PV to continue updating after disks are swapped.  Does someone have an idea about how to approach this?
Here's what I've tried.  I think the problem is in the last line of code.  I'm not sure this strategy will actually work with multi-volumes.
Code ExtBackup.sh:
#!/bin/sh

changedisk()
{
# This routine is called when tar runs out of disk space
# It simply waits for operator to change and mount disks
# then updates the file handle with a new volume number.
echo "Change disks now!"
read -p "Press <enter> when new disk is mounted. ..." NULL
echo ""

# Update the file name with the new volume number
name=`expr $TAR_ARCHIVE : '\(.*\)-.*'`
echo ${name:-$TAR_ARCHIVE}-Vol$TAR_VOLUME.tar >&$TAR_FD
}

###########
## MAIN  ##
###########

# Test for recursive call to change disks
if [ "$1" = 'changedisk' ]; then
        changedisk
        exit 0;
fi

# If this is initial call, set SIZE to calculate bytes in source
SIZE=`du -sb *Folder_Name* | cut -f 1`

# Now TAR it, using Multi-volume option and pipe through PV for progress bar
tar -cM -F 'sh ExtBackup.sh changedisk' *Folder_Name* | \
pv -s ${SIZE} > LVMBackup-$(date +%m-%d-%y)-Vol1.tar

A: Alright, it took me some time to understand what tar -F actually does (is that documented anywhere at all? I just ended up reading the source), but I think I came up with a pretty good solution for you.
Since pv doesn't support pretending that a certain progress has already been made, I needed to replace it with a similar tool called bar (available in Debian under that name, or see its hideous homepage).
The solution I found passes the data of all additional volumes through a named pipe (FIFO) to inject the bar invocation into the stream. To avoid printing each volume's progress bar in a new line, I use 'tput' to move the cursor back up after each volume.
In your code, you would replace the last line in changedisk() with the following.
(This is a bit hacky for the sake of brevity; just customize it once you get the idea)
tput cuu1 >&2 # clear previous progress bar
(cat somefifo | bar -ns \
    --size "$SIZE" \
    --completed $(((${TAR_VOLUME}-1)*${VOLSIZE})) \
    > ${name:-$TAR_ARCHIVE}-Vol$TAR_VOLUME.tar) &
echo somefifo >&$TAR_FD

And replace the pv invocation in the last line of your script with bar -ns --size ${SIZE}.
For this to work, you need to put export in front of the SIZE definition, and of course have executed mkfifo somefifo at some point beforehand. Make sure you also secure that FIFO's permission bits. You might also want to consider using mktemp to safely create a temporary pipe instead. Depends on your scenario, I guess.
I used an as-of-yet undefined variable $VOLSIZE that should expand to the size of your volumes in bytes. I'm not sure how this is determined in your setup. Maybe you need to do something more elaborate here, like keeping track of the cumulative sum of all the previous volume sizes.


text:
Q: pdflatex bash script to supress all output except error messages? I have a bash script which I use to compile a file with pdflatex twice (to make sure it sorts out references properly, etc.). This is the 'latexbuild' script I use:
module load ctan
pdflatex --shell-escape --interaction=nonstopmode $1
bibtex $1
pdflatex --shell-escape --interaction=nonstopmode --interaction=batchmode $1

I would then call this script with latexbuild test.tex. It produces a lot of output which I would like to supress, except for the error messages which I'd like to see. Is there any way to only allow error messages to be displayed?

A: The silence package provides a means for suppressing LaTeX package and class warnings and errors. For example, the command
\WarningFilter{latex}{Marginpar on page}

would suppress all warnings produced by latex that start with "Marginpar on page...". It is not always perfect, but it seems like something that might help in your case. You could also suppress all warnings (or errors) using \WarningsOff (or \ErrorsOff). Consider reading the package documentation for more of the filtering options.

A: The texfot Perl script by Karl Berry has been recently added to TeX Live; the command line
> texfot pdflatex eddy

where eddy.tex is
\documentclass{article}
\begin{document}

A purposely overfull line
\makebox[1.1\textwidth]{x}

And an error
\abcdefghi

\end{document}

will produce the following output on the terminal:
/usr/texbin/texfot: invoking: pdflatex eddy
This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013)
Overfull \hbox (156.0012pt too wide) in paragraph at lines 4--6
! Undefined control sequence.
l.8 \abcdefghi
! Emergency stop.
l.8 \abcdefghi
!  ==> Fatal error occurred, no output PDF file produced!
Transcript written on eddy.log.

Although the documentation asserts that the --interactive option allows for stopping at errors, this doesn't seem to work (maybe this will be fixed in a next release).
The "real" terminal output is available in $TMPDIR/fot or /tmp/fot if the TMPDIR environment variable is not set.

A: You could use the -file-line-error option and then grep the output for something of that form filename:##:error code (Below I just use the regex .*:[0-9]*:.*. Works decently well on a few tests.
Note, bibtex is run on the .aux file not the .tex file. For it, using the -terse option is probably sufficient.
Lastly I have no idea what your module load ctan does (--I have no such program--), so I excluded it.
#!/bin/bash
ARGUMENT="$1"
#determine aux name by stripping .tex suffix and adding .aux
AUXNAME="${ARGUMENT%.tex}.aux"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep ".*:[0-9]*:.*"
bibtex -terse "$AUXNAME"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep ".*:[0-9]*:.*"

You might want to play around with the -A and -B options to grep if you want some context surrounding the error messages, rather than just a single line.
I'd also play around with using if constructs or checking exit status to determine whether the last two steps should be done. (E.g., if an error is found in the first run, don't bother with the second, etc.) I can give more details if need be.
EDIT: Just saw your comment about warnings. The above will only catch true errors. I'm not sure there is a standard to warning messages, but grepping for the word "warning" might be good enough. so then it's something like:
#!/bin/bash
ARGUMENT="$1"
#determine aux name by stripping .tex suffix and adding .aux
AUXNAME="${ARGUMENT%.tex}.aux"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep -i ".*:[0-9]*:.*\|warning"
bibtex -terse "$AUXNAME"
pdflatex -shell-escape -interaction=nonstopmode -file-line-error "$ARGUMENT" | grep -i ".*:[0-9]*:.*\|warning"

A: Newb attempt that seems to be working on a few simple examples:
pdflatex a.tex | perl -0777 -ne 'print m/\n! .*?\nl\.\d.*?\n.*?(?=\n)/gs'

supposes that all errors are of form:
! Cryptic explanation
<maybe more cryptic explanations>
l.123 Undefined \asdfqwer
                          very very very very long line.

Please correct away.
EDIT
As answered by egreg after I posted, texfot seems to be a super advanced version of this attempt also based on "heuristic" regex filtering. Not in TeX Live 2013 ISO, but prefer that if you can use it.


text:
Q: MYSQLi UPDATE doesn't work unless I modify the first column I'm using mysqli with prepared statements and I tried to make a form to update the data from a row. But it only works when I modify the first column. I searched a lot and found nothing. The server doesn't display any errors, just does nothing if I don't modify the first field from the form.
I'm trying to make an online database of terms in guarani language. Now I'm writting a form to update a term information.
I have two pages: the first page is a form to search and select a term.
The id from selected term is passed to the second page.
The second page:
1° Verifies if the submit button from an update-form is sent in order to update the information of the term in the database, else
2° gets the id from selected term, which was passed from the first page, else
3° shows a message "you must select a term to modify it".
I reorganize better my code. I'm sorry for my english. I tried to translate some things to make the revision easier.
<!DOCTYPE HTML>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../css/ypy_style.css" />
<title>Introducir termino nuevo</title>

<?php include'zayvu_header.php';?>

Ayvu Ñemoambue

<?php
//*****************VERIFY IF  ENVIAR IS PRESSED***********************************

    //Comprueba si se presiono el boton ñemboguapy
    if(isset($_POST['enviar'])){ // SE HIZO ENVIAR

        include("../joapyra/aka_joaju_tuicha.php");
    include("../joapyra/aka_secure_data.php");

        // conectarse a la base de datos
    $dblink= new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

    // verificar la conexion
    if (mysqli_connect_error()) {
            echo "Ndaikatúi ñambojoaju base de datos rehe:". mysqli_connect_error();
            exit();
    }

    //Inicializa las variables a partir de los datos del formulario
    $id_seguro= secure_data($dblink, $_POST['idact']);
    $ayvu_seguro=  secure_data($dblink, $_POST['ayvu']);
    $heiseva_seguro=secure_data($dblink, $_POST['heiseva']);
    $nhenohehague_seguro=secure_data($dblink, $_POST['nhenohehague']);
    $ijepurupy_seguro=secure_data($dblink, $_POST['ijepurupy']);
    $ysajareko_seguro=secure_data($dblink, $_POST['ysajareko']);
    $nheejoapykuaa_seguro=secure_data($dblink, $_POST['joapykuaa']);
    $heijoja_seguro=secure_data($dblink, $_POST['heijoja']);
    $heiavy_seguro=secure_data($dblink, $_POST['heiavy']);
    $haimbohasa_seguro=secure_data($dblink, $_POST['haimbohasa']);
    $atygua_seguro=secure_data($dblink, $_POST['atygua']);
    $mboguapyhara_seguro=secure_data($dblink, $_POST['mboguapyhara']);
    $arange_seguro=secure_data($dblink, $_POST['arange']);

        //Comprueba si estan vacios los campos importantes
    if(empty($ayvu_seguro)|| empty($heiseva_seguro) || empty($mboguapyhara_seguro)){
        $error_message = "This fields: ayvu, he'iséva or mboguapyhára must be filled.";
        }else{ //ELSE SI NO ESTAN VACIOS

            if (!$stmt = $dblink->prepare("SELECT ayvu FROM ayvuryru WHERE ayvu=?")){

                $error_message = "error in the statement.";

            }else{
                // unir parametros con marcadores
                $stmt->bind_param("s", $ayvu_seguro);

                // ejecutar pedido
                $stmt->execute();

                // Almacenamos el resultado
                $stmt->store_result();

                // Obtenemos el número de filas que ha devuelto la consulta
                $NumeroRegistros = $stmt->num_rows;

                if ( $NumeroRegistros > 0 ) {

                        $error_message = "This ayvu is already registered.";

                }else{ //ELSE INSERTAR DATOS

                    if (!$stmt = $dblink->prepare("UPDATE ayvuryru SET ayvu= ?, heiseva= ?, nhenohehague= ?, ijepurupy= ?, ysajareko= ?, heijoja= ?, heiavy= ?, nheejoapykuaa= ?, haimbohasa= ?, atygua= ?, mboguapyhara= ?, arange= ? WHERE id= ?")) {

                                $error_message = "Error in the statement.";
                    }else{
                                // unir parametros con marcadores
                    $stmt->bind_param("sssssssssssss", $ayvu_seguro, $heiseva_seguro, $nhenohehague_seguro, $ijepurupy_seguro, $ysajareko_seguro, $heijoja_seguro, $heiavy_seguro, $nheejoapykuaa_seguro, $haimbohasa_seguro, $atygua_seguro, $mboguapyhara_seguro, $arange_seguro, $id_seguro);

                    // ejecutar pedido
                    $stmt->execute();

                                echo "The information of ayvu is updated";
            }
                }

            }

      } //ELSE SI NO ESTAN VACIOS

     //Cierra la conexion
     mysqli_close($dblink);

} else{
?>
<?php
//**********************GET DATA FROM FIRST PAGE**********************
?>

<?php
//Inicia la variable de error
$error_message = "";
$satisfactorio = "";

//Comprueba si se presiono el boton nhemboguapy
 if(!isset($_POST['selected_ayvu'])){

     echo "You must select an ayvu to modify it.";

     echo "
";
     echo "
";
     echo "";
     echo "";
 }else{
 ?>
<?php
//*****************IF A WORD IS SELECTED, PREPARES FORM TO UPDATE***********************
    $actualizable = $_POST['selected_ayvu'];
    echo $actualizable;
        include("../joapyra/aka_joaju_tuicha.php");
        include("../joapyra/aka_secure_data.php");

        // conectarse a la base de datos
    $dblink= new mysqli(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD, DB_DATABASE);

    // verificar la conexion
    if (mysqli_connect_error()) {
            echo "Ndaikatúi ñambojoaju base de datos rehe.". mysqli_connect_error();
            exit();
    }
        $id=secure_data($dblink, $_POST['selected_ayvu']);

        //prepara el statement
        if (!$stmt = $dblink->prepare("SELECT ayvu, heiseva, nhenohehague, ijepurupy, ysajareko, nheejoapykuaa, heijoja, heiavy, haimbohasa, mboguapyhara, arange, atygua FROM ayvuryru WHERE id=?")){

             $error_message = "Error in the statement.";

        }else{
            // Pasar los parametros a los marcadores
            $stmt->bind_param("s", $id);

            // Ejecutar el pedido
            $stmt->execute();

            // Almacenar los datos para poder usar num_rows
            $stmt->store_result();

            if( $stmt->num_rows <= 0) {
                echo "no se encontro nada.";
            }
            //unir resultado variables del resultado
            $stmt->bind_result($ayvu, $heiseva, $nhenohehague, $ijepurupy, $ysajareko, $nheejoapykuaa, $heijoja, $heiavy, $haimbohasa, $mboguapyhara, $arange, $atygua);
            //entregar resultado
            $stmt->fetch();
            ?>

Emyatyrõ ayvu rehegua ha upéi ejopy "ñemboguapy"pe.

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">

<fieldset class="ayvurehegua">
<?php

?>
<input type="hidden" value="<?php echo $id;?>" name="idact">
Ayvu
<input type="text" name="ayvu" value="<?php echo $ayvu;?>">

</fieldset>

<fieldset class="ayvurehegua">
Atygua
<input type="radio" name="atygua" value="tero" checked>tero
        <input type="radio" name="atygua" value="teroja">teroja
        <input type="radio" name="atygua" value="terarangue">terarängue
        <input type="radio" name="atygua" value="nheeteva">ñe'ëtéva
        <input type="radio" name="atygua" value="nheeteja">ñe'ëteja
        <input type="radio" name="atygua" value="nheeriregua">ñe'ëriregua

        <input type="radio" name="atygua" value="joajuha">joajuha
        <input type="radio" name="atygua" value="nheendyi">ñe'ëndýi
        <input type="radio" name="atygua" value="moteiha">moteïha
        <input type="radio" name="atygua" value="nheepehetai">ñe'ëpehëtai

He'iséva
<textarea name="heiseva" id="heiseva" cols="55" rows="2"><?php echo $heiseva; ?></textarea>

Ñenohehague
<textarea name="nhenohehague" id="nhenohehague" cols="40" rows="3"><?php echo $nhenohehague; ?></textarea>

</fieldset>

<fieldset class="ayvurehegua">
Ijepurupy
<textarea name="ijepurupy" id="ijepurupy" cols="55" rows="2"><?php echo $ijepurupy;?></textarea>

</fieldset>

<fieldset class="ayvurehegua">
Ysajareko
<textarea name="ysajareko" id="ysajareko" cols="55" rows="2"><?php echo $ysajareko;?></textarea>

Ñe'ejoapykuaa
<textarea name="joapykuaa" id="joapykuaa" cols="55" rows="2"><?php echo $nheejoapykuaa;?></textarea>

</fieldset>

<fieldset class="ayvurehegua">
He'isejoja
<input type="text" name="heijoja"  value="<?php echo $heijoja;?>">

He'ise'avy
<input type="text" name="heiavy" value="<?php echo $heiavy;?>">

</fieldset>

<fieldset class="ayvurehegua">
Haimbohasa
<input type="text" name="haimbohasa" value="<?php echo $haimbohasa;?>">

</fieldset>

<fieldset class="ayvurehegua">
Mboguapyhára
<input type="text" name="mboguapyhara" value="<?php echo $mboguapyhara;?>">

Arange
<input type="text" name="arange" value="<?php echo $arange;?>">

</fieldset>

<input type="submit" class="boton" value="nhemboguapy" name="enviar">  <input type="reset" class="boton" value="oï ypyva'ekue">

</form>

<?php

}

?>
<?php } // CIERRA ALTERNATIVA A NO SE ELIGIO AYVU ?>
<?php } // CIERRA ALTERNATIVA A VERIFICACION DE SI SE HIZO ENVIAR ?>
<?php } // CIERRA ALTERNATIVA A SI NO ESTA LOGUEADO ?>

A: Finally I found the problems. First, there were some variables, which names didn't match.
Second, after I checked that the fields $ayvu, $heiseva and $mboguapyhara were not empty. I have a piece of code that checks if $ayvu already exists in the database. If $ayvu exists it doen't update anything. There was the biggest problem. This part:
if (!$stmt = $dblink->prepare("SELECT ayvu FROM ayvuryru WHERE ayvu=?")){

                $error_message = "error in the statement.";

            }else{
                // unir parametros con marcadores
                $stmt->bind_param("s", $ayvu_seguro);

                // ejecutar pedido
                $stmt->execute();

                // Almacenamos el resultado
                $stmt->store_result();

                // Obtenemos el número de filas que ha devuelto la consulta
                $NumeroRegistros = $stmt->num_rows;

                if ( $NumeroRegistros > 0 ) {

                        $error_message = "This ayvu is already registered.";

Three days of headache to find my own mistake!


text:
Q: Google Map Android API v2 : GoogleMap is null I'm trying to explore using the MapView class for GoogleMap display, with no luck, as most codes examples are using MapFragment which I do not want.
I am using Google Maps Android API v2.
At first, just for testing with here from Google's example, I managed to get the typical normal map to display.
public class POnlineMapView extends Activity {

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.online_map_activity);
    }
}

The code above works perfectly which show that everything has been set up properly.
I am now trying to use the MapView class to manipulate the display settings such as the center point, but it seems like I am obtaining a null object everytime I try to obtain the GoogleMap object. Why is this so?
public class POnlineMapView extends Activity {

    private MapView myMapView;
    private GoogleMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        myMapView = new MapView(getApplicationContext());
        Bundle b = getIntent().getExtras();
        double longitude = b.getDouble("longitude");
        double latitude = b.getDouble("latitude");

        setContentView(R.layout.online_map_activity);
        map = myMapView.getMap();

        CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(latitude,longitude));
        CameraUpdate zoom=CameraUpdateFactory.zoomTo(17);

        map.moveCamera(center); //this gives a NullPointerException, probably due to the myMapView.getMap() method?
        map.animateCamera(zoom);
    }
}

A: Check whether Google Play Service are installed (and updated)
See Google Maps Android API v2 throws GooglePlayServicesNotAvailableException, out of date, SupportMapFragment.getMap() returns null
Please also read https://developers.google.com/maps/documentation/android/map (section Verify Map availability)

A: This seems like an old question, but I was having the same problem trying to use MapView.
Assuming you have properly imported the Google Play Services lib, you have to check if you have access to Google Services, you can do this in your onCreate method, and you have to initialize the Google Maps Android AP. you can do this by adding the following code to your onCreate method
try {
        MapsInitializer.initialize(this);
    } catch (GooglePlayServicesNotAvailableException e) {
        Log.e("Address Map", "Could not initialize google play", e);
    }

switch (GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) )
{
  case ConnectionResult.SUCCESS:
      Toast.makeText(getApplicationContext(), "SUCCESS", Toast.LENGTH_SHORT).show();
      break;
  case ConnectionResult.SERVICE_MISSING:
      Toast.makeText(getApplicationContext(), "SERVICE MISSING", Toast.LENGTH_SHORT).show();
      break;
  case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
      Toast.makeText(getApplicationContext(), "UPDATE REQUIRED", Toast.LENGTH_SHORT).show();
      break;
  default: Toast.makeText(getApplicationContext(), GooglePlayServicesUtil.isGooglePlayServicesAvailable(this), Toast.LENGTH_SHORT).show();
}

If you get SUCCESS, then everything is working so far.
You also have to implement the mothods of the Activity lyfecycle and call the corresponding methond of your map view inside every one of these methods:
@Override
protected void onResume() {
    myMapView.onResume();
    super.onResume();

}

@Override
protected void onPause() {
    myMapView.onResume();
    super.onPause();

}

@Override
protected void onDestroy() {
    myMapView.onDestroy();
    super.onDestroy();
   //((MapView)findViewById(R.id.mapView)).onDestroy();
}

@Override
public void onLowMemory() {
    super.onLowMemory();
    myMapView.onLowMemory();
}

Finally, you have to check that you have added your Google Maps API key to your Manifest file:
<meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="YOUR KEY"/>

you can find instructions to get your key here: https://developers.google.com/maps/documentation/android/start#installing_the_google_maps_android_v2_api
Edit:
Forgot to mention, you also have to set your applications permissions on the manifest file
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

This has to be set inside the application block  ...

A: Thanks, you finally gave me a clue to initialize the Map programatically, how stupid I oversaw it :)
Well, sometimes there is no option to use MapFragment (or SupportMapFragment alike), i.e. when you want to use the map from a fragment! This is actually a very common case when working with tabs (ActionBar) where the pattern is to use fragments. So you've got your own fragment per tab and in that fragment for a map you want to inflate your layout which contains a fragment for the MapFragment, et voila - good luck!
Now, according to the MapView specs it is no way said that using of the MapView is discouraged or deprecated, so why should I not use it? I did not want hacks in maintaining nested fragments without having support from SDK ( even the recent support lib v13 seems to have bugs and nested fragments from layout are not supported ), so using MapView turned for me into KISS.
Below is my CustomMapFragment I use with layout inflation (allowing complex layout) and embedded map, you're welcome to use it. You may also want to extend the Fragment from support-lib rather than SDK.
The onCreateView() method inflates the layout (just provide you're own) and expects the layout to have viewgroup (relativelayout,linearlayout,etc) with id "mapViewHolder" where the mapView will be attached to upon layout creation. The activity has to implement CustomMapFragment.Handler interface, otherwise ClassCastException will be thrown.
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.google.android.gms.common.GooglePlayServicesNotAvailableException;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.MapsInitializer;
import R;

public class AppMapFragment extends Fragment {
  /*
   * to interact with activity
   */
  public static interface Handler {
    void onMapResume(GoogleMap map);
  }

  private Handler handler;
  private MapView mapView;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try {
      // initialize explicitely, since we're working with MapView (not MapFragment)
      MapsInitializer.initialize(getActivity());
      this.mapView = new MapView(getActivity());
      this.mapView.onCreate(savedInstanceState);
    } catch (GooglePlayServicesNotAvailableException e) {
      Toast.makeText(getActivity(), "Please install Google Play Store and retry again!", Toast.LENGTH_LONG).show();
      getActivity().finish();
    }
  }

  @Override
  public void onResume() {
    super.onResume();
    this.mapView.onResume();
    this.handler.onMapResume(this.mapView.getMap());
  }

  @Override
  public void onPause() {
    super.onPause();
    this.mapView.onPause();
  }

  @Override
  public void onDestroy() {
    super.onDestroy();
    this.mapView.onDestroy();
  }

  @Override
  public void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);
    this.mapView.onSaveInstanceState(outState);
  }

  @Override
  public void onLowMemory() {
    super.onLowMemory();
    this.mapView.onLowMemory();
  }

  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);
    try {
      this.handler = (Handler) activity;
    } catch (ClassCastException e) {
      throw new ClassCastException("Your activity has to implement the interface " + this.handler.getClass().getName());
    }
  }

  public AppMapFragment() {
  }

  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_results_map, container, false);

    ((ViewGroup) rootView.findViewById(R.id.mapViewHolder)).addView(this.mapView);

    return rootView;
  }
}

A: One difference between MapFragment and MapView is that you have to manually manage the lifecycle of MapView, while MapFragment takes care of it by itself.
You must call the following methods from the parent Activity/Fragment's corresponding methods.
onCreate(Bundle)
onResume()
onPause()
onDestroy()
onSaveInstanceState()
onLowMemory()

I verified this with RawMapViewDemoActivity in samples of Google Play Services, which can be installed in the Extras section of Android SDK Manager.
The sample showed the map at first, and it showed a blank page once I commented out the 6 lines of mMapView.onXXX().
Maybe the lifecycle is the reason why most examples we see everywhere use MapFragment.

A: Try out this way:

  private MapView myMapView;
  private GoogleMap map;
      myMapView = (MapView) findViewById(R.id.map);
      if (map == null) {
                map = ((MapView) findViewById(R.id.map)).getMap();
       }

A: I didn't have luck with the map view either.
I did have luck with the MapFragment.
Try this:
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;

public class TestActivity extends FragmentActivity {

  SupportMapFragment mapFragment;
  GoogleMap map;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (mapFragment == null) {
      mapFragment = new SupportMapFragment();
      getSupportFragmentManager().beginTransaction()
          .add(android.R.id.content, mapFragment).commit();
    }
  }

  @Override
  protected void onResume() {
    super.onResume();
    setupMap();
  }

  private void setupMap() {
    if (map != null)
      return;
    map = mapFragment.getMap();
    if (map == null)
      return;

    doZoom();
  }

  private void doZoom() {
    if (map != null) {
      map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(45.424900,
          -75.694968), 17));
    }
  }
}


text:
Q: Jekyll URLs add leading slash when pushed to Github Pages I have successfully hosted on Github Pages. Today I was trying to run the site through browser-sync so I could view my changes faster, and noticed that my urls were different when served locally than on the actual website. Here's what the local url looks like:

Which when clicked on brings me to the page
http://localhost:3000/blog/blog/oven-baked-fajitas/

This same link, once it has been pushed to the Github repo and processed by them, turns into

Which works correctly.
I link to individual posts in my archive like this:

And my _config.yml is as follows:
name: Adam Hammes
description: Adam Hammes' Website
author: Adam Hammes
url: http://hammes.io
permalink: blog/:title/
excerpt_separator:
exclude: ["README.md", "gulpfile.js", "package.json", "node_modules"]

What I have tried:

*

*I added baseurl: "" to my _config.yml; no effect.

*I added baseurl: "/"; no effect.

*I added baseurl: "/", and changed the link format to {{ site.baseurl }}{{ post.url}}; this fixed the links locally, but resulted in 2 leading slashes live thus breaking the links.

A: I was using an old version of Ruby. By updating to Ruby 2 and then running gem install Jekyll I was able to get consistent behavior.


text:
Q: unix Diff utility - how to generates output file without < or >? I am using diff to see the differenceS between 2 files.
It generates the output like:
some numbers here
< gi|description1
< ADGCAAAGGCC
---
> gi|description3
> GGCCTAAGGGG

Can I produce the output like:
gi|description1
ADGCAAAGGCC
gi|description3
GGCCTAAGGGG

without < , > ,--- , the first numbers line ????
Thanks a lot.

A: Certainly you can modify the output of the diff utility to your liking. In the end it is a utility in the typical unix tradition, so one would expect it to be tweakable into all directions :-)
The "man page" explains the options and points out the ...-line-format options for this. Take a look yourself: man diff...
This leads to a command like this:
diff --unchanged-line-format="" --old-line-format="%L" --new-line-format="%L" file1 file2

It outputs only lines that have changed and for those simply the literal old and new form without any further indication marks. Which is what you want, according to your example.


text:
Q: How can I make a div appear only when a specific element gets clicked in jQuery? I'm making an HTML with multiple clickable Bootstrap panels. I want that, when a certain div/panel is clicked, only specific divs appear, like specific, with a class, to that panel.
Here is my jQuery code:
//document.ready
$(function () {

    if ($("#panel_1").data("clicked")) {
        alert("yes");
        $(".buscadoresInternet").show();
    } else {
        $(".buscadoresInternet").hide();
    }

    $("#panel_1").click(function () {
        $("#panel_1").data('clicked', true);
        alert("hes");
        console.log($("#panel_1").data("clicked"));
    });

    $("div [id^=panel_]").click(function () {
        //Esconde todos los divs con id = panel_n EXCEPTO el que fue clickeado
        $("div [id^=panel_]").not(this).toggle(function () { });
    })
 });

2° stuff is where my logic fails. In my mind, when panel/div with id panel_1 gets clicked, it stores its value like true, which works since it appears in the console.
Then, I'm just using a simple if statement, but neither the alert or the div I need to .show(); appears.

A: jQuery has a function for this.
$(document).ready(function(){
    $("#panel_1").click(function(){
        $(".buscadoresInternet").toggle();
    });
});

The toggle() function shows the element if it's hidden and hides the element if it's visible.


text:
Q: SSRS - How to Sum values on a LookUpSet expression Hi I have a column that uses a lookupset expression =Join(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0"), "ExecutionCount")).I'm getting an incorrect parameter when I sum that expression to =Join(Sum(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Format(Fields!cntSelfService.Value, "###,#######0")), "ExecutionCount")). The column to sum is cntSelfService. Please advise.

A: You have a few different issues with your expression.

*

*When you use the FORMAT function, the result is a string, not a
number.

*JOIN is used to concatenate strings from a table into a
single string which wouldn't help your issue.

*SUM will not work with a LookupSet

Unfortunately, there's not a built-in way to sum values from a LookupSet.
Luckily, users have had this issue for a while and someone created a function in Visual BASIC SumLookUp that will add the values from a lookupset. You add the code in the Report Properties --> Code tab.
Your expression would be:
=CODE.SumLookup(LookupSet(Fields!ReportUNC.Value, Fields!ReportUNC.Value, Fields!cntSelfService.Value, "ExecutionCount"))

See the code in: Need help in calculation using two Datasets using Expression SSRS


text:
Q: is there any way to know the pid of a launched program? if I launch a bash script as a child, I can pass its own pid to the parent by using $$.
Is there any way to find the pid of a program that I launch from a script in background
like:
ping x.x.x.x &

what's the pid of that ping ?
(I just hope I expressed my self correctly ... my English is not the best)
PS. I'm looking for a simple and clean solution, I can imagine something like:
ping -t10000 -W10 x.x.x.x &
then
ps ax | grep 'ping -t10000 -W10 x.x.x.x'$

but is too complicated, also even that I used switches to personalize it is not clean, it may catch another processes in the system

A: Use this: $! right after executing the command whose PID you want. It means, though that you need to use an ampersand (&) after the command, to start it in background. E.g.:
my_command & CMDPID=$!
echo "$CMDPID"

A: The variable $! has the PID of the last background process you started.


text:
Q: Unable to create organization and space in PCF using CLI I have created the PCF account in run.pivotal.io platform but not able to create org and space in UI as PCF is not allowing new account and showing the message "We will no longer be accepting any new PWS account sign-ups after September 17, 2020"
I tried creating the org and space from CLI(admin mode) but no luck.
ErrorMessage:
Creating org NP as ---@gmail.com...
You are not authorized to perform the requested action
FAILED.
while creating the user below are error logs:
"C:\Users\s\git\pcf-crash-course-with-spring-boot>cf create-user ------@gmail.com ss
Creating user --------@gmail.com...
Error creating user -----------@gmail.com.
Post https://uaa.run.pivotal.io/Users: read tcp 192.168.225.214:54659->3.220.155.194:443: wsarecv:
An existing connection was forcibly closed by the remote host.
FAILED"

A: You were never allowed to create new orgs on PWS using the cf cli. You were only ever allowed to create them through the Console. This is because of additional stipulations around requiring payment options to be set up for orgs & managing free trials.
That is irrelevant now though because PWS has been sunset. Here are the critical dates for the shutdown:

*

*New Pivotal Web Services account sign-ups will no longer be accepted after today, September 17, 2020.

*If you are consuming services offered through the AppDirect marketplace, please note that no new marketplace services will be available as of October 15, 2020.

*All existing AppDirect marketplace subscriptions will end on November 15, 2020.

*The end of availability (EOA) for Pivotal Web Services, effective as of January 15, 2021

For reference see this article:
https://blog.run.pivotal.io/pivotal-web-services-end-of-availability-announcement-and-timeline/
While the infrastructure for PWS still exists, it's very much closed to the public. That is why you cannot use the service anymore. Sorry.
If you are looking for migration options, I would encourage you to look at the Cloud Foundry Organization's List of Certified Providers. This list has other public providers you can use and because all of these platforms are certified compatible with Cloud Foundry, you should be able to use continue your existing tooling and configuration files to deploy your apps there.


text:
Q: Android exception: Runtime exception on launching login activity I'm an android newbie. I'm using the android studio and connecting to a device, 4.04, api 14. I created a default login activity. It throws up the following exception:
Launching application: com.noatta.www.noatta_14/com.noatta.www.noatta_14.LoginActivity.
DEVICE SHELL COMMAND: am start -n "com.noatta.www.noatta_14/com.noatta.www.noatta_14.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.noatta.www.noatta_14/.LoginActivity }
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.noatta.www.noatta_14/.LoginActivity } from null (pid=16079, uid=2000) not exported from uid 10127
at android.os.Parcel.readException(Parcel.java:1332)
at android.os.Parcel.readException(Parcel.java:1286)
at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1691)
at com.android.commands.am.Am.runStart(Am.java:451)
at com.android.commands.am.Am.run(Am.java:107)
at com.android.commands.am.Am.main(Am.java:80)
at com.android.internal.os.RuntimeInit.finishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:260)
at dalvik.system.NativeStart.main(Native Method)

Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.noatta.www.noatta_14" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".LoginActivity"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize|stateHidden" >
        </activity>

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>
    <!-- To access Google+ APIs: -->
    <uses-permission android:name="android.permission.INTERNET" />

    <!--
     To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
     option is required to comply with the Google+ Sign-In developer policies
    -->
    <uses-permission android:name="android.permission.USE_CREDENTIALS" />

    <!-- To retrieve the account name (email) as part of sign-in: -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

    <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />

</manifest>

Anybody have a suggestion on how to prevent the read exception?

A: You're missing <intent-filter> in activity definition:
<activity
    android:name=".LoginActivity"
    android:label="@string/app_name"
    android:windowSoftInputMode="adjustResize|stateHidden" >
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

A: You are missing the intent-filter and the exception states you were missing the android:exported="true" in your AndroidManifest.xml
<activity
       android:name=".LoginActivity"
       android:label="@string/app_name"
       android:windowSoftInputMode="adjustResize|stateHidden"
       android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>


text:
Q: Nginx - difference between root and alias? My goal is to have a Laravel installation running alongside a Nuxt application generated as static content.
I'd like for Laravel to be available, when the location start with /api. This works as expected.
For any other requests, I'd like to have Nginx serve me the static content from inside another folder.
I can achieve this by changing the document root at line 18 (root /var/www/html/public/dist;) and changing the following try_files configuration to what it states in the config below.
I tried switching root out for alias instead, and that gave me some funky results. I get a 500 server response from Nginx with the following output in the error log:
2020/09/29 13:28:17 [error] 7#7: *3 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 172.21.0.1, server: _, request: "GET /my/fake/url HTTP/1.1", host: "localhost"
172.21.0.1 - - [29/Sep/2020:13:28:17 +0000] "GET /claims/creat HTTP/1.1" 500 580 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.121 Safari/537.36" "-"

I have the following configuration (running inside a Docker container).
server {
    listen 80 default_server;

    root /var/www/html/public;

    index index.html index.htm index.php;

    server_name _;

    charset utf-8;

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }

    error_page 404 /index.php;

    location / {
        alias /var/www/html/public/dist;
        try_files $uri $uri/ /index.html;
        error_page 404 /400.html;
    }

    location ~ /api {
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ~ \.php$ {
        fastcgi_pass php:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

I'm not entirely sure what the difference is which also makes me question whether I should use alias or root in my case, and I would appreciate some help with understanding this.

A: The problem from your error message is with your try_files, not your root or alias. You tried to load a URL path that doesn't exist, and in a normal configuration nginx would just serve a 404 or try to load your web app's front controller. But your try_files tells it to serve /index.html instead. So it starts over trying to load /index.html and ends up at the same try_files, but that file doesn't exist either, so it gives the error rewrite or internal redirection cycle while internally redirecting to "/index.html" because it was already trying to load /index.html.
You should first fix try_files. Examples:
try_files $uri $uri/ =404;           # static site
try_files $uri $uri/ /index.php;     # PHP front controller

Now, to your secondary question.
root specifies the actual document root, the directory on the filesystem to serve static files from, which corresponds to the URL path /. For instance, if you have root /var/www/html/public and ask for a URL /css/myapp.css then this will map to the file path /var/www/html/public/css/myapp.css.
alias allows you to remap some URL path below the root to some other directory so that you can serve static files from elsewhere. For example, for a location /static/ you might define alias /var/www/html/files/. In this case, instead of going to a subdirectory of the root, the alias will be substituted for the part of the URL path in the location. So /static/ becomes /var/www/html/files/ and a request for /static/myapp.css will try to load the file /var/www/html/files/myapp.css instead of /var/www/html/public/css/myapp.css.
It doesn't make sense to use alias with location /. If necessary to define a different file path here, use root (but be aware that this can be an anti-pattern).


text:
Q: TypeError: () takes no arguments Вылетает ошибка import random

class Human:

    def __int__(self, name, satiety=50, food=50, money=0):
        self.name = name
        self.satiety = satiety
        self.food = food
        self.money = money

    def day(self, action):
        if self.satiety < 20 and self.food >= 10:
            self.satiety += 10
            self.food -= 10
            print(f'{self.name} поел.')
        elif self.food < 1 and self.money > 0:
            self.food += 20
            self.money -= 10
            print(f'{self.name} сходил в магазин.')
        elif action == 1:
            self.money += 50
            print(f'{self.name} работает.')
        elif action == 2:
            self.satiety += 10
            self.food -= 10
            print(f'{self.name} трапезничает.')
        else:
            self.satiety -= 10
            print(f'{self.name} играет.')

class Result:
    def __init__(self, man_1, man_2):
        self.man_1 = man_1
        self.man_2 = man_2

    def life_death(self):
        if self.man_1.satiety == 0 or self.man_2.satiety == 0:
            return True, print('Один из участников умер')

human_1 = Human('Степан')
human_2 = Human('Артур')

result = Result(human_1, human_2)
count_day = 0

while True:
    count_day += 1
    if count_day == 365:
        print('\nЭксперимент удался, все живы.')
        break
    elif result.life_death():
        break
    else:
        r = random.randint(1, 6)
        human_1.day(r)
        human_2.day(r)

print(count_day)

Подскажите пожалуйста. Уже все пересмотрел но на 43 и 44 строке вылетает TypeError: Human() takes no arguments Ума не приложу в чем может быть причина.

A: Вы просто вместо __init__ написали __int__, из-за чего интерпретатор решил, что у бедного класса нет конструктора. Если поменять эти строки, то программа должна будет заработать.
def __init__(self, name, satiety=50, food=50, money=0): # было — __int__
        self.name = name
        self.satiety = satiety
        self.food = food
        self.money = money


text:
Q: Tensorflow restore while ignoring scope name or into new scope name I had trained network N first and saved it with the saver into checkpoint Checkpoint_N. There were some variable scopes defined within N.
Now, I want to build a siamese network using this trained network N as below:
with tf.variable_scope('siameseN',reuse=False) as scope:
  networkN = N()
  embedding_1 = networkN.buildN()
  # this defines the network graph and all the variables.
  tf.train.Saver().restore(session_variable,Checkpoint_N)
  scope.reuse_variables()
  embedding_2 = networkN.buildN()
  # define 2nd branch of the Siamese, by reusing previously restored variables.

When I do the above, the restore statement throws a Key Error that siameseN/conv1 was not found in the checkpoint file for every variable in N's graph.
Is there a way to do this, without changing the code of N? I just basically added a parent scope to every variable and operation in N. Can I restore the weights to the right variables by telling tensorflow to ignore the parent scope or something?

A: This is related to: How to restore weights with different names but same shapes Tensorflow?
tf.train.Saver(var_list={'variable_name_in_checkpoint':var_to_be_restored_to,...'})
can take list of variables to restore or dictionary
(e.g. 'variable_name_in_checkpoint':var_to_be_restored_to,...)

You can prepare the above dictionary by going through all variables in current session variables, and use the session variable as value and getting the name of current variable, and remove 'siameseN/' from variable name and use as key. It should theoretically work.

A: I had to change the code a bit, to write my own restore function. I decided to load the checkpoint file as a dictionary with variable names as keys and the corresponding numpy array as values as below:
checkpoint_path = '/path/to/checkpoint'
from tensorflow.python import pywrap_tensorflow

reader = pywrap_tensorflow.NewCheckpointReader(checkpoint_path)
var_to_shape_map = reader.get_variable_to_shape_map()

key_to_numpy = {}
for key in var_to_shape_map:
  key_to_numpy[key] = reader.get_tensor(key)

I already had this single function where all variables are created, and which is called from the graph N with the name required. I modified it to initialize the variables using the numpy array obtained from the dictionary lookup. And, for the lookup to be successful, I just stripped off the parent name scope I added, as below:
init = tf.constant(key_to_numpy[ name.split('siameseN/')[1] ])
var = tf.get_variable(name,  initializer=init)
#var = tf.get_variable(name, shape, initializer=initializer)
return var

This is a much hackier way to do this. I didn't use the answer by @edit , because I had already written this above code. Additionally, all my weights are created in one function which assigns those weights to a variable var and returns it. Because this is akin to functional programming, the variable var keeps getting overwritten. var is never exposed to higher level functions. To use @edit's answer, I'd have to use a different tensor variable name for every initialization and expose those to higher level functions somehow, so that the saver can use them as var_to_be_restored_to in their answer.
But @edit's solution is the less hacky solution, as it adheres to the documented usage. So I'll accept that answer. What I did can be an alternative solution.


text:
Q: how to add multiple checkmarks to an li element I have a checkbox which i turned into a checkmark.It gets appended into multiple li statements,the problem i am having is that each li statement ends up with the same id element which results in only one element been checked.
i have attached a working jsfiddle as follows
https://jsfiddle.net/25er3cx9/1/
i tried to change the id to a class as follows:
<input type="checkbox" class="display:none" id="cb"  > // this is how it is currently

what i tried
<input type="checkbox" class="display:none cb" > // when i tried this it stops working,doesnt allow me to tick the checkmark

the above code gets added to my  elements
as follows
var list = $('

');
$.each(this.Markets, function () {
   list.append('
<input type="checkbox" class="display:none" id="cb" >' + this.Name + '
');});

so each li statement that comes in gets appended with the above which results in all of the elments having the same id.
is there a way i can set it without having it use the same id multiple times?

A: you have to change 'id' and 'for' attribute in label tag as well :
<input type="checkbox" class="display:none" id="cb1"  >
<input type="checkbox" class="display:none" id="cb2"  >

A: Not really sure what u accurately wanna approach.
First,i think  u should not use "display:none" in class , maybe in style is much correct.like style="display:none",And if u whant to check it one by one  you should use different id , the id might base on backend variable.
Hope this help u .
try like this ?
use Node Id to recognize different checkbox.
var list = $('

');
$.each(this.Markets, function() {
    list.append('
<input type="checkbox" class="display:none" id="cb'+this.NodeId+'" >' + this.Name + '
');
});


text:
Q: Merging a list of dictionaries I have a list of dicts as below.
list = [ {id: 1, s_id:2, class: 'a', teacher: 'b'} ]
list1 = [ {id: 1, c_id:1, rank:2, area: 34}, {id:1, c_id:2, rank:1, area: 21} ]

I want to merge the two lists on the common key-value pairs (in this case 'id:1')
Merged_list = [ {id:1, s_id:2, class: 'a', teacher: 'b', list1: {c_id:1, rank: 2, area: 34}, {c_id:2, rank: 1, area: 21} ]

How do I go about this?
Thanks

A: You can use
merged_list = [{**d1, **d2} for d1, d2 in zip(list1, list2)]

>>> merged_list
    [{'id': 1, 's_id': 2, 'class': 'a', 'teacher': 'b', 'rank': 2, 'area': 34},
     {'id': 2, 's_id': 3, 'class': 'c', 'teacher': 'd', 'rank': 1, 'area': 21}]

where {**d1, **d2} is just a neat way to combine 2 dictionaries. Keep in mind this will replace the duplicate keys of the first dictionary. If you're on Python 3.9, you could use d1 | d2.
EDIT: For the edit in your question, you can try this horrible one liner (keep in mind this will create the pair list1: [] if no matching indeces were found on list1):
list_ = [{"id": 1, "s_id": 2, "class": 'a', "teacher": 'b'}]
list1 = [{"id": 1, "c_id": 1, "rank": 2, "area": 34}, {"id": 1, "c_id": 2, "rank": 1, "area": 21}]

merged_list = [{**d, **{"list1": [{k: v for k, v in d1.items() if k != "id"} for d1 in list1 if d1["id"] == d["id"]]}} for d in list_]

>>> merged_list
    [{'id': 1,
      's_id': 2,
      'class': 'a',
      'teacher': 'b',
      'list1': [{'c_id': 1, 'rank': 2, 'area': 34},
       {'c_id': 2, 'rank': 1, 'area': 21}]}]

This is equivalent to (with some added benefits):
merged_list = []
for d in list_:
    matched_ids = []
    for d1 in list1:
        if d["id"] == d1["id"]:
            d1.pop("id") # remove id from dictionary before appending
            matched_ids.append(d1)

    if matched_ids: # added benefit of not showing the 'list1' key if matched_ids is empty
        found = {"list1": matched_ids}
    else:
        found = {}

    merged_list.append({**d, **found})

A: Try this
And don't forget to put " " when declare string
list = [ {"id": 1, "s_id": 2  ," class": 'a', "teacher": 'b'}, {"id": 2, "s_id" : 3, "class" : 'c', "teacher": 'd'} ]
list1 = [ {"id": 1, "rank" :2, "area" : 34}, {"id" :2, "rank" :1, "area": 21} ]

list2 = list1 + list
print(list2)


text:
Q: OpenCV Python Assertion Failed I am trying to run opencv-python==3.3.0.10 on a macOS 10.12.6 to read from a file and show the video in a window. I have exactly copied the code from here http://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html, section 'Playing' video from file.
The code runs correctly and shows the video, however after termination of the video it breaks the program, giving the following error:

Assertion failed: (ec == 0), function unlock, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/libcxx/libcxx-307.5/src/mutex.cpp, line 48.

Does anyone have any idea of what might cause this?

Code snippet for your convenience (edited to include some suggestions in the comment)
cap = cv2.VideoCapture('vtest.avi')

while(True):
    ret, frame = cap.read()

    if not ret:
        break

    gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

    cv2.imshow('frame',gray)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

 cv2.destroyAllWindows()

A: It's not clear from your question, but it looks like you're specifically running into a situation where the video completes playing without being interrupted. I think the issue is that the VideoCapture object is already closed by the time you get to cap.release(). I'd recommend putting the call to release inside of the if statement by the break.
I've not had time to experiment, but I normally follow this pattern:
reader = cv2.VideoCapture(<stuff>)
while True:
  success, frame = reader.read()
  if not success:
     break

I'd not had to call release explicitly in those contexts.


text:
Q: How to copy params from one LinearLayout and set to another LinearLayout in code? How to copy params from one LinearLayout and set to another LinearLayout  in code ?
I have tried like
LinearLayout.LayoutParams paramsR=(LinearLayout.LayoutParams) llRight.getLayoutParams();
LinearLayout.LayoutParams paramsL=(LinearLayout.LayoutParams) llLeft.getLayoutParams();
paramsR.height=paramsL.height;
paramsR.width=paramsL.width;
llRight.setLayoutParams(paramsR);

but it ignores at all. How to solve this problem ?

A: If the parent of llRight & llLeft is RelativeLayout then you should use:
RelativeLayout.LayoutParams paramsR=(RelativeLayout.LayoutParams) llRight.getLayoutParams();
RelativeLayout.LayoutParams paramsL=(RelativeLayout.LayoutParams) llLeft.getLayoutParams();
paramsR.height=paramsL.height;
paramsR.width=paramsL.width;
llRight.setLayoutParams(paramsR);


text:
Q: dataFrame data from big python objects If we are creating dataFrame from python objects like [dict or list], even if python data should be collect by GC, but as far as dataFrame is lazy, it needs to keep source of the data.
So every python object is kept in memory of interpreter. If such objects are really big it can cause crush of spark execution as python interpreter can't get enough memory. Am i right?
def get_df():
    # d should be collected by GC after leaving body of function
    d = {'a': 1}
    df = spark.createDataFrame(d)
    return df
df = get_df()
# d still in memory of interpreter


text:
Q: Javascript : Why Can't I Read the 'object.style.left' & 'object.style.top' values? Why Can't I Read the object.style.left & object.style.top values ?
I'm trying to dynamically move a button.
I can use javascript to reset the style.left & style.top values by doing this :
document.getElementById(theButton_ID).style.left = "128px";
document.getElementById(theButton_ID).style.top  =  "64px";

But my problem is that I need to dynamically reset the 'style.left' & 'style.top' values, using a scaling factor that needs to be dynamically determined when the web page loads.
To my novice way of thinking this means that I need to :
• Get the style.left & style.top values
• Multiply them by the scaling factor
• Assign those modified values to style.left & style.top values.
The problem is that I can't get the style.left & style.top values in the 1st place so I can't modify them, much less write them back.
So obviously, I'm both doing something wrong & I'm not understanding something I should understand.
So what am I doing wrong ?
What is it that I'm missing ?
And Most importantly, how do I get the value of style.left & style.top so that I can use them to dynamically modify the position of the button ?
Thanks everyone for all your help & suggestions.
Here's the actual HTML / CSS/ Javascript code …
<html>
      <head>

         <title>Button Dynamic Move Test</title>

      <style type="text/css">

        #MoveButton
        {
            position    : absolute;
            left        :  8px;
            top     : 16px;
        }

     </style>

     <script>

//      var X_Index_Move_Factor = 1.25;
//      var Y_Index_Move_Factor = 1.50;

function Move_A_Button (theButton_ID)
{
alert (   "We're in 'Move_A_Button'"
        + "\n"
        + " The Button Id = "
        +   theButton_ID
        );

var the_Old_Button_X_Offset = document.getElementById(theButtonId).style.left;

var the_Old_Button_Y_Offset = document.getElementById(theButtonId).style.top;

    alert (   "the_Old_Button_X_Offset = "
        + "\n"
        +   the_Old_Button_X_Offset
        + "the_Old_Button_Y_Offset = "
        + "\n"
        +   the_Old_Button_Y_Offset
        );
}

</script>
</head>

<body>

     <button type = "button"
       id       = "MoveButton"
      onclick   = "Move_A_Button ('MoveButton')">
     About Us
    </button>

</body>
</html>

A: Actually, if you don't need to support IE6 or IE7 (or FireFox from ~17 versions ago), then the best way to go about getting the internal data is something like this:
// inside of your function:

var el = document.getElementById(button_id),
    dimensions = el.getBoundingClientRect();

console.log("old x: " + dimensions.left, "old y: " + dimensions.top);
console.log("new x: " + dimensions.left * scale_X, "new y: " + dimensions.top * scale_Y);

Just remember that when you set them, afterward, you have to add the measurement, as well:
el.style.top = (dimensions.top * scale_Y) + "px";
el.style.left = (dimensions.left * scale_X) + "px";

And that using the getBoundingClient function will give you measurements as numbers, but .style.top / .style.left will give you measurements as strings ("112px") which you then have to pull the numbers out of, and then modify, and then when you add them back, you add the measurement type back on...  ...hooray

A: theButton_ID is the name of an argument
function Move_A_Button (theButton_ID)
{

When you try to get the style you write
document.getElementById(theButtonId).style.left;

You forgot a underscore

A: Even with the typos corrected, the element doesn't initially have top or left styles, since none are set on the element itself.
element.offsetLeft and element.offsetTop are your best bets as starting points.


text:
Q: $\omega_2$ is not a countable union of countable sets Without using axiom of choice, can we show that $\omega_2$ is not a countable union of countable sets? I know this cannot be done for $\omega_1$.

A: Yes, this can be proved without the axiom of choice.
Assume $\omega_2 = \cup_n E_n$ with $E_n$ countable. Then each $E_n$ is well-ordered, hence is isomorphic to a unique ordinal $\alpha_n < \omega_1$ via a unique isomorphism.
This makes it easy to construct a surjection $\omega \times \omega_1 \to \omega_2$, a contradiction since $|\omega \times \omega_1| = \aleph_1$.

A: Let $\omega_2 = \bigcup_n A_n$ where $A_n$'s are countable and pairwise disjoint. Let $\alpha_n$ be the order type of $A_n$. Then $\bigcup_n A_n$ can be injected into $\alpha_1 + \alpha_2 + \dots$. Since each partial sum is $< \omega_1$, the whole sum is $\leq \omega_1$. Contradiction! Hopefully axiom of choice wasn't used here.


text:
Q: Auto Increment Always adds 1 to previous Row, Even when previous row has been dropped
Possible Duplicate:
Reset AutoIncrement in SqlServer after Delete

I'm having an annoying issue with an Identity auto-increment column value within an Sql Server 2008 database. When I delete a row from my table (or delete all rows), when I add a new entry it's incremented from whichever value was inserted into a previous record, regardless as to whether that record still exists.
I was wondering if anyone knows how to get it so that the IDENTITY column will auto-increment from whatever the previous record that EXISTS is.
My code looks like this:
    CREATE TABLE Product
    (
            Product_Barcode INT NOT NULL PRIMARY KEY IDENTITY,
            Product_Description VARCHAR(255),
            Product_Name VARCHAR(255),
            Product_Supplier VARCHAR(255) FOREIGN KEY REFERENCES Supplier(Supplier_Name),
            Product_Size VARCHAR(255),
            Product_Weight FLOAT
    );

A: Typically you wouldn't want this because new and past records can share IDs. If you have referential constraints, this might cause confusion.
The only way I know how to do it though, is by inserting using a subquery eg.
INSERT INTO Product (Product_Barcode, Product_Description) VALUES (SELECT MAX(Product_Barcode) + 1 FROM Product, "Any description here");


text:
Q: How can I get the name of a variable in SQL? How can I get the name of a variable in SQL? something like C# nameof(variable)
In a SQL stored procedure, I handle a variable, @MetaData, which is a string repressing a JSON with a predefined structure:
{
  'Somekey1': 'Somevalue1',
  'Somekey2': 'Somevalue2'
}

Within the stored procedure, I check whether Somekey1 exists, and perform actions accordingly:
declare @existingSomekey1 VARCHAR(100) = (select [value]
from openjson(@Metadate) where [key] = 'Somevalue1')

Later, I do actions like:
set @Somekey1 = 'Some new value 1'
SELECT JSON_MODIFY(@Metadata, '$.Somekey1', @Somekey1)

So in the JSON_MODIFY command, if I provide the wrong path (which is the same as the variable name), it will create a different property altogether, which is wrong.
What's the best practice here to avoid typos in providing that path? which would lead to errors and exceptions...

A: If I understand the question correctly, the goal is to prevent adding entry for non-existing path and this could be achieved by adding strict:
DECLARE @Metadata NVARCHAR(MAX) = '{"Somekey1": "Somevalue1",
                                    "Somekey2": "Somevalue2"}'
       ,@Somekey1 NVARCHAR(100) = 'Some new value 1';

SELECT JSON_MODIFY(@Metadata, '$.Somekey3', @Somekey1);

Output:
{ "Somekey1": "Somevalue1",
  "Somekey2": "Somevalue2",
  "Somekey3":"Some new value 1"}

Using strict:
SELECT JSON_MODIFY(@Metadata, 'strict $.Somekey3', @Somekey1)

Output:

Property cannot be found on the specified JSON path.

db<>fiddle live demo

A: Not sure if this adds to the discussion, but ...
In 2016, the JSON key has to be a literal.   However, in 2017+ the key can be an expression
Example
DECLARE @Metadata NVARCHAR(MAX) = '{
  "Somekey1": "Somevalue1",
  "Somekey2": "Somevalue2"
}'

Declare @MyKey varchar(100),@MyVal varchar(100)

Select @MyKey = [key]
      ,@MyVal = [Value]
 From  OpenJson(@Metadata)
 Where [Key]='Somekey2'

Set @MyVal = 'This is a NEW Value';

SELECT JSON_MODIFY(@Metadata, '$.'+@MyKey, @MyVal)

Results
{
  "Somekey1": "Somevalue1",
  "Somekey2": "This is a NEW Value"
}


text:
Q: How to retrieve data from dynamically created user control in C# I have a user control which has text boxes and date picker. When the form loads, dynamically generate the user control and display in the form.
(EventComponent (user control)).

I want to get each of these user control values when the user clicks the save button.
public partial class InsertEventForm : Form
{
    private int numberOfEvent;

    public InsertEventForm(int numberOfEvent)
    {
        InitializeComponent();
        this.numberOfEvent = numberOfEvent;
    }

    private void InsertEventForm_Load(object sender, EventArgs e)
    {
        EventComponent[] eventComponents = new EventComponent[(int)this.numberOfEvent];
        int i = 0;

        Button backBTN = new Button();
        backBTN.Text = "Back";
        backBTN.Location = new Point(0, 10);
        backBTN.Size = new Size(50, 30);
        this.Controls.Add(backBTN);

    // generate user control dynamically here

        for ( i = 0; i < eventComponents.Length; i++)
        {
            eventComponents[i] = new EventComponent();
            System.Drawing.Point pLabel = new System.Drawing.Point(36, 50 + i * 280);
            eventComponents[i].Location = pLabel;
            eventComponents[i].Size = new System.Drawing.Size(358, 259);
            this.Controls.Add(eventComponents[i]);
        }

        Button saveBTN = new Button();
        saveBTN.Text = "Save";
        saveBTN.Location = new Point(200, 50 + i * 280);
        saveBTN.Size = new Size(100, 50);
        this.Controls.Add(saveBTN);
        saveBTN.MouseEnter += new System.EventHandler(this.SaveBTN_click);
    }

    private void SaveBTN_click(object sender, EventArgs e)
    {
        // need to retrieve value from user control
    }
}

A: Option 1
create List<EventComponent> EventComponentList
when you add to this.Controls  add to the list
this.Controls.Add(eventComponents[i]);
EventComponentList.Add(eventComponents[i]);

Option 2 (Less recommended)
private void SaveBTN_click(object sender, EventArgs e)
{
    var list = this.Controls.OfType<EventComponent>().ToList();
}

A: If you switch to MVVM, you'll have to create Model Event and every field would be a parameter of that class, later you create ObservableCollection that will be filled with objects of Event type every time you create the object clicking save button.


text:
Q: Downloading a file from the internet with python I'm trying to retrieve CSV data from a website through this link.
When downloaded manually you get synop.201708.csv.gz which is in fact a csv wrongly named .gz, it weights 2233KB
When running this code :
import urllib

file_date = '201708'
file_url = "https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Synop/Archive/synop.{}.csv.gz".format(file_date)
output_file_name = "{}.csv.gz".format(file_date)

print "downloading {} to {}".format(file_url, output_file_name)
urllib.urlretrieve (file_url, output_file_name)

I'm getting a corrupted ~361Kb file
Any ideas why?

A: What seems to be happening is that the MétéoFrance site is misusing the Content-Encoding header. The website reports that it is serving you a gzip file (Content-Type: application/x-gzip) and that it is encoding it in gzip format for the transfer (Content-Encoding: x-gzip). It is also saying the page is an attachment, which should be saved under its normal name (Content-Disposition: attachment)
In a vacuum, this would make sense (to a degree; compressing an already compressed file is mostly useless): The server serves a gzip file and compresses it again for transport. Upon receipt, your browser undoes the transport compression and saves the original gzip file. Here, it decompresses the stream, but since it wasn't compressed again, it doesn't work as expected.

A: As pvg said :
the file downloaded by urllib.urlretrieve is a compressed archive and not a csv file, everything is fine
I thought that I was suposed to get a csv named as .gz because when I was downloading it manually through my browser (chrome) it was then unziping it without telling me and it kept the unziped file name .gz


text:
Q: List of OpenTSDB metrics Is it possible to obtain a list of available OpenTSDB metrics (not tsuids) by HTTP api without any additional plugin? Or is is possible to find out a list of metrics by HTTP api matching any pattern (e.g. sys.cpu.* or something like that)?
What is the best way?
Thank you

A: I figured out.
Looks like it is possible to use /api/suggest/ endpoint with following params:
{
   'type': 'metrics',
   'q': '',
   'max': <int>,
}


text:
Q: How to convert text fields into numeric/vector space for a SVM in R Studio? I am attempting to train a Support Vector Machine to aid in the detection of similarity between strings. My training data consists of two text fields and a third field that contains 0 or 1 to indicate similarity. This last field was calculated with the help of an edit distance operation. I know that I need to convert the two text fields to numeric values before continuing. I am hoping to find out what is the best method to achieve this?
The training data looks like:
ID          MAKTX_Keyword       PH_Level_04_Keyword   Result
266325638   AMLODIPINE          AMLODIPINE              0
724712821   IRBESARTANHCTZ      IRBESARTANHCTZ          0
567428641   RABEPRAZOLE         RABEPRAZOLE             0
137472217   MIRTAZAPINE         MIRTAZAPINE             0
175827784   FONDAPARINUX        ARIXTRA                 1
456372747   VANCOMYCIN          VANCOMYCIN              0
653832438   BRUFEN              IBUPROFEN               1
917575539   POTASSIUM           POTASSIUM               0
222949123   DIOSMINHESPERIDIN   DIOSMINHESPERIDIN       0
892725684   IBUPROFEN           IBUPROFEN               0

I have been experimenting with the text2vec library, using this useful vignette as a guide. In doing so, I can presumably represent one of the fields in vector space.

*

*But how can I use this library to manage both text fields at the same time?

*Should I concatenate the two string fields into a single field?

*Is text2vec the best approach to take?

The code that will be used to manage one of the fields:
library(text2vec)
library(data.table)

preproc_func = tolower
token_func = word_tokenizer

it_train = itoken(Train_PRDHA_String.df$MAKTX_Keyword,
                  preprocessor = preproc_func,
                  tokenizer = token_func,
                  ids = Train_PRDHA_String.df$ID,
                  progressbar = TRUE)
vocab = create_vocabulary(it_train)

vectorizer = vocab_vectorizer(vocab)
t1 = Sys.time()
dtm_train = create_dtm(it_train, vectorizer)
print(difftime(Sys.time(), t1, units = 'sec'))

dim(dtm_train)
identical(rownames(dtm_train), Train_PRDHA_String.df$id)

A: One way to embed docs into the same space is to learn vocabulary from both columns:
preproc_func = tolower
token_func = word_tokenizer
union_txt = c(Train_PRDHA_String.df$MAKTX_Keyword, Train_PRDHA_String.df$PH_Level_04_Keyword)
it_train = itoken(union_txt,
                  preprocessor = preproc_func,
                  tokenizer = token_func,
                  ids = Train_PRDHA_String.df$ID,
                  progressbar = TRUE)
vocab = create_vocabulary(it_train)
vectorizer = vocab_vectorizer(vocab)

it1 = itoken(Train_PRDHA_String.df$MAKTX_Keyword, preproc_func,
             token_func, ids = Train_PRDHA_String.df$ID)
dtm_train_1 = create_dtm(it1, vectorizer)

it2 = itoken(Train_PRDHA_String.df$PH_Level_04_Keyword, preproc_func,
             token_func, ids = Train_PRDHA_String.df$ID)
dtm_train_2 = create_dtm(it2, vectorizer)

And after that you can combine them into a single matrix:
dtm_train = cbind(dtm_train_1, dtm_train_2)

However if you want to solve problem of duplicate detection I suggest to use char_tokenizer with ngram > 1 (say ngram = c(3, 3)). And check great stringdist package. I suppose you received Result with some manual human work. Because if it is just edit distance, algorithm will learn at most how edit distance works.


text:
Q: How to enable an OpenGL Texture for different multiple buffer objects? I have a problem about activating a single texture to multiple buffer objects. I am trying to draw two different graphical objects that using the same texture. However could not make it bind.
After searchs so far, I could find an answer that fits to my question in this (Re-using one texture for multiple OpenGL Quads) link. I tried this method in my code by using the glBindTexture() function before the main opengl render loop, and also inside of the render loop but it did not bind. Also it is said that, bind the texture before the draw call, in here (OpenGl all models are with the same texture). But this way also did not work for me.
How can I use the exact same texture which is named texture1 for second buffer object?
I use two buffer objects and two vertex array objects for different graphical objects. What I really want to accomplish to describe only one texture after the first buffer array and then use the exact same texture for the second object. But when I try to bind the texture after vertex array object it does not work.
By the way I do not load any images for the texture. The main purpose that I use texture in order to utilize the texture coordinates. I do necessary works in the fragment shader.
#shader vertex
#version 330 core

layout (location=0) in vec3 position;
layout (location=1) in vec2 TextureCoords;

out vec2 TexCoord;
void main()
{
  TexCoord = vec2(TextureCoords.x, TextureCoords.y);
  gl_Position = vec4(position, 1.0);
};

#shader fragment
#version 330 core

out vec4 fragColor;
in vec2 TexCoord;

void main()
{
  vec2 xy = TexCoord.xy;
  vec4 color = vec4(vec3(xy.x), 1.0);
  fragColor = color;
};

float vertexArray1[] = {
 //      Vertex Position | Texture Coords
 //       x     y     z     x      y
         0.9f, 0.9f, 0.0f, 1.0f, 1.0f,
         0.9f, 0.2f, 0.0f, 1.0f, 0.0f,
         0.2f, 0.2f, 0.0f, 0.0f, 0.0f,

         0.2f, 0.9f, 0.0f, 0.0f, 1.0f,
         0.9f, 0.9f, 0.0f, 1.0f, 1.0f,
         0.2f, 0.2f, 0.0f, 0.0f, 0.0f,
    };

float vertexArray2[] = {

        -0.2f, 0.9f, 0.0f, 1.0f, 1.0f,
        -0.2f, 0.2f, 0.0f, 1.0f, 0.0f,
        -0.9f, 0.2f, 0.0f, 0.0f, 0.0f,

        -0.9f, 0.9f, 0.0f, 0.0f, 1.0f,
        -0.2f, 0.9f, 0.0f, 1.0f, 1.0f,
        -0.9f, 0.2f, 0.0f, 0.0f, 0.0f,
 };

unsigned int buffer;
unsigned int VAO;

glGenBuffers(1, &buffer);
glGenVertexArrays(1, &VAO);

glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexArray1), vertexArray1, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 5, 0);
glEnableVertexAttribArray(0);

unsigned int texture1;
glGenTextures(1, &texture1);
glBindTexture(GL_TEXTURE_2D, texture1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);

unsigned int buffer2;
unsigned int VAO2;
glGenBuffers(1, &buffer2);
glGenVertexArrays(1, &VAO2);

glBindVertexArray(VAO2);
glBindBuffer(GL_ARRAY_BUFFER, buffer2);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexArray2), vertexArray2, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 5, 0);
glEnableVertexAttribArray(0);

// I want to use the previously described texture1 in here, but it does not bind.
glBindTexture(GL_TEXTURE_2D, texture1);

while(!glfwWindowShouldClose(window)){

    processInput(window);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(shader);
    glBindVertexArray(VAO);
    glDrawArrays(GL_LINES, 0, 6*3*1);

    glBindVertexArray(VAO2);
    glDrawArrays(GL_LINES, 0, 6*3*1);

    glfwSwapBuffers(window);
    glfwPollEvents();
}

Note:  When I create another different texture for the buffer2 object it works like a charm. I mean texture1 for buffer1, texture2 for buffer2... But I want to keep the number of the texture as possible as minimum. Maybe in future developments, I will have to create more than 50 buffer object, thus I do not want to create different textures for every single buffer object.
EDIT: I have changed my misunderstanding of "binding a texture to a vertex array" to "enabling attributes of a texture for other objects". I've also included my shader scripts for debugging purposes.

A: *

*Textures are not bound to buffer objects. When you draw something, it uses the currently bound texture, not one from a buffer.

*Textures are not bound to VAOs either so there's no need to worry about that.

*To use a texture, you do need to have a sampler in your shader, bind the texture unit (not the texture) to the sampler with glUniform1i, and call the texture function in the shader and do something with the return value.

*Since you say your shader isn't doing anything with your texture anyway, I wonder how you can tell whether it's bound or not.

*In fact, there's no reason to have a texture if you don't have a shader that does something with it! There is no magical texture-shader interaction. A texture is something you have to specifically query (by calling texture) or else it doesn't do anything by itself.

*You don't need to have a texture to have texture coordinates.

*Since you haven't shown your shaders, it's impossible to debug them for you.

A: After I review my code again and search once more, I came across a solution for my question.
And I guess where I was wrong was trying to bind a texture which was already bound to the global context, as @ColonelThirtyTwo pointed out in the comment.
As I understood, instead of trying to bind the same texture I should have called the glVertexAttribPointer() and enable with glEnableVertexAttribArray() for bounded texture.
Since in the answer of this question (glVertexAttribPointer clarification), it is said that:

"A Vertex Array Object or VAO is used to store the state of all the glVertexAttribPointer calls and the VBOs that were targeted when each
of the glVertexAttribPointer calls were made."

So I came up to this solution and it worked:
unsigned int buffer;
unsigned int VAO;

glGenBuffers(1, &buffer);
glGenVertexArrays(1, &VAO);

glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexArray1), vertexArray1, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 5, 0);
glEnableVertexAttribArray(0);

unsigned int texture1;
glGenTextures(1, &texture1);
glBindTexture(GL_TEXTURE_2D, texture1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);

unsigned int buffer2;
unsigned int VAO2;

glGenBuffers(1, &buffer2);
glGenVertexArrays(1, &VAO2);

glBindVertexArray(VAO2);
glBindBuffer(GL_ARRAY_BUFFER, buffer2);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertexArray2), vertexArray2, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(float) * 5, 0);
glEnableVertexAttribArray(0);

// Inseted of the bind call,
// I called the glVertexAttribPointer() and glEnableVertexAttribArray() here.
// And if I am not wrong these calls use the currently bounded texture which is texture1.
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);

while(!glfwWindowShouldClose(window)){

    processInput(window);
    glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT);

    glUseProgram(shader);
    glBindVertexArray(VAO);
    glDrawArrays(GL_LINES, 0, 6*3*1);

    glBindVertexArray(VAO2);
    glDrawArrays(GL_LINES, 0, 6*3*1);

    glfwSwapBuffers(window);
    glfwPollEvents();
}