text:
Q: android app with multiple sub apps We have an app such that it should contain more sub apps. So there is a parent app P which contains other child apps c1, c2, c3 etc. These child apps can be downloaded and run stand alone from the play store as well. If the parent app P is installed on the phone and child app too are present then upon clicking a tab corresponding to child app , the child app will be launched, if child app is not present then it's activity will be shown by the parent app P.
We had started copy pasting code from parent app P to create child apps c1 , c2 etc but the changes done are not synced right now and are causing problem. The project is under git and we are thinking of creating sub modules in git and to share the code. So the app structure becomes like
P android studio projet structure
-appcore ( common shared code repo )
-c1
-c2
-c3
-com.example.p

where core,c1, c2, c3 will be modules in android studio having their own repository which have the code that needs to be put inside P.
Each child app will have structure as below
c1 android studio structure :

    -appcore
    -c1
    -com.example.c1

So basically the child app c1 gets common shared code between all apps form appcore repo and makes changes in c1 repo which can be shared with other apps which add c1 repo as submodule and has the application specific files (like splash screen etc ) in com.example.c1 package.
Is there any better way for doing this ?


text:
Q: The computer didn't automatically boot from USB, I am new in Ubuntu and created a bootable USB disk first and restarted the PC(with OS Windows8) as recommended in the tutorial. However, the computer didn't automatically boot from USB, no menu box appeared on screen to choose "Try Ubuntu" or "Install Ubuntu", even though I tried holding esc, F12, F10. I appreciate any help!

A: This article has detailed steps for creating Ubuntu 18.04 Live USB and booting it:

*

*https://linuxconfig.org/install-ubuntu-from-usb-18-04-bionic-beaver
The part you are stuck on now is getting BIOS to boot the Live USB:
Access Boot Menu
To access Boot Menu on your computer you will need to hit different keys (or combination of keys) depending on your computer type. Here is the list of possible keys you may have to press depending on your PC:

Device
Key Combination
Comment

Acer
Esc, F12 or F9
F12 key most likely

Apple
⌥
the key is also known as Option or Alt

Asus
F8 or Esc

Compaq
Esc or F9

Dell
F12

eMachines
F12

Fujitsu
F12

HP
Esc or F9

Lenovo
F8, F10 or F12
Other possibilities: Novo button or Fn + F11

Samsung
Esc or F2 or F12
For ultrabooks from Samsung disable the fast boot option in BIOS/UEFI. See next section.

VAIO
Esc, F10 or F11
Other possibilities: Assist button

Toshiba
F12

These are the keys to override the boot priority for a single session. There are other keys for accessing the full BIOS/UEFI menus below.

Access BIOS/UEFI
To access BIOS/UEFI on your computer you will also need to hit different keys (or combination of keys) depending on your computer type. Here is the list of possible keys you may have to press depending on your PC:
Key combinations for accessing BIOS/UEFI Device

Device
Key Combination
Comment

Acer
Del or F2
F2 key most likely

Asus
Delet or Del

Compaq
F10

Dell
F2

eMachines
Tab or Del

Fujitsu
F2

HP
Esc, F10, F11
Other possibilities: on Pavilion - F1

Lenovo
F1 or F2
Other possibilities: small button next to the Power button (if laptop)

Samsung
F2
For ultrabooks from Samsung if might be F10

VAIO
F1, F2, F3
Other possibilities: Assist button

Toshiba
F1, F2, F12 or Esc

A: Have you changed your boot priority in the BIOS? I think you can find the settings you want by changing the priority in the BIOS.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to check if a Worksheet contains a specific macro In my little C# Programm im opening up an Excel sheet using Excel Interop to run a macro inside the sheet:
xlApp.Application.Workbooks.Open(Path.GetFullPath(path).Replace("\"", ""));
xlApp.Application.Run(Macro: macroName);

Im just passing the Macro as a string macroNamefrom a user input.
Unfortunately the programm crashes, if the macro doesnt exist in the current active worksheet.
Is there a way i can check for the macro before trying to run it, to give a suitable response to the user?

A: Found this. This solution works perfectly fine for me, thanks to Fredrik.


text:
Q: How to frequency filter a time series in R I'd like to know how to apply frequency filters to a time series in R and get the result back in the time domain (e.g. fourier transform -> get rid of certain frequencies -> inverse fourier transform) or a similar approach (there does not seem to be a suitable inverse function to fft). From what I have seen people recommend the signal package, but I don't seem to be able to get sensible results with this package. So to put an example. Let's say I have a simple monthy time series:
plot(log(AirPassengers))

Let's say I want to extract these seasonal fluctuations here using a band-pass filter (i.e. get rid of the trend and the small higher frequency movements). If someone could produce an R code do do this by fourier methods, preferably using a package function, and explain it that would be of great help to get me started.


text:
Q: How can I create null class object in Kotlin? In java, we can declare a null class object like this
VideoRecord videoRecord;

After that, we can check if it is null or not
if (videoRecord == null){
    videoRecord = new VideoRecord();
}

I am new to Kotlin and I would like to do the same thing in Kotlin. I have tried this code below.
lateinit var videoRecord1:VideoRecord

if (videoRecord1 == null){
    videoRecord1 = VideoRecord()
}

But it gives me a warning like the condition videoRecord1 == null is always false. How can I make the same thing in Kotlin?

A: var videoRecord: VideoRecord? = null

you can initial its variable like this
nullable reference : https://kotlinlang.org/docs/reference/null-safety.html

A: Depending on what you're trying to achieve, e.g. lazy initialization then this may be more suitable for you than the answer given by andika_kurniawan:
val videoRecord: VideoRecord by lazy { VideoRecord() }

This will lazily initialize videoRecord the first time it is accessed.
The advantage of this way is that you don't have to check for null when accessing videoRecord, because it cannot be null. This simplifies the usage of that variable significantly. Additionally you can mark videoRecord as val, meaning it is final, so it cannot be overwritten.
The example shown by @andika_kurniawan:
var videoRecord: VideoRecord? = null

Has some caveats and disadvantages:

*

*You always have to check that videoRecord is not null (and it gets tedious), see this example:
if (videoRecord != null) {
    videoRecord.callAMethod()
}

The above will not work, because videoRecord defined as nullable, so you need to use the !! operator to tell kotlin that you're sure that the variable is not null:
if (videoRecord != null) {
    videoRecord!!.callAMethod()
}

You can of course use other idioms, like the null-safe operator ?.
videoRecord?.callAMethod()

Or the already mentioned !! operator (which throws an exception when it is null) but this time without a null check:
videoRecord!!.callAMethod()

You may also use local variables, which simplify the usage (a little bit):
val videoRecord = videoRecord
if (videoRecord != null) {
    videoRecord.callAMethod()
}

*The variable is not final, so nothing stops you from doing this somewhere in your code:
videoRecord = null

*You have to initialize it somewhere, so if you have multiple methods accessing videoRecord you first have to initialize it if it hasn't already been, introducing unnecessary redundancy.

A: In kotlin, declaration of variable is different from java as kotlin is null safe language. You have to declare variable nullable. Only then its value can be null.
You can declare it as below
var videoRecord: VideoRecord? = null

To access nullable values you have to use !! or ? with variable names.


text:
Q: Operator overloading + with pointer array of class objects C++ I'm working on a small assignment for a class. I need to overload the '+' operator to add together two private member variables of a class object. The class objects are pointed to by an array of class pointers. I'm not quite sure where to start debugging, but my operator overload function causes the program to crash.
Here is main.cpp (ignore printObjects and freeObjects for now).
#include <iostream>

#include "Foo.h"

using namespace std;

void createObjects(Foo* fooArr[3], Foo* newFoo);
void printObjects(Foo* fooArr[3], Foo newFoo);
void freeObjects(Foo* fooArr[3], Foo newFoo);

int main()
{
    Foo *fooArr[3] = { 0 };
    Foo *newFoo = 0;
    createObjects(&fooArr[3], newFoo);
    Foo f1 = *(fooArr[1]) + *(fooArr[2]);
    f1.outputX();
}

void createObjects(Foo* fooArr[3], Foo* newFoo)
{

    for (int i = 0; i < 3; i++)
    {
        newFoo = new Foo(i+1);
        fooArr[i] = newFoo;
    }
}

Here is Foo.h:
using namespace std;

class Foo
{
private:
    int x;

public:

    Foo();
    Foo(int);
    void setX(int);
    const int getX();
    void outputX();
    Foo operator+(const Foo&) const;
};

And finally here is foo.cpp:
#include <iostream>

using namespace std;

#include "Foo.h"

Foo::Foo(int x_)
{
    x = x_;
}
void Foo::setX(int x_)
{
    x = x_;
}
const int Foo::getX()
{
    return x;
}
void Foo::outputX()
{
    cout << x << endl;
}
Foo Foo::operator+(const Foo& f2) const
{
    Foo f3(0);
    f3.x = x + f2.x;
    return f3.x;
}

The program crashes (segFault), right after calling the operator+ overload function. Now I know this means I am trying to access memory that the program doesn't actually have access to. However, I just don't know how to craft the operator overload statement to work with the function call:
 Foo f1 = *(fooArr[1]) + *(fooArr[2]);

Any help would be much appreciated.
Thanks!


text:
Q: 90's dark knight cartoon Help me identify a 90s gothic cartoon. All I can remember are three main characters. One of them was a dark knight summoned from his grave in order to kill a warrior in every episode. This warrior was helped by a wizard/priest. The whole theme of the animation was really dark. As much as I can remember it was a series.
First of all, I want to thank you for your interest in my question. These memories of this cartoon began when I heard a song where the intro they used seemed familiar to me. I born in 95'at Greece and I remember watching this before I was 5, so it must be a 90s cartoon. I remember it was translated into Greek for sure. The song I am telling you about is this

 All I can recall was that it was a medieval gothic cartoon and I can really remember this Dark Knight that didn't talk at all, he just wanted to kill our main protagonist. This Dark Knight was called in every episode in order to kill our protagonist warrior. Our protagonist was always helped by a guy with magic powers and he looked like a medieval priest. That's all. I really appreciate any effort to help me. Thanks in advance!


text:
Q: Mysql join returns results in multiple rows instead of one for every instance I have three tables: tbl_days, tbl_slots and tbl_bookings as follows.

Customers are supposed to book for a slot in a day.
Am using the following query:
$slots = $this->common->slots();

    if ($slots != NULL) {
        foreach ($slots as $C):
            $start = $C->start;
                 $stop = $C->stop;
                 $slotspace= $start." to ".$stop;

                 $available='Available';
                 $booked ='Booked';

                $sum_col[] = "  IF(tbl_bookings.slot_id =". $C->id.",'".$booked."','".$available."') AS '" . $slotspace . "'";

        endforeach; }

    $sqlquery = $this->db->query("SELECT tbl_days.date_day,

    " . implode(",", $sum_col) . "

    FROM tbl_days
    LEFT JOIN tbl_bookings ON tbl_bookings.date = tbl_days.date_day
    LEFT JOIN tbl_slots ON tbl_slots.id = tbl_bookings.slot_id
    LEFT JOIN tbl_fields ON tbl_fields.id = tbl_bookings.field_id
       ");
    return $sqlquery->result();

However, the results display as:
Intended result should be:

Please note how booking information displays on multiple rows for the same date.

*

*Dates to be from the date today (for the next 7 days from today)

*Display slots for the day on one row.

*Display the date regardless of if there is a booking or not, like in date 29th.
Kindly help me on how to go about this.
Please note that am using datatables.

A: So each entry gets displayed in a new row instead of everything that's connected to each other in 1 row, right? I had the same problem in the past and the solution is a second foreach. The second one should look at all the records and see if one is connected to another.
See my question: Each value is displayed in a new row HTML table


text:
Q: Empty folder importing external library I want to import to my android project an external library: CouchBase lite
I have cloned the library using Git

$ git clone git://github.com/couchbase/couchbase-lite-android.git

as well the submodules

git submodule update --init --recursive

In order to import the library to my Android project I am doing:
file->New->Import Module
This screen is showing:

After click on finish, the project has been imported but the folder couchbase-lite-android appears empty as can see:

That is not correct as you can see in the local source folder which I used to import the library:

In fact I need to use the class AndroidContext from that library but it is not available .
This is my setting.gradle
include ':couchbase-lite-java-forestdb', ':libraries:couchbase-lite-java-core'

About the build.gradle I have a few:

This is my build.gradle(Module:app)
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.jcr61782.importaingcoach"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile project(path: ':libraries:couchbase-lite-java-core')

}

What I am doing wrong?


text:
Q: How to get the availability zone of Codebuild build during execution time? I have an AWS Codebuild Project that is connected to a VPC. Now I'm trying to understand how can I get the availability zone of codebuild build during execution time. Is this possible?

A: It turns out there is an Environment Variable, CODEBUILD_VPC_AZ, that holds this value.

A: Based on AWS documentation there are two environment variables having the AWS Region where the build is running (AWS_DEFAULT_REGION and AWS_REGION). I don't think there is any possibility to get the actual availability zone.
But is there something specific that you want to achieve by knowing the availability zone? Maybe we can provide a solution to that.


text:
Q: How to verify a DSA signature given (R,S) pair in Java? I am developing a Java (JDK 1.8) application using standard (built in) DSA classes in order to verify digital signatures.
I have data files and the expected signatures stored in text files as shown below:
// Signature part R:
4226 3F05 F103 E3BE 59BF 3903 37F8 0375 8802 5D8F.
// Signature part S:
AF21 15B0 16E4 1761 75B8 C7D4 F877 5AB7 26BB AE72.

Note that the signature is expressed in the form of (R,S) pair as described in the FIPS 186-3 NIST Standard.
In order to verify the signature I am calling the method verify(byte[] signature) from java.security.Signature. This method expects a byte array that represents the signature to be verified. However, I do not know how to convert the (R,S) pair into a byte array. Therefore I am not able to verify the signature.
So, I would like to know:
1) Is there a way of converting (R, S) pair into a DSA byte array signature as expected by the verify() method?; Or,
2) Is there a way of getting the R and S values from the Java Signature instance class so that I can compare these values to the ones I have?
Thanks in advance.
EDIT: the solution proposed by @dave_thompson_085 worked pretty well! See below the complete source code:
// read DSA parameters from file or other means
BigInteger r = new BigInteger(...);
BigInteger s = new BigInteger(...);
BigInteger p = new BigInteger(...);
BigInteger q = new BigInteger(...);
BigInteger g = new BigInteger(...);
BigInteger y = new BigInteger(...);

// get the public key
KeySpec publicKeySpec = new DSAPublicKeySpec(y, p, q, g);
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);

// read the input file to be checked and update signature
Signature signature = Signature.getInstance("SHA1withDSA");
signature.initVerify(publicKey);
File inputFile = new File(...);
try (BufferedInputStream is = new BufferedInputStream(new FileInputStream(inputFile))) {
    byte[] buffer = new byte[1024];
    while (is.available() != 0) {
        int len = is.read(buffer);
        signature.update(buffer, 0, len);
    }
}

// convert (r, s) to ASN.1 DER encoding
// assuming you have r and s as !!positive!! BigIntegers
// (if you have unsigned byte[] as shown in your Q,
// use BigInteger r = new BigInteger (1, bytes) etc.
byte[] rb = r.toByteArray();
byte[] sb = s.toByteArray(); // sign-padded if necessary
// these lines are more verbose than necessary to show the structure
// compiler will fold or you can do so yourself
int off = (2 + 2) + rb.length;
int tot = off + (2 - 2) + sb.length;
byte[] der = new byte[tot + 2];
der[0] = 0x30;
der[1] = (byte) (tot & 0xff);
der[2 + 0] = 0x02;
der[2 + 1] = (byte) (rb.length & 0xff);
System.arraycopy(rb, 0, der, 2 + 2, rb.length);
der[off + 0] = 0x02;
der[off + 1] = (byte) (sb.length & 0xff);
System.arraycopy(sb, 0, der, off + 2, sb.length);

// verifies if the signature is valid
boolean isValid = signature.verify(des);

A: 1A. The form expected by normal Java crypto (and most but not all other uses of DSA, and also ECDSA) is an ASN.1 DER encoding. https://crypto.stackexchange.com/a/1797/12642 explains what the difficulties are but doesn't quite tell you how to do it.
1B. If you have or can install the BouncyCastle cryptoprovider jar, it contains a whole set of ASN.1 routines. Or easier it also contains
a low-level primitive org.bouncycastle.crypto.signers.DSASigner with init and verifySignature(byte[], BigInteger, BigInteger) accessible. (But this primitive does not do the hash, so do that yourself first.)
1C. If you must do it yourself with standard crypto:
// assuming you have r and s as !!positive!! BigIntegers
// (if you have unsigned byte[] as shown in your Q,
// use BigInteger r = new BigInteger (1, bytes) etc.

byte[] rb = r.toByteArray(), sb = s.toByteArray(); // sign-padded if necessary
// these lines are more verbose than necessary to show the structure
// compiler will fold or you can do so yourself
int off = (2+2)+rb.length, tot = off+(2-2)+sb.length;
byte[] der = new byte[tot+2];
der[0] = 0x30; der[1] = tot;
der[2+0] = 0x02; der[2+1] = rb.length; System.arraycopy(rb,0, der,2+2, rb.length);
der[off+0] = 0x02; der[off+1] = sb.length; System.arraycopy(sb,0, der,off+2, sb.length);

 2. You cannot verify a standard DSA signature by comparing r and s. As you should know from reading FIPS186-3 sections 4.5 and 4.6 signatures are randomized; computing two (or more) signatures for the same message gives a different (r,s) pair every time -- unless you repeat enough times to hit the same k, which on average is 2^159 tries for older 1024/160 groups/keys, more for newer/larger ones. If you have a million computers each of which can do a million tries per second, this will still take about 16,000,000,000,000,000,000,000,000,000 years.


text:
Q: Getting "Realm didn't match redirect_uri/origin. Error code: 2" When I try sign in, the login window pops up as expected but it gives me this error.
Error: invalid_request
Realm didn't match redirect_uri/origin. Error code: 2

Request Details:

openid.realm=localhost:8080/oauth2callback
scope=email profile openid https://www.googleapis.com/auth/userinfo.email
response_type=permission
redirect_uri=storagerelay://http/localhost:8080?id=auth435566
ss_domain=http://localhost:8080
client_id=SOME_STRING_ID.apps.googleusercontent.com
fetch_basic_profile=true

I read through the Open ID 2.0 documentation and from my understanding of it, the property openid.realm, should be the same as one of my redirect uri's.
Here are my "Authorized redirect URIs" from the developer console in the credentials section:
https://myapp-1234.appspot.com/oauth2callback
http://myapp-1234.appspot.com/oauth2callback
http://localhost:8080/oauth2callback

I set openid.realm to localhost:8080/oauth2callback because at the moment I'm only testing my application but I have tried the other ones in deployment and I still got the same result but with different error codes.
Here is where I invoke the signIn() method:
var authConfig = {
    client_id: 'SOME_STRING_ID.apps.googleusercontent.com',
    cookie_policy: 'single_host_origin',
    scope: 'https://www.googleapis.com/auth/userinfo.email profile',
    openid_realm: 'localhost:8080/oauth2callback'
}

window.handleGoogleClientLoad = function () {
gapi.client.load('myapp_endpoints', 'v1', null, '//' + window.location.host + '/_ah/api');
console.log('API LOADED');
}

//=====================================================================================

function authorizeUser() {
    gapi.load('auth2', function() {
        gapi.auth2.init(authConfig)
            .then(function() {
                var auth2 = gapi.auth2.getAuthInstance();
                var user = auth2.signIn();
                console.log(user);
        });
    });
}

module.exports = {
    login: authorizeUser
}

Here is index.html
<!DOCTYPE html>

<meta charset="utf-8">
    <title>My App</title>

A: The problem was that I was using the wrong Google APIs library. I was using the library that you get from npm. I then imported the module.
import GoogleApis from 'googleapis'

What I was meant to do instead was use the library that can be downloaded from their own website. Integrating this is handy enough. All you have to do is add the line of code below to your index.html.

The file should then look like this
<!DOCTYPE html>

<meta charset="utf-8">
    <title>Welcome to MyApp</title>

I then changed around my javascript. You can find references of these changes from their code examples.
const authConfig = {
    client_id: 'my_app.apps.googleusercontent.com',
    cookie_policy: 'single_host_origin',
    scope: 'https://www.googleapis.com/auth/userinfo.email profile',
    fetch_basic_profile: true
}

window.init = function() {
    gapi.load('auth2', function() {
        var auth2 = gapi.auth2.init(authConfig);
        auth2.signIn().then(function() {
            if(auth2.isSignedIn.get()) {
                var profile = auth2.currentUser.get().getBasicProfile();

                console.log('ID: ' + profile.getId());
                console.log('Full Name: ' + profile.getName());
                console.log('Email: ' + profile.getEmail());
            }
        });
    });
}

A: openid.realm=response_type=permission.
id_token
redirect_uri=storagerelay://https/www.zillow.com?id=auth807591
ss_domain=https://www.zillow.com
client_id=238648973530.apps.googleusercontent.com
fetch_basic_profile=true
gsiwebsdk=
access_type=online
scope=https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid


text:
Q: Cannot upload a image file in the EPiServersite I have created a EPIServer CMS site using visual studio. I am able to access the site using edit mode. I want to add some image on that site. But when I am trying to upload a image using the upload option it is showing failed message.Why it is happening do you have any idea. But when I have uploaded the images from the demp 'Aloy Site' given by EPIServer team it is uploaded successfully.
Please tell the probable cause of this.
Thanks and regards
Utpal Maity

A: I also got the fail to upload images. Firstly I thought it was a config-setting or a permission problem. But it turned out that I needed a "media descriptor".
You can read about it here. This applies for EPiServer CMS 7.x
C# example:
[ContentType]
[MediaDescriptor(ExtensionString = "jpg,jpeg,jpe,gif,bmp,png")]
public class ImageFile : ImageData
{
    public virtual string AlternativeText { get; set; }
}


text:
Q: Get average value from double[] between two indices I have a double[] array holding many numbers.
I have an algorithm that selects sections from within this array that fall under certain conditions (value greater than x, at least y values, etc.)
Now I want to calculate the average value of all these values in my section.
So, say my section is from index 20 to 40. Now I have 20 values. Is there an easy way to do this in C# or do I have to loop over my array and calculate the average by hand?

A: var values = new[] { 1, 2, 3, 4, 5, 6, 7, 8 };
var average = values.Skip(2).Take(5).Average();

A: Use Linq:
var myList = new double[] {1,2,3}
var avg = myList.Where(i => i > 1 && i < 2).Avg();

A: Note that if you have the numbers with index 20 to 40, you don't have 20 numbers, you have 21 numbers.
You can use the Range method to create an IEnumerable for the indexes, then you can use the Average method to get the average of the numbers:
double average = Enumerable.Range(20, 21).Select(i => numbers[i]).Average();

A: Use Enumerable.Average:
double[] values = new[] { 1.0, 2.0, 3.14, 2.71, 9.1 };
double average = values.Where(x => x > 2.0 && x < 4.0).Average();

Therefore, to use this with your selection methods you should consider having those methods return IEnumerable<double>. So, as an example:
public IEnumerable<double> GreaterThan(double[] values, double value) {
    for(int i = 0; i < values.Length; i++) {
        if(values[i] > value) {
            yield return values[i];
    }
}

Then:
// values is double[]
double average = GreaterThan(values, 2.0).Average();

You can even make the above an extension method so that it reads nicely:
double average = values.GreaterThan(2.0).Average();

I would encourage you to write your filtering methods to return IEnumerable<double>.

A: You can use the skip and take methods of linq to choose particular indexes:
var myData = new double[] { ..... };
var average = myList.Skip(20).Take(21).Average();

A: double avg = array
    .Skip(startIndex)
    .Take(endIndex - startIndex + 1)
    .Average();


text:
Q: How do I remove the white between border and my content? I have been at this for a while, here is my HTML and CSS together kind of simplified. I'm sure it's something simple but I cant figure it out for the life of me. I just need to remove the white space in between the border and my content.
<!DOCTYPE html>

<title> Module One Activity </title>

 Module One Activity

  Page 1

    &nbsp &nbsp

  Page 2

    &nbsp &nbsp

  Page 3

    &nbsp &nbsp

  Page 4

   Statement:  If students are allowed to use technology such as computers, calculators and tablets, then they will be able to develop a deeper understanding of the math concepts presented within their course.

 Part 1

  Inverse:  If students are not allowed to use technology such as computers, calculators and tablets, then they will not be able to develop a deeper understanding of the math concepts presented within their course.

 Created by: Tollis Hunt

 Contact information:  Email me!

A: Try this in your CSS:
body
{
    margin:0;
    padding:0;
}

This will remove your white space between content and border.
Hope it helps.
Demo


text:
Q: Load view from NIB file from several different UIViewControllers I have been loading view from Nib files successfully using the approach found on this site
[[NSBundle mainBundle] loadNibNamed:@"YourNibName" owner:self options:nil];

The problem is that, because we have to set the File Owner, this nib file becomes "attached" to this view controller. This view is subclass of UITableViewCell and I wanted to load this nib file from several different vc's.
Thanks for your help.

A: A nib is just a template, you can load it over and over again.
If using iOS4, you might want do look at UINib which gives improved performance for repeated nib loading.

A: I'll present two options:

*

*Create a class NibLoader with a single @property (nonatomic, retain) IBOutlet id mainObject; and a method called loadNibNamed:bundle:). Then, do MyView * v = [[NibLoader loadNibNamed:"MyView" bundle:nil] mainObject];. (A GCC 4.0 property access bug meant that [...].mainObject would call [...] twice; it's been fixed in 4.2.)

*Create @protocol MyNibOwner which has @property (nonatomic, retain) IBOutlet MyView * myView;, and change the file's owner class to id<MyNibLoader> or NSObject<MyNibLoader>.

A: Pedantically, a nib should probably have a single controller.  What I would probably do is create a new UIViewController subclass that controls the stuff in this nib of yours, and then whenever you want the stuff in the nib, create one of these view controllers and ask it for the stuff, instead of loading the nib directly.


text:
Q: C++ executable crashing I am starting to create a binary tree. So far all I have added is an insert function and I believe it works fine. When I compile my application, header and implementation files together it produces a executable but with an error code above it about exception handler used.... When I go to run the executable it crashes. I don't understand why it is crashing, can someone please help! Thanks in advance.
The command line errors http://gyazo.com/7ca1e8fb1a66da39e927e9ba627d3f53
My application file called mainprogramming.cpp
#include <iostream>
#include <cstdlib>

#include "Header.h"

using namespace std;

int main()
{
    int Rndnums[10] = {3, 99, 76, 49, 32, 9, 77, 64, 81, 24};

    BinaryTree *tree = new BinaryTree();

    for(int i = 0; i < 10; i++)
    {
        tree->insert(Rndnums[i]);
    }

    return 0;
}

My header file called Header.h
class BinaryTree
{
// Can only be accessed by the class itself
private:
    struct node
    {
        // Data stored in this node of he tree
        int data;
        // The left branch of the tree
        node *left;
        // The right branch of the tree
        node *right;
    };

    node *tree;
    void insert(node *tree, int value);

// Can be accessed by all
public:
    BinaryTree(){};
    ~BinaryTree();
    void insert(int value);

};

My implementation file called implementation.cpp
#include <iostream>
#include <cstdlib>

#include "Header.h"

using namespace std;

// Inserts a value into the tree - notice **
void BinaryTree::insert(node *tree, int value)
{
    // Check if nullptr. If so set new node
    if (tree == nullptr)
    {
        // Create new node
        tree = new node;
        // Set new value
        tree->data = value;
        // Set branches to nullptr
        tree->left = nullptr;
        tree->right = nullptr;
    }
    // If the input value is less than the node in the tree
    else if(value < tree->data)
    {
        insert(tree->left, value);
        cout << "The value " << value << "has been added as a left child\n";
    }
    // If the input value is greater than the node in the tree
    else if(value > tree->data)
    {
        insert(tree->right, value);
        cout << "The value " << value << "has been added as a right child\n";
    }
    else
    {
        cout << "The value " << value << "can only be equal and must already exist in the tree\n";
    }
}

void BinaryTree::insert(int value)
{
    insert(this->tree, value);
    cout << "It ran";
}

A: Your problem is in your insert call:
void BinaryTree::insert(node * leaf_head, int value)
{
    ...
}

You are copying the pointer address then trying to create an object in that memory space, and then modifying that object.  It works fine when you change it to a reference to that pointer:
void BinaryTree::insert(node * & leaf_head, int value)
{
    ...
}

That way you are actually modifying the tree pointer within BinaryTree instead of a copy of it.


text:
Q: Linking not working in homebrew's cmake since Mojave I've reproduced this symptom on two computers now, cmake seems to no longer look in /usr/local/lib (or more properly, $(brew --prefix)/lib) for Homebrew-provided libraries since upgrading my machine to macOS Mojave.
Although there are ways to circumvent this (e.g. search for homebrew prefix using EXECUTE_PROCESS; add the result to LINK_LIBRARIES(...) command) none are ideal.  What changed in Mojave to break this behavior?
The temporary workaround is to add the following to CMakeLists.txt:
# WARNING: Don't hard-code this path
LINK_DIRECTORIES(/usr/local/lib)

I've already tried brew doctor and updated all homebrew packages to no avail.
The specific error that cmake (make) shows is:
ld: library not found for -l<somelib>

I've asked the question on the Homebrew forums and the Apple developer forums.

A: I've isolated this to the following change in the VERBOSE=1 make logs...

*

*High Sierra (<=10.13) and below did NOT use the -isysroot command.

*Mojave (>=10.14) DOES use the -isysroot command.

From gnu.org:

-isysroot <dir>
  This option is like the --sysroot option, but applies only to header files (except for Darwin targets, where it applies to both header files and libraries). See the --sysroot option for more information.

So this flag specifically clobbers the lib search path only on Apple.  This results in the compilation never looking in the standard ld locations, which can be seen by typing ld -v dummy.
Library search paths:
    /usr/lib
    /usr/local/lib

Why does cmake do this?  My thought is it was to fix the /usr/local/include issues introduced with the new Mojave SDK behavior.
Unfortunately, I can't find a cmake compile flag to add the default library search paths back in.  For now the only solution I've found is to add the following to my project:
IF(APPLE)
    # Fix linking on 10.14+. See https://stackoverflow.com/questions/54068035
    LINK_DIRECTORIES(/usr/local/lib)
ENDIF()

I'm not sure if this is a behavior that warrants an upstream cmake patch.  If there is a better solution, please provide it.

A: Ran into a related (?) issue while trying to pip install psycopg2 in a Django app under OS X Mojave (10.14). I was getting the following errors:
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

The short explanation: « As of High Sierra, /usr/local is no longer
  chown-able... »
The solution: change permissions for /usr/local to allow Homebrew to
  create links.

I adapted the solution to my needs. Then I was finally able to run pip install psycopg2. Here is the sequence of commands (update: inside your project root i.e. where you see manage.py).
First
sudo chown -R $(whoami) $(brew --prefix)/*

Then
brew reinstall openssl
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
pip install psycopg2


text:
Q: applying style on contextual characters breaks the words I have problem in Arabic and Farsi characters as they have contextual (connetced) characters, When I want to indicate a keyword, the words that contain that keyword , break to smaller words. My question is how to apply css styles on keywords without breaking main words?
As you see in the following examples the character س is being separated from next character when I apply style on it.

.redColor{color:red}
.redBg{background:red}
div{font-size:26pt}

کلمات به هم پیوسته

کلمات به هم پیوسته

کلمات به هم پیوسته

A: One solution is to consider gradient coloration that you adjust in size/position to have the needed coloration. The drawback is that you need to correctly find the different values that will change depending on the chararacter you want to target and the font properties:

.redBg {
  background:
    linear-gradient(red,red) left/23px 100% no-repeat;
}
.blueBg {
  background:
    linear-gradient(green,green) 40px 0/32px 100% no-repeat;
}

.redColor {
  background:
    linear-gradient(red,red) left/23px 100% no-repeat,
    #000;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.blueColor {
  background:
    linear-gradient(green,green) 40px 0/32px 100% no-repeat,
    #000;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

div {
  font-size: 26pt;
  display:inline-block;
}

  کلمات به هم پیوسته

  کلمات به هم پیوسته

  کلمات به هم پیوسته

  کلمات به هم پیوسته

You can also easily scale to multiple background in order to target more character in the same sentence:

.redBg {
  background:
    linear-gradient(red,red) left/23px 100%,
    linear-gradient(pink,pink) 80px 0/25px 100%;
  background-repeat:no-repeat;
}
.blueBg {
  background:
    linear-gradient(green,green) 40px 0/32px 100% no-repeat;
}

.redColor {
  background:
    linear-gradient(red,red) left/23px 100%,
    linear-gradient(blue,blue) right/45px 100%,
    #000;
  background-repeat:no-repeat;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.blueColor {
  background:
    linear-gradient(green,green) 40px 0/32px 100% no-repeat,
    #000;
  background-clip: text;
  color: transparent;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

div {
  font-size: 26pt;
  display:inline-block;
}

  کلمات به هم پیوسته

  کلمات به هم پیوسته

  کلمات به هم پیوسته

  کلمات به هم پیوسته

Another idea is to duplicate the text where you can easily apply the needed styles and you cut one of the text using overflow (you won't have line break with this method)

.redColor:after {
  color:red;
  width:25px;
}
.blueColor:after {
  color:blue;
  width:30px;
  text-indent:-42px;
  left:42px;
}

div {
  font-size: 26pt;
  display:inline-block;
  position:relative;
}
div:before,
div:after{
  content:attr(data-text);
}

div:after {
  position:absolute;
  top:0;
  left:0;
  white-space:nowrap;
  overflow:hidden;
  background:#fff;
}


text:
Q: vCard or MeCard? Specific to creating detailed inventory forms I am in search of the most appropriate route to take, vCard or MeCard, and the correct syntax to use in order to create unique forms for various uses. An example being an inventory form.
Creating a new contact card by scanning a QR Code is as far as I am. However, I would like to create unique forms with unique keys/values. Is this easily achieved? Is there a set of keys that are specific to achieve this?
I have looked into the following resources:
https://www.rfc-editor.org/rfc/rfc6473
https://www.rfc-editor.org/rfc/rfc6350
If anyone has experience with any of the topics stated above, I would very much appreciate the advice and insight.
As this is my first question, go easy on me.

A: A vCard, .vcf or Versitcard is the standardised file format for electronic business cards. This is a universal format understood by most devices and software that handle things like contact information and email. vCards can hold everything from your first name, to a photo, to an audio clip. There is some good information about this format on Wikipedia.
meCARD is a more compact format, and that it generates a smaller QR code, meCARD might make more sense for contact information, it is possible that your phone will understand both formats, in which case meCARD would make more sense for contact information. as some phones like blackberry tends to face some problems scanning vCards


text:
Q: Django validate user input with generic listview filter So I'm making a really simple filter based on a generic listview. I use "GET" to retrieve a user input from a searchfield/ filterfield.
I want to filter my data on "arrival_date", a DateField in models.Delivery. So this filter works but any given number will be compared to the contents of "arrival_date"
What i want to do is validate the user input, it can only contain numbers and the characters "-" or "/". Besides the characters i also want to say the query needs at least four digits to be a valid input.
In a regular form I'd use "clean_arrival_date" to use any validation but I need a push in the right direction to apply the same sort of validation required in this listview...
Thanks for the help,
Kevin
Below; the views.py containing the overriding listview with query_set
    #views.py

    """
    Date selector based on ListView
    """

    from django.views.generic import ListView

    from .models import Delivery

    class DeliveryDateListView(ListView):
        model = Delivery
        template_name = 'data/deliveries_by_date.html

        def get_queryset(self):
            # Fetch the queryset from the parent get_queryset
            queryset = super(DeliveryDateListView, self).get_queryset()

            # Get the data GET parameter
            date = self.request.GET.get("date")
            if date:
                # Return a filtered queryset
                return queryset.filter(arrival_date__icontains=date)
            # Return the base queryset
            return queryset

A: First, if you pass it via URL please read this django's url
And then, if you using Ajax in JS:
Just check the input (you can check the event key down or check when submit)
We have many way to do this


text:
Q: can I update a javascript variable being displayed using innerhtml I'm trying to build a basic budget calculator tool in javascript which displays a running total at the top of the page which updates when individual budget items are changed. To do this I'm using [document.getElementById("runningTotal").innerHTML += total_sp;]. This works fine for calculating the running total but every time I make a change the new total is appended to the old total, so the output on screen makes no sense. Can anyone tell me how I can do this so that the running total updates every time a change is made replacing the old total with the new total? I'm new to all this, so very grateful for any help you can offer. Cheers!

    SPENDING (RUNNING TOTAL) £

    Baseline research spending is: £

    Baseline wage spending is: £

    Baseline total spending is: £

<input id="researchcalc" type="number">
<input type="button" value="change research spend" onClick="changeresearchspending()">

 Change in research spending is: £

 New research spending is: £

 New total spending is: £

<input id="wagecalc" type="number">
<input type="button" value="change wage spend" onClick="changewagespending()">

 Change in wage spending is: £

 New wage spending is: £

 New total spending is: £

A: You can replace the += by =, like this:
document.getElementById("runningTotal").innerHTML = total_sp;


text:
Q: How to reshape tabular data to one row per group I am an R (and coding novice) and I am looking for a way to reconfigure Table A show below into Table B.
Table A:
type   x1  x2  x3
A      4   6   9
A      7   4   1
A      9   6   2
B      1   3   8
B      2   7   9

I am looking for code that would convert to the following
Table B:
type   x1  x2  x3  x1'  x2'  x3'  x1'' x2'' x3''
A      4    6   9   7    4   1    9     6   2
B      1    3   8   2    7   9

The real Table A is over 150000 rows and 36 Columns. With 2100 unique "type" values.
Thanks for the help.
-Shawn

A: To me, this solution seems pretty straightforward
# split the data frame by type and use unlist, which will provide names
ld <- lapply(split(d[-1], d[["type"]]), unlist)

# gather all the unique names in the list
ldNames <- Reduce(unique, lapply(ld, names))

# use the names to index each list element, which makes them
# all of equal length and suitable for row binding.
do.call(rbind, lapply(ld, function(x) x[ldNames]))
#   x11 x12 x13 x21 x22 x23 x31 x32 x33
# A   4   7   9   6   4   6   9   1   2
# B   1   2  NA   3   7  NA   8   9  NA

If the order of the output above is not satisfactory, you can rearrange:
# save the output from above
d2 <- do.call(rbind, lapply(ld, function(x) x[ldNames]))
# reorder the names
ldNames_sorted <- c(matrix(ldNames, ncol = (ncol(d) - 1), byrow = TRUE))

# apply the new order.
d2 <- d2[, ldNames_sorted]
#  x11 x21 x31 x12 x22 x32 x13 x23 x33
#A   4   6   9   7   4   1   9   6   2
#B   1   3   8   2   7   9  NA  NA  NA

To add a column for type instead of using row names, one method would be:
data.frame(type = row.names(d2), d2)

A: A bit late to the party, but this can also be done quite easily with the dcast function of the data.table package because you can use multiple value.var's in it:
library(data.table)

dcast(setDT(d), type ~ rowid(type), value.var = c('x1','x2','x3'), sep = '')

which gives:

   type x11 x12 x13 x21 x22 x23 x31 x32 x33
1:    A   4   7   9   6   4   6   9   1   2
2:    B   1   2  NA   3   7  NA   8   9  NA

You can also do this in base R with:
d$num <- ave(d$x1, d$type, FUN = seq_along)
reshape(d, idvar = 'type', direction = 'wide', timevar = 'num', sep = '')

A: Take a try and the solution is not such concise, just give you a hint.I think lots of things can be improved.
But finally we have to introduce NAs in here :(
zz <- "type   x1  x2  x3
A      4   6   9
A      7   4   1
A      9   6   2
B      1   3   8
B      2   7   9"

dA <- read.table(text=zz, header=T)

tmp<-(sapply(unique(dA$type), FUN=function(x) as.vector(t(dA[dA$type == x, -1]))))

t(sapply(tmp, '[', seq(max(sapply(tmp, length)))))
      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,]    4    6    9    7    4    1    9    6    2
[2,]    1    3    8    2    7    9   NA   NA   NA

A: a <- data.frame(type=c("A", "A","A", "B", "B"), x1 = c(4,7,9,1,2),x2=c(6,4,6,3,7),
               x3 = c(9,1,2,8,9))

library(dplyr)
tmp <-
a %>%
  group_by(type) %>%
  summarise(no_rows = length(type))

for(i in unique(a$type)){
  n <- max(tmp$no_rows) - nrow(a[a$type == i,])
  nn <- nrow(a)
  if(n > 0){
    for(ii in 1:n){
      a[nn+ii,] <- c(i,NA,NA,NA)
    }
  }

}

a <- a[order(a$type),]
a$timevar <- seq(1:max(tmp$no_rows) )

b<-reshape(a,timevar="timevar",idvar="type",direction="wide",drop = F)
b

  type x1.1 x2.1 x3.1 x1.2 x2.2 x3.2 x1.3 x2.3 x3.3
1    A    4    6    9    7    4    1    9    6    2
4    B    1    3    8    2    7    9 <NA> <NA> <NA>

A: Variation on @Hack-R's answer:
A$num <- with(A, ave(as.character(type), type, FUN=seq_along) )
tmp <- cbind(A[c(1,5)], stack(A[2:4]))
tmp$time <- paste(tmp$ind, tmp$num, sep=".")

reshape(tmp[c("type","time","values")], idvar="type", timevar="time", direction="wide")

#  type values.x1.1 values.x1.2 values.x1.3 values.x2.1 values.x2.2 values.x2.3 values.x3.1 values.x3.2 values.x3.3
#1    A           4           7           9           6           4           6           9           1           2
#4    B           1           2          NA           3           7          NA           8           9          NA

And a dplyr version for fun:
library(dplyr)
library(tidyr)

A %>%
  gather(var, value, -type) %>%
  group_by(type,var) %>%
  mutate(time=seq_along(var)) %>%
  ungroup() %>%
  unite(grpvar, c(time,var) ) %>%
  spread(grpvar, value )

#Source: local data frame [2 x 10]
#
#   type  1_x1  1_x2  1_x3  2_x1  2_x2  2_x3  3_x1  3_x2  3_x3
#  (chr) (int) (int) (int) (int) (int) (int) (int) (int) (int)
#1     A     4     6     9     7     4     1     9     6     2
#2     B     1     3     8     2     7     9    NA    NA    NA


text:
Q: LINQ-TO-JSON cannot get value in array I am trying to get values with LINQ-TO-JSON in this JSON-TREE, So far it looks good until i've approached this categories element.
I want to get the value "Teknik" from this value and this is what i've tried to far without success.
  Name = json["items"][i]["categories"].Children().Value<string>() ?? "Not assigned"

  Name = json["items"][i]["categories"][0].Value<string>() ?? "Not assigned"

  Name = json["items"][i]["categories"].First.Value<string>()

But none of these results works for me. Please help!

A: You didn't post the actual JSON string and the "tree" doesn't help. The JSON string in Querying JSON with LINQ could be represented with a similar tree, so I'll assume that's your source data:
string json = @"{
  'channel': {
    'title': 'James Newton-King',
    'link': 'http://james.newtonking.com',
    'description': 'James Newton-King\'s blog.',
    'item': [
      {
        'title': 'Json.NET 1.3 + New license + Now on CodePlex',
        'description': 'Annoucing the release of Json.NET 1.3, the MIT license and the source on CodePlex',
        'link': 'http://james.newtonking.com/projects/json-net.aspx',
        'categories': [
          'Json.NET',
          'CodePlex'
        ]
      },
      {
        'title': 'LINQ to JSON beta',
        'description': 'Annoucing LINQ to JSON',
        'link': 'http://james.newtonking.com/projects/json-net.aspx',
        'categories': [
          'Json.NET',
          'LINQ'
        ]
      }
    ]
  }
}";

JObject rss = JObject.Parse(json);

The example shows two ways to access values, through indexers or LINQ queries.
Using indexers, you'd only need [0] to access the first category of an item, eg:
rss["items"][i]["categories"][0];

That returns a JValue object as a JObject. You can cast it directly to string to get its value, eg:
(string)rss["items"][i]["categories"][0]

Or to a JValue, if you want to handle it as a JSON object and read the Value property, eg:
(rss["items"][i]["categories"][0] as JValue).Value;

A LINQ query wouldn't need indexers. If you wanted to retrieve the Category names you could write :
var query= from item in rss["channel"]["item"]
           from category in item["categories"]
           select new {Name=(string)category};

Or
var query = from category in rss["channel"]["item"].SelectMany(item=>item["categories"])
            select new {Name=(string)category};

Or
var query = rss["channel"]["item"].SelectMany(item=>item["categories"])
                                  .Select(category=>new {Name=(string)category});


text:
Q: yo ember tutorial: Client doesn't have permission to access the desired data I'm doing the YoEmber tutorial: https://github.com/zoltan-nz/library-app. Getting the following error-
Uncaught Error: permission_denied at /authors: Client doesn't have permission to access the desired data.
I create a Firebase database, as the tutorial requires, with the following rules: {
  "rules": {
    ".read": true,
    ".write": true
  }
}

Still, the database is not getting authenticated. I also copied the correct apiKey, authDomain, databaseURL, projectId, storageBucket, and messagingSenderId from firebase.
Anyone have any ideas?

A: The issue was that I didn't update my credentials in Firebase itself, I only updated them in my environment.js file


text:
Q: Outputting to console from Char Array im creating a hangman game that has to use CHAR and not strings. I was wondering how i would choose a single random word form a Char array and display it to the console as a symbol e.g. ****** instead of the word. My current array; Thank you.
char words [6][10] =
{
    "Pistachio",
    "Avocado",
    "Salami",
    "Bologna",
    "Christmas",
    "Giraffes",
};

This is what i have so far (i know it not much im a bit confused)
cout <<"Test " <<words <<endl;

and that just out put a random number ??

A: To output a cstring from an array of cstrings you need to provide the index of that string.
cout <<"Test " <<words <<endl;

Will just print the address of the first element of the array since that is what an array name is reduced to.  So the correct way to display from the array is:
cout <<"Test " <<words[indexOfTheStringYouWant] <<endl;

A: words is a char** an array of char[10]. The << operator knows how to print simple types (int, float), std::string and char *, but not char ** arrays nor pointers to C strings (char arrays). So it only print the address of the array of char *. char[10]
I think that what you want is :
for (int i=0; i< sizeof(words)/sizeof(char *); i++) cout << words[i] << " ";
cout << endl;

A: I think you are looking for this:
#include<cstdlib>

int v;
for(int i=0; i<10; i++)
{
    v = rand() %6;
    printf("%s\n", words[v]);
}

A: If I have understood correctly what you need is the following
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <ctime>

int main()
{
    const size_t N = 6;
    const size_t M = 10;
    char words[N][M] =
    {
        "Pistachio",
        "Avocado",
        "Salami",
        "Bologna",
        "Christmas",
        "Giraffes",
    };
    size_t index[N];

    std::iota( index, index + N, 0 );

    std::srand( ( unsigned int )std::time( nullptr ) );

    std::random_shuffle( index, index + N );

    for ( size_t i = 0; i < N; i++ ) std::cout << words[index[i]] << std::endl;

    return 0;
}

The program output might look like
Giraffes
Bologna
Pistachio
Avocado
Salami
Christmas


text:
Q: Updating field name of the List I am creating new list using CSOM on Sharepoint Online. It's creating new list with column name as 'Title' by default. I need to rename the column to 'Description'. For that I am using Update method which is executing successfully. After updating the field name, when I try add new value to field Its showing 'Title' as field name.
Please find the screen shot for the details.

Here is the sample code
ListCreationInformation f_objLCInfo     =   new ListCreationInformation();
f_objLCInfo.Title                       =   "My New List";
f_objLCInfo.TemplateType                =   100;
f_objLCInfo.Description                 =   "This is new list";
_destlist                               =   _Web.Lists.Add(f_objLCInfo);
_context.Load(_destlist);
_context.ExecuteQuery(); // List is creating sucessfully.

 Field f_DestTitleColumn =  _destlist.Fields.Where(field =>
                             field.SchemaXml.Contains
                             ("82642ec8-ef9b-478f-acf9-31f7d45fbc31")).First();

f_DestTitleColumn.Title  =    "Description";
f_DestTitleColumn.Update();
_context.Load(f_DestTitleColumn);
_context.ExecuteQuery();

A: Explanation
SharePoint uses some calculated fields along with the "Title" field, these additional calculated fields are used in Views and there internal names are "LinkTitle", "LinkTitleNoMenu"
You have changed "LinkTitle" field which changes it in the View but not in the forms, since forms display "Title" field.
In order to change completely, you have to change all three of them.
The code
The code to change all the fields related to Title:
Field f_TitleLink =  _destlist.Fields.Where(field =>
                             field.SchemaXml.Contains
                             ("82642ec8-ef9b-478f-acf9-31f7d45fbc31")).First(); //LinkTitle

f_TitleLink.Title  = "Description";
f_TitleLink.Update();

Field f_TitleColumn =  _destlist.Fields.Where(field =>
                             field.SchemaXml.Contains
                             ("fa564e0f-0c70-4ab9-b863-0177e6ddd247")).First(); //Title

f_TitleColumn.Title  =    "Description";
f_TitleColumn.Update();

Field f_TitleLinkNoMenu =  _destlist.Fields.Where(field =>
                             field.SchemaXml.Contains
                             ("bc91a437-52e7-49e1-8c4e-4698904b2b6d")).First(); //LinkTitleNoMenu

f_TitleLinkNoMenu.Title  =    "Description";
f_TitleLinkNoMenu.Update();

_context.Load(f_TitleLink);
_context.Load(f_TitleColumn);
_context.Load(f_TitleLinkNoMenu);
_context.ExecuteQuery();

Additional
If you are working with list definitions or content types and you want to change the title of the "Title" field, following field XML will help:
 <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="Name" Required="TRUE"
         SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" />
 <Field ID="{82642ec8-ef9b-478f-acf9-31f7d45fbc31}" Name="LinkTitle" DisplayName="Name" Type="Calculated" Sealed="TRUE" />
 <Field ID="{bc91a437-52e7-49e1-8c4e-4698904b2b6d}" Name="LinkTitleNoMenu" DisplayName="Name" Type="Calculated" Sealed="TRUE" />

A: You can rename the title field by going into the list settings from site contents.
site content-> List Settings -> click on Title -> Rename it ->
save Changes


text:
Q: How to add a ListViewItem in ListView control in asp.net code behind I have declared a listView control on an aspx page.
e.g. <asp:Listview ID="ListView1" runat="server"><ItemTemplate></ItemTemplate></asp:Listview>
I want to know that how i can add one or more ListViewItems in code behind.
***Please don't give a solution that uses DataSource and DataBind methods for the ListView.
Thanks

A: No other way of binding data to ListView except DataSourceId and SataSource
Check the ListView control Reference from MSDN Here.


text:
Q: Can you safely delete apps from iTunes music folder? I realised I was running drastically low on disk space today, and after some poking around found I had 40GB (!) of apps in iTunes.
Now that Apple have sorted out their store so you can re-download without paying etc, can I safely delete this entire folder without losing all my apps? And will the apps currently on my devices (iPad and iPhone) stay there following a sync?

A: I had a similiar problem when I just bought my new iPad and downloaded a ton load of apps to it.
iTunes saves the downloaded apps as .ipa files on your harddrive, and when I found them I just deleted them, and I've been synchronizing my iPad multiple times after, and havent lost any of my apps on the iPad.
The .ipa's is placed here if you're using windows:
C:\Users\<username>\Music\iTunes\iTunes Media\Mobile Applications

And here if you are using OS X:
User/Music/iTunes/Mobile Applications

Alternatively you can just do this:
For windows:

*

*Open iTunes

*Go to Library, and press Apps menu

*Here you can see all your apps, right click just any if 'em

*Press "Show in Windows Explore"
For OS X:

*

*Open iTunes

*Go to Library, and press Apps menu

*Here you can see all your apps, right click just any if 'em

*Click "Show in Finder"

A: What I do:
Delete all, then plug your phone in and right click it.
Hit transfer purchases.
This will copy all apps from your phone (currently installed) to your pc.
Other apps that you deleted won't come back but you can always get them back via itunes (as they are not installed on your phone).
Then you can safely sync.
If you have another device - ipad - plug it in and transfer again.

A: Manipulating the iTunes folder structure manually is a VERY bad idea. If you didn't redownload the apps that were on your iDevice, it would likely clobber the apps on the device the next time you sync'd.
A better solution would be to go through the "Apps" section in iTunes itself and delete ones that aren't currently on any devices, thus getting rid of the copies on the computer without clobbering ones on the device. You can still redownload them from iCloud, should the need arise.


text:
Q: where is the cpp-package in mxnet 1.6? I tried to compile lates mxnet from git but there is no cpp-package as in before in 1.5 ?
How can I use c++ api in latest mxnet. ?
I compiled as n described and tis not produced op.h


text:
Q: JSF datatable populate rows based on selection I have two datatables in one jsf page and both are having two different managed beans.
//master table
<p:dataTable id="dataTable" var="req" lazy="true"
            value="#{emp.lazyModel}" paginator="true" rows="10"
            selection="#{emp.selectedRequest}">
            <p:ajax event="rowSelectRadio" listener="#{emp.onRowSelect}" />
            <p:column selectionMode=">
                <h:outputText value="#{req.empNo}" />
            </p:column>

// detail table
<p:dataTable id="Det" var="det" lazy="true"
            value="#{dept.lazyModel}" paginator="true" rows="1">

            <p:column>
                <f:facet name="header">
                    <h:outputText value="DeptNo" />
                </f:facet>
                <h:outputText value="#{det.deptNo}" />
            </p:column>

Managed beans respectively
// Master table managed Bean
@Named("emp")
@ViewAccessScoped
public class EmployeeManagedBean implements Serializable {

@PostConstruct
    public void init() {
        initTable();
    }

// Detail table managed Bean
@Named("dept")
@ViewAccessScoped
public class DepartmentManagedBean implements Serializable {

@PostConstruct
    public void init() {
        initTable();
    }

initTable() is a method which populates LazyModel for both managed beans
When I select a row in master datatable, I am able to get selected row value in managed bean for first datatable which is EmployeeManagedBean
My question is what is the best approach to populate the second datatable by passing the selected row value of first datatable to second managed bean and thus populate the second datatable?  The triggering point to display values in second datable should be based on the selection of a row in first datatable.
Any help is highly appreciable.
Thanks

A: I am new with this all, but I try doing like this:

*

*pass selected row to second bean (DepartmentManagedBean)

*took departments according to selected row

*update second datatable, using p:ajax attribute update


text:
Q: Required: Float, Found: Float []. Compatibility issue I need to store values of a table in an array, but I can't because the values are floats and it is being given an array. Basically, the lines that are giving me error are:
float[] floatArray = new float[columnCount];
floatArray[i] = dataModel.getFloats(nextRow, i, length);

columnCount needs to be an int because it is used for the for loop as well as being taken from another class. How do I make the 2nd line compatible. It is saying it requires a float (which is what dataModel outputs) but sees a float[].
I can try to be more helpful if I am not clear.

A: The error is "Required: Float, Found: Float []."
It means you're trying to set float[] into a float variable. You misunderstood the error message.
I believe your getFloats() is returning float[], not float. So the correct assignment is:
float[] floatArray = dataModel.getFloats(nextRow, i, length);

A: Assuming that getFloats() returns a single float, and all previous variables are defined, you can store all of the values into the array like this:
float[] floatArray = new float[columnCount];
for(int i = 0; i < MAX_FLOATS; i++) {
    floatArray[i] = dataModel.getFloats(nextRow, i, length);
}

Conversely, if getFloats() returns a float[], then you can peform this operation on a single row:
float[] floatArray = dataModel.getFloats(nextRow, i, length);


text:
Q: Can I add a 'show all pages' link to wp link pages? I use wp_link_pages to paginate individual pages and posts.
Is  there a way I can add to it an extra link which'll show all pages together, on a single page rather than split?

A: Here's a suggestion using the wp_link_pages and content_pagination filters:
The aim is to add a "Show All Content" link below the content pagination links:

and when we click it, the link should display "Show Content Pagination" and vice versa.
Demo plugin
We can do that with the following demo, where we introduce the wpse_show_all_content GET variable:
add_filter( 'wp_link_pages', function( $output, $args )
{
    // Validate user input
    $show_all_content = (bool) filter_input(
        INPUT_GET,
        'wpse_show_all_content',
        FILTER_VALIDATE_BOOLEAN
    );

    // Generate link
    $link = add_query_arg(
        'wpse_show_all_content',
        ! $show_all_content,
        get_permalink()
    );

    // Generate link title
    $title = $show_all_content
        ? 'Show Content Pagination'
        : 'Show All Content';

    // Append
    $output .= sprintf(
        '%s',
        esc_url( $link ),
        esc_html__( $title, 'mydomain' )
    );

    return $output;

}, 10, 2 );

To disable the content pagination when wpse_show_all_content is true, we can use (PHP 5.4+):
add_filter( 'content_pagination', function( $pages )
{
    // Validate user input
    $show_all_content = (bool) filter_input(
        INPUT_GET,
        'wpse_show_all_content',
        FILTER_VALIDATE_BOOLEAN
    );

    // Disable content pagination
    if( $show_all_content )
        $pages = [ join( '', $pages ) ];

    return $pages;

} );

Hope you can adjust this further to your needs!
Update
As per discussion, here's a way to target only a specific wp_link_pages() instance:
add_filter( 'wp_link_pages', function( $output, $args )
{
    // Nothing to do if 'wpse_show_all_link' is missing or not a true boolean string
    if(
            ! isset( $args['wpse_show_all_link'] )
        ||  ! wp_validate_boolean( $args['wpse_show_all_link'] )
    )
        return output;

    // Validate user input
    $show_all_content = (bool) filter_input(
        INPUT_GET,
        'wpse_show_all_content',
        FILTER_VALIDATE_BOOLEAN
    );

    // Generate link
    $link = add_query_arg(
        'wpse_show_all_content',
        ! $show_all_content,
        get_permalink()
    );

    // Generate link title
    $title = $show_all_content
        ? 'Show Content Pagination'
        : 'Show All Content';

    // Append
    $output .= sprintf(
        '%s',
        esc_url( $link ),
        esc_html__( $title, 'mydomain' )
    );

    return $output;
}, 10, 2 );

where we introduce a custom wpse_show_all_link attribute that can take values like
1, 0, '1', '0', 'yes', 'no', true, false, 'true', 'false'.

Usage:
wp_link_pages( ['wpse_show_all_link' => true, ...] );


text:
Q: How to stream a message with tokio_proto and tokio_service in Rust In my SmtpService I'd like to send the response header right away and the body when processing is finished. This should follow the SMTP exchange:
C: DATA
S: 354 Start mail input
C: ... data ...
C: ... more ...
C: .
S: 250 Ok

I've got this much in the playground:
#[macro_use]
extern crate log;
extern crate bytes;
extern crate tokio_proto;
extern crate tokio_service;
extern crate futures;

use std::io;
use bytes::Bytes;
use tokio_service::Service;
use tokio_proto::streaming::{Message, Body};
use futures::{future, Future, Stream};
use futures::sync::oneshot;
//use model::request::SmtpCommand;
//use model::response::SmtpReply;

#[derive(Eq, PartialEq, Debug)]
enum SmtpCommand {
    Data,
}
#[derive(Eq, PartialEq, Debug)]
enum SmtpReply {
    OkInfo,
    StartMailInputChallenge,
    TransactionFailure,
    CommandNotImplementedFailure
}

pub struct SmtpService;

impl Service for SmtpService {
    // For non-streaming protocols, service errors are always io::Error
    type Error = io::Error;
    // These types must match the corresponding protocol types:
    type Request = Message<SmtpCommand, Body<Bytes, Self::Error>>;
    type Response = Message<SmtpReply, Body<SmtpReply, Self::Error>>;

    // The future for computing the response; box it for simplicity.
    type Future = Box<Future<Item = Self::Response, Error = Self::Error>>;

    // Produce a future for computing a response from a request.
    fn call(&self, command: Self::Request) -> Self::Future {

        info!("Received {:?}", command);

        match command {
            Message::WithBody(cmd, cmd_body) => {
                match cmd {
                    SmtpCommand::Data => {
                        // start => SmtpReply::StartMailInputChallenge
                        // ok => SmtpReply::OkInfo
                        // err => SmtpReply::TransactionFailure

                        let (tx, rx) = oneshot::channel();

                        let fut = cmd_body
                                .inspect(|chunk| info!("data: {:?}", chunk))
                                .map(|_| tx.send(SmtpReply::OkInfo))
                                .map_err(|_| tx.send(SmtpReply::TransactionFailure))
                                .map(|_| Body::from(rx));

                        // ??? How to wire the fut future into the response message?

                        let msg = Message::WithBody(SmtpReply::StartMailInputChallenge, fut);

                        Box::new(future::ok(msg)) as Self::Future
                    }
                    _ => Box::new(future::ok(Message::WithoutBody(
                        SmtpReply::CommandNotImplementedFailure,
                    ))),
                }
            }
            Message::WithoutBody(cmd) => {
                Box::new(future::ok(Message::WithoutBody(match cmd {
                    _ => SmtpReply::CommandNotImplementedFailure,
                })))
            }
        }
    }
}

fn main() {
    println!("Hello, world!");
}

I'm wondering if it's even possible or do I need to produce two messages instead - one for DATA and a second for the actual byte stream?
The error I get shows a mismatch in the message structure; the body/future is obviously out of place:
error[E0271]: type mismatch resolving `<futures::FutureResult<tokio_proto::streaming::Message<SmtpReply, futures::stream::Map<futures::stream::MapErr<futures::stream::Map<futures::stream::Inspect<tokio_proto::streaming::Body<bytes::Bytes, std::io::Error>, [closure@src/main.rs:57:42: 57:76]>, [closure@src/main.rs:58:38: 58:68 tx:futures::Sender<SmtpReply>]>, [closure@src/main.rs:59:42: 59:84 tx:futures::Sender<SmtpReply>]>, [closure@src/main.rs:60:38: 60:56 rx:futures::Receiver<SmtpReply>]>>, std::io::Error> as futures::Future>::Item == tokio_proto::streaming::Message<SmtpReply, tokio_proto::streaming::Body<SmtpReply, std::io::Error>>`
  --> src/main.rs:66:25
   |
66 |                         Box::new(future::ok(msg)) as Self::Future
   |                         ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `futures::stream::Map`, found struct `tokio_proto::streaming::Body`
   |
   = note: expected type `tokio_proto::streaming::Message<_, futures::stream::Map<futures::stream::MapErr<futures::stream::Map<futures::stream::Inspect<tokio_proto::streaming::Body<bytes::Bytes, std::io::Error>, [closure@src/main.rs:57:42: 57:76]>, [closure@src/main.rs:58:38: 58:68 tx:futures::Sender<SmtpReply>]>, [closure@src/main.rs:59:42: 59:84 tx:futures::Sender<SmtpReply>]>, [closure@src/main.rs:60:38: 60:56 rx:futures::Receiver<SmtpReply>]>>`
              found type `tokio_proto::streaming::Message<_, tokio_proto::streaming::Body<SmtpReply, std::io::Error>>`
   = note: required for the cast to the object type `futures::Future<Error=std::io::Error, Item=tokio_proto::streaming::Message<SmtpReply, tokio_proto::streaming::Body<SmtpReply, std::io::Error>>>`

A: The future returned by call ends when the Response is returned; you cannot "drive" further actions in that future.
This means you need to spawn a new task generating the (streamed) body; you'll need a Handle from tokio_core for that.
Also the Body needs to be created from a mpsc channel, not a oneshot; you could send many body chunks.
Playground
#[macro_use]
extern crate log;
extern crate bytes;
extern crate tokio_core;
extern crate tokio_proto;
extern crate tokio_service;
extern crate futures;

use std::io;
use bytes::Bytes;
use tokio_service::Service;
use tokio_proto::streaming::{Message, Body};
use futures::{future, Future, Stream, Sink};
use futures::sync::mpsc;
//use model::request::SmtpCommand;
//use model::response::SmtpReply;

#[derive(Eq, PartialEq, Debug)]
pub enum SmtpCommand {
    Data,
}
#[derive(Eq, PartialEq, Debug)]
pub enum SmtpReply {
    OkInfo,
    StartMailInputChallenge,
    TransactionFailure,
    CommandNotImplementedFailure
}

pub struct SmtpService {
    handle: tokio_core::reactor::Handle,
}

impl Service for SmtpService {
    // For non-streaming protocols, service errors are always io::Error
    type Error = io::Error;
    // These types must match the corresponding protocol types:
    type Request = Message<SmtpCommand, Body<Bytes, Self::Error>>;
    type Response = Message<SmtpReply, Body<SmtpReply, Self::Error>>;

    // The future for computing the response; box it for simplicity.
    type Future = Box<Future<Item = Self::Response, Error = Self::Error>>;

    // Produce a future for computing a response from a request.
    fn call(&self, command: Self::Request) -> Self::Future {

        info!("Received {:?}", command);

        match command {
            Message::WithBody(cmd, cmd_body) => {
                match cmd {
                    SmtpCommand::Data => {
                        // start => SmtpReply::StartMailInputChallenge
                        // ok => SmtpReply::OkInfo
                        // err => SmtpReply::TransactionFailure

                        let (tx, rx) = mpsc::channel::<io::Result<SmtpReply>>(1);

                        let fut = cmd_body
                            // read cmd stream; for_each results in a Future,
                            // which completes when the stream is finished
                            .for_each(|chunk| {
                                info!("data: {:?}", chunk);
                                Ok(())
                            })
                            // now send the result body
                            .then(move |r| match r {
                                Ok(_) => tx.send(Ok(SmtpReply::OkInfo)),
                                Err(_) => tx.send(Ok(SmtpReply::TransactionFailure)),
                            })
                            // could send further body messages:
                            // .and_then(|tx| tx.send(...))
                            // ignore any send errors; spawn needs a future with
                            // Item=() and Error=().
                            .then(|_| Ok(()))
                        ;

                        self.handle.spawn(fut);

                        let body : Body<SmtpReply, Self::Error> = Body::from(rx);
                        let msg : Self::Response = Message::WithBody(SmtpReply::StartMailInputChallenge, body);

                        Box::new(future::ok(msg)) as Self::Future
                    }
                    _ => Box::new(future::ok(Message::WithoutBody(
                        SmtpReply::CommandNotImplementedFailure,
                    ))),
                }
            }
            Message::WithoutBody(cmd) => {
                Box::new(future::ok(Message::WithoutBody(match cmd {
                    _ => SmtpReply::CommandNotImplementedFailure,
                })))
            }
        }
    }
}

fn main() {
    println!("Hello, world!");
}


text:
Q: jQuery / Javascript > onClick place text at last known cursor position I have a form I'm working with that allows the user to continually add new rows as needed (used for making an article with multiple "howto" steps, they can click over and over again to add a new step).  What I would like to be able to do is have the user be able to click in any of those rows at any time and then click on a word or button that is off to the side that will then insert the value of that button into the last known cursor position.
So for example I may have one form that currently has 3 rows.  If the user goes back and wants to insert some data they could click back in the box and hit the button corresponding to the data they want to insert.
Example input 1: "Remove the customers current IP address and replace with their static IP, [USER COULD CLICK HERE AND THEN CLICK THE STATIC IP BUTTON AND %STATIC_IP% WOULD BE INSERTED AT THE LAST KNOWN CURSOR POSITION (AKA HERE)]
Example input 2: "Enter in the customers [Click to insert %WIFI_SSID%] into the router settings"
I have found several other stackoverflow articles that are able to all insert text but they all expect it to be into a defined textarea or input.  In this case I'm needing it to insert into the last known cursor position.  I hope this is all clear.  I look forward to any assistance or questions.
Starter code: http://jsfiddle.net/4mJwU/

A: If you already know how to insert some arbitrary content at the last known caret position, your only problem is to know which field was focues last time before button was clicked.
That can be done in numerous number of ways, one of those would be utilize focus and blur events (attached to fields - rows in your case) to track (in some variable for example) reference to the field last focused. It should be a piece of cake from there.
Quick and simple script that can get you started http://jsfiddle.net/sjqWu/1/
Combine what you've learned from other stackoverflow anwsers with example above and you should be ok. Happy learning!

A: I'd question your design. To make the user have to click a field then click some text to insert into that field seems like too many steps. You could possibly utilize some sort of drag and drop routine. Or instead of the first click being a text box, maybe make it a drop down list?
I agree with WTK. You can store the record id or text box id using some sort of event, then proceed from there.


text:
Q: ¿Como podría simplificar(acortar) estas funciones? Me gustaría poder simplicar las funciones de addEventListener y removeEvenListener tal como lo hace jquery.
Me gustaría logralode esta forma.
   // addEventListener
  $element.on('click', function(){});
  // removeEventListener
  $element.off('click', function(){});

Como lo logro sin necesidad de usar jquery.

A:
Lo que me gustaría lograr es, acortar esas funciones para no tener que agregar la función completa osea el.addEventListener y solo agregar el.on('ready')

Te dejo un ejemplo bien simple. Pero, tener un "alias" para los metodos, nomas para "acortar" las funciones, puede "simplificar" tu programa/tu escritura, pero tendra el nocivo efecto de ser contra-intuitivo para cualquiera que agarre el codigo, cuando tu lo dejes.
Salu2

// myJQuery
$ = function(selector) {
  var elem = document.querySelector(selector);
  elem.on = elem.addEventListener;
  elem.off = elem.removeEventListener;

  return elem;
}

var element = $('div');

element.on('click', function manejador() {
  console.log('clickeado');
  element.innerHTML = "no va mas";
  element.off('click', manejador);
})

click aqui

Por los comentarios de @MarcosGallardo, hice esta version que usa querySelectorAll y aunque mas complicada funciona tanto con un elemento como con varios aunque tiene sus limitaciones.

// myJQuery
$ = function(selector) {
  // Obtener un NodeList con los elementos
  var nl = document.querySelectorAll(selector),
  // Convertir como Array
      na = [].slice.apply(nl);

  // si no encuentra hay nada
  if (na.length == 0) {
    return undefined;
  }

  // si encuentra un solo elemento
  if (na.length == 1) {
    na[0].on = na[0].addEventListener;
    na[0].off = na[0].removeEventListener;

    return na[0];
  }

  // si encuentra varios
  var alias = { on: 'addEventListener', off: 'removeEventListener' };

  na.forEach(function(e) {
    Object.keys(alias).forEach(function(key, ix) {
      e[key] = e[alias[key]]
    })
  });

  Object.keys(alias).forEach(function(key, ix) {
    na[key] = function(...args) {
      na.forEach(function(e) {
        e[key](...args)
      });
    }
  });

  return na;
}

// slector de elementos
var list = $('div');

list.on('click', function manejador(e) {
  console.log('clickeado');
  e.target.innerHTML = "no va mas";
  e.target.off('click', manejador);
})

// selector de clases (aqui toma uno)
$('.otro').style.color = "red";

// selector de ID
$('#theone').style.background = "green";
$('#theone').style.color = "white";

// selectores multiples
$('.otro, #theone').forEach(function(e) {
  e.on('click', function(e) {
    e.target.style.color = "black";
    e.target.style.background = "initial";
  });
})

click aqui

quiza click aca

A:
Lo que me gustaría lograr es, acortar esas funciones para no tener que agregar la función completa osea el.addEventListener y solo agregar el.on('ready')

Una forma sencilla de es extendiendo el Element.prototype. Por ejemplo:
// No funciona en IE7-
if (!Element.prototype.on) {
  Element.prototype.on = Element.prototype.addEventListener;
}
if (!Element.prototype.off) {
  Element.prototype.off = Element.prototype.addEventListener;
}

Existen opiniones divididas sobre extender las APIs nativas, ya que si en un futuro los navegadores implementan funcionalidad sobre on y off, es probable que tu código deje de funcionar como esperabas.


text:
Q: How to login with an administrator account using OpenSSH on Windows 7? I have just installed Cygwin and Openssh on my win7 box. After setting up the openssh, I can log in with my account (of course admin). But, I found my account under Ssh shell is filtered as a standard user.
I know this is because UAC, but I wanna my account under ssh shell is real admin.
update: here is a way to do this, quoted from kb951016:

*

*Click Start, click Run, type regedit, and then press ENTER.

*Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

*If the LocalAccountTokenFilterPolicy registry entry does not exist, follow these steps:

*

*On the Edit menu, point to New, and then click DWORD Value.

*Type LocalAccountTokenFilterPolicy, and then press ENTER.

*Right-click LocalAccountTokenFilterPolicy, and then click Modify.
In the Value data box, type 1, and then click OK.
Exit Registry Editor.

Note: This change has a impact on system security, use it at your own risk

A: disable UAC as long as you want to ssh in it:
Control Panel -> search User Account Control.


text: Q: How can an error exist in a pipeline build but not an IDE build? I have a git pipeline running a build for a set of projects. One of these projects is having an issue with a reference to one form within another. The way the two forms works is the first is a list of commands and the second is an edit form for those commands. The edit form is showing "Error BC30002: Type 'frmEdit' is not defined". This error does not show up in compile of the project, only the pipeline; I have no idea how to fix an error that doesn't exist.


text:
Q: Python Tensorflow:UnimplementedError: Cast string to int32 is not supported everyone.
I am new to Tensorflow
When I wrote the code like this in this part :
def get_batch(image,label,new_height,new_width,batch_size,capacity):
image=tf.cast(image,tf.string)
label=tf.cast(image,tf.int32)

input_queue= tf.train.slice_input_producer([image,label])
label=input_queue[1]
image_contents=tf.read_file(input_queue[0])
image=tf.image.decode_jpeg(image_contents,channels=3)

image=tf.image.resize_images(image,(new_height,new_width))
image=tf.image.per_image_standardization(image)
image_batch,label_batch=tf.train.batch([image,label],batch_size=batch_size,capacity=capacity,num_threads=8)

label_batch=tf.reshape(label_batch,[batch_size])
return image_batch,label_batch

Btw. the Args: images ,labels are returned from another function, which read the files that store images and labels.And I define the new_height and new_width as constant when I run this code
 I met the error like this:

UnimplementedError (see above for traceback): Cast string to int32 is not supported
         [[Node: Cast_1 = Cast[DstT=DT_INT32, SrcT=DT_STRING, _device="/job:localhost/replica:0/task:0/cpu:0"](Cast/x)]]

Traceback (most recent call last):

  File "<ipython-input-1-5c65685872d1>", line 1, in <module>
    runfile('C:/Users/yanghang/ugthesis/mean subtraction.py', wdir='C:/Users/yanghang/ugthesis')

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 710, in runfile
    execfile(filename, namespace)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 101, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/yanghang/ugthesis/mean subtraction.py", line 102, in <module>
    coord.join(threads)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\training\coordinator.py", line 389, in join
    six.reraise(*self._exc_info_to_raise)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\six.py", line 686, in reraise
    raise value

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\training\queue_runner_impl.py", line 234, in _run
    sess.run(enqueue_op)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 778, in run
    run_metadata_ptr)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 982, in _run
    feed_dict_string, options, run_metadata)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1032, in _do_run
    target_list, options, run_metadata)

  File "C:\Users\yanghang\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1052, in _do_call
    raise type(e)(node_def, op, message)`

Could u tell me how to solve this problem?
   Thanks in advance

A: As pointed out by @mrry, there was a typo in the code:
label=tf.cast(image,tf.int32)

Which should instead be:
label=tf.cast(label,tf.int32)


text:
Q: ArcGIS ClassBreaksRenderer with local JSON I've been trying to color polygons based on attributes using the ClassBreaksRenderer in the ArcGIS JS API.  My data source is a local json file, which I suspect is the reason that it's not working.  I've based my testing on the example provided in the documentation:
https://developers.arcgis.com/javascript/3/jssamples/renderer_class_breaks.html
Where I can replace the FeatureLayer pointer as follows:
original:
var featureLayer = new FeatureLayer("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3", ...

Replaced:
var featureLayer = new FeatureLayer("./data/check.json", ...

The geojson layer renders and all of the attributes are visible in the pop-out when the polygons are clicked, but I can't seem to apply any color to the file, it just renders in a default shade of semi-transparent green. In fact, the only way that I can get the color of the json layer to change at all is if I require the simple renderer: esri/renderers/SimpleRenderer
then configure as follows, still following the ClassBreaksRenderer example otherwise:
var simpleJson = {
 "type": "simple",
 "label": "",
 "description": "",
 "symbol": {
     "color": [255,0,50,200],
     "style": "esriSFSSolid",
     "type": "esriSFS"
    }
}

featureLayer.renderer = new SimpleRenderer(simpleJson);

I'm wondering whether the API doesn't support a local json file, in which case I will consider switching to Leaflet for this project.
Thanks for looking.

A: You're right, you can't instantiate a FeatureLayer with an uri to a file in your local file system, it should be a valid REST Service in any of the valid formats (ArcGIS REST, WMS, etc).
What you can do in your scenario is to use a FeatureCollection to build your FeatureLayer and move on.
Take a look at this example: https://developers.arcgis.com/javascript/3/jssamples/fl_featureCollection.html
Let me know if it helps.


text:
Q: jQtouch.. nothing is getting displayed on the screen I'm very new to jQtouch. I'm following this tutorial. But because of this updated version of jQtouch I'm not being able to follow it exactly. I'm using eclipse to develop an app on android. Now, this is the code I'm trying to run

UPDATE
Get rid of the new .
Follow the example you're making up stuff of your own.
If you insist on using constructor that is the proper way:
var jQT = new jQTouch({

   option: value

});


text:
Q: UM Analysis Qual September 2013 I am trying to study for quals and I encountered this question from UM September 2013.
Let $\space f_1, f_2,..., f: [0,1] \rightarrow \mathbb{R}$ be non-decreasing right-continuous functions such that $\sum_{n=1}^{\infty} f_n =f$.  Prove that $\sum_{n=1}^{\infty} f'_n =f'$.
I want to think of the right continuous functions as induced Lebesgue-Stieltjes measure and apply Lebesgue-Radon-Nikodym Theorem.  I am not sure how the usual function derivative will play a role with the Radon-Nikodym derivative.

A: Key steps, with some results being merely alluded to that may require more work to show rigorously:

*

*First, extend the functions so that $f_j(x)=f_j(0)$ for all $x<0$ and $f_j(x)=f_j(1)$ for all $x>1$. Let $\mu_{j}$ be the Borel measure for which $\mu_{j}((-\infty,x])=f_j(x)-f_j(0)$ for all $x$. It can be shown that such a Borel measure exists and is unique. From now on, assume wlog that $f_j(0)=0$.

*Consider the Lebesgue-Radon-Nikodym representation of $\mu_j$: $$\mu_j(E)=\lambda_j(E)+\int_{E}g_j\,\mathrm{d}m$$ for any Borel set $E$, where $m$ is the Lebesgue measure and $\lambda_j\perp m$ and $g_j\in L^1(m)$. (Note that $\mu_j$ is a finite nonnegative measure.)

*Let $\mu\equiv \sum_j\mu_j$, $\lambda\equiv\sum_j\lambda_j$ (these are legit measures), and $g\equiv\sum_j g_j$. Show that $\lambda\perp m$ and $g\in L^1(m)$. Hence, $$\mu(E)=\lambda(E)+\int_E g\,\mathrm{d} m$$ is the unique LRN representation of $\mu$.

*On the other hand, $f(x)=\sum_j f_j(x)=\sum_j\mu_j((-\infty,x])=\mu((-\infty,x])$. Since $\mu$ is a finite measure, it can be shown that $$\lim_{r\to0}\frac{\mu((x,x+r])}{m((x,x+r])}=\lim_{r\to0}\frac{f(x+r)-f(x)}{r}=g(x)$$ for $m$-a.e. $x$, and similarly for the limit from the left. Hence, $f$ is differentiable a.e. and $f'=g$ a.e.

*Repeating the same procedure for each $j$, $f_j$ is differentiable a.e. and $f_j'=g_j$ a.e.

*Conclusion: since the set of points where one or more of the results above does not hold (i.e., points outside any of the a.e. sets) is a countable union of null sets and hence a null set itself, $f'=g=\sum_{j}g_j=\sum_j f_j'$ a.e. (Note: the a.e. stipulation cannot be weakened if $f$ is merely right-continuous or is continuous but not differentiable everywhere.)
This proof is basically exercise 3.39 in Folland (1999), and every result needed for it can be found in chapter 3 and theorem 1.16 in this book. See also here.


text:
Q: Switch statement based on the two columns with multiple conditions in Power Bi I have a two columns are A and B, Both columns are contains text and sometimes text and numbers.
I would like to generate new calculate column by using DAX based on the column A and B with below mentioned rules.
If column A equal to DNK and B equal to Apple then result is ok
If column A equal to DNK and B not equal to Apple then result is not ok
If column A equal to DNK and B is NA then result is XX.
DNK expecting three different results based on the columns A&B with multiple scenarios and the same thing for ADNK and BJB.
If column A equal to ADNK and B equal to Orange then result is ok
If column A equal to ADNK and B not equal to Orange then result is not ok
If column A equal to ADNK and B is NA then result is XX.
If column A equal to BJB and B equal to Apple1 then result is ok
If column A equal to BJB and B not equal to Apple1 then result is not ok
If column A equal to BJB and B is NA then result is XX.

A   B   RESULT
DNK APPLE   OK
DNK APPLE   OK
DNK ORANGE  NOT OK
DNK ORANGE  NOT OK
DNK APPLE   OK
DNK APPLE   OK
DNK NA  XX
DNK NA  XX
ADNK    ORANGE  OK
ADNK    ORANGE  OK
ADNK    ORANGE  OK
ADNK    ORANGE  OK
ADNK    NA  XX
ADNK    APPLE   NOT OK
ADNK    APPLE   NOT OK
BJB APPLE1  OK
BJB ORANGE1 NOT OK
BJB APPLE1  OK
BJB ORANGE1 NOT OK
BJB APPLE1  OK
BJB APPLE1  OK
BJB NA  XX
BJB NA  XX
BJB ORANGE1 NOT OK
BJB APPLE1  OK

A: Based on what you asked, you can achieve it in two ways
a. by optimizing SWITCH like following
desiredColumn1 =
SWITCH (
    TRUE (),
    [A] <> BLANK ()
        && [B] = "NA", "XX",
    [A]="DNK"&&[B]="Apple"||[A]="ADNK"&&[B]="Orange"||[A]="BJB"&&[B]="Apple1","ok",
    "not ok"
)

b. by building a whiteList Table and iterating that in the fact
desiredColumn2 =
VAR _whiteList =
    DATATABLE (
        "a1", STRING,
        "b1", STRING,
        "c1", STRING,
        {
            { "DNK", "Apple", "ok" },
            { "DNK", "NA", "XX" },
            { "ADNK", "Orange", "ok" },
            { "ADNK", "NA", "XX" },
            { "BJB", "Apple1", "ok" },
            { "BJB", "NA", "XX" }
        }
    )
VAR _fromList =
    MAXX (
        FILTER (
            _whiteList,
            [a1] = EARLIER ( 'Table'[A] )
                && [b1] = EARLIER ( 'Table'[B] )
        ),
        [c1]
    )
RETURN
    IF ( _fromList = BLANK (), "not ok", _fromList )