text:
Q: Make outlook emails display as a separate icon on taskbar I realize this is a duplicate. Unfortunately the original question is just answered as "This is a duplicate". and when I look at the original posts, I can see that they clearly don't address the question. At best they insist this is not possible.
The reason I want to know is I have 1 Office 2010 computer that shows a separate icon stack for messages to the stack that contains outlook and reminders, and a 2nd Office 2010 computer that stacks all of these icons on top of each other. I need these two programs to behave exactly the same.
So, clearly, unless these computers are doing the impossible, this is a possibility. I am unsure why these questions are being marked as duplicates if they are not being adequately answered. So, here it goes again:
Below is the original question:
When I open/compose and email in outlook, the window is kept in the outlook stack, as following:
What I'd like to do, is have the emails be stacked as a new icon, so clicking the outlook icon will immediately maximise outlook, rather than displaying the stack.
Is this possible?

A: What I'd like to do, is have the emails be stacked as a new icon
Configure the taskbar as follows:

*

*Right click on an empty part of the taskbar

*Click "Properties"

*Change "Taskbar buttons" to "Never combine"


text:
Q: Site is Working fine without any error I have a site in magento (Latest version). The site is working fine without any error but sometime site didn't load and a white screen appears. This issue then automatically resolved after some time.
Can anyone help me. Here is the site url.
http://egolfoutlet.ae

A: Blank white pages are usually a sign that a fatal PHP error has occurred, and error reporting in PHP is turned off.  Check your apache error logs (how you'll do this and the log file location varies depending on your web host).
Magento also has it's own error reporting system where it shows a friendly page to the end user and drops the actual PHP error message and stack trace into a file in var/report.
The report files will have a numeric file name and can be opened with any text editor.
If you are not seeing any error reports, it would be worth making sure your web server can write to the var/report folder.
Magento documentation generally recommends 777 permissions for the var folder and everything within it.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Laravel trouble routing to update Controller I'm trying to edit a Alumne model with a model Form but I only have a NotFoundHttpException
The application only fails when I confirm the edit form. I think the problem is in the Form::model line but don't know.
Here's the entire code:
http://laravel.io/bin/62eq
Thanks.

A: All looks correct...
Check if $alumne really has id or is named different like alumne_id or id_alumne... Is the only thing may be.


text:
Q: How can I track the progress of dd after I've already started it? I'm migrating my HDD to an external hard drive so that I can do a clean install of macOS Mojave.

I'm using dd if=/dev/disk02 of=/dev/disk15s2 to accomplish the task.

disk02 is the Macintosh HD (SATA-HDD), disk15s2 is the WD External HD

I didn't realize that it wouldn't show me any indication of progress (the HDD has ~750GB on it) - this is the first time I've done this through the terminal.app in recovery mode.

Is there a way for me to track the progress in another terminal window while it is in progress?

I'm on a Macbook Pro mid-2012 running El Capitan.

A: Yes, from a separate terminal you can issue this command:
kill -INFO 1234

where you need to replace 1234 with the pid of your dd process. You can look it up with the ps command.
Another simplification at a second terminal:
sudo kill -s siginfo $(pgrep ^dd)   # get dd info

Another simpler way is to request the progress information from the same terminal as dd by pressing Ctrl-T.


text:
Q: Copying image without a src to printable window I have a javascript project that TLDR creates a barcode. On the button click I want to print the barcode that gets generated by the internal guid I am using the jsBarcode.js plugin which takes a string and turns it into a barcode. Here is the html markup for that div.

The barcode shows up perfectly it's just when trying to copy it over to a new window it doesnt show up :(
I have tried multiple ways of doing this and have had no luck. Right now I have this code and on the window that pops up it just shows object Object
var printContent = new $('#barcode').clone();
var w = window.open('','','width=340,height=260');

var windowContent = '<!DOCTYPE html>';
    windowContent += '';
    windowContent += '<title>Print canvas</title>';
    windowContent += '';
    windowContent += '';
    windowContent += '' + printContent + '';
    windowContent += '';
    windowContent += '';
    w.document.write(windowContent);
    w.focus();
    w.print();
    w.close();

I have had no luck with doing this.. I can make just text content show up now problem, but have no clue on how to do it when linking an image with no source... Any help would be greatly appreciated.

A: On the plugin page, example barcodes actually have sources : lindell.me/JsBarcode It's a base64 image, directly hardcoded into the image source.
You can access the source simply with $('#myImg').attr('src') and voila, you get your base64 data. You can draw it on a canvas, etc. Have a look here : Base64 png data to html5 canvas


text:
Q: How do you get the country/state/region/city/state/zip/postal from GPS coordinates? I have GPS coordinates on all of my photos. I want to include tags/IPTC data for the city, state, zip, etc.. However all I have is the GPS coordinates. How can I take these and get meaningful info in an automated fashion (I have thousands upon thousands of photos, so typing each one into google maps would not work).

A: What about doing reverse geocoding with the Google Maps API?
http://code.google.com/apis/maps/documentation/services.html#ReverseGeocoding

A: Here is a bulk Reverse Geocoder which, internally, uses the Google Maps API to reverse geocode an entire series (in a CSV file) of latitude and longitude pairs.
It would make this fairly easy.

A: You can do reverse geocoding with Google Maps API using the following HTTP request:
Simple CSV:
http://maps.google.com/maps/geo?q=40.756041,-73.986939&output=csv&sensor=false

More Complex XML:
http://maps.google.com/maps/geo?q=40.756041,-73.986939&output=xml&sensor=false

Simply change the "q" parameter with your latitude,longitude.
Note that the Google Maps API has a limit of 15,000 request per IP address per day. (Google Maps API FAQ)


text:
Q: Questions about use of snapshot in Maven2 I am writing a POM file for a in-house jar artifact. The artifact depends on several other in-house artifacts which our team writes. When declaring the dependencies of the target, should I limit those dependencies to fixed release version or leave them to SNAPSHOT version. If too many other SNAPSHOT versions of depended modules, it creates uncertainties in testing, if I limit to fixed release version, I cannot leverage the bug fixes of the depended modules. Whats the practice out there?
Secondly, how do you name the snapshot version>
1.0.0-SNAPSHOT or 1.0-SNAPSHOT.

A: As a rule you should avoid snapshots and use only stable releases unless your code relies on some feature (or bugfix) that has not yet made it into a release.
As for version numbering I prefer three digits, from end:
revision: changes when bugs are fixed
minor: changes when new features are added
major: changes when incompatible changes are made.
I believe this is the standard used by (at least some of) Apache Java libraries.


text:
Q: how to center align the images inside li? Sorry for my silly question as I am new to web dev.
I got a wrapper of 880px and inside that is the code below. i am trying to get all li elements equally spread horizontally within 880px and have everything inside li element center aligned. I try to avoid using margin-right to spread them, as the last li supposed to perfectly aligned to the right. What would be the best css tricks to achieve this. Thanks a ton in advance!

Title1

subtag1
subtag2
subtag3

Title2

subtag1
subtag2
subtag3

Title3

subtag1
subtag2
subtag3

Title4

subtag1
subtag2
subtag3

Title5

subtag1
subtag2
subtag3

Title6

subtag1
subtag2
subtag3

A: Specify a width on the
 elements and then apply a text-align:center. Image elements  are inline elements so you don't have to use margin:auto; to center align them.

A: you may use,
#services ul{
   display: flex;
}
#services ul li {
   flex-direction: column;
   justify-content: center;
   flex-grow: 1;
}

this will help you please try.

A: The li elements by default don't spread across the whole width, so you have to apply 100% width to them, and then center their contents using text-align: center;:

li {
  width: 100%;
  text-align: center;
}

Title1

subtag1
subtag2
subtag3

Title2

subtag1
subtag2
subtag3

Title3

subtag1
subtag2
subtag3

Title4

subtag1
subtag2
subtag3

Title5

subtag1
subtag2
subtag3

Title6

subtag1
subtag2
subtag3

A: Add display: inline block to the li's and text-align: center; to center them.
Add width to each li element so they spread.
Add font-size:0 to the wrapper so the spaces in the HTML do not take up any space.
See full solution:
http://codepen.io/shippin/pen/KWQgoJ


text:
Q: Uploading Video using Angularjs and Symfony2 What is the best way to upload video with AngularJS and Symfony2 using MongoDB database, and more scalable to do the upload in the database or in the application files?

A: Video is only file, so you can use any module mentioned here: File Upload using AngularJS
If you want to implement it itself, you might like resumablejs.com.
For videos I would go with file system, it will probably be better for streaming video.
As for scaling, it depends on your point of view.
i.e. If your app is running on multiple machines connected to 1 DB than file system is not good idea.


text:
Q: AngularJs controller test: unexpected request : GET I am trying to write my first test for controller by mocking the service layer using karma-jasmine and httpBackend. But I am getting this error.
Error: Unexpected request: GET./webresources/campaign/getCampaignDetails/undefined
Expected GET ./webresources/campaign/getCampaignDetails/CMP1000004568
Thanks in advance for any help :)
Service:
    (function() {
    'use strict';

    angular.module('tbApp').factory('Campaign', CampaignFactory);

    CampaignFactory.inject = ['$http'];

    function CampaignFactory($http) {

        //base url for all rest service calls
        var baseUrl = WS_PATH + '/webresources/campaign';

        var Campaign = {

            getCampaignDetails: getCampaignDetails,

        };

        return Campaign;

        function getCampaignDetails(campaignId) {
            return $http.get(baseUrl + '/getCampaignDetails/' + campaignId).then(getCampaignDetailsComplete);

            function getCampaignDetailsComplete(response) {
                return response.data;
            }
        }

         }
})();

Controller:
(function () {
'use strict';

angular.module('tbApp').controller('campaignEditCtrl', campaignEditCtrl);

campaignEditCtrl.inject = ['$routeParams', 'Campaign', 'User', '$location', 'Asset', '$window', '$scope', '$compile', 'ImageLibrary', 'Lists'];

function campaignEditCtrl($routeParams, Campaign, User, $location, Asset, $window, $scope, $compile, ImageLibrary, Lists) {

    var vm = this;

    vm.campaignData = [];
    vm.getCampaignDetails = getCampaignDetails;

    initialise();

    /**
     * Initialises the campaign properties page
     */
    function initialise() {
        // Registes a click listener to hide action menu
        $window.addEventListener('click', function (event) {
            if (event.which !== 3) {
                $scope.$apply(function () {
                    vm.selectedActionItem = '';
                });
            }
        });
         fromPage=true;
         fromPage1=true;

        vm.user = User.info;
        vm.campaignId = $routeParams.campId;
        //set default value to prevent filter error
        vm.campaignData.imageName = '///////';
        getCampaignDetails();
        getAllImageData();
    }

    /**
     * Load the campaign details
     */
    function getCampaignDetails() {
        vm.loadingCampaignDetails = true;
        Campaign.getCampaignDetails(vm.campaignId).then(getCampaignDetailsComplete);

        function getCampaignDetailsComplete(data) {

            vm.campaignData = data;

        }
    }

     }})();

controllerSpec:
    describe('campaignEditCtrl as vm', function() {
    var scope, httpBackend,  controller,  vm, createController, campaignId;

    var baseUrl = './webresources/campaign';

     beforeEach(module("tbApp"));
    beforeEach(inject(function($rootScope, $httpBackend, $controller) {
        httpBackend = $httpBackend;

        scope = $rootScope.$new();
        controller = $controller;
        campaignId= "CMP1000004568";
        //service = Campaign;
        createController = function() {
            return $controller('campaignEditCtrl', {
                '$scope': scope
            });
        };

        httpBackend.when("GET", baseUrl+"/getCampaignDetails/"+campaignId).respond([{}, {}, {}]);

    }));

  /*afterEach(function() {
        httpBackend.verifyNoOutstandingExpectation();
        httpBackend.verifyNoOutstandingRequest();
    });*/

    it('should run the Test to get the campaign data from the backend', function() {
        console.log("here"+campaignId);
        vm=createController();
        httpBackend.expectGET(baseUrl+"/getCampaignDetails/"+campaignId);

        scope.$apply(function() {
            scope.runTest();
        });

        //expect(vm.campaignData.imageName).toEqual('///////');

        httpBackend.flush();

        expect(vm.campaignData.length).toBe(3);

    });
});

Output:
    INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Windows 7)]: Connected on socket jAWt7tfOMUkrmCjM0d_n with id 71764124
INFO [Chrome 41.0.2272 (Windows 7)]: Connected on socket Fu0mS3U91St4gSQ10d_o with id 78282639
WARN [web-server]: 404: /webresources/user/checkSession
PhantomJS 1.9.8 (Windows 7) LOG: 'WARNING: Tried to load angular more than once.'

LOG: 'hereCMP1000004568'
PhantomJS 1.9.8 (Windows 7) campaignEditCtrl as vm should run the Test to get the campaign data from the backend FAILED
        Error: Unexpected request: GET ./webresources/campaign/getCampaignDetails/undefined
        Expected GET ./webresources/campaign/getCampaignDetails/CMP1000004568
            at $httpBackend (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/angular-mocks.js:1181)
            at sendReq (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:8404)
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:8123
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11659
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11659
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11745
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12788
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12600
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12892
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/test/js/campaignEditSpec.js:42
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/node_modules/karma-jasmine/lib/boot.js:117
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/node_modules/karma-jasmine/lib/adapter.js:171
            at http://localhost:9876/karma.js:185
            at http://localhost:9876/context.html:157
PhantomJS 1.9.8 (Windows 7): Executed 2 of 2 (1 FAILED) (0.008 secs / 0.024 secs)
LOG: 'WARNING: Tried to load angular more than once.'
Chrome 41.0.2272 (Windows 7) LOG: 'hereCMP1000004568'
Chrome 41.0.2272 (Windows 7) campaignEditCtrl as vm should run the Test to get the campaign data from the backend FAILED
        Error: Unexpected request: GET ./webresources/campaign/getCampaignDetails/undefined
        Expected GET ./webresources/campaign/getCampaignDetails/CMP1000004568
            at $httpBackend (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/angular-mocks.js:1180:9)
            at sendReq (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:8403:9)
            at serverRequest (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:8123:16)
            at wrappedCallback (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11659:8
            at wrappedCallback (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11659:8
            at D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:11745:26
            at Scope.$eval (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12788:28)
            at Scope.$digest (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12600:31)
            at Scope.$apply (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/main/webapp/js/libraries/uncompressed/angular.js:12892:24)
            at Object.<anonymous> (D:/Tb_test/Campaign_Builder_Maven/campaign-builder-webapp/src/test/js/campaignEditSpec.js:40:9)
PhantomJS 1.9.8 (Windows 7): Executed 2 of 2 (1 FAILED) (0.008 secs / 0.024 secs)
Chrome 41.0.2272 (Windows 7): Executed 2 of 2 (1 FAILED) (0.051 secs / 0.047 secs)
TOTAL: 2 FAILED, 2 SUCCESS

A: We can see in the karma output that the test is failing because the URL is wrong. Instead of a campaign id, you're getting undefined.
Chrome 41.0.2272 (Windows 7) campaignEditCtrl as vm should run the Test to get the campaign data from the backend FAILED
        Error: Unexpected request: GET ./webresources/campaign/getCampaignDetails/undefined
        Expected GET ./webresources/campaign/getCampaignDetails/CMP1000004568

It looks like you're trying to test your getCampaignDetails() function, which passes in vm.campaignId as an argument to your service call. However, in your test you don't set vm.campaignId to anything before calling your function.
In your test setup, I would try changing your code to this:
    scope = $rootScope.$new();
    controller = $controller;
    campaignId= "CMP1000004568";
    //service = Campaign;
    createController = function() {
        var controller = $controller('campaignEditCtrl', {
            '$scope': scope
        });
        scope.vm.campaignId = campaignId;
        return controller;
    };

...and see if that fixes it.
What's going on here is that your getCampaignDetails() function's behavior is dependent on the state of your controller. Your controller has an initialize() function that brings your controller to a state where the getCampaignDetails() can succeed. In your test, however, you don't perform similar initialization.


text:
Q: How to align some equations in a table? \documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm,mathtools,systeme}
\usepackage[tikz]{bclogo}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
\newcommand{\isEquivTo}[1]{\underset{#1}{\sim}}
\begin{document}
\begin{center}
\section*{{\shadowbox{\bctakecare \;Développements limités et équivalences usuels à apprendre}}}
\end{center}
Les formules suivantes sont vrai {\bf \underline{uniquement} au voisinage de $0$}.
\begin{center}
\begin{tabular}[t]{|c|c@{\vrule depth 1.2ex height 3ex width 0mm \ }|}
\hline
\textbf{Les développements limités usuels en $0$}         & \textbf{Les équivalences usuels en $0$} \\
\hline
   (1) $e^u= 1 + u+\frac{u^2}{2}+\frac{u^3}{6}+ o(u^3)$         & (1) $e^u-1\isEquivTo{0} u$\\
     (2)   $\ln(1+u)= u - \frac{u^2}{2}+\frac{u^3}{3}+ o(u^3)$        &  (2) $\ln(1+u)\isEquivTo{0} u$\\
    (3)    $\sin  u = u - \frac{u^3}{6}+ o(u^3)$         & (3) $\sin  u\isEquivTo{0} u$\\
   (4)  $\cos u = 1 - \frac{u^2}{2}+o(u^3)$         & (4) $1-\cos u \isEquivTo{0}\frac{u^2}{2}$\\
  (5)   $\frac{1}{1-u}=1+u+u^2+u^3+ o(u^3)$      & (5) $(1+u)^{\alpha}-1\isEquivTo{0} \alpha u,\quad\quad\forall\,\alpha\in \mathbb{R}$\\
(6) $f(x)=f(0)+f'(0)x+\frac{f''(0)}{2}x^2+\frac{f^{3}(0)}{6}x^3+o(x^3)$ & En particulier on a: $\sqrt{1+u}-1\isEquivTo{0} \frac{u}{2}$\\
 (vrai si $f$ est $3$-fois dérivable en $0$)       &  (6) $\tan  u\isEquivTo{0} u$
   \\ \hline
\end{tabular}
\end{center}
\end{document}

How to align the equations in the table as follows?

A: A simple solution would be to put the preceding numbers in an own left-aligned column.
As shown in the modified version of your code below, the tabular declaration changes to \begin{tabular}[t]{|lc|lc@{\vrule depth 1.2ex height 3ex width 0mm \ }|}, including an extra left-aligned column before each of your two center-aligned columns.
In order to keep the headings in the first line of your table, you can use multicolumn to glue together the left- and center-aligned column: \multicolumn{2}{|c|}{\textbf{Les développements limités usuels en $0$}}.
Separate attention has to be paid for the lines of your table where you do not have a preceding number. I guess, the content of these lines shall not propagate to the column preserved for the numbering, so I just added an empty cell, as in the second-last line:  & & En particulier on a: $\sqrt{1+u}-1\isEquivTo{0} \frac{u}{2}$\\.
\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsfonts,amsmath,amssymb,graphicx,amsthm,mathtools,systeme}
\usepackage[tikz]{bclogo}
\usepackage{pifont} %bouni
\usepackage{fancybox} %pour faire l'encadrement
\newcommand{\isEquivTo}[1]{\underset{#1}{\sim}}
\begin{document}
\begin{center}
\section*{{\shadowbox{\bctakecare \;Développements limités et équivalences usuels à apprendre}}}
\end{center}
Les formules suivantes sont vrai {\bf \underline{uniquement} au voisinage de $0$}.
\begin{center}
\begin{tabular}[t]{|lc|lc@{\vrule depth 1.2ex height 3ex width 0mm \ }|}
\hline
\multicolumn{2}{|c|}{\textbf{Les développements limités usuels en $0$}}         & \multicolumn{2}{c|}{\textbf{Les équivalences usuels en $0$}} \\
\hline
   (1) & $e^u= 1 + u+\frac{u^2}{2}+\frac{u^3}{6}+ o(u^3)$         & (1) & $e^u-1\isEquivTo{0} u$\\
     (2) &  $\ln(1+u)= u - \frac{u^2}{2}+\frac{u^3}{3}+ o(u^3)$        &  (2) & $\ln(1+u)\isEquivTo{0} u$\\
    (3) &   $\sin  u = u - \frac{u^3}{6}+ o(u^3)$         & (3) & $\sin  u\isEquivTo{0} u$\\
   (4) & $\cos u = 1 - \frac{u^2}{2}+o(u^3)$         & (4) & $1-\cos u \isEquivTo{0}\frac{u^2}{2}$\\
  (5) &  $\frac{1}{1-u}=1+u+u^2+u^3+ o(u^3)$      & (5) & $(1+u)^{\alpha}-1\isEquivTo{0} \alpha u,\quad\quad\forall\,\alpha\in \mathbb{R}$\\
(6) & $f(x)=f(0)+f'(0)x+\frac{f''(0)}{2}x^2+\frac{f^{3}(0)}{6}x^3+o(x^3)$ & & En particulier on a: $\sqrt{1+u}-1\isEquivTo{0} \frac{u}{2}$\\
 & (vrai si $f$ est $3$-fois dérivable en $0$)       &  (6) & $\tan  u\isEquivTo{0} u$
   \\ \hline
\end{tabular}
\end{center}
\end{document}


text:
Q: Tailwind CSS breakpoints inverted somehow? I'm testing Tailwind CSS, and I'm facing this issue. It was working before and it's still working in some cases, but on this line below its inverting the breakpoints somehow. See the screenshots below
Example code:

  AndiiCodes.

Full screen (text should be 8xl, but it's taking the sm: size of 4xl): screenshot
Medium/small screens: screenshot
tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
  "./src/**/*.{js,jsx,ts,tsx}",
  'node_modules/flowbite-react/**/*.{js,jsx,ts,tsx}',
  ],
  theme: {
    extend: {},
  },
  plugins: [
    require('flowbite/plugin'),
  ],
}

CSS file
@tailwind base;
@tailwind components;
@tailwind utilities;

I also tried to set a base font size first then change it on other screens, but I'm still running into the same issue.

A: To use the breakpoints in Tailwind, you target a specific breakpoint which applies that style to that breakpoint and ALL breakpoints above that.

By default, styles applied by rules like md:flex will apply at that breakpoint and stay applied at larger breakpoints.

If you'd like to apply a utility only when a specific breakpoint range is active, stack a responsive modifier like md with a max-* modifier to limit that style to a specific range.

So if you want the 8xl size to be applied for the larger screens and above, you need to use: sm:text-4xl lg:text-8xl.


text:
Q: Pass data from Python (flask framework) to javascript I try to pass data (exactly a path or a url) from flask to a javascript. But it don't recognize my variable.
On the server side: it upload a file, process this file and then create and save many images. When I try to pass the path to a javascript file which use three.js library it doesn't.
@app.route('/upload', methods=['POST'])
def upload_file():
    print('coucou')
    if request.method == 'POST':
        file = request.files['file']
        print(file)
        # if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)
        print(filename)
        file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
        path = UPLOAD_FOLDER + filename
        fits_reader = FitsReader.FitsReader()
        fits_reader.open_file(path)
        cube_faces = ['/home/morban/essaiserver/cube3D/CubeX.PNG', '/home/morban/essaiserver/cube3D/CubeY.PNG', '/home/morban/essaiserver/cube3D/CubeZ.PNG']
    return render_template('index.html', cube_faces=cube_faces)

for (var i = 0; i < 3; i++) {
        switch (i) {
            case 0:
                texture[i] = new THREE.ImageUtils.loadTexture('{{ cube_faces[0] }}');
                console.log('{{ cube_faces[0] }}')
                break;
            case 1:
                texture[i] = new THREE.ImageUtils.loadTexture('{{ cube_faces[1] }}');
                break;
            case 2:
                texture[i] = new THREE.ImageUtils.loadTexture('{{ cube_faces[2] }}');
                break;
            }

A: The javascript must be in the template file, and not included has script source.
If included, you can make it has a function or "class" and use it like this:
   (function($) {
    var texture = new LoadTexture(
                '#filter_form',
                {{ cube_faces | tojson | safe }}
            );
    })(jQuery);

you could/should pass cube_fase has json and filter it to safe on Jinja2.


text:
Q: Query builder using XML as input to stored procedure I want to create a query builder which allows a user to build a query by selecting drop downs/text input etc on the web page which in turn creates an XML file containing the query filters such as (XML constructed from web page/View):
<Filters>
   <Filter Table="MyTable" Column="Total" Value="1234" Predicate="0"></Filter>
</Filters>

The idea would be for a stored procedure to receive this XML markup and parse it somehow so that it would translate to something like
SELECT * FROM MyTable WHERE Total > 1234

I've found examples here that query XML or take XML in and then insert into tables but can anyone give me a simple example of how I would set the proc up to parse an XML parameter and build SQL?
I'm using C# (MVC) and SQL Server 2008.

A: You could xsl to transform your xml file to a SQL file.
Something like:
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
 <xsl:strip-space elements="*"/>
 <xsl:output method="text" omit-xml-declaration="yes"/>
 <xsl:template match="/">
    <xsl:text>
</xsl:text>
    <xsl:for-each select="Filters">
        <xsl:apply-templates select="Filter" />
    </xsl:for-each>

 </xsl:template>
 <xsl:template match="Filter">
    <xsl:text>Select * from </xsl:text><xsl:value-of select="@Table"/>
    <xsl:text> WHERE </xsl:text><xsl:value-of select="@Column"/>
    <xsl:choose>
        <xsl:when test="@Predicate = 0"><xsl:text disable-output-escaping="yes"> > </xsl:text></xsl:when>
        <xsl:when test="@Predicate = 1"><xsl:text disable-output-escaping="yes"> < </xsl:text></xsl:when>
        <xsl:when test="@Predicate = 2"><xsl:text> = </xsl:text></xsl:when>
    </xsl:choose>
    <xsl:value-of select="@Value"/>
    <xsl:text>
</xsl:text>
  </xsl:template>
</xsl:transform>

This will translate this:
<Filters>
  <Filter Table="MyTable" Column="Total" Value="1234" Predicate="0"></Filter>
  <Filter Table="MyTable" Column="Total" Value="1234" Predicate="1"></Filter>
</Filters>

into this:
Select * from MyTable WHERE Total > 1234
Select * from MyTable WHERE Total < 1234


text:
Q: MPMoviePlayerController with MPMovieControlModeHidden I am trying to hide the controls on a MPMoviePlayerController. Using:

moviePlayer.movieControlMode = MPMovieControlModeHidden;

Works fine on my 3GS and in the simulator, however on a 3G (running 3.1.3) it refuses to hide.
Any Suggestions?
Thanks,
John

A: you should use this code in order to hide controls :
player.moviePlayer.controlStyle = MPMovieControlStyleNone;


text:
Q: Using BitmapFactory.Options(); I have taken and modified some code used to get a high quality anti-aliased small version of a larger (500x500) bitmap image. Apparently using a Matrix produces higher quality than employing createScaledBitmap(). The results were not very impressive.. and I suspected that perhaps I had made a mistake, in particularl I was unsure as to whether the options thing was actually being employed. So I changed the inSampleSize = 1; to inSampleSize = 50; expecting to see a dramatic drop in quality, but there was no change. So now I suspect options is being ignored. Can this code be rescued?
I was hoping to perhaps find some version of createBitmap which took bith a bitmap and an options argument, but could find none.
BitmapFactory.Options options = new BitmapFactory.Options();

options.inPreferQualityOverSpeed = true;
options.inJustDecodeBounds = false;
options.inDither = false;
options.inSampleSize = 1;
options.inScaled = false;
options.inPreferredConfig = Bitmap.Config.ARGB_8888;

Bitmap bmpSource = BitmapFactory.decodeResource(getResources(), R.drawable.bigicon);

Matrix matrix = new Matrix();
matrix.postScale(.1f,.1f);
Bitmap scaledBitmap = Bitmap.createBitmap(bmpSource, 0, 0, bmpSource.getWidth(), bmpSource.getHeight(), matrix, true);

A: well you should actually provide it as parameter. Change
Bitmap bmpSource = BitmapFactory.decodeResource(getResources(), R.drawable.bigicon);

with
Bitmap bmpSource = BitmapFactory.decodeResource(getResources(), R.drawable.bigicon, options);

here the documentation

A: Take a look of this Creating a scaled bitmap with createScaledBitmap in Android
This too: http://developer.android.com/training/displaying-bitmaps/load-bitmap.html


text:
Q: T-SQL: Select using sub Select returns nothing Using SQL Server 2008 R2 I currently have this query which works as expected.  It returns a simple distinct list, catalogID and catType.
Note - the catType string is not normalized in ALM_Catalog hence the inner select
SELECT DISTINCT
    catalogID, catType
FROM
    ALM_Catalog cat1
WHERE
    cat1.CatalogID = (SELECT max(CatalogID)
                      FROM ALM_Catalog cat2
                      WHERE cat1.catType = cat2.catType)
ORDER BY
    catType;

I now have an ALM_CatalogAudience table. This is a linking table which has two columns catalogID and businessGroupID. It is designed to only show certain catalog items to certain business groups.
So I changed the above query to this:
SELECT DISTINCT
    cat1.catalogID, cat1.catType
FROM
    ALM_Catalog cat1
LEFT OUTER JOIN
    ALM_CatalogAudience ON cat1.catalogID = ALM_CatalogAudience.catalogID
WHERE
    cat1.CatalogID = (SELECT MAX(CatalogID)
                      FROM ALM_Catalog cat2
                      WHERE cat1.catType = cat2.catType)
    AND ALM_CatalogAudience.businessGroupID = (SELECT  md_businessGroup.businessGroupID
                                               FROM
                                                  ((directory d
                                               LEFT OUTER JOIN
                                                  md_department ON d.departmentID =  md_department.departmentID)
                                               LEFT OUTER JOIN
                                                  md_businessGroup ON md_department.businessGroupID = md_businessGroup.businessGroupID)
                                               WHERE directoryID = 18230)
ORDER BY
    cat1.catType;

Which returns nothing and I can not see why.  Note - The second sub select (SELECT  md_businessGroup...) returns 1 and when I run this:
select * from ALM_CatalogAudience where businessGroupID=1

it returns 132 records. What am I missing? Thank you in advance.
EDIT:  Some sample output is:
1362    Accessories & Parts
1368    Audio & Video
1399    Batteries & Power
1412    Cables & Connectors
1418    Carrying Cases
1424    Docks & Port Replicators
1429    Keyboards & Mice

EDIT: It appears that the location of this:
cat1.CatalogID = (SELECT MAX(CatalogID) MAX

was the mistake I made.  The MAX catalogID was not necessarily mapped to businessGroupID 1 unless of course the catalog item was only ever mapped to one business group which happened to be 1.  So Im sure this is what will work for me now:
SELECT DISTINCT  max(cat1.catalogID) , cat1.catType FROM ALM_Catalog cat1
left outer join ALM_CatalogAudience on cat1.catalogID = ALM_CatalogAudience.catalogID
WHERE
 ALM_CatalogAudience.businessGroupID = (
    SELECT  md_businessGroup.businessGroupID
    from directory d
    LEFT OUTER JOIN md_department
              on d.departmentID =  md_department.departmentID
    LEFT OUTER JOIN md_businessGroup
              on md_department.businessGroupID = md_businessGroup.businessGroupID
    where directoryID=18230)
group BY cat1.catType
order BY cat1.catType;

A: SELECT DISTINCT cat1.catalogID, cat1.catType
  FROM ALM_Catalog cat1
 left outer join ALM_CatalogAudience
   on cat1.catalogID = ALM_CatalogAudience.catalogID
WHERE
   cat1.CatalogID=
        (SELECT max(CatalogID) from ALM_Catalog cat2 WHERE cat1.catType=cat2.catType)
   AND ALM_CatalogAudience.businessGroupID =
      (
          SELECT  md_businessGroup.businessGroupID
            from directory d
         LEFT OUTER JOIN md_department
                      on d.departmentID =  md_department.departmentID
         LEFT OUTER JOIN md_businessGroup
                      on md_department.businessGroupID = md_businessGroup.businessGroupID
         where directoryID=18230
      )
  ORDER BY cat1.catType;

I m suprised that you don't get a syntax error. i just fixed it and changed nothing, if it still won't work, then we need some sample data.
Ok, since still no record all i can tell you is the way to check where problem is.

*

*run this:
 SELECT  md_businessGroup.businessGroupID
        from directory d
     LEFT OUTER JOIN md_department
                  on d.departmentID =  md_department.departmentID
     LEFT OUTER JOIN md_businessGroup
                  on md_department.businessGroupID = md_businessGroup.businessGroupID
     where directoryID=18230

if you get the number wrote it down . if you get 0 record here you should check the directory table and test the script again.
2.check ALM_CatalogAudience  again and save the result
select * from ALM_CatalogAudience where businessGroupID = the number you just get;

if non then ALM_CatalogAudience don't have that groupID. if get records, save it in a temp table.

*left join ALM_Catalog and the temp table. i think you can get it now

A: You'll probably want to fix your original query to match the version that Raffaello.D.Huke fixed up for you.  If your subquery and ALM_CatalogAudience.businessGroupID are both returning 1, it might be that your businessGroupIDs aren't the same type.  Could you try the below?
...
AND CAST(ALM_CatalogAudience.businessGroupID AS VARCHAR) =
  (
      SELECT  CAST(md_businessGroup.businessGroupID AS VARCHAR)
        from directory d
...


text:
Q: Split tuple items to separate variables I have tuple in Python that looks like this:
tuple = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')

and I wanna split it out so I could get every item from tuple independent so I could do something like this:
domain = "sparkbrowser.com"
level = 0
url = "http://facebook.com/sparkbrowser"
text = "Facebook"

or something similar to that, My need is to have every item separated. I tried with .split(",") on tuple but I've gotten error which says that tuple doesn't have split option.

A: Python can unpack sequences naturally.
domain, level, url, text = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')

A: >>> domain, level, url, text = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
>>> domain
'sparkbrowser.com'
>>> level
0
>>> url
'http://facebook.com/sparkbrowser'
>>> text
'Facebook'

A: Best not to use tuple as a variable name.
You might use split(',') if you had a string like 'sparkbrowser.com,0,http://facebook.com/sparkbrowser,Facebook', that you needed to convert to a list. However you already have a tuple, so there is no need here.
If you know you have exactly the right number of components, you can unpack it directly
the_tuple = ('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
domain, level, url, text = the_tuple

Python3 has powerful unpacking syntax. To get just the domain and the text you could use
domain, *rest, text = the_tuple

rest will contain [0, 'http://facebook.com/sparkbrowser']

A: An alternative for this, is to use collections.namedtuple. It makes accessing the elements of tuples easier.
Demo:
>>> from collections import namedtuple
>>> Website = namedtuple('Website', 'domain level url text')
>>> site1 = Website('sparkbrowser.com', 0, 'http://facebook.com/sparkbrowser', 'Facebook')
>>> site2 = Website('foo.com', 4, 'http://bar.com/sparkbrowser', 'Bar')
>>> site1
Website(domain='sparkbrowser.com', level=0, url='http://facebook.com/sparkbrowser', text='Facebook')
>>> site2
Website(domain='foo.com', level=4, url='http://bar.com/sparkbrowser', text='Bar')
>>> site1.domain
'sparkbrowser.com'
>>> site1.url
'http://facebook.com/sparkbrowser'
>>> site2.level
4


text:
Q: Python Print Out All Rows Values of a MySQL Table i want to print all rows from mysql table but i dont get values, i just get for example ('2022-03-15',) but i want to get 2022-03-15
is there any way to make it look pretty?
Here is my code:
import mysql.connector

database = mysql.connector.connect(
    host = "localhost",
    user = "USER",
    password = "PASSWD",
    database = "fuel"
)

dbcursor = database.cursor()
dbcursor.execute("SELECT * FROM gulf")
result = dbcursor.fetchall()

for i in result:
    print(f"i : {i}" )

and output:
i : ('2022-03-15',)
i : ('3.89',)
i : ('3.85',)
i : ('3.79',)
i : ('3.71',)
i : ('3.93',)
i : ('3.87',)
i : ('1.69',)


text:
Q: Create chi square matrix in R thank you for helping me. I know enough about R to be dangerous, but not enough to be good. I'm trying to create a chi square matrix (exactly like a correlation matrix, but with chi sq) from a dataframe. I've searched extensively (including this page: Chi-square p value matrix in r which didn't help) even trying a loop, and I'm not getting there. Here's what I have so far:
R Studio version 1.2.5033 on Windows 10
data - 14 columns of 3401 rows, I'm only using 9 columns for the chi sq, 8 variables are binary, 1 is categorical
I've gotten the chi sq results I need, but I want to combine it in a matrix. As it is a standard matrix where columns get progressively smaller, the columns are not the same length, so most bind commands won't work. I do have plyr, and I am trying to do it that way, but am failing. Here's the code:
CA <- c(1, 0, 0, 1, 1, 1, 0, 1, 0, 0)
Pos <- c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0)
Mon <- c(1, 1, 1, 1, 0, 0, 0, 0, 0, 1)
Sc <- c(0, 0, 0, 0, 1, 1, 0, 0, 1, 0)
ood <- c(1, 1, 1, 1, 0, 1, 1, 0, 0, 1)
Eco <- c(1, 2, 4, 6, 7, 3, 2, 5, 7, 7)
Orp <- c(0, 0, 0, 1, 1, 1, 1, 0, 0, 0)
BC <- c(1, 1, 1, 0, 0, 0, 0, 1, 0, 1)
SA <- c(0, 0, 1, 1, 1, 1, 1, 0, 0, 1)
MV <- c(1, 1, 0, 1, 1, 0, 1, 1, 0, 0)
Ad <- c(0, 1, 0, 1, 0, 1, 0, 1, 0, 1)
YR <- c(1, 0, 1, 0, 1, 0, 1, 0, 1, 0)
KC <- c(1, 1, 1, 1, 1, 1, 0, 1, 1, 1)
H <- c(1, 1, 1, 1, 1, 1, 1, 0, 0 ,1)
data <- data.frame(CA, Pos, Mon, Sc, ood, Eco, Orp, BC, SA, MV, Ad, YR, KC, H)

Or, here is the dput() data:
structure(list(CA = c(0, 0, 1, 1, 1, 1, 0, 1, 0), Pos = c(0,
0, 0, 0, 1, 1, 0, 1, 0), Mon = c(1, 0, 1, 1, 0, 1, 1, 1, 1),
    Sc = c(0, NA, 0, 0, 1, 1, 1, 1, 0), ood = c(1, 1, 1, 0, 1,
    0, 1, 1, 1), Eco = c(7, 6, 7, 0, 1, 6, 5, 1, 3), Orp = c(0,
    0, 0, 0, 0, 0, 0, 0, 0), BC = c(1, 0, 1, 1, 1, 1, 1, 1, 1
    ), SA = c(0, 1, 0, 0, 0, 0, 0, 0, 0), MV = c(15, 13, 16,
    12, 16, 14, 11, 18, 12), Ad = c(2, 2, 2, 3, 3, 2, 2, 2, 2
    ), YR = c(2, 2, 1, 1, 2, 2, 2, 1, 2), KC = c(2, 2, 1, 1,
    1, 1, 1, 1, 1), H = c(0, 1, 1, 0, 0, 1, 1, 0, 1)), class = c("spec_tbl_df",
"tbl_df", "tbl", "data.frame"), row.names = c(NA, -9L), spec = structure(list(
    cols = list(CA = structure(list(), class = c("collector_double",
    "collector")), Pos = structure(list(), class = c("collector_double",
    "collector")), Mon = structure(list(), class = c("collector_double",
    "collector")), Sc = structure(list(), class = c("collector_double",
    "collector")), ood = structure(list(), class = c("collector_double",
    "collector")), Eco = structure(list(), class = c("collector_double",
    "collector")), Orp = structure(list(), class = c("collector_double",
    "collector")), BC = structure(list(), class = c("collector_double",
    "collector")), SA = structure(list(), class = c("collector_double",
    "collector")), MV = structure(list(), class = c("collector_double",
    "collector")), Ad = structure(list(), class = c("collector_double",
    "collector")), YR = structure(list(), class = c("collector_double",
    "collector")), KC = structure(list(), class = c("collector_double",
    "collector")), H = structure(list(), class = c("collector_double",
    "collector"))), default = structure(list(), class = c("collector_guess",
    "collector")), skip = 1), class = "col_spec"))

library(tidyverse)
library(plyr)
library(reshape2)

chisqstat <- function(x, y){round(chisq.test(x, y)$statistic, 2)} #chi sq formula, pulling stat
chisqp <- function(x, y){round(chisq.test(x, y)$p.value, 4)} #chi sq formula pulling pvalue

chisqdata <- list(apply(data[c(2:7, 9, 14)], 2, chisqstat, y = data$CA), #chi sq statistic for all values with child abuse
                       apply(data[c(2:7, 9, 14)], 2, chisqp, y = data$CA), #chi sq pvalue for all values with child abuse
                       apply(data[c(3:7, 9, 14)], 2, chisqstat, y = data$Pos),
                       apply(data[c(3:7, 9, 14)], 2, chisqp, y = data$Pos),
                       apply(data[c(4:7, 9, 14)], 2, chisqstat, y = data$Mon),
                       apply(data[c(4:7, 9, 14)], 2, chisqp, y = data$Mon),
                       apply(data[c(5:7, 9, 14)], 2, chisqstat, y = data$Sc),
                       apply(data[c(5:7, 9, 14)], 2, chisqp, y = data$Sc),
                       apply(data[c(6:7, 9, 14)], 2, chisqstat, y = data$ood),
                       apply(data[c(6:7, 9, 14)], 2, chisqp, y = data$ood),
                       apply(data[c(7, 9, 14)], 2, chisqstat, y = data$Eco),
                       apply(data[c(7, 9, 14)], 2, chisqp, y = data$Eco),
                       apply(data[c(9, 14)], 2, chisqstat, y = data$Orp),
                       apply(data[c(9, 14)], 2, chisqp, y = data$Orp),
                       apply(data[c(14)], 2, chisqstat, y = data$SA),
                       apply(data[c(14)], 2, chisqp, y = data$SA))
do.call(rbind.fill.matrix(), chisqdata)

When I do each line as:
as.matrix(apply(data[c(2:7, 9, 14], 2, chisqstat, y = data$CA))

I get exactly what I want with row names so I'm wondering if I need to use as.matrix. I know I can do a full matrix where the info above and below the diagonal is the same, but I find that visually overwhelming. I want to get something like this (this is correlations not chi square):
       CA   Pos   Mon    Sc   ood   Eco
Pos  0.20
Mon -0.20  0.60
Sc   0.22 -0.22 -0.65
ood -0.22  0.22  0.65 -0.52
Eco  0.00 -0.18 -0.18  0.38 -0.58
Orp  0.41  0.00 -0.41  0.36  0.09  0.04

I'm sure I'm missing something obvious, so your help is greatly appreciated. Or maybe there is a much nicer way to do this in general, again, thank you.

A: It looks like your dput data added is a tibble, which is probably from how your data was read in:
> class(data)
[1] "spec_tbl_df" "tbl_df"      "tbl"         "data.frame"

While your previous example was a plain data.frame (I called it df).
This plays a role in how your columns are extracted in the chisqmatrix code from here. Specifically:
m[i,j] = chisq.test(x[,i],x[,j],)$p.value

With a simple data.frame, selecting the first column gives you a numeric vector, which is what you want:
> df[,1]
[1] 0 0 1 1 1 1 0 1 0
> class(df[,1])
[1] "numeric"

While with a tibble, you will get another tibble:
> data[,1]
# A tibble: 9 x 1
     CA
  <dbl>
1     0
2     0
3     1
4     1
5     1
6     1
7     0
8     1
9     0
> class(data[,1])
[1] "tbl_df"     "tbl"        "data.frame"

So, two ways to deal with this. One way is to use double brackets (e.g., df[[1]]) which will extract a numeric vector:
> data[[1]]
[1] 0 0 1 1 1 1 0 1 0

Or, you can add drop = TRUE to coerce to a vector (e.g., df[,1, drop = TRUE]):
> data[,1,drop=T]
[1] 0 0 1 1 1 1 0 1 0

Because with a tibble the [ defaults to drop = FALSE:
https://tibble.tidyverse.org/reference/subsetting.html
So, here is the same function to reproduce your desired result:
chisqmatrix <- function(x) {
  names = colnames(x);  num = length(names)
  m = matrix(nrow=num,ncol=num,dimnames=list(names,names))
  for (i in 1:(num-1)) {
    for (j in (i+1):num) {
      #browser()
      m[j,i] = chisq.test(x[, i, drop = TRUE],x[, j, drop = TRUE])$p.value
    }
  }
  return (m)
}

mat <- chisqmatrix(data[c("CA", "Pos", "Mon", "Sc", "ood", "Eco")])
mat[-1, -ncol(mat)]

           CA       Pos       Mon        Sc       ood
Pos 0.2356799        NA        NA        NA        NA
Mon 1.0000000 1.0000000        NA        NA        NA
Sc  1.0000000 0.1441270 1.0000000        NA        NA
ood 0.5303348 1.0000000 1.0000000 1.0000000        NA
Eco 0.4220127 0.2399069 0.6669878 0.1562356 0.2959326

Note: I removed "Orp" as this will give an error from the sample data where there is only a single level; so you can replace with:
chisqmatrix(data[c("CA", "Pos", "Mon", "Sc", "ood", "Eco", "Orp")])

if using your full data.
Please let me know if this works for you.


text:
Q: What does "file.sync = true" do? I had a look at the docs but I can't seem to find the relevant part. Can anyone tell me what the call to sync is for in the following code?
fh = Tempfile.new('tmp')
fh.sync = true

A: Basically, it writes any data buffered in memory out to disk right away.

A: It sets the sync mode of the file.
This affects future operations and causes output to be written without block buffering.
If f.tty? is true, that is, if the file is connected to a console-like device, then output is not block buffered. But when output goes to a pipe or file, f.tty? will be false and the I/O library will switch to block buffering, that is, accumulating output in a buffer and writing it only if the file is closed, the program exits, or the buffer fills up. This is faster and the end result is the same.
Setting f.sync = true defeats this switch. This can be useful if the output of the pipe is connected to something that actually is a console or in some way interactive or if the contents of the file are being actively monitored.

A: Tempfile inherits from IO. From the IO.sync docs:
  ios.sync    -> true or false

------------------------------------------------------------------------------

Returns the current ``sync mode'' of ios. When sync mode is true, all
output is immediately flushed to the underlying operating system and is not
buffered by Ruby internally. See also IO#fsync.

  f = File.new("testfile")
  f.sync   #=> false


text:
Q: Data loss in Hazelcast Map when some nodes in cluster are restarted We have been using Hazelcast 2.6.8 and upgraded to 3.5. The reason for upgrading was what appear to be intermittent problems with caching data. However the upgrade has not solved the problem.
We are trying to cache 100 java plain objects in a Hazelcast IMap, which we cache from an external database. Cached objects are shared across the cluster via Hazelcast's ConcurrentMap. We have a cluster of 6 nodes and whenever we stop and start 2 out of these 6 nodes we find that some of the java objects are missing, its occurrence along with the number of missing varies, though when missing the number is usually about 90 objects in the map rather then 100.
Initially backup-count property has been set to 3, but due to failures we increased it to 6.
The IMap method used is the loadAll method to retrieve the data. This is the configuration we are using, StoreClass implements the Hazelcast MapStore:
<map name="objectsMap">
<backup-count>6</backup-count>
<near-cache>
<time-to-live-seconds>0</time-to-live-seconds>
<max-idle-seconds>6000</max-idle-seconds>
<eviction-policy>LRU</eviction-policy>
<max-size>5000</max-size>
<invalidate-on-change>true</invalidate-on-change>
</near-cache>

<map-store enabled="true">
<class-name>StoreClass</class-name>
<write-delay-seconds>0</write-delay-seconds>

A: <invalidate-on-change>true</invalidate-on-change>

If true, all the members listen for change in their cached entries and evict the entry when it is updated or deleted.
Change it to false and try. It works.
Now the <backup-count>6</backup-count> can be put to required lower number. Suggest not to have big numbers as back-up. 1 or 2 should suffice the requirement.


text:
Q: Best way to save javascript data in localstorage I want to be able to create JavaScript note objects and dynamically delete them using a navbar pane.
var sel = window.getSelection();
var range = sel.getRangeAt(0);
var editor = { "startContainer": range.startContainer, "startOffset": range.startOffset, "endContainer": range.endContainer, "endOffset": range.endOffset };

Then using a message I would pass the location and message into a function to add notes:
Notes(editor, message);
function Notes(location, note) {
  this.location = location;
  this.note = note;
}

I'm trying to wrap my brain around how to actually save the data locally.
function addNote() {
  // if(tyepof(Storage) !== "undefined"){
  //   if(localStorage.notes){
  //     localStorage.notes
  //   } else {
  //     localStorage.notes =
  //   }

  localStorage.setItem()
}

Is localStorage the way to go? I know sessionStorage only stores for a session.

A: You have many ways of doing this. In fact so many that is not praticable to explain all of them. It depends on you actual intent. If you just want notes you can loose aftwards, localStorage may be the way to go.
But for most applications you typically would do this sending data to a server that would be responsible for storing the data. In the server the data could be stored in a database, in local files, there are many ways.
Servers could be Node.js (if you want to stick to js only), or any other language that has server capabilities. That would be pratically all. Most used are Node, PHP, Python, Java and others.
You would prepare a certain url to receive a post with the data that needs to be saved and then make the client send an ajax request to this url with it.
in this question you can get some examples of how to start doing this:
Basic Ajax send/receive with node.js
the server save part is up to you :)
edit
here is a small tutorial about localStorage
https://www.taniarascia.com/how-to-use-local-storage-with-javascript/
just remember that every time you reload the page you will loose everything. In order to save the data you have to send it to a server.
Another thing: you don't need to buy a dedicated server to do this. You can implement the server in your own machine. This is a relatively easy task. Not that complicated. I advise you to take a look in the SO question above about basic ajax send/receive, before you rule this out.

A: Here's a quick way to generate a few elements from a localStorage.getItem() call and could maybe also help you out here along with Nelson's answer. Click on the button in the fiddle and you'll see the code grab the localStorage objects and use them to create some simple
's.
Fiddle:
http://jsfiddle.net/kfrvdnux/
Example code:
HTML
<button id='save'>Click the save button...</button>

JS
var content = document.getElementById('content'),
    save    = document.getElementById('save'),
    output  = '
',
    animals = [{
      name: 'bob',
      type: 'dog'
    }, {
      name: 'fred',
      type: 'lizard'
    }];

// set on load for testing
localStorage.setItem('animals', JSON.stringify(animals));

// grab localStorage data on click and create a list
save.addEventListener('click', function() {
    var ls = JSON.parse(localStorage.getItem('animals'));
    for (var i = 0; i < ls.length; i++) {
      output += '
' + ls[i].name + ', ' + ls[i].type + '
';
    }

  output += '
';
  content.innerHTML = output;
});

A: Are you trying to save .txt files locally to the computer? I don't believe JavaScript has this function because it would be a huge security hole. My understanding is that you could create cookie files on the local machine but that is about it.
If you need to export files you could always use an ASP.NET/PHP to create files on a server, then the user could click on a link that would prompt you to save the dynamically created file.
Based on the comment below you should create an array of objects.
var array = [];
array[array.length] = {name: 'NAME CONTENT', other: 'Other content', number: 1}
array[array.length] = {name: 'NAME CONTENT 2', other: 'Other content 2', number: 1}

You can then get a function to do things with your object by doing something like this
PrintInfo(array[i]);

function PrintInfo(aSingleObject){
    console.log(aSingleObject.name);
    console.log(aSingleObject.other);
    console.log(aSingleObject.number);
}

To remove objects from your array using the splice command
var array = [2, 5, 9];
console.log(array)
var index = array.indexOf(5);
if (index > -1) {
  array.splice(index, 1);
}
// array = [2, 9]
console.log(array);


text:
Q: Line endings with cygwin and Github for Windows I'm want to be able to work on my git projects using both the Github for Windows application as well as git in the command line using Cygwin (on Windows).
But I keep on getting problems with the line endings when I switch from one to the other.
If with the command line tool the repo has no changes, it will want to modify all the files with the Github app. If I do the changes with the Github app it will then again want to change it with the command line tool.
After a fair amount of testing I couldn't make it work for both tools.
What would make it work? In the .gitatributes I currently have set:
* text=auto
But it doesn't help

A: This is a GHfW bug which occurs when your repository configuration and the data in your repository do not agree.
If you configure a file to be translated to CRLF line endings - by setting core.autocrlf to true, for example, but you have blobs in your repository that are already in CRLF format (likely because somebody hasn't set core.autocrlf to true) then this problem can occur.
In this case, GHfW translates the CRLFs in the repository differently than msysgit.  As a result, some or all files appeared dirty.
I would recommend a consistent approach to your CRLF across your team to avoid any ambiguity by git tools as to what they should do with your line endings.  That said, this bug was recently fixed in libgit2, the library that underlies GHfW, and should makes its way into GHfW soon.

A: Working on both Git Bash and Cygwin in Windows is going to make git confuse. That is:

*

*clone/checkout a repo under Git Bash. During checking out, git thinks it's on Windows, so usually it uses CRLF to check out text files.

*run git in Cygwin, git thinks it's on Linux and that repo had been checked
out in Linux(which is actually not, according to the previous step). Therefore, when git sees CRLF in Cygwin, it thinks that LF is modified into CRLF so that git reports a lots files changes.

One way to fix this is to create .gitattributes file in repo's root and
add lines like the following:
*.txt text eol=lf

It tell git when encounter file with suffix .txt, using LF both when
writing into "database(.git)" and checking out into working directory.
reference here

A: I cloned a repository (with files with CRLF) on my windows using GitHub 2.7.0.24.
Then I wanted to use my cygwin's git version 2.1.4 on it.
I edited .git/config by adding "autocrlf=true" under the [core] section.
(With a real tabulation before "autocrlf=true")
Now cygwin's git says I'm up to date with no modifications.
I keep the CRLF on the files because they were created that way on the original repository.
I will not use the GitHub application anymore...
I noticed the merge conflicts are adding <<<< ==== >>>> lines with no CR, but they will be deleted when I resolve the conflicts.


text:
Q: Performance of single vs multiple column unique constraint I'm using PostgreSQL 9.3. I want to understand if I have an option to make a constraint unique across the entire table vs. unique across a subset of the table (i.e. by using 2 columns in the unique constraint, I restrict the uniqueness), which one is better for lookups?
Consider this table where a unique alphanumeric code is allotted to each student of the class.
CREATE TABLE sc_table (
   name text NOT NULL,
   code text NOT NULL,
   class_id integer NOT NULL,
   CONSTRAINT class_fk FOREIGN KEY (class_id) REFERENCES class (id),
   CONSTRAINT sc_uniq UNIQUE (code)
);

Currently the code is unique across the entire table. However the specification says that it is sufficient for the code to be unique across the class only. For my design requirements there's no restriction either way.
However if I change the constraint to be unique for a given class only, how would it affect lookup by code?
Or, in other words, which of the following combination of constraint & lookup is the best speed wise:
-- 1. unique across entire table, lookup by value
CONSTRAINT sc_uniq UNIQUE (code)
SELECT * FROM sc_table WHERE code='alpha-2-beta'

-- 2. unique across entire table, lookup by value & class
CONSTRAINT sc_uniq UNIQUE (code)
SELECT * FROM sc_table WHERE class_id=1 AND code='alpha-2-beta'

-- 3. unique per class, lookup by value
CONSTRAINT sc_uniq UNIQUE (code, class_id)
SELECT * FROM sc_table WHERE code='alpha-2-beta'

-- 4. unique per class, lookup by value & class
CONSTRAINT sc_uniq UNIQUE (code, class_id)
SELECT * FROM sc_table WHERE class_id=1 AND code='alpha-2-beta'

Question: My understanding is that 2 is better than 1 & 4 is better than 3. But which one's better between 1-vs-3 & 2-vs-4?
Update : Adding output of explain analyze. 3 is bad because there's no index for the lookup. 2 seems to be the best but the table is too small to conclude that.
-- 1
"Index Scan using sc_uniq on sc_table  (cost=0.15..8.17 rows=1 width=72) (actual time=0.041..0.044 rows=1 loops=1)"
"  Index Cond: (code = 'code1'::text)"
"Total runtime: 0.096 ms"

-- 2
"Index Scan using sc_uniq on sc_table  (cost=0.15..8.17 rows=1 width=72) (actual time=0.024..0.026 rows=1 loops=1)"
"  Index Cond: (code = 'code1'::text)"
"  Filter: (class_id = 1)"
"Total runtime: 0.056 ms"

-- 3
"Bitmap Heap Scan on sc_table2  (cost=4.18..12.64 rows=4 width=72) (actual time=0.052..0.053 rows=1 loops=1)"
"  Recheck Cond: (code = 'code1'::text)"
"  ->  Bitmap Index Scan on sc_uniq2  (cost=0.00..4.18 rows=4 width=0) (actual time=0.039..0.039 rows=1 loops=1)"
"        Index Cond: (code = 'code1'::text)"
"Total runtime: 0.121 ms"

-- 4
"Index Scan using sc_uniq2 on sc_table2  (cost=0.15..8.17 rows=1 width=72) (actual time=0.036..0.039 rows=1 loops=1)"
"  Index Cond: ((code = 'code1'::text) AND (class_id = 1))"
"Total runtime: 0.093 ms"

A: Your combinations in order of typical performance:
1. > 2. > 4. ( > 3.)

3. is invalid. If rows are only unique per (code, class_id), the lookup by code alone can return multiple rows and is different from the rest.
2. is pointless. If code is unique, there is no point in adding another predicate on class_id - except to verify that a given code actually belongs to a given class_id (and get no row otherwise).
Only 1. and 4. make sense and I would go with 1., of course. Unless you have additional requirements for the values of code, it's much more efficient to have one unique column. You could also make it the PK. Queries are simpler (one predicate instead of two), the (automatically created) unique index is potentially smaller (the most important factor here!), the lookup is typically slightly faster.
UPDATEs are also potentially more expensive for 2., where more columns trigger index updates. An UPDATE changing only code_id is cheaper for 1..
Your test result for 1. is counter-intuitive, maybe an artifact of your specific setup. Maybe you didn't prewarm the cache? Or some other random factor. It's pretty obvious from the EXPLAIN output: the only difference between 1. and 2. is the additional Filter: (class_id = 1) step. Nothing to gain here, you can only lose (even if very little in this case). 2. is typically a bit slower than 1. And 4. is also typically a bit slower than 1.

A: Since you are on Postgres 9.3, you are missing asking one of the most important questions, which is which columns do you really need the query to return?  Do you really need *?  If not, you may consider designing an index that can perform an Index Only Scan and avoid visiting the table at all.  This would be the primary reason in your case to go with a composite key.  For instance, if you wanted to look up name by code, you may try out this index and query:
CREATE UNIQUE INDEX sc_lookup ON sc_table (code, name);
SELECT name FROM sc_table WHERE code = 'alpha-2-beta';

This would normally give you an Index Only Scan.  There are more factors to consider as Erwin points out well, but the potential for an Index Only Scan can be one of the most significant performance benefits if your lookup scenario fits.


text:
Q: How can I create a relationship between two random nodes based on parent node? I am working on a PoC for my company in an effort to move towards a graph database to leverage some relationship analysis benefits from using graph databases.
I've created a dataset as follows:
foreach (x in range(1,1400) | create (:District {name: "District " + x, id: "district-" + x}))
foreach (x in range(1,10000) | create (:School {name: "School " + x, id: "school-" + x}))
foreach (x in range(1,50000) | create (:Teacher {name: "Teacher " + x, id: "teacher-" + x}))
foreach (x in range(1,50000) | create (:Class {name: "Class " + x, id: "class-" + x}))

I've started creating the basic relationships with these queries:
Create School -> District
match (s: School)
match (d: District)
with collect (distinct s) as school, collect (distinct d) as districts

foreach (school in schools |
    foreach (district in [districts[toInteger(rand()*size(districts))]] |
        create unique (school)-[:belongs_to]->(district)
        )
    )

Create Class -> School
match (c:Class)
match (s:School)
with collect (distinct c) as classes, collect (distinct s) as schools

foreach (class in classes |
    foreach (school in [schools[toInteger(rand()*size(schools))]] |
        create unique (class)<-[:has]-(school)
        )
    )

Create Teacher -> School
match (t:Teacher)
match (s:School)
with collect (distinct t) as teachers, collect (distinct s) as schools

foreach (teacher in teachers |
    foreach (school in [schools[toInteger(rand()*size(schools))]] |
        create unique (teacher)-[:teachers_at]->(school)
        )
    )

The problem I am currently facing is this: I need to take each Teacher and assign it to 0-2 classes at random, but only for classes that belong to the school that that teacher teaches at. I've tried putting MATCH statements inside of the FOREACH blocks, but that is against the rules for Cypher queries.
I am looking for suggestions on creating this specific query.

Note: As an aside, I am going to have to do this process again for a group of 250,000 students (randomly assign to a school, then randomly assign to 0-4 classes).

A: You can select a pattern from the teachers to the schools. Then from school to the classes. And then randomly sort classes, and then use the limit:
MATCH (teacher:Teacher) WITH teacher
MATCH (teacher)-[:teachers_at]->(:School)-[:has]->(class:Class)
WITH teacher,
     class ORDER BY RAND()
WITH teacher,
     collect(class)[0..toInteger(rand()*3)] as classes
UNWIND classes as class
CREATE (teacher)-[:has_class]->(class)


text:
Q: LLDB - setting source code path According to the official guideline of lldb, the ability to view source code during debug session (using the command source list) is done by setting new pathname for source files.
i.e. if i compiled my project in /tmp on one computer and deployed it on another computer where the source code reside in /Users/Src/ , i should type settings set target.source-map /tmp /Users/Src from running lldb in the deployment machine.
However, what happens if i got the executable from someone else, and don't know the build directory. and maybe the source-code is organized differently from where is was built (but the file contents is the same).
my questions are :

*

*Does lldb know how to search for matching source file recursively in the supplied path ?

*How can I get the original pathname form the mach-o executable ?
here's the formal description of the command :

Remap source file pathnames for the debug session. If your source files are no longer located in the same location as when the program was built --- maybe the program was built on a different computer --- you need to tell the debugger how to find the sources at their local file path instead of the build system's file path.

A: If you know a function name in the code in question, do:
(lldb) image lookup -vn <FunctionName> <BinaryImageNameContainingFunction>

and look for the CompileUnit entry.  The path given there is the path lldb got from the debug information.


text:
Q: Can I upload an audio file? Not sure where else to ask. There is no help or support forum?
Anyways, is it possible to upload an audio file, or how can I create a link to my machine, or is there a website to upload it to and then link it?


text:
Q: find child property key value and return parent object if value is true LODASH Give this data.
I am trying to return all data.objects who where property canHaveCookie : true
data : {
    name1: {
        canHaveCookie: true,
        anotherProp : false
    },
    name2: {
        canHaveCookie: false,
        anotherProp : false
    },
    name3: {
        canHaveCookie: true,
        anotherProp : false
    }
}

Here is what I have tried:
var dataAttrObj     = grandparent.data,
    tmpProcessObj   = [];

tmpProcessObj = _.pickBy(dataAttrObj, function(item) {
        console.log('item is', item);
        return _.includes(item, {canHaveCookie: true});
        // console.log('objs here',  _.has(item, {canStopProcessing: true}) );
        // return _.some(item, {canStopProcessing: true});
        // _.some(item, {canHaveCookie: true}));
        // return _.has(item, ['canHaveCookie', true]);
        return _.includes(item, {canHaveCookie: true});
    });

What I expect to get is
data : {
    name1: {
        canHaveCookie: true,
        anotherProp : false
    },
//notice name2 is not here because name2 canHaveCookie is false
    name3: {
        canHaveCookie: true,
        anotherProp : false
    }
}

Does anyone have a suggestion using lodash?

A: If you use  pickBy() is lodash, then you just need to check in the function if canHaveCookie is true. The first parameter to the function is the current value, so you simply need to return its canHaveCookie key (as it will be truthy if it is true).
For example:
_.pickBy(object, value => value.canHaveCookie)

Snippet:

var obj = {
  data: {
    name1: {
      canHaveCookie: true,
      anotherProp : false
    },
    name2: {
      canHaveCookie: false,
      anotherProp : false
    },
    name3: {
      canHaveCookie: true,
      anotherProp : false
    }
  }
}

var result = _.pickBy(obj.data, value => value.canHaveCookie)

console.log(result)
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.10/lodash.js"></script>


text:
Q: как перемешать данные в массиве типа Int class learn_project1 {
public static void main(String[] args) {
    learn_project1 e = new learn_project1();
    e.run();
    fixedarray();
    randomdelete();
    randomizer();
    }
public static int size;
public static int i;
public static int [] arrayResult;

public static void run (){

}

public static void fixedarray() {
    Scanner input = new Scanner(System.in);//объявляем сканнер

    System.out.println("Введите размера массива. Число должно быть не менее 10");
    size = input.nextInt(); // вводим размер массива
    int[] array = new int[size]; // объявление масссива - ты объявил массив в методе main. в других методах этот маммив не виден.понял? да
    /*проверка введенного размера массива*/
    if (size < 10) {
        System.out.println("Введенное число меньше 10. Выполнение программы далее невозможно.");// можно сделать повторение ввода- аля рестарта
        return;
    }
    if (size > 10) {
        System.out.println("Вводим данные в массив");
        for (i = 0; i < size; i++) {
            array[i] = i + 1;
        }
    }
    System.out.print("Введенные элементы массива:");
    for (i = 0; i < size; i++) {
        System.out.print(" " + array[i]);
    } // Выводим на экран, полученный массив
}
public static void randomdelete(){
    Random rnd = new Random();
    int randomValue = rnd.nextInt(size - 1) + 1;//здесь все норм
    System.out.println("Рандомное число: " + randomValue);
    int[] arrayResult = new int[size - 1];
    int j = 0;
    for (i = 0; i < size; i++) {
        if ((i + 1) != randomValue) {
            arrayResult[j] = i + 1;
            j++;
        }
    }
    for (i = 0; i < size - 1; i++) {
        System.out.print(" " + arrayResult[i]);
    }
}
public static void randomizer() {
    arrayResult[i]// применить функцию
}

}
// проверка что ввеенное значение это именно целое число больше 10
// заполение массива
// получение рандомного числа, которое находится в диапазоне заполненных
чисел. обратить внимание на граничащие числа. напр. если массив заполнен
числами от 1 до 10, то рандомайзер не должен выдавать 0 или 11 и далее
// удаление из массива полученного рандомного числа
// перемешивание массива
// вычисление удаленного рандомного числа


text:
Q: How to read a diff file in python, extract added lines and remove them (change to old patch)? I have unifled diff patch like this

@@ -3224,10 +3221,7 @@ void THTensor_(logspace)(THTensor *r_, real a, real b, long n)
  }

  if(n == 1) {

    TH_TENSOR_APPLY(real, r_,
 -       *r__data = TH_MATH_NAME(pow)(10.0, a);
 -       i++;
 -       );
 +   THTensor_(set1d)(r_, 0, TH_MATH_NAME(pow)(10.0, a));
  } else {
    TH_TENSOR_APPLY(real, r_,
        *r__data = TH_MATH_NAME(pow)(10.0, a + i*(b-a)/((real)(n-1)));

How I can read it in python, extract new lines and remove them from the diff patch to generate the old patch?

A: There is https://pypi.org/project/unidiff/ that can be used to read the unified diff and operate on it.
It is unclear to me what you want to achieve with modifying the diff. If you want to reverse the change from the diff, you can use patch --reverse.


text:
Q: How to recover from legacy stuff in large system step by step? Our team has been given a legacy system for further maintenance and development.
As this this is true "legacy" stuff, there is really, really small number of tests, and most of them are crap. This is an app with web interface, so there are both container-managed components as well as plain java classes (not tied to any framework etc.) which are "new-ed" here and there, whenever you want to.
As we work with this system, every time we touch given part we try to break all that stuff into smaller pieces, discover and refactor dependencies, push dependencies instead of pulling them in code.
My question is how to work with such system, to break dependecies, make code more testable etc? When to stop and how to deal with this?
Let me show you an example:
public class BillingSettingsAction {

    private TelSystemConfigurator configurator;
    private OperatorIdDao dao;

    public BillingSettingsAction(String zoneId) {
        configurator = TelSystemConfiguratorFactory.instance().getConfigurator(zoneId);
        dao = IdDaoFactory.getDao();
        ...
    }

    // methods using configurator and dao
}

This constructor definitely does too much. Also to test this for further refactoring it requires doing magic with PowerMock etc. What I'd do is to change it into:
public BillingSettingsAction(String zone, TelSystemConfigurator configurator, OperatorIdDao dao) {
    this.configurator = configurator;
    this.dao = dao;
    this.zone = zone;
}

or provide constructor setting zone only with setters for dependencies.
The problem I see is that if I provide dependencies in constructor, I still need to provide them somewhere. So it is just moving problem one level up. I know I can create factory for wiring all the dependencies, but touching different part of app will cause having different factories for each. I obviously can't refactor all the app at once and introduce e.g. Spring  there.
Exposing setters (maybe with default implementations provided) is similar, moreover it is like adding code for tests only.
So my question is how you deal with that? How to make dependencies between objects better, more readable, testable without doing it in one go?

A: I just recently started reading "Working effectively with legacy code" by Michael Feathers.
The book is basically an answer to your very question. It presents very actionable "nuggets" and techniques to incrementally bring a legacy system under test and progressively improve the code base.
The navigation can be a little confusing, as the book references itself by pointing to specific techniques, almost from page 1, but I find that the content is very useful so far.
I am not affiliated with the author or anything like that, it's just that I am facing similar situations and found this a very interesting resource.
HTH

A: I'd try to establish a rule like the boy scout rule: When ever you touch a file you have to improve it a little, apart from implementing what ever you wanted to implement.
In order to support that you can

*

*agree on a fixed time budget for such improvements like for 2 hours of feature work we allow 1 hour of clean up.

*Have metrics visible showing the improvement over time. Often simple things like average file size and test coverage are sufficient

*Have a list of things you want to change at least for the bigger stuff, like "Get rid of TelSystemConfiguratorFactory" track on which tasks you are already working and prefere working on things that already started over new things.
In any case make sure management agrees to your approach.
On the more technical side: The approach you showed is is good. In many cases I would consider a second constructor providing all the dependencies but through the new constructor with the parameters. Make the additional constructor deprecated. When you touch clients of that class make them use the new constructor.
If you are going with Spring (or some other DI Framework) you can start by replacing calls to static Factories with getting an instance from the Spring context as an intermediate step before actually creating it via spring and injecting all the dependencies.


text:
Q: How to connect two draw components in ExtJS 4.0 I have drawn two circles in ExtJS4, using draw component. I want to know how to connect those circles using line with arrow head. Is there any methods to draw such line, without drawing arrow head manually.
Thanks,
Boopathy


text:
Q: gcc can't find reference to function DoIt() when linking I am currently becoming crazy. It seems like there is a problem with gcc and it can't open include files can't find the function DoIt() when linking. I tried compiling this code in code blocks and it didn't work so I tried it with G++ in the console and it still didn't work. So I think it's a problem with gcc.
This is my code
main.cpp
#include <iostream>
#include "source.h"
int main()
{
    std::cout<<"That works"<<std::endl;
    DoIt();
    while(true)
    {
    }
    return 0;
}

source.cpp
#include "source.h"
#include <iostream>

void DoIt()
{
std::cout<<"That works too"<<std::endl; //Currently doesn't work
}

source.h
void DoIt();

And this is what I wrote in the terminal
g++ main.cpp -std=c++11 -o result

This is the error message when i run it
/tmp/ccG6X4Bw.o: In function `main':
main.cpp:(.text+0x2d): undefined reference to `DoIt()'
collect2: error: ld returned 1 exit status

I have no clue why it doesn't work

A: By default, gcc will try to compile and link. Linking without the code from source.cpp will cause the linker to be unable to link the call of DoIt to its code. If you just wish to compile, pass -c to gcc.
From the man page:

  When you invoke GCC, it normally does preprocessing, compilation, assembly and linking.
  ...
   -c  Compile or assemble the source files, but do not link.
       The linking stage simply is not done.


text:
Q: Inner joins on 3 tables with one known variable I tried a couple of the other answers but I still can't get my brain around this. Maybe if my specific problem is worked out I can understand how to join three tables.
I have these tables:
invoice
id -

invoiceItem
id - invId - itemId - discode

item
id - name - cid(categoryID) - price - memprice - attendee_price

category
id - catName

I query for invoices and get there id's and then run a while loop to:
get the list of invoice items, the details of those items by id, and the category by id.
this is the query i am attempting but am hung up on the joins and where clause
while ($r = mysql_fetch_assoc($invoice_query){
//my invoice id is $r['id']

    $iQ = mysql_query("SELECT
          item.id, item.cid, item.name, item.memprice, item.attendee_price, item.price,
          invoiceItem.discode,
          categories.id, categories.catName
          FROM invoiceItem
          INNER JOIN categories ON item.cid=categories.id
          INNER JOIN item ON ??????
          WHERE invoiceItem.id='$r[id]'");
}

A: ON conditions for INNER JOINS typically consist of
leftTable.foreignKey = rightTable.primaryKey...in your case you needed to add a join for the invoice table so you match its primary key to the foreign key in the invoiceItem table (invoice.id = invoiceItem.invId)
SELECT
          item.id, item.cid, item.name, item.memprice, item.attendee_price, item.price,
          invoiceItem.discode,
          categories.id, categories.catName
          FROM invoiceItem
          INNER JOIN item ON item.id = invoiceItem.itemId
          INNER JOIN categories ON item.cid=categories.id
          INNER JOIN invoice ON invoice.id = invoiceItem.invId
          WHERE invoice.id='$ir[id]'


text:
Q: IntelliJIdea: Cannot load /home/.../conf/server.xml: I encountered problem with my IDE Idea 2016.1
It says:

Error running run spring: Cannot load
  /home/sergei-rudenkov/.IntelliJIdea2016.1/system/tomcat//conf/server.xml:
  /home/sergei-rudenkov/.IntelliJIdea2016.1/system/tomcat//conf/server.xml
  (No such file or directory)

Actually my tomcat situated at /opt/tomcat directory and idea kmows about it. What can be a reason of this exception?

A: First, be sure you understand the difference between TOMCAT_HOME and TOMCAT_BASE. This SO answer gives a good description: https://stackoverflow.com/a/29398713/1348743
With that in mind, some explanation of how IDEA creates a TOMCAT_BASE directory for Tomcat run configurations...
When you create a Tomcat Run/Debug configuration, IntelliJ IDEA creates a TOMCAT_BASE directory as {intellij_system_directory}\tomcat\{run_configuration_name}_{project_name}. (TOMCAT_HOME identifies where the binary files are and TOMCAT_BASE defines where an instance of tomcat is. Sometimes they are the same. In this case, they are not.) The {intellij_system_directory} directory is usually in ~/.IntelliJIdea2016.1/system. See Directories used by the IDE to store settings, caches, plugins and logs for more info).
That's why the path is where it is. But it looks like your path (as you show in the message) is missing the run configuration portion: .../tomcat//conf/... That should be something like .../tomcat/foo_bar/conf/.... So it seems like a config has gotten corrupt. There is a bug, IDEA-133536, I reported a couple of years ago that can this type of corruption under certain conditions. You may be hitting that.
There are two potential solutions:

*

*Recreate your run/debug configurations ensuring you give them a unique name when you first create and save them

*Manually edit the run/debug configuration file and modify the value for the BASE_DIRECTORY_NAME option (just search for that string). If you have shared the run/debug configuration (via the "share" option in the upper right corner), the configuration file will be in ${project_directory}/.idea/runConfigurations/${runConfigurationName}.xml. If it is not shared, it will be in the file  ${project_directory}/.idea/workspace.xml. You should close the project before editing either of those files (and make a backup just in case).

For some additional information, take a look at my post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206837735--How-To-Specify-Tomcat-Cache-Directory-For-Webapp#community_comment_206857039

A: For me the problem was that I made java point to JDK instead of JRE - because of a new project, which required JDK.
So the old project stopped building and gave the error above.
After returning java to point back to JRE - the old project builds fine.
=====
So:

*

*when working on new project - java => JDK

*when working on old project - java => JRE
:D


text:
Q: Examples of George R. R. Martin's Three step foreshadowing/revelation In the interview quoted in this answer, Anne Groell mentions a three step revelation strategy for plot elements employed by George R. R. Martin in the A Song of Ice and Fire series:

That said, now that I've realized his three-fold revelation strategy, I see it in play almost every time. The first, subtle hint for the really astute readers, followed later by the more blatant hint for the less attentive, followed by just spelling it out for everyone else.

But I can't say I'm familiar enough with the works to spot it. Can someone find, for example, the three steps of revelation for Eddard Stark's death near the end of A Game of Thrones?

A: The two young Walders Frey at Winterfell play a game called King of the Crossing in which the King must hold to an oath unless he slips in the word "mayhaps" unnoticed. If you look at the interaction between Lord Frey and Robb & Catelyn right before the Red Wedding, Frey does just that- slips in a "mayhaps" when the Starks ask for food. Thus, it's not suprising that he does not hold to his oath.

A: There are many hints of Eddard's fate.
As already pointed out, in the first chapter:

 The dead stag and direwolf that Eddard and his posse find on the way back from beheading the Night's Watchman from the Epilogue is a subtle hint

Then in Chapter 27 as Eddard discusses the upcoming King's Tourney with the small council, Janos Slynt mentions:

 "The night before a woman's head was found in the Great Sept, floating in the rainbow pool". - A more direct hint of Ned's fate since Slynt assists in Ned's beheading on the steps of this Sept.

At the end of Chapter 32, Arya asks one of her father's guardsmen

 "What if a wizard was sent to kill him?"

And he responds:

 "Well, as to that," Desmond replied, drawing his longsword, "wizards die the same as other men, once you cut their heads off."

There are other hints in addition to the ones mentioned above, such as Illyrio and Varys's conversation and Littlefinger telling Ned not to trust him. And then of course we find out Ned's fate towards the end of AGOT.

A: As TLP wrote, I'm not sure there are always three components, and not all events are foreshadowed. But there are many events that are foreshadowed over the course of the series. One memorable example is the Red Wedding, which is heavily foreshadowed:

*

*Patchface sings about it in the prologue of ACOK:

 "Fool's blood, king's blood, blood on the maiden's thigh, but chains for the guests and chains for the bridegroom, aye aye aye."

*

*Dany sees a vision in the House of the Undying:

 A feast of slaughtered corpses holding cups, spoons, and food, with a dead man with a wolf's head sitting on a throne wearing an iron crown

*

*Later in ASOS, Grey Wind growls at Lothar Frey and Walder Rivers upon Robb's arrival at the Twins.

*Finally we have Walder Frey's comments, the bad food, bad music, lots of drinks, etc leading up to the actual events of the Red Wedding.


text:
Q: Using Jackson to deserialize JSON to Map I am trying to find an easy way to deserialize the following JSON to an OpeningHours Object containing a Map<String, List<String>> which contains the days as keys and the opening hours as a list.
I am using Jackson and created my own deserializer @JsonDeserialize(using = MyDeserializer.class)
The problem is that I need to check which of the different JSON nodes is present to set the keys for the map.
Is there an easy alternative solution?
{
  "OpeningHours": {
    "Days": {
      "Monday": {
        "string": [
          "09:00-13:00",
          "13:30-18:00"
        ]
      },
      "Tuesday": {
        "string": [
          "09:00-13:00",
          "13:30-18:00"
        ]
      }
    }
  }
}

A: You could just deserialize it to a data structure that represents the JSON like
@Data
public class TempStore {

    private List<DayTempStore> days;
}

@Data
public class DaytempStore {

    private String[] string;
}

and just transform this to a Map> leaving the hassle with Nodes and Checks to Jackson.

A: Jackson can deserialize any Json into Map<String, Object>, that may contain nested maps for nested json objects. all that is needed is casting:
String json = ...
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> openingHours = (Map<String, Object>)mapper.readValue(json, Map.class);
Map<String, List<String>> days = (Map<String, List<String>>)((Map<String, Object>)openingHours.get("OpeningHours")).get("Days");
System.out.println(days);

output:
 {Monday={string=[09:00-13:00, 13:30-18:00]}, Tuesday={string=[09:00-13:00, 13:30-18:00]}}

A: I think you are making the issue is a bit more complex than it is. You don't need a custom deserializer in this case. All you need is this:
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModules(new JavaTimeModule());
ObjectReader obrecjReader = objectMapper.reader();
Map<String, Object> myMap = objectReader.forType(Map<String,Object>.class).readValue(jsonString);


text:
Q: Changing state in componentDidMount doesn't lead to render in child component I'm saving a searchObject from database to localStorage and redirecting to /discover onclick:
  modelInstance.getSearchFromDB(id).then((searchObject) => {
  console.log(searchObject);
  modelInstance.setSearchParams(searchObject); // Save search params to localStorage

  window.location.assign("/discover");
 })

In discover.js, I use the searchObject object:
class DiscoverContainer extends React.Component {
    constructor(props){
        super(props);

        this.state = {
            status: 'NULL',
            searchInput: ""
        }
    }

    componentDidMount() {
      let searchObject = modelInstance.getSearchParams(); // function that gets search params and eliminates them from localStorage

      console.log("searchObject.query:");
      console.log(searchObject.query);

      if(searchObject){
        this.setState({
          status: "LOADED",
          searchInput: searchObject.query,
          positive: searchObject.positive,
          negative: searchObject.negative,
          total: searchObject.total,
          noOfNeutral: searchObject.noOfNeutral,
          until: searchObject.until,
          placeName: searchObject.location,

        });
      }
    }

render () {
  const { stepsEnabled, steps, initialStep} = this.state;

  }

    return (

            <Search handleStatusChange={this.handleStatusChange} searchInput={this.state.searchInput}/>

    );

As you can see, in componentDidMount, I'm setting this.state.searchInput to the searchObject value. My expectation is that this will lead to the new value being sent to the Search object in render, so that Search will send this value to its child SearchInput:
Search.js:
class Search extends Component {
  constructor(props){
    super(props);
    var today = new Date();
    console.log("in Search:");
    console.log(props.searchInput);
    this.state = {
      searchSuggestion: 'Search for tweets here',
      anchorEl: null,
      page: 0,
      placeName: "LOCATION", // === '' ? "LOCATION" : modelInstance.getPlaceName()
      placeOptions: modelInstance.getPlaceOptions(),
      searchInput: props.searchInput,
    }
  render(){
    return(

          <Row id='searchInput'>
            <SearchInput handleInput={this.handleInput.bind(this)} searchInput={this.state.searchInput} searchSuggestion={this.state.searchSuggestion} page={1}/>
          </Row>

    )
  }
}

Unfortunately, this doesn't work. I output searchObject.query (you can see it in the code) in the discover.js file, and the right value is there. But, when I output props.searchInput in Search', nothing is output. This seems to be because Search.constructor runs before Discover.componentDidMount. It feels like I'm going about this the wrong way. What is the right way of passing down state of a parent to a "grand-child"?

A: There's no need to copy the prop into the child's state, just reference the prop directly in render:
class Search extends Component {
  constructor(props) {
    super(props);
    this.state = {
      searchSuggestion: 'Search for tweets here',
      anchorEl: null,
      page: 0,
      placeName: 'LOCATION',
      placeOptions: modelInstance.getPlaceOptions(),
    };
  }

  render() {
    return(

          <Row id='searchInput'>
            <SearchInput
              handleInput={this.handleInput.bind(this)}
              searchInput={this.props.searchInput}
              searchSuggestion={this.state.searchSuggestion}
              page={1}
            />
          </Row>

    )
  }
}


text:
Q: C270 webcam + LED ceiling light + zoom = luminosity wave pattern I have a Logitech C720 webcam which I use for video chats, in particular with Zoom. Also, I'm sitting in a room with a small amount of sunlight, and light from a 48W, 3000K light, led-based, ceiling-mounted luminaire.
Now, when I turn my camera on and "test video" in Zoom, I see a sort of a vertical wave pattern on the video image, i.e.
luminosity of pixel at position x,y at time t =
average luminosity of pixel at position x,y  *
(1 + a_1 * sin(a_2 * y + a_3 * t) ).

If I turn the inside LED-based light off, the phenomenon goes away.
My question:

*

*(Less on-topic) Why is this happening? Does this have something to do with the difference between the camera's sample frequency and my house's electricity frequency (50 Hz)?

*What, other than turning the light off, can I do to cancel or weaken this pattern - if anything?

Note: I'm using Devuan GNU/Linux 3 (~= Debian 10 Buster without systemd).

A: (Thanks goes to Tetsujin for suggesting the appropriate course of action.)
The problem is, as you suspect, due to the electric power line frequency to your home: 50 Hz. In fact, the relevant OS driver - Linux USB Video Class - has specific functionality to account for alternate-current power effects on ambient lighting, which can be set to (at least) 50 Hz, 60 Hz or Disable. You likely have one of the latter values set, and need to change that setting.
As to how to change that setting - since Zoom doesn't let you do that, you need to find an app that will, or some hardware configuration interface of your desktop environment, or a utility for your specific webcam. For your specific case, see this answer on Unix.SX.


text:
Q: android menu not shown I am trying to study a project from here. After I downloaded the android app code and added the gridle files(the original gridle files are missing ), the mainActivity doesn't have the menu at the top of the screen.
the menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="@+id/secure_connect_scan"
    android:padding="5dp"
    android:icon="@android:drawable/ic_menu_search"
      android:title="@string/secure_connect"
      app:showAsAction="always" />

    @Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.option_menu, menu);
    return true;
}

Here's a link to the code : github

A: I just tried and everything works fine. The menu bar is there. Do following:

*

*Delete all project files to start from the scratch again.

*git clone https://github.com/aso777/BlueControl.git into the location you want to have the project. (Or just download the zip file from git, unzip it, and move it to the right place.)

*Open Android Studio

*On the Welcome screen click on "Import project (Eclipse ADT, Gradle, etc.)" (it's the 4th option!)

*Select the inner(!!) BlueControl folder and click OK.

*Accept all standard conficuration with "next" and "finalize".

*It you get import errors, just accept the fix Android Studio is proposing. (you may have to download some API stuff.)

OK?

A: you are using AppCompat theme but extending Activity. So, please change the following line
public class MainActivity extends Activity {

to
public class MainActivity extends AppCompatActivity {