text:
Q: Internet Explorer image rendering 1 pixel off The website I'm working on (schmuckzauberwelt.ch) has a fancy frame around it which adjusts somewhat dynamically to the available viewport. In order to keep the main site usable, the frame is not one image, but rather cut into four pieces (top, right, bottom, left) which are positioned around the main site. The gist of the html code is this:

[...]

These four .png's are completely transparent; they get a z-index of 1 in order to put them over the main site:
#mirror-top,
#mirror-bottom,
#mirror-left,
#mirror-right {
    z-index: 1;
    position: absolute;
background-repeat: no-repeat;
}

Then a bunch of media queries give them the right size / position and load in the the actual frame image as a background (one example here):
@media (min-height: 600px) and (max-height: 647px) and (min-width: 1000px),
(min-width: 1000px) and (max-width: 1079px) and (min-height: 600px)
{
[...]
#mirror-top,
#mirror-bottom {
width: 1000px;
height: 100px;
background-image: url(mirror-long-600px.jpg);
}
#mirror-bottom {
top: 500px;
}
#mirror-left,
#mirror-right {
width: 100px;
height: 400px;
top: 100px;
background-image: url(mirror-short-600px.jpg);
}
#mirror-right {
    left: 900px;
}
}

And finally, in order to save on bandwidth, the top and the bottom as well as the left and the right frame piece are the actually same image, they just get flipped via css before being loaded in:
#mirror-bottom,
#mirror-right {
-webkit-transform: rotate(180deg);
-moz-transform: rotate(180deg);
-ms-transform: rotate(180deg);
-o-transform: rotate(180deg);
transform: rotate(180deg);
}

Now, all of this works fine in Firefox, Chrome, Safari and Mobile Safari from display sizes of smartphones all the way up to a 27inch iMac
BUT
you guessed it: Internet Explorer has a problem with it: The bottom and the right mirror somehow are one pixel off, blurring the background image and creating ugly lines...
See for yourself: imgur.com album (First image windows 7 IE11, second Windows 8.1 IE11)
Apart from that, I noticed that everything is fine when making the window so small, that the smallest media query kicks in and positions the site top left with scrollbars rather than centering it horizontally and vertically.
The general code for that is the following:
#wrapper {
z-index: 0;
background-color: white;
position: absolute;
top: 50%;
left: 50%;
}

In all but the smallest media query, there's something like this:
#wrapper {
width: 1000px;
height: 600px;
margin-top: -300px;
margin-left: -500px;
}

And in the smallest one, this:
#wrapper {
    width: 830px;
    height: 498px;
    top: 0%;
    left: 0%;
}

So, the question is: what can I do? Or at least, where could I start debugging? Right now I'm completely lost...
I know that the code a little bit complicated and I tried my best to sum it up but most of the relevant code is scattered around several media queries, so maybe you need to take a quick look at it with firebug...

A: This looks like a typical "whitepace between inline-block elements" problem.
What I would try first is to remove the carriage returns in your HTML code, like this :

[...]

It actually puts the carriage returns (causing the whitespace problems) in comment, so it's basically as you putting all the img tags next to each other, but with this notation you can keep your code indented.

A: If the issue is whitespace related, you can also try explicitly setting the line-height or font-size to 0 on all relevant elements/DIVs/wrappers - and then re-establish the line-height/font-size on your central content area.
If the problem persists, another way of presenting the HTML layout which may solve your issue would be to break your content into further DIVs - very roughly - like this;

Lorem ipsum ...

In this example, you would apply your dynamic sizing to the divs (possibly with percentages) - not the images - and set the images to width: 100%;.  You shouldn't need to set the height of the images at all.
div#left and div#right could be floated, with div#center kept independent using margins/negative-margins.
Make sure that the #top, #left, #right and #bottom divs have font-size: 0; - because they contain no text; this will resolve any whitespace issues that the images might have.
Also, make sure that your wrapping DIVs have a background-color to match the gray.  This isn't a magic bullet, but it should hide the outer-most 1px lines making the issue far less prominent.


text:
Q: Android XmlPullParser Query Just a quick question how would I pull from a string using XmlPullParser content within a start tag?
Say the string was;
<location lat="56" lon="-145"></location>

How would I pull the lat and lon values?
Edit, is the correct way to input a string with xml content setInput(new StringReader(STRING)?
Thanks

A: You can do this below:
        parser.setInput(in, "utf-8");  //in(InputStream) is your xml content stream
        int eventType = parser.getEventType();
        while(eventType!=XmlPullParser.END_DOCUMENT){
            switch (eventType) {

            case XmlPullParser.START_TAG:
                String tagName = parser.getName();
                if(tagName!=null&&tagName.equals("location")){
                   //This is what you want
                   String lat = parser.getAttributeValue(null,"lat");

                }

                break;

            case XmlPullParser.END_TAG:
                if(parser.getName().equals("location")){

                }
                break;
            default:
                break;
            }
            eventType = parser.next();
        }

redpajama_set_name: RedPajamaStackExchange


text:
Q: Attach to running process inside docker from VS2017 Is there an easy way to debug a process running inside a Linux container on a remote host from Visual Studio?
Imagine a scenario where we have multiple services deployed on some remote machine, running inside docker containers - dev environment. During testing we detect that the internal state of one of the services becomes currupt and need to figure out what's going on in there. We do not want to docker-compose up locally because we might not be able to simulate the scenario.
Instead we want to attach to the running process inside the container.
I read several articles about how to do this, but they are either about Windows containers (https://www.richard-banks.org/2017/02/debug-net-in-windows-container.html) or are just plain confusing (e.g. do I need to install sshd to connect to it from VS? Do I need to install vsdbg as outlined here https://github.com/Microsoft/generator-docker/issues/130 ?)
I tried installing the vsdbg into the container along with ssh, but Visual Studio is not able to find any Remote Connections (in Debug -> Attach to Process).
Is there any tutorial specificly for VS2017 & remote debugging & Docker Linux containers
?

A: You can try to debug with gdb and ssh like it is showed on this page: https://learn.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer
but this will treat the process as native/unmanaged process. It is basically for debugging C++ applications.
For remote debugging managed processes C#, VB, F# and so on, you can use "remote debugging tools for VS" but they are only for Windows. So for know you can not remote debug C# application on Linux container.
Hope this clarifies the things.

A: To expose those you would have to install the remote debugging tools.  Generally there is a different version for each visual studio when using windows, but this should work from 2017 and later editions of visual studio.
https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-dotnet-core-linux-with-ssh?view=vs-2019


text:
Q: protocol delegates in swift to multiple views I am trying to learn all I can about delegates. In this example the main page is called PagesTableViewController. When user clicks Page 1, it takes the to DetailsViewController. When you fill in label you go back to PagesTableViewController. then when Button is pushed it takes you to PrintViewController and shows the label filled in from DetailsViewController. I have been trying tutorials and something in the code I must be doing wrong.
Here is my view

Here is code for PagesTableView
import UIKit

class PagesTableViewController: UIViewController {

    let pages = ["Page 1","Page 2","Page 3"]

    @IBOutlet weak var pagesTableView: UITableView!

    override func viewDidLoad() {
        super.viewDidLoad()

        pagesTableView.dataSource = self

    }

    @IBAction func printBtnPressed(_ sender: Any) {

    }

}

extension PagesTableViewController: UITableViewDataSource {

    // MARK: - Table view data source

     func numberOfSections(in tableView: UITableView) -> Int {
        // #warning Incomplete implementation, return the number of sections
        return 1
    }

     func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of rows
        return pages.count
    }

      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
     let cell = tableView.dequeueReusableCell(withIdentifier: "PagesCell", for: indexPath)

     cell.textLabel?.text = pages[indexPath.row]

     return cell
     }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "DetailsViewSegue" {

        }
    }

}

DetailsViewController
import UIKit

class DetailsViewController: UIViewController {

    @IBOutlet weak var detailsTextField: UITextField!

    var childDelegate: basicChildInfo?

    override func viewDidLoad() {
        super.viewDidLoad()

    }

    @IBAction func cancelBtnPressed(_ sender: Any) {
        dismiss(animated: true, completion: nil)
    }

    @IBAction func saveBtnPressed(_ sender: Any) {

        let data = detailsTextField.text
        childDelegate?.userEnteredChildInfo(data: data!)
        dismiss(animated: true, completion: nil)

    }
}

PrintViewController
import UIKit

class PrintViewController: UIViewController, basicChildInfo {

    @IBOutlet weak var printLabelOne: UILabel!

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    //protocol func pulled from child info -- Data from child info
    func userEnteredChildInfo(data: String) {
        printLabelOne.text = data
    }

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "PrintSegue" {
            let childInfoVC: DetailsViewController = segue.destination as! DetailsViewController
            childInfoVC.childDelegate = self
        }
    }

    @IBAction func printBtnPressed(_ sender: Any) {

        print("Printing File")
        dismiss(animated: true, completion: nil)

    }

}

And Lastly my protocol. File On on swift file
import Foundation

protocol basicChildInfo {
    func userEnteredChildInfo(data: String)
}

A: My guess is that the delegate on DetailsViewController never gets set. Here's the sequence of your UI's control flow (as far as I understand it):

*

*a new DetailsViewController is created and presented

*the user enters text

*the user taps the Save button

*DetailsViewController informs its delegate about the text and dismisses itself, thus getting deleted

*a new PrintViewController is created and presented

So at the time when DetailsViewController wants to inform its delegate about the entered value, that delegate has not yet been set; actually the PrintViewController does not even exist at this time.
What's worse, the code in PrintViewController's prepare-for-segue most likely never gets called because there is no segue from the Print VC to the Details VC, and this method only is run when a segue-based transition occurs.

So, coming back to the problem you want to solve: I suggest that you...

*

*let PagesTableViewController conform to the delegate protocol and set it as delegate when DetailsViewController is presented

*in the delegate callback, store the entered data in a member variable of PagesTableViewController

*when PrintViewController is presented, set the value stored in that member var on a property of PrintViewController
So both actions -- setting the delegate on DetailsViewController and configuring the entered text on PrintViewController -- go into PrintViewController's prepare-for-segue:
class PagesTableViewController: UIViewController, BasicChildInfo {
  private var userText: String? = nil

  func userEnteredChildInfo(data: String) {
    userText.text = data
  }

  override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
      if segue.identifier == "DetailsViewSegue" {
        (segue.destination as! DetailsViewController).childDelegate = self
      }
      else if  segue.identifier == "PrintSegue" {
        (segue.destination as! PrintViewController).userText = self.userText
      }
  }


text:
Q: plugin activation in ckeditor i have downloaded the colorbutton plugin. and put the plugin into ckditor plugin folder. in config.js i have activate my plugin . but when i put the activation code in confiq.js file the whole ckeditor is disapper from the page. when i remove this "config.extraPlugins = 'colorbutton';" from the code ckeditor appear when isert it disapper and i need the text coloroption in ckeditor.
the follwing is the config.js
CKEDITOR.editorConfig = function( config ) {

// Define changes to default configuration here.
// For the complete reference:
// http://docs.ckeditor.com/#!/api/CKEDITOR.config

// The toolbar groups arrangement, optimized for two toolbar rows.
config.toolbarGroups = [
    { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
    { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
    { name: 'links' },
    { name: 'insert' },
    { name: 'forms' },
    { name: 'tools' },
    { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
    { name: 'others' },
    '/',
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
    { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
    { name: 'styles' },
    { name: 'colors' },
    { name: 'about' }
];

// Remove some buttons, provided by the standard plugins, which we don't
// need to have in the Standard(s) toolbar.
config.removeButtons = 'Underline,Subscript,Superscript';

// Se the most common block elements.
config.format_tags = 'p;h1;h2;h3;pre';
// Make dialogs simpler.
config.removeDialogTabs = 'image:advanced;link:advanced';

var path12=CKEDITOR.basePath;
   config.filebrowserBrowseUrl = path12+ 'image/browse.php?type=files';
   config.filebrowserImageBrowseUrl = path12+'image/browse.php?type=images';
   config.filebrowserFlashBrowseUrl = path12+'image/browse.php?type=flash';
   config.filebrowserUploadUrl = path12+'image/upload.php?type=files';
   config.filebrowserImageUploadUrl = path12+'image/upload.php?type=images';
   config.filebrowserFlashUploadUrl = path12+'image/upload.php?type=flash';
  config.extraPlugins = 'colorbutton';
};

A: I would assume you do not have the correct folder structure. Did you place the plugin in the correct folder and its contents?
plugin_sdk_sample_1


text:
Q: Erlang spawn simple process from erl .. no such process or port When running this code in the Erlang console
Pid = spawn(fun() -> "foo" end),link(Pid),receive X -> X end.

I receive the following error.
** exception error: no such process or port
 in function  link/1
    called as link(<0.71.0>)```

A: This happens because the process you spawn finishes very quickly: it only "returns" a string (and the return value goes nowhere, since it is the top-level function in the call stack of the new process), so it's very likely to finish before the emulator gets to the link call.
You can make it more likely to succeed by making the process sleep before exiting:
2> Pid = spawn(fun() -> timer:sleep(1000), "foo" end),link(Pid).
true

Note however that the receive expression in your example most likely won't receive anything, since the spawned process doesn't send any message, and the link won't generate any message either since the process exits normally, and the calling process most likely isn't trapping exits.  You may want to do something like:
Parent = self(),
spawn(fun() -> Parent ! "foo" end),
receive X -> X end.

That returns "foo".


text:
Q: Resolving rotation matrices to obtain the angles I have used this code as a basis to detect my rectangular target in a scene.I use ORB and Flann Matcher.I have been able to draw the bounding box of the detected target in my scene successfully using the findHomography() and perspectiveTransform() functions.

The reference image (img_object in the above code) is a straight view of only the rectangular target.Now the target in my scene image may be tilted forwards or backwards.I want to find out the angle by which it has been tilted.I have read various posts and came to the conclusion that the homography returned by findHomography() can be decomposed to the rotation matrix and translation vector. I have used code from https:/gist.github.com/inspirit/740979 recommended by this link translated to C++.This is the Zhang SVD decomposition code got from the camera calibration module of OpenCV.I got the complete explanation of this decomposition code from O'Reilly's Learning OpenCV book.

I also used solvePnP() on the the keypoints returned by the matcher to  cross check the rotation matrix and the translation vector returned from the homography decomposition but they do not seem to the same.

I have already the measurements of the tilts of all my scene images.i found 2 ways to retrieve the angles from the rotation matrix to check how well they match my values.

*

*Given a 3×3 rotation matrix
R = [ r_{11} & r_{12} & r_{13} ]
      [ r_{21} & r_{22} & r_{23} ]
      [ r_{31} & r_{32} & r_{33} ]
The 3 Euler angles are
theta_{x} = atan2(r_{32}, r_{33})
theta_{y} = atan2(-r_{31}, sqrt{r_{32}^2 + r_{33}^2})
theta_{z} = atan2(r_{21}, r_{11})

*

*The axis,angle representation - Being R a general rotation matrix, its corresponding rotation axis u
and rotation angle θ can be retrieved from:
cos(θ) = ( trace(R) − 1) / 2
[u]× = (R − R⊤) / 2 sin(θ)

I calculated the angles using both the methods for the rotation matrices obtained from the homography decomposition and the solvepnp().All the angles are different and give very unexpected values.

Is there a hole in my understanding?I do not understand where my calculations are wrong.Are there any alternatives i can use?

A: Why do you expect them to be the same? They are not the same thing at all.
The Euler angles are three angles of rotation about one axis at a time, starting from the world frame.
Rodriguez's formula gives components of one vector in the world frame, and an angle of rotation about that vector.


text:
Q: Deallocate the presenting/previous view controller My app has a login page, then a main page. I want to deallocate the login page when user logs in, and since main page is heavy, I obviously want it to be deallocated when I log out and go to login page again. How to achieve this? I use presentModalViewController but I find that memory consumption doesn't decrease on logging out with this method. Will a navigation controller (with pushViewController method) do? How to dismiss/deallocate/nil presenting/previous view controller?

A: Try tab bar controller with hidden tab bar. Just make one tab - login screen, another - app main screen. When user logged in, just show app screen and then set view controllers of initial tab bar controller to only one vc - main app vc. And be sure you've set all appropriate properties to nil to allow ARC do it's job and dealloc the login screen.

A: You can achieve with this code:
MainViewController *mainController = [MainViewController new];
UIWindow *mainWindow = [[[UIApplication sharedApplication] windows] firstObject];
[mainWindow.rootViewController removeFromParentViewController];
[mainWindow setRootViewController:mainController];

A: View controller use the concept of a stack, so you have to have a root view controller to handle the switching. Have one master view controller that is basically blank, and add your two other view controllers to it as needed.


text:
Q: Store the query results with multiple rows into csv and taking table name from user I am trying to store a Greenplum query result into a csv but it is storing only one row. I want to store multiple rows. Can anyone help with this.
I tried the below already but it is storing only one row.
r= `psql -A -t -q  -h $hostname -U $username  -d $dbname <<-THE_END
COPY(select * From ${gschema}.${gtable} order by ${key} limit 3) TO STDOUT with NULL as ' '
THE_END` > /home/gp.csv

I also tried below which is storing the result but I am unable to pass table name as parameter in the below query. For standard table names the output is as desired.
psql -h $hostname -U $username  -d $dbname -c "COPY (select * from table_name order by key limit 3) TO STDOUT "> /home/gp.csv

Can anyone help me with this please.
please note that I am trying to embed the above in a shell script

A: Try this:
psql -A -t -q -h $hostname -U $username -d $dbname -c "select * from $gschema.$gtable order by $key limit 3" > /home/gp.csv

You could also put the SQL in a file:
example.sql
select * from :gschema.:gtable order by :key limit 3

And then to use the sql file:
psql -A -t -q -h $hostname -U $username -d $dbname -f example.sql -v gschema=public -v gtable=customer -v key=id > /home/gp.csv


text:
Q: jquery calling function from button created by plugin I have a very simple jquery plugin that creates a button and appends it to the element:
(function($) {
  $.fn.somePlugin = function(element, options) {

    var button = '<button>Hello World</button>';
    $(element).append(button);

    var sayHello = function(){
      alert('Hello World');
    }

  };
})(jQuery);

My question is, how do I call the sayHello function when the button is clicked? TIA!

A: You can transform your HTML code into a jQuery object using $('<button>Hello World</button>'), and then you can attack a click event to it like you would with any other jQuery object:
(function($) {
  $.fn.somePlugin = function(element, options) {

    var button = '<button>Hello World</button>';

    var sayHello = function(){
      alert('Hello World');
    }
    var $button = $(button).click(sayHello);
    $(element).append($button);

  };
})(jQuery);

A: Create a jQuery object, bind the click event with the object then append it to the container element.
(function($) {
  $.fn.somePlugin = function(element, options) {
    var sayHello = function() {
      alert('Hello World');
    }

    var button = $('<button>Hello World</button>');
    button.on('click', sayHello);
    button.appendTo(element);
  };
})(jQuery);

A: plugin code:
(function ($) {

    $.fn.somePlugin = function (el, options) {

        var $el = $(this);

        $el.append("<button>Hello World</button>");

        $el.on("click", "button", function(){
          alert("Hello World");
        });
    };

})(jQuery);

Simple html:

Usage of plugin:
$("#target").somePlugin();

jsfiddle test


text:
Q: Specifics on sentiment analysis I am working on a bot that uses sentiment analysis to analyze questions from people in the health care insurance realm.  One of the main things we do is connect people with care through a find care tool.  The basic questions people ask are in the form "I need a new doctor" or "I need to see a dermatologist".  When the sentiment is negative we want to pass the user on to customer service, but as we just discovered, any statement starting with "I need" is considered a negative statement by LUIS' built in sentiment analysis.  This is a big problem for us!
If there is a way to tweak that, please someone let me know, though I don't hold out much hope.  But I would like to understand - why was that decision made?  Why is a simple "I need" question considered negative instead of neutral?

A: Sentiment analysis cannot be changed as LUIS relies on Microsoft's Text Analytics to produce a result. In addition to Ferdinand's comment suggestion, you could do one of the following, as well.
Suggest different utterances that produce a more positive result. Using 'find a doctor' produces a positive result where as 'I need a doctor' does not.
The Azure team has a ML learning lab repo that shows how to develop your own text analytics. It would require more effort but would offer you the ability to get the kind of sentiment analysis you are looking for.


text:
Q: Define enum in class or in File? Say that in file foo.h I have:
enum bar {
    ONE = 1,
    TWO
};

class foo {
    bar m_bar;
public:
    void setBar(bar arg){ m_bar = arg; }
    bar getBar() const { return m_bar; }
};

In my current design, the only persistent bar variable will be m_bar. But I will have other functions, outside of foo that contain a bar, for example a GUI class that creates a local bar and passes it to setBar.
So here's my question, is there any rationale to defining bar publicly inside foo versus just inside the class where it is?

A:
So here's my question, is there any rationale to defining bar inside foo versus just inside the class where it is?

If all the functions that create/work with bar are related to foo functionality, then it is perfectly acceptable to write it like this:
class foo
{
    enum bar {
        ONE = 1,
        TWO
    };
};

void process_bar_of_foo(foo::bar bar_value); // process the bar of a foo

If on the other hand you can write code that has (conceptually) nothing to do with a foo instance but deals with bar values, you should probably write it separately.

A: Well, as it stands, you can create bar objects with objects and functions outside of the foo class like you mentioned and then pass it to whatever foo object you make.
If you were to, however, define it in the class, then you wouldn't really be able to make bar objects unless you create a foo class first which can lead to unnecessary overhead if you just want to enum object.
And so it really depends on what you're going to do. If you only plan on using bar with the foo class, then it would be perfectly acceptable to define it there. Otherwise if it's going to be accessed elsewhere, leave it as is.


text:
Q: How to use bundles like in old mvc I'm migrating a old MVC application to new asp.net core and I'm dealing with the new bundleconfig.json and how it works.
In the old code I used to have something like this:
 bundles.Add(new ScriptBundle("~/bundles/appcomponents").Include(
                       "~/Scripts/js/jquery.js",
                       "~/Scripts/js/bootstrap.js",
                       "~/Scripts/js/modernizr.js",
                       "~/Scripts/js/detect.js",
                       "~/Scripts/js/fastclick.js",
                       "~/Scripts/js/jquery.slimscroll.js",
                       "~/Scripts/js/jquery.blockUI.js",
                       "~/Scripts/js/waves.js",
                       "~/Scripts/js/wow.min.js",
                       "~/Scripts/js/jquery.nicescroll.js",
                       "~/Scripts/js/jquery.scrollTo.min.js"));

And in my CSHTML file I just added @Scripts.Render("~/bundles/appcomponents")
And I can had multiple bundles so depending on the view I could reference a different bundle depending on the files required for that module or view.
In Asp.Net Core I don't know how to do that.
I saw that you can add the files for CSS and JS but just once, like I don't see a way to have multiple bundles. In that case not all the modules uses the same CSS files and JS files so doesn't make sense to always pulls everything, what it makes more sense is to just use the required files for that module of view and thus from the bundleconfig.json a way to have multiple bundles just as in the old mvc projects.
[
  {
    "outputFileName": "wwwroot/css/main.min.css",
    "inputFiles": [
      "wwwroot/css/site.css",
      "wwwroot/css/abc01.css"
    ]
  },
  {
    "outputFileName": "wwwroot/js/main.min.js",
    "inputFiles": [
      "wwwroot/js/site.js",
      "wwwroot/js/abc01.js"
    ],
    "minify": {
      "enabled": true,
      "renameLocals": true
    },
    "sourceMap": false
  }
]

Also, if I'm running based on development, can I just reference my script as:
<script src="~/js/main.min.js"></script>

Because I think main.min.js is only generated when building for production. So if that's correct, how do you reference when dev? Do I have to include in my views all the scripts and css using the Environment Include tag? and then use Environment exclude tag for the main.min.js?


text:
Q: TFS Build error: C:\[path]\TFSBuild.proj (51): The local path 'C:\[path]\src' is not mapped to a TFS workspace Trying to upgrade TFS 2013 to 2015.  Having an issue with the migrated XAML builds. Created a new build server and installed the build agent but am getting the error:
Getting sources
Labeling sources
Exception Message: TF270015: 'msbuild.exe' returned an unexpected exit code. Expected '0'; actual '1'. See the build logs for more details. (type UnexpectedExitCodeException)
Exception Stack Trace:    at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe /nologo /noconsolelogger "C:\Builds\16\[path]\Deploy-G.M.FunctionalTests\BuildType\TFSBuild.proj" /m:1 /nr:False "@C:\Builds\16\[path]\Deploy-G.M.FunctionalTests\BuildType\TfsBuild.rsp"
Built $/[project]/Trunk/Tests/Builds/Deploy-G.M.FunctionalTests/TFSBuild.proj for default targets.
C:\Builds\16\[path]\Deploy-G.M.FunctionalTests\BuildType\TFSBuild.proj (51): The local path 'C:\Builds\16\[path]\Deploy-G.M.FunctionalTests\src' is not mapped to a TFS workspace.
Not sure why the the build working folder needs to be mapped to a TFS workspace.  This is a dynamic path and is specific to the build machine.
This is the part of the build project that causes the error:
<TfsChangeset LocalPath="$(SolutionRoot)" >
  <Output TaskParameter="Changeset" PropertyName="Revision"/>
</TfsChangeset>
<Message Text="TFS ChangeSet: $(Revision)" />

A: I've only had this problem when I removed the Map under Mappings.  Do you have a Map type of Mapping?


text:
Q: How can I partially specialize a class template for enums values? can templates be specialized based on enum values
#include <type_traits>

template<typename T, typename = void>
struct Specialize
{
};

template<typename T>
struct Specialize<T, typename std::enable_if<std::is_enum<T>::value>::type>
{
    void convert() { }
};

enum E
{
};

int main()
{
    Specialize<E> spec;
    spec.convert();
}

// My doubt: is below code valid? if not how to achieve this?

enum E
{
    E1,
    E2
};

int main()
{
    Specialize<E, E1> spec;
    spec.convert();
}

This is a follow-up question to the answer to the below question.
How can I partially specialize a class template for ALL enums?
I have copy pasted the code from the answer to the question linked above.
I am getting the following error with my changes.
error: type/value mismatch at argument 2 in template parameter list for _template<class T, class>

A:
// My doubt: is below code valid?
Specialize<E, E1> spec;

Short answer: No.
Long answer.
You have defined Specialized as a template struct receiving two types template parameters
template<typename T, typename = void>
struct Specialize
{
};

E is a type but E1 is a value.

if not how to achieve this?

If you want that your struct/class receive, as template parameters, a type and a value of that type, enabling the specialization of the struct/class iff (if and only if) the type is an enum, you have to add the typename = void as third template parameter
template<typename T, T Val, typename = void>
struct Specialize
{
};

template<typename T, T Val>
struct Specialize<T, Val, typename std::enable_if<std::is_enum<T>::value>::type>
{
    void convert() { }
};

Starting from C++17 you can also use auto as type for the template value and remove the first template parameter
template<auto Val, typename = void>
struct Specialize
{
};

template<auto Val>
struct Specialize<Val, std::enable_if_t<std::is_enum_v<decltype(Val)>>>
{
    void convert() { }
};

-- EDIT --
The OP asks

how would we define the function "convert" outside the struct/class?

Unfortunately I don't see a way, in this case, to avoid the std::enable_if repetition
template <typename T, T Val>
struct Specialize<T, Val,
   typename std::enable_if<std::is_enum<T>::value>::type>
 { void convert(); };

template <typename T, T Val>
void Specialize<T, Val,
   typename std::enable_if<std::is_enum<T>::value>::type>::convert ()
 { };

A: Your compiler tells you that Specialize<E, E1> spec; is invalid.
You can use std::integral_constant to wrap a value in a type.
template<typename T, T V>
struct Specialize<std::integral_constant<T, V>, typename std::enable_if<std::is_enum<T>::value>::type>
{
    void convert() { }
};

int main()
{
    Specialize<std::integral_constant<E, E1>> spec;
    spec.convert();
}


text:
Q: TCP under OpenVPN is very slow (tsg attached) I have a very weird problem with OpenVPN.
Most VPNs work fine, except this one. Here I get very low performance from TCP connections, but the CPU load is low (so, not a CPU issue).
OpenVPN is configured with UDP, AES-256-CBC cipher, SHA256 auth and no compression.
Here are some measurements I did with iperf:
Network connection without VPN:
iperf -c external.ip result:300 - 500mbps (good)
iperf -c vpn.int.ip result: 20-30mbps (not good)

The cpu usage on both ends is low. OK, maybe some ISP shapes or filters the UDP packets.
iperf -c external.ip -b 500M result: no packet loss

Hmm... what if I force UDP stream trough VPN
iperf -c vpn.int.ip -b 100M result: no packet loss
iperf -c vpn.int.ip -b 180M result: packet loss ~0.1%

So, my VPN connection should go up to 180mbps, based on the results with UDP, but it doesn't. I also get very weird graph with tcptrace.
This is how the good test goes (without VPN, using external IPs):

As you see, the sent packets stay near the yellow line, meaning the receive window is kept almost full. This portion of the graph is near the start of the connection, later, the sent packets are practically on top of the yellow line.
And this graphs is what I get from VPN:

Now here for some reason the sender acts as if the window was very small, even though it is large (it does not matter what I set the window to, tried keeping the default setting and 4MB) and sends the packets only in small bursts.
This is the first time I have seen a graph like this? What could be causing it? Some UDP filtering by the ISP, OpenVPN itself, something else?
EDIT: Running the VPN using TCP instead of UDP results in 10mbps troughput.

A: I have solved it. Or rather, I know how to make it faster, but do not know why it is slow. It seems that AES cipher interferes somehow with TCP on this particular server and results in the low performance. If I change the cipher to, say, 3des (which is slower as reported by "openssl speed"), I get 150mbps. After some trials, I now use this:
cipher camellia-128-cbc
auth sha1
tun-mtu 9000

Now I get 300mbps for a single stream and 450mbps for multiple streams.

A: maybe you are running into issues with MTU on the connection.
take a look at the following two links, they may contains some usefull info.
Configure the MTU with Fragment and MSS
Optimizing performance on gigabit networks


text:
Q: get 8 lower significant bits for each element in array I wrote following matlab code to get 8 lsb bits for each element in 1D array.
clc;
clear all;
close all;

sum=uint32(rand(1,80));
sumf=uint8(zeros(1,80));

for i=1:80
    sumf(1,i)=bitget(sum(1,i),8:-1:1,'uint32');
end

However, when I run, I get following error
Assignment has more non-singleton rhs dimensions than
non-singleton subscripts

Error in Untitled2 (line 11)
    sumf(1,i)=bitget(sum(1,i),8:-1:1,'uint32');

Any suggestions for removing this error ? What am I doing wrong

A: Your code has a number of problems:

*

*my_uint32 = uint32(rand(1,80)) does not generate random integers. It generates a 1x80 array of uint32s that are either 0 or 1 depending on whether the result of rand is returning a double above or below .5.

*You are attempting to assign a 1x8 vector to a uint8. In your case, bitget returns a vector of uint32, eg: [0,0,0,0,0,0,0,1]. You cannot assign a vector to a spot in a matrix for a single scalar.

*sum is a standard function in matlab. While you CAN use it as a variable, this is poor style and may be confusing.
`
I would use a bitwise and to extract the 8 least significant digits:
random_uint32s  = uint32(floor(rand(1, 80) * (2^32 - 1)));
lsd8 = bitand(random_uint32s, 255); %255 = 1 + 2 + 4 + 8 + 16 + 32 + 64 + 128

my_uint8 = uint8(lsd8); % if you really want it in a uint8 type for some weird reason?


text:
Q: Trouble Understanding Haskell Trees I'm having a few issues with trees, I was trying to make a simplified Family tree (genealogy tree) where I start with only 1 person, let's say Grandpa Bob, I'll try my best drawing this:
                                        BOB
                                         |
                                     /        \
                                 SIMON         RUDY
                                /    \         /  \
                            ROBBIE  MARTHA  TOM   ISABEL

So, Grandpa Bob had 2 kids with Grandma(which doesn't matter here), Simon and Rudy, then Simon and Rudy both had 2 kids each (only 1 parent matters again), note that this is not necessarily the tree I want to make but only an example which can be used by you guys to help me out. I want to have it as a data Family, then have a function that initiates the "root" which will be Grandpa Bob and then have another function that will let me add someone to the tree, as in add Simon descending from Bob.
So far this is what I have atm(I've tried other things and changed it all over):
    module Geneaology where
    data Family a = Root a [Family a] | Empty deriving (Show, Read)

    main :: IO()
    main = do
    root :: String -> Family
    root a = ((Root a) [Empty])

Now, this doesn't work at all and gives me a parse error:
t4.hs:9:10: parse error on input '='

I've tried to fix this and change the code around looking for other ways, and saw other posts as well, but didn't make any progress...
I think I made myself clear, thanks in advance xD

A: You have a syntax error, you can create a function in the main with a let and a lambda, and then use it
data Family a = Root a [Family a] | Empty deriving (Show, Read)

main :: IO()
main = do
  let root  = (\a  -> Root a [Empty])
  print(root "Bob")

But you can also define functions outside the main and call them latter:
root :: String -> Family String
root a = Root a [Empty]

main :: IO()
main = do
  print(root "Bob")


text:
Q: Trying to update the content of a JLabel I'm back again with a simpler question! I'd like the content of this JLabel (triedLettersLA) to update periodically throughout the application (I have that part handled).
But I'd like to ADD text to the label. NOT rewrite it entirely. For example.. If the text said "Letters Tried: ", I'd want to add "N", and "X", and then "H" on three separate occasions. So at the end, it'd look like this "Letters Tried: N X H". Here's what I have, and it's totally not working..
This is way up top,
JLabel triedLettersLA = new JLabel("Tried letters:");
public boolean used[] = new boolean[26];

And this is lower down in my code..
StringBuffer missedLetter = new StringBuffer();
for (int le = 0; le <= 25; le++) {
     if (used[le]) missedLetter.append((char)(le + 'a'));
     String triedLettersLA.getText(t);
     triedLettersLA.setText(t + " " + missedLetter.toString());
}

A: The code you posted makes no sense (nor could it ever compile). Well, it would compile now, possibly.
That being said, a String in Java is immutable; you can't change it. To change the text of a JLabel you need to create a new String and call the JLabel's setText() method.
String old = triedLettersLA.getText();
String newString = old + " N"; // this creates a new String object
triedLettersLA.setText(newString);

A: Nonsence code:
String triedLettersLA.getText(t);
Change it to:
String t = triedLettersLA.getText();


text:
Q: theorem that says all homogeneous equations are consistent Is there a theorem that states all homogeneous equations are consistent? I know its true, I just need to quote something so I don't need to do a "official" proof for it.
Also, how can I prove that an equation is homogeneous?
    Ax+By=0
is homogeneous, can I just say it is homogeneous or do I need to prove it? If I do, how would I do it?

A: You can just say that all homogeneous system of equations are consistent since they have the trivial solution $\vec{0}$.
For the second question, it is homogeneous by definition, which says that a homogeneous linear equation has constant term $0$.


text:
Q: SAS: Expressions in IF statement does Sas provide mechanism of chain-expressions?
does Sas provide mechanism of In-clause?
Simple examples:
  a = '09MAY2010'd;
  b = '17MAY2010'd;

if (a<=c<=b) then do; /*code*/ end;
if (c in (a:b)) then do; /*code*/ end;

maybe any good techniques of if/where statements?
your suggestions and advises, please.
Thanks!

A: Your example, changed a bit:
data _null_;
    a = '09MAY2010'd;
    b = '17MAY2010'd;
    c = '17MAY2010'd;

    if (a<=c<=b) then do;
        putlog "a<=c<=b";
    end;

    select (c);
        when (a, b) putlog "in a, b";
        when ('17MAY2010'd) putlog "'17MAY2010'd";/* not used, only first match is executed */
        otherwise;
    end;

run;

IN operator used with IF or in WHERE clause requires constants in the list.

A: Apart from the IN operator, which only accepts constant values inside the paranthesis, there is also an (undocumented) IN function, which can be used with variables, so instead of if c in(a,b) you can use if in(c,a,b) which will work also when a and b are variables.
Another possibility is to use WHICHN or WHICHC functions, which has the same syntax, and which return 0 (FALSE) when a match is not found, and otherwise the number of the (first) match.


text:
Q: How to fix writing a list content in a file I have a function which contains a list. I want just to write that list content in a file from main after user input.
putTodo :: (Int, String) -> IO ()
putTodo (n, todo) = putStrLn (show n ++ ": " ++ todo)

prompt :: [String] -> IO ()
prompt todos = do
    putStrLn "The list contains:"
    mapM_ putTodo (zip [0..] todos)
    putStrLn " "
    command <- getLine
    getCommand command todos

What I tried:
main = do
          outh <- openFile "agenda.txt" WriteMode;
          hPutStrLn outh prompt[]

          -- hPutStrLn outh (show prompt[])
          -- hPrint (show prompt[])
          hClose outh;

Thank you.

A: Your code contains a couple of errors / problems:

*

*prompt[] isn't valid (in main) - this should be prompt

*hPutStrLn expects a String as its second argument, but you provide IO()

*getCommand is not defined

What you need is:

*

*a list of todos (possibly returned by a function)

*a function that converts this list of todos to a string

*hPutStrLn to print this string to the output file

Here's a simple version with a hard-coded list of todos (my Haskell isn't very advanced, so this could probably be done in a much more elegant way):
import System.IO

type Todo = (Int, String)

todoToString :: Todo -> String
todoToString (idx, name) = (show idx) ++ " : " ++ name

todosToString :: [Todo] -> String
todosToString todos = foldl (\acc t -> acc ++ "\n" ++ (todoToString t)) "" todos

allTodos :: [Todo]
allTodos = [(1, "Buy milk"), (2, "Program Haskell")]

main = do
  outh <- openFile "agenda.txt" WriteMode;
  hPutStrLn outh (todosToString allTodos);
  hClose outh;


text:
Q: Naming your Output feature class? I am working in a work space in python on ArcGIS 10.1 on a remote desktop. Here is my code
import arcpy
from arcpy import env
env.workspace = "E:\Example"

PST = arcpy.ListFeatureClasses ("", "Point")
LST = arcpy.ListFeatureClasses ("", "Polyline")

for point in PST:
    for polyline in LST:
        arcpy.SplitLineAtPoint_management (polyline, point, point + "500" + ".shp", 1)

I want the output feature class to have the same file name as the point feature class, but with 500 appended to the end. Currently the way the code is now, it will name the output "Example.shp500.shp" which is giving me an error of failing to execute. How can I name my output "Example500.shp"?

A: A more Pythonic way which does not require guessing the file extension's length would be to use the built-in os.path module.  You can use the basename method to get just the filename portion of the path, then return the first entity (filename) returned by the splitext (read carefully, that is split-ext, not split-text) method.
Additionally, you should not have to include the ".shp" component of your output filename.  The shapefile is the default output and ArcGIS will automatically append the extension when writing to a folder.
import arcpy, os
from arcpy import env
env.workspace = r"E:\Example"

PST = arcpy.ListFeatureClasses ("", "Point")
LST = arcpy.ListFeatureClasses ("", "Polyline")

for point in PST:
    for polyline in LST:
        fname = os.path.splitext(os.path.basename(point))[0] + "500"
        arcpy.SplitLineAtPoint_management (polyline, point, fname, 1)

A: PST = arcpy.ListFeatureClasses ("", "Point")
LST = arcpy.ListFeatureClasses ("", "Polyline")

for point in PST:
    for polyline in LST:
        arcpy.SplitLineAtPoint_management (polyline, point, point[:-4] + "500" + ".shp", 1)

[:-4] means all but the last four characters.
but you will have a problem with your name if you keep your code like this, because there will be one point[:-4] + "500" + ".shp" for each line. you should use something like :
polyline[:-4] + "_" + point[:-4] + "500" + ".shp"


text:
Q: How recover account and emails from Windows Live Mail? First I change the path of the C:\Users\Valter\Documents to D:\Document\Windows (in Windows 7 Professional) and when I enter in the my Windows Live Mail, my account and emails gone.
How do I recover that ?
Any idea ? I really need help with this guys.
Thank you for your attention with this.

A: The mail is stored in you user folder (eg: 'C:\Users\\AppData\Local\Microsoft\Windows Live Mail').  You moved them, so you'll need to update Live Mail with the new path.

*

*In Windows Live Mail, press ALT to bring up the menu and select Tools, then Options.

*Click the Advanced tab, then the Maintenance button.

*Click the Store Folder button, Change it to the new path.


text:
Q: In C# 4, how can I have constructors with optional parameters in a subclass of a parent with an overloaded constructor? I have a parent class that has an overloaded constructor, and I have a subclass that has a constructor with optional parameters. Is there a way to have the subclass's constructors still expose the overloaded-ness of the parent class while preserving it's own optional parameters?
Here's some example code of the two classes and their required constructors:
class Foo {
    Foo(String arg0)
    {
      // do some stuff with arg0
    }

    Foo(String arg0, List<x> arg1)
        : this(arg0)
    {
      // do some other stuff with arg1 that is special because we have an arg1
    }
}

class Bar : Foo {
    Bar(String arg0, List<y> arg2 = null, String arg3 = "")
        : base(arg0)
    {
      // some third thing with arg2 and arg3
    }
}

This is the method signature for the other subclass constructor I would like to also have to expose the overload of the parent constructor, but the question is how to do it:
Bar(String arg0, List<x> arg1, List<y> arg2 = null, String arg3 = "")

I have, I think, found a solution, but I am not sure it is as clean as it could be. I have posted it as an answer just in case it is the only option.

A: If you can change Foo to only have one constructor with an optional parameter you can do the following:
public class Foo
{
    public Foo(String arg0, List<x> arg1 = null)
    {
        // do some stuff with arg0
        if (arg1 != null)
        {
            // do some other stuff with arg1
        }
    }
}

public class Bar : Foo
{
    public Bar(String arg0, List<x> arg1 = null, List<y> arg2 = null, String arg3 = "")
        : base(arg0, arg1)
    {
        // some third thing with arg2 and arg3
    }
}

A: Here is the solution I have come up with:
class Foo {
    Foo(String arg0)
    {
      // do some stuff with arg0
    }

    Foo(String arg0, List<x> arg1)
        : this(arg0)
    {
      // do some other stuff with arg1
    }
}

class Bar : Foo {
    Bar(String arg0, List<y> arg2 = null, String arg3 = "")
        : base(arg0)
    {
        this.Initialize( arg2, arg3);
    }

    Bar(String arg0, List<x> arg1, List<y> arg2 = null, String arg3 = "")
        : base(arg0, arg1)
    {
      this.Initialize( arg2, arg3);
    }

    private void Initialize(List<y> arg2, String arg3)
    {
      // some third thing with arg2 and arg3
    }
}

It seems a bit unclean because I am not chaining the subclass's constructors together and am calling a function instead, but I can't figure out any other way to do this.


text:
Q: passing function into another function in jquery? I am passing json obj in the function parameter. Json contains User id, password, success call and error call.
I want to authentic the user via ajax service. if the service returns success the access the successcallback function or returns error then access the errorcallback function.
 JSON Obj : Json_Obj =  { "UserId" : "uid",
                           "Password" : "pwd",
                           "Success_CB" : "successcallback()",
                           "Failure_CB" : "errorcallback()",
                          };

I am able to parse the Json_Obj
  Authentication = function(data) {
    var json_data = $.parseJSON(data);
    $.ajax({
           type: "GET",
            .
            .
           success:function(data){
             json_data.Success_CB;   // Unable to Execute the success call back function.
            },
             error:function(xhr,err){
                    json_data.Failure_CB
             }
   });
 }

   // Call Back Functions

      successcallback(){
           alert("Success");
      }
      errorcallback(){
           alert("Error");
      }

I am unable to access/execute the callback functions.
Please help me out on this..

A: json_data.Success_CB is a string, not a function.
You may do this :
success:function(data){
    eval(json_data.Success_CB+'();');
}

But instead of evaluating any received code, you might prefer to use a switch.
Of course if the function to call isn't related to the precise data, you may simply do
success: successcallback

A: You mean just like this?
  Authentication = function(data) {
    var json_data = $.parseJSON(data);
    $.ajax({
           type: "GET",
           success:function(data){
                successcallback();
           },
           error:function(xhr,err){
                errorcallback();
           }
   });
 }

   // Call Back Functions

      successcallback(){
           alert("Success");
      }
      errorcallback(){
           alert("Error");
      }


text:
Q: getting N number in a number I have an array and I am getting its length using sizeof(). In the size of the array I want to get how many 10 there are in that number. I used % in getting my number like:
$arraysize = 13;//sizeof($array)
$numberoften = $arraysize % 10 // getting 3

From here I know that I am wrong. What i want to get is 2. Because I want to get every 10. Like if length is 9 I want to get 1. If length is 31 I want to get 4.
What is the correct function of way to get my desired output?

A: What you're after is ceil()

Returns the next highest integer value by rounding up value if necessary.

$numberoften = ceil($arraysize / 10);

There's also floor() if you want to round the number down to the nearest integer. This would seem to fit better with your question...

I want to get how many 10 there are in that number

A: Use ceil() function
 $arraysize = 13;//sizeof($array);
$numberoften =ceil( $arraysize/10);

Or
Use round() function
$arraysize = 13;//sizeof($array);
$numberoften =round( $arraysize/10);


text:
Q: Is it possible to pair Microsoft wireless keyboard/mouse with Bluetooth? I have purchased Wireless Desktop 2000 from Microsoft, a 2.4G wireless mouse and keyboard with a USB transceiver.
After a while I lost the USB transceiver, so I'm trying to connect them with laptop's built-in Bluetooth, (I know it won't work with non-Microsoft transceiver), and when I try to pair them with Bluetooth I can't find the product in search's results but I'm wondering maybe somebody has a tricky way or got a solution to pair hidden devices!

A: 'Wireless' and 'Bluetooth' are two different technologies for doing the same thing. It'd be like trying to fill an electric car with petrol - sure, both petrol and electric cars exist, and both can drive on the same roads, but the underlying technology for them to perform this function is radically different.
Unless your Keyboard/Mouse explicitly say something like 'Bluetooth compatible' then they won't connect via a Bluetooth connection.


text:
Q: How to deregister a CRON job in AppEngine? I registered a cron job in the google appengine. It runs fine. Since I deleted the whole content of the app, I want this job to not run anymore. I don't know how to do it.

A: In Python, to delete all cron jobs, change the cron.yaml file to just contain:

cron:

In Java, to delete all cron jobs, change the cron.xml file to just contain:

<?xml version="1.0" encoding="UTF-8"?>
<cronentries/>


text:
Q: How can I make a date time picker always contain the last day of the month while showing month and year only? I have a DateTimePicker which I have set to only show the month and year as follows:
myDateTimePicker.Format = DateTimePickerFormat.Custom;
myDateTimePicker.CustomFormat = "MMMM yyyy";
myDateTimePicker.ShowUpDown = true;

However, I want the value of the date to always be the last day of the selected month, so I set the DateTime in the ValueChanged event using:
DateTime selectedDate = myDateTimePicker.Value;
DateTime lastDayOfMonth = new DateTime(
    selectedDate.Year,
    selectedDate.Month,
    DateTime.DaysInMonth(selectedDate.Year, selectedDate.Month));
myDateTimePicker.Value = lastDayOfMonth;

The problem is, if I have a month like March selected, and I change the month to February using the up/down controls, I get the following error before I can handle the ValueChanged event:
ArgumentOutOfRangeException was unhandled
Year, Month, and Day parameters describe an un-representable DateTime.

This is understandable because the date was 31 March and it is being changed to 31 February which is an invalid date. However, I want to change it to 28 February (or 29 February).
How can I achieve this?

A: Very strange, I tried to reproduce your problem, and when I switch from March to February, my control just doesn't display anything...
Maybe we have different framework versions, who handle the same error differently.
Anyway, one solution would be to set the datetime picker to the first of each month, and when you need the value, you can just use your code as it currently is:
DateTime lastDayOfMonth = new DateTime(
    selectedDate.Year,
    selectedDate.Month,
    DateTime.DaysInMonth(selectedDate.Year, selectedDate.Month));

Since you never use the day value of your dattime picker, you can just set it to 1, which will always give an existing date.
This solution leaves me with a bad feeling somehow, since you are using a date that differs from the date you get from your control -  always a possible source of errors, IMO. Remember to put comments into your code, explaining why you are doing it this way ;-)

A: I'd probably use the 1st of the month like Treb Selected, but extend DateTimePicker so that when you did this:
MyDateTimePicker.Value
it would do something like this:
get{
return value.addMonths(1).addDays(-1)
}


text:
Q: How to share Guest VM's VPN Connection with Host I've found it impossible to find an answer to this amidst the legion of How Tos explaining how to share your wireless connection or how to share a Host's VPN with a Guest.
I have a Guest Windows 10 VM (using VirtualBox) which I set up with a Bridged Connection via the Host (also Windows 10). I used Bridged because I need the host to be able to access the Guest and the Guest to also be able to access the outside world. I have installed VPN software on the Guest which works and enables me to access my company's network from that Guest. Installing the VPN software on the Host is not an option. I am attempting to share the Guest VM's network connection with the Host. Ultimately I want other VMs on the same Host to be able to connect via the Guest's VPN connection. But so far, I'm just trying to get the Host to use it on the basis that the rest should be straight-forward after that.
On the Guest, I see Ethernet 1 which is the network adaptor I configured for it in VirtualBox. I also see Ethernet 2 which is the adaptor the VPN software created when it ran. I tried sharing Ethernet 1 and 2 but that seems to end the VPN connection. I created a second Ethernet adaptor for the Guest in VirualBox. I've tried both Sharing that connection and creating a Bridge between it and Ethernet 1 and 2 (I tried both). None of this seems to have worked and I'm not sure how to progress. Ethernet 3 is currently a Host Only network adaptor as I think that should be all I need.
How can I use the Guest's VPN from the Host and other VMs?

A: On VM

*

*Enable network sharing on Ethernet 1

*Add Host Only Network (Ethernet 3)

*Assign it (Ethernet 3) a static IP

On Host

*

*add route to your company network via Ethernet 3 static IP

A: @Kostas Filios answer worked for me. The only thing that I didn't saw there were mentions to the firewall in the Windows guest. You should either add the firewall exceptions or disable it completely. I did the latter for the sake of brevity but I am willing to expand on it if someone deems it necessary.

A: I went through k010mb0's steps with a lot of trial and error, and finally I got my windows-only VPN to work on a virtualbox guest Windows 10 and also access it from my Linux (Ubuntu) host machine.
I will only try to elaborate a little bit further. I assume you have already installed virtualbox on your Linux host, you have created a guest virtual machine and you have installed Windows 10 on it.
1. Setup a NAT network adapter for your virtualbox guest Windows
This is required so that your Windows guest virtual machine has access to the internet. In order to do that, you open virtualbox with your guest virtual machine in stoped state, you click on your Windows virtual machine, click the settings button and then navigate to "Network" from the list on your left. Then you'll need to configure something like this:

The reason you see the options grayed out here is because I'm currently running my virtualbox, but, as mentioned earlier, you should do this with your VM stopped.
2. Setup a host-only network on your host machine
This step is host-specific, not guest-specific. This is why you create this network from the global settings menu of virtualbox and not a guest's settings (guest will be configured later).
Go to your virtualbox manager window, click File -> Host Network Manager... Ctrl+H. You'll probably get a screen with an empty list of networks and some buttons among which there's a Create button. Click it and you'll get your first network:

Note that apart from the IP settings, which you can leave as is, there's also a tab for configuring DHCP on this new network. This DHCP is for assigning IPs of the new network's subnet on the guest virtual machines. You can leave the default settings there as we're going to set network settings manually on the guest OS anyway.
3. Enable the host-only network on your guest virtual machine
Now that we have a new network interface on our host machine (Linux), we can go back to the guest virtual machine, again in stopped state, and add a new network adapter, this time pointing to our newly created host-only network.
From the virtualbox manager, select your guest machine, click Settings again, go to Network and switch to Adapter 2 (or 3 or anything other than the first adapter which we configured earlier):

4. Start your guest virtual machine
Now we can start up our Windows 10 guest virtual machine and verify that there are two network adapters configured, by going to the Network & Internet settings:

In my case, the NAT network (adapter 1) appears as Ethernet (first network on the screenshot) and the host-only network (adapter 3) appears as Ethernet 4. Don't mind the numbering, just make sure you remember which Windows network corresponds to which network adapter we've setup from our virtualbox console.
5. Connect to your company's VPN from Windows
This step is completely custom to your needs. Just download any clients, certificates, credentials, etc. provided by your IT administrator and connect your Windows machine to your VPN.
After successfully connecting to your VPN, you will get a new network connection on your Windows settings panel. Go to Network & Internet Settings, then click Network and Sharing Center. You'll see something like this:

In my case, I had two adapters, Ethernet and Ethernet 4. Now that I connected to my VPN, I also got Ethernet 3. You can always click on the network, then Details and see from the IP configuration which connection is which.
6. Share your VPN connection with the host-only network
Still on our Windows guest virtual machine, we now need to share our VPN connection (Ethernet 3 in my case) with the host-only adapter (Ethernet 4 in my case). For that, click on Ethernet 3 connection from Network and Sharing Center (see previous step), go to Properties and then hit the Sharing tab:

Click on Allow other network users to connect... and then select your host-only connection. In my case, that's Ethernet 4. As soon as you do it, you'll get the following warning:

This effectively says that our Ethernet 4 IP settings will be messed up, but that's ok, we'll fix this right afterwards. Click Yes here.
7. Fix host-only IP settings
As mentioned in the previous step, Windows sets an arbitrary IP address to our host only interface: 192.168.137.1. However, on our host's side (Linux), we have configured a 192.168.56.xxx network. If we leave these settings, Linux and Windows won't be able to communicate.
Let's go Ethernet 4 from the Internet & Network Center, click Properties, then Internet Protocol Version 4 (TCP/IPv4), then Properties:

You see this 192.168.137.1 IP there? Change it to 192.168.56.2.
8. Try to ping your Windows guest from your Linux host
Let's go back to our Linux host machine and see if networking is properly setup between the two machines. Open up a terminal and type ping 192.168.56.2. We should get something like this back:
$ ping 192.168.56.2
PING 192.168.56.2 (192.168.56.2) 56(84) bytes of data.
64 bytes from 192.168.56.2: icmp_seq=1 ttl=128 time=0.282 ms
64 bytes from 192.168.56.2: icmp_seq=2 ttl=128 time=0.181 ms
64 bytes from 192.168.56.2: icmp_seq=3 ttl=128 time=0.506 ms
64 bytes from 192.168.56.2: icmp_seq=4 ttl=128 time=0.262 ms
^C
--- 192.168.56.2 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3067ms
rtt min/avg/max/mdev = 0.181/0.307/0.506/0.120 ms

If you don't get a ping response, you need to repeat some of the previous steps.
9. Try to ping a VPN machine from your Linux box
Now pick an IP that is only accessible from your VPN and let's try to ping it. Usually the IP of your VPN's nameserver will respond to ping.
First try to ping this IP from your Windows box. Let's say the protected IP is 10.0.0.1:
C:\Users\XXX>ping 10.0.0.1

Pinging 10.0.0.1 with 32 bytes of data:
Reply from 10.0.0.1: bytes=32 time=76ms TTL=57
Reply from 10.0.0.1: bytes=32 time=76ms TTL=57

Ping statistics for 10.0.0.1:
    Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 76ms, Maximum = 76ms, Average = 76ms
Control-C
^C

Now that we have verified our VPN connection is up and running on Windows, and that 10.0.0.1 is pingable, let's go back to Linux.
The first thing you'll need to do is add a route so that 10.0.0.1 goes through our host-only network, and not your standard ethernet/wifi adapter:
ip route add 10.0.0.1/32 via 192.168.56.2

There are a few things to note here:

*

*We've used the Windows IP 192.168.56.2 in via. Not the Linux IP 192.168.56.1

*In this particular example has a netmask of 32. Other routes you might add later won't necessarily have the same netmask.

Now that you have added the route, you can try to ping your VPN protected machine from Linux:
ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=56 time=78.2 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=56 time=79.3 ms
64 bytes from 10.0.0.1: icmp_seq=3 ttl=56 time=77.1 ms
64 bytes from 10.0.0.1: icmp_seq=4 ttl=56 time=77.0 ms
^C
--- 10.0.0.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 76.985/77.896/79.320/0.937 ms

If you see a ping response similar to the above, you can prepare for celebrations. But first make sure you've configured some final stuff first.
10. Setup your VPN's DNS servers on your Linux host
The fact that you have connectivity to your VPN is great news, but that doesn't make everything functional. You'll soon try to open a VPN site on your Linux browser and realize the host name cannot be resolved to an IP. For example if you try to hit someservice.internal.mycompany.com, you'll get a DNS resolution error.
In order to fix that, you'll need to go your VPN connection in the Windows box, open up the Details tab and copy the DNS servers you see there. Then you'll have to go to your Linux box and add those two servers. One way to do it is by adding a nameserver entry for each dns server in your /etc/resolv.conf, but other ways are available.
11. Setup your VPN's routes on your Linux host
Having DNS servers in place allows you to resolve internal VPN domain names to IPs. The last thing left is to tell your Linux box that in order to reach those IPs, it will need to go through the 192.168.56.2 gateway, as we did earlier for our test.
You can print a list of all your VPN's routes on Windows by typing route PRINT.
Then you can use that information to add the same routes (or any subset you need) to your Linux box.
12. Windows configuration might occasionally need a restart
For some reason I never figured out, if I restart the Windows guest machine and just try to reconnect to VPN, Linux won't have access to it. I realized that the connection sharing settings of Windows become defunct. The workaround I've used was to:

*

*Connect to VPN from Windows

*Unshare the VPN connection

*Re-share the connection

Please feel free to suggest ways to persist sharing configuration on windows machines.

A: Is there any similar guide for ubuntu as guest VM and Windows 10 as host? I have setup host-only adapter however unable to share the vpn network from Ubuntu VM as it is not visible under network window.


text:
Q: C# - How to: Open PDF, highlight search-results, and save highlighting back to PDF I'm using itextsharp.dll.
How do I search and highlight text in the pdf file?
After highlighting the text in pdf, I want to save the highlighted pdf file such that when the PDF is re-opened, it is still highlighted.
Any ideas?

A: Have you consider another library such as Apache PDFBox? It is support following features:
PDF to text extraction
Merge PDF Documents
PDF Document
Encryption/Decryption
Lucene Search Engine Integration
Fill in form data FDF and XFDF
Create a PDF from a text file
Create images from PDF pages  Print a PDF


text:
Q: How to implement both brightness and contrast filter together in OpenGL Android? I have 2 codes, one for brightness and one for contrast as follows.
brightness
"precision mediump float;" +
            " varying vec2 vTextureCoord;\n" +
            " \n" +
            " uniform lowp sampler2D sTexture;\n" +
            " uniform lowp float brightness;\n" +
            " \n" +
            " void main()\n" +
            " {\n" +
            "     lowp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" +
            "     \n" +
            "     gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\n" +
            " }";

 @Override
    public void onDraw() {
        GLES20.glUniform1f(getHandle("brightness"), this.brightness);
    }

contrast
"precision mediump float;" +
            " varying vec2 vTextureCoord;\n" +
            " \n" +
            " uniform lowp sampler2D sTexture;\n" +
            " uniform lowp float contrast;\n" +
            " \n" +
            " void main()\n" +
            " {\n" +
            "     lowp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" +
            "     \n" +
            "     gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)), textureColor.w);\n" +
            " }";

   @Override
    public void onDraw() {
        GLES20.glUniform1f(getHandle("contrast"), this.contrast);
    }

Complete for one filter
public class GlBrightnessFilter extends GlFilter {
    private static final String BRIGHTNESS_FRAGMENT_SHADER = "" +
            "precision mediump float;" +
            " varying vec2 vTextureCoord;\n" +
            " \n" +
            " uniform lowp sampler2D sTexture;\n" +
            " uniform lowp float brightness;\n" +
            " \n" +
            " void main()\n" +
            " {\n" +
            "     lowp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" +
            "     \n" +
            "     gl_FragColor = vec4((textureColor.rgb + vec3(brightness)), textureColor.w);\n" +
            " }";

    public GlBrightnessFilter() {
        super(DEFAULT_VERTEX_SHADER, BRIGHTNESS_FRAGMENT_SHADER);
    }

    private float brightness = 0f;

    public void setBrightness(float brightness) {
        this.brightness = brightness;
    }
    public void setContrast(float contrast) {
        this.contrast = contrast;
    }
    @Override
    public void onDraw() {
        GLES20.glUniform1f(getHandle("brightness"), brightness);
    }
}

How I can merge them to change both without clearing other filter. I want both to be changed without changing other filter value.
Basically I want single filter to be used to change both values.

A: "precision mediump float;" +
            " varying vec2 vTextureCoord;\n" +
            " \n" +
            " uniform lowp sampler2D sTexture;\n" +
            " uniform lowp float brightness;\n" +
            " uniform lowp float contrast;\n" +
            " \n" +
            " void main()\n" +
            " {\n" +
            "     lowp vec4 textureColor = texture2D(sTexture, vTextureCoord);\n" +
            "     \n" +
            "     gl_FragColor = vec4(((textureColor.rgb - vec3(0.5)) * contrast + vec3(0.5)) + vec3(brightness), textureColor.w);\n" +
            " }";


text:
Q: C++ macro - capitalize string I'm using preprocessor macros to declare some repetitive variables, specifically:
QuitCallbackType quitCallback;
LossCallbackType lossCallback;
PauseCallbackType pauseCallback;
KeyCallbackType keyCallback;
MouseCallbackType mouseCallback;
I'd like to use a preprocessor macro to do it, a la

CREATE_CALLBACK_STORAGE(quit)
CREATE_CALLBACK_STORAGE(loss)
CREATE_CALLBACK_STORAGE(pause)
CREATE_CALLBACK_STORAGE(key)
CREATE_CALLBACK_STORAGE(mouse)

where it would essentially be like this:
#define CREATE_CALLBACK_STORAGE(x) capitalize(x)##CallbackType x##CallBack;
Is there a way to do this, so that I don't have to pass in both the capitalized AND lowercase versions of each name?
I realize it's not much less typing to use macros, but the problem itself began intriguing me.

A: The macro preprocessor doesn't have the ability to take substrings or capitalize a letter. Sorry.
If you could change your naming scheme you might have more success. For example:

QuitCallbackType _QuitCallback;

Edit: I've been warned not to use leading underscores, but the idea still applies:
QuitCallbackType callbackQuit;

A: I think you should ditch the idea of macros altogether. A better solution would be to create a simple data structure, such as:
struct CallBacks {
  QuitCallbackType quit;
  LossCallbackType loss;
  PauseCallbackType pause;
  KeyCallbackType key;
  MouseCallbackType mouse;
};

And use this instead:
CallBacks callback;

You can only use the members you want:
callback.quit = GetCallback(...);
someFunc(callback.quit);
// ect..

It also makes the variable names (in my opinion) a little clearer.


text:
Q: jQuery: Accordian Toggle - Close Div When Sibling Is Open I've got an accoridan toggle that currently works fine, except I want it so only one item is expanded at a time. When you open one item and go to open another I'd like the original one to close.
Any idea on what I should add to my code to get this to work?
Here's the code:
$(document).ready(function() {

$('.internal').hide();

$('.slider').click(function() {

    $(this).next('.internal').slideToggle();
}).toggle(function() {
    $(this).children("span").html("minus sign");
}, function() {
    $(this).children("span").html("plus sign");
});

});

I set up a fiddle here: http://jsfiddle.net/Lg9Mn/17/
Thanks!

A: Simply hide all the elements with class internal (using slideUp) before you show the correct one:
$(document).ready(function() {

    $('.internal').hide();

    $('.slider').click(function() {
        $('.internal').slideUp();
        $('.slider').not($(this)).children("span").html("plus sign");
        if($(this).next('.internal').css("display") == "none"){
            $(this).next('.internal').slideDown();
            $(this).children("span").html("minus sign");
        }else{
            $(this).next('.internal').slideUp();
            $(this).children("span").html("plus sign");
        }
    })
});

http://jsfiddle.net/Lg9Mn/30/

A: Try this code
$(document).ready(function() {

    $('.internal').hide();

    $('.slider').click(function() {
        $('.internal').not($(this).next('.internal')).hide();
        $('.slider').not($(this)).children("span").html("plus sign");

        if( $(this).next('.internal').is(':visible')){
            $(this).children("span").html("plus sign");
        }
        else{
            $(this).children("span").html("minus sign");
        }
        $(this).next('.internal').slideToggle();
    });
});

Need to add this to your click event
$('.internal').not($(this).next('.internal')).hide();

Check Fiddle


text:
Q: Anglar: values not updating after assign to select I have a <select>  backed by a formcontrol and filled with an array of objects. After a select it will fill a
 with the fields of the object.
All fine and dandy.
relevant html:
<form>

    <select
      [formControl]="selectedLocation"
      (change)="changeSelectedLocation($event)"
    >
      <option [ngValue]="null" disabled>Select Location</option>
      <option *ngFor="let location of locations" [ngValue]="location">
        {{ location.name }}
      </option>
    </select>

  Location Details

        {{ selectedLocation.value.name }}

        Street
        {{ selectedLocation.value.streetName }}

        Number
        {{ selectedLocation.value.houseNumber }}

        Zip
        {{ selectedLocation.value.zipcode }}

        City
        {{ selectedLocation.value.city }}

</form>

typescript:
export class LocationSelectorComponent implements OnInit {
  console = console;
  locations: MyLocation[] | undefined;
  currentLocation!: MyLocation;
  selectedLocation = new FormControl();

  constructor(private locationService: MyLocationService) {}

  ngOnInit() {
    this.locations = this.locationService.getLocations();
    this.getCurrentLocationFromStore();
    console.log('current location loaded is: ' + this.currentLocation.name);
    this.selectedLocation.setValue(this.currentLocation);
  }

  changeSelectedLocation(e: any) {
    this.currentLocation = e.target.value;
    localStorage.setItem(
      'currentLocation',
      JSON.stringify(this.currentLocation)
    );
    console.log('event is: ' + this.selectedLocation.value.name);
  }

  getCurrentLocationFromStore() {
    const retrievedObject = localStorage.getItem('currentLocation');
    if (retrievedObject != null)
      this.currentLocation = JSON.parse(retrievedObject);
  }
}

Now I want the save the last selected object in local storage and read it back later when I revisit the page. Storing and retrieving work fine. But after setting the <select> to the retrieved object the dropdown is updated, but the table is not.
Could not find a minimal example just doing this and I'm probably making some rookie mistakes. Can someone point me in the right direction?
stackbliz:
project:
https://stackblitz.com/edit/angular-ivy-hzpdlf?file=src/app/component/location-selector/location-selector.component.ts
application:
https://angular-ivy-hzpdlf.stackblitz.io
---- Edit ----
Not sure what the lifetime of a stackbliz is so here the pertinant changes from the accepted answer;
in the html file only the selector definition is changed:
 <select [formControl]="selectedLocation">

in the typescript file the ngOnInit :
ngOnInit() {
    this.locations = this.locationService.getLocations();

    this.getCurrentLocationFromStore();
    this.selectedLocation.valueChanges
      .pipe
      //takeUntil() left out
      ()
      .subscribe((selectedLocation) => {
        this.changeSelectedLocation(selectedLocation);
      });
  }

A: Here is a working example
https://stackblitz.com/edit/angular-ivy-mp8nou?file=src/app/component/location-selector/location-selector.component.ts
The problem was a redundant roundtrip with currentLocation and not being in sync anymore. I removed it and just worked with the control.


text:
Q: Where can I get the Active Template Library? I've never worked with COM before, and I've been tasked with writing an application that uses some third party COM objects.  If anyone could point me to some good tutorials on how to use them it would be much appreciated.  More immediately, it appears that I don't have the Active Template Library installed.  I've searched online but can't figure out how to get it.

A: It's part of Microsoft Visual Studio (but not the Express Edition.)

A: As Dan pointed out, these are distributed with Visual Studio.
If you don't have Visual Studio, you can get the ATL libraries from one of the Microsoft Visual C++ Redistributable packages:

*

*2005 SP1 (32-bit)

*2005 SP1 (64-bit)

*2005 (Itanium)

*2008 SP1 (32-bit)

*2008 SP1 (64-bit)

*2008 SP1 (Itanium)
Note: The ones marked 2005 are version 8 (atl80.dll), the ones marked 2008 are version 9 (atl90.dll).

A: I think you have to own a copy of Visual Studio 2005 or 2008 (not Express) to get ATL. If you have one of those installed, but you don't have ATL then go to "Control Panel:Add/Remove Programs" and do a "Modify" install (with the program CD or DVD in the drive) and make sure the box for ATL is checked.

A: As for tutorials:
I haven't found a really good one online. There are a few OK pages on using ATL/COM:

*

*The Active Template Library Makes
Building Compact COM Objects a
Joy by Don Box (veteran guru of
COM). This article starts: "I love
COM. COM is good. Like a fine pilsner
or ale, COM never disappoints. In
fact, the more I look at COM, the
more I like it. Unfortunately, I work
in C++, and C++ does not share my
appreciation for the finer things in
life." Despite the Grand Master's
proselytizing, and the fact that it's
12 years old now, it's a pretty good
article...

*Mike Dunn's excellent tutorial on
COM on CodeProject.

*DevGuy's C++ COM Tips -- kind of a hodgepodge of links and suggestions.

*The COM Programmer's Cookbook -- this ancient (1995) article isn't bad, despite its age and the fact that it describes implementing COM objects in C rather than C++ (explicit vtables!)

I'm a little rusty myself w/ COM and ATL, but if I remember right, the classes you're going to want to learn that you'll use the most (especially if you are using someone else's COM objects rather than implementing your own) are CComBSTR, CComPtr, and CComVariant. Also the #import statement in Visual C++ makes using external COM objects much easier, it generates a smart pointer class for you from an external DLL or EXE.
If you're going to be implementing COM objects, I would strongly recommend getting a copy of ATL Internals (there's a newer edition out now covering ATL v8). Yes it does go into some gory detail in sections, but even as an intro book it's fairly well written.
If you've never used COM before, the "classic" books Essential COM and Effective COM are very good and you can probably get them inexpensively from your favorite sources of used books. You're also going to want to be very familiar with the RAII idiom, if you aren't already.
The newsgroup microsoft.public.vc.atl is very good for asking particular questions. (they tend to be more gruff there than on StackOverflow, though)
Beware: There are lots of little gotchas with COM, although ATL does help it become a lot easier & without a lot of bloat. The "simulated dynamic binding" techniques aka CRTP are useful in the C++ world, not just in the context of ATL/COM but especially if you are developing a library of reusable classes that you want to subclass or mixin in situations where only one instance is present at a time (e.g. a class CSpiffyFramework that provides mixin functionality that you want to reuse a lot, and you have a derived class that you want to include that functionality, and it's not part of a virtual object model so you don't really need a vtable).
Good luck!

A: I installed this: http://www.microsoft.com/en-us/download/details.aspx?id=3138 and got the C++ compiler and all stuff on my buildserver, but no ATLMFC libraries.
The redist packages linked above is just that, redistributables, not the headers and includefiles needed..
After lots of searching, I ended up installing vs2008 on the server, crap.

A: here is how to use atl with vs express:
you need WDK 7.1.0:
https://www.microsoft.com/en-us/download/details.aspx?id=11800

*

*Download Visual Studio Express Edition
Get VS Express C++ free from Microsoft

*Download the freely available Windows Driver Kit (7.1 or later) from Microsoft
Get WDK 7.1.0 free from Microsoft
You can mount the ISO file with Virtual Clone Drive or extract it with 7-zip.

*Install the WDK and select the "Build Environments" option
This will install the ATL and MFC header and lib files. ATL is a requirement for FireBreath on windows. Make sure to install this in the default location so that FireBreath can find it

*For VS Express 2010
If you are using an older version of FireBreath, this post by scjohn may be useful for you. Note that FireBreath 1.4 beta 1 and later these steps are no longer needed!
http://www.firebreath.org/display/documentation/Building+with+Visual+Studio+Express
[vs2010 express include path]
C:\WinDDK\7600.16385.1\inc\atl71
[vs2010 express lib path]
C:\WinDDK\7600.16385.1\lib\ATL\i386


text:
Q: Extracting Specific numbers from text on Google Sheets? The data is as in the form below. I am trying to extract the hour(h), and minute(m) from the text to calculate the total duration in google sheets. ex 3h 24m equals 3.4 I am not able to extract the minute part incorrectly.
I have tried the below functions which work well for the hour part but fail for the minute part.
=LEFT(c1, SEARCH("h",c1)-1)

=IFERROR((REGEXEXTRACT(D1,"([[:print:]]+)h")),0)

C        D
4h       2h 49m
32m 19s  2h 2m
6h 7m    3h 24m

A: To extract hours, minutes and seconds into separate columns, you may use three separate REGEXEXTRACT formulas:
=IFERROR(REGEXEXTRACT(C1,"(\d+)h"), "")
=IFERROR(REGEXEXTRACT(C1,"(\d+)m"), "")
=IFERROR(REGEXEXTRACT(C1,"(\d+)s"), "")

Here, (\d+) is a capturing group that grabs 1 or more digits and the letter after is just matched, and thus, is not returned by the function.
You may also try to extract each part using optional patterns:
=REGEXEXTRACT(C1, "(?:(\d+)h)?\s*(?:(\d+)m)?\s*(?:(\d+)s)?")

Here, all hour, minute and second patterns are optional, and minutes will still match even if hours are missing.
Details

*

*(?:(\d+)h)? - an optional hour part wrapped with a non-capturing group:

*

*(\d+) - Group 1: one or more digits

*h - h letter

*\s* - 0+ whitespaces

*(?:(\d+)m)? - an optional minute part:

*

*(\d+) - Group 2: one or more digits

*m - m letter

*(?:(\d+)s)? - an optional seconds part:

*

*(\d+) - Group 3: one or more digits

*s - s letter


text:
Q: Activity not being reused I have an odd issue with my application.
I start the application and the activity shows ok.
I then press the home key so that the activity goes into the background. I can see the onPause() method being called.
The application's service then creates a notification which shows on the status bar.
I then click on the notification and the activity is shown and I see that the onResume() method is called.
I then press the home key and the activity goes into the background. I can see the onPause() method being called.
If I now start the application by clicking on the applications icon I see that a new instance of the activity is created rather than using the paused instance.
If I press the home key again the new activity goes into the background.
Starting the application by clicking on the applications icon I see another new instance of the activity is created.
Pressing the back button at the point destroys each activity in return.
What I want to happen is that a single instance of the activity be used.
Any ideas?

A: Just use the same intent filters as android uses when launches the app:
        final Intent notificationIntent = new Intent(context, MessageListActivity.class);
        notificationIntent.setAction(Intent.ACTION_MAIN);
        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);

As the intent you created to open your activity from notification bar is the same as android used for launching your app, the previously opened activity will be shown instead of creating a new one.

A: You should look at the different launch modes for Android activities. this should help. Launch modes can be set in the androidmanifest.xml file. I think your solution would be to use the 'singleTop' launch mode.


text:
Q: Creating a reusable animation using AOT compilation I'm trying to create a reusable animation but I'm getting the following error when compiling my app with angular-cli:
Error encountered resolving symbol values statically. Calling function 'flyInOut', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function
It only happens when using AOT compilation, though. If I set the aot flag to false, then it works.
Here's my function:
export function flyInOut(enter: string, leave: string, duration?: number): AnimationMetadata {
  const timing: number = duration || 100;
  return trigger('flyInOut', [
    state('in', style({ transform: 'translateX(0)' })),
    transition('void => *', [
      style({ transform: `translateX(${enter})` }),
      animate(timing),
    ]),
    transition('* => void', [
      animate(timing, style({ transform: `translateX(${leave})` })),
    ]),
  ]);
}

Any ideas on how to make it work with AOT compilation?

A: That is a known issue tracked in the official repo. This issue occurs when using variables inside our function. A workaround is obtaining that result from another exported function:
export function flyInOut(enter: string, leave: string, duration?: number): AnimationMetadata {
  return trigger('flyInOut', [
    state('in', style({ transform: 'translateX(0)' })),
    transition('void => *', [
      style({ transform: getTranslate(enter) }),
      animate(getDuration(duration)),
    ]),
    transition('* => void', [
      animate(100, style({ transform: getTranslate(leave) })),
    ]),
  ]);
}

In the example above, we call getTranslate and getDuration instead of using the duration, enter and leave variables. Then, we export those functions returning the proper value:
export function getDuration(duration: number): number {
  return duration || 100;
}

export function getTranslate(value: string): string {
  return `translateX(${value}%)`;
}


text:
Q: sql server query to replace variables with values recursively I have a table variable containing variables names and their values, for example :

*

*var1 = value1

*var2 = value2

*var3 = value3

Another table expression contains expressions :

*

*"a string using #var1# and #var2#"

*"another one with #var3# and #var4# and even #var1#"

and I want to replace the variables present in the table variable by their values, so the result should be :

*

*"a string using value1 and value2"

*"another one with value3 and #var4# and even value1"

Is there a way to do this with a CTE ?
http://sqlfiddle.com/#!3/c1e1e/2/0

A: This one was a good brainteaser. Here's a recursive CTE approach:
--using recursive CTE
with
    subq (original, corrected, PassNum) as
        (
         select expression.expression as corrected, expression.expression as original, 1 as PassNum from expression
         union all
         select subq.original, cast(replace(subq.corrected, '#' + variable.name + '#', variable.value) as varchar(100)),
         PassNum+1 as PassNum from subq, variable where subq.corrected like '%#' + variable.name + '#%'
         )

update expression set expression.expression=subq.corrected from expression inner join subq on
expression.expression=subq.original where subq.passnum=(select max(passnum) from subq)

It has some annoyances, like the fact that you have to cast the corrected value so it matches the column size (see below for more about this), and the PassNum variable, which was the only way I could find to indicate which update was the final one.
The mundane cursor approach is probably easier to debug since it's more straightforward:
--using cursor
DECLARE @name VARCHAR(50)
DECLARE @value VARCHAR(50)

DECLARE loopCursor CURSOR FOR
SELECT name, value from variable

OPEN loopCursor
FETCH NEXT FROM loopCursor INTO @name, @value

WHILE @@FETCH_STATUS = 0
BEGIN
       update expression set expression.expression=replace(expression, '#' + @name + '#', @value)
       FETCH NEXT FROM loopCursor INTO @name, @value
END

CLOSE loopCursor
DEALLOCATE loopCursor

Here's the quote I found about the casting when using a recursive CTE:

The behavior you are seeing is by design. While we could do type
  derivation for the columns and/or coerce to common type, for recursive
  CTE we chose to keep the derivation strict. There are also corner
  cases where the type derivation will not be able to arrive at the
  correct precision/scale/length. This can potentially lead to errors.
  So our recommendation as you observed is to explicitly type any
  expression using CAST. -Umachandar, SQL Programmability Team [1]

[1]
    http://connect.microsoft.com/SQLServer/feedback/details/668872/types-dont-match-between-the-anchor-and-the-recursive-part-in-column-columnname-of-recursive-query-cte-name


text:
Q: Cannot determine embedded database driver class for database type NONE while running jar As mentioned in the headline of question I am facing issue Cannot determine embedded database driver class for database type NONE. The application I have built is on spring boot and working fine when I run the code in intellij.
I have followed several questions regarding the same exception and they suggested that I need to add spring.datasource properties in my application.properties file. I already have them and still facing the same issue. This issue occurs when I create jar file using artifacts of intellij and then run it by the following command.
java - jar myJar.jar
My application.properties file
# ===============================
# = DATA SOURCE
# ===============================
spring.datasource.url = jdbc:mysql://localhost:3306/db_wssmith?useSSL=false
spring.datasource.username =
spring.datasource.password =
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

Error Log while running jar
ERROR org.springframework.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

A: You should create the jar from maven, to do that go to View on top then Tool Windows/Maven Projects and from there double click on install in LifeCycle option in maven. Use the jar created by that command instead of using intellij. It
Should work.


text:
Q: SQL SUM JOIN Issue I come to you again seeking further help :)  I have gotten to the point where I am able to JOIN the two queries producing the duplicate columns with different values as I would like, but I am still facing the overall query producing many results for each size (literal and technical are 1:1) How could I go about producing a query that only shows each material once for each size?  Thanks in advance and thanks for all of your help:
SELECT *
FROM

(SELECT         P.PLANT_CODE,
                P.STOCK_CATEGORY,
                P.MATERIAL,
                P.DISTRIBUTION_VERSION_CODE,
                P.PERIOD_CODE,
                P.REQUIREMENTS_DATE,
                P.PLANNED_QTY AS 'REM PLAN QTY',
                P.VERSION_IND_FLAG,
                P.SIZE_LITERAL,
                P.WITHDRAWN_QUANTITY,
                P.TECHNICAL_INDEX,
                P.PLANNED_QTY + P.WITHDRAWN_QUANTITY AS 'ORIGINAL FCST QTY'
 FROM           VW_PLANNED_REQMNTS_TXT P
 WHERE          P.PLANT_CODE IN ('6040','6041')
 AND            P.STOCK_CATEGORY IN ('A60385000','A60385003')
 AND            P.DISTRIBUTION_VERSION_CODE IN ('00','01','ZU','Z2')
 AND            P.REQUIREMENTS_DATE < GETDATE() - 59
 AND            P.PLANNED_QTY > 0) AS P1

 JOIN

 (SELECT
                SUM(P.PLANNED_QTY) AS 'FUTURE_FCST',
                P.MATERIAL,
                P.TECHNICAL_INDEX,
                P.SIZE_LITERAL
 FROM           VW_PLANNED_REQMNTS_TXT P
 WHERE          P.REQUIREMENTS_DATE > GETDATE()
 AND            P.PLANNED_QTY > 0
 GROUP BY       P.PLANNED_QTY,
                P.MATERIAL,
                P.TECHNICAL_INDEX,
                P.SIZE_LITERAL) AS P2

 ON             P1.MATERIAL = P2.MATERIAL
 AND            P1.TECHNICAL_INDEX = P2.TECHNICAL_INDEX`

 ORDER BY       P1.MATERIAL,
                P1.TECHNICAL_INDEX;