text:
Q: SimulatedGreg Electron-Vue-Vuetify Error message: [Vue warn]: Unknown custom element:  - did you register the component correctly? First, let me say thank you for helping with my problem. I started struggling with this problem this morning at about 9 am, it's now 3 pm and I am still not able to figure out what if anything will fix this issue. I lost count of the number of youtube videos I watched in an attempt to understand the underlying principles that I might have missed.
Here are all of the other StackOverflow question-answer pairs that I have also looked at and attempted (sometimes multiple times & in combination even) all without luck:
https://forum.vuejs.org/t/solved-unknown-custom-element-v-card/43018
<v-card> - did you register the component correctly?
"[Vue warn]: Unknown custom element: ..." Error, when using vuetify UI components with the vue-cli-plugin-vuetify
Vuetifyjs error Unknown custom element: did you register the component correctly
https://github.com/SeregPie/VuetifyImageInput/issues/3
https://michaelnthiessen.com/solve-unknown-custom-element-vue/
Vue/Vuetify - Unknown custom element: <v-app> - did you register the component correctly?
Unknown custom element: <v-app> - did you register the component correctly? For recursive components
At this point I have basically given up on finding a solution for Vuetify, and if I still cannot find a solution by Monday, then I will abandon Vuetify completely and move on to another framework such as VueBootstrap.
Problem Setup:
I am just trying to learn Electron-Vue-Vuetify by using project-based learning. I decided to start by building a simple calculator application just so I can learn how to create components and wire them together with code and perhaps learn how to do SASS/CSS styling/themes as well.
I created a boiler-plate application using the SimulatedGreg template on GitHub:
https://github.com/SimulatedGREG/electron-vue
I validated the application is running.
Then I followed the steps to NPM install Vuetify. I noticed that the vuetify installer modified the App.vue file in the root folder but not the App.vue in the renderer folder. So I moved that around, and I also noticed that the Vuetify installer created a new components folder also at the root of the src folder, so I moved that HelloWorld.vue component into the src/renderer/components folder. I made a few other minor changes to make sure I did the best I could to wire it up. Validated that the Vuetify plugin was installed and saved in the Dev-dependencies in the package.json, and a few other odds and ends.
Finally, I was able to get where the application would load but all the styling was wrong. Now it's just a flat text rendered to the DOM with no styling at all. I get a bunch of errors in the developer tools:
Here is the full error log: (Sorry a bit long I know, I tried to remove the long redundant bits)
[Vue warn]: Unknown custom element: <v-app> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
warn @ vue.esm.js?a026:628
createElm @ vue.esm.js?a026:5949
patch @ vue.esm.js?a026:6488
Vue._update @ vue.esm.js?a026:3954
updateComponent @ vue.esm.js?a026:4075
get @ vue.esm.js?a026:4488
Watcher @ vue.esm.js?a026:4477
mountComponent @ vue.esm.js?a026:4082
Vue.$mount @ vue.esm.js?a026:9063
Vue.$mount @ vue.esm.js?a026:11974
init @ vue.esm.js?a026:3127
createComponent @ vue.esm.js?a026:5989
createElm @ vue.esm.js?a026:5936
patch @ vue.esm.js?a026:6527
Vue._update @ vue.esm.js?a026:3954
updateComponent @ vue.esm.js?a026:4075
get @ vue.esm.js?a026:4488
Watcher @ vue.esm.js?a026:4477
mountComponent @ vue.esm.js?a026:4082
Vue.$mount @ vue.esm.js?a026:9063
Vue.$mount @ vue.esm.js?a026:11974
(anonymous) @ main.js?cebd:13
./src/renderer/main.js @ renderer.js:1351
__webpack_require__ @ renderer.js:791
fn @ renderer.js:102
1 @ renderer.js:1423
__webpack_require__ @ renderer.js:791
(anonymous) @ renderer.js:858
(anonymous) @ renderer.js:861
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-app-bar> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
2vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-img> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-spacer> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-btn> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-icon> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-content> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <App> at src/renderer/App.vue
       <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-container> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-col> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-img> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
2vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-col> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-col> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-col> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>
....
vue.esm.js?a026:628 [Vue warn]: Unknown custom element: <v-row> - did you register the component correctly? For recursive components, make sure to provide the "name" option.

found in

---> <HelloWorld> at src/renderer/components/HelloWorld.vue
       <App> at src/renderer/App.vue
         <Root>

Some of the Vuetify users might be also on the Vuetify Facebook page. I did re-post my question there, just hoping to get any kind of help!
Some other things I tried which you might see in the code repo linked below:
In the main.js file I tried to modify the code in the following way....see the commented code:
import Vue from 'vue'
import axios from 'axios'
// import '../plugins/vuetify' <--Attempted to add this....causes the application to not load anything!
import App from './App'
import router from './router'
import store from './store'

Also in the main.js:
new Vue({
  components: { App },
  router,
  // vuetify: Vuetify, <--Also attempted to add this here....same issue as above, not loads at all.
  store,
  template: '<App/>'
}).$mount('#app')

I posted the code to a sandbox repo on GitHub:
https://github.com/SethEden/EVJS-Calculator
Feel free to clone it and see if you can help me figure out what it is that I have not done correctly or what I am missing? I'm sure it is something super silly, but hopefully, it will help someone else overcome similar or related issues. Again my main goal here is to learn! So if you have any additional information you can describe why a change is important that would help me learn more!!
And perhaps the answer to this question is something answered in one of those other questions, but perhaps I just didn't understand those answers fully enough to implement it in my own circumstance. In any case, I hope it benefits someone else!
Thank you again!!
Cheers & have a great weekend!
~Seth
UPDATE:
First setup, followed this tutorial:
https://medium.com/@bromix/electron-application-with-vue-js-and-vuetify-f2a1f9c749b8
npm install -g @vue/cli
vue create electron-app
vue add vuetify
vue add electron-builder
Result: Everything for Vue, Electron & Vuetify was working perfectly, but the folder structure was not correct to scale as an enterprise application.
Default folder structure:
ProjectName

*

*src
--- main.js

This is what the folder structure should be:
ProjectName

*

*src
--- Application
------ ProjectName
--------- main.js

This way we can have a framework folder and everything will be contained within the src project root folder.
All files in the src path were moved into the new folder structure path: @/src/Application/ProjectName/.
Result: Build is completely broken.
Found this blog article:
https://vuejsdevelopers.com/2019/03/18/vue-cli-3-rename-src-folder/
And this article:
https://vuejsdevelopers.com/2019/03/11/vue-cli-3-full-stack/
And this GitHub bug report:
https://github.com/vuejs/vue-cli/issues/1134
After implementing these fixes, the build is still broken, additional searching and I found this:
https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/configuration.html#webpack-configuration
After implementing this fix and a few other obvious changes to various paths in the code files and package.json main entry-point,
the build is now working, but the application gives an error on load and the Vue fails to render.
Error message:
[HMR] Waiting for update signal from WDS...
utils.js?e375:21 Uncaught TypeError: Cannot read property 'getPath' of undefined
    at getPath (utils.js?e375:21)
    at getIDMapPath (index.js?b206:29)
    at eval (index.js?b206:32)
    at Object../node_modules/electron-devtools-installer/dist/index.js (chunk-vendors.js:1117)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)
    at eval (background.js?e28f:1)
    at Module../src/Application/electronVueJS-App/background.js (app.js:949)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)

Looking up the utils.js?e375:21 at the following path:
C:\electronVueJS-App\node_modules\electron-devtools-installer\dist\utils.js
The code for the failure is:
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.changePermissions = exports.downloadFile = exports.getPath = void 0;

var _electron = require("electron");

var _fs = _interopRequireDefault(require("fs"));

var _path = _interopRequireDefault(require("path"));

var _https = _interopRequireDefault(require("https"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

var getPath = function getPath() {
  var savePath = _electron.app.getPath('userData'); // <-------------------- HERE

Attempted to modify the above code like so, to be able to see what exactly is failing:
var getPath = function getPath() {
    console.log('_electron is: ' + JSON.stringify(_electron));
    console.log('_electron is: ', _electron);
    var savePath = _electron.app.getPath('userData'); // <-------------------- HERE

Now the build fails to finish the build process, so attempting something else:
rather than:
var _electron = require("electron");

I'm going to do this:
const remote = require('electron').remote;
const app = remote.app;
console.log(app.getPath('userData'));

Then I will attempt:
const remote = require('electron').remote;
console.log('remote electron is: ", remote);
const app = remote.app;
console.log('remote app is: ', app);
console.log(app.getPath('userData'));

and finally:
var getPath = function getPath() {
var savePath = app.getPath('userData');

Another build-time error:
[Window Title]
Error

[Main Instruction]
A JavaScript error occurred in the main process

[Content]
Uncaught Exception:
TypeError: Cannot read property 'app' of undefined
    at eval (webpack:///./node_modules/electron-devtools-installer/dist/utils.js?:11:20)
    at Object../node_modules/electron-devtools-installer/dist/utils.js (C:\electronVueJS-App\dist_electron\index.js:166:1)
    at __webpack_require__ (C:\electronVueJS-App\dist_electron\index.js:20:30)
    at eval (webpack:///./node_modules/electron-devtools-installer/dist/downloadChromeExtension.js?:16:14)
    at Object../node_modules/electron-devtools-installer/dist/downloadChromeExtension.js (C:\electronVueJS-App\dist_electron\index.js:142:1)
    at __webpack_require__ (C:\electronVueJS-App\dist_electron\index.js:20:30)
    at eval (webpack:///./node_modules/electron-devtools-installer/dist/index.js?:16:55)
    at Object../node_modules/electron-devtools-installer/dist/index.js (C:\electronVueJS-App\dist_electron\index.js:154:1)
    at __webpack_require__ (C:\electronVueJS-App\dist_electron\index.js:20:30)
    at eval (webpack:///./src/Application/electronVueJS-App/background.js?:6:85)

That error is now happening on this line:
const electApp = remote.app;

So clearly that didn't work.
Reverting the code just to be safe, since that was the closest to getting a running application.
Error is now:
utils.js?e375:19 Uncaught TypeError: Cannot read property 'getPath' of undefined
    at getPath (utils.js?e375:19)
    at getIDMapPath (index.js?b206:29)
    at eval (index.js?b206:32)
    at Object../node_modules/electron-devtools-installer/dist/index.js (chunk-vendors.js:1117)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)
    at eval (background.js?e28f:1)
    at Module../src/Application/electronVueJS-App/background.js (app.js:949)
    at __webpack_require__ (app.js:849)
    at fn (app.js:151)

Attempted to enable Chrome logging via the Electron logging argument:
"electron:serve": "vue-cli-service electron:serve --enable-logging",
This poped some additional windows but no additional information was displayed.
Further investigation with Sean Alexander Free on the VueJS Developers Facebook page discovered the following:
Interestingly, the problem is in the electron-dev-tools-installer node module's index.js on line 18:
var _utils = require("./utils");
The relative path isn't being found because the current directory is electron's renderer path.
Adding console.log(__dirname) after the require shows:
D:\workspace\electronVueJS-App\node_modules\electron\dist\resources\electron.asar\renderer
Which of course is not the correct path to pull in a resource from a node_modules folder via a relative path.
Seems like this is an issue with the installer module itself, but I would assume some webpack trickery could get around this.
My response
Ahhh I see what you are saying. So it seems somewhere in the Electron-dev-tools-installer internal code,
a developer reused the init-main path as the same path to base where to go and get the resources to load....
pretty typical programming technique to use since it seems they never planned to allow the system folder structure to
scale for custom enterprise solutions. (E.G. Client-Server).
Further I would make a bet that this wouldn't be the last of the problems I would run into....
and it certainly hasn't been the first.
I will revert back to the default installation and investigate ways to turn the background.js & main.js files
into a wrapper/call-forwarder and try to make it work that way.
Final WORKING Repo of the template is: (I will leave this up for others)
https://github.com/SethEden/electronVueJS-Basic

A: I'm totally new to Electron, meanwhile I found out that Github reply and tried it.
It's perfectly working (I've added a button on the top left to kinda test it).

Maybe not using the whole Electron boilerplate but it get's you with Electron + Vue + Vuetify ready. :)
I guess this answer may help you debug the whole boilerplate and make it work but it requires some webpack config knowledge.
Not sure if it's worth a time investment nor the struggle but since it's pointed out by several people, it may actually work. ^^
~~
Oh and I'm not an expert but you may maybe ask people on the Vue Discord if you want to debug your current configuration instead of my solution.


text:
Q: What is the difference between git pull origin [another_branch] vs git rebase [another_branch]? I know git pull creates a new commit and rebase goes commit by commit and make it on top of another. Other than the extra merge commit is there any other difference or danger involved?

A: git pull fetches the commits from the remote repository, then merges the commits into the current branch. As a result, a merge commit will be created.
A merge commit is not created for a fast-forward merge.
git rebase moves commits from one branch on top of commits from another branch. The commit history looks more transparent. No extra commits.
Also you can use git pull --rebase. As a result, after the data is fetched, a rebase will be performed instead of a merge.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Encrypting a properties file of a Webserver (AES) I am currently developing an Android app that requests specific properties from my webserver, which look like this:
<properties>
<property name="Approved-IP" value="SomeIPAddresses"/>
</properties>

The app saves the site as a temporary XML file and tries to check these IPs.
I want to let the server encrypt the properties using AES and IF the app doesn't have an encryption password set use a default key like "test123".
The app then decrypts this information via the EasyCrypt library and uses it.
The problem is that I don't really know how to do it server-side, so that the information won't be passed in plain text.

A: So I found a solution for my program (beware, this is just for exercise, so I wouldn't call it safe in ANY way)
I am using this method to encrypt the String on my WebServer:
private static byte[] encrypt(String plain, String key) throws Exception {
    byte[] clean = plain.getBytes();

    int ivSize = 16;
    byte[] iv = new byte[ivSize];
    SecureRandom random = new SecureRandom();
    random.nextBytes(iv);
    IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);

    MessageDigest digest = MessageDigest.getInstance("SHA-256");
    digest.update(key.getBytes("UTF-8"));
    byte[] keyBytes = new byte[16];
    System.arraycopy(digest.digest(), 0, keyBytes, 0, keyBytes.length);
    SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "AES");

    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
    byte[] encrypted = cipher.doFinal(clean);

    byte[] encryptedIVAndText = new byte[ivSize + encrypted.length];
    System.arraycopy(iv, 0, encryptedIVAndText, 0, ivSize);
    System.arraycopy(encrypted, 0, encryptedIVAndText, ivSize, encrypted.length);

    return encryptedIVAndText;
}

Then I am encoding the generated String with Base64

Base64.getEncoder().encodeToString(encryptedString)

And return the Base64 String.
My App decodes the returned String using the getDecoder function and decrypts it with this method:
public static String decrypt(byte[] encryptedIvTextBytes, String key) throws Exception {
    int ivSize = 16;
    int keySize = 16;

    byte[] iv = new byte[ivSize];
    System.arraycopy(encryptedIvTextBytes, 0, iv, 0, iv.length);
    IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);

    int encryptedSize = encryptedIvTextBytes.length - ivSize;
    byte[] encryptedBytes = new byte[encryptedSize];
    System.arraycopy(encryptedIvTextBytes, ivSize, encryptedBytes, 0, encryptedSize);

    byte[] keyBytes = new byte[keySize];
    MessageDigest md = MessageDigest.getInstance("SHA-256");
    md.update(key.getBytes());
    System.arraycopy(md.digest(), 0, keyBytes, 0, keyBytes.length);
    SecretKeySpec secretKeySpec = new SecretKeySpec(keyBytes, "AES");

    Cipher cipherDecrypt = Cipher.getInstance("AES/CBC/PKCS5Padding");
    cipherDecrypt.init(Cipher.DECRYPT_MODE, secretKeySpec, ivParameterSpec);
    byte[] decrypted = cipherDecrypt.doFinal(encryptedBytes);

    return new String(decrypted);
}

And the result is the normal properties file.


text:
Q: Java matcher unable to finding last group I'm trying regex after a long time. I'm not sure if the issue is with regex or the logic.
String test = "project/components/content;contentLabel|contentDec";
String regex = "(([A-Za-z0-9-/]*);([A-Za-z0-9]*))";

Map<Integer, String> matchingGroups = new HashMap<>();

Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(test);
//System.out.println("Input: " + test + "\n");
//System.out.println("Regex: " + regex + "\n");
//System.out.println("Matcher Count: " + matcher.groupCount() + "\n");
if (matcher != null && matcher.find()) {
    for (int i = 0; i < matcher.groupCount(); i++) {
         System.out.println(i + " ->  " + matcher.group(i) + "\n");
    }
}

I was expecting the above to give me the output as below:
0 ->  project/components/content;contentLabel|contentDec
1 ->  project/components/content
2 ->  contentLabel|contentDec

But when running the code the group extractions are off.
Any help would be really appreciated.
Thanks!

A: You have a few issues:

*

*You're missing | in your second character class.

*You have an unnecessary capture group around the whole regex.

*When outputting the groups, you need to use <= matcher.groupCount() because matcher.group(0) is reserved for the whole match, so your capture groups are in group(1) and group(2).

This will work:
String test = "project/components/content;contentLabel|contentDec";
String regex = "([A-Za-z0-9-/]*);([A-Za-z0-9|]*)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(test);
if (matcher != null && matcher.find()) {
    for (int i = 0; i <= matcher.groupCount(); i++) {
         System.out.println(i + " ->  " + matcher.group(i) + "\n");
    }
}


text:
Q: Splitting the output of MySQL Group_Concat() How do I split Group_Concat() result into different columns? I don't want to show it in the same cell separated by comma.

A: You can use SUBSTRING_INDEX twice after wrapping it in a subquery, in case you know the delimiter.
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 3), '.', -1)
    FROM (
        SELECT GROUP_CONCAT(...) AS SomeColumn
            FROM ...
    ) AS SomeTable

*

*The first SUBSTRING_INDEX gets the string from first -> n

*The second SUBSTRING_INDEX removes the string from first -> n - 1
Check this SQLFiddle example
In your case, if you know the number of columns, your query would look something like (assuming you have 5 strings separated by comma):
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 1), '.', -1)
    , SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 2), '.', -1)
    , SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 3), '.', -1)
    , SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 4), '.', -1)
    , SUBSTRING_INDEX(SUBSTRING_INDEX(SomeColumn, '.', 5), '.', -1)
    FROM (
        SELECT GROUP_CONCAT(...) AS SomeColumn
            FROM ...
    ) AS SomeTable


text:
Q: want help for running MapReduce programs on Google Cloud storage I am using Google Cloud Storage for Hadoop 2.3.0 using GCS connector.
I have added GCS.jar to lib directory of my hadoop installation an added path to GCS connector in hadoop-env.sh file as:
export HADOOP_CLASSPATH=${HADOOP_CLASSPATH:"/share/hadoop/common/lib/gcs_connector"}

I had also made changes to core-site.xml file of Hadoop installation as:

   <property>
   <name>fs.defaultFS</name>
   <value>hdfs://127.0.0.1:9000</value>
   </property>
   <property>
   <name>fs.gs.impl</name>
   <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem</value>
   <description>The FileSystem for gs: (GCS) uris.</description>
   </property>
   <property>
   <name>fs.AbstractFileSystem.gs.impl</name>
   <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFS</value>
   <description>The AbstractFileSystem for gs: (GCS) uris. Only necessary for use with Hadoop 2.
  </description>
  </property>
  <property>
  <name>fs.gs.impl</name>
  <value>com.google.cloud.hadoop.fs.gcs.GoogleHadoopFileSystem</value>
  </property>
  <property>
  <name>fs.gs.project.id</name>
  <value>1113</value>
  </property>
  <property>
  <name>fs.gs.system.bucket</name>
  <value>hadoop1</value>
  </property>
  <property>
  <name>fs.gs.working.dir</name>
  <value>/</value>
  </property>
  <property>
  <name>fs.gs.auth.service.account.enable</name>
  <value>true</value>
  </property>
  <property>
  <name>fs.gs.auth.service.account.email</name>
  <value>7168543aovnjqaf1e7sumil@developer.gserviceaccount.com</value>
  </property>
  <property>
  <name>fs.gs.auth.service.account.keyfile</name>
  <value>C://hadoop-2.3.0/etc/hadoop/gcskey.p12</value>
  </property>
  <property>
  <name>fs.gs.auth.client.id</name>
  <value>7168543aovnjqaf1e7sumil.apps.googleusercontent.com</value>
   </property>

The billing account for my created project is also enabled.
I created a bucket and the contents of the buckets are visible to me using:
hadoop fs -ls gs://hadoop1

I had tried the Hadoop click-to-deploy option of master and worker nodes for Hadoop and VM instances are created.
I had installed gcloud for auth login. Git repositories are also created.
I had followed MapReduce article posted on Google, but its not helpful for complete guidance.
Question: i want to run MapReduce programs developed in Java using deployed Hadoop on cloud? What path do I provide in my programs for input and output files?
My programs are working well on Hadoop platform on my system.


text:
Q: Can I tell MSBuild to look for a project's dependencies in a non-standard folder? Our build script effectively does this:
1) build project_a.csproj into non/standard/output/path
1) build project_b.csproj into non/standard/output/path
2) build tests_for_project_a.csproj into non/standard/test_output/path

Building the test project causes any referenced projects to be built a second time, since the output path isn't the same as what's in project_a.csproj. Is there a way to tell MSBuild where to go looking for those binaries?

A: So far, the best option I have found is to run the following:
1a) msbuild project_a.csproj
1b) msbuild project_a.csproj into non/standard/output/path

When I do step 1b, it doesn't rebuild the binaries, only copies them to the final destination.


text:
Q: Сheck that indents in code don't mix indents with spaces and tabs I need to сheck that the code does not mix indents whitespaces and tabs.
The code is mixed with spaces and tabs, if both conditions are met:

*

*There are lines containing a space up to the first non-whitespace character (or the end of the line)

*There are lines containing a tab character up to the first non-whitespace character (or the end of the line)

Here's what I've tried to do
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("input.txt");
        Scanner sc = new Scanner(fis);
        boolean flag1 = false;
        boolean flag2 = false;
        while (sc.hasNextLine()) {
            String str = sc.nextLine();
            for(int i = 1; i < str.length(); i++){
                if((str.charAt(0) == ' ') && (str.charAt(i) != ' ')) {
                    flag1 = true;
                    break;
                }
            }
            System.out.println(flag1);
            for(int i = 0; i < str.length(); i++){
                int ind = str.indexOf("\t");
                int ind2 = -1;
                if(str.indexOf("\t") != -1){
                    if((str.charAt(i) != ' ') && (str.charAt(i) != '\t')) {
                        ind2 = str.indexOf(str.charAt(i));
                        if (ind < ind2) {
                            flag2 = true;
                        }
                    break;
                    }
                }
            }
            if (flag1 && flag2){
                break;
            }
        }
        FileOutputStream fos = new FileOutputStream("output.txt");
        PrintWriter pw = new PrintWriter(fos);
        if(flag1 == true && flag2 == true){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}

But it doesn't work right when the input is
  // whitespace
        // tab

Example of input:
public class Main
{
  public static void main(String[]  args)
  {
  }}

Output
YES

Could you explain how can I fix this?

A: Your code seems overly complex. Re-phrasing the assignment:

Examine all leading white-spaces, i.e. examine all indentations. If you find both space and tab characters, the input has mixed indentations.

try (Scanner sc = new Scanner(new FileInputStream("input.txt"))) {
    boolean foundSpace = false, foundTab = false;
    while ((! foundSpace || ! foundTab) && sc.hasNextLine()) {
        String line = sc.nextLine();
        for (int i = 0; i < line.length(); i++) {
            char ch = line.charAt(i);
            if (ch == ' ')
                foundSpace = true;
            else if (ch == '\t')
                foundTab = true;
            else
                break; // end of leading white-spaces
        }
    }
    System.out.println(foundSpace && foundTab ? "NO" : "YES");
}

A: As Piotr suggests, the best solution is using regex (more efficent than loops I think) and here is how I did it,
import java.io.*;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("input.txt");
        Scanner sc = new Scanner(fis);
        boolean flag1 = false;
        boolean flag2 = false;
        while (sc.hasNextLine()) {
            String str = sc.nextLine();

            // matches spaces
            Pattern pattern1 = Pattern.compile("^\\s*[ ]+\\s*[^\\s]+");
            Matcher matcher1 = pattern1.matcher(str);
            flag1 = matcher1.find();

            // matches tabs
            Pattern pattern2 = Pattern.compile("^\\s*[\t]+\\s*[^\\s]+");
            Matcher matcher2 = pattern2.matcher(str);
            flag2 = matcher2.find();

            if (flag1 && flag2){
                break;
            }
        }
        FileOutputStream fos = new FileOutputStream("output.txt");
        PrintWriter pw = new PrintWriter(fos);
        if(flag1 == true && flag2 == true){
            System.out.println("NO");
        } else {
            System.out.println("YES");
        }
    }
}


text:
Q: How to create bitmap from string text with SkiaSharp I created an entry where you type in a value, but now I want to create a bitmap with the text of an entry. When I got the bitmap, I can load it in SkiaSharp and use BitmapModifiers on it.
Is this possible?

A: I would recommend you to go through these examples on github.
Dummy sample could look like this:
This is xaml page:
<StackLayout>
    <Entry x:Name="InputText" />
    <Button Text="Create Bitmap" Clicked="Button_Clicked" />
</StackLayout>

Codebehind:
SKBitmap helloBitmap;

void OnCanvasViewPaintSurface(object sender, SKPaintSurfaceEventArgs args)
{
    SKImageInfo info = args.Info;
    SKSurface surface = args.Surface;
    SKCanvas canvas = surface.Canvas;

    canvas.Clear(SKColors.Aqua);

    canvas.DrawBitmap(helloBitmap, 0, 0);
}

private void Button_Clicked(object sender, EventArgs e)
{
    CreateBitmapFromText(InputText.Text);
}

private void CreateBitmapFromText(string text)
{
    // Create bitmap and draw on it
    using (SKPaint textPaint = new SKPaint { TextSize = 48 })
    {
        SKRect bounds = new SKRect();
        textPaint.MeasureText(text, ref bounds);

        helloBitmap = new SKBitmap((int)bounds.Right,
                                    (int)bounds.Height);

        using (SKCanvas bitmapCanvas = new SKCanvas(helloBitmap))
        {
            bitmapCanvas.Clear();
            bitmapCanvas.DrawText(text, 0, -bounds.Top, textPaint);
        }
    }

    SKCanvasView canvasView = new SKCanvasView();
    canvasView.PaintSurface += OnCanvasViewPaintSurface;
    Content = canvasView;
}


text:
Q: Show SQL result in horizontal format All I want is to transform this:
Period  | Department    | Print | Copy
---------------------------------------
201601  | Dept 1        | 10    | 20
201601  | Dept 2        | 20    | 10
201602  | Dept 1        | 30    | 40
201602  | Dept 2        | 40    | 30
201603  | Dept 1        | 50    | 60
201603  | Dept 2        | 60    | 50

into this:
Department  | 201601 Print  | 201601 Copy   | 201602 Print  | 201602 Copy   | 201603 Print  | 201603 Copy
------------------------------------------------------------------------------------------
Dept 1      | 10            | 20            | 30            | 40            | 50            | 60
Dept 2      | 20            | 10            | 40            | 30            | 60            | 50

I was trying to build the script with PIVOT but I don't know how to show both "Print" and "Copy" of each period in the columns.
Besides, since the values of 'Period' would be unknown therefore I cannot hard-code the value in the script as well.
Here is my attempt:
SELECT [Department]
    ,[201601] AS [201601 Copy]
    ,[201602] AS [201602 Copy]
    ,[201603] AS [201603 Copy]
FROM
    (SELECT [Copy], [Period], [Department] from #tempTable) AS ST
PIVOT
    (SUM([Copy]) FOR [Period] IN ([201601],[201602],[201603])) AS PT

And here is the script for creating the table with my sample data:
IF OBJECT_ID('tempdb..#tempTable') IS NOT NULL
    DROP TABLE #tempTable
CREATE TABLE #tempTable(
    [Period] varchar(50)
    ,[Department] varchar(50)
    ,[Print] int
    ,[Copy] int
)
INSERT INTO #tempTable VALUES
     ('201601', 'Dept 1', 10, 20)
    ,('201601', 'Dept 2', 20, 10)
    ,('201602', 'Dept 1', 30, 40)
    ,('201602', 'Dept 2', 40, 30)
    ,('201603', 'Dept 1', 50, 60)
    ,('201603', 'Dept 2', 60, 50)

Thanks for any reply in advance.
ANSWER
I studied the answers received and finally build the below script:
DECLARE @sql AS varchar(max);
SELECT @sql = 'SELECT [Department],' +
    STUFF((
        SELECT DISTINCT
            ',SUM(ISNULL(CASE [Period] WHEN ''' + [Period] + ''' THEN [Print] END, 0)) AS [' + [period] + ' Print]' +
            ',SUM(ISNULL(CASE [Period] WHEN ''' + [Period] + ''' THEN [Copy]  END, 0)) AS [' + [period] + ' Copy]'
        FROM #TempTable
        FOR XML PATH('')
    ), 1, 1, '') +
    'FROM #TempTable
    GROUP BY [Department]';
PRINT @sql
EXEC(@sql);

A: You can use a dynamic sql query.
Query
declare @sql as varchar(max);
select @sql = 'select [Department],' + stuff((
    select distinct ',max(case [Period] when ' + char(39) + [Period] + char(39) +
    ' then [Print] end) [' + [period] + ' Print]'
    + ',max(case [Period] when ' + char(39) + [Period] + char(39) +
    ' then [Copy] end) [' + [period] + ' Copy]'
    from #TempTable
    for xml path('')
), 1, 1, '');

select @sql += ' from #TempTable group by [Department];';
exec(@sql);

A: Another dynamic SQL that uses a pivot.
But this one uses a variable @Columns to generate a string with the column names.

declare @Columns varchar(max);
set  @Columns = STUFF((SELECT ', ' + QUOTENAME([Period] +' Print') + ', ' + QUOTENAME([Period] +' Copy') FROM  #tempTable GROUP BY [Period] FOR  XML PATH(''), TYPE).value('.', 'NVARCHAR(max)') ,1,1,'');

declare @SQL varchar(max);
set @SQL = 'select *
from (
select [Department], [Period] + '' Print'' as Title, [Print] as Value from #tempTable
union all
select [Department], [Period] + '' Copy'' as Title, [Copy] as Value from #tempTable
) q
pivot (sum(Value) for Title in ('+ @Columns +')) p;';

--select @SQL;
exec (@SQL);

A: You can achieve this using ISNULL() and SUM() Functions.
SELECT [Department]
        ,SUM(ISNULL(CASE WHEN [Period]='201601' THEN [Print] END,0)) AS [201601 Print]
        ,SUM(ISNULL(CASE WHEN [Period]='201601' THEN Copy END,0)) AS [201601 Copy]
        ,SUM(ISNULL(CASE WHEN [Period]='201602' THEN [Print] END,0)) AS [201602 Print]
        ,SUM(ISNULL(CASE WHEN [Period]='201602' THEN Copy END,0)) AS [201602 Copy]
        ,SUM(ISNULL(CASE WHEN [Period]='201603' THEN [Print] END,0)) AS [201603 Print]
        ,SUM(ISNULL(CASE WHEN [Period]='201603' THEN Copy END,0)) AS [201603 Copy]
FROM #tempTable
GROUP BY [Department]

A: SELECT Department,SUM([201601Print])[201601 Print],SUM([201601Copy])[201601  Copy],SUM([201602Print])[201602 Print],
                 SUM([201602Copy])[201602 Copy],SUM([201603Print])[201603   Print],SUM([201603Copy])[201603 Copy] FROM (
SELECT [Department]
,[201601] AS [201601Copy]
,[201602] AS [201602Copy]
,[201603] AS [201603Copy]
,0 AS [201601Print]
,0 AS [201602Print]
,0 AS [201603Print]
FROM
(SELECT  [Period],[Copy], [Department] from #tempTable) AS ST
PIVOT
(SUM([Copy]) FOR [Period] IN ([201601],[201602],[201603])) AS PT
UNION ALL
SELECT [Department]
,0 AS [201601Copy]
,0 AS [201602Copy]
,0 AS [201603Copy]
,[201601] AS [201601Print]
,[201602] AS [201602Print]
,[201603] AS [201603Print]
FROM
(SELECT  [Period],[Print], [Department] from #tempTable) AS ST
PIVOT
(SUM([Print]) FOR [Period] IN ([201601],[201602],[201603])) AS PT
)A GROUP BY Department


text:
Q: Setting up Android Bootstrap in IntelliJ I found this open source project: Android Boostrap. However, I am having some troubles with getting it run in IntelliJ. I have followed their own instructions, but still I am running into some problems. Note that I just started using IntelliJ. I cannot even describe the errors I am getting very precisely, since I am not sure about what exactly is causing them. Here is the screenshot of what I have:

Navigating to the problem:

How do you suggest me to solve it?
Another snapshot regarding unsupported import:


text:
Q: Search contours on the image I'm trying solve the recognition problem with a help OpenCV library for C++.
I have a some text(below) and i want to separate each symbol in this text using by cvFindContours(...) function. After, I want to send each separated symbol on the input of neural network for recognition it. It's all ok. I will can get all contours in my image and i can drawn it on my image with a help cvDrawContours(...) function(below). But cvFindContours(...) returns unordered sequence(pointer on the first contour in this sequence) where contains all the found contours. For my task order is very important.
CVAPI(int)  cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
                            int header_size CV_DEFAULT(sizeof(CvContour)),
                            int mode CV_DEFAULT(CV_RETR_LIST),
                            int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
                            CvPoint offset CV_DEFAULT(cvPoint(0,0)));

-image- source image
-storage- for storing where contains contours
-first_contour- pointer to the first contour in the storage
-mode- mode of search (I use the CV_RETR_EXTERNAL for search external contours)
-method- method of approximation (I'm using the CV_CHAIN_APPROX_SIMPLE by default)

How can I make the cvFindContours(...) function that returns the contours in the order in which they in the picture? Is it possible?
Thanks!

A: You can't directly force findContours to yield contours in a certain order (I mean there is no parameter to tune this in the function call).
To sort your contours in a "read text" order, you could do a loop which goes through all your contours and retrieves for each contour the top-leftest point, either by directly going through all points in each contour object, or by using a boundingbox (see minAreaRect for example).
Once you have all these points, sort them from left to right and bottom to top (some adjustments will probably have to be made, like detecting all contours starting within a range of heights to be all part of the same text line)

A: You have found bounding rectangles for all the contours present in your image. Instead of going about with the left-most point approach, you can sort your contours based on the centroid of each contour, which is more robust since your approach is being for text.
THIS ANSWER from the OpenCV  community might help provide a start


text:
Q: How to parse a multi-array JSON (Java) I'm currently working on a project that requires the latitude and longitude of a given address (input). Google maps API returns in json format, and I've done research and found that json-simple is the best option for my project. I have this code as well as the String output from google maps API, and would highly appreciate some help in parsing properly.
Also note: the call: MapTile.receiveJson just returns the string from google's API (linked below)
try {
            String jsonAdr = MapTile.receiveJson("http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA");
            JSONParser parser = new JSONParser();
            JSONObject json = (JSONObject)parser.parse(jsonAdr);
            System.out.println("lat=" + json.get("address_components"));
        } catch (Exception e1) {e1.printStackTrace();System.out.println("Error contacting google or invalid input");}

This is the exact string output from google's API:
http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA
I realize I could do String parsing, however it would be inefficient as I will be using more of google's API. I have also viewed other stack overflow, as well as their JSON website but found no examples with multiple JSON arrays such as those returned by google.
Any help is greatly appreciated.

A: Here's the solution:
I basically made a stand alone and I parsed your JSON like this:
First : This is the method I used to parse the JSON:
public String loadJSON(String someURL) {

        String json = null;
        HttpClient mHttpClient = new DefaultHttpClient();
        HttpGet mHttpGet = new HttpGet(someURL);

        try {

            HttpResponse mHttpResponse = mHttpClient.execute(mHttpGet);
            StatusLine statusline = mHttpResponse.getStatusLine();
            int statusCode = statusline.getStatusCode();
            if (statusCode != 200) {

                return null;

            }
            InputStream jsonStream = mHttpResponse.getEntity().getContent();

            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    jsonStream));

            StringBuilder builder = new StringBuilder();
            String line;

            while ((line = reader.readLine()) != null) {

                builder.append(line);

            }

            json = builder.toString();

        } catch (IOException ex) {

            ex.printStackTrace();

            return null;
        }
        mHttpClient.getConnectionManager().shutdown();
        return json;

    }

Second : Used Async Task to download the data:
public class BackTask extends AsyncTask<Void, Void, Void> {

        String url;

        public BackTask(String URL) {
            super();
            this.url = URL;

        }

        @Override
        protected Void doInBackground(Void... params) {

            getData(url);
            return null;
        }

    }

Third: Method to get the data and parse it. I have made some comments for this part since it's a bit long than usual.
public void getData(String URL) {

        try {
            JSONObject mainJsonObject = new JSONObject(loadJSON(URL));
            // Log.d("JSON Data : ", mainJsonObject.toString());

            String Status = mainJsonObject.getString("status");
            Log.d("JSON Status : ", Status + "\n" + "---------------------");

            JSONArray mainArray = mainJsonObject.getJSONArray("results");
            // Log.d("JSON Array : ", mainArray.toString());

            for (int i = 0; i < mainArray.length(); i++) {

                JSONObject insideJsonObject = mainArray.getJSONObject(i);

                if (insideJsonObject != null) {

                    String address_components = insideJsonObject
                            .getString("address_components");
                    // Log.d("Inside JSON Array : ", address_components);

                    JSONArray addressJSON = insideJsonObject
                            .getJSONArray("address_components");
                    // Log.d("Inside JSON ADDress : ", addressJSON.toString());

                    String formatted_address = insideJsonObject
                            .getString("formatted_address");
                    Log.d("Inside JSON formatted_address : ", formatted_address
                            + "\n" + "-----------");

                    for (int ji = 0; ji < mainArray.length(); ji++) {

                        JSONObject geoMetryJO = mainArray.getJSONObject(ji);

                        if (geoMetryJO != null) {

                            JSONObject geometry = geoMetryJO
                                    .getJSONObject("geometry");
                            // Log.d("Inside JSON geometry : ",
                            // geometry.toString()+"\n"+"----------");

                            String location_type = geometry
                                    .getString("location_type");
                            Log.d("Inside JSON location_type : ", location_type
                                    + "\n" + "------------");

                            JSONObject locationJSONObject = geometry
                                    .getJSONObject("location");

                            String Latitude = locationJSONObject
                                    .getString("lat");
                            Log.d("Inside JSON Latitude : ", Latitude + "\n"
                                    + "--------------");
                            String Longitude = locationJSONObject
                                    .getString("lng");
                            Log.d("Inside JSON Longitude : ", Longitude + "\n"
                                    + "------------");

                            JSONObject viewportJSONObject = geometry
                                    .getJSONObject("viewport");
                            // Log.d("Inside JSON viewportJSONObject : ",
                            // viewportJSONObject.toString()+"\n"+"------------");

                            JSONObject northeastJSONObject = viewportJSONObject
                                    .getJSONObject("northeast");
                            String Lat = northeastJSONObject.getString("lat");
                            Log.d("Inside JSON Lat : ", Lat + "\n"
                                    + "------------");
                            String Lon = northeastJSONObject.getString("lng");
                            Log.d("Inside JSON Lon : ", Lon + "\n"
                                    + "------------");

                            JSONObject southwestJSONObject = viewportJSONObject
                                    .getJSONObject("southwest");
                            String south_Lat = southwestJSONObject
                                    .getString("lat");
                            Log.d("Inside JSON south_Lat : ", south_Lat + "\n"
                                    + "------------");
                            String south_Lon = southwestJSONObject
                                    .getString("lng");
                            Log.d("Inside JSON south_Lon : ", south_Lon + "\n"
                                    + "------------");
                        }

                    }

                    for (int k = 0; k < addressJSON.length(); k++) {

                        JSONObject addressJSONObject = addressJSON
                                .getJSONObject(k);

                        if (addressJSONObject != null) {

                            String long_name = addressJSONObject
                                    .getString("long_name");
                            Log.d("Inside JSON LongName : ", long_name);
                            String short_name = addressJSONObject
                                    .getString("short_name");
                            Log.d("Inside JSON ShortName : ", short_name);

                            JSONArray addressJSONArray = addressJSONObject
                                    .getJSONArray("types");
                            Log.d("Inside JSON JSONADD : ",
                                    addressJSONArray.toString() + "\n"
                                            + "-------------");

                        }

                    }

                    JSONArray insideJsonArray = insideJsonObject
                            .getJSONArray("types");
                    Log.d("Inside JSON Types : ", insideJsonArray.toString());
                    String street = insideJsonObject.getString("types");
                    Log.d("Inside JSON Street : ", street);

                }

            }

        } catch (JSONException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

After getting all the data, you can use it in anyway you want cause it's mostly in the string format. You can just copy and paste this method and it should run fine.
Fourth : On the onCreate() method, just executed the task like this:
public static final String URL = "http://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA";
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        new BackTask(URL).execute();

    }

This was the complete solution for this question. Let me know if have any questions for this. Hope this helps..Good Luck.. :)

A: I did this for formatted_address. I type casted explicitly here. But getJSONArray () and getJSONObject() methods will perform the typecasting too.
// parse the Result String to JSON
JSONObject myJSONResult = new JSONObject(results);
for (int i = 0; i <((JSONArray) myJSONResult.get("results")).length(); i++)
    System.out.println(((JSONObject) ((JSONArray) myJSONResult.get("results")).get(i)).get("formatted_address")); // This is your final options.


text:
Q: How to preserve the data for the previous http request before making new request using observable? Parent component
this.statisticsService.getData().subscribe(data =>
   this.processData(data));

processData(data: DataWrapper) {
  if (!isNullOrUndefined(data) && data.table.rows.length > 1) {
    this.noDataAvailableFlag = false;
    this._statisticsData.next(data);
  } else { // If no data available from backend
    console.log('no data available');
    this.handleNoDataAvailable();
  }
}

Template

    {{'DETAILS.No_Data_Available' | translate}}

Child component ngOnit method.
ngOnInit() {
  this.windowWidth = window.innerWidth;
  this._statisticsData.subscribe(data => {
  if (!isNullOrUndefined(data)) {
    this.processData(data);
  }
 });
}

If no data is available , i dont want to clear the table. I want data for the previous request remain shown in the table. Please suggest how i can make this workaround.

A: That's what the filter is for:
this._statisticsData
  .filter(data => !isNullOrUndefined(data))
  .subscribe(data => {
    this.processData(data);
  });


text:
Q: Apache "httpd" process, utilizing all my servers memory My small ec2 instance with 1.7 GB memory, running the Amazon AMI based off of CentOS, has an issue with Apache utilizing way too much memory than it should. If you take a look at the screenshot, the memory usage will be at 90-100% until I reboot the httpd service, where it will start over, increasing its way back up to 90+ %.

I would really appreciate some assistance on how to locate the issue. Is this perhaps "normal" apache behavior, to utilize all available memory? Or is there a possible leak I have to hunt down. At the moment I'm a bit perplexed as to what could be going on.
We are using the Apache MPM prefork, and no sql or anything similar - just apache. The website is here.

A: As HTTP500 said, you probably shouldn't worry about it unless the machine is actually choking.  Take a look at Help! Linux Ate My RAM!.  It's not quite an analogous situation, as you have processes rather than buffers using up the RAM, but it's not too far off: your machine's physical RAM is a resource to be used, either with kernel buffers or spare Apache worker processes to promptly handle incoming requests.  If you're not using RAM, you've overpaid for the size of your box.
Anyway, if you want to play with MPM settings, the Apache documentation is http://httpd.apache.org/docs/current/mod/prefork.html
You can perhaps reduce the MinSpareServers, StartServers, etc., as you've stated that the site is low traffic.  You will then have more free RAM to be consumed by kernel buffers for their nefarious purposes.

A: linux using all your memory is normal, memory which isn't in use otherwise is re-purposed as disk cache.  see: linux ate my ram
You can verify this by looking at the output of free -m and expect to see something like this:
             total       used       free     shared    buffers     cached
Mem:          7889       6887        101          0        106       2307
-/+ buffers/cache:       5373       3416
Swap:         1903         17       1886

the +/- buffers/cache line is the one you want.  It adds cached ram to free to give you a better picture of how much memory is really available.  In this case, You want to pay attention to the 3416 number, not 101.


text:
Q: Second order PDE with coupled nonlinear coefficients I am trying to separate and solve this PDE:
$$ \frac{\partial^2{S(u,v)}}{\partial{u}^2}+\frac{\partial^2{S(u,v)}}{\partial{v}^2}-\left[\frac{a^2}{2  \cosh(u)  \cos(v)}\right] S(u,v) =0 $$
where $(u,v)$ are orthogonal curvilinear coordinates associated with a bipolar conformal mapping from Cartesian coordinates. Can someone suggest an analytic method to solve this in a separated closed-form that will allow me to satisfy boundary conditions on contours of constant $(u)$?
I have attempted a separation of variables approximation with $(v)$ held constant about some constant contour $(v=v_0)$:
$$ \frac{\partial^2{T(u)}}{\partial{u}^2}-\left[\frac{\gamma^2}{ \cosh(u)} +\beta^2 \right] T(u) =0 $$
where:
$$ \gamma^2=\frac{a^2}{2 \cos(v_0)}$$
but am unable to find a solution for this ODE.

A: Perhaps transform under a Laplace transform?
\begin{align}
\mathscr{L}\left(\frac{\partial S}{\partial v}\right) &= s U(u,v)-U(u,o) \\
\mathscr{L}\left(\frac{\partial^2 S}{\partial v^2}\right) &= s^2 U(u,v)-sU(u,o)-U_v(u,0)\\
\mathscr{L}\left(\frac{\partial S}{\partial u}\right) &= \frac{d U}{d u} \\
\mathscr{L}\left(\frac{\partial^2 S}{\partial u^2}\right) &= \frac{d^2 U}{d u^2}
\end{align}
The trickier part would be the transform of the term immediately to the left of the zero.


text:
Q: A Directed Preorder from a Local Base Prove that if $\mathscr{A}$ is a local base at point $p \in (X, \mathscr{T})$, then $\supset$ (the superset relation) is directed on $\mathscr{A}$.

Here are the definitions I am given for this problem
Call a preorder $R$ on a set $I$ directed if for all $x,y \in I$, there exists $z \in I$ such that $xRz$ and $yRz$.
If $\trianglelefteq$ is a directed preorder on $I$ and $\{x_i\}_{i \in I}$ is an $I-$sequence of points in $(X, \mathscr{T})$, say that  $\lim_{i \in I} x_i=y$ if for every open $y \in U,$ there exists $k\in I$ such that $(k \trianglelefteq n \Rightarrow x_n \in U)$.
Given $p \in X, \mathscr{A}$ is a local base at $p$ if  $\mathscr{A} \subset \mathscr{T}$ and $\left( \forall A \in \mathscr{A}, p \in A\right)$, and $\left(\forall U \in \mathscr{T} (p \in U \Rightarrow \exists A \in \mathscr{A} : p \in A \subset U) \right)$.

Based on what I have read so far, if a set is directed, then every two elements in $I$ have an upper bound, but not necessarily a least upper bound.  We want to show that the preorder $\supset$ has the property that $x \supset z$ and $y \supset z$ for all $x,y \in I$.
I am very confused as to how we proceed in solving this problem. How does one show this result? Any help will be greatly appreciated. Many thanks in advance for your time and patience.

A: You don't need the definition of limit along a directed set: it's not relevant here. This definition of local base at a point is standard; you'll want to remember it. It just says that $\mathscr{A}$ is a local base at $p$ if $\mathscr{A}$ is a collection of open nbhds of $p$ such that every open nbhd of $p$ is a superset of some member of $\mathscr{A}$. For instance, in $\Bbb R$ the set of intervals of the form $\left(x-\frac1n,x+\frac1n\right)$ for $n\in\Bbb Z^+$ is a local base at $x$.
Now, back to the actual problem. You're asked to show that if $\mathscr{A}$ is a local base at some point $p\in X$, then $\langle\mathscr{A},\supseteq\rangle$ is a directed set. As you say, this requires showing that if $A,B\in\mathscr{A}$, then $A$ and $B$ have an upper bound in $\mathscr{A}$ relative to the order $\supseteq$. Translate that into simpler terms: you want to show that there is a $C\in\mathscr{A}$ such that $A\supseteq C$ and $B\supseteq C$.
If we knew that $A\cap B$ was a member of $\mathscr{A}$, we could use it; unfortunately, it need not be a member of $\mathscr{A}$. However, $A\cap B$ is guaranteed to be an open nbhd of $p$, and therefore it contains ... ?


text:
Q: Issue with Arduino TX/RX when using different power sources I have had this issue multiple times and I really want to know what is going on. So I have a bench power supply, and I was powering my ESP8266 off of the bench supply. I then wanted to send it some AT commands, so I set up the Software Serial on the arduino and hooked everything up. All i got on the serial was complete garbage. I decide to disconnect the ESP8266 from the bench supply, and use the 3.3 output of the Arduino. I reset everything, and BOOM, serial monitor is working perfectly and I am no longer getting garbage from the ESP.
This has happened with multiple modules and I am at a total loss. Why would everything work fine when the module is running off of the 3.3v output of the arduino, and NOT when powered from 3.3v off of the bench power supply? Thank you for any clarification!

A: Your circuit is going to need a common ground between the Arduino and any sensor you're connecting to it.
Voltage is a reference of the potential between 2 points in a circuit. If the sensor and your microcontroller are not sharing a reference for where 0V is, the 3.3V on your Arduino and the 3.3V on your bench supply are "floating" and completely unrelated to each other. The signals from your sensor are as good as noise to your Arduino.
You can solve this by running a line from the GND on the Arduino to the V- on your bench supply, however you're going to want to be darn sure your bench supply is putting out an accurate and stable 3.3V or you risk damaging the Arduino I/O pins.


text:
Q: reloading the page after the ok button in sweetalert I am using sweetAlert code to reload the page after i click the OK, but it just appears for 4 seconds and then reload the page, how can i fix it.
my Code:
localStorage.setItem("swal",swal({title:"Good job!", text:"Thanks For your Quotation, we will get back to you soon!",
                        type:"success",timer:4000,showConfirmButton: true}));
                        location.reload();
                        localStorage.getItem("swal");

A: if you want to execute actions on the "OK" button try this:
swal({...}).then(function(){
    window.location.reload();
});

If you also have a "Cancel" button in your modal, you'll want to confirm that the "OK" button was indeed pressed:
swal({...}).then(okay => {
  if (okay) {
    window.location.reload();
  }
});

the variable "okay" is true if the user clicked the "OK" button, otherwise is false
Update
try to update your code with this:
localStorage.setItem("swal",swal({ title:"Good job!",
                                   text:"Thanks For your Quotation, we will get back to you soon!",
                                   type:"success",
                                   showConfirmButton: true
                                  }).then(function(){
                                      window.location.reload();
                                  })
                    );
localStorage.getItem("swal")

I made a fiddle, click here to test it as you can see everything works, when you press "OK" the page will reload (opening another time the swal, you have to handle the reload in your code)


text:
Q: How to sign out from instagram api in iOS? The instagram integration and login has been done.  How to sign out from instagram api in iOS? How to remove the access token?

A: You can logout the user by deleting the cookies.
   let cookieJar : NSHTTPCookieStorage = NSHTTPCookieStorage.sharedHTTPCookieStorage()
    for cookie in cookieJar.cookies! as [NSHTTPCookie]{
        NSLog("cookie.domain = %@", cookie.domain)

        if cookie.domain == "www.instagram.com" ||
            cookie.domain == "api.instagram.com"{

            cookieJar.deleteCookie(cookie)
        }
    }

A: The following is what we use. Note that the domain has to be ".instagram.com" not "www.instagram.com" since some cookies do not have the "www". Also the main cookie is "sessionid".
 override func signOut() {
    if let cookies = HTTPCookieStorage.shared.cookies {
        for cookie in cookies {
            if cookie.domain.contains(".instagram.com") {
                HTTPCookieStorage.shared.deleteCookie(cookie)
            }
        }
    }
 }

A: Try this code
InstagramEngine.shared().logout()


text:
Q: TableView in TableViewCell with RxSwift Binding I want to bind a tableview in a tableview cell to an observable. The first tableview works perfect, but the problem is that the second tableview inside the cell is not displayed even though it gets the data.
I have 2 functions: function: "populateCustomCategorys" is for the main table view and the function "populateDetailCustomCategory" is for the tableview inside the cell.
Heres my code:
//MARK: Custom TableView
    private func populateCustomCategorys() {
        let observableItems = viewModel.getCustomCleaningPlanData().asObservable()
        observableItems.bind(to: customTableView.rx.items(cellIdentifier: "dailyCustomCell", cellType: DailyCustomTableViewCell.self)) { (row, element, cell) in
            cell.titleLabel.text = element.categoryName
    }.addDisposableTo(disposeBag)
}

//MARK: Custom Detail Table View
private func populateDetailCustomCategorys() {
    let cell = customTableView.dequeueReusableCell(withIdentifier: "dailyCustomCell") as! DailyCustomTableViewCell

    observableItems.bind(to: cell.DetailTableView.rx.items(cellIdentifier: "dailyDetailCustomCell", cellType: DailyCustomDetailTableViewCell.self)) { (row, element, cell) in
        //print(cell.titleLabel)
        //cell.titleLabel.text = element.owner.title
        //cell.checkmarcButton.isSelected = element.owner.status
        cell.config(title: element.owner.title ?? "Temp", check: element.owner.status)

       print("/////////// \(element)")
       // print()
    }.addDisposableTo(disposeBag)
}[enter image description here][1]


text:
Q: Alexa Skill FeedHelper.js - how can i get the enclosure URL? I am using a blueprint from Amazon to develop an Alexa feed skill. In this blueprint, RSS feeds are called from an URL and transformed into JSON format and saved on Amazon S3.
This file is responsible to do that action (and it works well for the standard elements)
https://github.com/alexa/skill-sample-nodejs-feed/blob/master/lambda/custom/feedHelper.js
I need now also the enclosure url, because i want to play a podcast. I thought it will work by adding following into the feedHelper.js in Line 63:
                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure'].attributes['url'];
                    }

But the JSON which is generated on S3 with help of this file has still no enclosure element in there. Did I even call it correctly?
I also tried already:
                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure'].url;
                    }

and
                        if (item['enclosure']) {
                        feedItem['enclosureUrl'] = item['enclosure']['url'];
                    }

The other issue is, that the audio link is linked with https:// and Amazon don't accept HTTP...
But when I put in this address manually in the browser bar with https in front, the download works. So hopefully I am able to just change the HTTP from the enclosure tag into https like described here?
http://code.dblock.org/2017/02/09/alexa-skill-to-play-your-podcast.html
So to summarize above: I need this element from an RSS feed
      <enclosure type="audio/mpeg" url="http://feeds.soundcloud.com/stream/file.mp3" length="7087881"/>

to be written in the JSON that is created with the feedHelper.js
Currently, it did not generate any enclosure element in the json, despite my code above.
Does anyone have an idea?
Thank you!

A: A friend helped me to find out that the normalize option of the feed parser hides the enclosure tag from me. So i turned normalize off. But then you have to call the items a bit different. Like rss:title instead of title,.. etc.
Solved the issue for me!


text:
Q: How can I animate a cylinder that's decreasing in height? I'm trying to Animate a cylinder standing upright that decreases its height through time. To be specific I wanted the height to decrease starting from the bottom so when I run the program the cylinder that had height h initially will eventually reach a very small height.
scene= canvas(width=400, height=400, autoscale=False)#creates scene

for i in arange(0,9.9,0.04):
    rod11 = cylinder(pos=vector(0,-3+i,0), axis=vector(0,3,0), radius=0.1, length=10-i)
    rate(20)

I tried using each case of 'i', I used i=1, i=2, i=3, and so on to see if the cylinder shortens like I wanted it and it does but when i used 'i' it didn't work


text:
Q: moving data from one listbox (data from database) to another listbox in same page Please help me ,I am very new to asp.net.I have one Listbox, on which data has been taken from the database, I want to move this data into another Listbox one by one ,what is ASP.Net c# code for this?
thanks in advance..

A: ListBox2.Items.AddRange(ListBox1.Items.Cast<ListItem>().ToArray());

you need to add using statement to
using System.Linq;
using System.Web.UI.WebControls;


text:
Q: Spring Cloud Stream content-based routing on payload We are using Spring Cloud Stream v2.2 with Kafka and Avro (native encoder/decoder). We are trying to use content-based routing based on a condition on the payload. I understand that according to Spring Cloud Stream docs content-based routing is only achievable on the header as payload has not gone through the type conversion process when it arrives at the condition. Therefore, unless the condition is based on the byte format, it won't work as expected. However, I understand that when Avro is used in the native mode then the message header is skipped and no type negotiations are being handled. So I am not sure if content-based routing does work on the payload as expected or not.
@StreamListener(target = Channels.INPUT, condition =
      "payload.context['type']=='one' or"
          + " payload.context['type']=='two'")
  public void doStuff(TypeOneAndTwoData inputData){
...
channels.outputChannel().send(MessageBuilder.withPayload(inputData).build());
}

@StreamListener(target = Channels.INPUT, condition =
      "payload.context['type']=='three' or"
          + " payload.context['type']=='four'")
  public void doOtherStuff(TypeThreeAndFourData inputData){
...
channels.outputChannel().send(MessageBuilder.withPayload(inputData).build());
}

Based on the logging that I have got in place I can see that occasionally doStuff is being triggered and sometimes doOtherStuff is being triggered. However, it seems that mostly none of them is being triggered and the message is skipped. Based on the input data I am sure that context.type can only have 4 values of "one", "two", "three" and "four", so based on the input it's not possible to expect having something else, but frequently I can see the following entry in the logs:
Cannot find a @StreamListener matching for message with id: null

I have a few questions:

*

*Does condition on payload work on the message after it is deserialized to the corresponding POJO class in the native Avro format?

*Why sometimes the condition works and sometimes it does not? Does id: null mean something?

*How content-based routing work from the thread perspective? Do multiple threads run when we have two StreamListner with separate conditions or they work single-threaded? How at-least-once guarantee message delivery being managed in this scenario? Should the conditions be mutually exclusive?

A: *

*Yes; it's (currently) supported.

*id: null is unfortunate; with Kafka the message.headers['id'] is null by default - it has no meaning anyway so this log message is not much use.

*The issue is that none of the conditions match the converted payload
You can set a breakpoint in DispatchingStreamListenerMessageHandler.handleRequestMessage() to figure out what's wrong.
EDIT
I didn't answer your third question.
The calls are single-threaded; no, a message can match multiple conditions; you only get that log when no conditions match. See the method I referenced above.
If multiple conditions match any exception thrown by a listener will stop processing (and invoke retry/DLQ processing etc).


text:
Q: Property children is optional for no reason I have a function called provide that wraps a component with an array of providers.
The syntax is provide([Provider,propsObject])(WrapedComponent) and it replaces:
<Provider {...propsObject}>
    <WrapedComponent/>
</Provider>

My types are provider and providers, and they are used in wrap and provide:
//This type is Component or tuple of [Component,props without children]
type Provider<P> = React.ComponentType<P>  | [React.ComponentType<P>, Omit<P, "children">];

type Providers<T extends any[]> = {
  [P in keyof T]: T[P] extends T[number] ? Provider<T[P]> : never;
};

The wrap :

const wrap = <T extends any[]>(...providers: Providers<T>) => ( element: React.ReactNode) =>
  providers.reduceRight((element: React.ReactNode, provider) => {
    let Provider: React.ComponentType<any>,
      providerProps: object = {};

    if (Array.isArray(provider)) [Provider, providerProps] = provider;
    else Provider = provider!;

    const wrap = createElement(Provider, providerProps, element);

    return wrap;
  }, element);

And the provide function is:
const provide = <T extends any[]>(...providers: Providers<T>) =>
<P extends { children: React.ReactNode }>(  component: React.ComponentType<P>) => {
  const Provide: React.FC<P> = (props) => {
    return wrap(...providers)(
      createElement(component, props)
    ) as React.ReactElement<P>;
  };
  return Provide;
};

All this code used to work, and works in most places. But I have one place that isn't working and I don't get why.
The error is:

The bottom line is that the wrapping components thinks that the provide function returns children as optional prop, and that's not true. How do I fix it?


text:
Q: Sum of Scaled Harmonic Numbers I came across the following identity:
$$
\frac{1}{n}\sum_{j=1}^{n}\sum_{k=j}^{n}\frac{1}{k}=1.
$$
However, I do not know how to prove it except verify it by numerical calculations.
Does any one know how to prove it or give me some hints? Thanks very much.

A: Using Iverson Brackets can simplify the changing of the order of summation:
$$
\begin{align}
\frac1n\sum_{j=1}^n\sum_{k=j}^n\frac1k
&=\frac1n\sum_{j=1}^n\sum_{k=1}^n[k\ge j]\frac1k\\
&=\frac1n\sum_{k=1}^n\sum_{j=1}^n[k\ge j]\frac1k\\
&=\frac1n\sum_{k=1}^n\sum_{j=1}^k\frac1k\\
&=\frac1n\sum_{k=1}^n1\\[9pt]
&=1
\end{align}
$$

A: In the double sum
$$\sum_{j=1}^{n}\sum_{k=j}^{n}\frac{1}{k}$$
each fraction $1/k$ occurs $k$ times, so overall these contribute $1$ to the sum.
As $k$ ranges from $1$ to $n$, the total sum is $n$.

A: We can also write the index region conveniently to better see what's going on.

We obtain
  \begin{align*}
\frac{1}{n}\sum_{j=1}^n\sum_{k=j}^n\frac{1}{k}&=\frac{1}{n}\sum_{\color{blue}{1\leq j\leq k\leq n}}\frac{1}{k}\\
&=\frac{1}{n}\sum_{k=1}^n\sum_{j=1}^k\frac{1}{k}\\
&=\frac{1}{n}\sum_{k=1}^n1\\
&=1
\end{align*}

A: Another proof uses the well-known formula for the sum of harmonic numbers
$$\sum_{k=1}^{n} H_k = (n+1)H_n -n$$
The double sum of the OP can be written as
$$\frac{1}{n} \sum_{j=1}^{n}\left (H_n - H_{j-1}\right)\\
=H_n - \frac{1}{n} \sum_{m=1}^{n-1} H_m\\
= H_n - \frac{1}{n} \left (n H_{n-1} -n +1\right)\\
= H_n - H_{n-1} + 1 -\frac{1}{n} = 1$$
In the second line we have used that $H_0=0$, and in last line we have employed the defining recursion relation of the harmonic numbers.

A: By double counting we have
$$\frac{1}{n}\sum_{j=1}^{n}\sum_{k=j}^{n}\frac{1}{k}=\frac1n \sum_{k=1}^{n}\sum_{j=1}^{k}\frac{1}{k}=\frac1n \sum_{k=1}^{n}1=\frac1n \cdot n=1$$


text:
Q: Angular Material md-autocomplete with md-chips doesn't clear search if blank I am using md-autocomplete inside an md-chips.  If I type 'a' and then select from the list, the control works correctly.
however, if i don't type any search string and simply select from the list (because i want min-length=0), then the control shows the chip and also shows the contents as my new search string??
http://jsfiddle.net/3t715vLw/
<md-autocomplete md-min-length="0"

A: In your code take this part out md-item-text="item"
jsfiddle


text:
Q: Pros and Cons of SQLite and Shared Preferences What is the good mechanism to store information among SQLite database and Shared Preferences?
Why use shared preferences? Why use sqlite? I tried to find the difference between them, and which is the better mechanism for data storing, but I am unable to find the appropriate answer on Google. Please help me with example and explanations.

A: *

*For storing huge amount of data, go for SQLite database system. This
will allow the user to search for data as well.

*On the other hand, for storing small amount of data, go for Shared
Preferences. In this case, a huge database system is unnecessary.
This will allow user to simply save data and load them.

A: My take is, it is not about speed or size but the kinds of operation you want to do to your data.
If you plan to do join, sort, and other DB operations on your data then go for Sqlite. An example is sorting data by date.
If you want to map simple values (like int, boolean, String) then use Preferences. DB operations won't work here and needless to say you need to have all the keys. An example is user password or app configuration.
The big temptation to embrace Preferences is when you want to use it to store a flattened POJO (a serialized JSON object) as String. Having such need is actually the sign to use Sqlite. Why ? Because complex data will eventually need complex oprations. Imagine retrieving a specific entry which could be handled by a simple "SELECT ... WHERE id = 1". In Preferences path, this will be a long process from deserializing to iterating the results.

A: It really depends on the data you want to store.
SQLite
Large amounts of same structured data should be stored in a SQLite database as databases are designed for this kind of data. As the data is structured and managed by the database, it can be queried to get a sub set of the data which matches certain criteria using a query language like SQL. This makes it possible to search in the data. Of course managing and searching large sets of data influences the performance so reading data from a database can be slower than reading data from SharedPreferences.
SharedPreferences
SharedPreferences is a key/value store where you can save a data under certain key. To read the data from the store you have to know the key of the data. This makes reading the data very easy. But as easy as it is to store a small amount of data as difficult it is to store and read large structured data as you need to define key for every single data, furthermore you cannot really search within the data except you have a certain concept for naming the keys.

A: This question has an accepted answer, but I think there is more to said on the topic - regarding speed.
An application's SharedPreferences and Sqlite DB are both just files, stored in the application's directories on the device's file system.  If the amount of data is not too big, the Sqlite option will involve a larger and more complicated file with more processing overhead for simple access.
So, if the nature of the data does not dictate your choice (as explained in accepted answer), and speed matters, then you are probably better to use SharedPreferences.
And reading some data is often on the critical path to displaying the main activty so I think speed is often very important.
One final thought regarding speed and efficiency - if you need to use an Sqlite database for some structured data then it is probably more efficient to also store user preferences in the database so you are not opening a second file.  This is a fairly minor consideration - probably worth consideration only if you need to access both the structured data and preferences before you can display the main activity.

A: Forget SQLLite forget SharedPreferences, use Realm. A single solution for all your local storage. You can use plain old Java Objects as RealmObjects  and store your data there. You can convert selcted queries into JSON files. No need to parse the entire data base.
Check this link:
https://realm.io/news/introducing-realm/


text:
Q: Compiling OpenJDK 6 from sources on Windows 7 using Windows SDK v7.1 I am trying to compile the OpenJDK 6 from sources on a Windows 7 machine with Windows SDK v7.1.
After some tweaks I reached a point where I really do not know what is the right thing to do.
Here is the file - http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/windows/native/sun/nio/ch/WindowsSelectorImpl.c
The lines 47 and 49:
   static int POLLIN   = 1;  // line 47
   static int POLLCONN = 2;
   static int POLLOUT  = 4;  // line 49

The problem is that the included file winsock2.h has the following code:
#if(_WIN32_WINNT >= 0x0600)

/* Event flag definitions for WSAPoll(). */

#define POLLRDNORM  0x0100
#define POLLRDBAND  0x0200
#define POLLIN      (POLLRDNORM | POLLRDBAND)
#define POLLPRI     0x0400

#define POLLWRNORM  0x0010
#define POLLOUT     (POLLWRNORM)
#define POLLWRBAND  0x0020

#define POLLERR     0x0001
#define POLLHUP     0x0002
#define POLLNVAL    0x0004

typedef struct pollfd {

    SOCKET  fd;
    SHORT   events;
    SHORT   revents;

} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD;

#endif // (_WIN32_WINNT >= 0x0600)

Notice how winsock2 #defines POLLIN and POLLOUT, whereas WindowsSelectorImpl.c declares them as consts. Even worse, both give different values:
OpenJDK:
POLLIN = 1
POLLOUT = 4

WinSock2 (Windows SDK v7.1):
POLLIN = 0x300
POLLOUT = 0x10

Obviously, the OpenJDK code is not supposed to be compiled on Windows 7.
However, I do want to compile it on Windows 7.
One of the options is installing an older Windows SDK. Another is to change the file WindowsSelectorImpl.c, the question is how? My intention is to rename the constants, but I cannot help wondering about WinSock2 #defining constants with exactly the same names, but different values...
Any advices?
EDIT1
On second thought, maybe I am better off conditionally using the values from WinSock2? I mean the change in values probably means a change in API.
WinSock2.h defines pollfd like this:
typedef struct pollfd {
    SOCKET  fd;
    SHORT   events;
    SHORT   revents;
} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD;

vs WindowsSelectorImpl.c:
typedef struct {
    jint fd;
    jshort events;
} pollfd;

The former is being backward compatible with the latter (more or less, alignment aside).
So, there is a chance WinSock2 constants are the right ones for Windows 7, but then what to do with POLLCONN ? And how will the code run on Windows 2003 or XP?
EDIT2
Things are even worse, because the C implementation has a matching counterpart in java - http://hg.openjdk.java.net/jdk6/jdk6/jdk/file/tip/src/windows/classes/sun/nio/ch/WindowsSelectorImpl.java, which uses the same constants as the C code.
I do not get it. Does winsock2 on Windows 7 breaks any code written for winsock2 on Windows 2003 SP1?
EDIT3
Checked the jdk7u sources (WindowsSelectorImpl.c and AbstractPollArrayWrapper.java). It uses the rename approach, meaning even though the Windows SDK v7.1 declares POLLIN and POLLOUT with the different values, jdk7 sticks to the implementation of jdk6.
I really do not know what does it mean, but I am not going to be more catholic here than the Pope.

A: The solution is simple, though annoying - get Visual Studio 2003 and use it to compile OpenJDK. The most difficult part is to get VS2003 itself, all the rest is easy.


text:
Q: TSQL IF appears to randomly execute code from wrong logic branch I have an idempotent script that brings different database deployments up to the latest revision.  The column referenced in the code is actually deleted in a future release, so in order to preserve the script's validity I check if the column exists before executing the statement.  I noticed some unexpected behaviour whereby the IF logic branches seem to intermittently execute when the condition is false.
Basic example
IF (1 = 0)
    BEGIN
        PRINT 'Adding data'; -- Never printed
    END
GO

Testing the logic branch
IF (1 = 0)
    BEGIN
        PRINT 'Adding data';                       -- Never printed
        RAISERROR('One never equals zero', 16, 1); -- Never raised
    END
GO

Added data modification code
IF (1 = 0)
    BEGIN
        PRINT 'Adding data';                                            -- Never printed
        RAISERROR('One never equals zero', 16, 1);                      -- Never raised
        INSERT INTO [tbl_Users] ( NonExistentColumn ) VALUES ( 'Bar' ); -- Msg 207, Level 16, State 1, Line 6; Invalid column name 'NonExistentColumn'.
    END
GO

Why does this happen?  Particularly, why are the PRINT and RAISERROR lines correctly ignored but the INSERT still executes, even though the entire logic branch should be ignored?

A: None of your statements are run, it isn't skipping the PRINT and RAISERROR and going to the INSERT INTO, instead the entire batch fails due to a compilation error.
Despite some beliefs, T-SQL is parsed and validated before it is executed, and if the statement isn't valid then the entire batch won't be run; this is why when you have a syntax error, for example, none of the statements are run.
Here you have an invalid column reference, the column NonExistentColumn in the table [YourDefaultSchema].tbl_Users doesn't exist. Although SQL Server does have some deferred object validation, columns against objects that exist are not one of them. As such, when you ask for your batch to be executed, the parser checks to see table [YourDefaultSchema].tbl_Users has a column NonExistentColumn, and when it finds it doesn't, it raises an "Invalid Column Name" error.
If the table itself did not exist, then this error would not occur. For example, take the following batches:
CREATE TABLE dbo.SomeTable (SomeColumn int);
GO
PRINT N'First Batch Starts';
IF 1 = 0 BEGIN
    PRINT N'Entered first IF.';
    INSERT INTO dbo.SomeTable (AnotherColumn)
    VALUES(1);
END;
PRINT N'First Batch Ends';
GO
PRINT N'Second Batch Starts';
IF 1 = 0 BEGIN
    PRINT N'Entered second IF.';
    INSERT INTO dbo.AnotherTable (AnotherColumn)
    VALUES(1);
END;
PRINT N'Second Batch Ends';
GO

DROP TABLE dbo.SomeTable;

In the messages pane of SSMS you will get the following:
Msg 207, Level 16, State 1, Line 6
Invalid column name 'AnotherColumn'.
Second Batch Starts
Second Batch Ends

Notice that none of the PRINT statements from the first batch print, as the batch isn't run, however, in the second batch they are, as the validation of the column is deferred till that statement would be run (and it's never run, so no error occurs).
If you wanted to reference a potentially non-existent column on an existing object, defer the statement's validation using sys.sp_executesql:
CREATE TABLE dbo.SomeTable (SomeColumn int);
GO
PRINT N'Third Batch Starts';
IF 1 = 0 BEGIN
    PRINT N'Entered first IF.';
    EXEC sys.sp_executesql N'INSERT INTO dbo.SomeTable (AnotherColumn) VALUES(1);';
END;
PRINT N'Third Batch Ends';
GO

DROP TABLE dbo.SomeTable;

This simply prints the following:
Third Batch Starts
Third Batch Ends

db<>fiddle


text:
Q: R error "object 'required_pkgs' not found whilst loading namespace 'timetk'" I am using R 4.0.3 with RStudio 1.2.5033 on macOS 11.1.
I have successfully installed the package using install.packages("timetk").
When trying to load the package with library(timetk), I get the following error:
Error: package or namespace load failed for 'timetk':
object 'required_pkgs' not found whilst loading namespace 'timetk'
I do not know how to solve this. Can anyone please offer help or advice?
Thank you,
C

A: This seems to be an error with the package, an is a known issue on GitHub.
You could try to install an earlier version of the package if you have one available, while waiting for the author(s) to publish a fix.
At the time of writing, this error occurs both when installing from CRAN and GitHub.

A: Matt Dancho found the problem for me: update 'recipes'


text:
Q: C# windows mobile 6 application to windows phone 7 I have a Windows Mobile 6 application, written in C# and I want to port it to Windows Phone 7.
What modifications do I have to do to the original application? Do I have to modify only the user interface or are there any other things I need to modify in the backgroung code?

A: *

*You can not use native API in Windows Phone 7 applications.

*You should recompile your dlls from wp7 environment.

*UI should be re-written with XAML.

*All interaction with network should be acync.

*WebBrowser is different from WinMobile6 one.

*You can not use sockets (should wait for Mango update).

A: It is likely you will need to make a decent number of changes. The framework changed from .NET Compact Framework 3.5 to Silverlight Phone Edition, aka almost-but-not-quite Silverlight 3. And the guidelines for submission to the app store are much stricter in terms of user experience, e.g. time taken to load the app, behavior of background processing, etc.


text:
Q: What does metavar and action mean in argparse in Python? I am reading through argparse module. I got stuck as what to metavar and action means
>>> parser.add_argument('integers', metavar='N', type=int, nargs='+',
...                     help='an integer for the accumulator')
>>> parser.add_argument('--sum', dest='accumulate', action='store_const',
...                     const=sum, default=max,
...                     help='sum the integers (default: find the max)')

I might have missed but from what I read, I could not find definitions for metavar and
action (action="store_const", etc). what do they actually mean?

A: Metavar: It provides a different name for optional argument in help messages. Provide a value for the metavar keyword argument within add_argument().
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo', metavar='YYY')
>>> parser.add_argument('bar', metavar='XXX')
>>> parser.parse_args('X --foo Y'.split())
Namespace(bar='X', foo='Y')
>>> parser.print_help()
usage:  [-h] [--foo YYY] XXX

positional arguments:
  XXX

optional arguments:
  -h, --help  show this help message and exit
  --foo YYY

Reference: http://www.usatlas.bnl.gov/~caballer/files/argparse/add_argument.html
Action:  Arguments can trigger different actions, specified by the action argument to add_argument(). There are six built-in actions that can be triggered when an argument is encountered:

*

*store: Save the value, after optionally converting it to a different type. This is the default action taken if none is specified explicitly.

*store_true/store_false: Save the appropriate boolean value.

*store_const: Save a value defined as part of the argument specification, rather than a value that comes from the arguments being parsed. This is typically used to implement command line flags that aren't booleans.

*append: Save the value to a list. Multiple values are saved if the argument is repeated.

*append_const: Save a value defined in the argument specification to a list.

*version: Prints version details about the program and then exits.
Reference: http://bioportal.weizmann.ac.il/course/python/PyMOTW/PyMOTW/docs/argparse/index.html

A: metavar is used in help messages in a place of an expected argument. See FOO is a default metavar here:
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('--foo')
>>> parser.add_argument('bar')
>>> parser.parse_args('X --foo Y'.split())
Namespace(bar='X', foo='Y')
>>> parser.print_help()
usage:  [-h] [--foo FOO] bar
...

action defines how to handle command-line arguments: store it as a constant, append into a list, store a boolean value etc. There are several built-in actions available, plus it's easy to write a custom one.


text:
Q: Issue with Capistrano deployment from Windows permission denied Privatekey I am really stuck with this deployment, I am using Ryan Bates code from railcasts on deploying with capistrano.
Here is my deploy
require "bundler/capistrano"

load "config/recipes/base"
load "config/recipes/nginx"
load "config/recipes/unicorn"
load "config/recipes/postgresql"
load "config/recipes/nodejs"
load "config/recipes/rbenv"
load "config/recipes/check"

server "37.188.126.99", :web, :app, :db, primary: true

set :user, "deployer"
set :application, "TWL"
set :deploy_to, "/home/#{user}/apps/#{application}"
set :deploy_via, :remote_cache
set :use_sudo, false

set :scm, "git"
#set :repository, "git@github.com:acooperman/#{application}.git"
set :repository, "git@github.com:acooperman/TWL.git"
#set :repository, "https://github.com/acooperman/TWL.git"
set :branch, "master"

default_run_options[:pty] = true
ssh_options[:forward_agent] = true

after "deploy", "deploy:cleanup" # keep only the last 5 releases

And here is the result :
    $ cap deploy:update
      * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        updating the cached checkout on all servers
        executing locally: "git ls-remote git@github.com:acooperman/TWL.git master"
    Permission denied (publickey).
    fatal: The remote end hung up unexpectedly
    *** [deploy:update_code] rolling back
      * executing "rm -rf /home/deployer/apps/TWL/releases/20120611173529; true"
        servers: ["37.188.126.99"]
    Password:
        [37.188.126.99] executing command
        command finished in 340ms
    Command git ls-remote git@github.com:acooperman/TWL.git master returned status code pid 3500 exit 128

If I swap the comments on the line
set :repository, "git@github.com:acooperman/TWL.git"
#set :repository, "https://github.com/acooperman/TWL.git"

I get the following :
     * executing `deploy:update'
     ** transaction: start
      * executing `deploy:update_code'
        updating the cached checkout on all servers
        executing locally: "git ls-remote https://github.com/acooperman/TWL.git master"
    Username for 'https://github.com':
    Password for 'https://acooperman@github.com':
        command finished in 7893ms
      * executing "if [ -d /home/deployer/apps/TWL/shared/cached-copy ]; then cd /home/deployer/apps/TWL/shared/cached-copy && git
     fetch -q origin && git fetch --tags -q origin && git reset -q --hard 418c9e9b1d7b37427a76e6bf98a17722f3a9e863 && git clean -q
     -d -x -f; else git clone -q https://github.com/acooperman/TWL.git /home/deployer/apps/TWL/shared/cached-copy && cd /home/depl
    oyer/apps/TWL/shared/cached-copy && git checkout -q -b deploy 418c9e9b1d7b37427a76e6bf98a17722f3a9e863; fi"
        servers: ["37.188.126.99"]
    Password:
        [37.188.126.99] executing command
     ** [37.188.126.99 :: out] error: The requested URL returned error: 401 while accessing https://github.com/acooperman/TWL.git/
    info/refs
     **
     ** fatal: HTTP request failed
        command finished in 1590ms
    *** [deploy:update_code] rolling back
      * executing "rm -rf /home/deployer/apps/TWL/releases/20120611173441; true"
        servers: ["37.188.126.99"]
        [37.188.126.99] executing command
          command finished in 331ms
    failed: "sh -c 'if [ -d /home/deployer/apps/TWL/shared/cached-copy ]; then cd /home/deployer/apps/TWL/shared/cached-copy && gi
    t fetch -q origin && git fetch --tags -q origin && git reset -q --hard 418c9e9b1d7b37427a76e6bf98a17722f3a9e863 && git clean -
    q -d -x -f; else git clone -q https://github.com/acooperman/TWL.git /home/deployer/apps/TWL/shared/cached-copy && cd /home/dep
    loyer/apps/TWL/shared/cached-copy && git checkout -q -b deploy 418c9e9b1d7b37427a76e6bf98a17722f3a9e863; fi'" on 37.188.126.99

Git works fine from my new vps and does not require a password.
I really am stuck here and any help would be appreciated, I am completely new to capistrano and fairly new to rails so this really does have me stumped.
Thanks for any help :)
Adam

A: looks like your ssh key is not in the default location, try setting a pass to your ssh key manually
ssh_options[:keys] = ["PATH TO SSH/id_rsa]


text:
Q: How do I run unison between Ubuntu and CentOS 7 I am trying to sync data between an Ubuntu instance and a CentOS 7 instance. It's like a bi-directional rsync so I thought unison would be the best tool. I installed it on both instances but when I tried to connect them I received an error because the versions are different:
unison -testServer . ssh://myuser@myremotehost/efs/home/
Contacting server...
myuser@myremotehost's password:
Fatal error: Received unexpected header from the server:
 expected "Unison 2.48\n" but received "Unison 2.40\n\000\000\000\000\017",
which differs at "Unison 2.40".
This can happen because you have different versions of Unison
installed on the client and server machines, or because
your connection is failing and somebody is printing an error
message, or because your remote login shell is printing
something itself before starting Unison.

So I tried to make the versions match but when I look I only see the one version available on Ubuntu.
myuser@mylocalhost:/nas/$ apt policy unison
unison:
  Installed: 2.48.4-1ubuntu1
  Candidate: 2.48.4-1ubuntu1
  Version table:
 *** 2.48.4-1ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

And when I look on CentOS 7 I don't see any versions
$ yum --showduplicates list unison
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: mirror.prgmr.com
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Error: No matching Packages to list

However, I can install it with no problem:
$ sudo yum install unison
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: d36uatko69830t.cloudfront.net
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: d36uatko69830t.cloudfront.net
 * updates: d36uatko69830t.cloudfront.net
Package unison240-gtk-2.40.128-5.el7.x86_64 already installed and latest version
Nothing to do

Am I doing something wrong with finding the versions? How can I make them match?
The local host is:
myuser@mylocalhost:/nas$ cat /etc/*release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04

The remote host is:
$ cat /etc/*release
CentOS Linux release 7.6.1810 (Core)

A: Per @Freddy's comment, the key is to compile unison from source on CentOS:
yum install ocaml ocaml-camlp4-devel ctags ctags-etags

cd ~
wget http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.48.4.tar.gz
tar xvfz unison-2.48.4.tar.gz
cd src
make

sudo cp -v unison /usr/local/sbin/
sudo cp -v unison /usr/bin/

cd ~
rm -fr src

Then you will be able to run unison:
On the local server, go to the desired location, then test it with
unison -testServer . ssh://myuser@myremotehost//path/to/data/

To do the real thing, simply remove -testServer from above. It's also a good idea to tmux before doing so.

A: In order to run across the network, Unison needs the same program version, built with the same version of the OCaml compiler, on both ends.
As described in the other answer, you can build Unison from source. Either build on one machine and copy the binary to the other—or, if you decide to build Unison separately on each machine, ensure both have the same version of the OCaml compiler.
As an easier alternative, Unison versions starting with 2.40 are available as binary downloads from the project itself, at least for Intel platforms. Starting with 2.51.3, they even offer builds with different OCaml versions. Grab the one you want and deploy it to both of your machines, which ensures you are running the same on both ends.