text:
Q: R copy row and divide value with duplicate ids I have a dataframe like so:
id val
a  10
a  50
b  30

Now for every id, I want to divide val by the number of repetitions of id and copy the row just as many times. So the final dataframe will become like so:
id val
a  5
a  5
a  25
a  25
b  30

Please note that the duplicate ids may not be consecutive.
How can I achieve this?

A: One dplyr option could be:
df %>%
 group_by(id) %>%
 mutate(val = val/n()) %>%
 uncount(n())

  id      val
  <chr> <dbl>
1 a         5
2 a         5
3 a        25
4 a        25
5 b        30

A: Store the counts in a vector and use it to repeat the data.frame:
df = data.frame(id=c("a","a","b"),val=c(10,50,30))
df$id = as.character(df$id)
n = table(df$id)
with(df,data.frame(id=rep(id,n[id]),val=rep(val/n[id],n[id])))

  id val
1  a   5
2  a   5
3  a  25
4  a  25
5  b  30

A: Using tapply and stack.
stack(with(d, tapply(val, id, function(x) rep(x/length(x), each=length(x)))))
#   values ind
# 1      5   a
# 2      5   a
# 3     25   a
# 4     25   a
# 5     30   b

Data:
d <- structure(list(id = c("a", "a", "b"), val = c(10L, 50L, 30L)), row.names = c(NA,
-3L), class = "data.frame")


text:
Q: Is possible to change the ID of an attribute? I have these attributes:

*

*id 199 = size

*id 200 = color

*id 210 = number

*id 220 = measure

Those are used to create configurable items in the product view.
Color is showing above number and measure, while the size is showing the bottom.

I need that color attribute is always displayed on top and I guess it's related to the attribute ID. Is possible to change the id 199 = size with another ID > 200 (color's id) ?

A: Your approach is the wrong one.
Obviously you can always change the id in raw from your database and it's probably what magento use to sort by default but the real way of doing it would be :
Extending the filter rendering; there might use a collection or an array or whatever that they print. Before sending that array to the template you need to order it as you wish.
Altering raw ids in database is for me a terrible idea. Because when your feature will be sent to an other env like production...then you will still have the firsts ids and you will have to make all the changes again.
But then you will have a new request...hey i want a filter "age" between color and number...so you will change again raw ids ? Obviously not.
So the way is to sort the filter collection used by magento so as this logic of changing the order will appear int he code and won't be magical from the database..

A: Edit attribute > Storefront properties > Position to reorder on frontend:

A: Here the solution.
Just run those two sql queries:
update catalog_product_super_attribute set position = 0 where attribute_id = 200;
update catalog_product_super_attribute set position = 1 where attribute_id != 200;
Those will set position = 0 for color attribute in all products and position = 1 for rest of the attributes. This way color will be always first.
Enjoy.

redpajama_set_name: RedPajamaStackExchange


text:
Q: EmberJS development on a machine with outdated node version I have a project where I want to use the latest EmberJS to develop under. Currently, node 0.10.4 is installed on the machine I was given, which is a hard requirement for a backend system that I will need. Since the nodejs is so outdated, I cannot install the latest Ember on this machine without updating the NodeJs. My ember app has to communicate to the backend system through socket.io, is it possible to create a virtual development environment on this machine to develop Ember with the latest nodejs and also be able to easily configure the socket.io connection during development?
I believe once Ember is compiled down to distribution files, I can easily migrate these files into the public folder of my outdated nodejs with no problem, but correct me if I'm wrong
Any ideas on a solution that is easy to configure without asking for a new  machine?

A: The easiest way to handle this situation is to use Node Version Manager (NVM).
Just follow the install instructions located here.
Then you can simply type nvm install <desired version of node>.
For example, when developing your backend system, first type nvm install v0.10.4. And when developing your Ember app, type nvm install v6.0.0.
(Note: to find out what versions of node are available to download, run nvm ls-remote).

A: If you use Linux - you can do following steps:

*

*create new user

*download archive with latest node.js version from here:

*extract archive to any folder in new user /home directory

*then switch to created user and do echo "export PATH=$PATH:/path/to/your/latest/node/bin/node" >> ~/.bashrc;
Then you should be available to use node.js 7.*.* only for this user, but default version for other users will be 0.10.4


text:
Q: GLSL ES equivalent to OpenGL GLSL 'out' keyword? I have a vertex shader which works fine on Windows with OpenGL. I want to use the same shader on an iPad which supports OpenGL ES2.0.
Compilation of the shader fails with:
Invalid storage qualifiers 'out' in global variable context

From what I have read, the 'out' keyword required GLSL 1.5 which the iPad won't support. Is there an equivalent keyword to 'out' that I can use to pass the color into my fragment shader?
attribute vec4 vPosition;
attribute vec4 vColor;

uniform   mat4 MVP;

out vec4 pass_Color;

void main()
{
  gl_Position = MVP * vPosition;
  pass_Color = vColor;
}

This vertex shader is used by me to create gradient blends, so I'm assigning a color to each vertex of a triangle and then the fragment shader interpolates the color between each vertex. That's why I'm not passing a straight color directly into the fragment shader.

A: Solved! In GLSL ES 1.0 that I'm using, I need to use 'varying' instead of 'in' and 'out'. Here's the working shader:
attribute vec4 vPosition;
attribute vec4 vColor;

uniform   mat4 MVP;

varying vec4 pass_Color;

void main()
{
  gl_Position = MVP * vPosition;
  pass_Color = vColor;
}


text:
Q: JavaScript prototypes: replace a function I want to decorate a function of a JavaScript "class" (prototype):
SomeClass = function() { this.someVar = 5; };

SomeClass.prototype = {
    foo: function(arg) { /* do something with this.someVar */ }
}

However, I cannot change the source of SomeClass nor am I able to influence the instance creation of SomeClass instances.
Therefore I thought about doing the following:
var oldFoo = SomeClass.prototype.foo;
SomeClass.prototype.foo = function(arg) {
    console.log("Yey, decorating!");
    oldFoo(arg);
};

This seems to work fine, however, due to function scoping oldFoo cannot access someVar anymore (the this object is now window). How to overcome this issue?

A: You need to delegate it correctly. What's happening is that since you're calling oldFoo like a bare function the this value is set to undefined (or the global object in non-strict mode).
Apply the method with the arguments and set the this value explicitly:
oldFoo.apply(this, arguments); // use the same `this` and same arguments as called.

Note that in order to be really correct - you also need to return the result. So in total your code should look something like:
SomeClass.prototype.foo = function(arg) {
    console.log("Yey, decorating!");
    return oldFoo.apply(this, arguments); // alternatively capture the return value
};                                        // and process it and then return it


text:
Q: How to run 'source ~/.my_commands.sh' in windows? I want to run source ~/.my_commands.sh but I am not able to. I have tried PowerShell and CommandPrompt these are the errors I get. If it is not possible to run this command in windows, is there an alternate solution?:
PowerShell:

Command Prompt:

This is what my_commands.sh contains:
#!/bin/bash

function create() {
    cd
    source .env
    python create.py $1
    cd $FILEPATH$1
    git init
    git remote add origin git@github.com:$USERNAME/$1.git
    touch README.md
    git add .
    git commit -m "Initial commit"
    git push -u origin master
    code .
}

A: An easy way to run .sh scripts on windows is to use git bash. Download and install git for windows, go to the folder where you have your .sh script, right click, select "git bash here" and run the script like this:
./my_commands.sh


text:
Q: Matching both preg_matches in an if statement I have 2 preg_match in an if statement, and if either of them are true, I want to print_r both of them. But for some reason, only the first preg_match is being matched each time, even though both of them has the same pattern. Why is this happening?
<?php

$string = "how much is it?";
if (preg_match("~\b(how (much|many))\b~", $string, $match1) || preg_match("~\b(how (much|many))\b~", $string, $match2)) {
print_r($match1);
print_r($match2);
}

?>

 Result:
Array ( [0] => how much [1] => how much [2] => much )

 Expected Result:
Array ( [0] => how much [1] => how much [2] => much )
Array ( [0] => how much [1] => how much [2] => much )

A: Explanation:-
Due to || condition when first one is correct at-once if is executed by ignoring second one. so first one outputs array, but second one gives an Notice: Undefined variable: match2 in D:\xampp\htdocs\abc.php on line 6. It's wierd that you didn't get that error.
If you want both as output use && instead of || so that both will check and both will print
So code will be:-
<?php

$string = "how much is it?";
if (preg_match("~\b(how (much|many))\b~", $string, $match1) && preg_match("~\b(how (much|many))\b~", $string, $match2)) {
print_r($match1);
print_r($match2);
}

?>

Output:-https://eval.in/595814
Another solution:-
<?php
    $string = "how much is it?";
    preg_match("~\b(how (much|many))\b~", $string, $match1);
    preg_match("~\b(how (much|many))\b~", $string, $match2);
    print_r($match1);
    print_r($match2);
?>

For more learning:- http://php.net/manual/en/language.operators.logical.php


text:
Q: Generating/Coping KeyPair on USB Token using NodeJS and PKCS11js library I have no problem with doing that in java; however, I can't do the same thing in this library.
In java, I give these attributes (plus my session) to the C_CreateObject method for creating (copying) the public key into the token:
CKA_TOKEN
CKA_CLASS
CKA_KEY_TYPE
CKA_MODULUS_BITS
CKA_VERIFY
CKA_MODULUS
CKA_PUBLIC_EXPONENT
CKA_SUBJECT
CKA_ID
CKA_LABEL

Is it the same thing in this library?

A: So Insead of C_CreateObject I used C_GenerateKeyPair and it worked.


text:
Q: Mysql group by select most recent record I've got a reports table with organisation id's that has multiple rows for every year, example.
| ID | Organisation ID | Report Year
--------------------------------------
|  1 |   1             | 2016
|  2 |   1             | 2017
|  3 |   12            | 2016
|  4 |   12            | 2017
|  5 |   13            | 2016
|  6 |   13            | 2017
|  7 |   14            | 2016

and a report_files table as follows
| ID | Report Type ID | Report ID   | Report File
---------------------------------------------------
|  1 | 1              | 1          | org1_test_report_2016.pdf
|  3 | 1              | 3          | org1_test_report_2016.pdf
|  5 | 1              | 5          | org1_test_report_2016.pdf
|  6 | 1              | 6          | org1_test_report_2017.pdf
|  7 | 1              | 7          | org1_test_report_2016.pdf

I'd like to get the most recent record from reports table i.e if 2016 and 2017 rows exist i'd like to get 2017 and if only 2016 exist then get that and left join that on reports_file table to get the report_file column with the file name if one exist for that id if not return null. Something like this.
| Report ID | Organisation ID | Report File
----------------------------------------------
| 2         | 1               | NULL
| 4         | 12              | NULL
| 6         | 13              | org1_test_report_2017.pdf
| 7         | 14              | org1_test_report_2016.pdf

Might not have explained properly, please let me know if the question is not clear. Basically want to group by organisation_id on the reports table but get the most recent row, if 2017 exists then get that if not get 2016 and then left join that on report_files table to see if a file is attached to the most recent report id if so return file else return null. Hope this makes sense.
Thanks in advance.

A: Try this:
SELECT C.Report_ID, A.Organisation_ID, C.Report_File
FROM
(SELECT Organisation_ID, MAX(Report_Year) Latest_Report_Year
FROM reports GROUP BY Organisation_ID) A
JOIN reports B ON A.Organisation_ID=B.Organisation_ID AND A.Latest_Report_Year=B.Report_Year
JOIN report_files C ON B.ID=C.Report_ID;

See it run on SQL Fiddle.

A: Based on the result you want I'd like to do a LEFT JOIN on a intermediate table as below after selecting MAX(Report_Year) :
SELECT C.Report_ID, A.Organisation_ID, C.Report_File
FROM
(SELECT Organisation_ID, MAX(Report_Year) Latest_Report_Year
FROM reports GROUP BY Organisation_ID) A
JOIN reports B ON A.Organisation_ID=B.Organisation_ID AND
A.Latest_Report_Year=B.Report_Year
LEFT JOIN report_files C ON B.ID=C.Report_ID;

Result :
| Report ID | Organisation ID | Report File
----------------------------------------------
| 2         | 1               | NULL
| 4         | 12              | NULL
| 6         | 13              | org1_test_report_2017.pdf
| 7         | 14              | org1_test_report_2016.pdf

SQL Fiddle here


text:
Q: Cómo redireccionar a otra vista o página en Angular 4 Necesito saber cuál es la sintaxis en typescript para redireccionar a otra página o vista en Angular 4.
Gracias.

A: Te aconsejo que utilices las características de routing de Angular. Puedes activarlas utilizando:
ng new mi-aplicacion --routing true

Tendrás que definir un fichero de ruteo para el componente raíz (app-module) y para el resto de componentes sobre los que quieras enrutar (redirigir).
De esta manera podrás chequear tu variable booleana de login exitoso redirigiendo a un nuevo componente que contenga la parte privada.
Aún así te aconsejo que controles los enrutamientos con un token de sesión para mejorar la seguridad de tu aplicación.
Aquí tienes un enlace donde explica de manera sencilla como enrutar con Angular. http://academia-binaria.com/enrutado-con-angular2-el-nuevo-spa/


text:
Q: PHPMyAdmin coletando dados sem necessidade? Abaixo o código que tenho para coletar os $_POST
<?php
     $conexao = mysql_connect("localhost:3306",'user1','senhadementirinha');
     $bd = mysql_select_db("recados");
 ?>

    <form name="form" method="post" action="#">
         Nome:
          <input type=text name=nome>

         E-Mail:
          <input type=text name=email>

         Mensagem:
           <textarea name=post></textarea>

         <input type=submit value=Enviar>

         <input type=reset value=Limpar>
    </form>

<?php

    $nome=$_POST['nome'];
    $post=$_POST['post'];
    $data = date("Y/m/d");

      $insert = mysql_query("INSERT INTO msg(nome,post,data) values ('$nome','$post','$date')");

      $sql = "SELECT * FROM msg ORDER BY id desc";

      $executar = mysql_query($sql);

   while( $exibir = mysql_fetch_array($executar)){
        echo $exibir['date'];
        echo $exibir['post'];
        echo "

";
   }

?>

esse código e usado em loop em uma tabela, porém consegui inserir e colocar o comentário na linha da tabela, mas quando atualiza ele, as outras linhas enviam para o banco de dados espaços vazios.
Uma forma de resolver seria ter um checkbox mas não sei se é possível depois de selecionado, ele permanecer mesmo depois de atualizar a pagina.

A: Tente isso:
<?php
$nome=$_POST['nome'];
$post=$_POST['post'];
$data = date("Y/m/d");

/* Verifica se existe valores a inserir */
if($nome != null &&
      $post != null &&
      $data != null){

$insert = mysql_query("INSERT INTO msg(nome,post,data)
values('$nome','$post','$date')");

$sql = "SELECT * FROM msg ORDER BY id desc";

$executar = mysql_query($sql);

while( $exibir = mysql_fetch_array($executar)){
echo $exibir['date'];

echo $exibir['post'];
echo "

";
}

} /* fim do if != null */

?>


text:
Q: How to use sharedPreference value in different classes in android in main Activity i have following:
((TextView)findViewById(R.id.TextView02)).setText(getSharedPreferences("FearAlert", 1).getString("contactName", "Tap to select an Emergency Contact."));
    ((TextView)findViewById(R.id.TextView03)).setText(getSharedPreferences("FearAlert", 1).getString("contactNumber", ""));

now i want to use contactNumber value in ANOTHER Activty say activity2
in Activty2  is:
 SmsManager.getDefault().sendTextMessage(??, null, "message",null, null, null);
return null;

what should i write in place of ?? above..help please..

A: In Java, there are... Never mind, In programming languages, there are variables where you can assign values to variables. like x=1; then use can use x+x=?; and will give you 2;
Here you can do
SharedPreferences sPrefs=getSharedPreferences("FearAlert", 1);
TextView tv=(TextView)findViewById(R.id.TextView02);
String YOUR_INTRESTING_STRING=sPrefs.getString("contactName", "Tap to select an Emergency Contact.");

And to pass it to the another Activity; You can put it in a Bundle
Intent i = new Intent(getApplicationContext(), YOUR_ANOTHER_ACTIVITY.class);
i.putExtra("name_of_value",YOUR_INTRESTING_STRING);
startActivity(i);

And retrive it in your AnotherActivity by
Bundle extras = getIntent().getExtras();
String value = extras.getString("name_of_value");

A: Preferences are typically name value pairs. They can be stored as "Shared Preferences" across various activities in an application (note currently it cannot be shared across processes). Or it can be something that needs to be stored specific to an activity (which is not discussed here).
The context object lets you retrieve SharedPreferences through the method
Context.getSharedPreferences().

getSharedPreferences("FearAlert", 1).getString("contactNumber", "");

OR

 SharedPreferences myPrefs = this.getSharedPreferences("FearAlert", 1);
        String contactNumber = myPrefs.getString(contactNumber, "nothing");

A: you can access you preferences everywhere in your app e.g. with following method:
/**
 * Get a string preference by its key from the apps preferences file
 *
 * @param key of preference
 * @return value of preference
 */
public String getStringPreference(String key) {
    SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    return pref.getString(key, "");
}

Just set your key, e.g. "contactName" as parameter. The preferences manager requires the application context via getApplicationContext().

A: Assuming you have created the SharedPreferences correctly:
SharedPreferences settings = getSharedPreferences("MY_APP", MODE_PRIVATE);

You can retrieve a preference in your method by:
SmsManager.getDefault().sendTextMessage(settings.getString("contactNumber"), null, "message", null, null, null);

Assuming you've set it with the "MY_APP" shared preference tag.
settings.edit().putString("contactNumber", "XXX-XXX-XXXX").commit();


text:
Q: Converting a given number to a word using array I am trying to create a method for the classic bottles of beers output.
Given a number, @beers, I want to convert it to the word version of the number. I wanted to split the number into an array and then compare with a list of numbers to words:
class BeerSong

  attr_accessor :beers

  def initialize(beers)

    if beers > 99
      beers = 99
    elsif beers < 1
      beers = "Zero"
    end
    @beers = beers
  end

  def worded
    num_name = {
      90 => "Ninety", 80 => "Eighty", 70 => "Seventy",60 => "Sixty",
      50 => "Fifty",40 => "Forty",30 => "Thirty",20 => "Twenty",
      19 => "Nineteen", 18 => "Eighteen",  17 => "Seventeen", 16 => "Sixteen",
      15 => "Fifteen",14 => "Fourteen", 13 =>"Thirteen",  12 => "Twelve",
      11 => "Eleven", 10 => "Ten",  9 => "Nine",8 => "Eight", 7 => "Seven",
      6 => "Six",5 => "Five",4 => "Four",3 => "Three",2 => "Two",1 => "One"
    }

    worded = ""

    beers = @beers

    split_beers = beers.to_s.split

    num_name.each do |number, name|
      split_number = number.to_s.split
      if beers == number
        worded << name
      else
        number > 19 && split_number[0].to_i == split_beers[0].to_i
        worded << name
        worded << "-"
      end
    end

    num_name.each do |number, name|
      if number < 10 && split_beers[1].to_i == number
        worded << name
      end
    end

    worded

  end

  def print_song

    while @beers.to_i > 2

      puts "#{worded} bottles of beer on the wall,"
      puts "#{worded} bottles of beer,"
      puts "Take one down, pass it around,"
      @beers -= 1
      puts "#{worded} bottles of beer on the wall.\n\n"
    end

    if @beers.to_i == 2
      puts "#{worded} bottles of beer on the wall,"
      puts "#{worded} bottles of beer,"
      puts "Take one down, pass it around,"
      @beers -= 1
      puts "#{worded} bottle of beer on the wall.\n\n"
    end

    if @beers.to_i == 1
      puts "#{worded} bottle of beer on the wall,"
      puts "#{worded} bottle of beer,"
      puts "Take one down, pass it around,"
      puts "Zero bottles of beer on the wall.\n\n"
    end

    if @beers.to_i == 0
      print ""
    end

  end

end

I am trying to compare the first digit to get the tens, then compare the second digit for the units separated by a hyphen.

A: Your lines:
split_beers = beers.to_s.split
split_number = number.to_s.split

assume an array as a result which is not the case because you don't provide a pattern to split on
so the default is used. See: http://ruby-doc.org/core-2.0.0/String.html#method-i-split
puts "10".to_s.split.inspect        # gives ==> ["10"]
puts "10".to_s.split('',2).inspect  # gives ==> ["1", "0"]

The last is what you want.


text:
Q: Build Failed when trying to test app on Android phone with API 30 - Xamarin I trying to debug app on the Android 11 (API 30).
I enable USB debugging from the options and when I connect phone to computer with cable I see the phone from the debug menu.
When I choose the phone and start the Application I receive error:
    InstallPackage
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00169] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:346
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass100_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:803
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <e068e2227ab74c1bb3d724ebaab0e3ff>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x001cf] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:206
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x0042f] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:223
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x001c0] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:338
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x0032d] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:355
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x002fb] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:212
Done building target "_Upload" in project "HydroMeteoAnalyzer.Android.csproj" -- FAILED.

Done building project "HydroMeteoAnalyzer.Android.csproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00169] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:346
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass100_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:803
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <e068e2227ab74c1bb3d724ebaab0e3ff>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x001cf] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:206
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x0042f] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:223
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x001c0] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:338
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x0032d] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:355
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x002fb] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:212
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:16.77
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00169] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:346
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass100_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:803
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <e068e2227ab74c1bb3d724ebaab0e3ff>:0
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x001cf] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:206
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x0042f] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:223
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x001c0] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:338
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x0032d] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:355
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x002fb] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:212
Done building target "_Upload" in project "HydroMeteoAnalyzer.Android.csproj" -- FAILED.

Done building project "HydroMeteoAnalyzer.Android.csproj" -- FAILED.

Build FAILED.

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: Mono.AndroidTools.InstallFailedException: Failure [INSTALL_FAILED_USER_RESTRICTED: Install canceled by user]
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.Internal.AdbOutputParsing.CheckInstallSuccess (System.String output, System.String packageName) [0x00169] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/Internal/AdbOutputParsing.cs:346
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Mono.AndroidTools.AndroidDevice+<>c__DisplayClass100_0.<InstallPackage>b__0 (System.Threading.Tasks.Task`1[TResult] t) [0x00016] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Mono.AndroidTools/AndroidDevice.cs:803
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.ContinuationTaskFromResultTask`1[TAntecedentResult].InnerInvoke () [0x00024] in <e068e2227ab74c1bb3d724ebaab0e3ff>:0
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at System.Threading.Tasks.Task.Execute () [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2319
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010: --- End of stack trace from previous location where exception was thrown ---
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x001cf] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:206
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at AndroidDeviceExtensions.PushAndInstallPackageAsync (Mono.AndroidTools.AndroidDevice device, PushAndInstallCommand command, System.Threading.CancellationToken token) [0x0042f] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/external/androidtools/Xamarin.AndroidTools/Devices/AndroidDeviceExtensions.cs:223
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x001c0] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:338
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.InstallPackage (System.Boolean installed) [0x0032d] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:355
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(604,5): error ADB0010:   at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x002fb] in /Users/builder/azdo/_work/1/s/xamarin-android/external/monodroid/tools/msbuild/Tasks/FastDeploy.cs:212
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:16.77

Is there a way to fix this bug and debug on the phone, because is more fast than emulator ..


text:
Q: Flexbox alignment - two on each row and then one I'll just add a pic of how I am trying to get the link boxes to align:
examplepic
So two on each line, same size, and then one on the last left line. I have been experimenting with wrap, justifycontent and flex but I am not getting it right. Any tips? Code follows here;
return (

    <View style={styles.linkContainer}>

            <TouchableOpacity
                containerStyle={styles.linkContainerStyle}
                onPress={() =>
                    WebBrowser.openBrowserAsync(
                        "https://skatt.skatteetaten.no/web/minskatteside/?innvalg=minearbeidsgivere#/minearbeidsgivere"
                    )
                }
            >
                <View style={styles.linkContainer}>
                    <Icon name="arrow-circle-right" size={15}></Icon>
                    <Text style={{ fontWeight: "bold",fontSize: 13}}> Videregående opplæring </Text>
                </View>
            </TouchableOpacity>

            <TouchableOpacity
                containerStyle={styles.linkContainerStyle}
                onPress={() =>
                    WebBrowser.openBrowserAsync(
                        "https://skatt.skatteetaten.no/web/minskatteside/?innvalg=minearbeidsgivere#/minearbeidsgivere"
                    )
                }
            >
                <View style={styles.linkContainer}>
                    <Icon name="arrow-circle-right" size={15}></Icon>
                    <Text style={{ fontWeight: "bold",fontSize: 13}}> Lærling </Text>
                </View>
            </TouchableOpacity>

        <View style={styles.testTwo}>
            <TouchableOpacity
                containerStyle={styles.linkContainerStyle}
                onPress={() =>
                    WebBrowser.openBrowserAsync(
                        "https://skatt.skatteetaten.no/web/minskatteside/?innvalg=minearbeidsgivere#/minearbeidsgivere"
                    )
                }
            >
                <View style={styles.linkContainer}>
                    <Icon name="arrow-circle-right" size={15}></Icon>
                    <Text style={{ fontWeight: "bold",fontSize: 13}}> Høyere og anna utdanning </Text>
                </View>
            </TouchableOpacity>
        </View>

            <TouchableOpacity
                containerStyle={styles.linkContainerStyle}
                onPress={() =>
                    WebBrowser.openBrowserAsync(
                        "https://skatt.skatteetaten.no/web/minskatteside/?innvalg=minearbeidsgivere#/minearbeidsgivere"
                    )
                }
            >
                <View style={styles.linkContainer}>
                    <Icon name="arrow-circle-right" size={15}></Icon>
                    <Text style={{ fontWeight: "bold",fontSize: 13}}> Grunnskoleopplæring </Text>
                </View>
            </TouchableOpacity>

            <TouchableOpacity
                containerStyle={styles.linkContainerStyle}
                onPress={() =>
                    WebBrowser.openBrowserAsync(
                        "https://skatt.skatteetaten.no/web/minskatteside/?innvalg=minearbeidsgivere#/minearbeidsgivere"
                    )
                }
            >
                <View style={styles.linkContainer}>
                    <Icon name="arrow-circle-right" size={15}></Icon>
                    <Text style={{ fontWeight: "bold",fontSize: 13}}> Sommerkurs </Text>
                </View>
            </TouchableOpacity>
        </View>

);

}
and CCS:
const styles = StyleSheet.create({

linkContainer:{
    flexDirection: 'column',

},

linkContainerStyle:{
    borderWidth: 1,
    borderColor: "black",
    backgroundColor: "white",
},

});
I removed my attempts in CCS as its mostly a mess at this point. If anyone have any tips on how to get the icons to align on the same line as the text as well that would be great!.

A: Here is a working example of the alignment you want

.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  width: 300px;
}

.container .item {
  width: 48%;
}

    item1

    item2

    item3

    item4

    item5


text:
Q: Maven deploy non jar file on to nexus repository using bamboo I want to deploy my build file (format *.cba) to nexus repository using Bamboo. This build file was generated by ANT. I am using maven deploy command without pom file as bamboo task within a stage. Command below.
The build file *.cba is a shared artifact.
-X deploy:deploy-file
-Dfile=${bamboo.artifacts.path.buildFile}
-Dpackaging=cba
-Durl=https://nexus.internal.organisation.com/content/repositories/snapshots/
-DrepositoryId=snapshots
-DgroupId=com.organisation.art
-DartifactId=myproject
-Dversion=0.0.1-SNAPSHOT

When bamboo runs this command, I am always getting this error.

[INFO] Downloading: https://nexus.internal.organisation.com/content/repositories/art-snapshots/com/organisation/art/myproject/0.0.1-SNAPSHOT/maven-metadata.xml
  [WARNING] Could not transfer metadata com.organisation.art:myproject:0.0.1-SNAPSHOT/maven-metadata.xml from/to art-snapshots (https://nexus.internal.organisation.com/content/repositories/art-snapshots/): /home/art/username/work/SILF/.m2/repository/com/organisation/art/myproject/0.0.1-SNAPSHOT/maven-metadata-art-snapshots.xml.part.lock (No such file or directory)
  org.eclipse.aether.transfer.MetadataTransferException: Could not transfer metadata com.organisation.art:myproject:0.0.1-SNAPSHOT/maven-metadata.xml from/to art-snapshots (https://nexus.internal.organisation.com/content/repositories/art-snapshots/): /home/art/username/work/SILF/.m2/repository/com/organisation/art/myproject/0.0.1-SNAPSHOT/maven-metadata-art-snapshots.xml.part.lock (No such file or directory)
      at org.eclipse.aether.connector.basic.MetadataTransportListener.transferFailed(MetadataTransportListener.java:43)
      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
      at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
      at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:222)
      at org.eclipse.aether.internal.impl.DefaultDeployer.upload(DefaultDeployer.java:417)
      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:290)
      at org.eclipse.aether.internal.impl.DefaultDeployer.deploy(DefaultDeployer.java:245)
      at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:413)
      at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:139)
      at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
      at org.apache.maven.plugin.deploy.DeployFileMojo.execute(DeployFileMojo.java:310)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  Caused by: java.io.FileNotFoundException: /home/art/username/work/SILF/.m2/repository/com/organisation/art/myproject/0.0.1-SNAPSHOT/maven-metadata-art-snapshots.xml.part.lock (No such file or directory)
      at java.io.RandomAccessFile.open0(Native Method)
      at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
      at java.io.RandomAccessFile.(RandomAccessFile.java:243)
      at org.eclipse.aether.connector.basic.PartialFile$LockFile.tryLock(PartialFile.java:123)
      at org.eclipse.aether.connector.basic.PartialFile$LockFile.lock(PartialFile.java:71)
      at org.eclipse.aether.connector.basic.PartialFile$LockFile.(PartialFile.java:58)
      at org.eclipse.aether.connector.basic.PartialFile$Factory.newInstance(PartialFile.java:210)
      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:432)
      at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
      ... 32 more

I am thinking there is some problem with the versioning. Any help?

A: I am able to solve this issue using the below command. Hope this will help.
mvn deploy:deploy-file
-Dfile=${bamboo.artifacts.path.cbaFile}
-Dpackaging=cba
-DgeneratePom=false
-DupdateReleaseInfo=true
-Durl=https://nexus.organisation.com/content/repositories/snapshots
-DrepositoryId=snapshots
-DgroupId=com.organisation.dept
-DartifactId=myproject
-Dversion=0.0.1-SNAPSHOT

A: cba is AFAIK not a valid packaging value, see "packaging":
https://maven.apache.org/pom.html
Maybe you are better off by zipping your script and deploy it with packaging "zip".


text:
Q: Is it better to use Actions.sendKeys() or WebElement.sendKeys() to simulate a user typing with Selenium WebDriver? As far as I'm aware there are two ways of typing with Selenium:
new Actions(webDriver).sendKeys("text to send").perform();
webElement.sendKeys("text to send");

The Actions method seems like the most natural way of replicating a user typing as the keys are sent wherever the browser wants (I believe a method called sendKeysToActiveElement is being used under the covers). However, many tutorials instruct testers to use the WebElement method (this is in fact the only option when using SafariDriver), I assume as it is simpler.
Is the Actions method actually a better simulation of user interaction, or should I use the WebElement method for convenience?

A: public Actions sendKeys(java.lang.CharSequence... keys)
Sends keys to the active element. This differs from calling WebElement.sendKeys(CharSequence...) on the active element in two ways:

*

*The modifier keys included in this call are not released.

*There is no attempt to re-focus the element - so sendKeys(Keys.TAB) for switching elements should work.

for more you can refer this link : https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/interactions/Actions.html#sendKeys-java.lang.CharSequence...-

A: This doesn't answert the question directly but I would have thought using SendKeys in the WebElement class would have been better, since you already have the WebElement object in memory, why do you need to create an Actions object?
I have always used the WebElement.SendKeys() method and I have not found any uses to switch over to using the Actions class for sending over a regular string.
I would use the Actions class when I require more complex scenarios e.g. Need to hold down a button or drag something.

A: Two things:

*

*If you want to recreate exactly the interactions of a user, it is better to use Actions, otherwise it is better to use webElement.sendkeys() because it is more practical and simple.

*If you need to execute a complex action like drag and drop it is also better to use Actions.


text:
Q: a simple question about local inversion of a power series Suppose $F(z,w)=0$, where $F$ is a polynomial in both variables, further suppose that we have a taylor series for $w(z)$ in a neighborhood of a point $z_0$ : $$ w(z)=w_0 + \sum_{k=1}^{\infty} a_k (z-z_0)^k $$
also suppose that $\displaystyle \frac{\partial F}{\partial z} \Big|_{(z_0,w_0)} \neq 0 $; the implicit function theorem tells us that we can solve for $z$ in a sufficiently small neighborhood of $z_0$;  but do we necessarily know that w(z) would be a biholomorphic map ? i.e. is it correct that  $$z-z_0 = \sum^{\infty}_{k=1} b_k(w-w_0)^k$$ with $\displaystyle b_1=\frac{1}{a_1}$.
Any help is appreciated, thanks

A: Yes, there is an analytic implicit function theorem.  And if $w(z)$ is analytic near $z_0$ with $w'(z_0) \ne 0$, then $w$ is one-to-one in a neighbourhood of $z_0$, its inverse on the image of that neighbourhood being analytic.


text: Q: BeanUtils.copyProperties() in SpringFramework I have two Entity with many properties, each with annotated @SequenceGenerator and ID column annotated with @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="SEQ_NAME"). The question is, when i use BeanUtils.copyProperties(source,target) and then saveAndFlush() method what data for ID save in target table? Does BeanUtils copy it from source or SequenceGenerator generate it?


text:
Q: input(file) and input (text) send with one ajax html
<body>
    <form method="post" action="" id="dataForm" enctype="multipart/form-data">
        <input type="text" id="textSelector"/>
        <input type="file" id="fileSelector"/>
        <button name="sub-comfirm" class="btn-selection-content" type="submit" id="sub-comfirm">Send</button>
    </form>
</body>

js/ajax
var fileVar = null;// global var to store file info
$(document).ready(function(){
    $('#dataForm').on('submit', function(e) {
        e.preventDefault();
        SendData();
    });

    $('#fileSelector').on('change',function(ev){
        fileVar = null;
        fileVar = new FormData();
        $.each(ev.target.files, function(key, value)
        {
            fileVar.append(key, value);
        });
    });
});

function SendData(){
    var formData = new FormData($("#dataForm")[0]);
    // should i add the filerVar like this ?
    // formData.append("Image", fileVar);

    $.ajax({
        type: "POST",
        url: "checkinput.php",//you need to add this '?files part' to URL
        data: formData,// use fileVar here now
        cache: false,
        processData: false,
        // contentType: false,
        success:function(data)
        {
            console.log(data);
            console.log("success");
        },
        error: function(jqXHR, textStatus, errorThrown)
        {
            console.log("failure");
        }
    });
}

php
print_r($_POST);
print_r($_FILES);

my intention is to send input(file) and input(text) in one ajax , i can get the input file value if i add ajax data with fileVar , but i cant get my input text value i have no idea why , can anyone tell me what i did wrong ?
var formData = new FormData($("#dataForm")[0]) is the way to get both to one ajax but i cant get any input text value.
anyone can teach me how to make this work ?

A: I think you need to specify input name attributes:
<body>
    <form method="post" action="" id="dataForm" enctype="multipart/form-data">
        <input type="text" id="textSelector" name="textSelector"/>
        <input type="file" id="fileSelector" name="fileSelector"/>
        <button name="sub-comfirm" class="btn-selection-content" type="submit" id="sub-comfirm">Send</button>
    </form>
</body>

Hope that helps.


text:
Q: ASP .NET Application_Start Event + Connection to a DB I have started developing a full-web application by using the ASP .NET MVC 3 framework.
I am a MVC 3 beginner developer.
On the server-side I am going to execute some queries to a DB.
Consequently I will have to make a connection to the DB.
I would like to know if it is better to make a connection in the beginning of each action method or in an event handler.
I have thought about making the connection in the Application_Start event handler and then storing an object representing my connection into the application state.
Does this way present disadvantages ?
Thanks in advance for your future answer

A: Open and close the connection as required (rather than keeping one open). Let connection pooling work for you.
10 Tips for Writing High-Performance Web Applications (ASP.NET but contains relevant advice):

Tip 3—Connection Pooling
Setting up the TCP connection between your Web application and SQL
  Server™ can be an expensive operation. Developers at Microsoft have
  been able to take advantage of connection pooling for some time now,
  allowing them to reuse connections to the database. Rather than
  setting up a new TCP connection on each request, a new connection is
  set up only when one is not available in the connection pool. When the
  connection is closed, it is returned to the pool where it remains
  connected to the database, as opposed to completely tearing down that
  TCP connection.


text:
Q: Firewall rules for process Is there a way to create (outgoing) firewall rules that apply to a specific process only? I'm currently running various *buntus. All 16.04 or 16.10.
On Windows, nearly all firewalls have the ability to create rules that apply to specific processes, in addition to the regular network rules.
Can this be achieved on Ubuntu distros?


text:
Q: Objective C inheritance and syntax I am starting to learn basic of Objective-C, currently reading Kochan's (Progamming Objective C).
I am stucked at Inheritance topic.
I have 2 Class and 1 subClass, XYPoint and Rectangle, Square (Square is subclass of Rectangle).
I have method which can retain value X and Y coordinate for Rectangle Object.
here is my main.m files
#import <Foundation/Foundation.h>
#import "Rectangle.h"
#import "Square.h"
#import "XYPoint.h"

int main(int argc, const char * argv[])
{

    @autoreleasepool {

        Square *square1 = [[Square alloc]init];
        XYPoint *myPoint = [[XYPoint alloc]init];

        [myPoint setX:33 andY:33];

        [square1 setOrigin:myPoint];

        [myPoint setX:25 andY:25];
        NSLog(@"square1 origin is %i and %i",[[square1 origin]x],[[square1 origin]y]);
        [myPoint setX:125 andY:125];

        NSLog(@"square1 origin is %i and %i",[[square1 origin]x],[[square1 origin]y]);

        [myPoint setX:25 andY:25];
        NSLog(@"square1 origin is %i and %i",[[square1 origin]x],[[square1 origin]y]);

    }
    return 0;
}

and my Rectangle.m
-(void) setOrigin:(XYPoint *)pt{

       if (!origin)
        origin = [[XYPoint alloc]init];

        origin.x = pt.x;
        origin.y = pt.y;

}

-(XYPoint *)origin {
    return  origin;
}

and XYPoint.m files
- (void) setX:(int)xVal andY: (int) yVal{

    x = xVal;
    y = yVal;

}

Output from this Program is :
2014-01-23 15:25:36.368 Rectangle1[4356:303] square1 origin is 33 and 33
2014-01-23 15:25:36.370 Rectangle1[4356:303] square1 origin is 33 and 33
2014-01-23 15:25:36.370 Rectangle1[4356:303] square1 origin is 33 and 33

NSLogged 3 times. this retain method  -(void) setOrigin:(XYPoint *)pt;
helped to retain XY values on Rectangle Object even XY value reseted through setX andY method.
but when I changed retain method into this :
-(void) setOrigin:(XYPoint *)pt{
       if (!origin)
        origin = [[XYPoint alloc]init];

        origin = pt;
}

NSLogged output changed into this :
2014-01-23 15:29:54.287 Rectangle1[4398:303] square1 origin is 25 and 25
2014-01-23 15:29:54.288 Rectangle1[4398:303] square1 origin is 125 and 125
2014-01-23 15:29:54.289 Rectangle1[4398:303] square1 origin is 25 and 25

what is the difference between those two ? aren't those two have the same characteristic pointing at the same coordinate both for x and y?

A: Because You're creating an origin with the name  myPoint using the following :
[myPoint setX:33 andY:33];

And then you're making the myPoint as origin of square 1using :
[square1 setOrigin:myPoint];

And then you're changing the co-ordinates of square using the statements:
[myPoint setX:25 andY:25];
[myPoint setX:125 andY:125];
[myPoint setX:25 andY:25];

When you change the values and then try to print the origin using the
[[square1 origin]x];
[[square1 origin]y];

You'll get the modified values because when you say :
[origin x]; // it points to myPoint.x which u r changing all the time.

and
[origin Y]; // it points to myPoint.y which u r changing all the time.

Finally you are getting the right output . Please analyse the code properly.
EDIT: You have gone wrong in defining:
-(void) setOrigin:(XYPoint *)pt;

when you do this :
-(void) setOrigin:(XYPoint *)pt{
    if (!origin){
            origin = [[XYPoint alloc]init];

            origin = pt;// makes origin.X to point to pt.x and origin.Y to point to pt.y
   }
}

you're just making origin point to pt (which is myPoint), i.e, origin is nothing but a pointer to pt ,so when myPoint's X and Y value changes. Your origin.x and origin.y changes. This is a shallow copy.
But when we do this :
-(void) setOrigin:(XYPoint *)pt{
if (!origin){
origin = [[XYPoint alloc]init];
origin.x = pt.x;// copies value in pt.x to origin.x, so when pt.x changes origin.x doesn't change
origin.y = pt.y;// copies value in pt.y to origin.y, so when pt.y changes origin.y doesn't change
}

    }

We're acheiving a Deep Copy, which means whenever mypoint.x and mypoint.y changes our origin.x and origin.y doesn't change.


text:
Q: Array output truncated I have written the following code which takes the input of an array
and returns it stretched.
For example
{18, 7, 9, 90}

should be returned as:
{9, 9, 4, 3, 5, 4, 45, 45}

This is the code I wrote:
import java.util.Arrays;

public class Stretching
{
  public static void main(String[] args)
  {
    int[] list = {18, 7, 9, 90};
    int[] list2 = stretch(list);

    System.out.println(Arrays.toString(list));
    System.out.println(Arrays.toString(list2));
  }
  public static int[] stretch(int[] array)
  {
    int[] stretched = new int[2*array.length];
    for (int i = 0; i < array.length; i++)
    {
      if (array[i]%2 == 1)
      {
        stretched[i] = array[i]/2;
        stretched[i] = array[i]/2 + 1;
      }
      else
      {
        stretched[i] = array[i]/2;
        stretched[i] = array[i]/2;
      }
    }
    return stretched;
  }
}

Unfortunately, the output is like this:
[9, 3, 4, 45, 0, 0, 0, 0]

How can I fix this error?

A: You are reusing the i index that refers to the positions in the original array. Instead, since you're stretching your array, the target indexes should be:
if (array[i]%2 == 1)
{
    stretched[2 * i] = array[i]/2 + 1;
    stretched[2 * i + 1] = array[i]/2;
}
else
{
    stretched[2 * i] = array[i]/2;
    stretched[2 * i + 1] = array[i]/2;
}

A: There is a very big error in this code.
  if (array[i]%2 == 1)
  {
    // Here array[i]/2+1 to index i
    stretched[i] = array[i]/2 + 1;
    // Here array[i]/2 to index i
    stretched[i] = array[i]/2;
  }
  else
  {
    // Here array[i]/2 to index i
    stretched[i] = array[i]/2;
    // Here array[i]/2 to index i
    stretched[i] = array[i]/2;
  }

Here, you are assigning to the stretched array two values at the same index where as what you really want is to assign them to consecutive indices.
Rather you must modify your code like the following
import java.util.Arrays;

class Stretching
{
  public static void main(String[] args)
  {
    int[] list = {18, 7, 9, 90};
    int[] list2 = stretch(list);

    System.out.println(Arrays.toString(list));
    System.out.println(Arrays.toString(list2));
  }
  public static int[] stretch(int[] array)
  {
    int[] stretched = new int[2*array.length];
    for (int i = 0; i < array.length; i++)
    {
      if (array[i]%2 == 1)
      {
        stretched[2 * i] = array[i]/2 + 1;
        stretched[2 * i + 1] = array[i]/2;
      }
      else
      {
        stretched[2 * i] = array[i]/2;
        stretched[2 * i + 1] = array[i]/2;
      }
    }
    return stretched;
  }
}

Hope you understand the bug!!


text:
Q: Javascript functions as values and closure I am grappling to understand functions as values, and closure in Javascript.
Consider the code;
function multiplier(factor) {
    return function (number) {return number * factor; }
}
var i = multiplier(10);

What is i actually holding at this point? I know I could use i next by doing something like
console.log(i(5));

which would produce the value 50. But I'd still like to know what Javascript actually gives to i before this.

A: Consider the following two examples. The first you have given and the second one I provided.
In the first one might think that the returned function is
function (number) {return number * 10; }

But this isn't really the case even if it is easy to think of it that way. factor is saved as a reference to the parameter factor. So the function multiplier returns a function with a reference to the value you provided.
If the value of factor changes then the function result is different.

function multiplier(factor) {
    return function (number) {return number * factor; }
}
var i = multiplier(10);
console.log('Example1',i(5))

function multiplier2(factor) {
    setTimeout(() => {factor = 100}, 1000)
    return function (number) {return number * factor; }
}
var i2 = multiplier2(10);
console.log('Example2',i2(5))
setTimeout(() => {console.log('Example2',i2(5))}, 1100)

A: var i = multiplier(10);

is actually var i = function(number){return number * 10;}
then when calling console.log(i(5));
you are calling
console.log(function(5){return 5* 10;})

A: i is actually a brand new function: function (number) {return number * 10; }
So if you have j = multiplier(10); actually i is not j, because they are 2 different functions
One more note is that, after i = multiplier(10); you no longer have factor as reference or as value anymore, factor already disappear from your i


text:
Q: ASP.Net Core - JWT Authentication with WebAPI and MVC Frontend not working The Project consists of two Parts:

*

*ASP.Net Core API

*ASP.Net Core MVC Frontend

Basically, what I want to do is authentication via JWT. So the API issues JWT and the MVC Frontend uses Identity with the claims and roles declared in the JWT.
Startup.cs in the API:
private const string SecretKey = "my_Secret_Key";
private readonly SymmetricSecurityKey _signingKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(SecretKey));

            #region JWT Auth

        // jwt wire up
        // Get options from app settings
        var jwtAppSettingOptions = Configuration.GetSection(nameof(JwtIssuerOptions));

        // Configure JwtIssuerOptions
        services.Configure<JwtIssuerOptions>(options =>
        {
            options.Issuer = jwtAppSettingOptions[nameof(JwtIssuerOptions.Issuer)];
            options.Audience = jwtAppSettingOptions[nameof(JwtIssuerOptions.Audience)];
            options.SigningCredentials = new SigningCredentials(_signingKey, SecurityAlgorithms.HmacSha256);
        });

        var tokenValidationParameters = new TokenValidationParameters
        {
            ValidateIssuer = true,
            ValidIssuer = jwtAppSettingOptions[nameof(JwtIssuerOptions.Issuer)],

            ValidateAudience = true,
            ValidAudience = jwtAppSettingOptions[nameof(JwtIssuerOptions.Audience)],

            ValidateIssuerSigningKey = true,
            IssuerSigningKey = _signingKey,

            RequireExpirationTime = false,
            ValidateLifetime = true,
            ClockSkew = TimeSpan.Zero
        };

        services.AddAuthentication(options =>
        {
            options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
            options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;

        }).AddJwtBearer(configureOptions =>
        {
            configureOptions.ClaimsIssuer = jwtAppSettingOptions[nameof(JwtIssuerOptions.Issuer)];
            configureOptions.TokenValidationParameters = tokenValidationParameters;
            configureOptions.SaveToken = true;
        });

        // api user claim policy
        services.AddAuthorization(options =>
        {
            options.AddPolicy(Constants.Policies.ApiAccess, policy => policy.RequireClaim(Constants.JwtClaimIdentifiers.Rol, Constants.JwtClaims.ApiAccess));
        });

        #endregion

JWT Generation:
        public async Task<string> GenerateEncodedToken(string userName)
    {

        User user = _userManager.GetUserByUserName(userName);
        List<string> userRoles = _userManager.GetRoles(user.Guid);

        var claimsToEncode = new[]
     {
             new Claim(JwtRegisteredClaimNames.Sub, userName),
             new Claim("web", user.WebId),
             new Claim(JwtRegisteredClaimNames.Jti, await _jwtOptions.JtiGenerator()),
             new Claim(JwtRegisteredClaimNames.Iat, ToUnixEpochDate(_jwtOptions.IssuedAt).ToString(), ClaimValueTypes.Integer64),
             new Claim(Constants.JwtClaimIdentifiers.Rol,Constants.JwtClaims.ApiAccess),
     };

        // Create the JWT security token and encode it.
        var jwt = new JwtSecurityToken(
            issuer: _jwtOptions.Issuer,
            audience: _jwtOptions.Audience,
            claims: claimsToEncode,
            notBefore: _jwtOptions.NotBefore,
            expires: _jwtOptions.Expiration,
            signingCredentials: _jwtOptions.SigningCredentials);

        jwt.Payload.Add("roles", userRoles.ToArray());

        var encodedJwt = new JwtSecurityTokenHandler().WriteToken(jwt);

        return encodedJwt;
    }

Authorization works like a charm with this in the API.
Now I want to do the following:
Implement the same in the Frontend, so that:
MVC Frontend receives Credentials, send them to the API, get Token, and Authorize with the Claims and Roles in the Token.
I tried several things, but none of them worked so far.
What do I have to insert in the Startup.cs in the Frontend so that Identity checks not against the secret key (which the Frontend is not allowed to have) but against a public key? Or do I have to implement a Endpoint in the API which validates the JWT remotely?

A: When you get the token in web client, you can store it in a session object and send that whenever you are requesting something from the webapi


text:
Q: jquery each if statement highlight matching variable I am blanking on how to get this to work. Basically I am just trying to go over a list of items that are nav links and compare them to the title of the page. If the title is the same as the list item, change the color. Basically highlight what page you are on. Only this highlights all the items.
var secondNav = $('.custom-post-side-list ul li a');
var title = $('.custom-post-main h1');

secondNav.each(function(index, el) {
    var $this = $(this);

    if(title = $this) {
        $this.css('color', 'red');
    }
});

A: So basically I wasnt comparing two of the same objects. So what I did was grab the text from the two elements and compared that. If true, then change the element.
//Highlight current
var secondNav = $('.custom-post-side-list ul li a');
var title = $('.custom-post-main h1');

secondNav.each(function(index, el) {
    var $this = $(this);
    var titleText = title.text();
    var navText = $this.text();

    if (navText == titleText) {
        $this.css('color', 'red');
    }
});


text:
Q: Cancel/Modify Intent Message I want to send a confirmation from the second activity to the main activity. If the checkbox is marked then I want to set Intent data and set the Result returned from activity to true.
Otherwise if the checkbox is unmarked then I want to either:

*

*Modify the intent that was set to false

*Remove the intent altogether as if it wasn't set
 ConfirmCheckBox.setOnClickListener(new View.OnClickListener() {

 @Override
 public void onClick(View view) {

        // Is the view now checked?
        boolean checked = ((CheckBox) view).isChecked();

        if (checked) {
            Intent data = new Intent();
            data.putExtra(EXTRA_CONFIRM, true);
            setResult(RESULT_OK, data);
        }
        else
        {
            // Remove or modify to false.
        }
    }
});

How can I do either of the actions to modify or cancel the Intent message? also, I would like to know what's the best way to handle it?

A: you can remove the extras using removeExtra() method and replace it using getIntent().replaceExtras()
Remove argument from intent:
  getIntent().removeExtra("search");

Replace bundle with new extras:
  Bundle extras = new Bundle();
  extras.putString("key","Value");
  getIntent().replaceExtras(extras);

A: You can simply use the checkbox value as value for your Intent. There's no need to have this if/else construct.
@Override
public void onClick(View view) {

    // Is the view now checked?
    boolean checked = ((CheckBox) view).isChecked();
    Intent data = new Intent();
    data.putExtra(EXTRA_CONFIRM, true);
    setResult(RESULT_OK, data);
}

In your MainActivity's onActivityResult you can simply check the Intents Extra for EXTRA_CONFIRM and decide how to react if the value is true/false.
Thats the basic approach to handle data sending between activities.
Further reading:
https://developer.android.com/training/basics/intents/result.html


text:
Q: Logstash filter does not works on any logline I using this logstash configuration for filter my logs:
  input {
      udp {
        port  => 9600
        codec => json
      }
      tcp {
        port  => 9600
        codec => json
      }
    }

    filter {
      mutate { add_field => [ "pod_id", "${POD_ID}" ] }
      if [docker.image] =~ /consul/ {
        mutate { add_field => [ "image_type", "consul" ]  }
      }
      else if [docker.image] =~ /image86/ {
        mutate { add_field => [ "image_type", "image86" ]  }
      }
      else if [docker.image] =~ /traefik/ {
        mutate { add_field => [ "image_type", "traefik" ] }
      } else {
        drop {}
      }

    }

    output {
      file {
       path => [ "${LOGSTASH_OUTPUT_PATH}/${NODE_ID}/%{image_type}-%{+YYYY-MM-dd}.log" ]
      }
    }

An example line for the logs:
{
  "@timestamp": "2017-08-16T10:31:24.912Z",
  "stream": "stderr",
  "port": 58768,
  "@version": "1",
  "host": "127.0.0.1",
  "message": "\"Update /api/v1/namespaces/default/pods/logstash-l0t1l/status\" [638.662326ms] [107.202µs] END",
  "pod_id": "logstash-h04h7",
  "docker": {
    "image": "gcrio.azureedge.net/google_containers/traefik@sha256:97a2133434e2d3b12afcc19d47c53bf4c3539eb8dab1ece0bc58cc9509",
    "hostname": "k8s-master-sdfsd1DC9D-1",
    "name": "/traefik_kube-system_0b2942b3e833432463ca0b767977a99e_0",
    "id": "fbc8bbbdaf2c3845008fc800a6134e2740eb72f9f705b0720a450a9c2d435c76",
    "labels": null
  },
  "tags": []
}

The problem with this one is that every message will be dropped and nothing go to the endfile. I am very beginner in logstash so can you help me.

A: To access the docker.image value in the logstash filter, you have to use [docker][image]
Edit: The reference in the logstash documentation:

The syntax to access a field is [fieldname]. If you are referring to a top-level field, you can omit the [] and simply use fieldname. To refer to a nested field, you specify the full path to that field: [top-level field][nested field].


text:
Q: phpmyadmin logic command to unpublish records in table stored before set period of time I have date as DB column
Can someone advise on a command in phpmyadmin which will unpublish all records more than 6 month old
For Instance -
v_id : unique record value given to every record
Adddate : Date field - values stores as 2015-11-23 09:39:28 (Year-Month-Date Time)
v_status : 1 means published and 0 means unpublished
Table name xyz_used
What command can i run in my phpadmin so that it can unpublish i.e make V_id record status i.e. v_status as 0 having adddate as before 2015-05-31 in table xyz_used
Pls am not aware of command at all - hence asking question for help
thanks

A: first of all phpmyadmin is a tool or webapp to access mysql databases. you can say it is a client utility.
Second
To update a table you will need to write Update Sql Query where you can put the date and can set the status.
query would be like
Updaate <tbl> set v_status = 0 where datefield  < date_sub(now(), interval 6 month);


text:
Q: truecrypt - copy without mounting I would like to copy files into a truecrypt partition without mounting it or mounting it in a hide way (without another volume displayed in "my computer"). I considered hiding the new volume but it requires admin priv' whice i dont have.
Thank you!

A: I don't think you can do that by definition.  But if what you want to achieve is to prevent any other user being able to view your files in the mounted TC volume you could change the file permissions to deny read+write access to everyone except yourself.


text:
Q: Obteniendo datos nulos con LEFT OUTER JOIN entre dos tablas Tengo el siguiente código:
SELECT
    a.*
FROM
    tr_HistoryRecords a
LEFT JOIN tr_HistoryRecords1 b
    ON
    a.id_employee = b.id_employee
WHERE
    b.id_employee IS NULL;

Quiero pasar datos que no existen en "b" de "a", pero no funciona mi consulta.
PD. Hace días este código funcionaba perfectamente.

A: Para que tu consulta funcione como quieres, tienes que agregar la columna id_course como condición del JOIN:
SELECT a.*
FROM tr_HistoryRecords a
LEFT JOIN tr_HistoryRecords1 b
    ON a.id_employee = b.id_employee
    AND a.id_course = b.id_course
WHERE b.id_employee IS NULL;


text: Q: How to get colour of an SVG image at a given coordinate? I want to sample the colour of an SVG image at a given location. For example, get_colour(svg, 0.01, 0.02) would return the colour at the point with x coordinate 0.01 and y coordinate 0.02. Is there a simple way to do this without rasterisation?


text:
Q: Python plotting using dopri5 My goal is to plot the following set of coupled ODEs:

The odeint method was giving me problems (such as some of the x_i's taking on negative values which analytically does not happen), so I decided to use a fourth-order Runge-Kutta solver. I was following the examples here to use the dopri5 method (Using adaptive step sizes with scipy.integrate.ode):
import scipy as sp
import pylab as plt
import numpy as np
import scipy.integrate as spi

#Constants
c13 = 6.2
c14 = 1.0
c21 = 7.3
c32 = 2.4
c34 = 12.7
c42 = 5.7
c43 = 5.0

e12 = 1.5
e23 = 2.5
e24 = 2.0
e31 = 3.0
e41 = 4.8

#Time
t_end = 700
t_start = 0
t_step = 1
t_interval = sp.arange(t_start, t_end, t_step)

#Initial Condition
ic = [0.2,0.3,0.3,0.5]

def model(t,ic):
    Eqs= np.zeros((4))
    Eqs[0] = (ic[0]*(1-ic[0]*ic[0]-ic[1]*ic[1]-ic[2]*ic[2]-ic[3]*ic[3])-c21*((ic[1]*ic[1])*ic[0])+e31*((ic[2]*ic[2])*ic[0])+e41*((ic[3]*ic[3])*ic[0]))
    Eqs[1] = (ic[1]*(1-ic[0]*ic[0]-ic[1]*ic[1]-ic[2]*ic[2]-ic[3]*ic[3])+e12*((ic[0]*ic[0])*ic[1])-c32*((ic[2]*ic[2])*ic[1])-c42*((ic[3]*ic[3])*ic[1]))
    Eqs[2] = (ic[2]*(1-ic[0]*ic[0]-ic[1]*ic[1]-ic[2]*ic[2]-ic[3]*ic[3])-c13*((ic[0]*ic[0])*ic[2])+e23*((ic[1]*ic[1])*ic[2])-c43*((ic[3]*ic[3])*ic[2]))
    Eqs[3] = (ic[3]*(1-ic[0]*ic[0]-ic[1]*ic[1]-ic[2]*ic[2]-ic[3]*ic[3])-c14*((ic[0]*ic[0])*ic[3])+e24*((ic[1]*ic[1])*ic[3])-c34*((ic[2]*ic[2])*ic[3]))
    return Eqs

ode =  spi.ode(model)

ode.set_integrator('dopri5')
ode.set_initial_value(ic,t_start)
ts = []
ys = []

while ode.successful() and ode.t < t_end:
    ode.integrate(ode.t + t_step)
    ts.append(ode.t)
    ys.append(ode.y)

t = np.vstack(ts)
x1,x2,x3,x4 = np.vstack(ys).T

plt.subplot(1, 1, 1)
plt.plot(t, x1, 'r', label = 'x1')
plt.plot(t, x2, 'b', label = 'x2')
plt.plot(t, x3, 'g', label = 'x3')
plt.plot(t, x4, 'purple', label = 'x4')
plt.xlim([0,t_end])
plt.legend()
plt.ylim([-0.2,1.3])

plt.show()

which produces the following plot:

However, my plots have something odd about them -- the x1 value seems to randomly spike above 1. Because (1,0,0,0) is a fixed point of the dynamical system, it doesn't make much sense to me that it spikes above one (there might've been a reason if the spikes had shown some sort of repetitive pattern, but they look random in the plot, so I'm wondering if that has more to do with just the numerical integration rather than the actual dynamics). Changing parameters also changes that spike (some parameter values I tried still have that spiking but it's substantially less). I therefore have 2 questions:
1) What is causing these spikes to appear? My original thought was that it was the "t_step" being large, so I tried playing around with it (which leads me to my second question)
2) I tried changing the step size from 1 to 0.1. However it produced this plot, which actually looks much different than if step size was 1 (which I thought lower step size would produce more accurate plots?) In this plot, it appears that the time each x_i spends near 1 is longer than if the step size was 1 instead of 0.1, and the heights of the spikes are all equal -- how do I know which plot is more accurate of the true system considering the plots have some substantial differences?

The real crux of the problem I'm working on is looking up the interaction between x3 and x4, but I want to make sure the simulations are set up correctly so that I can get accurate results about x3 and x4!

A: By the Gronwall lemma, the error propagation of "nice" ODE is controlled by an exponential with the Lipschitz constant L as factor. Which means that any local error contribution incurred at time t gets (potentially) magnified by a factor of exp(L(T-t)) at time T.
Being generous one may use L=10 for your system. Over a time interval of 10 this gives an error magnification of exp(100)=2.688e+43, or a total decoupling of the numerical value from the initial value and the exact solution.
Thus it is more astonishing how far, up to t=80, the similarity of both solutions is preserved.

Notes on the theory, spikes: There is nothing limiting the variables to stay inside the interval [0,1] or to have some conserved quantity that has the same effect. The best you can do is to use a Ljapunov function like V(x)=sum(x*x) which then gives bounds that limit the solution to be between two spheres.
The fixed points are all hyperbolic, the Jacobian there is rank-deficient and traceless which excludes stable fixed points. The spikes are then just a result of the direction of the stable and unstable manifolds/axis of these hyperbolic points.


text:
Q: Rails: how to calculate the average of a small set of elements I've looked at resources to know how to find the average with RoR built-in average ActiveRecord::Calculations. I've also looked online for ideas on how to calculate averages: Rails calculate and display average.
But cannot find any reference on how to calculate the average of a set of elements from the database column.
In the controller:
@jobpostings = Jobposting.all

@medical = @jobpostings.where("title like ? OR title like ?", "%MEDICAL SPECIALIST%", "%MEDICAL EXAMINER%").limit(4).order('max_salary DESC')
@medical_salary = "%.2f" % @medical.average(:max_salary).truncate(2)

@medical returns:
CITY MEDICAL SPECIALIST
220480.0
CITY MEDICAL EXAMINER (OCME)
180000.0
CITY MEDICAL SPECIALIST
158080.0
CITY MEDICAL SPECIALIST
130000.0

I want to find the average of :max_salary (each one is listed correctly under the job title). I use @medical_salary = "%.2f" % @medical.average(:max_salary).truncate(2) to convert the BigDecimal number and find the average of :max_salary from @medical which I thought would be limited to the top 4 displayed above.
But the result returned is: 72322.33, which is the average of the entire column (I checked), instead of the top 4.
Do I need to add another condition? Why does the average of @medical return the average of the entire column?
Any insight would help. Thanks.

A: @medical.average(:max_salary) is expanded as @jobpostings.where(...).average(:max_salary).limit(4) even though the limit(4) appears previously in the method chain.
You can confirm this by checking the query that is run which be as follows:
SELECT  AVG(`jobpostings `.`max_salary `) FROM `tickets` ... LIMIT 4`

Effectively, LIMIT 4 doesn't do anything because there is only one average number in the result of the above query.
One way to accomplish what you are trying to do will be:
$ @top_salaries = @jobpostings.where("title like ? OR title like ?", "%MEDICAL SPECIALIST%", "%MEDICAL EXAMINER%").limit(4).map(&:max_salary)
=> [ 220480.0, 180000.0, 158080.0, 130000.0]
$  average = @top_salaries.reduce(:+) / @top_salaries.size
=> 172140.0

A: @medical.average(:max_salary)

This line corresponds to following MySQL query:
SELECT AVG(`jobpostings`.`max_salary`) AS avg_max_salary FROM `jobpostings` WHERE (`jobpostings`.`title` like "%MEDICAL SPECIALIST%" OR title like "%MEDICAL EXAMINER%") LIMIT 4

Since MySQL already calculated AVG on the column max_salary, it returns only 1 row. LIMIT 4 clause doesn't actually come into play.
You can try following:
@limit = 4
@medical = @jobpostings.where("title like ? OR title like ?", "%MEDICAL SPECIALIST%", "%MEDICAL EXAMINER%").limit(@limit).order('max_salary DESC')
@medical_salary = "%.2f" %(@medical.pluck(:max_salary).reduce(&:+)/@limit.to_f).truncate(2)

It will even work for cases when no. of results are 0.


text:
Q: Python Tkinter GUI Always loads minimized I have a simple Python script that loads a GUI (created with Tkinter) when run. I used py2app to convert the Python script into a double-click app for OSX. When the app is clicked, Python executes the script. However, Python (and the GUI) load minimized. The user has to click on the Python icon in the tray in order to bring the GUI into the foreground.
I have tried adding lift() to the main Tkiner window but it doesn't seem to have any effect (I've tried similar methods with no success in bringing the window to the foreground). After the app is double-clicked, it is hard for users to tell what's going on if the GUI doesn't pop-up (especially if they are expecting some kind interface to appear). I am running Lion and didn't have this problem on Leapord.
Any help would be greatly appreciated.
Thanks.

A: I just faced the same issue and found the general cause. The problem with all the published workarounds is that they either don't work for a py2app-built executable (the '-topmost' workaround doesn't) or have serious side effects (the iconify/deiconify works but causes all future modal windows from the app to stop being dismissible, including tkMessageBox and tkFileDialog).
The problem is caused by the argv_emulation of py2app, which is enabled by default. That option puts some OSX-specific Carbon event code in the boot loader of the app, which can be found at dist/appname/Contents/Resources/__ boot __.py of your built application bundle. I don't need the argv_emulation so for now I just disabled the feature by changing argv_emulation to False in the OPTIONS dictionary of the setup.py built by py2applet:
OPTIONS = { 'argv_emulation' : False }

A: I've been able to get tkinter to play nice on Lion by adding the following before root.mainloop():
 root.attributes('-topmost', 1)
 root.update()
 root.attributes('-topmost', 0)

A: Ok, I have found a solution that is working. Launching from shell is different then launching a compiled app, this solution fix the background window issue under Lion for my compiled Python/Tkinter app
    root.iconify()
    root.deiconify()

The window still appear by default in the background, but then pops up after the iconify and deiconify are called back to back right before the root.mainloop() call


text:
Q: Is it possible to make one column readonly? I'm curious if it is possible to create a table with a column that can never be changed, but the other columns of the table can.
For instance I could imagine a CreatedByUser column that should never be changed.
Is there a built-in functionality in SQL Server for this, or is it only possible via triggers or something else?

A: You could use a view with derived column. Try this
create table ro_test(id int primary key, CreatedByUser int)
go
create view v_ro_test
as
select id, CreatedByUser*1 CreatedByUser from ro_test
go

insert into ro_test values(1,10);
update ro_test
set CreatedByUser =11
where id =1;
select * from v_ro_test;
go
--ERROR--
update v_ro_test
set CreatedByUser =10
where id =1;

--BUT--
update v_ro_test
set id =2
where id =1;
select * from v_ro_test;

A: There is no built in declarative support for non updatable columns (except for specific predefined cases such as IDENTITY)
This Connect item requested it but was rejected. Add DRI to enforce immutable column values
An UPDATE trigger would probably be the most robust way of achieving this. It could check IF UPDATE(CreatedByUser) and raise an error and rollback the transaction if true.

A: I've made my implementation of the UPDATE TRIGGER approach suggested by Martin Smith's answer as follows:
CREATE TRIGGER trgAfterUpdateAsset ON dbo.Asset
FOR UPDATE AS
IF UPDATE(AssetTypeID) AND EXISTS (SELECT * FROM inserted i JOIN deleted d ON i.ID = d.ID WHERE i.AssetTypeID <> d.AssetTypeID)
BEGIN
    RAISERROR ('AssetTypeID cannot change.', 16, 1);
    ROLLBACK TRAN
END

(Note: The table has a Primary Key column, called ID).
I'm only rejecting the update if the value of AssetTypeID changes. So the column could be present in an update, and if the value did not change, than it would pass through. (I needed this way)

A: Why are you updating the createdby column?
I would have two columns a [created_by] and a [modified_by] column, where the first insert would insert all the respective columns in the record, and any subsequent updates would just update the [modified_by] column ( via a trigger on in the application layer you can structure your update to only change the [modified_by] , along with your respective columns )

A: I know this is rather old, but there is a way to prevent a column from being UPDATED, which is the reason why SQL does not need an immutable schema, and is the same reason why Microsoft SQL Server did not ever fulfill the request linked by @Martin Smith in the answer.
The following line will prevent your table from being updated or altered anyhow.
GRANT INSERT ON database.immutable TO 'user'@'localhost' IDENTIFIED BY 'password';

You can grant every permission on every database and table, but keep "INSERT" only wherever you need a pseudo-immutable table. Hope this helps.


text:
Q: javasetting jdbc driver for coldfusion (Railo) in Application.cfc I have never had a need to handle a JDBC driver and DB like this so any help is appreciated. But I am working an environment that prevents me from doing anything in the cfadmin.
In Railo under webapps I have a website folder called cms.  That folder contains a file structure you would expect, js, css, img, etc.
It also has two additional folders:
/db/cms.sqlite.db
/jar/sqlite-jdbc-3.8.6.jar
Here is my Application.cfc code (cfscript):
this.javaSettings = {LoadPaths = ["./jar/"], loadColdFusionClassPath = true, reloadOnChange = true, watchInterval=30};
obj = createObject("java", "org.sqlite.JDBC");
this.datasources["cms"] = {class:'org.sqlite.JDBC',connectionString:'jdbc:sqlite:webapps/cms/db/cms.sqlite.db'};

How can I get all this to work? I can get the DB to work if I copy the JDBC jar file to /lib/ext(so that datasources with connection string works for me).
Now I just have to access that JDBC jar file locally and make it accessible to form a connection string (and I don't know how exactly to do that...but I think I am close).
Edit:
Would this also work the same in Coldfusion 11?


text:
Q: FtpWebRequest.GetRequestStream Fails with RETR but works with STOR I am sending and receiving a file to an OCR service via FTP. using the FtpWebRequest library in .NET
I used the same block of code for setting up the connection in both cases with only two changes:
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://" + server + "/FTP/Input/" + fileNameWithoutExtension+".pdf");
                            ftp.Method = WebRequestMethods.Ftp.UploadFile;
                            ftp.Credentials = new NetworkCredential(username, password);
                            ftp.Timeout = 10000;
                            ftp.UseBinary = true;
                            ftp.KeepAlive = false;
                            ftp.UsePassive = true;

                            try
                            {
                                using (var ftpStream = ftp.GetRequestStream())

vs.
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://" + server + "/FTP/Output/" + fileNameWithoutExtension+".txt");
                            ftp.Method = WebRequestMethods.Ftp.DownloadFile;
                            ftp.Credentials = new NetworkCredential(username, password);
                            ftp.Timeout = 10000000;
                            ftp.UseBinary = true;
                            ftp.KeepAlive = false;
                            ftp.UsePassive = true;

                            try
                            {
                                using (var ftpStream = ftp.GetRequestStream())

Opening up the "ftp" object,
the "method" for "upload" is "STOR"
the "method" for "download" is "RETR"
The STOR works
the RETR just times out
I can manually connect to the directory and list as well as download the files using the Windows Explorer
but if I connect via the "ftp" client in CMD - I also get timeouts even using GET
any ideas?


text:
Q: Update table query from another table postgresql I have 2 update table queries in posgresql that returns successful but the updated table is empty when I checked
Query 1
UPDATE tt
SET Name=subquery.Name1,
    id=subquery.id1
FROM (SELECT id1,Name1
      FROM  tt1) AS subquery
WHERE tt.id=subquery.id1;
select * from tt;

Query 2
with t as (
    select t0.id as rowid, t1.Name1 as calculatedvalue
    from tt t0
    join tt1 t1 on t0.id = t1.id1
)
update tt
set Name = t.calculatedvalue
from t
where id = t.rowid;
select * from tt;


text:
Q: How can any statements be proven undecidable? As I understand it, undecidability means that there exists no proofs or contradictions of a statement.
So if you've proved $X$ is undecidable then there are no contradictions to $X$, so $X$ always holds, so $X$ is true. Similarly though, if $X$ is undecidable then $\lnot X$ is undecidable. But again, this would mean $\lnot X$ is true which is a contradiction.

A: There is no contradiction of $S$ doesn't mean $S$ is true.
The standard way is to construct "models" which satisfy all the axioms yet the statement is true in some model but false in some other model.
A famous example, the parallel postulate is independent from neutral geometry. There exists Euclidean geometry, of which the postulate hold; but also Non-euclidean geometry, of which the postulate fails.

A: The idea is that provability is a syntatic concept while truth is semantic.
Formally, a mathematical statement is simply a sequence of characters (often involving things like "(", "$\forall$ ", "$x_1$", "$\wedge$", etc).  A proof is a simply a particular kind of sequence of characters.  Note that while these characters have generally agreed upon meanings, we are NOT applying them at this stage - a proof really is just a "special type" of sequence of characters.
When one says "I can't prove statement X from axioms A", one (officially) means that there does not exist a "special type" of sequence of characters beginning with things in A and ending with X.  Note that there is no notion of whether or not "X is true" at this point.
Now, one of the most common ways one shows "I can't prove statement X from axioms A" is by exhibiting a model M of A which certain properties.  A model is a set together with interpretations of any constants, functions, and relations.  A model allows us to interpret a syntatic formal-string-of-characters mathematics statement as an honest to goodness mathematical statement, which then has a true or false value.
Then, in order to show "I can't prove statement X from axioms A", one commonly exhibits two models M and M' (i.e., 2 different interpretations of the symbols appearing in your mathematical statements) with the property that in both M and M', all axioms in A are assigned the value true, while X is assigned true in M and false in M'.
The point is that whether or not X is true or false happens in the two different settings M and M', so there's no contradictions.  In any given instance (model), X is either true or false but not both.  Undecidability means there are models where it's true and models where it is false.

A: There is a difference between "logically valid" and "provable". Some theorems can be proven; that is, they can be deduced from the axioms. That does not always imply that those theorems are logically valid (specifically in inconsistent theories), because logical validity is about "evaluating" specific statements, such as "$5>3$". It is either true or false, and in this case it is logically valid, and it is provable even ($1>0$, so $1+1>0$, so $2>0$ so $5>3$, depending on the axiom system you assume).


text:
Q: Expo app crashing on android on rendering components When i render a screen in App.js the app crashes on android but works fine on android. If i render some function defined in App.js in renders on screen.
App.js
import React from 'react';
import {enableScreens} from 'react-native-screens';
enableScreens();

import { ActivityIndicator, View, Text, Button, TextInput, StyleSheet, TouchableOpacity } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import  {createNativeStackNavigator} from "@react-navigation/native-stack";

import  Main from "./screens/Main"

function HomeScreen({navigation}) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <TouchableOpacity onPress={() => {navigation.navigate("LoginPage")}}>
                <Text>NEXT</Text>
            </TouchableOpacity>
    </View>
  );
}

function S1({navigation}) {
  return (
    <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
      <Text>Home Screen</Text>
      <TouchableOpacity onPress={() => {navigation.navigate("main")}}>
                <Text>NEXT</Text>
            </TouchableOpacity>
    </View>
  );
}

const Stack = createNativeStackNavigator();

export default function App() {
  return (
    <NavigationContainer>
      <Stack.Navigator>
        <Stack.Screen name="Home" options={{headerShown : false}} component={HomeScreen} />
        <Stack.Screen name="LoginPage" options={{headerShown : false}} component={S1} />
        <Stack.Screen name="main" options={{headerShown : false}} component={Main} />
      </Stack.Navigator>
    </NavigationContainer>
  );

}

Main.js
import react, {useState} from "react";
import { View, Text, Button, TextInput, StyleSheet, TouchableOpacity } from "react-native";

export default function Main({navigation}){

    const options = [
        {
            name: "Games",
            redirect: "Games"
        },
        {
            name : "AR Tutorials",
            redirect: "AR"
        },
        {
            name : "Competition",
            redirect : "Competition"
        }
    ];

    return(
        <View style={styles.container}
        >
            {
                options.map(op => (
                    <TouchableOpacity
                        style={styles.card}key={op.name} onPress={() => {navigation.navigate(op.redirect)}}>
                        <Text style={styles.cardText}>{op.name}</Text>
                    </TouchableOpacity>
                ))
            }
        </View>
    );
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: "center",
        alignItems: "center"
    },

    card: {
        backgroundColor: "rgb(0, 100, 255)",
        minHeight: "25%",
        minWidth: "70%",
        borderRadius: 1,
        marginVertical: "1rem",
        display: "flex",
        justifyContent: "flex-end",
        alignItems: "center"
    },

    cardText : {
        marginBottom: "0.5rem"
    }
});

Here functions HomeScreen and S1 renders but on navigating to Main the app crashes whiteout any logs.
I have tried building apk ind then running but it shows same behaviour.