text:
Q: Chrome App / Extension - Background Request Error, or Allowing app issue to load Google Doc API I'm not sure what is wrong it says that the Google Doc API cannot allow a desktop application to be installed when previously this worked in Chrome 27.0 I believe.
Here is my Manifest.Json file:
{
  "name": "__MSG_extName__",
  "description": "__MSG_extDescription__",
  "version": "4.0",
  "default_locale": "en_US",
"background": {
  "page": "background.html"
},
  "offline_enabled": true,
  "options_page": "options.html",
  "manifest_version": 2,
  "app": {
    "launch": {
      "local_path": "index.html"
    }
  },
  "icons": {
    "16": "16icon.png",
    "48": "48icon.png",
    "128": "icon.png"
  },
  "permissions": [
    "<all_urls>",
    "unlimited_storage",
    "notifications",
    "tabs",
      "https://docs.google.com/feeds/*",
      "https://www.google.com/accounts/OAuthGetRequestToken",
      "https://www.google.com/accounts/OAuthAuthorizeToken",
      "https://www.google.com/accounts/OAuthGetAccessToken"

  ],

   "content_security_policy": "script-src 'self'; object-src 'self'",

  "web_accessible_resources": [
    "chrome_ex_oauthsimple.js",
    "chrome_ex_oauth.html",
    "back-main.js",
    "cloud.js"
  ]

}

I'm also seeing an error here in the background.html piece.
ChromeExOAuth.prototype.onAccessToken = function(callback, xhr) {
  if (xhr.readyState == 4) {
    var bg = chrome.extension.getBackgroundPage();
    if (xhr.status == 200) {
      var params = ChromeExOAuth.formDecode(xhr.responseText);
      var token = params["oauth_token"];
      var secret = params["oauth_token_secret"];
      this.setToken(token);
      this.setTokenSecret(secret);
      bg.chromeExOAuthRequestingAccess = false;
      callback(token, secret);
    } else {
      bg.chromeExOAuthRequestingAccess = false;
      throw new Error("Fetching access token failed with status " + xhr.status);
    }
  }
};

A: I had been worrying by same state.
But I just cleared this state with "setTimeout" , nevertheless the chrome ver is 29.x.
The program code is here...
filename:chrome_ex_oauth.js  line:about 77
77>  chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {

      //original_midify/////////////////////////////////////////////////
      setTimeout(function(){

78>    if (changeInfo.url &&
79>      changeInfo.url.substr(0, url_match.length) === url_match &&
80>      changeInfo.url != tabs[tabId] &&
81>        window.chromeExOAuthRequestingAccess == false) {
82>      chrome.tabs.create({ 'url' : changeInfo.url }, function(tab) {
83>        tabs[tab.id] = tab.url;
84>        chrome.tabs.remove(tabId);
85>      });
86>    }

      //original_midify/////////////////////////////////////////////////
      },500);

87>  });

How is it?


text:
Q: Error with value of identifiers C Programming Alright, I am making a fairly basic program which reads from account.txt. The output ends up looking like how I would expect it to except the values of amount and balance are displayed as 0.00.
Here is the account.txt file:
I 478.83
D 127.45
D 619.84
C 945.12
C   4.76
D  32.81
C   1.06
D 184.32
C 495.18
C 141.81
C 255.10
D 250.00
D 123.88
D 245.05
D 873.25
C 981.12
D 317.84
C 812.73
D 606.12

Here is the relevant part of my program.
int process_info(void){

char code;

double amount, service, balance;

double amtCheck, amtDeposit, openBalance, closeBalance;

int numCheck, numDeposit, numOverdraft;

amount = 0.0;
service = 0.0;
balance = 0.0;
amtCheck = 0.0;
amtDeposit = 0.0;
openBalance = 0.0;
closeBalance = 0.0;
numCheck = 0;
numDeposit = 0;

fp = fopen("account.txt", "r");

printf("Transaction\tDeposit\tCheck\tBalance\n");
printf("-----------\t-------\t-----\t-------\n");

while ((fscanf(fp, "%c %f", &code, &amount)) != EOF){
    if (code == 'I'){
        openBalance = amount;
        balance += amount;
        printf("Initial Balance\t\t\t%.2f\n", amount);
    }
    else if (code == 'D'){
        numDeposit++;
        balance += amount;
        printf("Deposit\t\t%.2f\t\t%.2f\n", amount, balance);
    }
    else if (code == 'C'){
        numCheck++;
        balance -= amount;
        printf("Check\t\t\t%.2f\t%.2f\n", amount, balance);
    }
}
getch();
return 0;
}

A: fscanf returns the number of successful conversions made - check that and see if the call is working the way you expect (hint: it's not).
Turning on some warnings would be a good first step.  The %f format you're using in the fscanf() call doesn't match the double * argument you're assing.  Use %lf.  From clang:
example.c:29:36: warning: format specifies type 'float *' but the argument has
      type 'double *' [-Wformat]
while ((fscanf(fp, "%c %f", &code, &amount)) != EOF){
                       ~~          ^~~~~~~
                       %lf

redpajama_set_name: RedPajamaStackExchange


text:
Q: Как реализовать постоянное нахождение в личном кабинете android-приложения? Пишу android-приложение. Каждый раз при входе в него необходимо вбивать логин и пароль. Как сделать так, чтобы при входе однажды нахождение в личном кабинете было постоянным, пока пользователь сам не захочет выйти(как у приложения ВКонтакте)? Нужно ли для этого использовать Service?

A: Храни логин и пароль в SharedPreferences в если там что-то есть - логинься. Сервисы для этого совсем не нужны. По кнопке "разлогиниться" просто очищай данные.


text:
Q: Deploy changed files, using git, to staging and live server So I'm using git (BitBucket) in my workflow and I wan't to ditch classic FTP upload and use some kind of "git powered" deployment executed via the terminal.
So this is the setup I would prefer:

*

*A config file at the root of the project folder with FTP details for a staging server and a live server (2 different servers/locations).

*When I execute a command like "deploy staging" all files that has been changed, according to git, will be uploaded to the staging server.

*When I execute a command like "deploy live" all files that has been changed, according to git, will be uploaded to the live server.

*When a another developer from my team pulls a project, he can execute the above commands just like he would be able to install the required gulp-modules and start Gulp.

How can I achieve this?

A: In order to pull this off you will need to incorporate some sort of CICD(Continuous Integration/Continuous Deployment) pipeline. There are many different flavors of this, but since you are using Bitbucket you may want to look into Atlassian's Bamboo.
Once you integrate that into your pipeline, you would need to have the tool poll for changes in your git repository.  Once it sees those changes, it can automatically run any tests that you have and once they pass it can do a gulp deploy staging or gulp deploy live.
Atlassian have a pretty decent amount of resources on this using their set of tools here as well.

A: Sounds like you want to give DeployHQ a try.

*

*Add one or many environments/servers like staging and production.

*Lets you define individual config files for each server.

*You can trigger deployments automatically (whenever you push) or submitting a simple POST request to a special URL.

There are a lot more features too!


text:
Q: JButton setText() ERROR I am trying to set a new text into a button when you press on it. However it does not seem to work, I am doing something wrong, and I do not know what...
EDIT -----I attach the code for easier comprehension of what I mean
import javax.swing.*;

import java.awt.*;
import java.awt.event.*;

public class GrowAndShrinkSquareGUItest {
JFrame frame;
SquareDrawPanel bigGreen;
SquareDrawPanel smallGreen;
JButton button;
growAndShrinkListener listener;

public class SquareDrawPanel extends JPanel {

    int width;
    int height;

    SquareDrawPanel(int w, int h) {

        width = w;
        height = h;
    }

    public void paintComponent(Graphics g) {

        g.setColor(Color.green);
        g.fillRect(frame.getWidth() / 2 - (width / 2), frame.getHeight()
                / 2 - (height / 2) - 15, width, height);

    }

}

public class growAndShrinkListener implements ActionListener {

    // JButton button;

    growAndShrinkListener(JButton button) {

        button = new JButton("Click me to grow the Square");
        frame.add(button, BorderLayout.NORTH);
        button.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        button.setText("Unselect all");

    }
}

public static void main(String[] args) {
    GrowAndShrinkSquareGUItest test = new GrowAndShrinkSquareGUItest();
    test.go();
}

private void createPanels() {

    bigGreen = new SquareDrawPanel(400, 400);
    smallGreen = new SquareDrawPanel(100, 100);

}

private void drawPanel(JPanel panel) {

    frame.add(panel);
    panel.setVisible(true);
    frame.add(panel, BorderLayout.CENTER);

}

private void createListenerButton() {
    listener = new growAndShrinkListener(button);
}

private void loop(){}

public void go() {
    frame = new JFrame();
    frame.setSize(500, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    createPanels();
    drawPanel(smallGreen);
    createListenerButton();
    frame.setVisible(true);

}

}

A: It is because you use the button variable that is not defined in the scope of actionPerformed method. Java variables have scope and they are available inside curly braces where they're defined. The actionPerformed method is out of the curly braces of growAndShrinkListener method. The fixed code:
public class growAndShrinkListener implements ActionListener {

    growAndShrinkListener(JButton button) {

        button = new JButton("Click me to grow the Square");
        frame.add(button, BorderLayout.NORTH);
        button.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();

        if(source instanceof JButton) {
            button = (JButton) source;
            button.setText("Click to shrink square");
        }
    }
}

Alternatively, you can use a private variable:
public class growAndShrinkListener implements ActionListener {

    private JButton button;

    growAndShrinkListener() {

        button = new JButton("Click me to grow the Square");
        frame.add(button, BorderLayout.NORTH);
        button.addActionListener(this);

    }

    @Override
    public void actionPerformed(ActionEvent e) {
        button.setText("Click to shrink square");
    }
}

Note: You should not overwrite the content of the argument in the constructor. The argument that you got is not a "pointer" to the callee's variable, but just a simple reference to that. If you overwrite, then the content will be lost for you and calle will not know that.

A: change like this..
public class YourSuperClass{
    private JButton button;
    public YourSuperClass(){
         // your logics
         button = new JButton();
         button.addActionListener(new GrowAndShrinkListener(button));
         frame.add(button, BorderLayout.NORTH);
    }
    class GrowAndShrinkListener implements ActionListener {
        GrowAndShrinkListener(JButton button) {

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if(e.getSource() == button){
                button.setText("Click to shrink square");
            }

        }
    }
}

A: Try This :
        import javax.swing.*;
        import java.awt.*;
        import java.awt.event.*;
        class frame extends JFrame
       {
       JButton b;
       public frame()
        {
           setLayout(new BorderLayout());
           b=new JButton("Press");
           add(b,BorderLayout.SOUTH);
           b.addActionListener(new ActionListener(){
           public void actionPerformed(ActionEvent e)
            {
             b.setText("Clicked");
            }
          });
        }

        public static void main (String[] args) {
            frame f=new frame();
            f.setExtendedState(MAXIMIZED_BOTH);
            f.setVisible(true);
        }
      }


text:
Q: Phonegap FileTransfer appears to do nothing in android I'm having problems with the Phonegap FileTransfer API. Currently I'm trying to run the example code below:
        saveFile: function (filepath,location, filetype) {
            console.log("FUNCTION BEING CALLED");
            var self = this;
            //filepath is path to the internets file
            //location is where on the device the file will be stored
            var fileTransfer = new FileTransfer();
            fileTransfer.download(filepath,self.rootPath + location + '.' + filetype,
                function (entry) {
                    console.log('############# DOWNLOAD WORKS ##############');
                    console.log("download complete: " + entry.fullPath);
                },
                function (error) {
                    console.log('############# DOWNLOAD FAILS ##############');
                    console.log("download error source " + error.source);
                    console.log("download error target " + error.target);
                    console.log("upload error code" + error.code);
                }
            )
        }

Currently, nothing at all appears to be happening. No errors are flagged, and the callbacks don't appear to be firing. All I get is the initial console.log of "FUNCTION BEING CALLED".
I've double checked, and can confirm that I'm including the cordova js file, (cordova-2.4.0.js).
If it matters, I've tried this on the Android Emulator, a HTC One X and a Samsung Galaxy S3, all with the same results.
Does anyone know what could be causing this?
Edit: I also felt I should mention that it's all running in an Angular JS app as well.

A: this  is how i am doing it in my project
 document.addEventListener("deviceready", onDeviceReady, false);

 function onDeviceReady() {
     window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
  }
 function gotFS(fileSystem) {
    window.fileSystem = fileSystem;
    //create directory test_app
    fileSystem.root.getDirectory("test_app", {
        create : true,
        exclusive : false
    }, dirWallpaper, fail);

 function fail(evt) {

 }

function dirWallpaper(entry) {
    //save the directory path
    window.testDir = entry;
}
//now download file to that location
saveFile: function (filepath,location, filetype) {
        console.log("FUNCTION BEING CALLED");
        var self = this;
        //filepath is path to the internets file
        //location is where on the device the file will be stored
        var fileTransfer = new FileTransfer();
        var path = window.testDir.fullPath + "/test_pdf."+ filetype;
        fileTransfer.download(filepath,path,
            function (entry) {
                console.log('############# DOWNLOAD WORKS ##############');
                console.log("download complete: " + entry.fullPath);
            },
            function (error) {
                console.log('############# DOWNLOAD FAILS ##############');
                console.log("download error source " + error.source);
                console.log("download error target " + error.target);
                console.log("upload error code" + error.code);
            }
        )
    }

try like this and let me know.


text:
Q: Java RMI Registry from within Jar file I have a problem involving RMI Registry creation and obtention within the scope of a distributed processing tool. First of all, I will describe briefly my environment:
ENVIRONMENT
I need a background Java process to be executed permanently. The instances of my software (in the same physical machine) need to communicate with that process in order to perform some operations. The solution I found months ago to communicate different JVM's on the same physical machine was Java RMI. So, I launch the background process and create a Registry from it:
    CAEATServiceManagerInterface smi = (CAEATServiceManagerInterface)UnicastRemoteObject.exportObject(csm, 0);
    Registry registry = LocateRegistry.createRegistry(8090);
    registry.rebind("ServiceManager", smi);

Notes: csm is the Remote object to be exported. Security policy has been properly installed (AllPermission for everybody) and so has been the RMISecurityManager.
For now on, instances of my main program are able to Lookup the Registry and obtain the Remote object at any given moment:
    Registry registry = LocateRegistry.getRegistry(8090);
    smi = (CAEATServiceManagerInterface)registry.lookup("ServiceManager");

PROBLEM
The problem arises when my program (both the main program that obtains the Registry and the background program that creates it) is executed from within a jar file. If they're executed from Eclipse, everything works fine. If they are executed directly from command-line, it is also OK. But when they are packed into an auto-executable jar file for distribution, the background process seems to create the Registry fine, but when the main program tries to Lookup it, this happens:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
    java.io.EOFException
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at sener.caeat.autoejecutable.PublicadorStandalone.getServiceManagerInterface(PublicadorStandalone.java:170)
    at sener.caeat.autoejecutable.PublicadorStandalone.publicarEsquema(PublicadorStandalone.java:319)
    at sener.caeat.autoejecutable.CargadorStandalone.mostrarDialogoOpcionesPublicacion(CargadorStandalone.java:415)
    at sener.caeat.autoejecutable.ExtractorJars.main(ExtractorJars.java:32)
Caused by: java.io.EOFException
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2553)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1296)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    at sun.rmi.server.MarshalInputStream.readLocation(MarshalInputStream.java:285)
    at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:228)
    at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1530)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1492)
    at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
    ... 5 more

Forget about my classes, what I don't understand is the EOFException... Why is it only launched when the program is executed from within a jar?
Aditional data: if the background program is launched from within the jar file, but the main program that Lookups the Registry is launched from Eclipse, the probles is still there.
Thanks in advance.

A: This is usually caused by SecurityExceptions relating to SocketPermissions at the other side causing the incoming connection to be closed prematurely. Have a look at its log.

A: At last I found the solution. It was not directly related to RMI, but with the way my program was being packed into an autoexecutable jar file.
One of the particularities my sub-process is that it uses a custom RMI ClassLoader to handle some stuff related to custom remote class resolution. This is achieved by means of the following statement:
System.setProperty("java.rmi.server.RMIClassLoaderSpi","<My_custom_RMI_ClassLoader>");

Remember: this is executed from within a jar file. The class "My_custom_RMI_ClassLoader" is inside the jar, and that's why the exception thrown was not a ClassNotFoundException. But, and here comes my mistake, this class has an inner class inside it (one of those whose name ends with $innerClass.class). And that .class file WASN'T BEING PACKED INSIDE THE JAR FILE. I suppose that's the reason for the EOFException when the proxy class was being resolved.
Thank you very much, but the problem was more subtle than I thought.


text:
Q: Polygon: Solidity build failed for 'pragma solidity ^0.8.7' with chainlink In polygon chain, the latest chainlink version not support.
If I remove chainlink library, it deploy sucessfully.
Chainlink 0.8 working fine in 'ropston test' network. But in 'Mumbai test net', not able to deploy contract.
hardhat.config.js [edit:1]

error log:

remix error log:

A: You can deploy the contract with Remix Ide Online, web3 connection with Metamask.
Can you share your hardhat config file or error logs?
This should be inside your hardhat env.
    mumbai: {
  url: "https://rpc-mumbai.matic.today",
  // url: API_URL, //or Infura API  URL
  accounts: [`0x${PRIVATE_KEY}`],
    gasPrice: 10000000000,
    gasLimit: 9000000
},

Edit: It's failing because cant estimate gasLimit of the transaction. You can set it manually.
Inside your deploy.js script set the gasPrice and gasLimit. Depending on you are using web3js or etherjs this code will be different. This is example of another minting function.
FT = await contract.ownerMint(WALLET_ADDRESS,{ gasLimit: 285000, gasPrice: ethers.utils.parseUnits('30', 'gwei')});

Edit2: you can always deploy it with remix online with Metamask


text:
Q: Vue packages version mismatch I'm trying to add unit testing to an existing vue project via jest, but when I attempt to run my first test I get an error that says

Vue packages version mismatch:

- vue@2.5.16
- vue-template-compiler@2.6.6

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.

But looking at my packages, my current vue version is 2.6.6 not 2.5.16. I have no idea where it's seeing this 2.5.16 version. I don't have vue installed globally, only @vue/cli@3.4.0. Any help would be appreciated. Below you can find my package.json that contains my jest configuration.

{
  "version": "1.0.0",
  "name": "asp.net",
  "private": true,
  "dependencies": {
    "@babel/core": "^7.4.0",
    "@tinymce/tinymce-vue": "^1.1.0",
    "@types/bootstrap": "^3.3.40",
    "@types/jest": "^24.0.11",
    "@types/jquery": "^2.0.51",
    "@types/jquery.validation": "^1.16.5",
    "@types/jqueryui": "^1.12.6",
    "@types/kendo-ui": "^2018.3.0",
    "@types/knockout": "^3.4.60",
    "@types/moment": "^2.13.0",
    "axios": "^0.18.0",
    "axios-cache-adapter": "^2.1.1",
    "browser-detect": "^0.2.28",
    "es6-promise": "^4.2.5",
    "file-saver": "^1.3.8",
    "knockout": "^3.4.2",
    "moment-timezone": "^0.5.23",
    "query-string": "^6.2.0",
    "tinymce-vue": "^1.0.0",
    "url-search-params-polyfill": "^5.0.0",
    "vee-validate": "^2.1.3",
    "vue": "^2.6.6",
    "vue-class-component": "^6.3.2",
    "vue-multiselect": "^2.1.3",
    "vue-notification": "^1.3.13",
    "vue-property-decorator": "^7.2.0",
    "vue-router": "^3.0.2",
    "vuejs-datepicker": "^1.5.4",
    "vuex": "^3.0.1",
    "vuex-persistedstate": "^2.5.4"
  },
  "scripts": {
    "dev": "webpack --mode development --watch --hot",
    "test": "npm run test:unit",
    "test:unit": "jest",
    "build": "webpack --mode production",
    "output": "webpack --profile --json > stats.json"
  },
  "devDependencies": {
    "@types/file-saver": "^1.3.1",
    "@vue/test-utils": "^1.0.0-beta.29",
    "babel-core": "^6.26.3",
    "babel-jest": "^24.7.1",
    "babel-loader": "^8.0.4",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-3": "^6.24.1",
    "css-loader": "^1.0.1",
    "hard-source-webpack-plugin": "^0.13.1",
    "jest": "^23.4.2",
    "node-sass": "^4.10.0",
    "printd": "^1.0.1",
    "sass-loader": "^7.1.0",
    "ts-jest": "^23.10.5",
    "ts-loader": "^4.5.0",
    "typescript": "^3.2.1",
    "uglifyjs-webpack-plugin": "^2.0.1",
    "vue-jest": "^3.0.4",
    "vue-loader": "^15.4.2",
    "vue-template-compiler": "^2.6.6",
    "webpack": "^4.28.4",
    "webpack-bundle-analyzer": "^3.0.3",
    "webpack-cli": "^3.1.2",
    "webpack-hot-middleware": "^2.24.3"
  },
  "jest": {
    "moduleFileExtensions": [
      "js",
      "ts",
      "json",
      "vue"
    ],
    "moduleDirectories": [
      ".",
      "<rootDir>/Scripts",
      "<rootDir>/Scripts/VueModules",
      "<rootDir>/Scripts/VueModules/SharedComponents",
      "<rootDir>/Scripts/VueModules/Candidates/",
      "node_modules"
    ],
    "moduleNameMapper": {
      "^@candidates$": "<rootDir>/Scripts/VueModules/Candidates",
      "^@shared$": "<rootDir>/Scripts/VueModules/SharedComponents",
      "^@app$": "<rootDir>/Scripts/VueModules",
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/Scripts/VueModules/__mocks__/fileMock.js",
      "\\.(css|less|scss|sass)$": "<rootDir>/Scripts/VueModules/__mocks__/styleMock.js"
    },
    "transform": {
      ".*\\.(vue)$": "vue-jest",
      "^.+\\.tsx?$": "ts-jest"
    },
    "transformIgnorePatterns": [
      "node_modules/(?!vue)"
    ],
    "testURL": "http://localhost/",
    "testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$"
  }
}

A: You have  "vue": "^2.6.6", and "vue-template-compiler": "^2.6.6", in your package.json meaning any version matching 2.6.6 or higher will be installed that explain the vue@2.5.16. Your package-lock.json file set the current version to which the package has been updated to, you can verify from there which version both vue and vue-template-compiler
You can run npm update or npm install vue-template-compiler@2.5.16 --save-dev to get both on the same version
Running the following command helped me
npm install vue-template-compiler@2.5.16 --save-dev
NB. Replace the version number with the right version that you need. In my case, the version of vue was 2.5.16 and vue-template-compiler was 2.5.13 hence I updated the vue-template-compiler to the version of the vue.
Hope this helps someone
Vue packages version mismatch error fix

A: npm update fixed the same problem for me.

A: Add the following lines to your Package.json
"vue-template-compiler": "^2.6.12"
and then run npm install in terminal.


text:
Q: jQuery/Ajax call - It Doesn't work on IE7 i make a Jquery function that (for the moment) call a function dinamically and print it with an alert. with firefox, chrome : it works! when i try on IE7 (the first time), it fails. If i reload the page (F5) and retry , it works! o_O
I FINALLY understand why that's happen. In my old website i used the jquery-1.3.2.min.js library. On this i use the jquery-1.4.2.js and in fact it doesnt work. So what's up? A bug in this new version?
cheers
EDIT
actual functions (with Bryan Waters suggestions):
// html page
prova

// javascript page
function pmNew(mexid) {
    var time = new Date;
    $.ajax({
        type: 'POST',
        cache: false,
        url: './asynch/asynchf.php' + '?dummy=' + time.getTime(),
        data: 'mexid='+escape(mexid)+'&id=pmnew',
        success: function(msg) {
            alert(msg);
        }
    });
    return false;
}

// ajax.php
if($_POST['id']=="pmnew") {
    echo "please, i will just print this";
}

Fiddler result : if i use http://localhost/website fiddler doesnt capture the stream. if i use http://ipv4.fiddler/website it capture the stream, but at the ajax request doesnt appair. if i refresh the page, yes it works. mah...i really don't know how resolve this problem...

A: ok, I'm not exactly sure what the issue is here but I think you could probably fix this by simply letting jquery handle the click instead of the inline attribute on the tag.
first change your link like this to get rid of the inline event
<a class="lblueb" href="./asynch/asynchf.php?mexid=<?$value?>"><?=value?>

then in your javascript in the head of your page add a document.ready event function like this if you don't already have one:
$(function(){

});

then bind a click event to your link inside the ready function using the class and have it pull the mexid from the href attribute, then call your pmNew function like so:
$(".lblueb").click(function(e){

  e.preventDefault();

  //your query string will be in parts[1];
  parts = $(this).attr("href").split("?");
  //your mexid will be in mexid[1]
  mexid = $parts[1].split("=");

  //call your function with mexid[1] as the parameter
  pmNew(mexid[1]);

});

Your final code should look like this:

A: Best way to debug is to download Fiddler and see what the HTML traffic is going on and if the browser is even making the ajax request and what the result is 200 or 404 or whatever.
I've had problems with IE cacheing even on posts. And not even sending out the requests. I usually create a date object in javascript and add a dummy timestamp just to make the url unique so it won't be cached.

A: I believe you have an error in your SQL code. Is userd supposed to be userid?
Gaby is absolutely right that your SQL code is wide open for injection. Please consider learning PDO, which will reduce the likelihood of SQL injection significantly, particularly when using placeholders. This way you will have query($sql) and execute($sql), rather than the code going directly into your DB.

A: As a matter of habit you should deal with your request variables early in your script, and sanitize them to death -- then assign the cleaned results to new variables and be strict in only using them throughout the rest of the script. As such you should have alarm bells ringing whenever you have a request variable in or near an sql query.
For example at the very least you should be stripping any html tags out of anything that will get printed back to the page.
That is in addition to escaping the quotes as part of the sql string when inserting into the database.
I'm all for coding things up quickly -- sure, neaten up your code later... but get security of request vars right before doing anything. You can't tack on security later.
Anyway sorry for harping on.... as for your actual problem, have you tried what Gaby suggested: change your html to:
<a class="lblueb" href="#" onclick="return pmNew('<?php echo $value; ?>')"><?php echo $value; ?>

And then update your JS function to:
function pmNew(mexid) {
    $.ajax({
        type: 'POST',
        cache: false,
        url: './asynch/asynchf.php',
        data: 'mexid=' + escape(mexid) + '&id=pmnew',
        success: function(msg) {
            $('#pmuser').html('PANEL (' + msg + ')');
        }
    });
    return false;
}

Also, with IE -- check the obvious. Clear the browser cache/history

A: I didn't understood the "fail", but here's another example..
function pmNew(mexid) {
    $.post("./asynch/asynchf.php", {mexid: mexid, id: "pmnew"},
        function(msg) {
            $("#pmuser").html('PANEL ('+msg+')');
        }
    });
}

A: It appears that this issue is faced by several people.
One of them had luck with clean installation of browser:
http://www.geekstogo.com/forum/topic/22695-errorpermission-denied-code0/

A: Check to make sure the content returned to the DOM is valid for the DOCTYPE specified.
I've had a similiar problem with Chrome, FF and Safari all working just fine, but finding the ajax result broken in IE. Check to make sure you don't have any extra divs or spans in the ajax result breaking your markup.


text:
Q: Use regex to enforce cell validation? Using Excel 2010.  I want to only allow values in a cell that fit a given regex pattern.  So I created a UDF module as follows:
Public re as RegExp

Public Function isValidRegex(rng As Range, pattern As String) As Boolean

If re Is Nothing Then
    Set re = New RegExp
End If

re.pattern = pattern

isValidRegex = re.Test(rng.value)

End Function

I created a named range called THIS_CELL, so that the current cell can be passed to isValidRegex(), as follows:
=INDIRECT(ADDRESS(ROW(),COLUMN()))

I set a custom validation for the cell, using this formula:
=isValidRegex(THIS_CELL,"(my|regex)patt[ern]")

This generated the following error:
A named range you specified cannot be found.

According to this article, UDFs cannot be used in Custom validation formulas.  The solution suggested in the article (putting the formula in another cell, making that cell into a named range, and referencing that cell in the Custom formula) won't work, because I need to be able to pass THIS_CELL as an argument to the function.
I also tried creating a named range called isValidRegexPattern, defining it as =isValidRegex(THIS_CELL,"(my|regex)patt[ern]"), and setting the Custom formula to =isValidRegexPattern, but this didn't work either; putting a breakpoint in isValidRegex() showed that the function wasn't even being called.
So, how can I use a UDF for cell validation?

A: You can use a static variable with the Worksheet_Change event to keep a snapshot of the prior values
The code below tracks the values in A1:A10 and uses a Regexp like yours to reject any non-numeric entries
The example below tries top copy and paste B1:B10 over A1:A10, only A6and A8 are allowed as they are numeric
to set the range initially change a cell outside the range of interest to trigger  If IsEmpty(X) Then X = [a1:a10].Value2

change event
Private Sub Worksheet_Change(ByVal Target As Range)

Static X As Variant
Dim rng2 As Range
Dim rng3 As Range

If IsEmpty(X) Then X = [a1:a10].Value2

Set rng2 = Intersect([a1:a10], Target)
If rng2 Is Nothing Then Exit Sub

Application.EnableEvents = False
For Each rng3 In rng2
    If Not isValidRegex(rng3, "\d+") Then rng3.Value = X(rng3.Row, 1)
Next
Application.EnableEvents = True

X = [a1:a10].Value2

End Sub

regexp
Function isValidRegex(rng As Range, pattern As String) As Boolean
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.pattern = pattern
isValidRegex = re.Test(rng.Value)
End Function

A: You seem to be reluctant to move over to a WorksheetChange event macro because you believe it does not 'capture the pre-change state of the cell'. That may be correct in the strictest definition but that doesn't mean you cannot capture the changed state, undo the change, determine whether the change is valid and only re-apply the change if it meets criteria.
I'm not going to produce a full regex validating function. This simply tests if the number typed into column E is less than zero or blank. If not then the cell reverts to its prechange state.
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count > 1 Then Exit Sub
    If Not Intersect(Target, Columns(5)) Is Nothing Then
        If Not IsEmpty(Target) Then
            On Error GoTo Safe_Exit
            Application.EnableEvents = False
            Dim vNEW As Variant
            vNEW = Target.Value
            Application.Undo
            If bIs_It_Valid(vNEW) Then
                Target = vNEW
            Else
                ' put stuff like idiot warnings here
            End If
        End If
    End If
Safe_Exit:
    Application.EnableEvents = True
End Sub

Private Function bIs_It_Valid(val As Variant) As Boolean
    If IsNumeric(val) Then _
        bIs_It_Valid = CBool(val < 0)
    Debug.Print bIs_It_Valid
End Function

That Worksheet_Change could probably be adjusted to work on a range of cells if pasting a number of values is important.

A: Here's how I accomplished this without using the Worksheet_Change event

Define a Public REGEX Function in a new Module

'Public REGEX Formula
Public Function REGEX(pattern As String, cel As Range) As Boolean
    Dim re As New RegExp
    re.pattern = pattern
    REGEX = re.Test(cel.Value)
End Function

I added this Sub to a module I named Validations. This Sub requires not only the range to validate and the regular expression pattern, but also another range to apply the REGEX formula to. The actual validation applied actually only checks that separate cell for a True or False value. This is a simplified version that assumes the validationColumn is an entire column.

'Validations Module
Sub regexValidation(cells As Range, pattern As String, validationColumn As Range, defaultValue As String)
    Dim cel As Range, regexFormula As String, validationCell As Range

    cells.Value = defaultValue

    'Need to match true on default value or validation will always fail
    pattern = "(" & defaultValue & ")|(" & pattern & ")"

    For Each cel In cells
        regexFormula = "=REGEX(""" & pattern & """," & cel.address & ")"
        Set validationCell = validationColumn.cells(cel.Row, 1)
        validationCell.Formula = regexFormula
        cel.Validation.Delete
        cel.Validation.Add xlValidateCustom, Formula1:="=" & Trim(validationCell.address)
    Next cel
End Sub

This is how I'm calling it. In my case, this is a UserForm with a TextBox called regexPattern that contains the regular expression to apply.

'Form
Private Sub applyRegexValidation(cells As Range)
    Validations.regexValidation cells, regexPattern.text, validationColumn:=cells.Parent.Range("AA:AA"), defaultValue:="Required Custom"
End Sub


text:
Q: Input left padding make cursor jump I have basic
HTML

  //you need to use Font awesome
  <input type="text" id="inputField"/>

CSS
#searchIcon{
  position:absolute;
  font-size:14px;
  padding-top:6px;
  padding-left:3px;
}
#inputField{
  padding-left:20px;
}

So when I click on that input cursor caret appears first at the left inside input field(ignoring padding) and then jump to the correct position. Is there is a way to prevent this behavior?

A: Here's a way to work around that problem.  Since the cursor jumps when you do it that way, enclose the <input> in a wrapper so you can have your icon on the left, and the input box next to it.  For all intents and purposes, it will look the same to the user.  That way, you don't need to move the cursor.
See the code below for a working example.  I added a wrapper around the input that you can't see, and changed the padding shift to a margin shift.  (I used a basic HTML icon as a placeholder for your Font Awesome icon.)

#searchIcon{
  position:absolute;
  font-size:14px;
  padding-top:6px;
  padding-left:3px;
}

#inputField{
  margin-left:20px;
  border: none;
}

#wrapper {
  height: 1.2em;
  width: 11em;
  border: 1px solid black;
  background-color: white;
}

  🔎
  <input type="text" id="inputField"/>


text:
Q: LINQ to Entities does not recognize the method 'Int32 ToInt32(System.Object)' method I wrote this SQL query
select
    acc.DepartmentID,
    dept.DepartmentName,
    dept.DepartmentDivision,
    county.CountyName,
    sp.StateProvinceID
from [AccountDepartmentXREF] acc
inner join [Department] dept on dept.DepartmentID = acc.DepartmentID
left join [DepartmentStateCountyXREF] dscx on dscx.DepartmentID = acc.DepartmentID
left join [StateCounty] county on county.StateCountyID = dscx.StateCountyID
inner join [StateProvince] sp on sp.StateProvinceID = dept.StateProvinceID
where acc.AccountID = 1

and want to rewrite it using LINQ, but I always get confused when writing left joins in LINQ, so I decided to use a convertor and went with Linqer and this is what it produced
from acc in db.AccountDepartmentXREF
join dscx in db.DepartmentStateCountyXREF on acc.DepartmentID equals dscx.DepartmentID into dscx_join
from dscx in dscx_join.DefaultIfEmpty()
join county in db.StateCounty on new { StateCountyID = Convert.ToInt32(dscx.StateCountyID) } equals new { StateCountyID = county.StateCountyID } into county_join
from county in county_join.DefaultIfEmpty()
join sp in db.StateProvince on acc.Department.StateProvinceID equals sp.StateProvinceID
where
acc.AccountID == 1
select new {
acc.DepartmentID,
acc.Department.DepartmentName,
acc.Department.DepartmentDivision,
CountyName = county.CountyName,
sp.StateProvinceID
}

so when I put everything together in code
public List<DepartmentList> GetDepartmentsByAccountID(string email)
    {
        HWC = new HWCEntities();
        List<DepartmentList> result = new List<DepartmentList>();

        int id = CurrentUserID(email);

        List<AccountDepartmentXREF> adx = HWC.AccountDepartmentXREFs.Where(w => w.AccountID == id).ToList();

        foreach(var a in adx)
        {
            var query = from acc in HWC.AccountDepartmentXREFs
                        join dscx in HWC.DepartmentStateCountyXREFs on acc.DepartmentID equals dscx.DepartmentID into dscx_join
                        from dscx in dscx_join.DefaultIfEmpty()
                        join county in HWC.StateCounties on new { StateCountyID = Convert.ToInt32(dscx.StateCountyID) } equals new { StateCountyID = county.StateCountyID } into county_join
                        from county in county_join.DefaultIfEmpty()
                        join sp in HWC.StateProvinces on acc.Department.StateProvinceID equals sp.StateProvinceID
                        where
                          acc.AccountID == a.AccountID
                        select new
                        {
                            acc.DepartmentID,
                            acc.Department.DepartmentName,
                            acc.Department.DepartmentDivision,
                            CountyName = county.CountyName,
                            sp.StateProvinceID
                        };

            foreach(var b in query)
            {
                result.Add(new DepartmentList
                {
                    DepartmentID = b.DepartmentID,
                    DepartmentName = b.DepartmentName,
                    StateProvinceID = b.StateProvinceID,
                    DivisionName = b.DepartmentDivision,
                    CountyName = b.CountyName
                });
            }
        }

        return result;
    }

I get the error

LINQ to Entities does not recognize the method 'Int32 ToInt32(System.Object)' method, and this method cannot be translated into a store expression.

at the

foreach(var b in query)

Any idea's on how to fix this? I have looked around but other solutions I found aren't dealing with joins

A: Linq doesn't support the Convert.ToInt32(dscx.StateCountyID) method inside the query because this will need to be converted to sql for execution on the db.
I am not sure what datatype StateCountyID is in both tables but you will need to use some sql compatible conversion method like SqlFunctions.StringConvert() to get them to the same datatype.

A: Convert them to Strings
from acc in HWC.AccountDepartmentXREFs
                        join dscx in HWC.DepartmentStateCountyXREFs on acc.DepartmentID equals dscx.DepartmentID into dscx_join
                        from dscx in dscx_join.DefaultIfEmpty()
                        join county in HWC.StateCounties on new { StateCountyID = dscx.StateCountyID.ToString() } equals new { StateCountyID = county.StateCountyID.ToString() }

or use the below:
dscx.StateCountyID equals SqlFunctions.Convert(county.StateCountyID)

A: I figured out why I was getting that error. It was because I had StateCountyID as nullable in my DepartmentStateCountyXREF table. Once I changed the StateCountyID column from a nullable and then removed the Convert.ToInt32, everything worked.


text:
Q: how to convert int to vector? When I assign int to vector I get an error says  "conversion from 'int' to non-scalar type 'std::vector<int, std::allocator<int> >' requested", what should I do?
I have vector varr(4, -1); what is the right way to do "varr[2] = 3"?

A: They're two different types.  If you want to add an int to a vector<int> do something like:
std::vector<int> vec;
vec.push_back(10);
Update: To set an element within the vector:
std::vector<int> vec(16, 0); // Create a 16 element vector containing all 0's
vec[4] = 10; // Sets the 5th element (0 based arrays) to 10
There appears to be a thorough codeguru tutorial which might be of interest.

A: A vector is a collection of ints. You can not assign an int to the collection, you add it to the collection using the push_back() function:
std::vector<int> manyInts;
int oneInt = 42;
manyInts.push_back(oneInt);

A: If you want to add the int to to a vector<int> you should use push_back:
vector<int> v;
int i = 5;
v.push_back(i);

A: int sum = 468;
vector<int> v;
while(sum!=0){
 v.push_back(sum%10);
        sum /= 10;
    }
reverse(v.begin(), v.end());


text:
Q: How to have myname.github.io as url of a personal website on GitHub? I want to set up a personal website on Github. I followed this video to create a repository containing a file index.html.
I read online that in order to obtain an url <myname>.github.io for this html page, you need to name the respository <myname>.github.io. But when I do this, the html page gets published to <accountname>.github.io/<myname>.github.io. Did I do something wrong?

A: From https://pages.github.com:

Head over to GitHub and create a new repository named
  username.github.io, where username is your username (or organization
  name) on GitHub.
If the first part of the repository doesn't exactly match your
  username, it won't work, so make sure to get it right.


text:
Q: absolute or conditional convergence I am doing an exercise but in the middle I am stuck.
$$\sum_{k=2}^\infty \frac{[\ln(k+1)-\ln k]^a}{\ln^2k}$$
I have rewritten this as:
$$\sum_{k=2}^\infty \frac{[\ln(k+1)/k)]^a}{\ln^2k}$$
Now $a_k=\frac{\ln^a(k+1)/k)}{\ln^2k}$, and apply a Taylor series expansion.
Now I wrote: $a_k = \frac{1}{\ln^2k}\left[\frac{1}{k}-\frac{1}{2k^2} + O\left( \frac 1 {3k^3}\right)\right]^a$. By dividing by $\frac{1}{k}$, and applying the binomial expansion, obtaining
$$a_k=\frac{1}{k^a \ln^2k}(1-\frac{a}{2k}+\cdots)$$
But how to proceed? Perhaps I started completely wrong?

A: HINT:
Using the inequalities
$$\frac{x}{x+1}\le \log(1+x)\le x$$
we see that
$$\frac{1}{(k+1)^a\log^2(k)} \le \frac{\log^a\left(1+\frac1k\right) }{\log^2(k)}\le \frac{1}{k^a\log^2(k)}$$
Can you conclude now?


text:
Q: How make a join table like bellow in laravel Helllo, i want to do a join between tow tables in laravel, but if table B has no rows query return null.
What i want is like this.
table A

id user_id description
1    1      something
2    1       apple
3    2       cherry

table B

user_id post_id vote
(with no records initial)

result table

    id user_id description post_id  vote
    1    1      something    null   null
    2    1       apple       null   null
    3    2       cherry      null   null

How can i do that?
Thank you in advance and I apologize for the worse English.

A: you should use leftJoin
 DB::table("tableA")->leftJoin("tableB","tableA.user_id",'=','tableB.user_id')
           ->select(["tableA.id as id",'tableA.user_id as user_id','description','post_id','vote'])->get();

A: You can leverage eloquent relations to get the desired output
Assume Table A is represented by ModelA and Table B is represented by ModelB

class ModelA extends Model
{
    //Get all related ModelB records
    public function kids()
    {
        return $this->hasMany(ModelB::class, 'user_id', 'user_id');
    }
}

class ModelB extends Model
{
    //Get the ModelA record to which the ModelB record belongs
    public function parent()
    {
        return $this->belongsTo(ModelA::class, 'user_id', 'user_id');
    }
}

Now you can get all ModelB (related) records for a ModelA record anywhere

$modelA = ModelA::with('kids')->first();

$modelA->kids //These records will hold values from Table B

Or using QueryBuilder

$rows = DB::table('TableA')
    ->leftJoin('TableB', 'TableA.user_id', '=', 'TableB.user_id')
    ->select('id', 'TableA.user_id', 'description', 'post_id', 'vote');

Eloquent or Query Builder is a choice to make

A: Let assume Table A is User model and Table B is Post model.
Eloquent query:
$users = User::leftJoin('posts', function($join) {
      $join->on('users.id', '=', 'posts.user_id');
    })
    ->whereNull('posts.user_id')
    ->first([
        'users.id',
        'users.description',
        'posts.id',
        'posts.vote'
    ]);


text:
Q: Convergence of exponential random variables - conditions for $\lambda_n$ Let $X_n$ be independent sequence of random variables with exponential distributions with parameters $\lambda_n$. What are the necessary conditions for sequence $\lambda_n$ for $X_n$ to be convergent almost surely to 0?
I already know(due to Borel-Cantelli's Lemma) that both necessary and sufficient condition is that for arbitrary $\varepsilon > 0$ $\sum_{n=1}^{\infty} \mathbb{P}(|X_n| > \varepsilon)$ must converge.
For this to be true, we fix $n > 0$ (no need to wander in reals, $\frac{1}{n}$ will be enough) and look at:
\begin{align}
\sum_{n=1}^{\infty} \mathbb{P}(|X_n| > \frac{1}{n}) &= \sum_{n=1}^{\infty} 1 - \mathbb{P}(|X_n| \leq \frac{1}{n}) =  \sum_{n=1}^{\infty}  1 - \mathbb{F}_X(\frac{1}{n}) \\
&= \sum_{n=1}^{\infty} 1 - (1 - e^{-\lambda_n \frac{1}{n}}) = \sum_{n=1}^{\infty} e^{-\frac{\lambda_n}{n}}
\end{align}
I got stuck here - I think the next step would be somehow deducing what $\frac{\lambda_n}{n}$ must converge to, to make the entire series convergent. How can we deduce it though?
Note this is a similar question to that one, but I am looking for the necessary conditions for $\lambda_n$.

A: Firstly, an error in your thinking:
It is not at all the same thing if you set $\varepsilon_n$ as a sequence depending on $n$.
The mechanics of this will become clearer if you consider what B-C is saying. Since $X_n \ge 0$ surely, it suffices to argue that $\limsup X_n = 0$ a.s.. What does this mean? By definition, it is that for every $\varepsilon > 0,$ there is some $N_\varepsilon$ such that the event $\{\forall n> N_{\varepsilon}, X_n < \varepsilon\}$ occurs a.s. B-C is in essence using the union bound for this - $$ P(\exists n > N: X_n > \varepsilon\} \le \sum_{n > N} P(X_n > \varepsilon)$$
and convergence of the upper bound $\sum_{n = 1}^\infty P(X_n > \varepsilon)$ is enough for this to become arbitrarily small after some $N$.
In fact, setting $\varepsilon_n = 1/n$ is equivalent to studying $\limsup n X_n$, and the sufficient condition you have set up tells you that this is bounded by $1$ a.s. (Exercise - write this out explicitly). Certainly this implies that $X_n$ go to $0$ a.s., but this is not all such $X_n$.
Next, the necessary condition:
For independent $X_n$, B-C is the complete story. This is the so-called second Borel-Cantelli Lemma, which for this setting gives :if the $X_n$ are independent, and for some $\varepsilon > 0$ $\sum P(X_n > \varepsilon) = \infty,$ then $\limsup X_n \ge \varepsilon$ a.s. - which implies that $X_n > \varepsilon/2 > 0$ infinitely often. In particular, this means that the condition $$ \forall \varepsilon > 0: \sum e^{-\lambda_n \varepsilon} < \infty$$ is both necessary and sufficient.
It seems you want what growth rate $\lambda_n$ as a function of $n$ is necessary for this to happen. This is one of those things that doesn't have a neat answer. For instance, clearly $\lambda_n = \log n$ doesn't suffice, because for small enough $\varepsilon$ $e^{-\varepsilon \log n} > 1/n$. Also clearly, $\lambda = \Omega( \log^{1 + c} n)$ is sufficient for any $c > 0$, since then eventually $e^{-\lambda_n \varepsilon} \le \frac{1}{n^{\varepsilon \log^c n}} \le \frac{1}{n^2}$ (taking $n > \exp((2/\varepsilon)^{1/c}$)
We can start refining this. Take $\mu_n := \frac{\lambda_n}{\log n}$. The same reasoning as above tells us that if $\liminf \mu_n = \infty,$ then we have convergence for every $\varepsilon$, while if $\limsup \mu_n < \infty,$ then we have divergence.
The boundary case of $\liminf \mu_n < \infty, \limsup \mu_n = \infty$ can have both behaviours - if $\mu_n = 1 + n\mathbf{1}\{ n \textrm { is odd}\},$ then we'll have divergence for small $\varepsilon,$ but if $\mu_n = 1 + n\mathbf{1}\{ n \textrm{ is not a power of $2$}\}$ then we'll have convergence for every $\varepsilon$. One can presumably start refining this as well, but its already quite messy. The B-C condition is a neat way to encapsulate all of this.


text:
Q: ReactNative issue with contructor saying ';' error This is my code want to implement an add country and region drop down. I am facing and error at 7,8 line saying semicolon is missing. I would like help as i am beginner at reactnative.
import React,{ Component } from 'react';
import { CountryDropdown, RegionDropdown } from 'react-country-region-selector';
import { StyleSheet, Text, TextInput, View } from 'react-native';

export default function App extends Component() {
  constructor(props) {
    super(props);
    this.state = { country: '', region: '' };
  };
  selectCountry=(val)=>{
    this.setState({ country: val });
  };

  selectRegion=(val)=>{
    this.setState({ region: val });
  };
  const { country, region } = this.state;
  return (
    <View style={styles.container}>
      <View style={styles.line}>
        <Text style={styles.text}>Enter name:</Text>
        <TextInput
        style={styles.input}
        placeholder='e.g. John Doe'
        />
      </View>
      <View style={styles.line}>
        <Text style={styles.text}>Enter Age:</Text>
        <TextInput
        keyboardType='numeric'
        style={styles.input}
        placeholder='2'
        />
      </View>
      <View style={styles.line}>
        <Text style={styles.text}>Enter Country:</Text>
        <CountryDropdown
          value={country}
          onValueChange={(val) => this.selectCountry(val)} />
      </View>
      <View style={styles.line}>
        <Text style={styles.text}>Enter Region:</Text>
        <RegionDropdown
          country={country}
          value={region}
          onValueChange={(val) => this.selectRegion(val)} />
      </View>

    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex:1,
    backgroundColor: '#fff',
    alignItems:'center',
    justifyContent:'center',
  },
  line:{
    flexDirection:'row',
    flex:0,
    marginBottom:5,
  },
  text:{
    flex:1,
  },
  input:{
    flex:1,
    width:70,
    borderBottomWidth:1,
    borderBottomColor:'#777',
  },

});

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

A: You are using a class component but calling it a function ....
change export default function App extends Component() { to export default class App extends Component(){
also add a render() function with appropriate surrounding brackets
new code below
import React,{ Component } from 'react';
import { CountryDropdown, RegionDropdown } from 'react-country-region-selector';
import { StyleSheet, Text, TextInput, View } from 'react-native';

export default class App extends Component() { <-- change here
  constructor(props) {
    super(props);
    this.state = { country: '', region: '' };
  };
  selectCountry=(val)=>{
    this.setState({ country: val });
  };

  selectRegion=(val)=>{
    this.setState({ region: val });
  };
  render() { <-- add here
    const {country, region} = this.state;

    return (
      <View style={styles.container}>
        <View style={styles.line}>
          <Text style={styles.text}>Enter name:</Text>
          <TextInput
            style={styles.input}
            placeholder='e.g. John Doe'
          />
        </View>
        <View style={styles.line}>
          <Text style={styles.text}>Enter Age:</Text>
          <TextInput
            keyboardType='numeric'
            style={styles.input}
            placeholder='2'
          />
        </View>
        <View style={styles.line}>
          <Text style={styles.text}>Enter Country:</Text>
          <CountryDropdown
            value={country}
            onValueChange={(val) => this.selectCountry(val)}/>
        </View>
        <View style={styles.line}>
          <Text style={styles.text}>Enter Region:</Text>
          <RegionDropdown
            country={country}
            value={region}
            onValueChange={(val) => this.selectRegion(val)}/>
        </View>

      </View>
    );
  } <-- add here
}

const styles = StyleSheet.create({
  container: {
    flex:1,
    backgroundColor: '#fff',
    alignItems:'center',
    justifyContent:'center',
  },
  line:{
    flexDirection:'row',
    flex:0,
    marginBottom:5,
  },
  text:{
    flex:1,
  },
  input:{
    flex:1,
    width:70,
    borderBottomWidth:1,
    borderBottomColor:'#777',
  },

});


text:
Q: modx revo adding fields in user module I am new to modx revo and trying to add extra fields in user creation from backend. Which file should i check out for customization. I added the custom field in backend with this code on modx.panel.user.js file.
{
    id: 'modx-user-companyname'
    ,name: 'company_name'
    ,fieldLabel: _('company_name')
    ,xtype: 'textfield'
    ,anchor: '100%'
    ,maxLength: 255
}

I created custom column named company_name in database table modx_users but I don't know how to save it on database. Any ideas?

A: Editing the core code of modx is considered a bad idea.
Really you have two options if you want to add extra properties to users...
Firstly you could take advantage of modUser extended field which allows you to store extra  properties for the user and are stored as JSON. This is available in the default ui in the manager.
See Understanding MODX Extended User Fields and JSON
Secondly, you could extend modUser. This would give you full control over the user model and could then add additional related entities. From then, you might be able to alter the user form in the manager with form customisation or write a plugin to alter view.
See Extending modUser


text:
Q: Gradle multimodule project - how to create library with individual module as dependency jar Below is my multimodule project setup.
Root project 'gradle-lib'
+--- Project ':environment-config1'
+--- Project ':environment-config2'
+--- Project ':environment-api'
\--- Project ':environment-lib'

gradle-lib/build.gradle
plugins {
    id "org.springframework.boot" version "2.6.7" apply false
    id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false
}

subprojects { final Project subproject ->

apply plugin: 'org.springframework.boot'
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'jacoco'
apply plugin: 'java-library'
apply plugin: 'maven-publish'

version = rootProject.version
group = rootProject.group

repositories {
    mavenLocal()
    mavenCentral()
}

configurations {
    compileOnly {
        extendsFrom annotationProcessor
    }
}

// No spring boot application
bootJar {
    enabled = false
}

jar {
    enabled = true
    // Remove `plain` postfix from jar file name
    archiveClassifier.set("")
}

sourceCompatibility = '1.8'

//  Add dependencies that common to all projects
dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

environment-config1/build.gradle
dependencies {
    implementation project(":environment-api")
}

environment-config2/build.gradle
dependencies {
    implementation project(":environment-api")
}

environment-api/build.gradle
// Boiler plate code with some jar dependencies
 dependencies {

}

environment-lib/build.gradle
dependencies {
    implementation project(":environment-api")
    implementation project(":environment-config1")
    implementation project(":environment-config2")
}

*

*Whenever I try to build this project with gradlew clean build, these is compileJava task failed at 'environment-lib' which actually uses certain class files from environment-config1 & environment-api projects.

*

*I could suppress the same as below, but what configuration: 'default' will do?
  implementation project(":environment-api", configuration: 'default')
  implementation project(":environment-config1", configuration: 'default')
  implementation project(":environment-config2", configuration: 'default')

*How can I create a single jar with other module as individual jar like below. Is it possible or recommended way?
gradle-lib-1.0.0.jar ---> + META-INF
                            \- MANIFEST.MF
                          + //source files of environment-lib project
                          + lib
                             \- environment-api-1.0.0.jar
                             \- environment-config1-1.0.0.jar
                             \- environment-config2-1.0.0.jar


text:
Q: On Windows 7, how can I assign languages (German/English) to user accounts? I would like to have two user accounts on my laptop: one for a German speaker and one for an English speaker.  Are language packs far enough advanced now that I can just:

*

*download a Germany language pack

*install it

*assign a user account to it

so that the operating system language changes based on who is logged in?

A: I don't have any language packs installed at the moment so some wording may be wrong.
Language packs are installed for all users but the preference of which language should be used is per user so it's possible to do what you ask for.

*

*Download and install the language pack.

*Log in to the user you want to have german menus.

*Go to region and language options.

*Go to Keyboards and Languages.

*Select German.

*Log out and in again and you're done.

All of this applies to Vista as well.


text:
Q: How to turn a complicated json into a pandas dataframe I'm pulling FRED data through their api and I'm getting complicated JSON back.  Buried in this data is liability data.  Inside the JSON, is a nested 'observations' key and inside of that key is a list of dictionaries with 'date' and 'value' keys.  I need the date and value as the column headers.  Date could also be the index.
To get the data, one will need a free api key found here:  https://fred.stlouisfed.org/.  Just go to my account and follow the instructions.
For the code to pull the data, see the below.
import pandas as pd
import time
import urllib
import requests
from fred_api import fred_api #config file with my personal api
networth_endoint = r'https://api.stlouisfed.org/fred/series/observations?series_id=BOGZ1FL102090005A&api_key={}&file_type=json'.format(api)

content = requests.get(url = networth_endoint)

data = content.json()
data

If you don't want to go through that hassle, below is a snippet of what is returned:
{'realtime_start': '2020-03-03',
 'realtime_end': '2020-03-03',
 'observation_start': '1600-01-01',
 'observation_end': '9999-12-31',
 'units': 'lin',
 'output_type': 1,
 'file_type': 'json',
 'order_by': 'observation_date',
 'sort_order': 'asc',
 'count': 74,
 'offset': 0,
 'limit': 100000,
 'observations': [{'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1945-01-01',
   'value': '215967.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1946-01-01',
   'value': '232012.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1947-01-01',
   'value': '269729.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1948-01-01',
   'value': '294148.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1949-01-01',
   'value': '304352.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '1950-01-01',
   'value': '328550.0'}...

{'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '2017-01-01',
   'value': '15479906.0'},
  {'realtime_start': '2020-03-03',
   'realtime_end': '2020-03-03',
   'date': '2018-01-01',
   'value': '16491618.0'}]}

This goes one from 1945 to the last reported quarter.  Actual json broken up by ...
Can anyone figure out how to pull each date and value out of the json and make a dataframe with it?


text:
Q: Specified cast is not valid (xamarin.android) namespace Quiz_App
{
    [Activity(Label = "@string/app_name", Theme = "@style/AppTheme", MainLauncher = false)]
    public class MainActivity : Android.Support.V7.App.AppCompatActivity
    {
        Android.Support.V7.Widget.Toolbar toolbar;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            toolbar = (Android.Support.V7.Widget.Toolbar)FindViewById(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "TOPICS";
            Android.Support.V7.App.ActionBar actionBar = SupportActionBar;
            actionBar.SetHomeAsUpIndicator(Resource.Drawable.menuaction);
            actionBar.SetDisplayHomeAsUpEnabled(true);
        }

    }
}

When I try to run the above xamarin code I get the error System.InvalidCastException: 'Specified cast is not valid.'.
How do i resolve this.

A: Please make sure the element Toolbar in file toolbar.axml in layout folder is:
android.support.v7.widget.Toolbar

not
android.widget.Toolbar

For example:
  <?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?attr/actionBarSize"
    android:background="?attr/colorPrimary"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />


text:
Q: Why value of "document.form1.yourname" changed even if I set onsubmit="return false;" The html code is as following:
<form name="form1" id="formid1" method="get" onsubmit="return false;" >
Please enter your name:
<input type="text" name="yourname">
<input type="submit" value="please submit">
</form>

When button is clicked, the value of document.form1.yourname will change to the value of user input, although I set: onsubmit="return false;"
So I get confused. Onsubmit() event will be cancled since I set  onsubmit="return false;". Then why the value document.form1.yourname still changed?
So the assignment of document.form1.yourname does not occur in Onsubmit()? When does the assignment happen?  How to prevent this assigment?

A: value properties of form controls in the DOM represent their current, live, value.
They do not represent (except sometimes by coincidence) the value they held last time the user was on the same page and left it by submitting the form.
You cannot prevent the value of the value property from changing other than by preventing input into the input.
If you want to get the default value, then use getAttribute('value').

A: There are different concepts named "value":

*

*A form control's value

Form controls have a value and a checkedness. (The latter is only
  used by input elements.) These are used to describe how the
  user interacts with the control.

This is changed when:

*

*User modifies the form control.

*You change the value content attribute.

*You change the value or defaultValue IDL attributes.

*The value IDL attribute

The value IDL attribute allows scripts to manipulate the value
  of an input element. The attribute is in one of the following
  modes, which define its behavior:

*

*value
  On getting, it must return the current value of the element. On setting, it must set the element's value to the new value,
  set the element's dirty value flag to true, invoke the value
  sanitization algorithm, if the element's type attribute's
  current state defines one, and then, if the element has a text entry
  cursor position, should move the text entry cursor position to the end
  of the text field, unselecting any selected text and resetting the
  selection direction to none.

*default
  On getting, if the element has a value attribute, it must return that attribute's value; otherwise, it must return the empty
  string. On setting, it must set the element's value attribute
  to the new value.

*default/on
  On getting, if the element has a value attribute, it must return that attribute's value; otherwise, it must return the string
  "on". On setting, it must set the element's value attribute
  to the new value.

*filename
  On getting, it must return the string "C:\fakepath\" followed by the name of the first file in the list of selected files, if
  any, or the empty string if the list is empty. On setting, if the new
  value is the empty string, it must empty the list of selected
  files; otherwise, it must throw an InvalidStateError
  exception.

This is changed when:

*

*User modifies the form control.

*You change the value content attribute.

*You change the value or defaultValue IDL attributes.

*The value content attribute

The value content attribute gives the default value of the
  input element. When the value content attribute is added,
  set, or removed, if the control's dirty value flag is false, the
  user agent must set the value of the element to the value of the
  value content attribute, if there is one, or the empty string
  otherwise, and then run the current value sanitization algorithm,
  if one is defined.

This is changed when:

*

*You change the value content attribute.

*You change the defaultValue IDL attribute.

You can prevent the user from modifying the value (and thus the value IDL attribute too):

*

*Making it read-only.
You can do this adding the readonly content attribute, or setting the readOnly IDL attribute to true.
<input readonly="readonly">

myInput.setAttribute('readonly', '');

myInput.readOnly = true;

*Cancelling the beforeinput event.
myInput.addEventListener('beforeinput', function(event) {
    event.preventDefault();
});

Note neither Firefox nor Chrome support it yet.
If you want the user to be able to modify the value, but you want to get the default value, you can use

*

*The value content attribute:
myInput.getAttribute('value');

*The defaultValue IDL attribute:
myInput.defaultValue;


text:
Q: How to get error or success result from Acumatica Web service api? //LoginResult loginResult = context.Login("user","pass");
//if (loginResult.Code != ErrorCode.OK)
//Get Schema
//Insert
//Add fields values
//....
O301000.Actions.CopyOrder,
O301000.Actions.Save,
O301000.OrderSummary.OrderNbr
Submitresult = O301000.context.Submit(cmds);

How do I know if there was an error when inserting/saving the Order (or any other file)?
I just can find a value 'Submitresult.ErrorCode' like in the Login Result.
Mean while a have solve the issue, when inserting, by looking for the 'O301000.OrderSummary.OrderNbr' not null value.
But that does not works when updating a record.

A: You should always use a
try{Submitresult = O301000.context.Submit(cmds);}
 catch(Exception ex){Console.WriteLine(ex.Message);}
when making these calls.  If the SOAP calls returns an error, than the message is passed to the Exception object.


text:
Q: Check if url is exist or not I've website where visitor would submit links so i would like of the posted url is exist or not so i've been using the following function
<?PHP
        function url_exist($url){
        $c=curl_init();
        curl_setopt($c,CURLOPT_URL,$url);
        curl_setopt($c,CURLOPT_HEADER,1);
        curl_setopt($c,CURLOPT_NOBODY,1);
        curl_setopt($c,CURLOPT_RETURNTRANSFER,1);
        curl_setopt($c,CURLOPT_FRESH_CONNECT,1);
        if(!curl_exec($c)){
        return false;
        }else{
        return true;
        }}

    $ur = "http://www.google.com"; // example

    if(url_exist($url)){
    echo "yea valid";
    }else{
    echo "not valid";
    }
?>

but my website become so slow and something not even loading at the step of checking if valid or not valid url so i wonder if there any idea else can do the same without loading too much on my hosting server as the above function !! ~ any help

A: Using this code may work
$headers = @get_headers($url);
if(strpos($headers[0],'200')===false)return false;

So if a url returns anything other than code 200, you will know that url is wrong.

A: $url = 'http://google.com/';

if( get_headers($url) )
    echo "$url exists";

A: Using example from link in the accepted answer:
$url = 'http://www.example.com';
$handle = @fopen($url,'r');
if ($handle !== false) {
   echo 'Exists';
} else {
   echo "Doesn't";
}

Reproducing here in case external resource becomes unavailable in the future.

A: You can try the below code, hope it will work.
$url = 'http://www.example.com/file.jpg';
$file_header = @get_headers($url);
if($file_header[0] == 'HTTP/1.1 404 Not Found') {
    $is_exists = false;
}
else {
    $is_exists = true;
}


text:
Q: Visual Studio Code - Connect to a remote Git repository and PUSH local files to a new remote repository I have created a local project with Visual Studio Code that implements a local Git repository.
Then I have create a Git repository on Visual Studio Online and I want to push all my project files to the remote repository...
What is the correct procedure to do it?
My .git\config files at this moment look like this:
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true

A: I assume you started to work in a directory and didn't use Git there. The following should work with Git Bash:
cd "path to your repository"
git init
git add . # If you want to commit everything. Otherwise use .gitconfig files
git commit -m "initial commit" # If you change anything, you can add and commit again...

To add a remote, just do
git remote add origin https://...
git remote show origin # If everything is ok, you will see your remote
git push -u origin master # Assuming you are on the master branch.

The -u sets an upstream reference and Git knows from where to fetch/pull and where to push in the future.

A: From comments:

VSCode does not support the "add remote" action in its UI (April 2018)

Actually, it does since Visual Studio Code 1.46 (May 2020):

Add remote from GitHub
You can now easily add a GitHub repository as a remote to your local repositories using the Git: Add Remote... command.

A: It is now possible to set the origin from Visual Studio Code without command line typing:
git remote add origin https://github.com/USR/REPO.git

From within Visual Studio Code you may Ctrl + SHIFT + P if you are on Windows and type remote.
From there select Git: Add Remote and you will have two steps:

*

*Set origin for the remote name:

*Add origin URL: https://github.com/USR/REPO.git


text:
Q: Is there a way to config vscode with a Context Window as in Source Insight? The Context Window is a Source Insight innovation that automatically provides relevant information while you are viewing and editing your source code.  So, is there a way to config Visual Studio with a Context Window as in Source Insight?
Is there a way to config Visual Studio with a Context Window as in Source Insight?


text:
Q: What is the best way to reduce Memory Leak? During Runtime I find that there is a very big memory usage by my application..
But It seems that I only use 3~4 MemoryStreams one of which is sometimes full of 81 Mb..
The others are mainly 20 mb, 3 mb and 1mb containers...
But still there is 525.xx MB memory usage by the application...
I tried using using(...) statements also but without any luck..
So, I am asking here for the most efficient way to cut down memory leaks.

A: In managed .NET apps, you don't generally have memory "leaks" in the original sense of the word, unless you are allocating unmanaged resource handles and not disposing of them correctly. But that doesn't sound like what you're doing.
More likely is that you are holding on to references to objects that you no longer need, and this is keeping the memory "alive" longer than you are expecting.
For example, if you put 5MB of data into a memory stream, and then assign that memory stream to a static field, then the 5MB will never go away for the lifetime of the application.  You need to assign null to the static field that refers to the memory stream when you no longer need what it points to so that the garbage collector will release and reclaim that 5MB of memory.
Similarly, local variables are not released until the function exits.  If you allocate a lot of memory and assign it to a local variable, and then call another function that runs for hours, the local variable will be kept alive the whole time.  If you don't need that memory anymore, assign null to the local variable.
How are you determining that your app has a memory leak?  If you are looking at the process virtual memory allocation shown by Task Manager, that is not very accurate. An application's memory manager may allocate large chunks of memory from the OS and internally free them for other uses within the application without releasing them back to the OS.
Use common sense practices. Call dispose or close as appropriate and assign null to variables as soon as you no longer need their contents.
Just because the garbage collected environment will let you be lazy doesn't mean you shouldn't pay attention to memory allocation and deallocation patterns in your code.

A: Your definition of memory leak seems to be unusual... Following code will produce exactly the effect you are observing, but it rarely called memory leak:
var data = new byte[512*1024*1024];
data = null;

But you may actually have legitimate leaks. Memory profilers will easily show them, but huge ones can be tracked down by code reviews. If you already know that you have small number of memory streams - check if you don't keep them alive by storing in some list or simply in member variable. Also check if your large arrays are not staying alive for similar reasons.


text:
Q: Can I combine my openssl key and csr creation commands in to one command keeping des3 passphrase encryption? I am in the process of trying to automate/script via shell, a method of post server build config for one of our teams, and one of the final steps after all is installed, is to generate an SSL key and csr file ready for upload to our internal certificate management/signing tool.
The existing process had them running the following 2 commands and entering all details (passphrase, distinguished name details, attributes etc.) manually:
#create private key
openssl genrsa -des3 -out filename.key 2048

#generate csr
openssl req -new -key filename.key -out filename.csr

I have opted to use the following process to try and automate it:
at first generate a config file containing the required details like
[ req ]
default_bits = 2048
distinguished_name = disname

.....

[ disname ]
C = NN
ST = name

.....

Then run the combined command to generate the files using some defined variables
openssl req -newkey rsa:2048 -passout pass:${passPhrase} -config config.file\
   -keyout filename.key -out filename.csr

This command seems to work a dream, but...
It was noticed that the output for the key on this combined command is not like the original one.
The original method where we include -des3 create a key file stating the following in front:
----BEGIN RSA PRIVATE KEY----

Proc-Type: 4,ENCRYPTED

DEK-Info: DES-EDE3-CBC, nnnnnnnnnnnnn

The file created via the combined method simply has:
----BEGIN ENCRYPTED PRIVATE KEY----

The question is, is this the same but one method simply put different info at the beginning or is this fundamentally different and I need to revert back to the old way or do something else to have the same level/method of encryption?

A: I found a way to do what I need.
2 step process:
1 - key creation (with no prompt)
openssl genrsa -passout:${passphrase} -des3 -out filename.key 2048

2 - csr creation from key with no prompt
openssl req -passin pass:${passphrase} -config config.file -new\
  -key filename.key -out filename.csr


text:
Q: PHP - Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll I am having a strange error (system is Ubuntu 16.04):
[Mon Sep 04 13:07:17.219992 2017] [mpm_prefork:notice] [pid 27798] AH00169: caught SIGTERM, shutting down
[Mon Sep 04 13:07:17.302181 2017] [so:warn] [pid 27874] AH01574: module php7_module is already loaded, skipping
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[Mon Sep 04 13:07:17.322006 2017] [mpm_prefork:notice] [pid 27875] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Sep 04 13:07:17.322026 2017] [core:notice] [pid 27875] AH00094: Command line: '/usr/sbin/apache2'

PHP version is 7.1.19. I installed curl (apt-get install php7.1-curl), in the php.ini I added extension=curl.co (and commented out extension=php_curl.dll), restarted the apache service, and the error is still there (I tried commenting out extension=curl.co but the error is still there).
This is an error I am getting on the page (Laravel setup):
Call to undefined function App\curl_init()

Everything is installed and config files are as required and I don't know what could be wrong here.

A: The /etc/php/7.1/mods-available/curl.ini file content should be:
extension=curl.so

Please notice the extension is .so, and not .co.
Then you can enable the module in your PHP by running:
$ sudo phpenmod curl

Finally, you may need to restart your Apache:
$ sudo systemctl restart apache2


text:
Q: Overriding Bootstrap with custom css I use npm I bootstrap in reactjs project , but I want to modify some of the elements, so I wrote my own custom.css. However it doesn't make any changes (only when I put !important, but the file is so large so it's not a good option).
import these in index.js
import "bootstrap/dist/js/bootstrap.bundle.min";
import "bootstrap/dist/css/bootstrap.css"

and in a single component, I have use bootstrap classes but It affects my all components and also inline custom CSS Style


text:
Q: Xcode, how to updates "Recent" projects I have a list of projects i am working on, some of which are no longer relevant. I would like to be able to remove them from the "Recents" list that shows up when Xcode starts up.
How to remove projects from "Recents" list?
Please let me know

A: File -> Open Recent Project -> Clear Menu

A: You can clear the entire recent projects list via the "File" -> "Open Recent" -> "Clear Menu" option within the file menu. (This applies to Xcode 4.x, but there's an equivalent in Xcode 3.x in the event it's not in the same location.)


text:
Q: Passing function params I have a foreach statement that looks like the following:
foreach ($term['terms'] as $term_single) {
    $term_object = get_term_by('name', $term_single, $tax_name);

    switch ($term['tax_name']) {
        case has_action( "basey_taxonomy_search_teaser_{$tax_name}" ) :
            do_action( "basey_taxonomy_search_teaser_{$tax_name}",$term_object, $term_single );
        break;

        default:
            echo basey_taxonomy_search_teaser_default($term_object,$term_single);
        break;
    }
}

So, within this, I have both the $term_object and $term_single variables to pass to the basey_taxonomy_search_teasr_default() function. The odd thing here is, if I do the following in another location:
function basey_taxonomy_search_teaser_default($term_object,$term_single) {

    ob_start();

    do_action('basey_taxonomy_teaser_before');
    echo '
term_id . '" class="' . $term_object->taxonomy . '">';
    echo '';
    echo $term_single;
    echo '';
    echo '
';
    do_action('basey_taxonomy_teaser_after');

    $display = apply_filters('basey_taxonomy_teaser_default_view', ob_get_clean());
    return $display;
}

it works just fine on my localhost, but online at a server, it is coming back with errors for $term_object and $term_single as undefined. If I want the function definition to use the values from the initial call, is there a better way to do so? Again little confused on why it would work here on localhost (MAMP) but on the server, it would error out. Aside from it being a php.ini issue (which I think this is more fundamental programming practice), looking to see what I'm doing wrong and if my assumptions are off on passing values via a function. Thanks!
Update
var_dump($term_object) right after $term_object = get_term_by('name', $term_single, $tax_name);:
localhost gives me:
object(stdClass)#181 (10) { ["term_id"]=> string(3) "127" ["name"]=> string(4) "Base" ["slug"]=> string(4) "base" ["term_group"]=> string(1) "0" ["term_order"]=> string(1) "0" ["term_taxonomy_id"]=> string(3) "130" ["taxonomy"]=> string(18) "profile_categories" ["description"]=> string(4) "Base" ["parent"]=> string(1) "0" ["count"]=> string(1) "2" }

live server gives me:
bool(false)

Bah, quite frustrating.

A: I'd guess that the DB you're hitting is different and the $term_single is null, leading to a null $term_object, and when you call the function and try to use the objects that's where you're dying.

A: Sounds like the term you are searching for doesn't exist on the live server.


text:
Q: Reprojecting LiDAR data with libLAS error: "x scale and offset combination is insufficient to represent the data" Disclaimer: This is a duplicate of this, a question without an answer.
This is not, however, a duplicate of this, as it is a different error.
I have a LAS file projected in EPSG:32636, and I need to reproject it to EPSG:4326.
When I try to reproject it, using code found here to convert it to a format CesiumJS can show, it runs:
las2las --a_srs EPSG:32636 --t_srs EPSG:4326 ../cloud.las --scale 0.000001 0.00 0001 0.01 -o tmp/p.las

Which returns the following error:

error: X scale and offset combination is insufficient to represent the data

I played around with the scaling values, and values that work are between 0.01 and 1, but not for example 0.001, and I don't understand why. When visualizing the new las file, it is a points cloud in the right location, but all of the points condense to a single pixel.
The file's header states as follows:
 Header Summary
---------------------------------------------------------

  Version:                     1.2
  Source ID:                   0
  Reserved:                    0
  Project ID/GUID:             '00000000-0000-0000-0000-000000000000'
  System ID:                   'libLAS'
  Generating Software:         'libLAS 1.8.1'
  File Creation Day/Year:      135/2018
  Header Byte Size             227
  Data Offset:                 1081
  Header Padding:              0
  Number Var. Length Records:  3
  Point Data Format:           3
  Number of Point Records:     1541011
  Compressed:                  False
  Number of Points by Return:  0 0 0 0 0
  Scale Factor X Y Z:          0.00100000000000 0.00100000000000 0.00100000000000
  Offset X Y Z:                681000.000 3552000.000 0.000
  Min X Y Z:                   681113.173 3552810.731 41.752
  Max X Y Z:                   681389.296 3553078.302 69.555
  Spatial Reference:
PROJCS["WGS 84 / UTM zone 36N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",33],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32636"]]

Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,22): "WGS 84 / UTM zone 36N"
      GeogCitationGeoKey (Ascii,7): "WGS 84"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): PCS_WGS84_UTM_zone_36N
      ProjLinearUnitsGeoKey (Short,1): Linear_Meter
      End_Of_Keys.
   End_Of_Geotiff.

---------------------------------------------------------
  VLR Summary
---------------------------------------------------------
    User: 'LASF_Projection' - Description: 'GeoTIFF GeoKeyDirectoryTag'
    ID: 34735 Length: 64 Total Size: 118
    User: 'LASF_Projection' - Description: 'GeoTIFF GeoAsciiParamsTag'
    ID: 34737 Length: 30 Total Size: 84
    User: 'liblas' - Description: 'OGR variant of OpenGIS WKT SRS'
    ID: 2112 Length: 598 Total Size: 652
---------------------------------------------------------
  Schema Summary
---------------------------------------------------------
  Point Format ID:             3
  Number of dimensions:        16
  Custom schema?:              false
  Size in bytes:               34

  Dimensions
---------------------------------------------------------
  'X'                            --  size: 32 offset: 0
  'Y'                            --  size: 32 offset: 4
  'Z'                            --  size: 32 offset: 8
  'Intensity'                    --  size: 16 offset: 12
  'Return Number'                --  size: 3 offset: 14
  'Number of Returns'            --  size: 3 offset: 14
  'Scan Direction'               --  size: 1 offset: 14
  'Flightline Edge'              --  size: 1 offset: 14
  'Classification'               --  size: 8 offset: 15
  'Scan Angle Rank'              --  size: 8 offset: 16
  'User Data'                    --  size: 8 offset: 17
  'Point Source ID'              --  size: 16 offset: 18
  'Time'                         --  size: 64 offset: 20
  'Red'                          --  size: 16 offset: 28
  'Green'                        --  size: 16 offset: 30
  'Blue'                         --  size: 16 offset: 32

A: Scale refers to the precision of the coordinates, and is used in combination with the XYZ point within the points record and the offset to position the point in the coordinate system specified. A common way for coordinates in LAS files to be represented is as long integers, with a precision of 3 digits and a scale of 0.001.  Therefore, if an X point was 540000000, the offset was 0, and the scale was 0.001, the point would be positioned in a viewer at X point 540000.  If the offset was 12 (offsets are added without scaling), the point would be positioned at X point 540012.  Your original file has this scale factor.  You'll also notice that their minimum X value 681113.173 is slightly less than the offset, so essentially the point records build up from there.
From the specs for LAS version 1.2 files:

X, Y, and Z scale factors: The scale factor fields contain a double
  floating point value that is used to scale the corresponding X, Y, and
  Z long values within the point records. The corresponding X, Y, and Z
  scale factor must be multiplied by the X, Y, or Z point record value
  to get the actual X, Y, or Z coordinate. For example, if the X, Y, and
  Z coordinates are intended to have two decimal digits, then each scale
  factor will contain the number 0.01.

For your data, when you scale it (divide the number added to the minimum X bound) by 1000000, it will appear that all points are at the same point - they are separate, but by minute fractions of a meter.  They are in the right region because the offset (that does not get scaled) puts them there.
Try to run this without setting scaling - it should leave the defaults in place.

A: Weirdly, this didn't work on my Linux machine, but on a mac even a simpler form does:
las2las -target_epsg 4326 cloud.las -o tmp/p.las

No need to identify my own projection, no need to set a custom scale.


text:
Q: How to replace text in pipelined data without it converting the underlying object into a string object Is it possible to replace text in pipelined data without it converting the underlying object into a string object?
I'm querying a dns server for hostname and ipaddresses with the following:
$DnsData = Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName "DCName"  -Filter "DomainName = 'OurDomain.local'" `
        |?{$_.IPAddress -like "192.168.100.*" } | Select-Object -property Ownername, ipaddress

Which returns data like:
Ownername                               ipaddress
---------                               ---------
2UA0123AB0.OurDomain.local              192.168.100.101
2UA0123AB1.OurDomain.local              192.168.100.102
2UA0123AB2.OurDomain.local              192.168.100.103
2UA0123AB3.OurDomain.local              192.168.100.104
2UA0123AB4.OurDomain.local              192.168.100.106

I want to strip out the domain suffix (OurDomain.local), but if I put a replace step in the query such as:
$DnsData = (Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName "DCName"  -Filter "DomainName = 'OurDomain.local'" `
    |?{$_.IPAddress -like "192.168.100.*" } | Select-Object -property Ownername, ipaddress) -replace ".OurDomain.local",""

or
$DnsData = Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName "DCName"  -Filter "DomainName = 'OurDomain.local'" `
    |?{$_.IPAddress -like "192.168.100.*" } | Select-Object -property Ownername, ipaddress|foreach{$_ -replace ".OurDomain.local",""}

The data is returned as:
@{OwnerName=2UA0123AB0; ipaddress=192.168.100.101}
@{OwnerName=2UA0123AB1; ipaddress=192.168.100.102}

And as it's a string, I can't refer to the properties e.g. in a loop:
Foreach($pc in $DnsData)
{
    $pc.Ownername
}

How do I change the query to replace the text but without changing the objects? I've worked around it for now, but it bugs me that I'm missing something simple.

A: Apparently this isn't simple.
Try to add a property, containing the info you need, to the object:
$DnsData = Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName "DCName" -Filter "DomainName = 'OurDomain.local'" |
    ? { $_.IPAddress -like "192.168.100.*" }

$DnsData | % { Add-Member -InputObject $_ Hostname ($_.Ownername -replace ".OurDomain.local", "") }
$DnsData | fl Hostname, IPaddress

A: Try this:
$DnsData = Get-WmiObject -Class MicrosoftDNS_AType -NameSpace Root\MicrosoftDNS -ComputerName "DCName"  -Filter "DomainName = 'OurDomain.local'" `
    |?{$_.IPAddress -like "192.168.100.*" } | Select-Object @{Name="OwnerName";Expression={$_.ownername -replace ".OurDomain.local",""}}, ipaddress


text:
Q: The integral of mollifier function is $1 $ \begin{eqnarray}
u(x) =
\begin{cases} e^{-\frac{1}{1-\|x\|^2}}& \text{ if } \|x\| < 1\\
                 0& \text{ if } \|x\|\geq 1
                 \end{cases}
\end{eqnarray}
 I am trying to show the integral of the  mollifier function $u$ equals $1$. Help please. Thank you.


text:
Q: Can you load controllers separately and not on page load? I was just wondering is it possible to run the controllers separately and not all on page load. So like if I'm on a certain page only that controller loads and not others. If I go to a different page then the controller on that page load. I guess it's like a the controller load dynamically. If anyone can find some examples/links/videos that I can refer too, that would be great since I'm having trouble finding them due to my amazing engrish. Thanks.

A: Use ozlazyload, it loads the modules dynamically on page loads and inject that module to your app at run time. It can be used with both ng and ui router. https://oclazyload.readme.io/docs
resolve:{
            loadplugin : ["$ocLazyLoad", function($ocLazyLoad){
                return $ocLazyLoad.load([{
                    name : "modulename",
                    files: ["path/modules/file.js"]
                }])
            }]
        },


text:
Q: Does it make sense to use Auth::attempt in APIs login by API token? I see that it is a very common approach to see something like :
if (!Auth::attempt($request->only('email', 'password'))) {
            return response()->json([
                'message' => 'Invalid login details'
            ], 401);
        }

Even if the Laravel app works only with JWT or other kinds of token based login (Sanctum tokens, for example).
But i was wondering, does it make sense? In my undestanding this method will try to execute a traditional web based login, what isn't what is trying to be archieved here. The method seems to be used only to verify if the attempt was true or false, but doesn't Laravel have a more appropriate and more focused method for this?

A: Yes, it makes sense to implement. But have you looked at the security side?
While authentication through a email/password combination is considered generally secure, there are use cases where it isn't considered the best option or even safe.
Email/password authentication is simple to implement, but not the best way to protect an API. The client application has to keep the clear text password in memory to send it along with each request. Not safe enough.
The problem with a password is that they are reused
A password is a valuable target, because the same password is likely to be used on multiple services. So you exchange it for a shorter-lived access token, which, if stolen, presents less risk for your user. And you can't easily revoke a password - forcing users to change their passwords is a hassle. Revoking an access token is easy.


text:
Q: How to point to eng.traineddata in Tess4J OCR project I am new in Tess4J. I'm getting this error
Error opening data file ./tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent directory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Empty page!!
After searching, I added environment variable TESSDATA_PREFIX pointing to "C:\Program Files\Tesseract-OCR\tessdata" which has eng.traineddata file.
How can I get this to work. Please help, step by step if possible.

A: The datapath should be set to "C:\Program Files\Tesseract-OCR\".

A: First,you need to download the language data file.
Then,set the environment variable to point to your tessdata directory.
Ex:if your tessdata path is '/usr/local/share/tessdata'
export TESSDATA_PREFIX='/usr/local/share/'

Finally,move the language data files to the tessdata directory:
sudo mv Downloads/eng.traineddata /usr/local/share/

now,try~