text:
Q: Azerothcore connecting to internet via Docker I have Azerothcore fresh installed using install with Docker method.
I am able to connect over local network using SET realmlist 192.168.1.242
What is the best method to get docker or server to allow a friend to access over the internet? Do I have to follow a different install method? Wiki isn't very clear on this.

A: Modify the address column of the realmlist table inside your acore_auth database and put there your public IP address.
Be aware that if you don't have a static IP address, then that value will frequently change. Also, you need to open the ports 3724 and 8085 of your router.
If you can't open your router ports, you can try using some VPN like hamachi (in that case, your public address should be your hamachi one and your friends need to be in the same hamachi room of yours). This solves also the dynamic IP issue.


text:
Q: Iterating through XML tree So I have the following xml sheet and I need to print the timestep only if the vehicle's type is normal:
<?xml version="1.0" encoding="utf-8"?>
<fcd-export xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://sumo.dlr.de/xsd/fcd_file.xsd">
    <timestep time="0.00">
        <vehicle slope="0.00" lane="32909782#5_1" angle="85.36" type="normal" pos="12.10" y="6290.09" x="7863.24" speed="0.00" id="bus0"></vehicle>
        <vehicle slope="0.00" lane="34057952#19_1" angle="111.40" type="veh_passenger" pos="2.74" y="4577.24" x="12936.51" speed="0.00" id="veh0"></vehicle>
    </timestep>
    <timestep time="2.00">
        <vehicle slope="0.00" lane="32909782#5_1" angle="85.36" type="bus" pos="14.65" y="6290.30" x="7865.78" speed="1.83" id="bus0"></vehicle>
        <vehicle slope="0.00" lane=":3937025936_11_0" angle="12.20" type="bus" pos="1.25" y="6602.77" x="15149.41" speed="2.39" id="bus1"></vehicle>
        </vehicle>
        <vehicle slope="0.00" lane="-4585082#2_1" angle="357.57" type="veh_passenger" pos="5.10" y="1534.76" x="10182.72" speed="0.00" id="veh5"></vehicle>
    </timestep>
    <timestep time="3.00">
        <vehicle slope="0.00" lane="32909782#5_1" angle="85.36" type="normal" pos="17.22" y="6290.50" x="7868.34" speed="2.57" id="bus0"></vehicle>
        <vehicle slope="0.00" lane="-520627761#0_1" angle="294.88" type="veh_passenger" pos="1.04" y="4078.46" x="7552.28" speed="0.00" id="veh1"></vehicle>
        <vehicle slope="0.00" lane="-4585082#2_1" angle="357.57" type="veh_passenger" pos="6.99" y="1536.64" x="10182.64" speed="1.89" id="veh5"></vehicle>
    </timestep>
    <timestep time="4.00">
        <vehicle slope="0.00" lane="32909782#5_1" angle="85.36" type="normal" pos="20.83" y="6290.80" x="7871.94" speed="3.61" id="bus0"></vehicle>
        <vehicle slope="0.00" lane=":370532908_0_0" angle="236.46" type="normal" pos="2.54" y="6596.43" x="15145.39" speed="4.43" id="bus1"></vehicle>
        <vehicle slope="0.00" lane="-147066248#4_0" angle="153.72" type="normal" pos="12.10" y="6381.40" x="13622.55" speed="0.00" id="bus6"></vehicle>
        <vehicle slope="0.00" lane=":287820954_0_0" angle="111.47" type="veh_passenger" pos="0.36" y="4577.06" x="12936.98" speed="0.00" id="veh0"></vehicle>
        <vehicle slope="0.00" lane="-520627761#0_1" angle="294.88" type="veh_passenger" pos="1.04" y="4078.46" x="7552.28" speed="0.00" id="veh1"></vehicle>
        </vehicle>
    </timestep>
</fcd-export>

the code is as follow:
import os
import xml.etree.ElementTree as ET
import geopy.distance
import pandas as pd
import csv

tree = ET.parse('times2.xml')
file = os.path.abspath('times2.xml')

root = tree.getroot()

for timestep in root.findall('timestep'):
    for vehicle in root.iter('type'):
        if 'normal' in vehicle.attrib:
            f3.write(timestep.get('time'))

the resulting .csv file is empty. Am I missing something?
additional info that might help:
for vehicle in root.iter('vehicle'):
   if vehicle.get('type')=="normal":
        id = vehicle.get('id')
        f3.write(id)

this shows that I am able to reach the vehicle and print out its attributes, but the main point here is to be able to link the vehicle with the timestep so that when I bump into a 'normal' car, I print its timestep

redpajama_set_name: RedPajamaStackExchange


text:
Q: Question about a technique used to find extremum of a polynomial function Someone told me to find extremum of a function in form of $f(x) = (x-a)^n (x-b)^m$ we can use this method: (this a method so that we can find the extremum without using the derivative) ($n$ and $m$ are not necessarily natural numbers and can be any real number)
$$x_{ext} = \frac{ma+nb}{m+n}$$
i.e. we calculated the weighted mean of roots where their weights are the degree of the other term.
I want to know that does this method have any name for example name of a mathematician or something else? And I also want to know can this method
be somehow generalized into polynomial functions with more than two roots i.e. $(x-a)^n(x-b)^m(x-c)^p ...$ ? If yes, how?

A: This result is reached by differentiation.
By the Product Rule, $$f'(x)=n(x-a)^{n-1}(x-b)^m+m(x-a)^n(x-b)^{m-1}=0$$ for extrema. Dividing gives $$n(x-b)+m(x-a)=(m+n)x-(ma+nb)=0\implies \boxed{x=\frac{ma+nb}{m+n}}$$ as you have.

For generalisation, you can repeatedly use the Product Rule, giving $$ f'(x)=n(x-a)^{n-1}(x-b)^m(x-c)^p...+m(x-a)^n(x-b)^{m-1}(x-c)^p...+p(x-a)^n(x-b)^m(x-c)^{p-1}...+...=0$$ and simplifying gives $$n(x-b)(x-c)...+m(x-a)(x-c)...+p(x-a)(x-b)...=0$$ This becomes difficult to solve as the number of products increases - there is no general form for the solution of a quintic.

A: For the generalized version, it is easier to study logarithmic differentials:
$$ \frac{f'(x)}{f(x)}=(\ln f(x))'=\frac n{x-a}+\frac m{x-b}+\frac p{x-c}+\ldots$$
which unfortunately no longer allows such a simple solution for $x$ (you will end up with a polynomial equation with degree one less than the number of roots of $f$)


text:
Q: How can I choose option from a drop-down list in IE that's not entirely preloaded with VBA? I am trying to create a VBA macro that will automatically select the item from a drop-down list from a website. Even though the options in the drop-down list have id tag, but not the entire list is preloaded, therefore it will throw an error when I hard code to choose the option's ID.
[![enter image description here][1]][1]
First pic: This is when the drop-down list when it's first clicked (not all the options are shown)
[![enter image description here][2]][2]
Second pic: Once I scroll the drop-down list to the bottom, more options and their tag IDs show up!
Even though I know the tag ID of the last option in the drop-down menu, I couldn't hard code to choose it because it does not exist on the webpage until the drop-down menu is scrolled down and the options are shown.

How can I do that via VBA to have all the options shown?

Thanks in advance! :)

<!DOCTYPE html>

(head removed)

  <form name="form1" class="ng-pristine ng-valid" id="form1" onsubmit="doSubmit();return true;" action="/pagesUTF8/auftrag_allgemeinauftrag.jsp" method="post" accept-charset="utf-8">

                                            <select name="ASSPLJ" class="form-element ng-non-bindable" id="ASSPLJ">
                                              <option id="ATagBox07#ASSPLJ#1187" selected="selected" value="1187"></option>
                                            </select>

<button class="dropDownButton" id="TagBoxDropDownASSPLJ" type="button"></button>

Yin

<input class="textBoxSearchWrapper" id="ATagBox01ASSPLJ" type="text" autocomplete="off">

John 1

John 2

John 3

John 4

John 5

John 6a

John 7

John 8

John 9

John 10

John 11

John 12

John 13

John 14

John 15

John 16

John 17

John 18

John 19

John 20

Go to details

Send e-mail

  </form>


text:
Q: How can I beat Mothron during a Solar Eclipse?
I have a question, how do I beat this monster? I have no problem surviving a solar eclipse, but when this monster appears, he kills me almost immediately, do you know how can I beat this monster? Which gear or item should I use? Which trick should I do to kill it with more ease if there's any? Here's my full gear (With a warding obsidian shield, a quick magma stone, a quick charm of myths, an armored spectre boots and an armored cloud in a bottle, I also have some pumpkin pies, I eat one each times before starting an eclipse event.)

Someone told me to use wings, but there are two problems, it doesn't change the fact that I won't be able to dodge it knowing that it's super fast and I can't make one, I hope you'll be able to help me, if really there is no other method to beat it without the wings, I will wait until I can craft those.

A: Mothron is indeed a tough opponent, as it is the strongest mob of the entire solar eclipse event.
Something is to be taken in consideration once this mob has spawns : the more you are distant from him, the more it is likely for him to use his super-fast charging attack. So don't try to completely outrun it.
Using low range Melee weapons isn't recommended, your highest priority is to have a constant spacing for having better chances of dodging his attacks, and the most effective way of improving your dodging abilities is to use ... wings.
Here is one thing that can be very useful about this boss :
Sometimes, Mothron slows down, lands, and lay an egg, while being a static target for a couple of seconds. Using a weapon that hit multiple times (the death scythe in your screeshot, for example) at this moment is nice, as it will damage Mothron a lot and the egg that will spawn under it. To force him to land, prioritize your attacks on any Mothron child/egg you see.
In a crimson world, it is always good to inflict the ichor debuff on every ennemy you fight, maybe it won't work on Mothron, but it will make the others mobs of the solar eclipse less of a bother. Equip ichor arrows, ichor bullets and drink an ichor flask (made from an imbuing potion). This may require some farming in underground crismon biomes, but it is well worth the effort.
Also, transform the terrain at your advantage beforehand, make an arena if you haven't already.
A good arena is an arena that helps a player move swiftly, and helps regain health : campfire, heart lantern, honey spot, heart statue, sunflowers, etc...
For movement : place platforms in a large grid pattern. This way, you would have better way of quickly changing your movement speed without using wings.


text:
Q: Dynamically define a variable in LESS CSS I am trying to create a mixin that dynamically defines variables in LESS CSS, by actually assigning them a composite name.
The simplified use-case (not the real one):
.define(@var){
    @foo{var}: 0;
}

Then one would call the mixin as such:
.define('Bar'){
    @fooBar: 0;
}

Since this kind of string interpolation is possible while using selectors names, I was wondering if the same would be possible for variable names; so far, I have had no luck with various syntaxes I tried (other than the above, I tried escaping, quoting, using the ~ prefix and so on).
Edit
I just tried one more thing, and I feel I might be close; but I am experiencing an oddity of the LESS syntax. If I write this:
.define(@var){
    #namespace {
         @foo: @var;
    }
}

And then call it like so:
.define(0)

I can then use @foo in the usual namespaced fashion:
.test {
     #namespace;
     property: @foo; /* returns 0 */
}

However, the same doesn't apply in the case of a string-interpolated selector:
.define(@var, @ns){
    #@{ns} {
         @foo: @var;
    }
}

.define(0, namespace);

.test {
     #namespace;
     property: @foo;
}

The above code gives me the following error:

Name error: #namespace is undefined

However, the string interpolation was successful and valid. As a matter of fact, if I take away the .test part and modify the above to output a test property, I can see that the CSS is parsed correctly. I mean:
.define(@var, @ns){
    #@{ns} {
         @foo: @var;
         prop: @foo;
    }
}

.define(0, namespace);

Outputs the following CSS:
#namespace {
    prop: 0;
}

A: I`m not really sure for what you want to use this, but one of my suggestion is based on @ScottS answer. On my real world, I need to create a web app, where it would show several brands and each brand have their own text color, background and so on... so I started to chase a way to accomplish this in LESS, what I could easily do on SASS and the result is below:
LESS
// Code from Seven Phase Max
// ............................................................
// .for
.for(@i, @n) {.-each(@i)}
.for(@n)     when (isnumber(@n)) {.for(1, @n)}
.for(@i, @n) when not (@i = @n)  {
    .for((@i + (@n - @i) / abs(@n - @i)), @n);
}

// ............................................................
// .for-each

.for(@array)   when (default()) {.for-impl_(length(@array))}
.for-impl_(@i) when (@i > 1)    {.for-impl_((@i - 1))}
.for-impl_(@i)                  {.-each(extract(@array, @i))}

// Brands
@dodge : "dodge";
@ford : "ford";
@chev : "chev";

// Colors
@dodge-color : "#fff";
@ford-color : "#000";
@chev-color : "#ff0";

// Setting variables and escaping than
@brands: ~"dodge" ~"ford" ~"chev";

// Define our variable
.define(@var) {
  @brand-color: '@{var}-color';
}

// Starting the mixin
.color() {
    // Generating the loop to each brand
    .for(@brands); .-each(@name) {
        // After loop happens, it checks what brand is being called
        .define(@name);
         // When the brand is found, match the selector and color
        .brand-@{name} & {
            color: @@brand-color;
        }
    }
}

.carColor {
    .color();
}

Te result will be:
CSS
.brand-dodge .carColor {
    color: "#fff";
}
.brand-ford .carColor {
    color: "#000";
}
.brand-chev .carColor {
    color: "#ff0";
}

This is very tricky and I had to use several elements to get what I needed, first used a set of mixins provided by Seven Phase Max and you can find it here and than, the @ScottS answer was the piece that was missing fro my puzzle... hope this helps you and others that need to create a set of Variables to be part of another variable and create a more dynamic less file.
You can copy my entire code and test at http://lesstester.com/

A: This Cannot Be Done
What you desire to do is not currently possible in LESS. I can think of two possible "workarounds" if you know ahead of time what variable names you want to allow to be used (in other words, not fully dynamic). Then something like one of the following could be done:
Idea #1 (Variable Variables)
.define(@var) {
  @fooBar: 0;
  @fooTwo: 2;
  @fooYep: 4;

  @fooSet: 'foo@{var}';
}

.define(Two);
.test {
  .define(Bar);
  prop: @@fooSet;
}
.test2 {
  prop: @@fooSet;
}

Idea #2 (Parametric Mixins)
LESS
.define(@var) {
  .foo() when (@var = Bar) {
    @fooBar: 0;
  }
 .foo() when (@var = Two) {
    @fooTwo: 2;
  }
 .foo() when (@var = Yep) {
    @fooYep: 4;
  }
  .foo();
}

.define(Two);
.test {
  .define(Bar);
  prop: @fooBar;
}
.test2 {
  prop: @fooTwo;
}

CSS Output (for both ideas)
.test {
  prop: 0;
}
.test2 {
  prop: 2;
}

Conclusion
But I'm not sure how useful either would really be, nor do I know if it could have any real application in your actual use case (since you mention the above is not the real use case). If you want a fully dynamic variable in LESS, then it cannot be done through LESS itself.

A: To follow up on the accepted answer you can also define a value for the variable by extending the .define() mixin as follows. This allows you to use a temporary set of variables within a rule.
.define(@var, @val) {
  .foo() when (@var = temp1) {
    @temp1: @val;
  }
 .foo() when (@var = temp2) {
    @temp2: @val;
  }
 .foo() when (@var = temp3) {
    @temp3: @val;
  }
  .foo();
}

.define(temp2, 2);
.test {
  .define(temp1, 0);
  prop: @temp1;
}
.test2 {
  prop: @temp2;
}

CSS Output
.test {
  prop: 0;
}
.test2 {
  prop: 2;
}

Here is a more complicated gist of how I use this in a mixin for generating responsive background images with background-size: cover; (and an IE8 fallback).

A: I don't have time to build out the examples, but none of the above are as quick and simple as defining a variable and then assembling the import based on it. Then just have multiple documents where the same variables are defined.
@whitelabel: 'foo';
@import 'whitelabel/@{whitelabel}/colors';


text:
Q: does renaming column values in an issues log mess up the current values? I have a issues log in Sharepoint 2010 and have been asked if the "priority "column values are changed from the original values (currently they are named "Low", "Medium", "High") to new values, will the current values remain the same, so that a set of 6 values will exist instead of only 3?

A: If you replace the three choices with three other choices, the values in existing list items will stay as they are. As soon as an existing list item is edited, the field control will pull the current choices into the drop-down and will display the first option from the drop-down in the field.
So, until each of the existing items are edited, the old values will still show in views and in the read-only form.


text:
Q: Display WebP image on Android 2.x with libwebp and NDK I'd like to display webp image on older Android platforms. I tries these steps:

*

*Download latest Android SDK and NDK package.

*Add NDK path to system environment path and set it in Eclipse preferences.

*Create new Android project in Eclipse

*Right click on project folder, Android Tools -> Add native support, confirm default name.

*Download libwebp-0.3.1.tar.gz, extract to project/jni

*Add static {} and webpToBitmap method to main Activity, codes come from WebP for Android

*Add /jni/swig/libwebp.jar(comes with libwebp source) to java build path and import com.google.webp.libwebp;.

And I got these errors when try to use webpToBitmap: (delete unnecessary time/package name)
Could not find method com.google.webp.libwebp.WebPDecodeARGB, referenced from method ....MainActivity.webpToBitmap

VFY: unable to resolve static method 4601: Lcom/google/webp/libwebp;.WebPDecodeARGB

E/AndroidRuntime(12614): java.lang.UnsatisfiedLinkError: Couldn't load webp from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/....apk"],nativeLibraryDirectories=[/data/app-lib/..., /vendor/lib, /system/lib]]]: findLibrary returned null

I also tried add swig/libwebp_java_wrap.c \(comes with libwebp source) to Android.mk LOCAL_SRC_FILES and include $(BUILD_STATIC_LIBRARY) -> include $(BUILD_SHARED_LIBRARY), got same error.
Or, is there any prebuilt files I can easily add to my project?

A: Finally resolved this error by getting an updated version of the jar included in the 0.3.1 release. The one included in that package is broken and you can either use an old version from 0.3.0 or use the new version James has compiled at this link:
https://groups.google.com/a/webmproject.org/forum/#!topic/webp-discuss/4nNFdaE2GXI
To summarise:
This uses a slightly modified version of the 0.3.1 source tree. The libwebp.jar file wasn't working for that tree and we had to make some small modifications to the Android.mk files. Do the following changes to the files in the 0.3.1 release and grab the new libwebp.jar.
Add to Android.mk:
swig/libwebp_java_wrap.c \

-include $(BUILD_STATIC_LIBRARY)
+include $(BUILD_SHARED_LIBRARY)

LOCAL_ARM_MODE := arm

Application.mk should contain:
APP_ABI := armeabi armeabi-v7a
APP_OPTIM := release


text:
Q: How to insert a specific text into CKEditor image/link dialog URL input field? So, I use CKEditor 4 in my project, and I need to insert a string into the URL textfield in image or link dialog window (using js/jQuery) - i mean here:

I just can't figure out how to find some kind of identifier of this input element. I mean something like
var myText = 'abcdef...';
ckeditor.(that specific input field).val(myText);

Any ideas?

A: Try this:
var newURL = 'http://stackoverflow.com';
var dialog = CKEDITOR.dialog.getCurrent();
    dialog.setValueOf('info', 'txtUrl', newURL);

A: After some time and with more experience, in my specific situation it was a lot better solution just to insert html INTO ckeditor at cursor, it's very easy to achieve with:
CKEDITOR.instances.your-instance-name-here.insertHtml("<img src='...'/>");

Maybe it will help you. Cheers

A: This is what I made to set an URL into Links tabs on Dialog Image CKEDITOR
    dialogDefinition.onShow = function() {
       var link_href = this.getContentElement('Link', 'txtUrl');
       var link_selector = link_href._.inputId;

       if (link_href._.dialog.hasOwnProperty('linkElement')) {
       link_href.setValue(link_href._.dialog.linkElement.$.dataset.ckeSavedHref);//set src img url
    }
}


text:
Q: Drools in stream mode not working in Karaf I am new to Drools, investigating to use Drools Fusion CEP for our product. I am  executing Drools (in stream mode) fusion 6.0.2.Final in karaf 2.4.3.
My kmodule.xml
<kbase name="sampleKBase" packages="com.sample.heartbeat" eventProcessingMode="stream" default="true">
    <ksession name="sampleKSession" type="stateful" default="true" clockType="realtime">
    </ksession>
</kbase>

And my Rule:
package com.sample.heartbeat

import com.sample.droolsfusion.HeartBeat;

declare HeartBeat
     @role(event)
     deviceId : int
     currentCheckIntime : long
end

rule "Sound the alarm"
when
   $h: HeartBeat($deviceId : deviceId, $currentCheckIntime: currentCheckIntime) from entry-point "MonitoringStream"
  not( HeartBeat( deviceId == $deviceId, currentCheckIntime > $currentCheckIntime , this after[0s,10s] $h ) from entry-point "MonitoringStream")
then
            // Sound the alarm
    System.out.println("Sound" + $h);
end

When i send events from BundleActivator, events are not fired after 10 seconds on missing heartbeat events
Can anyone help me on this.


text:
Q: SQL (mySQL) optimization via BOOLEAN values I am working on a side project that is quite an undertaking; my question regards the efficiency gained when using a BOOLEAN value to determine whether or not further data processing is required.
For example: If I had a table that listed all the creatures. In another table that was relational in nature listed their hibernation period, and calories consumed each day during hibernation.
Is it efficient to have inside the (Creatures) table a value for "hibernates" BOOLEAN.
If true then go to the "hibernation_creature_info_relations" table and find the creature with that ID and return that information.
This means that for all the creatures whose value for "hibernates" = false will prevent SQL from having to search through the large table of "hibernation_creature_info_relations."
Or when using ID's is the process so fast in checking the "hibernation_creature_info_relations" table so fast that there will actually be a larger impact on performance by having to process the argument of doing what based on if the value of hibernation is set to true or false?
I hope this was enough information to help you understand what I am asking, if not please let me know so I can rephrase or include more details.

A: No, that is not a good way to do things.
Use a normal field that can be null instead.
Example
table creatures
---------------
id     name      info_id

1      dino      null
2      dog       1
3      cat       2

table info
--------------
id     info_text

1      dogs bark
2      cats miauw

Now you can just do a join:
SELECT c.name, i.info_text
FROM creature c
LEFT JOIN info i ON (c.info_id = i.id)

If you do it like this, SQL can use an index.
No SQL database will create an index on a boolean field.
The cardinality of that field is too low and using indexes on low cardinality fields slows things down instead of speeding things up.
See: MySQL: low cardinality/selectivity columns = how to index?

A: If you want to use the column "hibernates" only to prevent the SQL from having to search through the other table then you should follow @Johan otherwise you can create index on the column "hibernates" it will improve the execution time. But keep in mind what @Johan is trying to tell you.


text:
Q: Aws Cognito federated identities answers with UnknownError Not Found on getOpenIdTokenForDeveloperIdentity() I have an issue in aws lambda (environment nodejs6.10), trying to register a user as custom provider.
I'm calling getOpenIdTokenForDeveloperIdentity in my backend, with this params:
const params = {
  IdentityPoolId: config.IDENTITY_POOL_ID,
  Logins: {
    [config.DEVELOPER_PROVIDER_NAME]: id
  }
}

The code responsible for the call is simple:
const cognitoidentity = new AWS.CognitoIdentity({apiVersion: '2014-06-30'})
return cognitoidentity.getOpenIdTokenForDeveloperIdentity(params).promise()
.then(...)

Unfortunately the answer from Cognito is this error:
{
  "message": "Not Found",
  "code": "UnknownError",
  "statusCode": 404,
  "time": "2017-09-13T16:50:12.832Z",
  "requestId": "4RQE2T66K7LOT3RBGOMN0JO82NVV4KQNSO5AEMVJF66Q9ASUAAJG",
  "retryable": false,
  "retryDelay": 58.96973108302359
}

I've done this with almost same code 2 years ago and is still working, but in this project it is not. I've made a little web client for unauthenticated user and it is working well with Cognito, so I assume cognito is set correctly. The region are the same for cognito and lambda, us-east-1. The role and policies seems correct, lambda have permission to do all the stuff with Cognito Identity. I don't know what to do now, just thinking to leave cognito if this cannot be solved. Please help.
Other relevant parts of information:
I'm using Serverless framework, but cognito identity pool was created manually (the same for roles).
Lambda allowed permissions:
[
  "cognito-identity:DeleteIdentities",
  "cognito-identity:DescribeIdentity",
  "cognito-identity:GetOpenIdTokenForDeveloperIdentity",
  "cognito-identity:ListIdentities",
  "cognito-identity:LookupDeveloperIdentity",
  "cognito-identity:MergeDeveloperIdentities",
  "cognito-identity:UnlinkDeveloperIdentity"
]

Code initializations
const AWS = require('aws-sdk')

AWS.config.update({
  region: config.REGION
})
AWS.config.setPromisesDependency(require('bluebird'))

A: Solved: the problem was due to a wrong endpoint in the AWS config, loaded by my dynamodb data layer


text:
Q: TextField click rebuilds/reloads widget after routed I am having an issue where the whole screen widget reloads when there is a textfield is used.
This doesn't happen when the the app is loaded with this screen as landing page.
But when the routing happens from another page to this page and when textfield is clicked then the rebuild happens.
I even tried a simple app and this is getting reproduced. Tried many ways but could not get to a solution.
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

class Screen1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Screen 1"), // screen title
      ),
      body: new Center(
        child: new Column(
          children: <Widget>[
            new RaisedButton(
              onPressed: () {
                button1(context);
              },
              child: new Text("Go to Screen 2"),
            )
          ],
        ),
      ),
    );
  }
}

class Screen2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    print("Widget rebuilds");
    return new Scaffold(
      appBar: new AppBar(
        title: new Text("Screen 2"),
      ),
      body: new Center(
        child: new Column(
          children: <Widget>[
            new Container(
                height: 350.0,
                child: TextFormField(
                  keyboardType: TextInputType.text,
                  style: TextStyle(fontSize: 16.0, color: Colors.black),
                )),

          ],
        ),
      ),
    );
  }
}

void main() {
  runApp(new MaterialApp(
    home: new Screen1(),
    routes: <String, WidgetBuilder>{
      '/screen2': (BuildContext context) => new Screen2()
    },
  ));
}

void button1(BuildContext context) {
  print("Button 1");
  Navigator.of(context).pushNamed('/screen2');
}

Here the app is loaded with screen 1 and clicking on button Go to screen2 will load the screen 2 with the text field. Clicking on this field will bring the keyboard and clicking the done on keyboard and again focusing on the text field will rebuild the screen. This keeps happening when keyboard appears and when disappears.
But then if Screen2 is set as landing page, then clicking on the text field and doing the same process mentioned above will not reload the widget. The widget build happens only once. Seems the issue is when the Screen2 is navigated from Screen 1
 runApp(new MaterialApp(
    home: new Screen2(),
    routes: <String, WidgetBuilder>{
      '/screen2': (BuildContext context) => new Screen2()
    },
  ));

A: This is the normal behavior, there is no problem with it. It is in fact within the specs of build method :
It can be called an arbitrary number of time and you should expect it to be so.
If this causes a problem to do so, it is very likely that your build function is not pure. Meaning that it contains side effects such as http calls or similar.
These should not be done within the build method. More details here : How to deal with unwanted widget build?

About the "What triggers the build", there are a few common situations:

*

*Route pop/push, for in/out animations

*Screen resize, usually due to keyboard appearance or orientation change

*Parent widget recreated its child

*An InheritedWidget the widget depends on (Class.of(context) pattern) change

A: if you are using MediaQuery, the popup of the keyboard triggers MediaQuery. all widgets that depends on the MediaQuery will be rebuild. there are packages that can replace MediaQuery and deal with dimensions without causing unnecessary rebuilds such as the sizer package.


text:
Q: Google Analytics - put their code in manually or is it already included? I have 1.9.0 and the SEO lady wants me to put the following code into every page of the website in order so that she can work with Google Analytics. Is this already included in the Magento shopping cart? I activated this in SYSTEM - CONFIGURATION - SALES - GOOGLE API - GOOGLE ANALYTICS - it's asking for Type - Google Analytics or Universal Analytics and I put in the Account number. I read somewhere that 1.9.0 only has Universal Analytics working and 1.9.1 only has Google Analytics working - is that correct?

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new
  Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
      ga('create', 'UA-52215891-1', 'auto');   ga('send', 'pageview');

A: Google Analytics is native to Magento, you don't need to add the code yourself. Just go to System > Configuration > Google API > Google Analytics, select the right type, specify your Account Number and you're good to go.
As mentioned above the GA code needs to be updated, you can directly update yourtheme/default/template/googleanalytics/ga.phtml. Don't put it in Miscellaneous HTML, if you have many store views, it's just repeating code for no reason.

A: I typically place the GA code into the footer template file. There is an option within the admin section, but for me the theme is easier to edit than worrying about Magento's code being proper for any future changes to either GA or Magento.
Edit: Another option is to wrap the code you have above in  tags and place it in System >> Configuration >> Design >> Footer >> Miscellaneous HTML


text:
Q: How to reset api cache in chrome? For some reason I am getting following response in chrome for some of my api requests Status Code:200 OK (from disk cache) I need to disable / clear associated disk cache in order to get fresh endpoint response. Tried clearing out chrome's cache but this is still happening.
Request detail minus some private data:

A: because response type is svg/xml, browser count it as a static content and cache it by url as cache key, try to call your api with additional random query string parameter.
like this
 http://myserver/myapi/action?rand=123456789
with this workaround every time browser request data from server not cache.
here is javascript code for generate new random number
var rand = (new Date()).getTime();


text:
Q: I am getting an error when using fusioncharts in Vuejs I'm getting this error Uncaught RuntimeException: #03091456 chartobject-1.render() Error >> Unable to find the container DOM element. Using vue2
I'm trying to work with fusioncharts in vuejs Here are the docs
https://www.fusioncharts.com/dev/getting-started/vue/your-first-chart-using-vuejs
I have used the Boilerplate code from this website
import VueFusionCharts from 'vue-fusioncharts';
import FusionCharts from 'fusioncharts';
import Column2D from 'fusioncharts/fusioncharts.charts';
import FusionTheme from 'fusioncharts/themes/fusioncharts.theme.fusion';

Vue.use(VueFusionCharts, FusionCharts, Column2D, FusionTheme);

// STEP 2: Prepare the data
const chartData = [
    {
      label: "Venezuela",
      value: "290"
    },
    {
      label: "Saudi",
      value: "260"
    },
    {
      label: "Canada",
      value: "180"
    },
    {
      label: "Iran",
      value: "140"
    },
    {
      label: "Russia",
      value: "115"
    },
    {
      label: "UAE",
      value: "100"
    },
    {
      label: "US",
      value: "30"
    },
    {
      label: "China",
      value: "30"
    }
  ];

// STEP 3: Configure your chart
const dataSource = {
  chart: {
    caption: "Countries With Most Oil Reserves [2017-18]",
    subcaption: "In MMbbl = One Million barrels",
    xaxisname: "Country",
    yaxisname: "Reserves (MMbbl)",
    numbersuffix: "K",
    theme: "fusion"
  },
  data: chartData
  };

export default {
  name: 'app',
  data() {
    return {
      "type": "column2d",
      "renderAt": "chart-container",
      "width": "550",
      "height": "350",
      "dataFormat": "json",
      dataSource
    }
  }
}
</script>

//STEP 4: Render the chart
<template>

      <fusioncharts
      :type="type"
      :width="width"
      :height="height"
      :dataformat="dataFormat"
      :dataSource="dataSource"
      >
      </fusioncharts>

</template>


text:
Q: could not install any dependencies using NPM install ******, throwing error ( ECONNREFUSED, ETIMEDOUT) npm install -g create-react-app also nodemon failing and thrwoing error ETIMEDOUT
not using any proxy
also tried reinstalling node often
all ready gone through several article on this but could not resolve the problem, what could be the problem ?
error log-
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'i',
1 verbose cli   'nodemon'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose config Skipping project config: C:\Users\sunil salat/.npmrc. (matches userconfig)
5 verbose npm-session 00ce03fa5818b313
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 silly fetchPackageMetaData error for nodemon@latest request to
http://registry.npmjs.org/nodemon failed, reason: connect ETIMEDOUT 104.16.20.35:80
9 timing stage:rollbackFailedOptional Completed in 1ms
10 timing stage:runTopLevelLifecycles Completed in 133257ms
11 verbose type system
12 verbose stack FetchError: request to http://registry.npmjs.org/nodemon failed, reason:
connect ETIMEDOUT 104.16.20.35:80
12 verbose stack     at ClientRequest.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\node_modules\node-fetch-npm\src\index.js:68:14)
 12 verbose stack     at ClientRequest.emit (events.js:315:20)
12 verbose stack     at Socket.socketErrorListener (_http_client.js:426:9)
 12 verbose stack     at Socket.emit (events.js:315:20)
12 verbose stack     at emitErrorNT (internal/streams/destroy.js:92:8)
12 verbose stack     at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
 12 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
 13 verbose cwd C:\Users\sunil salat
 14 verbose Windows_NT 10.0.19043
15 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "nodemon"
 16 verbose node v12.18.3
17 verbose npm  v6.14.6
18 error code ETIMEDOUT
19 error errno ETIMEDOUT
20 error network request to http://registry.npmjs.org/nodemon failed, reason: connect
ETIMEDOUT 104.16.20.35:80
21 error network This is a problem related to network connectivity.
21 error network In most cases you are behind a proxy or have bad network settings.
21 error network
21 error network If you are behind a proxy, please make sure that the
21 error network 'proxy' config is set properly.  See: 'npm help config'
22 verbose exit [ 1, true ]


text:
Q: What happens after scrapy job is deleted before it is erased In Scrapy Cloud, a job can be deleted. At first, its state will change, but the data will be available - items data, job.metadata, items.stats.
What's the process of deletion in particular? How soon all of data will be erased?

A: Job deletion in Scrapy Cloud is an asynchronous process: at first, the jobs are just marked as deleted with all its data available, and then it's purged on the server side after 7 days (using a cron job). It's implemented in this way to have the last chance to recover jobs deleted by mistake or save some important data.
Also, purging in the context relates only to job data (requests/items/logs/samples), while job metadata and stats are stored indefinitely for now (though you shouldn't rely on that, the policy can be revised at any given moment).


text:
Q: Can't find the module that I downloaded for python 3.7 Hi I just downloaded the module docx using pip, I have a mac so I used the terminal, here is what I entered in terminal
pip install python-docx

I have python 3.7 installed and I am using PyCharm's latest version but I can't find the module and when I try to import it PyCharm doesn't recognize it.
The error PyCharm gives me is "No module named docx"
p.s. of you know how to install numpy or know where can I find the instructions to download numpy it would make my day.

A: Can you please show us the error the Pycharm gives you.
on other hand to download numpy pip install numpy or check the link


text:
Q: Spark + Parquet + S3n : Seems to read parquet file many times I have the parquet files in Hive-like partitioned way on S3n bucket. The metadata files are not created, the parquet footers are in the file itself.
When I tried a sample spark job in local mode (v-1.6.0) trying to read a file of size 5.2 MB:
val filePath = "s3n://bucket/trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet"
val path: Path = new Path(filePath)

val conf = new SparkConf().setMaster("local[2]").set("spark.app.name", "parquet-reader-s3n").set("spark.eventLog.enabled", "true")
val sc = new SparkContext(conf)
val sqlc = new org.apache.spark.sql.SQLContext(sc)

val df = sqlc.read.parquet(filePath).select("referenceCode")
Thread.sleep(1000*10) // Intentionally given
println(df.schema)
val output = df.collect

The log generated is:
..
[22:21:56.505][main][INFO][BlockManagerMaster:58] Registered BlockManager
[22:21:56.909][main][INFO][EventLoggingListener:58] Logging events to file:/tmp/spark-events/local-1463676716372
[22:21:57.307][main][INFO][ParquetRelation:58] Listing s3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet on driver
[22:21:59.927][main][INFO][SparkContext:58] Starting job: parquet at InspectInputSplits.scala:30
[22:21:59.942][dag-scheduler-event-loop][INFO][DAGScheduler:58] Got job 0 (parquet at InspectInputSplits.scala:30) with 2 output partitions
[22:21:59.942][dag-scheduler-event-loop][INFO][DAGScheduler:58] Final stage: ResultStage 0 (parquet at InspectInputSplits.scala:30)
[22:21:59.943][dag-scheduler-event-loop][INFO][DAGScheduler:58] Parents of final stage: List()
[22:21:59.944][dag-scheduler-event-loop][INFO][DAGScheduler:58] Missing parents: List()
[22:21:59.954][dag-scheduler-event-loop][INFO][DAGScheduler:58] Submitting ResultStage 0 (MapPartitionsRDD[1] at parquet at InspectInputSplits.scala:30), which has no missing parents
[22:22:00.218][dag-scheduler-event-loop][INFO][MemoryStore:58] Block broadcast_0 stored as values in memory (estimated size 64.5 KB, free 64.5 KB)
[22:22:00.226][dag-scheduler-event-loop][INFO][MemoryStore:58] Block broadcast_0_piece0 stored as bytes in memory (estimated size 21.7 KB, free 86.2 KB)
[22:22:00.229][dispatcher-event-loop-0][INFO][BlockManagerInfo:58] Added broadcast_0_piece0 in memory on localhost:54419 (size: 21.7 KB, free: 1088.2 MB)
[22:22:00.231][dag-scheduler-event-loop][INFO][SparkContext:58] Created broadcast 0 from broadcast at DAGScheduler.scala:1006
[22:22:00.234][dag-scheduler-event-loop][INFO][DAGScheduler:58] Submitting 2 missing tasks from ResultStage 0 (MapPartitionsRDD[1] at parquet at InspectInputSplits.scala:30)
[22:22:00.235][dag-scheduler-event-loop][INFO][TaskSchedulerImpl:58] Adding task set 0.0 with 2 tasks
[22:22:00.278][dispatcher-event-loop-1][INFO][TaskSetManager:58] Starting task 0.0 in stage 0.0 (TID 0, localhost, partition 0,PROCESS_LOCAL, 2076 bytes)
[22:22:00.281][dispatcher-event-loop-1][INFO][TaskSetManager:58] Starting task 1.0 in stage 0.0 (TID 1, localhost, partition 1,PROCESS_LOCAL, 2395 bytes)
[22:22:00.290][Executor task launch worker-0][INFO][Executor:58] Running task 0.0 in stage 0.0 (TID 0)
[22:22:00.291][Executor task launch worker-1][INFO][Executor:58] Running task 1.0 in stage 0.0 (TID 1)
[22:22:00.425][Executor task launch worker-1][INFO][ParquetFileReader:151] Initiating action with parallelism: 5
[22:22:00.447][Executor task launch worker-0][INFO][ParquetFileReader:151] Initiating action with parallelism: 5
[22:22:00.463][Executor task launch worker-0][INFO][Executor:58] Finished task 0.0 in stage 0.0 (TID 0). 936 bytes result sent to driver
[22:22:00.471][task-result-getter-0][INFO][TaskSetManager:58] Finished task 0.0 in stage 0.0 (TID 0) in 213 ms on localhost (1/2)
[22:22:00.586][pool-20-thread-1][INFO][NativeS3FileSystem:619] Opening 's3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet' for reading
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[22:22:25.890][Executor task launch worker-1][INFO][Executor:58] Finished task 1.0 in stage 0.0 (TID 1). 4067 bytes result sent to driver
[22:22:25.898][task-result-getter-1][INFO][TaskSetManager:58] Finished task 1.0 in stage 0.0 (TID 1) in 25617 ms on localhost (2/2)
[22:22:25.898][dag-scheduler-event-loop][INFO][DAGScheduler:58] ResultStage 0 (parquet at InspectInputSplits.scala:30) finished in 25.656 s
[22:22:25.899][task-result-getter-1][INFO][TaskSchedulerImpl:58] Removed TaskSet 0.0, whose tasks have all completed, from pool
[22:22:25.905][main][INFO][DAGScheduler:58] Job 0 finished: parquet at InspectInputSplits.scala:30, took 25.977801 s
StructType(StructField(referenceCode,StringType,true))
[22:22:36.271][main][INFO][DataSourceStrategy:58] Selected 1 partitions out of 1, pruned 0.0% partitions.
[22:22:36.325][main][INFO][MemoryStore:58] Block broadcast_1 stored as values in memory (estimated size 89.3 KB, free 175.5 KB)
[22:22:36.389][main][INFO][MemoryStore:58] Block broadcast_1_piece0 stored as bytes in memory (estimated size 20.2 KB, free 195.7 KB)
[22:22:36.389][dispatcher-event-loop-0][INFO][BlockManagerInfo:58] Added broadcast_1_piece0 in memory on localhost:54419 (size: 20.2 KB, free: 1088.2 MB)
[22:22:36.391][main][INFO][SparkContext:58] Created broadcast 1 from collect at InspectInputSplits.scala:34
[22:22:36.520][main][INFO][deprecation:1174] mapred.min.split.size is deprecated. Instead, use mapreduce.input.fileinputformat.split.minsize
[22:22:36.522][main][INFO][ParquetRelation:58] Reading Parquet file(s) from s3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet
[22:22:36.554][main][INFO][SparkContext:58] Starting job: collect at InspectInputSplits.scala:34
[22:22:36.556][dag-scheduler-event-loop][INFO][DAGScheduler:58] Got job 1 (collect at InspectInputSplits.scala:34) with 1 output partitions
[22:22:36.556][dag-scheduler-event-loop][INFO][DAGScheduler:58] Final stage: ResultStage 1 (collect at InspectInputSplits.scala:34)
[22:22:36.556][dag-scheduler-event-loop][INFO][DAGScheduler:58] Parents of final stage: List()
[22:22:36.557][dag-scheduler-event-loop][INFO][DAGScheduler:58] Missing parents: List()
[22:22:36.557][dag-scheduler-event-loop][INFO][DAGScheduler:58] Submitting ResultStage 1 (MapPartitionsRDD[4] at collect at InspectInputSplits.scala:34), which has no missing parents
[22:22:36.571][dag-scheduler-event-loop][INFO][MemoryStore:58] Block broadcast_2 stored as values in memory (estimated size 7.6 KB, free 203.3 KB)
[22:22:36.575][dag-scheduler-event-loop][INFO][MemoryStore:58] Block broadcast_2_piece0 stored as bytes in memory (estimated size 4.0 KB, free 207.3 KB)
[22:22:36.576][dispatcher-event-loop-1][INFO][BlockManagerInfo:58] Added broadcast_2_piece0 in memory on localhost:54419 (size: 4.0 KB, free: 1088.2 MB)
[22:22:36.577][dag-scheduler-event-loop][INFO][SparkContext:58] Created broadcast 2 from broadcast at DAGScheduler.scala:1006
[22:22:36.577][dag-scheduler-event-loop][INFO][DAGScheduler:58] Submitting 1 missing tasks from ResultStage 1 (MapPartitionsRDD[4] at collect at InspectInputSplits.scala:34)
[22:22:36.577][dag-scheduler-event-loop][INFO][TaskSchedulerImpl:58] Adding task set 1.0 with 1 tasks
[22:22:36.585][dispatcher-event-loop-3][INFO][TaskSetManager:58] Starting task 0.0 in stage 1.0 (TID 2, localhost, partition 0,PROCESS_LOCAL, 2481 bytes)
[22:22:36.586][Executor task launch worker-1][INFO][Executor:58] Running task 0.0 in stage 1.0 (TID 2)
[22:22:36.605][Executor task launch worker-1][INFO][ParquetRelation$$anonfun$buildInternalScan$1$$anon$1:58] Input split: ParquetInputSplit{part: s3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet start: 0 end: 5364897 length: 5364897 hosts: []}
[22:22:38.253][Executor task launch worker-1][INFO][NativeS3FileSystem:619] Opening 's3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet' for reading
[22:23:04.249][Executor task launch worker-1][INFO][NativeS3FileSystem:619] Opening 's3n://bucket//trackingPackage/dpYear=2016/dpMonth=5/dpDay=10/part-r-00004-1c86d6b0-4f6f-4770-a930-c42d77e3c729-1462833064172.gz.parquet' for reading
[22:23:28.337][Executor task launch worker-1][INFO][CodecPool:181] Got brand-new decompressor [.gz]
[22:23:28.400][dispatcher-event-loop-1][INFO][BlockManagerInfo:58] Removed broadcast_0_piece0 on localhost:54419 in memory (size: 21.7 KB, free: 1088.2 MB)
[22:23:28.408][Spark Context Cleaner][INFO][ContextCleaner:58] Cleaned accumulator 1
[22:23:49.993][Executor task launch worker-1][INFO][Executor:58] Finished task 0.0 in stage 1.0 (TID 2). 9376344 bytes result sent to driver
[22:23:50.191][task-result-getter-2][INFO][TaskSetManager:58] Finished task 0.0 in stage 1.0 (TID 2) in 73612 ms on localhost (1/1)
[22:23:50.191][task-result-getter-2][INFO][TaskSchedulerImpl:58] Removed TaskSet 1.0, whose tasks have all completed, from pool
[22:23:50.191][dag-scheduler-event-loop][INFO][DAGScheduler:58] ResultStage 1 (collect at InspectInputSplits.scala:34) finished in 73.612 s
[22:23:50.195][main][INFO][DAGScheduler:58] Job 1 finished: collect at InspectInputSplits.scala:34, took 73.640193 s

The SparkUI snapshot is:

Questions:

*

*In logs, I can see that the parquet file is seen to be read in total of 3 times. One time by [pool-21-thread-1] thread (on driver) and another two times by [Executor task launch worker-1] thread, which I assume to be worker thread. On debug, I can see that before first read, two s3n requests were made specifically for the footer (it had the http header of content-range), first to get the size of the footer and then to get the footer itself. My question is: When we had the footer information, why [pool-21-thread-1] thread still had to read the entire file? And why the executor thread made 2 requests to read the s3 file?

*In the spark UI, It shows that only 670 KB is being taken as input. Since I was not assured this to be true, I looked into network activity and it seems 20+ MB has been received. Snapshot attached shows nearly 5+ MB received data in first read and later on 15+ MB for the 2 reads after Thread.sleep(1000*10). I could not reach the debug point for last 2 reads by  [pool-21-thread-1] thread due to IDE issues, so not sure whether the particular column ("referenceCode") is being read or the entire file. I understand that there are overhead network packets at the tcp/udp layers, but 20+ MB seems quite a lot for just one column.

A: After debugging into the application, it turned out that S3N still uses jets3t library but the S3A has a new implementation based on AWS SDK (
Hadoop-10400 )
The hadoop's implementation of NativeS3FileSystem does not support seek (partial content reads) on S3 files. It downloads the whole file first.
EDIT: The scenario was not seen in EMR. On EMR amazon provides a highly optimized S3 connector - emrfs for all schemes which overrides the connector provided by hadoop.


text:
Q: How to convert to CSV to Keyed JSON? Currently, I'm creating to JSON with this code:
import pandas as pd
import csv
data = pd.read_csv(r'C:\Users\user\Downloads\config_all_env.csv')
# print(data.to_string())
df = pd.DataFrame(data)
# print(df)

json_file = df.to_json(orient='index',indent=4)
print(json_file)

my 'config_all_env.csv' looks like this
_key,index,source
123456789100:LogGroup1,index1,Account1-123456789100:LogGroup1
123456789100:LogGroup2,index1,Account1-123456789100:LogGroup2
678901234200:LogGroup3,index2,Account2-678901234200:LogGroup3
678901234200:LogGroup4,index2,Account2-678901234200:LogGroup4

And the Output is like this:
{
    "0":{
        "_key":"123456789100:LogGroup1",
        "index":"index1",
        "source":"Account1-123456789100:LogGroup1"
    },
    "1":{
        "_key":"123456789100:LogGroup2",
        "index":"index1",
        "source":"Account1-123456789100:LogGroup2"
    },
    "2":{
        "_key":"678901234200:LogGroup3",
        "index":"index2",
        "source":"Account2-678901234200:LogGroup3"
    },
    "3":{
        "_key":"678901234200:LogGroup4",
        "index":"index2",
        "source":"Account2-678901234200:LogGroup4"
    }
}

But, this website: https://www.convertcsv.com/csv-to-json.htm has an option of Keyed JSON, after parsing which this output is received:
{
   "123456789100:LogGroup1": {
      "index": "index1",
      "source": "Account1-123456789100:LogGroup1"
   },
   "123456789100:LogGroup2": {
      "index": "index1",
      "source": "Account1-123456789100:LogGroup2"
   },
   "678901234200:LogGroup3": {
      "index": "index2",
      "source": "Account2-678901234200:LogGroup3"
   },
   "678901234200:LogGroup4": {
      "index": "index2",
      "source": "Account2-678901234200:LogGroup4"
   }
}

How to Achieve this using Python, since its not feasible to open this website everytime and do the conversion?

A: If you set the "_key" column as the index to the pandas dataframe first, this should achieve what you want (if I've interpreted your problem correctly).
import pandas as pd

my_data = pd.DataFrame.from_dict({
    "0":{
        "_key":"123456789100:LogGroup1",
        "index":"index1",
        "source":"Account1-123456789100:LogGroup1"
    },
    "1":{
        "_key":"123456789100:LogGroup2",
        "index":"index1",
        "source":"Account1-123456789100:LogGroup2"
    },
    "2":{
        "_key":"678901234200:LogGroup3",
        "index":"index2",
        "source":"Account2-678901234200:LogGroup3"
    },
    "3":{
        "_key":"678901234200:LogGroup4",
        "index":"index2",
        "source":"Account2-678901234200:LogGroup4"
    }
}, orient="index")

my_dict = my_data.set_index("_key").to_json(orient='index',indent=4)

Output:
{
    "123456789100:LogGroup1":{
        "index":"index1",
        "source":"Account1-123456789100:LogGroup1"
    },
    "123456789100:LogGroup2":{
        "index":"index1",
        "source":"Account1-123456789100:LogGroup2"
    },
    "678901234200:LogGroup3":{
        "index":"index2",
        "source":"Account2-678901234200:LogGroup3"
    },
    "678901234200:LogGroup4":{
        "index":"index2",
        "source":"Account2-678901234200:LogGroup4"
    }
}


text:
Q: Domain with host:port not working with node-fetch const response = await fetch(API_URL, {
    method: 'POST',
    body: JSON.stringify(body),
    headers: headers
})

Here API_URL = https://139.59.39.54:53724/business/1.0/verify
Getting error

TypeError: Only absolute URLs are supported

I though maybe the problem with package it doesn't support domain with IP addresses, so I also tried nip.io
. But still getting same error.
Update
I am using dotenv for environment variables. So If directly use the domain I don't get error any more.
const response = await fetch("https://139.59.39.54:53724/business/1.0/verify", {
     method: 'POST',
     body: JSON.stringify(body),
     headers: headers
})

A: I think you're missing reading environment variables with dotenv, such as call require('dotenv').config();.
Because dotenv can understand API_URL = https://139.59.39.54:53724/business/1.0/verify that API_URL is a string. Therefore API_URL you read from process.env.API_URL now is empty, which can cause the error.
Please make sure you've called require('dotenv').config(); before reading process.env.API_URL.


text:
Q: find the source of crash in C program I have a code base where the process running on linux is crashing in free and sometimes in malloc:
#0  0xffffe430 in __kernel_vsyscall ()
#1  0xf7424e30 in raise () from /lib/libc.so.6
#2  0xf7426765 in abort () from /lib/libc.so.6
#3  0xf7469d33 in malloc_printerr () from /lib/libc.so.6
#4  0xf746e7bc in free () from /lib/libc.so.6
#5  0xf6047e25 in myFree (mem_ptr=0x82165d8) at ../my_code/mylib.c:78
#6  0xf6014a10 in FreeBuffer (buffer=0x82042f8)

In the code I am not seeing anything fishy at the place where memory freeing is happening.
Function myFree() has nothing but a free() function call.
void FreeBuffer(struct MY_BUFFER *buffer)
{
    if (buffer)
    {
        myFree(buffer);
    }
}

void myFree(void *mem_ptr)
{

        free(mem_ptr);
}

I tried using MALLOC_CHECK_ but it was not of any help.
I suspect some where the heap is getting corrupted and want to find that.
Any hint to proceed to debug the process in such cases?

A: There is hard to be 100% sure but most probably you are trying to free memory twice. It's great that you are checking if pointer is not NULL before trying to free it
if (buffer)
    {
        myFree(buffer);
    }

but you are probably NOT setting pointer NULL after doing exact free job - that's my guess.
Check if you have something like this
struct MY_BUFFER *buffer;
//do something with buffer
FreeBuffer(buffer)
buffer = NULL;

You can do this as well inside FreeBuffer() function but to do so you will have to pass address of pointer AKA pointer to pointer so the definition will be like this FreeBuffer(struct MY_BUFFER **buffer)


text:
Q: How to connect android device to specific AP with adb shell or monkeyrunner I am trying to connect an android device to specific AP without keycodes. I am looking for adb shell commands or monkeyrunner script that can perform the same.
Hope you guys can help me with this.
PS. After researching for days only way I found is using wpa_cli in adb shell. But couldnt exactly connect because I was not able to find the exact codes.

A: wpa_cli should work.Open wpa_cli>>
    add_network
    set_network  ssid "APSSID"
    set_network  key_mgmt NONE \if ap is confgrd in open none
    save_config
    enable
these set of commands should work if WiFI is ON in UI.
using Monkeyrunner navigate using keycode is the only option OR
you need to make an APK for ur specific operations


text:
Q: How to remove the default selection checkboxes in ng-grid? By default multiselection is enabled and ng-grid displays checkboxes on the left side. How to keep multiselection but get rid of the checkboxes?

A: Set  enableRowHeaderSelection to false.
   $scope.gridOptions = {
    ...
     enableRowHeaderSelection: false
    ...
    };


text:
Q: Can abrt help to gather information about process issues We have a system (Red Hat Enterprise Linux Server release 6.6)
where we occasionally see hung java processes (xalan or fop transformations).
These processes just sit there and never complete
In /var/log/messages I find entries like this
abrt[33580]: Saved core dump of pid 48556 (/usr/bin/jdk1.6.0_06/bin/java) to /var/spool/abrt/ccpp-2017-06-01-08:52:40-48556 (341344256 bytes)
abrtd: Directory 'ccpp-2017-06-01-08:52:40-48556' creation detected
abrtd: Executable '/usr/bin/jdk1.6.0_06/bin/java' doesn't belong to any package and ProcessUnpackaged is set to 'no'
abrtd: 'post-create' on '/var/spool/abrt/ccpp-2017-06-01-08:52:40-48556' exited with 1
abrtd: Deleting problem directory '/var/spool/abrt/ccpp-2017-06-01-08:52:40-48556'

*

*Can abrt be used to gather extra information about the issues ?

*Is it useful to change ProcessUnpackaged to yes ?

A: If the process is aborted or has a coredump, it will no longer be in memory anymore. So if you think a process is hung, get the pid of the process, and run the following :
strace -fp <pid> -o strace.out -- can be useful to point out the system call at which the process might be hung (refer the output file strace.out).
pstree -aAp <pid> -- shows the current executing line from the program.
/usr/bin/gdb -q -p <pid> -- to see the current state of the process.

If you have the coredump available,you can use gdb to analyse it.
/usr/bin/gdb <java_binary_path> <coredump_path>

And on gdb console use:
(gdb) bt
(gdb) thread apply all bt


text:
Q: Infinite printing when trying to use a loop new to programming.
I have a class in java and i'm trying to write this program but it's printing none-stop and it's even bugging my browser! (Im using an online ide)
my instructions:
Q: how much do you love me?
Below 10 : wrong answer
equal to 10 and more = good answer
I know how to do it but I dont want the program to stop every time i write an answer. I want the program to keep running until i have a 10 +. So i can always input until it's 10+ out of 10.
this is my lines :
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner input = new Scanner (System.in);
    System.out.println ("how much do you love me out of 10");
    int num1 = input.nextInt();

    while (true)
    if (num1 <= 9) {
    System.out.println("Wrong answer");
    }
       else {
       System.out.println ("Good answer");
       }
 }
}

A: This should work:
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner (System.in);
        System.out.println ("Out of 10, how much do you love me?");
        int input = 0
        while (input <= 9) {
            input = scanner.nextInt();
            if (input <= 9) {
                System.out.println("Wrong answer");
            } else {
                System.out.println("Good answer");
            }
        }
    }
}

Explanation: It loops until input is less not less than or equal to 9 (while (input <= 9)). Each time through the loop, it gets input and acts on it.
Hope this helps!

A: First off, you need to move the int num1 = input.nextInt(); statement inside your while loop, this will allow for a new input every time the while loop loops (iterates).
Second, if you are looking to run the program until num1 >= 10, then you could implement it in two ways.
while(num1 < 10) {
    num1 = input.nextInt();

    if(num1 >= 10) {
        System.out.println("Good answer");
    } else {
        System.out.println("Wrong answer");
    }
}

or using the keyword break,
while(true) {
    num1 = input.nextInt();

    if(num1 >= 10) {
        System.out.println("Good answer");
        break;
    } else {
        System.out.println("Wrong answer");
    }
}

break simply escapes the loop it resides in when called
Hoped this helped


text:
Q: Casperjs, waitfor not executing then() I am trying to click elements on casperjs based on coordinates, the clicks sometimes fail because for example a link could have a line-break which makes the random coordinates I get try to click like in the bottom left corner where there's no clickable element (even when the x,y,x+width,y+height bounds are correct). So I am trying to detect when the link fails and when it succeed.
I tried this code:
var oldUrl;

casper.start( url, function ( ) {

    oldUrl = casper.getCurrentUrl();

    // code that clicks element based on coordinates

}).then( function() {

    casper.waitFor(function check() {
        return oldUrl === casper.getCurrentUrl();
    }, function then() {
        require('utils').dump( 'link click succeed' );
    }, function timeout() {
        require('utils').dump( 'link click failed' );
    }, 5000);

}).run();

Also tried without the first then() and using waitFor directly after start like .start(...).waitFor(...). I also tried this code I found googling:
casper.waitForUrlChange = function(then, onTimeout, timeout){
    var oldUrl;
    this.then(function(){
        oldUrl = this.getCurrentUrl();
    }).waitFor(function check(){
        return oldUrl === this.getCurrentUrl();
    }, then, onTimeout, timeout);
    return this;
};

casper.start( url, function ( ) {

    // code that clicks element based on coordinates

}).waitForUrlChange( function then() {
        require('utils').dump( 'link clicked succeed' );
    }, function timeout() {
        require('utils').dump( 'link click failed' );
    }, 5000);
}).run();

When I use some random coordinates to make sure the click fail, I get this on the output:

[warning] [phantom] Casper.waitFor() timeout
link click failed

But when I use real coordinates making sure the click succeed, I never get link clicked succeed on the output, the script just clicks the element, then goes to "about:blank" and exits.
How do I make it to execute the "then()" function when the click element succeeds?


text:
Q: How to dynamically get value of component p:inputText inside a datatable? I have a primefaces Datatable:
    <p:dataTable id="tabela" var="item"
        value="#{myBean.lista}"
        rowIndexVar="rowindex">

        <p:column>
            <p:inputText
                required="true" id="inputAliquota" value="#{item.taxa}"
                >
            </p:inputText>
        </p:column>
    </p:dataTable>

In my backing bean I have a lista:
private List<Aliquota> lista;

And a Button to remove columns from my datatable:
            <p:commandLink
                immediate="true" id="botaoExcluir"
                action="#{myBean.excluirAliquota}"
                >
                <f:setPropertyActionListener value="#{item}"
                    target="#{myBean.aliquota}" />
            </p:commandLink>

When I start the bean I populate "lista" with 5 empty Aliquota objects.
In excluirAliquota method I get the object that has to be removed, compare with the values of the List and delete it. But I'm having problems. When the user change the value of inputText the change don't reflect the Aliquota object on list.
My question is how to set this value without submit it?

A: You cannot reflect the value on the backing bean without submitting it. However, you can submit it using Ajax by adding a listener to the input text. The listener method doesn't have to do anything, it can be empty, but it needs to be there for an Ajax submit. It can be something like that:
<p:dataTable id="tabela" var="item"
    value="#{myBean.lista}"
    rowIndexVar="rowindex">

    <p:column>
        <p:inputText
            required="true" id="inputAliquota" value="#{item.taxa}"
            >
            <p:ajax listener="#{myBean.dummyListener()}"/>
        </p:inputText>
    </p:column>
</p:dataTable>

This will instantly reflect all changes in the inputText to the taxa field of the corresponding item. If that's what you want, you can use this method.


text:
Q: Fail Files that have no value stored using JSON Schema file I have code that validates .json files using a schema file.
I'm trying to validate a list of values.
But if the file has a "NO_DATA", "EMPTY", or "NULL" stored as a value, I want
Splunk_Status = Data_JSON.IsValid(Schema) to be false.
Schema file I have so far:
"MN": {
    "Type": "string",
    "pattern": "[A-Z0-9]{14}",
},

File to fail:
{
  "MN": "NO_DATA",
}

File to pass (It doesn't have to have the exact pattern it just needs to not be empty):
{
"MN": "FS40-SR20D4-2C00W",
}

VB.net code:
schemaConn = ConfigurationManager.ConnectionStrings("LOCAL_SPLUNK_SCHEMA_PATH")
schema_path = schemaConn.ToString
            Schema_String = My.Computer.FileSystem.ReadAllText(schema_path)
extra_str = backup_path
Schema = JsonSchema.Parse(Schema_String)
step_str = "Validate JSON File Data Using Schema"
Data_String = My.Computer.FileSystem.ReadAllText(Splunk_Info.FullName)
Data_JSON = JObject.Parse(Data_String)
Splunk_Status = Data_JSON.IsValid(Schema)
System.Threading.Thread.Sleep(1000)
Console.WriteLine("SPLUNK VALIDATE: " + Splunk_Status.ToString)
If Splunk_Status = True Then
    File_Validation = True
    Console.WriteLine("File Location = " + Splunk_Info.FullName)
    GoTo Jump_ValidateHeader
Else
    File_Validation = False
    GoTo Jump_ValidateHeader
End If

A: You can prohibit certain values by combining the not and enum keywords:
"not": {
  "enum": [ "NO_DATA", "EMPTY", "NULL" ]
}

You can read about these keywords here:

*

*https://json-schema.org/understanding-json-schema/reference/generic.html#id4

*https://json-schema.org/understanding-json-schema/reference/combining.html#id8


text:
Q: How to get attributes of a selector when using on() or bind()? I have a webpage which lists some articles from a database. The content is loaded dinamically via ajax.
Each article has an edit button that will popup an editor dinamically (second ajax call) where the user can make corrections to the article.
My problem is that I need to pass the 'id' of the article when the edit button is pressed (in order to load it into the editor window), but because I need to use bind() to make the buttons work there is no way to get any atrribute of the button (selector) like 'href':
$('body').on ('click', '.button', function (){
       //load editor window
});

So how could I refrence here the '.button' to get its attributes using .attr () for example.
Thanks!

A: You will need to use e.preventDefault(); to make sure you are not firing the default event that would be the URL in your href tag.
$('body').on ('click', '.button', function (e){
       e.preventDefault();
       console.log($(this).attr('href'));
});

A: I'm assuming your HTML gets rendered in this manner:

    <button class="button">Edit</button>

    <button class="button">Edit</button>

    <button class="button">Edit</button>

If that's the case, then your JS should be like this:
$('body').on('click', '.button', function () {
    var id = $(this).parent().attr("id");
    alert(id);
});


text:
Q: Different ways of making a set of numbers (all between $0$ and $1$) to sum up to $1$ I have a set of numbers $S$, and for each $s_i\in S$, $0\lt s_i \lt 1$. I would like to transform them so that they sum up to $1$.
An obvious way to do it is to calculate $t_i=\frac{s_i}{\sum_i{s_i}}$, so that $\sum_i{t_i}=1$. I wonder if there is any other way to achieve the same effect, and what are the differences between them.

A: A little generalization of this would be: $t_i=\frac{f(s_i)}{\sum f(s_i)}$ with $\sum f(s_i)$ not equal to zero. $f$ would allow you to "bend" $S$ (give different weights).


text:
Q: Order Number missing in Paypal In my site, I am passing multiple items to cart using Paypal. The price ,product name everything appearing correctly. But the order number not displaying in the Paypal. I have pasted my code below.
<form name=pay_last_form method=post action='https://www.sandbox.paypal.com/cgi-bin/webscr'>
<input type=hidden name=cmd value=_cart>
<input type=hidden name=upload value='1'>
<input type=hidden name=rm value='2'>
<input type=hidden name=business value=mymail_id>
<input type=hidden name=item_name_1 value='Deep House 01 - Download Version'>
<input type=hidden name=amount_1 value='14.96'>
<input type=hidden name=item_number_1 value='1'>
<input type=hidden name=shipping value=''>
<input type=hidden name=currency_code value='EUR'>
<input type=hidden name=custom value='17297'>
<input type=hidden name=return value='thanks-payment.php'>
<input type=hidden name=cancel_return value='payment-cancel.php'>
<input type=hidden name=notify_url value='success_payment.php'>
</form>

A: Best to go live for final testing once you have established that your code works. Try using $1 transactions.
Try sending "item_number" and not "item_number_1". Also, try adding a few ore digits to make it look real.
You can retrieve it as Request("item_number")

A: Where are you expecting to see your custom value at?  This will not show on the payment page, as this is a pass thru variable that the merchant will only see.  You should see it in the transaction details, when you log into the merchant account.  If you check the transaction details in the buyer account, you will not see it.  This is also sent back thru IPN as well.  This is working how it should.  I also just ran a test and it is showing where it should be showing.  If you are trying to get it to show on the payment page, you would need to use a different variable, one that is designed to show up for the buyer.


text:
Q: NEXT/Image Component URL issue I am using NEXT/Image component and facing this issue:
When I open the source code on chrome the image src is this:
https://www.example.com/_next/image?url=%2Fimages%2Fhome%2FDog-image-1.jpg&w=384&q=100
but when I make google crawl the website in search console and see the code how google sees it, I see the image URLs like this:
https://www.example.com/_next/image?url=%2Fimages%2Fhome%2FDog-image-1.jpg& amp;w=384& amp;q=100
The URL has changed the "&" character to "& amp;" which is stopping google from indexing the images because this URL gives an error of:
400: BAD_REQUEST Code: INVALID_IMAGE_OPTIMIZE_REQUEST
and google is not able to crawl these images and index them because it seems like a broken link to it.
Any idea why this is happening?
Thank You.

A: I came a cross this issue today as well. I found an answer to this question solves my problem. Create a loader function and pass it to the image component.
const loaderProp =({ src }) => {
    return src;
}

<Image
      src={currentImage.imageurl}
      alt={currentImage.imageurl}
      layout="fill"
      className={styles.imageSize}
      loader={loaderProp}
/>


text:
Q: Why am I getting a "Title set but using a system Identifier" warning? I get the following warning:

MainStoryboard.storyboard: Title set but using a system Identifier
  (These attributes are mutually exclusive; the Title will be ignored)

I have a manually placed toolbar on my storyboard with a Title and a Cancel button. What's wrong about that?

A: Are you adding a title to the Cancel button (e.g. "Cancel")?
You don't need to do this as setting the bar button item as a system bar button item (like Cancel) will automatically set the title—and it'll be localized for you.


text:
Q: $\nabla^nf(x_i)=\sum\limits_{k=0}^{n}(-1)^k\frac{n!}{k!(n-k)!}f(x_i-kh).$ Can anyone help me prove this $$\nabla^nf(x_i)=\sum\limits_{k=0}^{n}(-1)^k\frac{n!}{k!(n-k)!}f(x_i-kh).$$
where $\nabla f(x_i)=f(x_i)-f(x_i-h).$
I tried using induction but I'm not getting anywhere.

A: $\nabla^{n+1}f(x_i)=\sum\limits_{k=0}^{n}(-1)^k\frac{n!}{k!(n-k)!}\nabla f(x_i-kh)$
$=\sum\limits_{k=0}^{n}(-1)^k\frac{n!}{k!(n-k)!}(f(x_i-kh)-f(x_i-(k+1)h))$
$=\sum\limits_{k=0}^{n}(-1)^k\frac{n!}{k!(n-k)!}f(x_i-kh)-\sum\limits_{k=1}^{n+1}(-1)^{k-1}\frac{n!}{(k-1)!(n-k+1)!}f(x_i-kh)$
$=\sum\limits_{k=0}^{n+1}(-1)^k\frac{(n+1)!}{k!(n+1-k)!}\nabla f(x_i-kh)$
because of $\enspace \frac{n!}{k!(n-k)!}+\frac{n!}{(k-1)!(n-k+1)!}=\frac{(n+1)!}{k!(n+1-k)!} \enspace$ and $\frac{1}{(-1)!}=0$ .


text:
Q: 'BooleanField' object has no attribute 'use_required_attribute' in django as the title says i am getting the error while i am using a booleanfield:
'BooleanField' object has no attribute 'use_required_attribute' in django
Models.py
class contactData(models.Model):

    ...
    mapActivated         = models.BooleanField(default=True)

forms.py:
class ContactForm(forms.ModelForm):

class Meta:
    model = contactData
    fields = [
        'vision',
        'horario',
        'image_path',
        'mapActivated',
        ]
    labels = {
        'image_path': '',
    }

    widgets = {
        'mapActivated': forms.BooleanField(required=True)
    }

Anyone can help me with this?
Thank you!

A: You are confusing form fields with form widgets. A forms.BooleanField [Django-doc] is not a widget, it is a form field. A widget is for example the CheckboxInput [Django-doc], it specifies how to render that in a HTML form.
You can specify the field as:
class ContactForm(forms.ModelForm):
    mapActivated = forms.BooleanField(required=True)

    class Meta:
        model = contactData
        fields = [
            'vision',
            'horario',
            'image_path',
            'mapActivated',
        ]
        labels = {
            'image_path': '',
        }
By setting this as required=True, you require that the user will check the checkbox. This might not be (per se) what you want to do. If the user has the freedom to check/uncheck it. Removing required=True should be sufficient.


text:
Q: How should we understand change of the basis matrix? I'm rather new to linear algebra and my professor isn't very clear, so although this question may seem "too easy" for MSE it would be of great help to me!
I'm trying to understand the concept behind a change of basis matrix.

*

*Let's say we have some $m \times n$ matrix $A$, formed by a basis $\alpha$. This means that all the columns of $A$ are a linear combination of elements of $\alpha$, right?

*And if we want a change of basis to $\beta$, we're essentially finding $[A]_\beta$, right?

*And, the thought behind this is "reforming" the columns of $A$ with respect to the basis $\beta$?

*And, to do this, we take the elements of $\beta$ as columns of a new matrix $C$, then multiply it by the coordinates of $A$ w.r.t. $\beta$?
Am I on the right track to understanding this, or am I mistaken?

A: Here's the thing: vector spaces don't come with a basis "pre-loaded", it's an additional layer of structure we put on a vector space in order to describe them more easily.
It turns out the things of actual interest (for the most part) in linear algebra are "vector-space homomorphisms" (functions that preserve "vector-space-ness"), or as your professor and text more likely call them, linear mappings.
Now, normally, vector spaces are "pretty big" (as in infinite, because typically the field of scalars is infinite), and we can't just list all the vectors, and give them names like Fred and Charlie. However, in some cases (these cases are called "finite-dimensional") we have a finite generating set, which we can list.
If this generating set is the smallest one we can make, we call it a basis. Now bases, in general, aren't unique. They're a way to describe vectors explicitly (instead of, say, saying: "vectors are anything that obey the vector space axioms"). This process is called "co-ordinatizing", because given a basis, we can refer to specific vectors by their coordinates (an array of scalars), that is, the coefficients of the basis vectors in the (unique!) linear combination a vector is, in that basis.
It's easier to see what's going on with a two-dimensional example, and the grand-daddy of all such examples is the real cartesian plane, or what most texts refer to as $\Bbb R^2$. One possible basis is formed by the unit axis vectors, often denoted $\mathbf{e}_1$ and $\mathbf{e}_2$, or $\mathbf{i}$ and $\mathbf{j}$. In "standard coordinates" (that is, in this basis), these have the form $(1,0)$ and $(0,1)$, since:
$\mathbf{e}_1 = 1\cdot\mathbf{e}_1 + 0\cdot\mathbf{e}_2\\\mathbf{e}_2 = 0\cdot\mathbf{e}_1 + 1\cdot\mathbf{e}_2.$
Note well that the statement: "the vector that has coordinates $(a,b)$" has no meaning unless a basis is specified. For example, this is also a basis of $\Bbb R^2$: $\beta = \{\mathbf{e}_1 + \mathbf{e}_2, \mathbf{e}_2\}$, and in this basis, the vector that has coordinates $(3,4)$ in the basis $\{\mathbf{e}_1,\mathbf{e}_2\}$ has "different coordinates", namely $[3,1]$.
Now, since vectors are completely determined by their coordinates in a basis, to completely determine the action of a linear map, it suffices to determine its action on said basis (since linear maps preserve linear combinations, the image of a linear combination of basis elements is the same linear combination of the images of the basis elements, for example:
$T(c_1\mathbf{e}+c_2\mathbf{e}) = c_1T(\mathbf{e}_1) + c_2T(\mathbf{e}_2)$).
Note that such a determination represents a "co-ordinatization" of the linear transformation, and is not "intrinsic" but highly-dependent on the basis being used. We call this "array of coordinate arrays" a matrix. In is important to realize that the columns of such a matrix represent the image of the basis vectors "in their own basis", so the first column is the image of $(1,0,\dots,0)$ (which vector this array of coordinates is, depends on the basis; for example, in the basis $\beta$ I gave above this represents what we "usually call" $(1,1)$, in the standard basis).
A change-of basis is a certain kind of linear transformation, namely, one is that is bijective. When the "source" and "target" vector spaces are the same one, but represented by different coordinate systems, we can compute a matrix that lets us convert from one coordinate system, to another. Since this matrix is like a "translation system" between two languages of vector description, it's not in either basis.
The "standard basis" for a vector space can pose a stumbling block, here, because it's so "natural" that we often omit it, and just refer to a vector by coordinates. Put another way, the real cartesian plane doesn't come equipped with coordinate axes, just an origin. We choose coordinate axes, and this choice then determines the actual numbers we put in our scalar array to describe a point in the plane.
Here is an actual example: let's say student $A$ uses the traditional $x$ and $y$ axes, and thus means:
$(x,y) = x\mathbf{e}_1 + y\mathbf{e}_2$.
She is studying a linear transformation $T$ that maps the $x$-unit vector to $(2,2)$ in her coordinates, and the $y$-unit vector to $(3,4)$ in her coordinates. She writes this as:
$[T] = \begin{bmatrix}2&3\\2&4\end{bmatrix}$.
Student $B$ prefers to use the lines $y = x$ and $y = -x$ as his coordinates axes, which is the same as using the basis $\gamma = \{\frac{1}{\sqrt{2}}(\mathbf{e}_1+\mathbf{e}_2),\frac{1}{\sqrt{2}}(\mathbf{e}_2-\mathbf{e}_1)\}$ (for some odd reason, student $B$ prefers a coordinate system rotated at $45^{\circ}$ counter-clockwise to that of student $A$).
So student $A$ recognizes that student $B$'s $[1,0]$ is her $(\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$ and his $[0,1]$ is her $(-\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}})$.
Thus the $B$ to $A$ "translation"(change-of-basis matrix) is afforded by:
$P = \begin{bmatrix}\frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\end{bmatrix}$.
(perhaps you recognize this as a rotation matrix).
Since bijective mappings are invertible, the $A$ to $B$ change will be:
$P^{-1} = \begin{bmatrix}\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\\-\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\end{bmatrix}$.
Student $A$ reasons (correctly) that if she takes a coordinate vector in $B$'s coordinate system, "translates" it to her coordinate system, applies her matrix for $T$, and then translates it back, what she gets should be what $[T]_{\gamma}$ does, in $B$'s coordinate system; that is:
$[T]_{\gamma} = P^{-1}[T]P$
If we compute this, we get:
$[T]_{\gamma} = \begin{bmatrix}\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\\-\frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\end{bmatrix} \begin{bmatrix}2&3\\2&4\end{bmatrix} \begin{bmatrix}\frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}}\\ \frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}}\end{bmatrix}$
$= \begin{bmatrix}\frac{11}{2}&\frac{3}{2}\\ \frac{1}{2}&\frac{1}{2}\end{bmatrix}$.


text:
Q: Get number of changed features in a layer under edit mode using pyqgis Is there a method I can find out, how many features in a layer have changed during edit mode (including changes in the attribute and the geometry)?

A: If you want to count the number of Features that are in the buffer (i.e that have changed since last commit on the layer) you can use the editBuffer of your QgsVectorLayer. It's a QgsVectorLayerEditBuffer object which has interesting methods (changedAttributeValues(), changedGeometries(), addedAttributes(), addedFeatures(), ...)
# get a layer
layer = iface.activeLayer()

# get its editBuffer
buff = layer.editBuffer()

# make some changes in the layer...
  # changed geometries
buff.changedGeometries()
--> {61L: <qgis._core.QgsGeometry object at 0x7f8ed555e808>}

  # changed Attribute Value
buff.changedAttributeValues()

  # Number of changedFeatures regarding geometry or attributes
len(buff.changedGeometries()) + len(buff.changedAttributeValues())

Be aware that if you count the features that  have changed like that, you will count two times the same feature if you change it's geometry and one (or more) of it's attribute(s).
If you want the count of distinct features that have changed you can do something like that:
changed_geom =  buff.changedGeometries().keys() #list of feature ID
changed_attributes = buff.changedAttributeValues().keys() #list of feature ID
distinct_changed_features = set(changed_geom + changed_attributes) # set of distinct feature ID
number_changed_features = len(distinct_changed_features)

Now, if you want the count features that have change during an "Edit session" on a layer, you can connect to editingStarted() and editingStopped signals of QgsVectorLayer to implements a counter of modified features.


text:
Q: Insert text with single quotes in PostgreSQL 9.4.3 Using this:
Insert text with single quotes in PostgreSQL
I run on Postgres version 9.4.3 with command sql after
insert into test values (1,$$user's log$$);

Postgres returns error message
ERROR: 42601: Syntax error at or near "s"


text:
Q: Find Laurent Expansion of $\frac{1}{z(e^z - 1)} $ around $z_0=0$ Find the Laurent expansion of the following around $z_0 = 0$
\begin{align*}
  f(z) &= \frac{1}{z(e^z - 1)} \\
\end{align*}
The answer is
\begin{align*}
  f(z) &= \frac{1}{z^2} - \frac{1}{2z} + \frac{1}{12} - \frac{z^2}{720} + \frac{z^4}{30240} + \cdots
\end{align*}
But I don't see how to find that by hand. I tried:
\begin{align*}
  f(z) &= -\frac{1}{z} \cdot \frac{1}{(1 - e^z)}
= -\frac{1}{z} \cdot \sum\limits_{n=0}^\infty e^{zn}\\
\end{align*}
or
\begin{align*}
  f(z) &= \frac{1}{z} \cdot \frac{1}{e^z - 1} = \frac{1}{z} \cdot \frac{1}{\left( \sum\limits_{n=0}^\infty \frac{z^n}{n!} \right) - 1} \\
  &= \frac{1}{\sum\limits_{n=1}^\infty \frac{z^{n+1}}{n!}} \\
\end{align*}
Neither of the two approaches I tried seem to get me to the solution. Any ideas?


text:
Q: max-height toggle animation on Accordion I have a simple accordion, a transition property on maxHeight.
The clickevent listener is on the parent ul element when I toggle between the max-height(click event) why does all the elements shift to the left slightly? (This happens only to the 2nd and 3rd ul element i.e"Web Development" and "AI and Machine Learning") Can someone help me understand
Here is the codepen
https://codepen.io/sabgalaxy/pen/XWJXGWy
let containers = document.getElementsByClassName("container");

for(let container of containers){
    container.addEventListener("click",() => {
    /*Get the child ul element*/
   let dropdownElement = container.childNodes[1].childNodes[7];
    if (dropdownElement.style.maxHeight) {
      dropdownElement.style.maxHeight = null;
    } else {
      dropdownElement.style.maxHeight = dropdownElement.scrollHeight + "px";
    }

  });
}

A: This is happening because when the accordion expands, the browser is generating a scrollbar to the right hand side of the screen, which narrows the view port and "pushes" everything left. You could acknowledge this in several different ways.
First and foremost, in normal conventions the accordion menu really shouldn't cause a page overflow to begin with. There isn't really any reason this should happen.
To prevent this kind of thing from happening if you don't want to change the structure of your page, take a look at this thread:
Prevent scroll-bar from adding-up to the Width of page on Chrome


text:
Q: How to convert list into a dictionary by python old_list = [ ['ID0', 'ID1'], ['4', '8'], ['5', '6'] ]

I want convert list to new list
key = ['id', 'frame', 'length']
new_list = [{'id': 'ID0', 'frame': '4', 'length': '5'}, {'id': 'ID1', 'frame': '8', 'length': '6'}]

A: new_list=[]
for x,y,z in zip(old_list[0],old_list[1], old_list[2]):
    dict = {'id' : x, 'frame' : y, 'length': z}
    new_list.append(dict)

A: Here's a one-line approach:
>>> [{'id':x, 'frame':y, 'length':z} for x,y,z in zip(*old_list)]
[{'length': '5', 'frame': '4', 'id': 'ID0'}, {'length': '6', 'frame': '8', 'id': 'ID1'}]


text:
Q: pyglet window.flip() not updating I'm drawing a circle and some text with pyglet. I'd like it to update after a keypres, but instead on calling window.flip() the second time, the window is just empty. Any suggestions are appreciated.
from math import *
from pyglet.gl import *

window = pyglet.window.Window()

def make_circle(x_pos, y_pos, radius, numPoints):
    verts = []

    glMatrixMode(GL_PROJECTION)
    glOrtho(0, 640, 0, 480, -1, 1)
    glMatrixMode(GL_MODELVIEW)

    glClear(pyglet.gl.GL_COLOR_BUFFER_BIT)
    glColor3f(1, 1, 0)
    for i in range(numPoints):
        angle = radians(float(i) / numPoints * 360.0)
        x = radius * cos(angle) + x_pos
        y = radius * sin(angle) + y_pos
        verts += [x, y]
    circle = pyglet.graphics.vertex_list(numPoints, ('v2f', verts))
    circle.draw(GL_LINE_LOOP)

def text(x, y, text):
    label = pyglet.text.Label(text, font_size=36,
                              x=x, y=y, anchor_x='left', anchor_y='bottom',
                              color=(255, 123, 255, 255))
    label.draw()

make_circle(5, 5, 100, 10)
text(10, 10, 'Test1')
text(30, 30, 'Text2')

window.flip()
input()

make_circle(5, 5, 22, 10)
text(23, 10, 'This text does not appear')
text(30, 23, 'Neither does this one')
window.flip()
input()

A: If you don't use the default event loop, then you've to do the steps of the event loop your self. It is not sufficient to call window.flip().
Befor the drawing you've to call pyglet.clock.tick() to signify that one frame has passed and window.dispatch_events() to poll the operating system event queue for new events and call attached event handlers.
Note, Since the events are dispatched manually, it is not necessary to set the projection matrix.
See also Dispatching events manually
e.g.:
from math import *
from pyglet.gl import *

def make_circle(x_pos, y_pos, radius, numPoints):
    verts = []

    glClear(pyglet.gl.GL_COLOR_BUFFER_BIT)
    glColor3f(1, 1, 0)
    for i in range(numPoints):
        angle = radians(float(i) / numPoints * 360.0)
        x = radius * cos(angle) + x_pos
        y = radius * sin(angle) + y_pos
        verts += [x, y]
    circle = pyglet.graphics.vertex_list(numPoints, ('v2f', verts))
    circle.draw(GL_LINE_LOOP)

def text(x, y, text):
    label = pyglet.text.Label(text, font_size=36,
                              x=x, y=y, anchor_x='left', anchor_y='bottom',
                              color=(255, 123, 255, 255))
    label.draw()

window = pyglet.window.Window()
# make OpenGL context current
window.switch_to()

# signify that one frame has passed
pyglet.clock.tick()
# poll the operating system event queue
window.dispatch_events()

make_circle(5, 5, 100, 10)
text(10, 10, 'Test1')
text(30, 30, 'Text2')

# swap buffers
window.flip()

input()

# signify that one frame has passed
pyglet.clock.tick()
# poll the operating system event queue
window.dispatch_events()

make_circle(5, 5, 22, 10)
text(23, 10, 'This text does not appear')
text(30, 23, 'Neither does this one')

# swap buffers
window.flip()

input()


text:
Q: How to get last record in mongodb using ruby? I use Ruby on rails, mongoid for my application. I want to get last record in a collection. I try
Person.find().sort({'_id',-1})

but, this command does not work on ruby. How can I achieve to get the last record?
Thanks in advance.

A: Try this
Person.asc(:created_at).last


text:
Q: Is it possible to get design-time code completion for dynamic types? I'm looking into generating types dynamically, ie. TypeBuilder, Reflection.Emit..
Is it ever possible to get design-time code completion for such created types? i.e typename recognition, list of properties after typing "obj1." and such.
Full Context: Trying to generate entities and data access objects corresponding to database tables in runtime. Code generation is an option, but I wanted to see if I could do without it. Have some experience in reflection, but none in type building the reflection.emit way.

A: Not likely without some serious designer mojo.  Emitted code isn't actually generated until runtime, which means it's not actually available at design time.  You could use T4 templates to generate your types that way, as the designer will evaluate the templates to build the required types, which of course are immediately available at design time.


text:
Q: Interactive website building options I am fairly new to the web applications realm and here is my question:
Suppose I want to build an interactive website where I can edit a one dimensional graph containing nodes and branches. The nodes will have a name on it which can be interactively edited. In addition, the user can interactively add or delete nodes, meaning that at least part of the graph should be redrawn.
What is the most efficient way to do that?

*

*Passing add/delete node commands from front-end (browser) to the back-end (server) and doing all the database update on the back-end level and then sending back the command to the front-end about what should be redrawn? Will it be to long a process for the user with all the connections to the server?

*Doing all the processing on what should be redrawn at the front end (browser) level, meaning that the same database should be maintained at both levels: front-end and back-end
Thank you in advance.

A: I think it depends on what you want your user experience to have and what your true intentions are for the website. If it's for educational purposes in showing how nodes and branches are added/removed which would be showing the same thing to every user, I think simply doing this in the front-end is fine and you can maintain the data with sessions, cookies, GET/POST variables, etc.
If you are going to be accessing data, having accounts, and keeping track of what people are updating into the nodes, which ones are being deleted, etc, then that seems like something that would require a larger emphasis on the backend.

A: I'm actually in the process of doing something quite similar.  My suggestion is that you should take a look at ASP.NET MVC4 http://www.asp.net/mvc/mvc4
We need a lot of dynamic front-end manipulation of strong-typed datasources.  MVC allows me to create a rich jQuery-run grid-like front-end with endless interactivity and animations (everything HTML/CSS/jQ is meant to do) while safely and securely passing information asynchronously to models and effectively updating the apps databases in real time.
There's a learning curve for sure but it can really pay off if you give it the time.


text:
Q: How do I center a div inside a background image across browsers? So this website has content inside a background image that has a square in it but it is not centered.
In firefox it is too big, and in Chrome it is too far to the left, and the only way to center it is by pressing ctrl+ (which makes the browser window smaller), and even then it is still not centered.
Does anyone have a fix for this?
Thanks.

A: You need to centre the background image:
body {
    background: #000000 url(images/waves.jpg) center top repeat-x;
}

A: Essentially if you have a div inside another div or a div inside your html body tag, if the div in question has a width defined, you just need to
.myDiv {
margin: 0 auto;
}

A: This will work..
body {
    background: background: url(images/waves.jpg) center;
}

A: Personally I use percentages to center the background image:
background-position:50% 50%;

Full code for body:
body {
margin: 0;
padding: 0;
line-height: 1.5em;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 12px;
color: #989898;
background-image: url(images/waves.jpg);
background-position: 50% 50%;
}


text:
Q: Sort array without using temporary variables I am doing a program. In that there is an array sorting function like below
$arr= array(10,2,13,5,8);

for($i=0; $i<count($arr)-1; $i++)
{
    for($j=0; $j<count($arr)-1; $j++)
    {
        if($arr[$j]> $arr[$j+1]){
            $temp= $arr[$j+1];
            $arr[$j+1]= $arr[$j];
            $arr[$j]= $temp;
        }
    }

}
print_r($arr);

Here I am using a temp variable to store the values temporarily.
Is there a way to do this sorting with out a temp variable?
I don't want to do this with any built in PHP functions

A: $arr = array(10,2,13,5,8);

for($i=0; $i<count($arr)-1; $i++)
{
    for($j=0; $j<count($arr)-1; $j++)
    {
        if($arr[$j]> $arr[$j+1]){
            list($arr[$j],$arr[$j+1]) = array($arr[$j+1], $arr[$j]);
        }
    }

}
print_r($arr);

If they are integers, another way of swapping them is
$a = $a + $b;
$b = $a - $b;
$a = $a - $b;

A: Use the array-sort function. In my opion there is no need to write another array-sort-function.


text:
Q: Install ubuntuon UEFI mode on hp h8-1360t This is a new computer that can only boot in UEFI mode. ( or at least I do not know how to switch to  normal BIOS mode). I am not able to install ubuntu 12.04.1 or ubuntu 12.10 using the livecd. The live CD does not boot properly. I get error message with subsequent kernel panic. It came with windows 7 preinstalled. bcdedit indicated that windows in UEFI mode. The problem is not solved even when I disconnect the windows disk.

A: I'm using the exact same model(h8-1360t) which came with Windows 7 x64 and just installed Ubuntu 12.10 Desktop edition and writing here from it.
For the installation, I did not do anything specific, just downloaded the Ubuntu 12.10 ISO, burnt it on DVD, and then booted from the DVD and installed it.
Just something different from the original setup was that I used a HDD that was left over from other things, did a clean install to it, but disattached the other HDD's that I wasn't going to use in this setup.
I have not installed any special drivers to make the graphics better to have something like the wobbly dialogs so its just a normal install of Ubuntu 12.10.


text:
Q: Caption in subfloat shifted to the right I'm seeing strange behavior when using subfloat. I have 6 figures that I want to display as 2 by 3 (2 lines, 3 columns). The caption (a, b, c etc.) is shifted to the right which means figure b) is labeled a) and c) appears on page margin where no image is located.
\usepackage{graphicx,subfig}

\begin{document}
    \begin{figure}[ht!]
        \centering
            \subfloat[Shield One]{\includegraphics[width=4cm]{figure/items/shield_1}}
            \subfloat[Shield Two]{\includegraphics[width=4cm]{figure/items/shield_2}}
            \subfloat[Shield Three]{\includegraphics[width=4cm]{figure/items/shield_3}}
            \newline
            \subfloat[Sword One]{\includegraphics[width=4cm]{figure/items/sword_1}}
            \subfloat[Sword Two]{\includegraphics[width=4cm]{figure/items/sword_2}}
            \subfloat[Sword Three]{\includegraphics[width=4cm]{figure/items/sword_3}}
            \caption[Items and their definition]{Items and their definition}
            \label{fig:items}
    \end{figure}
\end{document}

Does anyone have a clue ?

A: Check images and if there's sufficient space, also look for warnings. Perhaps post a compilable example. This compilable example shows the expected correct behavior:
\documentclass{article}
\usepackage{graphicx,subfig}
\begin{document}
\begin{figure}[ht!]
    \centering
        \subfloat[Shield One]{\includegraphics[width=4cm]{figure/items/shield_1}}
        \subfloat[Shield Two]{\includegraphics[width=4cm]{figure/items/shield_2}}
        \subfloat[Shield Three]{\includegraphics[width=4cm]{figure/items/shield_3}}
        \newline
        \subfloat[Sword One]{\includegraphics[width=4cm]{figure/items/sword_1}}
        \subfloat[Sword Two]{\includegraphics[width=4cm]{figure/items/sword_2}}
        \subfloat[Sword Three]{\includegraphics[width=4cm]{figure/items/sword_3}}
        \caption[Items and their definition]{Items and their definition}
        \label{fig:items}
\end{figure}
\end{document}