text:
Q: Generating ECDH keys in the browser through WebCryptoAPI instead of the browserified node crypto module I have a very tiny node script to create a public/private key
Is there any way to do it on the client side without having to browserify hole crypto module?
var crypto    = require('crypto');

var userCurve = crypto.createECDH('prime256v1');
var userPublicKey = userCurve.generateKeys()
var userPrivateKey = userCurve.getPrivateKey();

I have tried this so far:
// https://github.com/diafygi/webcrypto-examples#ecdh---generatekey
window.crypto.subtle.generateKey(
    {
        name: "ECDH",
        namedCurve: "P-256", //can be "P-256", "P-384", or "P-521"
    },
    true, //whether the key is extractable (i.e. can be used in exportKey)
    ["deriveKey", "deriveBits"] //can be any combination of "deriveKey" and "deriveBits"
)
.then(function(key){
    //returns a keypair object
    console.log(key);
    console.log(key.publicKey);
    console.log(key.privateKey);
})
.catch(function(err){
    console.error(err);
});

But it looks nothing like the node version when i log it

A: Let's do a complete elliptic curve Diffie-Hellman (ECDH) exchange to establish a shared secret between two parties. Alice uses Node.js and Bob sits at his browser (a recent version of Chrome or Firefox). (No need to browserify anything.)
(1) Alice generates a private and public key.
const crypto = require('crypto');

const alice = crypto.createECDH('prime256v1');
alice.generateKeys()

const alicePublicKey = alice.getPublicKey('hex')
const alicePrivateKey = alice.getPrivateKey('hex')

console.log(`publicKey: ${alicePublicKey}`)
console.log(`privateKey: ${alicePrivateKey}`)

Example output:
publicKey: 043a3770a8068738ded16c9409e1a6fbf6dde2360ac5b3fd3e5bb8d9fd6adaed6ea83ff5153f58ae13098e86da89df1beb14ef46388d3df76e8fe2ee0ff9e926d5
privateKey: 03ce9cb317c8761699f174943dc9b2d2b7991515b48216a4c677fcf5ee879f2c

(2) Alice sends her public key to Bob (043a3770...). Bob has written some helpers to convert hex strings to Uint8Arrays and buffers to hex strings.
const hex2Arr = str => {
    if (!str) {
        return new Uint8Array()
    }
    const arr = []
    for (let i = 0, len = str.length; i < len; i+=2) {
        arr.push(parseInt(str.substr(i, 2), 16))
    }
    return new Uint8Array(arr)
}

const buf2Hex = buf => {
    return Array.from(new Uint8Array(buf))
        .map(x => ('00' + x.toString(16)).slice(-2))
        .join('')
}

(3) Bob receives Alices's key and computes the shared secret

*

*He generates his own private and public key

*He exports his public key and sends it to Alice

*He imports Alice's public key

*He computes the shared secret using his private and Alice's public key
// Alice's public key (received over an [insecure] connection)
const alicePublicKeyHex = '043a3770a8068738ded16c9409e1a6fbf6dde2360ac5b3fd3e5bb8d9fd6adaed6ea83ff5153f58ae13098e86da89df1beb14ef46388d3df76e8fe2ee0ff9e926d5'
const alicePublicKey = hex2Arr(alicePublicKeyHex)
console.log(`Alice's publicKey: ${alicePublicKeyHex}`)

let bob = null

// generate Bob's private and public key
window.crypto.subtle.generateKey(
    {
        name: 'ECDH',
        namedCurve: 'P-256'
    },
    false, // no need to make Bob's private key exportable
    ['deriveKey', 'deriveBits'])
    .then(bobKey => {
        bob = bobKey
        // export Bob's public key
        return window.crypto.subtle.exportKey(
            'raw', bobKey.publicKey
        )
    })
    .then(bobPublicKeyExported => {
        const bobPublicKeyHex = buf2Hex(bobPublicKeyExported)
        // display and send Bob's public key to Alice
        console.log(`Bob's publicKey: ${bobPublicKeyHex}`)

        // import Alice's public key
        return window.crypto.subtle.importKey(
            'raw',
            alicePublicKey,
            {
                name: 'ECDH',
                namedCurve: 'P-256'
            },
            true,
            [])
    })
    .then(aliceKeyImported => {
        // use Alice's imported public key and
        // Bob's private key to compute the shared secret
        return window.crypto.subtle.deriveBits(
            {
                name: 'ECDH',
                namedCurve: 'P-256',
                public: aliceKeyImported
            },
            bob.privateKey,
            256)
    })
    .then(sharedSecret => {
        const sharedSecretHex = buf2Hex(sharedSecret)
        console.log(`sharedSecret: ${sharedSecretHex}`)
    })
    .catch(err => {
        console.log(err)
    })

Example output:
Alice's publicKey: 043a3770a8068738ded16c9409e1a6fbf6dde2360ac5b3fd3e5bb8d9fd6adaed6ea83ff5153f58ae13098e86da89df1beb14ef46388d3df76e8fe2ee0ff9e926d5
Bob's publicKey: 04aeceba6ae783c9b705833c2fa8822281f47f6f36bc867e4d398fa7a744d4fc63a010cbce1e6c9ac8858ad376a24ee8551615560f01c8bb63c86335c046b18962
sharedSecret: c26c9f370f001a947d7fec4dc9282d3e9ea718e1de487eb4f6fa7d6f0a311b97

(4) Alice receives Bob's public key (04aece...). She computes the shared secret as well.
const crypto = require('crypto')
const alice = crypto.createECDH('prime256v1')

// Alice's privateKey (generated previously)
const alicePrivateKey = '937cdd11062b612ff3cb3e4a3c183254b9728b4c8c3a64de799ed196b672734b'

// Bob's publicKey transmitted to Alice
const bobPublicKey = '04aeceba6ae783c9b705833c2fa8822281f47f6f36bc867e4d398fa7a744d4fc63a010cbce1e6c9ac8858ad376a24ee8551615560f01c8bb63c86335c046b18962'

// set Alice's private key (not needed if continuing from (1))
alice.setPrivateKey(alicePrivateKey, 'hex')

const sharedSecret = alice.computeSecret(bobPublicKey, 'hex', 'hex')
console.log(`sharedSecret: ${sharedSecret}`)

Examle output:
sharedSecret: c26c9f370f001a947d7fec4dc9282d3e9ea718e1de487eb4f6fa7d6f0a311b97

The secret is shared (the same).
(5) The shared secret is typically used to derive a symmetric key for encrypting messages between Alice and Bob (and they communicated happily ever after).
Remarks:

*

*Usually there is no need to display or export the private key. Alice would typically continue the computation of the shared secret from step (1) (and omit alice.setPrivateKey(alicePrivateKey, 'hex')).

*As the shared secret is most often used to derive a symmetric key, there is window.crypto.subtle.deriveKey and deriveBits can be ommitted. deriveBits was used here to illustrate that Alice and Bob indeed agreed on a shared secret.


text:
Q: Issue with IIS Permissions with Enable32BitAppOnWin64 I am running a 64 bit computer. My application pool is configured to use NETWORK SERVICE. My application runs fine when it runs in 64 bit mode.
When running in 32 bit mode (Flag Enable32BitAppOnWin64 on the application pool), I frequently get permission errors with IIS unable to access it's on temporary folder. If I change the tempDirectory in the web.config, the issue is resolved temporarily. It frequently returns later on, after I make another change to my application.
Example when tempDirectory="c:\temp\iistemp4"
Access to the path 'c:\temp\iistemp4\tbmpos\a93ceaf9\c953db72\ResX\header.ascx.resources' is denied. ---> System.UnauthorizedAccessException: Access to the path 'c:\temp\iistemp4\tbmpos\a93ceaf9\c953db72\ResX\header.ascx.resources' is denied.
Obviously, NETWORK SERVICE has access to the folder, since it actually created it. Reverting back to 64-bit mode solves the issue.
Process Monitor shows:
12:40:47.7314293 PM w3wp.exe    6184    CreateFile  c:\temp\iistemp4\tbmpos\a93ceaf9\c953db72\ResX\header.ascx.resources    ACCESS DENIED   Desired Access: Generic Write, Read Attributes, Disposition: OpenIf, Options: Synchronous IO Non-Alert, Non-Directory File, Open No Recall, Attributes: n/a, ShareMode: None, AllocationSize: 0
This is the only access to it that I can see in Process Monitor.
However, if I open the folder using Windows Explorer, I get a few 'BUFFER OVERFLOW' on Information: Owner, DACL and Owner, Group, DACL. Did IIS create the file with improper permissions?
Any ideas?

A: Thanks to process monitor, I realized something had set odd permissions in my c:\temp\ and forced propagation to all children. This caused weirdnesses in odd contexts, such as this one.
I moved to another folder without any inherited permissions, cleaned up the permissions, gave network service full access, and it appears solved.

A: Did the failure does not occur because of resource sharing? Try watching with a tool like filemon.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Organization members not allowed to access private pages of the organization site With Liferay 6.1 CE, when an organization member attempt to access a private page of the organization site, he obtains the following error :

You do not have permission to view this page.

In the log file liferay.2012-06-06.log, we can read the following message :

13:54:42,149 INFO [PortalImpl:4890] User 524603 is not allowed to
  access the private pages of group 503050

For information, the Membership type of the organization is private.
If we add the Site administrator role to the member, then the access is allowed to the private pages of the organization site.
It seems that the error appears for public pages of an organization site too.

14:11:46,782 INFO [PortalImpl:4890] User 524603 is not allowed to
  access the public pages of group 503050

Both errors appear even after deletion of the organization site and new creation of it ?

A: Add the user to the Site as Site Member, and add the user to Organization as.


text:
Q: I need to pass a string from a NSObject class to a UIViewController with a delegate I need to pass a string from a NSObject class to a UIViewController, I understand that the best way is delegation but the delegate method isn't being called. I'm trying to set the UILabel an DieFacesViewController as the selectedOption from TemporarySelection.
A tableview shows the value of CustomOptionStore, once it's tapped passes its value to TemporarySelection and opens the modal view DieFacesViewCountroller which should, at least in my mind, take the label value from TemporarySelection. The reason I created TemporarySelection is because the DieFacesViewController will be used by other classes, not only by CustomOptionStore, and it will need to load the label from all those classes when different tableViews are selected.
I tried to set the delegate as self in both viewDidLoad and viewWillAppear with no luck, I don't understand if the view loads before being able to call the delegate method or if there's something wrong the way I set the method up.
I've been stuck here for two days, this is the first time I post a question so please forgive me if it's a bit confused.
my delegator class TemporarySelection.h is
#import <Foundation/Foundation.h>
#import "CustomOptionsStore.h"

@class DieFacesViewController;

@protocol TemporarySelectionDelegate <NSObject>

-(void)sendSelection;

@end

@interface TemporarySelection : NSObject

@property (nonatomic, weak) id <TemporarySelectionDelegate> delegate;

@property (nonatomic, strong) NSString *selectedOption;

-(void)addSelection: (CustomOptionsStore *) selection;

@end

and my TemporarySelection.m is
#import "TemporarySelection.h"

@implementation TemporarySelection

-(void)addSelection: (CustomOptionsStore *) selection{

    self.selectedOption = selection.description;

    [self.delegate sendSelection];

}

@end

the delegate class DiewFacesViewController.h is
#import <UIKit/UIKit.h>
#import "SelectedStore.h"
#import "TemporarySelection.h"

@interface DieFacesViewController : UIViewController <TemporarySelectionDelegate>

@property (strong, nonatomic) IBOutlet UILabel *SelectionName;

@end

and the DieFacesViewController.m is
#import "DieFacesViewController.h"

@interface DieFacesViewController ()

@end

@implementation DieFacesViewController

- (void)viewDidLoad {

    TemporarySelection *ts = [[TemporarySelection alloc]init];
    ts.delegate = self;

    [super viewDidLoad];

}

-(void)sendSelection{

    TemporarySelection *ts = [[TemporarySelection alloc]init];
    self.SelectionName.text = ts.selectedOption;

}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];

}

A: You are not setting the delegate object properly.Check the above code
 #import "DieFacesViewController.h"

@interface DieFacesViewController ()<TemporarySelectionDelegate>
{
//global object

TemporarySelection *ts;
}
@end

@implementation DieFacesViewController

- (void)viewDidLoad {

    ts = [[TemporarySelection alloc]init];
    ts.delegate = self;

    [super viewDidLoad];

}

-(void)sendSelection{

   //Use the object to extract
    self.SelectionName.text = ts.selectedOption;

}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:YES];

}


text:
Q: Login page reading details from SQLite database does not work
Possible Duplicate:
java.lang.NullPointerException when trying to access SQLite database

I cannot get my login screen to work.  The user should enter their login name and password which is then compared against a database containing previous registrations.  Can someone please tell me where I am going wrong and why the code is not working?
**Login.java**

    package com.B00512756.angertwo;

    import android.app.Activity;
    import android.content.ContentValues;
    import android.content.Context;
    import android.content.Intent;
    import android.database.Cursor;
    import android.database.sqlite.SQLiteDatabase;
    import android.database.sqlite.SQLiteDatabase.CursorFactory;
    import android.database.sqlite.SQLiteOpenHelper;
    import android.os.Bundle;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.EditText;

    public class Login extends Activity implements OnClickListener{
        public static final String DATABASE_NAME = "login_database.db";
        public static final String USER_INFO_TABLE = "user_information";
        public static final String COLUMN_ID = "UserID";
        public static final String COLUMN_RATING = "UserName";
        public static final String COLUMN_NAME = "Password";

        public EditText txtUserName;
        public EditText txtPassword;
        public static Button btnLogin;
        public static Button btnCancel;

            /** Called when the activity is first created. */
            @SuppressWarnings("unused")
            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.loginpage);

                txtUserName=(EditText)this.findViewById(R.id.txtUname);
                txtPassword=(EditText)this.findViewById(R.id.txtPwd);
                //btnLogin=(Button)this.findViewById(R.id.btnLogin);
                Button Login = (Button) findViewById(R.id.btnLogin);
                Button Register = (Button) findViewById(R.id.btnregister);
                Button Cancel = (Button) findViewById(R.id.btnCancel);

                Register.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {
                        Intent myIntent = new Intent(view.getContext(), Registration.class);
                        startActivityForResult(myIntent, 0);
                        finish();
                    }
                });

                Cancel.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View view) {
                        android.os.Process.killProcess(android.os.Process.myPid());
                    }
                });

                Login.setOnClickListener(new View.OnClickListener() {

                    @SuppressWarnings("null")
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub

                        String name = txtUserName.getText().toString();
                        String pwd = txtPassword.getText().toString();
                        SQLiteDatabase regDB = null;

                        //String[] columns = new String[]{COLUMN_ID, COLUMN_RATING, COLUMN_NAME };

                        try {
                        Cursor c = regDB.query(USER_INFO_TABLE, new String[] {
                                COLUMN_ID, COLUMN_RATING, COLUMN_NAME}, null, null, null, null, null);
                        if(null!=c){

                              c.moveToFirst();

                             System.out.println("Cursor Size"+c.getCount());

                            }

                        String result = "";

                        int iRow = c.getColumnIndex(COLUMN_ID);
                        int iRating = c.getColumnIndex(COLUMN_RATING);
                        int iName = c.getColumnIndex(COLUMN_NAME);

                        c.moveToLast();
                        for (int i = c.getCount() - 1; i >= 0; i--) {

                            // Get the data
                            result = result + c.getString(iRow) + " " + c.getString(iRating) + " " + c.getString(iName) + "\n" ;
                            if("select * from USER_INFO_TABLE where UserName =" + "\""+ name + "\""+" and Password="+ "\""+ pwd != null );
                            { Intent j = new Intent();
                            j.setClassName("com.B00512756.angertwo",
                                    "com.B00512756.angertwo.AngerprototypetwoActivity");

                            startActivity(j);}

                            // Move the cursor
                            c.moveToPrevious();
                        }
                        c.close();
                        }
                            catch (Exception e)
                            {

                            }

                        }

                    });

                }

            private SQLiteDatabase getWritableDatabase() {
                // TODO Auto-generated method stub
                return null;
            }

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub

            }
    }

**AndroidMainfest:**

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.B00512756.angertwo"
      android:versionCode="1"
      android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-sdk android:minSdkVersion="8" />

    <application android:name=".AppState" android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".Login"
                  android:label="@string/main_title">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name=".Login" android:label="@string/begin_label"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Question1" android:label="@string/question_one"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Question2" android:label="@string/question_two"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Question3" android:label="@string/question_three"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Question4" android:label="@string/question_four"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Question5" android:label="@string/question_five"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".AngerprototypetwoActivity" android:label="@string/main_title"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".nextQ1" android:id="@+id/next_Q1_button"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Strategies" android:label="@string/strategies_label"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Contact" android:label="@string/begin_label"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Strat_What_Is_Anger" android:label="@string/strategies_label_what_is_anger"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Strat_Use_Distraction" android:label="@string/strategies_label_distraction"
       android:theme="@android:style/Theme"></activity>
      <activity android:name=".Registration" android:label="@string/registration"
       android:theme="@android:style/Theme"></activity>

    </application>

</manifest>

A: You never open your database (and from the code it doesn't look like you even create it), so when you try to run a query it returns null.
I would suggest you learn more about databases, how to create and use them...
Tutorial
And learn a bit more about StackOverflow... it is not good manners to keep posting the same question over and over (and will get your questions closed pretty quickly).
StackOverflow FAQ


text:
Q: After install OS X El Capitan, Apache not working I just installed in my MacBook pro "El capitan" and I can't type any host set it in vhost. Everything was working perfectly before in Yosemite. When I type one of my virtualhost I get:

403 "Forbidden You don't have permission to access / on this server."

What did I try ?
go to /etc/apache2/httpd.conf
and uncoment this lines:
Include /private/etc/apache2/extra/httpd-vhosts.conf

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

/etc/apache2/extra/httpd-vhosts.conf is the same file that was working before in Yosemite since long time ago, so I haven't modified.
To install everything in Yosemite I used homebrew.
Another problem related with "El capitan", before I was able to type http://localhost/~myuser/ and I could access to any folder in /Users/myuser/Sites now I get this message: 404 not found.
I hope some help, I am not specialist in servers and it's really difficult to me to set it up, and is very annoying to waste a lot of time anytime there is a new upgrade in the OS.

A: I have merged to two versions (httpd.conf and http.conf~previous) and after that I discovered that the v-host wasn't working anymore.
After disabling rule 19 #NameVirtualHost *:80 in /private/etc/apache2/extra/httpd-vhosts.conf everything worked again!

A: The upgrade process keeps a copy of your old httpd.conf. Unless you were way out of date, just overwrite the new file with your old one. Keep a copy of the new just in case...
sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.after-update
sudo mv /etc/apache2/httpd.conf.pre-update /etc/apache2/httpd.conf
sudo apachectl restart

A: I had the same trouble.
Type this command line you will have the error from apache :
apachectl configtest

If you have this error :
AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration.

so this link can help : https://apple.stackexchange.com/questions/211015/el-capitan-apache-error-message-ah00526

A: LockFile is a directive of Apache ≤ 2.2. El Capitan comes with Apache version 2.4. so, you need to disable LockFile
First, just to be sure apache is stopped:
sudo apachectl stop

Then edit your httpd-mpm.conf:
Comment this lines
#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
<IfModule !mpm_winnt_module>
<IfModule !mpm_netware_module>
  LockFile "/private/var/log/apache2/accept.lock"
</IfModule>
</IfModule>

Start apache sudo apachectl start and that's all

A: I experienced that after the upgrade to El Capitan the line
Include /private/etc/apache2/extra/httpd-userdir.conf

in
/private/etc/apache2/httpd.conf

was commented again. After uncommenting it and restarting apache, everything worked alright again.

A: As some have mentioned the problem is that the upgrade to El Capitan backed up your previous httpd.conf and renamed it httpd.conf~previous and gave you a new httpd.conf.  What you need to do though with these files to fix your problem is:
Use nano or other editor to open httpd.conf~previous and look for these 2 lines:
DocumentRoot "/Users/my-machine-name/Prev-Localhost-Path
<Directory "/Users/my-machine-name/Prev-Localhost_path">

Copy them and then using nano open httpd.conf and look for these 2 lines:
DocumentRoot "/Library/WebServer/Documents"
<Directory "/Library/WebServer/Documents">

Comment them out by entering the '#' character in front of each one, and then below them paste in the two lines you copied from your original file. Save the file and exit.
After that you'll need to reboot.  My setup would not work until I made these changes and then rebooted.  But perhaps the suggestion by DSG to restart apache will suffice:
sudo apachectl restart


text:
Q: SimpleXML parsing has strange effect on strings I want to get 13:00 and 13:50 using new SimpleXMLElement() on
<time>
    <start_time>01:00PM</start_time>
    <end_time>01:50</end_time>
</time>

I tried this:
$stime = $some_child_element->start_time;
$etime = $some_child_element->end_time;
if($stime[strlen($stime)-2] == 'P') {
    $stime = (substr($stime,0,2)+12) . substr($stime,2,3);
    $etime = (substr($etime,0,2)+12) . substr($etime,2,3);
}
else
    $stime = substr($stime,0,5);

echo $stime;

but it doesn't do anything. Then I tried to cast the time with (string)value and still nothing. echo and strlen work, but array-like access and substring don't work and it doesn't show anything, neither errors...
EDIT: The problem here is not only how do I make that a datetime, but on how I can access a smaller set of this string. Substring doesn't work, neither $time[0]
Check out this demo:
http://codepad.viper-7.com/vdmlVQ

A: You made this much more complicated then it needed to be. Just use PHP's built in date/time functionality to do the converting for you:
$time = $some_child_element->time;
echo date('H:i', strtotime($time));

Demo

A: the problem was when casting the element into string, the actual string started from position 1. very strange... See the demo below
Demo


text:
Q: Difference between "I will call you" and "I give you a call"? What is the difference between I will call you and I give you a call?

A: First of all, you can't say "I give you a call". I gather you meant "I will give you a call".
As far as phone calls are concerned, there is little, if any, difference in meaning or register. However, the first sentence:

I will call you.

is much more generic and, without proper context, may have meanings other than phone calls. For example, when you read

Go to your room. I'll call you when dinner is ready.

You don't imagine any phones involved, whereas

Go to your room. I'll give you a call when the dinner is ready

implies a strange situation when you make a phone call to someone in the same house.


text:
Q: error launching the android app I just started learning android via the udacity 'android development for beginners' course and they asked us to make an a coffee ordering app.I pasted the MainActivity code given and clicked on run.the app got installed on my phone but doesn't launch.
Error Screenshot

A: You don't have MainActivity.java file in your project. Please insert Activity name correctly instead red text in your manifest.

A: MEntion pacakge name before class name like this...
com.example.abhishek.justjava.MainActivity
and also make sure you activity is present in the right destination with same name....
and plz cross check the package name if you have kept abhishek in package name or not....
also include
<uses-sdk android:minSdkVersion="7" />


text:
Q: Uniqueness of nonterminating decimal expansion... Prove that decimal representation is unique iff the number has no terminating expansion. Prove also that any terminating expansion also has a nonterminating expansion. How are these nonterminating expansions constructed?

A: Hint:  the important idea is that $1=0.9999\ldots $  This will let you solve the second and third.  The first depends on what you have to work with, but the idea is that aside from this any two expansions are a ways apart.


text:
Q: How to understand this in perl my @skipper = qw(blue_shirt hat jacket preserver sunscreen);
my @skipper_with_name = ('The Skipper' => \@skipper);

How to understand the second line?
print @skipper_with_name;

got the following msg:
The SkipperARRAY(0x209cf90)

A: The backslash in front of @skipper gets the reference to the array.
You can see the actual structure if you:
use Data::Dumper;
print Dumper \@skipper_with_name;

Perhaps you wanted a hash instead for the second array, which means that The Skipper can be used as a key for accessing @skipper:
my %skipper_with_name = ('The Skipper' => \@skipper);
print Dumper \%skipper_with_name;
my @skipper_copy = @{$skipper_with_name{'The Skipper'}};

Note how I've used @{...} to dereference the array reference.

A: As Stevenl mentions, Data::Dumper only prints out the structure of array or hash, if you pass a reference into it, not the structure itself. Otherwise it prints what the structure is (ARRAY) and its memory address.
Also, if you are expecting @skipper_with_name to be a HASH and not an ARRAY, I will point out that @ is only used for arrays, % is the symbol for a HASH (so it would be %skipper_with_name). Also, although => is most commonly used in hashes to show the key/value relationship, it is essentially just a comma, so can be used without error to create an array.
my @skipper_with_name = ('The Skipper' => \@skipper);

is the same as:
my @skipper_with_name = ('The Skipper',  \@skipper);

you can see here:
 $skipper_with_name[0] = 'The Skipper'
 $skipper_with_name[1] = \@skipper

A: It's a new Array which has a reference (the slash in front of the array \) to your initial array stored in it. If you print it, you only get the memory address, you need to dereference it first by again prepending the @ symbol to get the content of the hash.
However this makes no real sense, Arrays can only have numeric indixes. What you probably want to do is to use a hash.
my %skipper_with_name = ('The Skipper' => \@skipper);

now you can reference to the array via the 'The Skipper' identifier.
print Dumper $skipper_with_name{'The Skipper'};
#or
print @{ $skipper_with_name{'The Skipper'} };


text:
Q: Merge data based on column match I have a record as follows (Input) .There are 8 fields and each fields are separated by tab space.From the above records I need to generate a new file as follows based on 1,2,4,5 column match.
Input file:
-10 68120047    .   X   Y   .   Pass    A=0.0257732
-10 68120047    .   X   Y   .   Pass    B=0.0263158
-10 68120047    .   X   Y   .   Pass    C=0.0280899

output
-10 68120047    .   X   Y   .   Pass    A=0.0257732;B=0.0263158;C=0.0280899

A: your example 1,2,4,5 don't match!. you have y and Y
try this one-liner with $1 and $2 as key. you could add to $1 $2 $4 $5 too.
awk '{r=$NF;k=$1$2;a[k]=a[k]?a[k]";"r:$0}END{for(x in a)print a[x]}' file

with your content in file:
kent$  awk '{r=$NF;k=$1$2;a[k]=a[k]?a[k]";"r:$0}END{for(x in a)print a[x]}' file
-10  68120047    .   X   Y   .   Pass    A=0.0257732;B=0.0263158;C=0.0280899


text:
Q: Google Sheets Ap-script Indexof I am trying to use IndexOf and it keeps returning -1 (no match) when the value is in the array.  I am new to this so I am not sure why it won't work.  my end goal is to return the row number of the first instance of the matching data.
var lookup_array = sales_sheet.getRange(1,1,3,1).getValues();
var index = lookup_array.indexOf(newsheet_name);

lookup_array = [[account_manager], [john doe], [john doe]]
newsheet_name = john doe
index = -1
I would expect value to = 1 since john doe is the 2nd value in the array.

A: Values retrieved by getValues() is 2 dimensional array. So in order to use indexOf(), please modify as follows. Please think of this as just one of several answers.
In this modification, 2 dimensional array is converted to 1 dimensional array by map(), and indexOf() is used.
Modified script:
var newsheet_name = "john doe";
var lookup_array = sales_sheet.getRange(1,1,3,1).getValues(); // [["account_manager"], ["john doe"], ["john doe"]]
var res = lookup_array.map(function(e) {return e[0]}).indexOf(newsheet_name);
Logger.log(res) // 1

References:

*

*getValues()

*indexOf()

*map()


text:
Q: Use of undefined constant PHP 7.2 Since updating, I'm occasionally seeing this warning

Warning: Use of undefined constant SSL_CURRENT - assumed 'SSL_CURRENT'
  (this will throw an Error in a future version of PHP) in
  /usr/www/domain/phpmyd/listing.php on line 151

This is the line:
$pdf->Image($PMDR->get($PMDR->getConfig('map_type').'_Map')->getMapImageByCoords($listing['latitude'],$listing['longitude']),$pdf->GetX(),$pdf->GetY(),$pdf->pixelsToUnits(512),$pdf->pixelsToUnits(512),'','http'.(SSL_CURRENT ? 's' : '').'://maps.google.com/maps?q='.$listing['latitude'].','.$listing['longitude'],'N', false, 300);

Just looking at it, should it be like
$pdf->pixelsToUnits(512),'','http'.('SSL_CURRENT' ? 's' : '')

So just adding brackets around SSL_current? Was it always like this, because I never saw errors before.

A: I have looked at PHP's source and the constant SSL_CURRENT was never defined in any of the PHP version starting form version 4.
Therefore this issue is not related to the change of the PHP version.
For whatever reason you could not see warning about that constant before but it is for sure not PHP version update that made that constant undefined.
Since this string:
'SSL_CURRENT'

will always evaluate to true then this conditional expression:
'SSL_CURRENT' ? 's' : '';

is not conditional at all because it will always return "s":
echo 'SSL_CURRENT' ? 's' : '';

so it can be also written this way
echo 's';

so it equals using it in your code this way:
$pdf->pixelsToUnits(512),'','https'


text:
Q: SKStoreReviewController requestReview method takes time to display and app get stuck until ReviewController presented I am using StoreKit for in app rating. but whenever I call SKStoreReviewController requestReview method, the app get stuck and after a while the review View presented and then app get to normal state. Why this happened and if there is any solution for it?
I have another question, is write a review is necessary (i.e) i don't want to open app store for writing a review, i want that user just submit a review and remain in the app.

A: I just encountered this same issue. But (at least as far as I can tell) only in the debug version of my app. I have no way of fixing it. But it appears that the storekit is trying to connect to some Apple server, and sometimes that connection takes long.
And while the connection is trying to be established, the whole main queue is frozen. Nothing gets through.
I made some syslog. And at some point I see this happening:
Mar  4 18:17:37 RetepV StoreKitUIService(CFNetwork)[14436] <Notice>: Task <F9F9DB85-B649-43CC-A3D6-B8E931BF9ADA>.<27> resuming, QOS(0x19)
Mar  4 18:17:37 RetepV StoreKitUIService(CFNetwork)[14436] <Notice>: Task <F9F9DB85-B649-43CC-A3D6-B8E931BF9ADA>.<27> {strength 0, tls 4, ct 0, sub 0, sig 1, ciphers 0, bundle 1, builtin 0}
Mar  4 18:17:37 RetepV StoreKitUIService(CFNetwork)[14436] <Notice>: TIC Enabling TLS [29:0x280586a00]
Mar  4 18:17:37 RetepV StoreKitUIService(CFNetwork)[14436] <Notice>: TIC TCP Conn Start [29:0x280586a00]
Mar  4 18:17:37 RetepV StoreKitUIService(libnetwork.dylib)[14436] <Notice>: [C29 Hostname#68464834:443 tcp, url hash: 11d80191, tls] start
Mar  4 18:17:37 RetepV StoreKitUIService(libnetwork.dylib)[14436] <Notice>: nw_connection_report_state_with_handler_locked [C29] reporting state preparing
Mar  4 18:17:37 RetepV StoreKitUIService(CFNetwork)[14436] <Notice>: Task <F9F9DB85-B649-43CC-A3D6-B8E931BF9ADA>.<27> setting up Connection 29
.

Then a whole lot of stuff is happening that's not related to connection C29. And the first time I see C29 pop up again is 31 seconds later:
Mar  4 18:18:08 RetepV StoreKitUIService(libnetwork.dylib)[14436] <Notice>: nw_endpoint_flow_protocol_connected [C29.1 IPv4#9566630f:443 in_progress channel-flow (satisfied)] Transport protocol connected
.

And I had already observed that my app was frozen for about 30 seconds.
I don't see how I can fix this, it's an API call of exactly 1 line. This is something that only Apple must fix. An API function that can freeze the app for some unknown amount of time is not good.
Edit:
NOTE: My requestReview call is always made on the main thread.

A:
I call SKStoreReviewController requestReview method, the app get stuck
  and after a while the review View presented and then app get to normal
  state.

Place a breakpoint on the line where you call requestReview and make sure this is happening on your main thread.

I don't want to open app store for writing a review, i want that user
  just submit a review and remain in the app.

Per app store guidelines now, you absolutely most use this for reviews, so there is no alternative approach or customization available that you may use when submitting new & updated apps now.
You can see here under section 1.1.7.
I have additional information under this answer that may be of use as well for handling review requests.

A: I figured out that the app will get stuck when requestReview called with bad network.Before the review View presented,even the hitTest method will not get called.May be one solution is that do not call requestReview method in a bad network.

A: Yes, run into the same problem. It is bad network. It is not enough to check for WIFI connection, for instance, but one also needs to check whether the connection is fast and leading to the internet. My user base is sometimes using local WIFI generated by a device to share, e.g., its screen. But it does not mean it will get you to the internet. So, the solution is to A) check that WIFI is available, and B) use an as simple as possible test to see whether one can reach anything out there. I ended up seeing whether I can reach captive.apple.com. Had to set a tough limit on the timeout interval, and now it seems to be working okish.

A: It appears that Apple has fixed the issue on iOS 16. As I just received a reply from Apple: "This shouldn't be an issue in recent builds. Please verify and close this feedback, if the issue is resolved for you. Thanks!" for FB8936712.


text:
Q: Installing a certificate to the LocalMachine/Root store is not supported I have a couple of certificates that I need to add to the worker role which have to get installed in the Cloud service's Root Certification store upon deployment.
I added the following lines in the service definition of my worker role
Upon building the Worker Role project, I get the following error
Installing a certificate to the LocalMachine/Root store is not supported
Any thoughts on why this could be happening  ?
Certificate name="Internal Root" storeLocation="LocalMachine" storeName="Root"
Certificate name="SSL Corp CA" storeLocation="LocalMachine" storeName="Root" />

A: Microsoft by default does not allow direct import to the trusted root store. Even if you give the Storename as "CA" , the cert will be downloaded only to the intermediate cert store. You will have to write a startup task with elevated permissions to move the cert to root store. However, you need to do this only if your SSl cert is issued by a provider who is not included in the Microsoft root certificate program . If a provider is part of the root certificate program, the root certificate corresponding to your SSL certificate will automatically be downloaded to your Azure instance when you deploy it.
refer:  http://thetechnologychronicle.blogspot.in/2013/11/ssl-cert-considerations-in-windows-azure.html
The Workaround is discussed in the following thread from MSDN
https://social.msdn.microsoft.com/Forums/en-US/b5db1118-0185-4dc7-a6d7-d62ce4cc9e27/azure-cloud-service-install-certificate-in-trusted-root?forum=windowsazuredevelopment
and also a Code example for OnStart().
https://rupertmaier.wordpress.com/2014/09/12/deploying-a-certificate-into-the-trusted-root-store-in-windows-azure-cloud-services/
-Nithin


text:
Q: Remove the border of a table headerCell itext7 pdf I am creating a table using itext7.
I can change the color of a regular cell. How can I change the border to Null of a header cell?
I cannot add a check to create a "false" headerCell as the table may be a mutli-column so I would like the cells to be atop each column.
Having this false headerCell would just be on the first cell generated.
I tried:
            //does not work.
            table.setBorder(null);

            //---------------------------does not work.
            table.addHeaderCell("one: ").setBorder(Border.NO_BORDER);
            table.addHeaderCell("two: ").setBorder(null).addStyle(normal);
            table.addHeaderCell("three: ").setBorder(null).addStyle(normal);

Minimal:(just set your location)
    package application;
import java.io.IOException;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;

import com.itextpdf.io.font.FontConstants;
import com.itextpdf.kernel.color.Color;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.geom.Rectangle;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfDocumentInfo;
import com.itextpdf.kernel.pdf.PdfString;
import com.itextpdf.kernel.pdf.PdfViewerPreferences;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.ColumnDocumentRenderer;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.Style;
import com.itextpdf.layout.border.Border;
import com.itextpdf.layout.border.SolidBorder;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.element.Text;

import javafx.application.Application;
import javafx.stage.Stage;

public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        exportRes();
    }

    public static void main(String[] args) {
        launch(args);
    }

    public void exportRes() throws IOException{
        PdfWriter writer = new PdfWriter(--location--);
        PdfDocument pdf = new PdfDocument(writer);

        pdf.getCatalog().setLang(new PdfString("en-US"));
        pdf.getCatalog().setViewerPreferences(new PdfViewerPreferences().setDisplayDocTitle(true));

        PdfDocumentInfo info = pdf.getDocumentInfo();
        info.setTitle("List");

        Document document = new Document(pdf,PageSize.A4);

        PdfFont font = PdfFontFactory.createFont(FontConstants.HELVETICA);

        Style normal = new Style();
        normal.setFont(font).setFontSize((float) 7.5);

        Style notesF = new Style();
        notesF.setFont(font).setItalic().setFontSize((float) 7.5);

        Style lastNameF = new Style();
        lastNameF.setFont(font).setFontSize((float) 7.5).setBold();

        Table table = new Table(new float[]{(float) 2,29,10});
        table.setWidthPercent(100);
        table.setFont(font);

        //does not work.
        table.setBorder(null);

        //---------------------------does not work.
        table.addHeaderCell("one: ").setBorder(Border.NO_BORDER);
        table.addHeaderCell("two: ").setBorder(null).addStyle(normal);
        table.addHeaderCell("three: ").setBorder(null).addStyle(normal);

        Cell check = new Cell().add(new Paragraph(" ").addStyle(normal).setFixedLeading(0)).setBorder(new SolidBorder(Color.LIGHT_GRAY, (float) 0.5));
        table.addCell(check);

        Text lastName = new Text("Name ").setBold().addStyle(lastNameF);

        Text address = new Text("address").addStyle(normal);

        Cell name = new Cell().add(new Paragraph().add(lastName).add(address)).setBorder(new SolidBorder(Color.LIGHT_GRAY, (float) 0.5));
        table.addCell(name);

        Cell notes = new Cell().add("notes").addStyle(notesF).setBorder(new SolidBorder(Color.LIGHT_GRAY, (float) 0.5));
        table.addCell(notes);

        document.add(table);
        document.close();

    }

}

A: Your code is almost right. The problem is very simple and can be found in the next line:
table.addHeaderCell("one: ").setBorder(Border.NO_BORDER);

Notice that Table#addHeaderCell method returns Table not Cell object. So then you apply Border.NO_BORDER on Table.
The solution is:
table.addHeaderCell(new Cell().add("one: ").setBorder(Border.NO_BORDER));

Also if you want to set specific border on header/footer (the analog of Table border), write summat table.getHeader().setBorder(your border). Notice also that itext applys table border on header/footer too.
I also want to mention that invoking Table constructor as you do isn't 100% correct if you use itext 7.0.2+. If you want columns widths to be in a ratio 2 29 30 (or any else), call Table(UnitValue.createPercentArray(new float[]{2, 29, 30)) ;


text:
Q: client_Browser field is always empty in App Insights For all requests in App Insights the property client_Browser is empty for some reason.
How can I make App insights populate client_Browser column?

A: This feature(client_os, client_browser are populated in app insights) has been deprecated for a long time, see the issue here.
As of now, client_Browser is only populated in the pageViews telemetry, but not in request telemetry.
Here is the screenshot of pageViews telemetry:

If you just want to query the requests based on which browser, you can simply join pageViews table and requests table via session_Id in the Application Insights logs.
Also, here is the request feature about this, please upvote it.


text:
Q: How to get the pressed button in a function Is it possible to create a function that returns which button was pressed, even though all buttons have the same class?
It is important that the classes of the buttons must not be changed.
<html>
 <body>
   <button class="button">text</button>
   <button class="button">text</button> //this button was clicked
   <button class="button">text</button>
 </body>
</html>

The code is only for visualisation I know it isn't right.
function myfunction(){
 console.log(clickedbutton)
}

What I have to fill in so the code runs?
Sorry for the bad code i don't know how to make it more clearly.

A: Hello and happy new 2021!
I think this might be a slight duplicate of this.
As Gabriele said, you can get the HTML element by using the target. If you need some logic for differentiating the structures (using them in some state later on), you would need to assign an id or a different class.

A: Delegate

document.getElementById("buttonDiv").addEventListener("click",function(e) {
  const tgt = e.target;
  if (tgt.classList.contains("button")) console.log(tgt.textContent,"clicked")
})
<div id="buttonDiv">
   <button class="button">text 1</button>
   <button class="button">text 2</button>
   <button class="button">text 3</button>
</div>

A: When an event happens and the handler that is bound to that event for that element is called, it is passed the event as the first parameter. And one of the properties of the event is the target which points to the element that triggered the event.
so

function clickHandler(event) {
  const clickedElement = event.target;
  console.log(clickedElement.textContent);
}

document
  .querySelectorAll('.button')
  .forEach(button => button.addEventListener('click', clickHandler))
<button class="button">text 1</button>
<button class="button">text 2</button>
<button class="button">text 3</button>

A: If you assign a function to the onClick event of a button (or multiple buttons), you can receive the event info as an argument, like so:

function myfunction(e) {
  console.log(e.target.id)
}
<!DOCTYPE html>
<html>

<body>
  <button id="button-1" class="button" onclick="myfunction(event)">text</button>
  <button id="button-2" class="button" onclick="myfunction(event)">text</button>
  <button id="button-3" class="button" onclick="myfunction(event)">text</button>
</body>

</html>

A: You can make use of data-id for getting index of button clicked.

const button = document.querySelectorAll(".button");

function getClickedIndex(evt) {
  console.log(evt.target.getAttribute("data-id"));
}

button.forEach(button => button.addEventListener('click', getClickedIndex))
<html>
 <body>
   <button class="button" data-id="1">text</button>
   <button class="button" data-id="2">text</button>
   <button class="button" data-id="3">text</button>
 </body>
</html>


text:
Q: Java: Modifying parameter passed as a Reference I have to implement an interface method that has the signature like:
public int runMethod(final int key, Reference <String> result);

I have to update the value of result parameter before method returns. For example if the value of result was ABC when the method was invoked, I need to modify it as DEF and return to caller. Can somebody suggest how do I achieve it?

A: If you really want to pass as reference, here is a tricky way by wrapping it in an array:
class TestRef{
  static void func(int[] arr){arr[0] = -arr[0];}
  public static void main(String[] args){
    int[] arrI = new int[1];
    arrI[0] = 250;

    System.out.println(arrI[0]); // 250
    func(arrI);
    System.out.println(arrI[0]); // -250
  }
}

A: You can't modify the variable that you passed to the method. For example:
public int runMethod(final int key, Reference <String> result) {
    result = null; // Only changed the method's version of the variable, and not the variable that was passed to the method
}
...
Reference<String> ref = ...
runMethod(0, ref);
// ref is still what you originally assigned it to

However, you can modify the fields and call the methods of the object you pass.
public int runMethod(final int key, Reference <String> result) {
    result.someField = ...; // Here we are changing the object, which is the same object as what was passed to the method.
}
...
Reference<String> ref = ...
runMethod(0, ref);
// ref.someField has now been changed

An alternative would be to change the method's return type to Reference<String> and return the updated value.
public Reference<String> runMethod(final int key, Reference <String> result) {
    return ...;
}
...
Reference<String> ref = ...
ref = runMethod(0, ref);
// ref is now whatever you returned from the method

A: In java objects are in effect passed by reference. That is, parameter 'result' within runMethod appears to be exactly the same object as in the caller, not a copy. So, by updating the contents of Reference parameter of runMethod you will be achieving the goal you have described.
However, 'result' itself is not actually a pointer to the caller's passed variable so it is not possible to overwrite the object itself, only update it's contents.


text:
Q: Flexbox alignment in Safari Please see this fiddle where the layout works well in chrome, firefox but not Safari..
html..

my text

css..
.flex-at-desktop {
display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
display: -ms-flexbox;      /* TWEENER - IE 10 */
display: -webkit-flex;     /* NEW - Chrome */
display: flex;
}
.something-semantic {
display: table;
width: 100%;
height:100%
}
.something-else-semantic {
display: table-cell;
vertical-align: middle;
background:#ccc
}

https://jsfiddle.net/3me544L3/1/
The aim is to have the column with the text in match the height of the image in the other column, and once that happens - to align the text vertically in the div. This is working well in some browsers but in Safari the div doesnt adapt to  full height?


text:
Q: cannot increment same product in cart i cannot seem to be able to add a method to increment the same product in my app.i am designing an online store, i want to be able to add a product to cart so that the number of the same items in the cart will increment,
when i run the program it starts fine, but when i add a product to cart it gives me this error...
ruby 2.4.1p111 (2017-03-22 revision 58053) [i386-mingw32]

C:\Users\COMPUTER>cd desktop

C:\Users\COMPUTER\Desktop>cd trial

C:\Users\COMPUTER\Desktop\trial>cd depot

C:\Users\COMPUTER\Desktop\trial\depot>rails s
=> Booting Puma
=> Rails 5.0.5 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
*** SIGUSR2 not implemented, signal based restart unavailable!
*** SIGUSR1 not implemented, signal based restart unavailable!
*** SIGHUP not implemented, signal based logs reopening unavailable!
Puma starting in single mode...
* Version 3.10.0 (ruby 2.4.1-p111), codename: Russell's Teapot
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
Started POST "/line_items?product_id=3" for 127.0.0.1 at 2017-11-01 19:32:19 +0100
  ActiveRecord::SchemaMigration Load (1.0ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by LineItemsController#create as HTML
  Parameters: {"authenticity_token"=>"i1T0s2RDpZMJfxGvhgygNCSXXowIblsp4R+t1rrIOe9NKPkB83qppszYRtmW65uCUPOJyUPPq9p3yVz+pCCvcw==", "product_id"=>"3"}
  Cart Load (1.0ms)  SELECT  "carts".* FROM "carts" WHERE "carts"."id" = ? LIMIT ?  [["id", 17], ["LIMIT", 1]]
  Product Load (1.0ms)  SELECT  "products".* FROM "products" WHERE "products"."id" = ? LIMIT ?  [["id", 3], ["LIMIT", 1]]
Completed 500 Internal Server Error in 1005ms (ActiveRecord: 14.0ms)

NoMethodError (private method `add_product' called for #<Cart:0x4de4bb0>):

app/controllers/line_items_controller.rb:29:in `create'
  Rendering C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout
  Rendering C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (223.0ms)
  Rendering C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (44.0ms)
  Rendering C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (7.0ms)
  Rendered C:/Ruby24/lib/ruby/gems/2.4.0/gems/actionpack-5.0.5/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb within rescues/layout (11138.2ms)

this is the controller where the code resides.......
class LineItemsController < ApplicationController
  include CurrentCart
  before_action :set_cart, only: [:create]
  before_action :set_line_item, only: [:show, :edit, :update, :destroy]

  # GET /line_items
  # GET /line_items.json
  def index
    @line_items = LineItem.all
  end
  # GET /line_items/1
  # GET /line_items/1.json
  def show
  end

  # GET /line_items/new
  def new
    @line_item = LineItem.new
  end

  # GET /line_items/1/edit
  def edit
  end

  # POST /line_items
  # POST /line_items.json
  def create
    product = Product.find(params[:product_id])
    @line_item = @cart.add_product(product)

    respond_to do |format|
      if @line_item.save
        format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }
        format.json { render :show, status: :created, location: @line_item }
      else
        format.html { render :new }
        format.json { render json: @line_item.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /line_items/1
  # PATCH/PUT /line_items/1.json
  def update
    respond_to do |format|
      if @line_item.update(line_item_params)
        format.html { redirect_to @line_item, notice: 'Line item was successfully updated.' }
        format.json { render :show, status: :ok, location: @line_item }
      else
        format.html { render :edit }
        format.json { render json: @line_item.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /line_items/1
  # DELETE /line_items/1.json
  def destroy
    @line_item.destroy
    respond_to do |format|
      format.html { redirect_to line_items_url, notice: 'Line item was successfully destroyed.' }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_line_item
      @line_item = LineItem.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def line_item_params
      params.require(:line_item).permit(:product_id, :cart_id)
    end
end

this is the cart.rb.......
class Cart < ApplicationRecord
    has_many :line_items, dependent: :destroy
end

def add_product(product)
 current_item = line_items.find_by(product_id: product.id)
  if current_item
   current_item.quantity += 1
else
   current_item = line_items.build(product_id: product.id)
     end
     current_item

here is the index

<%= notice %>

Your Pragmatic Catalog

<% cache @products do %>
<% @products.each do |product| %>
<% cache @product do %>

<%= product.title %>

<%= image_tag(product.image_url) %>
<%= sanitize(product.description) %>

<%= number_to_currency (product.price) %>

<%= button_to 'Add to Cart' , line_items_path(product_id: product.id)%>

<% end %>
<% end %>
<% end %>


text:
Q: Getting error 'Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' ON andoid app Here is my layout
ProfileDisplay.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Profiledisplay">
<RelativeLayout
android:layout_width="match_parent"
android:background="@color/colorPrimaryDark"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/profilimg"
    android:layout_width="160dp"
    android:elevation="20dp"
    android:layout_height="160dp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="40dp"
    app:civ_border_width="2dp"
    android:src="@drawable/progileicon"
    app:civ_border_color="#FF000000"/>
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="26dp"
    android:textColor="@color/white"
    android:text="mailid@mail.com"
    android:id="@+id/mailid"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="220dp"
    android:textStyle="bold"></TextView>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="name"
    android:id="@+id/name1"
    android:textColor="@color/white"
    android:layout_marginTop="260dp"
    android:layout_centerHorizontal="true"
    android:textStyle="bold"
    android:textSize="20dp"/>
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/bloggerorweiter"
    android:textSize="20dp"
    android:textColor="@color/white"
    android:layout_marginTop="280dp"
    android:layout_centerHorizontal="true"
    android:textStyle="bold"
    android:text="Blogger or Writer"
     />
<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="20dp"
        android:id="@+id/City"
        android:textColor="@color/white"
        android:layout_marginTop="300dp"
        android:layout_centerHorizontal="true"
        android:textStyle="bold"
        android:text="City"
        />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="20dp"
    android:id="@+id/state"
    android:textColor="@color/white"
    android:layout_marginTop="320dp"
    android:layout_centerHorizontal="true"
    android:textStyle="bold"
    android:text="State"
    />
<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="20dp"
    android:id="@+id/Country"
    android:textColor="@color/white"
    android:layout_marginTop="340dp"
    android:layout_centerHorizontal="true"
    android:textStyle="bold"
    android:text="Country"
    />
</RelativeLayout>
<com.google.android.material.navigation.NavigationView
    android:id="@+id/navigation"
    android:background="#97145C"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    app:menu="@menu/nav_items"
    app:headerLayout="@layout/header">
</com.google.android.material.navigation.NavigationView>

ProfileDisplay.java
package com.example.myapplication;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.media.Image;
import android.nfc.Tag;
import android.os.Bundle;
import android.util.Log;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import com.google.android.material.navigation.NavigationView;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import org.w3c.dom.Text;
import java.util.concurrent.ExecutionException;
public class Profiledisplay extends AppCompatActivity {
NavigationView navigationView;
ImageView imgview;
FirebaseAuth mauth;
String currentuserID;
private DatabaseReference userref1;
TextView name,country,mailid,city,state,blog_writer;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    imgview=findViewById(R.id.profilimg);
    name=(TextView) findViewById(R.id.name1);
    country=(TextView)findViewById(R.id.Country);
    mailid=(TextView)findViewById(R.id.mailid);
    city=(TextView)findViewById(R.id.City);
    state=(TextView)findViewById(R.id.state);
    mauth=FirebaseAuth.getInstance();
    blog_writer=(TextView)findViewById(R.id.bloggerorweiter);
    currentuserID=mauth.getCurrentUser().getUid();
    userref1 = FirebaseDatabase.getInstance().getReference().child("Users");
   try{
    userref1.child(currentuserID).addValueEventListener(new ValueEventListener() {
        @Override
        public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
            if(dataSnapshot.exists()){
                if(dataSnapshot.hasChild("username")){
                        String fullname1 = dataSnapshot.child("username").getValue().toString();
                        **name.setText("123456");**
                }
                if(dataSnapshot.hasChild("urlimage")){
                    String imageurl=dataSnapshot.child("urlimage").getValue().toString();
                    Glide.with(getApplicationContext()).load(imageurl).into(imgview);
                }else{
                    Toast.makeText(Profiledisplay.this, "username or profile not exist",
   Toast.LENGTH_SHORT).show();
                }
                String Email="gaakash149@gmail.com";
                mailid.setText(Email);
            }
        }
        @Override
        public void onCancelled(@NonNull DatabaseError databaseError) {
        }
    });}
   catch(Exception e){
   }
    setContentView(R.layout.activity_profiledisplay);
    navigationView=findViewById(R.id.navigation);
    navigationView.setNavigationItemSelectedListener(new
    NavigationView.OnNavigationItemSelectedListener() {
        @Override
        public boolean onNavigationItemSelected(@NonNull MenuItem menuItem) {
            switch (menuItem.getItemId()){
                case R.id.home:
                    Toast.makeText(Profiledisplay.this, "CLicked Home", Toast.LENGTH_SHORT).show();
                    startActivity(new Intent(getApplicationContext(),Home.class));
                    break;
                case R.id.Profile:
                    Toast.makeText(Profiledisplay.this, "CLicked profile",Toast.LENGTH_SHORT).show();
                    startActivity(new Intent(getApplicationContext(),Profiledisplay.class));
                    break;
                case R.id.Post:
                    Toast.makeText(Profiledisplay.this, "CLicked Post", Toast.LENGTH_SHORT).show();
                    startActivity(new Intent(getApplicationContext(),forgotpass.class));
                    break;
            }
            return false;
        }
    });
    }
}

error

E/AndroidRuntime: FATAL EXCEPTION: main
      Process: com.example.myapplication, PID: 25982
      java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference
          at com.example.myapplication.Profiledisplay$1.onDataChange(Profiledisplay.java:51)
          at com.google.firebase.database.core.ValueEventRegistration.fireEvent(com.google.firebase:firebase-database@@16.0.4:75)
          at com.google.firebase.database.core.view.DataEvent.fire(com.google.firebase:firebase-database@@16.0.4:63)
          at com.google.firebase.database.core.view.EventRaiser$1.run(com.google.firebase:firebase-database@@16.0.4:55)
          at android.os.Handler.handleCallback(Handler.java:790)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:198)
          at android.app.ActivityThread.main(ActivityThread.java:7055)
          at java.lang.reflect.Method.invoke(Native Method)
          at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:523)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:836)

I got this error every time when I am trying to do SetText() method.
build.gradel file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion '24.0.2'
defaultConfig {
    applicationId "com.example.myapplication"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-
optimize.txt'), 'proguard-rules.pro'
    }
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.google.android.material:material:1.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.makeramen:roundedimageview:2.3.0'
}
apply plugin: 'com.google.gms.google-services'

A: You need to setContentView before calling findViewbyID.
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_profiledisplay); // move setContentView here
    imgview=findViewById(R.id.profilimg);
    name=(TextView) findViewById(R.id.name1);
 ....

Your problem is that the view was null when you were trying to finditbyid.
Update
In other words:

*

*setContentView before trying to get reference to the view:
Focus here setContentView(R.layout.activity_profiledisplay);

*Make sure that there is a TextView named name1 in activity_profiledisplay.xml

A: Your Java Activity XML file not match with same Activity.
setContentView(R.layout.********);//here your matching activity.*
Like when u create new activity , MainActivity its xml file name is    activity_main...
Use Binding Easy To Understand ...


text:
Q: Is there a way to know where a download is saved in javascript I am scripting an application in php (installed on the client side).
There will be a front end accessible from the browser (standard html + javascript, ...) and some background process (php).
The application should be able to download files.
The plan is to let the user of the front end decide of the target location for the download (folder and filename) with standard browser dialog box (with offering a dummy content)
and then to perform the download of the real content with the background processes.
Is there a way to know, with javascript, the target location chosen by the user for a download ? and if yes, how ?
EDIT
To make the question less intrusive : is there a way to let the user choose a target location on its filesystem with a standard dialog box and let the browser know this location ?


text:
Q: Save a HTML table to array only working for first 102 elements I'm trying to scrape this website and parse the data into an excel sheet.
await page.evaluate(() => loadMore());
await page.evaluate(() => loadMore());
await page.evaluate(() => loadMore());
$('tr').each(function(idx) {
    const val = [];
    $('td', this).each(function() {
        val.push($(this).text())
    });
    array.push(val);
});

What this code does is first, it clicks the "load more" button 3 times in order to show the entire table. Then, it looks for the elements "tr" and for each of these, it creates an array of the child elements("td") and merges them all together to form a 2D array.
However, my code currently only fetches the data up to the first few elements. It only goes up to the elements until the first "load more" button. In order words, it shows the content up to where it would if I didn't click the "load more " button at all. I suspect that the error is caused by the array being created before the button is clicked because when I use "headless: true" it shows all the elements on the page after clicking the "load more" button 3 times.

A: The function loadMore is not a promise, so you can't await until it finish
this is the loadMore function on that page:
function loadMore() {
    //... some code

    $.get(url, function (data) {
         /// HERE is the callback that is called when the async api call returns

            })

    /// more code

}

Maybe you can make your own loadMore function adding some promise behavior to wait until it finish.
here i added a promise wrapper to the ajax function and returned that promise
function customLoadMore() {
   //... some code

    let promise = new Promise((resolve) => {
        $.get(url, function (data) {

            // same callback code

            resolve() // add a resolve to the promise when the callback finish
        })
    })

    // more code

    return promise; // we return the promise so it can be awaited
}

So, now you can await customLoadMore()


text:
Q: Nginx can't find phpMyAdmin Hello I have installed the newest stable Version of Nginex (1.4.4) and want to install also phpMyAdmin, unfortunately the following error appears when I try to open phpMyAdmin in my browser through http:// 192 . . . /phpmyadmin:
404 Not Found
nginx/1.4.4

What exactly is the reason that Nginx can't find the phpMyAdmin file?
This is the content of my /etc/nginx/nginx.conf file:
user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

Many Greetings

A: It's really not a good idea to make a symbolic in your document root, that's just asking for trouble having a phmyadmin shortcut in www.
The right way to do it is to create a file called php and add to /etc/nginx/sites-available. You can copy the file below but change the port number to something else.
    server {
        listen 30425;

        # Don't want to log accesses.
        #access_log  /dev/null main;
        access_log  /var/log/nginx/php.acces_log main;
        error_log   /var/log/nginx/php.error_log info;

        root /usr/share/phpmyadmin;
        index  index.php index.html index.htm;
        error_page 401 403 404 /404.php;

        location ~ .*.php$ {
                include fastcgi_params;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param SERVER_NAME $http_host;
                fastcgi_ignore_client_abort on;

        }
}

Now you need to make symbolic link to sites enabled directory
ln -s /etc/nginx/sites-available/php//etc/nginx/sites-enabled
now you need to add this code to Logging Settings part of nginx.conf
log_format main '$remote_addr – $remote_user [$time_local] '
                '"$request" $status $body_bytes_sent "$http_referer" '
                '"$http_user_agent" "$http_x_forwarded_for"' ;

Now you can access your phpmyadmin with http://example.com:30425

A: I have followed the instructions on https://www.digitalocean.com/community/articles/how-to-install-phpmyadmin-on-a-lemp-server and linked nginx and phpMyAdmin through the following command:
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html
(the folder "www" was replaced in the newer versions of Nginx through "html")
sudo service nginx restart

If I now try to start phpMyAdmin through
"http:// 192 . . . /phpmyadmin"
the following error appears in my browser:
403 Forbidden
nginx/1.4.4

If I try to start phpMyAdmin through
"http:// 192 . . . /phpmyadmin/index.php"
the index.php file only gets downloaded.
Many Greetings

A: The answers provided here did not help me for reasons unknown. I suspect that other parts of my conf file ruled out going into the phpmyadmin directory.
Not wanting to spend too long fixing it to work I simply copied my working conf file from www.example.com to phpmyadmin.example.com and set the directory to /usr/share/phpmyadmin. I then did nginx -s reload and I was good to go without ever having to get to the bottom of the 403/502 errors that I encountered doing it properly. I also believe that http://phpmyadmin.example.com is more secure from random hackers trying their scripts than the http://www.example.com/phpmyadmin domain, however it does entail having the wildcard setup correctly for the DNS for your domain, i.e. so that the address resolves to your server.
Hope this helps anyone frustrated in the simple task of getting phpmyadmin working with nginx.

A: As user1941083 explain.
You just need to create a symbolic link between phpMyAdmin and your site's directory.
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/www

And after that, modify nginx setting in /etc/nginx/sites-available.
Change :
index index.html index.html;

to :
index index.html index.html index.php;

A: Simply try by using http://domain-name-or-ip-address/phpmyadmin/index.php
Sometime Nginx do not use index.php automatically, we have to tell it, either by changing location in nginx.conf file or by adding index.php manually into url, just like above.

A: I know this is late though but I had the same problem after following some tutorials and suggestions online but to no avail. I also tried @STH answer on this page but still error still exist.
I had to restart the following services:
sudo systemctl restart nginx.service
sudo systemctl restart php-fpm

THIS DID THE TRICK: Configure the Daemons to Start at Boot, to ensure that all of the LEMP programs start automatically after any server restarts:
sudo systemctl enable nginx mysqld php-fpm

A: Try to create the symbolic link between the phpmyadmin location and nginx www:
sudo ln -s /usr/share/phpmyadmin/ /usr/share/nginx/html

after this you can get the 403 Forbidden but should add the index.php inside the server tag where index.html and others are:
/etc/nginx/sites-available/default

and then restart nginx


text:
Q: .NET MVC or just plain old ASP.NET? This is a shoutout as I've been spending the last few days learning about .NET and the process has left me a little confused rather than enlightened.  Just as a background info, I have knowledge of PHP (have even used CakePHP to create a whole app rather easily) and Rails.
I am wondering if I should pursue ASP.NET or should stick to learning ASP.NET MVC?  While I was going through a few tutorials of ASP.NET, the basics seemed rather straightforward, but somehow, when every example I've gone through sticks SQL statements right into the example without a DAL, I just get a little worried.
So, in case I was just not doing any good research, are there any books/sites out there that will help in this?  Or should I just go and learn .NET MVC?
If you're wondering why I just don't stick with PHP or Rails, I just learned that I might just have to know a little .NET for the safety of my job.

A: I think that the DAL-less examples you're seeing are written that way for simplicity. Serious ASP.Net applications always use layers such as BLL and DAL. The separation of the DAL is just omitted in simple examples -- that does lead to the unfortunate mis-interpretation of the examples by people who don't know better.
I believe that MVC is more difficult to program, and that it is best used only when there is a specific reason for using it -- SEO optimization, TDD development. It ignores many of the sophisticated functionality available in ASP.Net WebForms and is often compared to classic ASP. And, I don't believe that MVC has become widely adopted in many corporate environments, so if you want to learn the approach used by everybody else, stick with the basic ASP.Net and save MVC for later.
As a .Net beginner with abundant experience in other programming languages, I would recommend that you continue your studies of ASP.Net using WebForms. If you're looking for a serious DAL example, I would highly recommend this lengthy tutorial on the ASP.Net website. It has all of the architectural refinements you seek, and may prove helpful in learning how to use the many data display controls.

A: I would choose ASP.Net MVC over ASP.Net WebForms for one reason: testing.  MVC was designed from the ground up to be a pluggable and testable system.  Testing is, or at least should be, an inseparable part of your development cycle.  Testing MVC is orders of magitude easier than WebForms due to the ability to MOCK or replace parts of the core API.  Doing the equivalent in WebForms is either not possible or very unwieldy.

A: A colleague of mine has written up his experiences of using ASP.NET MVC on a real world project at http://www.mindscape.co.nz/staff/jeremy/index.php/2009/02/loving-aspnet-mvc/ and his comparisons to plain old ASP.NET.  His conclusion is "I reckon MVC is the way forward for building web applications on the .NET framework."
He has also written up some detailed walkthroughs showing how to use ASP.NET MVC with an ORM which might help address your "putting the SQL straight in the example without a DAL" concern (he also covers things like unit testing). See http://www.mindscape.co.nz/staff/jeremy/index.php/2009/03/aspnet-mvc-part1/, http://www.mindscape.co.nz/staff/jeremy/index.php/2009/03/aspnet-mvc-part2/, http://www.mindscape.co.nz/staff/jeremy/index.php/2009/03/aspnet-mvc-part3/ and http://www.mindscape.co.nz/staff/jeremy/index.php/2009/03/aspnet-mvc-part4/.  Disclaimer: These are written in terms of our commercial ORM, but will I hope be easy to translate to your own preferred data access technology.

A: Rob Conery has written a book on ASP.MVC, so you might find him biased. I find his arguments compelling nonetheless.

A: Recently read ASP.NET 3.5 Application Architecture and Design - it was a reasonable look into many different aspects of design within ASP.NET, including Data Access Layers, N-Tier architecture, Design Patterns and touched on MVC, amongst other topics. It was good as an overview of ASP.NET best practices, if looking for a book.
I would have to agree with others that you're best bet would be to look at going straight to ASP.NET MVC as your current skills will translate better to that framework. I would recommend taking a look at Professional ASP.NET MVC 1.0.

A: ASP .net MVC will be closer to your rails experience.
ASP .net Web Forms (what is usually called ASP.net) is clearly different, but if you are learning for the sake of finding jobs, it's what will pay for a long time(there are lots and lots of sites, both internal and public-facing) built on ASP .net web forms. There are some emerging sites using ASP.net MVC, but it's a long way.
So, it depends on your goals.
If you just need to know "a little .net", go with MVC because the concepts will be known to you. If you need to know "the .net web stack", then most people will thnik of web forms, not MVC...
And yes, samples in the microsoft world tend to be on the "lighter side". It's near impossible to find demos that do not have the "draggy-droppy" feeling, and it is a REAL problem.


text:
Q: Cheese will start from terminal but not main menu on 20.04 I'm running Ubuntu MATE 20.04.2. When I try to launch Cheese from the main menu, a small bar (like a minimised window) appears in the panel at the bottom of the screen, saying "Starting Cheese". After a few seconds it vanishes, and Cheese does not launch.
However, when I try to open Cheese from the MATE terminal, it works straight away!
$ which cheese
/usr/bin/cheese

$ which -a cheese
/usr/bin/cheese
/bin/cheese

I have tried changing the command in Cheese's menu entry from cheese to /usr/bin/cheese and /bin/cheese, both times without any luck. I also tried mate-terminal -e "cheese", but again no luck. I tried setting Cheese's menu entry to "Application in terminal" as well as "Application" - no luck from either.
I don't know where logfiles for Cheese would be, and in this age of systemd I can't consult /var/log/messages anymore. I did try:
$ dmesg | grep "cheese"

but nothing showed up.
The only possible clue I have is that when I first launched Cheese from the command line and took four photos, when I closed it I saw the following in the terminal:
$ cheese

(cheese:16782): GLib-CRITICAL **: 16:47:37.203: Source ID 6792 was not found when attempting to remove it

(cheese:16782): GLib-CRITICAL **: 16:47:54.570: Source ID 8525 was not found when attempting to remove it

(cheese:16782): GLib-CRITICAL **: 16:48:46.087: Source ID 9582 was not found when attempting to remove it

A: The normal Cheese package puts its executable into /usr/bin/cheese and not to /bin/cheese.
So you have to remove the latter by
sudo rm /bin/cheese

and then reinstall the package by
sudo apt-get update
sudo apt-get install --reinstall cheese

and then retry launching Cheese from terminal or MATE menu.


text:
Q: Which filter does InverseRadon use by default? I am using the InverseRadon function. According to the documentation the function uses a Hann filter and no cutoff ("CutoffFrequency"->1) by default. However, if this is given as an option the result is different from the default.
Is their a way to determine which parameters (Filter and cutoff) are used by default?
I have tested the filters listed in the documentation.
The result is closest to the cosine-ramp filter, but not identical.
i = Import["http://i.imgur.com/zxKkFP9.png"];(* Sinogram from InverseRadon Documentation *)
filter = {{Automatic, "Default"}, {#1&, "ramp filter with constant slope"},{#1 Cos[#1 \[Pi]]&, "ramp filter multiplied by cosine function"}, {(1+Cos[#1 \[Pi]])/2&, "Hann filter (default)"}, {0.54` +0.46` Cos[#1 \[Pi]]&, "Hamming filter"}, {Sqrt[1/(1+#^(2n))]&, Row@{"Butterworth filter of order ",n}}, {1&, "no filtering"}};
TableForm@Transpose[{Last@#,ImageAdjust@InverseRadon[i,{300,300},Method->{First@#, "CutoffFrequency"->1}]}&/@(filter/.n->2)]

Edit:
I have tested @JM's suggestion to use the scaled cosine-ramp filter.

ImageDifference@@(ImageAdjust@InverseRadon[i, {300, 300}, Method -> #] & /@ {Automatic, (# (1 + Cos[\[Pi] #])/2 &)})

This results a black image image. The two options are almost equal, but not identical. The maximum difference (Max@ImageData) is 0.00249.
This is difference image after an ImageAdjust:


text:
Q: What does it mean "sequence with infinite range" I'm trying to understand this phrase

Find a sequence with infinite range that converges only to $0$.

What does it mean "sequence with infinite range"?
Thanks

A: Recall that a sequence is really a function from $\Bbb N$ into some set, $\Bbb R$ in this case (guessing by the choice of tags). If the sequence is $x\colon\Bbb N\to\Bbb R$ then we write, for convenience, $x(n)$ as $x_n$.
But since $x$ is a function, it has a range $\{x_n\mid n\in\Bbb N\}$ (where we forget about the enumeration). The sequence $x_n=0$, for example, is such that its range is a singleton, since all the $x_n$'s are equal to each other. On the other hand, the sequence $x_n=n$ has an infinite range, since $x_n=x_k$ if and only if $n=k$.
Your question asks you to find a sequence which converges to $0$ but does not have a finite range. Namely, infinitely many $x_n$'s are distinct from one another.


text:
Q: wait a process to finish in Python script I'm writing a Python script to run several executables one by one on Windows. I need to wait a program to finish before starting the next.
So the script will be like this.
1: launch a.exe
2: wait till a.exe finishes running
3: launch b.exe
4: wait till b.exe finishes

Anyone have an idea how to make the script waiting for a process to finish in Python?
Thanks

A: If you wish to wait for your launched process, you can simply use subprocess.call() . This method executes the command in args and waits for it to complete. For reference, see this
import subprocess
subprocess.call(('someprog.exe', str(i)))


text:
Q: Ruby on Rails 3: Updating join table, using 2 parameters? I have a join table, which have 3 parameters. I want to update it, using a where-clause, something like this: (which obviously is not correct)
Grid.update(:page_id => @page_id,:thing_id => @thing_id,:number => @number ).where(:page_id => @page_id, :number => @number ).first

I need to find the record with mathing page_id and number, and then update the thing_id.
Thanks!
Jakob

A: Grid.where(:page_id => @page_id, :number => @number).first.
  update_attributes(:page_id => ...,: thing_id => ..., :number => ...)


text:
Q: How to Listen Value Change in Primitive Data Type (in this case: boolean) I want to make some code which its execution is triggered by value change of a boolean in my Android project. does that means creating a listener? Would you mind showing a sample to me?

A: Without knowing anything of your application, I will suggest an implementation of the Observer pattern. There are examples for a Java implementation on the Wikipedia page.


text:
Q: how does chronicle queue enable remote appender and tailer I just start to read the latest V4 documentation. It suggests for remote append and tail, it is recommended to use chronicle-engine. Does it require the enterprise support for that set of functionality ? I looked around the test packages of chronicle-engine, and found out this test class WireRemoteStatelessQueueClientTest.java seems to be relevant but is entirely commented out.

A: I think I should just switch to V3 implementation.


text:
Q: alinear tabla al centro con bootstrap queria alinear esta tabla al centro con bootstrap. Utilizo d-block porque si utilizo d-flex me estira la tabla hasta ocupar toda la pagina como se ve mas abajo.

.cuadroLogin
{
    height:550px;
}

        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
        <link rel="stylesheet" href="estilos.css?<?php echo date('l jS \of F Y h:i:s A'); ?>">

            Id	Nombre

1	Articulo1

si uso d-flex me la alinea sin problemas pero la tabla se estira hasta ocupar toda la pantalla.

.cuadroLogin
{
    height:550px;
}

        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
        <link rel="stylesheet" href="estilos.css?<?php echo date('l jS \of F Y h:i:s A'); ?>">

            Id	Nombre

1	Articulo1

A: Al div prueba agregarle col-auto o tex-center, para alinear al centro verticalmente:


text:
Q: Issue in Spring page navigation Mapping not found error in logs I am new to Spring and trying one user registration example using maven with spring mvc.
I am able to lunch my home page but when i click on the login link than getting 404 error page not found.
Below are my application details:-
Web.xml
<web-app id = "WebApp_ID" version = "2.4"
   xmlns = "http://java.sun.com/xml/ns/j2ee"
   xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation = "http://java.sun.com/xml/ns/j2ee
   http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <display-name>Archetype Created Web Application</display-name>
    <welcome-file-list>
        <welcome-file>home.jsp</welcome-file>
    </welcome-file-list>
    <servlet>
        <servlet-name>spring-mvc</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>spring-mvc</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>
</web-app>

DispacterServlet:-
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <import resource="classpath.*:jbr/config/user-beans.xml" />
    <context:component-scan base-package="jbr.springmvc" />
    <context:annotation-config />
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
</beans>

Controller:-
package jbr.springmvc.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import jbr.springmvc.model.Login;
import jbr.springmvc.model.User;
import jbr.springmvc.service.UserService;
@Controller
public class LoginController {
  @Autowired
  UserService userService;
  @RequestMapping(value = "/login", method = RequestMethod.GET)
  public ModelAndView showLogin(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("login");
    mav.addObject("login", new Login());
    return mav;
  }
  @RequestMapping(value = "/loginProcess", method = RequestMethod.POST)
  public ModelAndView loginProcess(HttpServletRequest request, HttpServletResponse response,
  @ModelAttribute("login") Login login) {
    ModelAndView mav = null;
    User user = userService.validateUser(login);
    if (null != user) {
    mav = new ModelAndView("welcome");
    mav.addObject("firstname", user.getFirstname());
    } else {
    mav = new ModelAndView("login");`enter code here`
    mav.addObject("message", "Username or Password is wrong!!");
    }
    return mav;
  }
}

Login.jsp
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" %>
        <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

            <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
            <title>Login</title>

            <form:form id="loginForm" modelAttribute="login" action="loginProcess" method="post">

                            <form:label path="username">Username: </form:label>

                            <form:input path="username" name="username" id="username" />

                            <form:label path="password">Password:</form:label>

                            <form:password path="password" name="password" id="password" />

                            <form:button id="login" name="login">Login</form:button>

                        Home

            </form:form>

                    ${message}

I have tried so many some but not able to find any solution for this.
Please help me to identify where I am doing wrong.It's my first application in spring so not able to perform any more analysis.
Please guide me with this

A: You Have specified home.jsp in your welcome file list. I don't see a home.jsp file in your file path. May be that's throwing you 404. You have a login.jsp. Make your controller return "login" from your controller. Either wise works. Since you mentioned as a beginner, you can check here for bootstrapping a basic app.
https://github.com/mrakhunathan/SpringWebSkeleton.git


text:
Q: How to Dock a PyQt window in Maya I am working with PyQt in Autodesk Maya 2013 and was curious how to set up your window to dock. Using maya.cmds its quite easy to do and I feel like it should be easy to do here but I am not quite sure how. If anyone can help me out I would be quite appreciative, Thanks!

A: http://www.jason-parks.com/artoftech/?p=439
Jason gives here a nice exemple commented line by line.


text:
Q: Why is vuexfire not updating state but updating the ui correctly? I'm trying to set up vuexfire with firestore for a project, I think I've done everything according to the docs. I managed to get data from firestore inside a component using vuex/vuexfire and show it correctly in the UI but when inspecting the state in the devtools I get that my state hasn't changed.
I used the vue-cli to set up my project and followed the vuexfire docs and examples for a basic todo app.
Here's my store file:
import Vue from 'vue'
import Vuex from 'vuex'
import { vuexfireMutations, firestoreAction } from 'vuexfire'
import { db } from './db'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    todos: []
  },
  mutations: {
    ...vuexfireMutations
  },
  actions: {
    bindTodos: firestoreAction(({ bindFirestoreRef }) => {
      return bindFirestoreRef('todos', db.collection('todos'))
    }),
    unbindTodos: firestoreAction(({ unbindFirestoreRef }) => {
      unbindFirestoreRef('todos')
    })
  }
})

And here's the basic component that loads and displays the ui:
<template>

Home

{{ todo.name }}

</template>

As you can see the UI is showing the todos but state is not:

I've tried refreshing the state in the devtools but it isn't working. Any help will be much appreciated!

A: Vue Devtools

*

*Settings

*

*New Vuex backend: OFF

A: It turns out that it was a problem with the vue dev tools for chrome, I finally decided to uninstall it and reinstall it and it did the trick. State was actually updating, but the dev tools wasn't showing it.
Hope this helps someone in the future!