text:
Q: Windows 7 says Avast is off, but it's not! Am I infected? I have Avast Free antivirus installed on Windows 7.
I just noticed that Windows Action Center (the white flag icon in task bar) warns me about activating Avast antivirus, and even if I click activate it will just continue to ask for that.
But Avast reports being OK. I didn't turn off antivirus when I installed all my software since last format a couple of weeks ago, and I'm behind a NAT.
The only thing that makes me a little worried is that yesterday I used a "SKIDROW" (no further comments on that) installer, but that application is popular and months and months old, so Avast team would have had the time to add it to dangerous software if it was so. I understand I granted UAC permission, but I find hard to believe I could have been infected, even if I recently read that SKIDROW himself (again, no comment) placed a Trojan forged with Themida in a more and more popular patch.
My question is:
Is it normal that Windows says Avast is not running? Avast behaves normally. I even downloaded a virus from eMule (zipped, of course, so I wouldn't be running it) and had Avast scan it, and it found the threat!!
Could there be a relationship with yesterday's installation? Wouldn't Avast detect an exploitation attempt? I set its heuristics to a higher level, so it would have detected attempts to overwrite its files, system files, boot sector, startup programs, etc... (it even complained about Office 2010 installation)

A: Reinstalling Avast tends to fix this issue. I've seen it before where it happened after an AVAST update.
As for AVs in general. They are not an invincible shell. They are more like a bulletproof vest. They stop some fatal shots but not all; you still have to avoid firefights.
You should probably check your computer with standalone tools such as Malware Bytes.

A: Having looked on several forums, all suggesting re-installing Avast etc, I came here. I saw the suggestion above to try disabling permanently all the shields and then re-enabling them.
Gave it a go, and it worked a treat - only took about 30 seconds - couldn't have been easier.
Just to be on the safe side I disconnected from the internet first, went to avast - settings - active protection - and did the deed.
I was a little concerned about disabling permanently, but that is totally misleading as it's not permanent at all - you just click ON and they start again again.

A: You might try scanning with these 2 scanners to be sure you have no infection.
2.)
Install free MBAM, run the program and go to the Update tab and update it, then go to the Scanner Tab and do a quick scan, select and remove anything it finds.
http://download.cnet.com/Malwarebytes-Anti-Malware/3000-8022_4-10804572.html
3.) When MBAM is done install SAS free version, run a quick scan, remove what it automatically selects.
http://www.superantispyware.com/download.html
These 2 are not AV softwares like Avast, they are on demand scanners that only scan for nasties when you run the program and will not interfere with your installed AV, these can be run once a day or week to ensure you are not infected. Be sure you update them before each daily-weekly scan.
.

A: My solution was to simply disable all of the shields permanently and then re-enable them. Could save you the time and trouble of uninstalling, re-installing, new av program, etc.


text:
Q: Problem with making a new folder in Ubuntu I have a problem with making a new folder in one of my drives.
I have Ubuntu 17 and the drive format is NTFS.
I already mounted it, but I still can't make a new folder.
Result of for i in $(lsblk -l -f|grep -i ntfs|cut -d ' ' -f 1) /etc/mtab;do grep "/dev/$i" /etc/mtab;done ;:
/dev/sda2 /media/mo/0A9392143BD31443 fuseblk ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
/dev/sdb1 /media/mo/My\040Passport fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

A: Two partitions with NTFS file systems were found:
$ for i in $(lsblk -l -f|grep -i ntfs|cut -d ' ' -f 1) /etc/mtab;do grep "/dev/$i" /etc/mtab;done
/dev/sda2 /media/mo/0A9392143BD31443 fuseblk ro,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0
/dev/sdb1 /media/mo/My\040Passport fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

*

*/dev/sda2 is mounted read-only ro

*/dev/sdb1 is mounted read-write rw
I think default_permissions,allow_other should make it possible to write files and create a directory when mounted read-write.
You cannot write anything (and not create a directory) when a Microsoft partition is mounted read-only.
Try to check permissions with the following commands
ls -ld /media/mo/0A9392143BD31443
ls -ld /media/mo/'My Passport'

See How do I use 'chmod' on an NTFS (or FAT32) partition? with detailed instructions how to mount an NTFS or FAT32 partition to make it useful.

If Windows is hibernated or semi-hibernated (alias Fast Startup), the Windows file system(s) are not ready for writing by Linux, so Linux (and Ubuntu is Linux) does not want to mount it with write permissions.
What about your partition /dev/sda2? Please check, and if necessary, turn off Fast Startup in Windows and try again.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Create reusable switches with javascript and css I'm currently developing a web interface which has some custom controls, one of which is a toggle switch. This is a rough example of what I should look like:
The interface

I've made this switch in illustrator and exported it as a .svg, which results in a rect (the base) and a circle (the sliding part). When the toggle switch is clicked, i want the base to change colors, a variable to be set or reset, and the slider to move 16px to the right. I know how i could do this by changing the style property of each different element, but i'd like to know how (if) this can be done with one global id for the whole switch. I am using css and javascript and would like to stick to these languages.
In short, this is what i am looking to achieve: I want to use one id for reference in javascript, and would like to toggle a variable (and styles) with the switch. This way, if i use 5 switches, every switch can be toggled independently.
This is what i already have:
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="36px" height="18px" class="Switch" id="Switch1" checked="false">
<defs>
    <linearGradient id="SwitchGradient" x1="0%" y1="0%" x2="0%" y2="100%"> //gradient for slider
        <stop offset="5%" stop-color="#E6EEF2" />
        <stop offset="95%" stop-color="#D7DDE0" />
    </linearGradient>
</defs>
<rect x="3.25" y="3.25" width="27" height="11" class="BaseSlider" rx="6px" ry="6px" id="SwitchBase1"/> //base of the switch
<circle cx="9" cy="9" r="8.5" class="SwitchSlider" id="SwitchSlider1"/> //slider of the switch

and this is my javascript function:
function SwitchClick() {
Slider_Clicked = !Slider_Clicked; // toggle boolean
if (Slider_Clicked) {
    SwitchBase.style.fill = "#3EBEE5"; //make blue
    SwitchSlider.style = "transform: translateX(16px)"; //move to right
} else {
    SwitchBase.style.fill = "#D7DDE0"; // make grey
    SwitchSlider.style = "transform: translateX(0px)"; //move to left
}

Any help on how to tackle this would be greatly appreciated, thanks!


text:
Q: Jenkins xvnc, HOME variable not set error Trying to get some jobs working that require xvnc, but get this:
  Starting xvnc
  [workspace] $ vncserver :14
  vncserver: The HOME environment variable is not set.

I have no problems with running vncserver from the jenkins user on command line. (aside: 'printenv' shows the HOME variable is populated correctly when on the command line, but not from within a jenkins job).
I am running Ubuntu 11.10.

A: Edit  /etc/init.d/jenkins on the server to set HOME environment variable.

A: Go into: /etc/init/jenkins.conf
Add the following line to the bottom of the env list.
env HOME="/var/lib/jenkins"

restart jenkins, enable the xvnc in your build, and then it will work.


text:
Q: How to compare current datetime to some database time I have a database table with values as:
 "295fc51f6b02d01d54a808938df736ed" : {
    "author" : "James Iva",
    "authorID" : "JBvLC3tCYCgFeIpKjGtSwBJ2scu1",
    "geometry" : {
      "latitude" : 29.4241219,
      "longitude" : -98.49362819999999
    },
    "listDate" : 1482331706209,
    "openHours" : {
      "Friday" : {
        "closeTime" : "17:00",
        "openTime" : "09:00",
        "status" : true
      },
      "Monday" : {
        "closeTime" : "17:08",
        "openTime" : "09:00",
        "status" : true
      },
      "Saturday" : {
        "closeTime" : "17:00",
        "openTime" : "09:00",
        "status" : true
      },
      "Sunday" : {
        "closeTime" : "17:00",
        "openTime" : "10:00",
        "status" : true
      },
      "Thursday" : {
        "closeTime" : "17:00",
        "openTime" : "09:21",
        "status" : true
      },
      "Tuesday" : {
        "closeTime" : "17:00",
        "openTime" : "04:00",
        "status" : false
      },
      "Wednesday" : {
        "closeTime" : "17:00",
        "openTime" : "10:00",
        "status" : false
      }
    },
    "pPhone" : "no_phone",
    "placeAdd" : "San Antonio, TX, USA",
    "placeCat" : "Education"
  }
}

What I have to do is check if the place is open(status is true) at the current Day Time and show something like the following in the template:
IT'S THURSDAY 4:12PM - WE'RE OPEN!

How can I achieve this in angular2?
Here is my subscribe code to get the data from a service:
ngOnInit() {
    this.sub = this.route.params.subscribe(params => {
        this.id = params['id'];
        let str = params['string'];
       // Retrieve Pet with Id route param
       this._placesService.findPetById(this.id).subscribe(place => {
         this.place = place; //Here should be the opening data!

       });
});
}

A: To get an idea how to do this job, take a look at this:
@Component({
  selector: 'my-app',
  template: `

Hello {{name}}

      {{ opening }}

  `,
})
export class App {
  name:string;
  opening: string;

  constructor() {
    this.name = 'Angular2'

    this._refresh();
  }

  private _getDayName(): string {
    return new Date().toLocaleString("en-us", { weekday: 'long' });
  }

  // converts string-times into Date and checks if its opened ..
  private _isOpen(todaysOpeningData: any): bool {
    const curDate = new Date();
    const open = new Date();
    const close = new Date();

    // set opening time
    open.setHours(+todaysOpeningData.openTime.split(':')[0]);
    open.setMinutes(+todaysOpeningData.openTime.split(':')[1]);

    // set closing time
    close.setHours(+todaysOpeningData.closeTime.split(':')[0]);
    close.setMinutes(+todaysOpeningData.closeTime.split(':')[1]);

    // check if its opened !
    return curDate >= open && curDate <= close;
  }

  // check and build string ..
  private _checkOpeningHours(data: any): string {
    const curDayName = this._getDayName(); // get current day name
    const todaysOpeningData = openingdata.openHours[curDayName]; // get opening time for today with current day name

    if (!todaysOpeningData) return "ERROR!"; // there are no opening-times for today?
    if (!todaysOpeningData.status) return `IT'S ${curDayName.toUpperCase()} - WE ARE CLOSED TODAY!`; // we are closed entirely today !

    return `IT'S ${curDayName.toUpperCase()}, ${new Date().toLocaleString("en-US", { hour: '2-digit', minute: '2-digit' })} - ${this._isOpen(todaysOpeningData) ? 'WE ARE OPEN' : 'SORRY, WE ARE CLOSED'}!`;
  }

  private _refresh() {
    this.opening = this._checkOpeningHours(openingdata.openHours[this._getDayName()]);
    console.log(this.opening);

    setTimeout(() => this._refresh(), 60 * 1000);
  }
}

live-demo: https://plnkr.co/edit/R5fk7eJrltGx2zOuVhuz?p=preview
UPDATE:
You should use it like this:
this.sub = this.route.params.subscribe(params => {
   this.id = params['id'];
   let str = params['string'];

   // Retrieve Pet with Id route param
   this._placesService
      .findPetById(this.id)
      .subscribe(place => {
         this.place = place; //Here should be the opening data!

         // assuming that 'this.id' is '295fc51f6b02d01d54a808938df736ed'
         this.yourTargetVariable = this._checkOpeningHours(place[this.id]);
   });
});


text:
Q: Rhino Mocks AssertWasCalled (multiple times) on property getter using AAA I have a mocked object that is passed as a constructor argument to another object.
How can I test that a mocked object's property has been called? This is code I am using currently:
INewContactAttributes newContact = MockRepository.GenerateMock<INewContactAttributes>();
newContact.Stub(x => x.Forenames).Return("One Two Three");
someobject.ConsumeContact(newContact);
newContact.AssertWasCalled(x => { var dummy = x.Forenames; });

This works except when within the "someobject" the getter on Forenames property is used multiple times. That's when I get "Rhino.Mocks.Exceptions.ExpectationViolationException: INewContactAttributes.get_Forenames(); Expected #1, Actual #2.."
Simply using
newContact.AssertWasCalled(x => { var dummy = x.Forenames; }, options => options.Repeat.Any());

does not work and gives the error below:
"The expectation was removed from the waiting expectations list, did you call Repeat.Any() ? This is not supported in AssertWasCalled()."
So how do I cater for the multiple calls?

A: newContact.AssertWasCalled(x => { var dummy = x.Forenames; }, options => options.Repeat.AtLeastOnce());
Repeat.Any does not work with AssertWasCalled because 0 counts as any... so if it WASN'T called, the AsserWasCalled would return TRUE even if it wasn't called.

A: I agree with chris answer
newContact.AssertWasCalled(x => { var dummy = x.Forenames; }, options => options.Repeat.AtLeastOnce());

Additionally If you know exactly how many times the property would be called you can do
newContact.AssertWasCalled(x => { var dummy = x.Forenames; }, options => options.Repeat.Times(n));

where n is an int.

A: What is your motivation behind checking the number of times it is called? Is it a particularly expensive operation? If so, then I would suggest that you put it behind a method instead as, semantically speaking, properties should be inexpensive calls.
Also, checking the number of times a property is called is not the thrust of unit testing (don't worry it's a common mistake to test too much, we've all been there). What you should really be testing is that given the state of your mock object that the method produces the expected output. The number of times a method is called to do that doesn't really matter (unless it's a service to send an email or something). It is an implementation detail which you normally wouldn't test as a simple refactor would break your tests as they would be too specific.

A: Depending on your version of Rhino you are using, you can use:
// Call to mock object here
LastCall.IgnoreArguments().Repeat.Never();

A: newContact.Expect( c => c.ForeNames ).Return( ... ).Repeat.Any()

A: From Here:
mock.AssertWasCalled(x => x.Name ="Bob");

or
mock.AssertWasCalled(x => x.Name =Arg.Is("Bob"));

or
mock.AssertWasCalled(x => x.Name =Arg<string>.Is.NotNull);


text:
Q: Installing efibootmgr at end of Ubuntu install on Mac I've installed Ubuntu on my Mac Mini from a USB drive. The instructions on the web site that I followed to do the install says I should not reboot at the end of the process. Instead I should "get a terminal" and run
sudo apt-get install efibootmgr

When I key ctrl opt t, it briefly flashes a progress bar then returns to the installation app. At the point in the install where it asks you to reboot, I chose back. That gave me a menu where I chose "Execute a shell". When I ran the command, it tells me that I will be running ash with a bourne shell and the new file system is on "/target. At this point I entered the comnand. It said sudo was not found. When I run it without sudo, it says apt-get is not found. Typing help displays all the available commands. It's very limited. I found apt-get in /target/usr/bin. When I try to run it, I get permission denied. I even get permission denied on trying to run sudo in the same directory. I then copied apt-install from its target directory to the local ram image. It ran, but gave an error about a missing library. Next, I did a chown root /target and tried to run it from its original location. I got the same error about a missing file.

A: The instructions on that site become suddenly vague at the crucial point.
sudo apt-get install efibootmgr

is most definitely an Ubuntu command and nothing to do with OSX
The guide seems to assume you're running the graphical installer program (ubiquity) from a live environment. Although it just says "boot the USB and install as normal" I would elaborate slightly

*

*After creating a live USB of the desktop edition of Ubuntu, turn your computer off and on again and select the USB in the boot menu or firmware settings (accessed with whatever method your hardware requires)

*At the initial menu select Try Ubuntu without installing

*When the desktop loads, click on the Install Ubuntu icon

*Select your options... If not dual booting, Erase the disk and install Ubuntu, allowing the installer to partition for you, and not choosing LVM, is the simplest formula.

*According to the instructions, when told to reboot, rebelliously refuse and instead open a terminal, by clicking the terminal launcher icon, searching for "terminal" in the dash, or pressing Ctrl+Alt+T (wait, what's that on a Mac?)

*Enter the command in the terminal... and that should be it.


text:
Q: JavaScript - tooltip div on hover I'd like to implement this situation: user hovers link and on his screen appears div with additional information.
There is no problem, to generate div with absolute position, populate data and display it with jQuery, but the problem is with maintainability. I want to separate logic and view. What if I'd like to change page layout in the future? How programmer will know, that some part of page exist in JavaScript file?
Is it some elegant way to separate view (in my case HTML structure) and logic (data obtained from server in JSON using JS script) and combine them? Is it any ... templating engine or something like that in JavaScript?

A: You can generate your HTML entries like this

    My Cool Link

        This link is awesome!

And use CSS to style the tooltip:
(The important part is a:hover .tooltip and everything except background on .tooltip
a {
    display: inline-block;
}
a:hover .tooltip {
    visibility: visible;
}
.tooltip {
    position: relative;
    top: 20px;
    left: -50%;
    display: inline;
    visibility: hidden;
    background: #eee;
}

Example: http://jsfiddle.net/4K7sB/
Then you just need to populate the elements with the correct text using JS.

A: Bootstrap does all this and more: http://getbootstrap.com/javascript/#tooltips
To put it in:
$('#example').tooltip(options)

And the markup being:

    Tooltip text here!

Go to the link for a more detailed explanation on how to implement it

A: You can alter the Title="information" dynamicaly by some program or script and use the following code to display it as a tool tip,found it on net
http://www.webdesignerdepot.com/2012/11/how-to-create-a-simple-css3-tooltip/

A: Just add title attribute in div tag like below code....

StackOverFlow StackOverFlow StackOverFlow
StackOverFlow StackOverFlow StackOverFlow StackOverFlow StackOverFlow
StackOverFlow

StackOverFlow StackOverFlow StackOverFlow
StackOverFlow StackOverFlow StackOverFlow StackOverFlow StackOverFlow
StackOverFlow

just copy paste and check.


text:
Q: Grub HD wrong detection mapping I have a SATA disc with several partitions, one with Centos and one with Clonezilla Live. Grub sees both entries correctly, and starts either OS correctly.
Then I install my big monster (a bit of sarcasm here) data hardware RAID (which bios and I'm assuming grub too, see as one HD), and pop! the grub does not load either OS. I disconnect the monster, and pop! it all works again.
The issue here, I think, is that grub does not map the (hd*) to either HD correctly. I don't know what order criteria there is within the grub HD detection, but it maps the monster RAID as hd0 instead of the usual SATA disc.
How do I influence the GRUB HD detection/mapping, so that grub will point the right hard drive, irrespective of whether the RAID drive is installed or not?
map (hd0) (hd1) does not solve the problem.

A: GRUB has map file /boot/grub/device.map
If your RAID is going to be permanent installation - than just remap your drives in this file and reinitialize GRUB setup.
Solution for the problem is to use persistent names for your block devices. With persistent names there should be no problem with what device is /dev/sda1 or /dev/sda2, etc, because we are using unique values to identify our partitions. These values remain same regardless of other factors.


text:
Q: Include h1/h2/h3 and positioning then in html file using .css file This is my html code:

Main Title

I would like to know how to add h2 / h3 / h4 inside div:
?
There's more, how do I position them my way? That is, h2 will be on the right but just below h1,  h3 will be on the bottom right and h4 will be on the top right.
Is it possible to do that?
Any help guys?

A: Have a play with this

H1 {
  float: left
}

H2 {
  float: right
}

H3 {
  display: block;
  position: relative;
  top: 150px;
}

H4 {
  display: block;
  position: absolute;
  top: 0px
}

Main Title

H2

H3

H4


text:
Q: Is it possible to set an IAM policy and as a condition, remove it when the account is gone Looking for the setIamPolicy, saw that is possible to set a condition for the policy. For example:
bindings:
- members:
  - serviceAccount:my-project-id@appspot.gserviceaccount.com
  role: roles/resourcemanager.organizationAdmin
  condition:
    title: expirable access
    description: Does not grant access after Sep 2020
    expression: request.time < timestamp('2020-10-01T00:00:00.000Z')

Source: https://cloud.google.com/kms/docs/reference/rest/v1/Policy
I would like to create a custom condition, which the Policy will be removed after the account is removed. Is it possible? Didn't found any example in the link below:
https://cloud.google.com/iam/docs/conditions-overview#attributes

A: Cloud IAM Conditions is currently in private beta the chances of a community member to be whitelisted for this feature are incredibly low.
I advise you to ask directly to Google if the feature to set IAM policy as a condition is supported


text:
Q: Is there a shorthand notation to $frac(x) = x - \lfloor x \rfloor $? In old Hewlet Packard calculators, it was common to have an int and a frac function, which were giving the integer and the fraction part of a number.
Nowadays, the floor function is quite common and noted $ \lfloor x \rfloor $ but to get fraction part, you usually need to compute it "by hand" by explicitly writing something like x - floor(x). I wondered if there existed some mathematical short hand notation for $frac(x) =  x - \lfloor x \rfloor $.
Thank you.

A: As requested in the comments:
The standard notation for the fractional part of $x$ is $\{x\}$.


text:
Q: Getting rid of JQuery DatePicker in a Selenium test I am writing a Selenium test to populate a date field on a webpage. The field is associated with a JQuery Date Picker. When I use the 'type' function to enter the date, the picker pops up. However, I cannot get it to go away, even if I shift focus, click on another field etc. I've tried the following till now...
# Python Code
# Setting the date in the field
sel.focus('tradeDate')
sel.type('tradeDate', '8/16/2011')

# Trying to get rid of the date picker popup, none of these work
sel.key_press('tradeDate', '5')          # Trying to TAB out
sel.focus('link=[Search Filters]')       # Trying to set focus to something else
sel.focus('searchDirectory')             # Trying to set focus to another text field
sel.fire_event('tradeDate', 'blur')
sel.click('//span[@onclick="toggleTradeDetails(\'14859\',this);"]')

None of the above seem to work. I am not actually trying to test JQuery. The 'tradeDate' field has its own onClick event define, which is what I am actually trying to test.
Thus, how can I get rid of the date picker pop-up. I'm using Selenium RC against IE 8

A: i guess,
you don't need to use sle.focus() function as you are using sel.type() and it supplied with
element id.so it knows where to type the value. i think sel.focus() is causing the date field to pop-up the jquery date picker earlier.
if this is not solved please post the HTML code to see where exactly that Jquery date picker is attached to the text box.

A: I solved this issue by using the mouseMove, mouseDown & mouseUp selenium commands to move to a different field on the page, which gets rid of the date picker


text:
Q: string to array, split by single and double quotes i'm trying to use php to split a string into array components using either " or ' as the delimiter. i just want to split by the outermost string. here are four examples and the desired result for each:
$pattern = "?????";
$str = "the cat 'sat on' the mat";
$res = preg_split($pattern, $str);
print_r($res);
/*output:
Array
(
    [0] => the cat
    [1] => 'sat on'
    [2] =>  the mat
)*/

$str = "the cat \"sat on\" the mat";
$res = preg_split($pattern, $str);
print_r($res);
/*output:
Array
(
    [0] => the cat
    [1] => "sat on"
    [2] =>  the mat
)*/

$str = "the \"cat 'sat' on\" the mat";
$res = preg_split($pattern, $str);
print_r($res);
/*output:
Array
(
    [0] => the
    [1] => "cat 'sat' on"
    [2] =>  the mat
)*/

$str = "the 'cat \"sat\" on' the mat 'when \"it\" was' seventeen";
$res = preg_split($pattern, $str);
print_r($res);
/*output:
Array
(
    [0] => the
    [1] => 'cat "sat" on'
    [2] =>  the mat
    [3] => 'when "it" was'
    [4] =>  seventeen
)*/

as you can see i only want to split by the outermost quotation, and i want to ignore any quotations within quotations.
the closest i have come up with for $pattern is
$pattern = "/((?P<quot>['\"])[^(?P=quot)]*?(?P=quot))/";

but obviously this is not working.

A: You can use preg_split with the PREG_SPLIT_DELIM_CAPTURE option. The regular expressions is not quite as elegant as @Jan Turoň's back reference approach because the required capture group messes up the results.
$str = "the 'cat \"sat\" on' the mat the \"cat 'sat' on\" the mat";
$match = preg_split("/('[^']*'|\"[^\"]*\")/U", $str, null, PREG_SPLIT_DELIM_CAPTURE);
print_r($match);

A: You can use just preg_match for this:
$str = "the \"cat 'sat' on\" the mat";
$pattern = '/^([^\'"]*)(([\'"]).*\3)(.*)$/';

if (preg_match($pattern, $str, $matches)) {
  printf("[initial] => %s\n[quoted] => %s\n[end] => %s\n",
     $matches[1],
     $matches[2],
     $matches[4]
  );
}

This prints:
[initial] => the
[quoted] => "cat 'sat' on"
[end] =>  the mat

Here is an explanation of the regex:

*

*/^([^\'"]*) => put the initial bit until the first quote (either single or double) in the first captured group

*(([\'"]).*\3) => capture in \2 the text corresponding from the initial quote (either single or double) (that is captured in \3) until the closing quote (that must be the same type as the opening quote, hence the \3). The fact that the regexp is greedy by nature helps to get from the first quote to the last one, regardless of how many quotes are inside.

*(.*)$/ => Capture until the end in \4

A: Yet another solution using preg_replace_callback
$result1 = array();
function parser($p) {
  global $result1;
  $result1[] = $p[0];
  return "|"; // temporary delimiter
}

$str = "the 'cat \"sat\" on' the mat 'when \"it\" was' seventeen";
$str = preg_replace_callback("/(['\"]).*\\1/U", "parser", $str);
$result2 = explode("|",$str); // using temporary delimiter

Now you can zip those arrays using array_map
$result = array();
function zipper($a,$b) {
  global $result;
  if($a) $result[] = $a;
  if($b) $result[] = $b;
}
array_map("zipper",$result2,$result1);
print_r($result);

And the result is
[0] => the
[1] => 'cat "sat" on'
[2] =>  the mat
[3] => 'when "it" was'
[4] =>  seventeen

Note: I'd would be probably better to create a class doing this feat, so the global variables can be avoided.

A: You can use back references and ungreedy modifier in preg_match_all
$str = "the 'cat \"sat\" on' the mat 'when \"it\" was' seventeen";
preg_match_all("/(['\"])(.*)\\1/U", $str, $match);
print_r($match[0]);

Now you have your outermost quotation parts
[0] => 'cat "sat" on'
[1] => 'when "it" was'

And you can find the rest of the string with substr and strpos (kind of blackbox solution)
$a = $b = 0; $result = array();
foreach($match[0] as $part) {
  $b = strpos($str,$part);
  $result[] = substr($str,$a,$b-$a);
  $result[] = $part;
  $a = $b+strlen($part);
}
$result[] = substr($str,$a);
print_r($result);

Here is the result
[0] => the
[1] => 'cat "sat" on'
[2] =>  the mat
[3] => 'when "it" was'
[4] =>  seventeen

Just strip eventual empty heading/trailing element if the quotation is at the very beginning/end of the string.


text:
Q: How to get the result from the asynctask back to my main thread This is the code in the AsyncTask class:
    package com.mermit.enter;
import android.os.AsyncTask;
import android.os.Bundle;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;

public class isOnlineTask extends AsyncTask<Void, Void, Boolean> {

    public static Boolean networkStatus;

    @Override
    protected Boolean doInBackground(Void... params) {
        /*try {
            int timeoutMs = 1500;
            Socket sock = new Socket();
            SocketAddress sockaddr = new InetSocketAddress("8.8.8.8", 53);

            sock.connect(sockaddr, timeoutMs);
            sock.close();

            return true;
        } catch (IOException e) { return false; }*/
        return true;
    }

    @Override
    protected void onPostExecute(Boolean result) {
        // result holds what you return from doInBackground
        networkStatus = result;
    }
}

This is the code that matters in my main class. The function isOnline gets called in an if statement and is expected to return the boolean from the asynctask. I want the main thread to wait till a response has been returned from the asynctask, which is why I use .get(). I looked through a lot of questions on the site but couldn't find a fix for my specific situation. Logcat doesn't give an error message or anything strange at all either, which doesn't help.
package com.mermit.enter;

import static com.mermit.enter.isOnlineTask.networkStatus;

...

public boolean isOnline() {
    try {
        new isOnlineTask().get();
        return networkStatus;
    } catch (InterruptedException e) {
        e.printStackTrace();
        return false;
    } catch (ExecutionException e) {
        e.printStackTrace();
        return false;
    }
}

edit: I also tried
return new isOnlineTask().execute()
instead of
new isOnlineTask().get();
return networkStatus;

A: I suggest to provide a listener object in the AsyncTask's constructor and invoke it on onPostExecute callback. For instance:
public class isOnlineTask extends AsyncTask<Void, Void, Boolean> {
   private NetworkStatusListener mListener;

   public interface NetworkStatusListener{
      void isStatusAvailable(Boolean result);
   }

   // your code...
   public isOnlineTask(NetworkStatusListener listener){
      this.mListener = listener;
   }
   protected void onPostExecute(Boolean result) {
        // result holds what you return from doInBackground
        if (mListener != null){
            mListener.isStatusAvailable(result);
        }
    }
}

then on the MainClass:
new isOnlineTask(new NetworkStatusListener{
       void isStatusAvailable(Boolean result){
          //.. do something with the result
       }
   }
).execute();

A: AsyncTask is used for doing background operation, so you should not try to stop the execution of the UI thread. onPostExecute() is invoked on the UI thread so here you can do everything you need to do after the task is completed. If you need to know in your main class whether the task is completed you can do something like this
isOnlineTask
@Override
protected void onPostExecute(Boolean result) {
    MainClass.taskIsCompleted(result)
}

MainClass
public class MainClass {

    private static boolean isTaskCompleted;

    public void genericMethod() {
        if(isTaskCompleted()) {
            // your operation here
        }
    }

    private boolean isTaskCompleted() {
        return isTaskCompleted;
    }

    public static void taskIsCompleted(boolean bool) {
        isTaskCompleted = bool;
    }

}


text:
Q: iOS Swift Adding Object To Array I am trying to add the retrieved object from Parse to an array. It has found the user, it is printed in my logs. All the key names match up, I can't seem to find why both my userArray and imageFiles array are printed to the logs as empty. Thanks for the help!
    var userArray: [String] = []

var refresher: UIRefreshControl!

var imageFiles = [PFFile]()

override func viewDidLoad() {
    super.viewDidLoad()

    PFGeoPoint.geoPointForCurrentLocationInBackground { (geopoint: PFGeoPoint!, error: NSError!) -> Void in

        if error == nil {

            println(geopoint)

            var user = PFUser.currentUser()

            user["location"] = geopoint
            user.save()

            var query = PFUser.query()
            query.whereKey("location", nearGeoPoint:geopoint)
            query.limit = 10
           query.findObjectsInBackgroundWithBlock({ (users: [AnyObject]!, error: NSError!) -> Void in

                for user in users {

                 self.userArray.append(user["name"] as! String)

                 self.imageFiles.append(user["profilePicFile"] as! PFFile)

                    println(user)
                }

      })

  }
}

    self.refresher = UIRefreshControl()
    self.refresher.attributedTitle = NSAttributedString(string: "Pull to refresh")
    self.refresher.addTarget(self, action: "refresh", forControlEvents: UIControlEvents.ValueChanged)
    self.tableView.addSubview(self.refresher)
    //follow udemy to get pull to refresh , need update users
    println(userArray)
    println(imageFiles.count)

}

func updateUsers() {

    self.userArray.removeAll(keepCapacity: true)
    self.imageFiles.removeAll(keepCapacity: true)

    var aquery = PFUser.query()
    aquery.whereKey("username", equalTo: PFUser.currentUser().username)
    var cools = aquery.findObjects()

    var query = PFUser.query()
    query.whereKey("location", nearGeoPoint: cools[0]["location"] as! PFGeoPoint!)
    query.limit = 10
    query.findObjectsInBackgroundWithBlock({ (users: [AnyObject]!, error: NSError!) -> Void in

        for user in users {

            self.userArray.append(user["name"] as! String)

            self.imageFiles.append(user["profilePicFile"] as! PFFile)

        }

        self.tableView.reloadData()

        self.refresher.endRefreshing()

    })

}

A: The reason is because PFGeoPoint.geoPointForCurrentLocationInBackground is an asynchronous method that takes a callback closure as a parameter to fire off as soon as the asynchronous work is done. So viewDidLoad will call that method but continue on and print userArray before the geoPointForCurrentLocationInBackground callback gets fired.
This is a big feature of functional programming languages so I suggest reading up on closures when you can.
http://code.tutsplus.com/tutorials/swift-from-scratch-closures--cms-23138
https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html
If you put the println statements after you iterate the users inside of the callback, you will see your data:
for user in users {
    self.userArray.append(user["name"] as! String)
    self.imageFiles.append(user["profilePicFile"] as! PFFile)
        println(user)
    }
}
println(userArray) // you will see userArray is populated
println(imageFiles.count)


text:
Q: Python, recognizing and handling events with win32 api My goal is to record mouse position on screen and then replay it. I found the part for creating mouse events easily, but couldn't find anything about recognizing and handling events. Or at least I couldn't find anything that was simple enough for me to understand and use.
So the question is, how can i recognize mouse clicks and handle them?


text:
Q: Why my QtRPT project file is not running in QtCreator? I have QtRPTProject to run in the QtCreator but It is showing errors like      " Cannot run compiler 'g++'. Maybe you forgot to setup the environment?" and "Project ERROR: Unknown module(s) in QT: script" while building.Any help ??

A:
Project ERROR: Unknown module(s) in QT: script

This means that the module Qt Script is not installed.
This module has been deprecated and is not installed by default, you have to opt-in.
The exact procedure on how to install it depends on how you installed Qt in the first place. If you used the online installer, it is just a matter of running the "Maintenance Tool" and checking the Qt Script checkbox.

Cannot run compiler 'g++'. Maybe you forgot to setup the environment?

This means that Qt Creator cannot find the c++ compiler.
That means that you have not installed a compiler, or not configured Qt Creator correctly.
Again the exact procedure depends on your system and which compiler you want to use. If you are on Windows, the Qt Maintenance Tool offers to install MinGW for your. Like for Qt Script it is just a matter of checking the right checkbox. Be sure to select the MinGW version that matches the version of Qt you selected.
If you need more help, please edit your question and add details about your system and your current installation.


text:
Q: How to get offset included in timestamp with time zone into a variable using npgsql I have a query that takes a table which has a 'timestamp with timezone' column and returns the timestamp in the context of the server timezone.
As an example, the row contains 2023-02-01T23:00:00+00 but when retrieved using the context of Europe/Paris timezone it shows the value with an offset of +1:

When retrieving via npgsql I have tried mapping to a DateTimeOffset but I'm always getting the UTC value, I never get the +1 offset included.
I have also tried using NodaTime but get the same issue: UTC with no offset :
while (await reader.ReadAsync())
{
    var dto = reader.GetFieldValue<DateTimeOffset>(0);
    var instant = reader.GetFieldValue<Instant>(0);
    var zonedDateTime = reader.GetFieldValue<ZonedDateTime>(0);
    var offsetDateTime = reader.GetFieldValue<OffsetDateTime>(0);
}

How can I get the local time with the offset via npgsql and into my C# code? Is this even possible? As PGAdmin shows the local+offset time I assume that this is also passed back but can't find out how to do it.

A: When you query a timestamptz as text, PG converts it to the (server) local time zone as defined in the Timezone parameter. This usually is not what you want - different users live in different time zones, and the system time zone that happens to be configured on the database server isn't generally important. While it's possible to pre-set Timezone to the user
The more usual pattern is to do any time zone conversion out of the database, in .NET. In other words, you would simply use .NET APIs to convert the UTC DateTime (or Instant, if you're using Nodatime) which you get from Npgsql to whatever time zone you want.
However, if you want to do the time zone conversion in the database, you can simply convert your timestamptz to text and get that:
SELECT my_column::text FROM my_table;

This would be similar to what happens when you query in PGAdmin. However, what you get back is a text, and not a structured timestamp; PostgreSQL simply does not support a data time that combines a timestamp with an offset.
But I again recommend thinking carefully about why you want PG to do the time zone conversion for you, and whether that's a good idea etc.


text:
Q: How can I use Skype in Ubuntu? What are the options to install Skype in Ubuntu 11.04?

A: If you enable (this link tells you how) the partner repository within your software sources (and reload the list).

Now you should be able to install Skype in 11.04 from the Software Centre.

Screenshot, it happened.

A: Have you tried the packages for Ubuntu 10.04 or more that are available on the Skype Linux download page ? I would think they will also work on 11.04. And make sure to use the right package for your Ubuntu version, either 32 bits or 64 bits.

A: To get Skype just go to the Ubuntu Software Center and search for "skype", then it will return the Skype software, select it and click on the Install button, it's supposed to install the latest Skype client for Linux. To start Skype just search for it in the Unity Dash or if you're using Classic Gnome go to Applications > Internet > Skype.

A: The easiest way, in 12.04, download the .deb file from www.skype.com/intl/es/get-skype/ , and simply open it. It should open your Ubuntu software center. So it will check if you have already installed it in your computer, in this case it will offer you to upgrade or install it directly from the Software Center window !


text:
Q: Fourier transformation of $f(2t), \; f(2t+1), \; f(2t+1)e^{it}$, etc if $\mathcal{F}[f](t)$ is known Suppose that a function$\,$ $f(t)$ $\,$has the Fourier transform
$\,$$\hat f(\omega)=e^{-\omega^4}$.
What general rules are there for computing the Fourier transforms of things like $\,$$g(t)=f(2t)$, $\,$ $h(t)=f(2t+1)$, $k(t)=f(2t+1)e^{it}$ and similar?
I know that the Fourier transforms are the once below and I know how to find them (by finding f(t) by the inverse transform and then transforming f(2t+1) etc.)
My question is if there is a quicker way of finding a Fourier transform of a function with a modified argument if the transform of the function is known.(?)
$$\hat g (\omega)=\frac{1}{2} \hat f \left(\frac{\omega}{2}\right)=\frac{1}{2}e^{-\frac{\omega^4}{16}}$$
$$\hat h (\omega)=e^{i \frac{\omega}{2}} \hat g (\omega) =
\frac{1}{2}e^{i \frac{\omega}{2}-\frac{\omega^4}{16}}$$
$$\hat k (\omega)= \hat h (\omega-1)=\frac{1}{2}e^{i \frac{(\omega-1)}{2}-\frac{(\omega-1)^4}{16}}$$

A: There are indeed such laws!
Throughout, we will consider ourselves with a function $f(t)$ and its Fourier transform, and we will let $\gamma$ be a real constant.
We will also suppose $f$ has a defined transform and inverse transform where needed, denoted  $\mathscr{F} \left. [f(t)] \right|_\omega$ and  $\mathscr{F}^{-1} \left. [f(\omega)] \right|_t$ respectively.

(Generally speaking I'm borrowing naming and notation conventions from my own textbook/lectures on the topic from this semester if the sudden change in such confuses you. I also modify these slightly so that they make slightly more sense or are at least easier to remember. I find them a lot nicer to work with than what you presented, no offense intended.)

Scalar Laws: (we further assume $\gamma \neq 0$ here)
$$\mathscr{F} \left. [f(\gamma t)] \right|_\omega = \frac{1}{|\gamma |} \mathscr{F} \left. [f(t)] \right|_\omega$$
$$\mathscr{F}^{-1} \left. [f(\gamma \omega)] \right|_t = \frac{1}{|\gamma |} \mathscr{F}^{-1} \left. [f(\omega)] \right|_t$$

Translation Laws:
$$\mathscr{F} \left. [f(t - \gamma )] \right|_\omega = e^{-i2\pi \gamma \omega} \cdot \mathscr{F} \left. [f(t)] \right|_\omega$$
$$\mathscr{F}^{-1} \left. [f(\omega - \gamma )] \right|_t = e^{i2\pi \gamma \omega} \cdot \mathscr{F}^{-1} \left. [f(\omega)] \right|_t$$
Equivalently, following directly from these, one can also state,
$$\mathscr{F} \left. [e^{i2\pi \gamma \omega} \cdot f(t)] \right|_\omega = \mathscr{F} \left. [f(t)] \right|_{\omega - \gamma}$$
$$\mathscr{F}^{-1} \left. [e^{-i2\pi \gamma \omega} \cdot f(\omega)] \right|_t = \mathscr{F}^{-1} \left. [f(\omega)] \right|_{t - \gamma }$$

You can utilize these as necessary to manipulate your function into a "nicer" place. You might need to utilize multiple identities in sequence
For example, in finding the transform of $f(2t+1)$, you'd first want to note that $f(2t+1)=f(2(t+\frac{1}{2}))$. Then you can apply a translation identity with $\gamma = -\frac{1}{2}$, which gives you an $e^{(stuff)}$ factor times the transform of $f(2t)$. Then you apply the scaling identity to get a constant times the transform of $f(t)$.
Or, to just show the calculation, first we use the translation identity:
$$\mathscr{F} \left. [f(2t+1)] \right|_\omega = \mathscr{F} \left. \left[ f \left( 2 \left( t+\frac{1}{2} \right) \right)  \right] \right|_\omega = e^{-i2\pi \left( - \frac{1}{2} \right) \omega} \cdot \mathscr{F} \left. [f(2t)] \right|_\omega = e^{i\pi \omega}  \cdot \mathscr{F} \left. [f(2t)] \right|_\omega$$
Then we use the scaling identity on the transform we got:
$$\mathscr{F} \left. [f(2t)] \right|_\omega = \frac{1}{2} \cdot \mathscr{F} \left. [f(t)] \right|_\omega$$
Thus, overall,
$$\mathscr{F} \left. [f(2t+1)] \right|_\omega = \frac{1}{2} \cdot e^{i\pi \omega}  \cdot \mathscr{F} \left. [f(t)] \right|_\omega$$

I'll be the first to admit that it's entirely likely I made minor mistakes in the preceding statements of the identities/calculations. This was a mess to look at the LaTeX for and while I think everything checks out I could be completely wrong. Still, worst case, you could Google up "Fourier transform scalar translation identities" and pull up some results - or maybe even look in the index of your own text, OP, if you have one. I'd be surprised if a text didn't cover these identities. But yes, long story short, there are identities to cover cases such as those in the original post.


text:
Q: SQL Query Result delimit I have a problem like the image.
! Example.
I want to fetch the result of "forQ15aRowList".
I can get that by a simple SQL query.
I need the values [5,2,3,1,4,6] in an array so that I can use these values alone!

A: After receiving the SQL result, use explode() (php) or it's variants in whichever language you use to split the string by ',' into an array.
$array = explode(',', $result);

I do not believe it is possible (or a good idea at that) to do it in pure SQL.


text:
Q: Is there current consensus on the value of the Information Bottleneck Principle to understanding Deep Learning? In 2015, Tishby and Zaslavsky published a well-known paper claiming that the so-called Information Bottleneck Principle could be used to understand some behaviour of deep neural networks. In a more recent (April 2017) paper, Schwartz-Ziv and Tishby expand on these claims, in particular visualising some of the results.
Later in 2017, a critical paper by Saxe et al. was posted on the OpenReview website (with revisions as recent as 2 weeks ago). It claims that many of the claims made in the Schwartz-Ziv-Tishby paper don't hold up, or at least not in the generality claimed. In fact, if I am reading them right, they claim that the visualised result are an artifact of the choice of activation function -- something that should not matter according to the theory.
However, in the comments, Schwartz-Ziv and Tishby show up with a long list of commentary on the critical paper, saying that the criticism misses the mark. To this in turn the authors of the critical paper respond, but perhaps the conversation is not yet finished.
I am interested in starting a research project into the deep learning aspects of the information bottleneck, but worried that I am going to waste time learning something that has already been 'refuted'. Therefore, my question is:

What is the current expert opinion on the applicability of the Information Bottleneck Principle to understanding Deep Learning?

In particular, I am interested in research on the subject other than what I have linked, and commentary by experts (either directly or indirectly).

A: What I will say here is that the proofs that compression guarantees a better lower bound on generalization are accepted, but it's not widely accepted if this lower bound is practically relevant.
For example, a model with better compression might increase the lower bound from 1.0 to 1.5, but it might not be relevant if all models are already performing from 2.0-2.5.  Likewise, I think it's apparent that while compression is sufficient for some amount of guaranteed generalization, it's clearly not necessary (for example, invertible neural networks can get just fine generalization).
Probably the right conclusion is that the theory and analysis are a useful direction but it's unclear if it says anything about real networks.


text:
Q: Is it possible to use xlDialogSendMail to send a selected range as PDF? I'm trying to use xlDialogSendMail to send an email of a selected range as PDF but so far all it is doing is to send it as a workbook.
This is the original code:
Sub createSendPDF()

    Dim selectedRange As Range
    Dim folderPath As String
    Dim fileName As String

    fileName = InputBox("Please enter the name for this file", "PDF Name")

    Set selectedRange = ActiveSheet.Range("A1:H29")
    folderPath = ThisWorkbook.Path & "\temp_PDF\" & fileName

    selectedRange.ExportAsFixedFormat xlTypePDF, folderPath,
    xlQualityStandard, True, False, , , False

    Application.Dialogs(xlDialogSendMail).Show

End Sub

==========================
Problem resolved - Solutiom
Sub createSendPDF()

        Dim selectedRange As Range
        Dim folderPath As String
        Dim fileName As String

        fileName = InputBox("Please enter the name for this file", "PDF Name")

        Set selectedRange = ActiveSheet.Range("A1:H29")
        folderPath = ThisWorkbook.Path & "\temp_PDF\" & fileName

        With objMail

              .subject = subject
              .Attachments.Add folderPath & ".pdf"
              .display

        End With
    End Sub


text:
Q: [Today]-15 filter not working on external list I have an external list which is getting data from SQL Server. The table structure is as follows:
Name
InsertDate
Where InsertDate is the date when record was inserted.
I am trying to show only those records which were entered during last 15 days. So I used the following filter in that external list's view but still it returns all records.

where InsertDate is greater than or equal to [Today]-15

I have checked that all records in SQL Server have InsertDate set to 2013-10-10 which is basically 10 October 2013 and today is 19 Nov 2013 so basically [Today]-15 will return 2013-11-04 so it should not show any record as they were entered in October.

A: I did some experimentation a while back involving CAML operators with various field types, and it seems that all external columns get passed back to SP as Strings. You can use DateValue(InsertDate) in your formula to get it as a date (possibly using a calculated column if needed).


text:
Q: using string to identify the elements of a listView in android As the question suggests, is it possible to identify the elements of a listView using string ids or something similar to id? I know the typical signature is
public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {...}

But I need to have string ids or such. How would I do that?
Elaboration (sorry if still unclear)
The problem is my underlying list is a rotating list (i.e. circular list)
myList.addFirst(myList.deleteLast());

So the id/index of an item keeps actually floating around. But I need an id that is essentially a part of the element so that no matter the rotation, I can always retrieve the exactly element I mean to.

A: You can create an array of string ids for your listview. In onItemClick, you can use the position to assess your string array. As the list items and your string will be of same size, it should have one to one mapping.
I hope you understand what I mean..

A: If you want to have a String row ID kindly get the position then convert it into string.

A: Create an Array List of strings. Add the strings id for listview in it.
Add a hidden textview in your listitems.
Add all the string id from Array List to your listview hidden textview.
Access the string id as below :
public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
    TextView anyId = (TextView) view.findViewById(R.id.anyID);
    String val_Id = anyId.getText().toString();

Using ArrayList allows to handle dynamic listview.


text:
Q: Problem upgrading from Ubuntu 20.04 to 22.04lts My system got hung up and wouldn't move past a Microsoft font installer (hit OK and enter page) while upgrading to 22.04. So after waiting a very looong time with nothing happening I forced a reboot.
Now I get a white screen that says "Oh no! Something has gone wrong.  A problem has occurred and the system can't recover.  Please contact a system administrator".


text:
Q: Filtering connections by group or label The Google People API allows you to get a list of all contacts:
  resultset = service.people().connections().list(
  resourceName='people/me',
  pageSize=100,
  personFields=('names,emailAddresses,organizations,photos,phoneNumbers'))

Is there any way to filter the results by Contact Group? I couldn't find the source code for the list method ...
Thanks!

A: There isn't a way to filter by contact group in the list call. The two options you have are:

*

*Do a get on the contact group to get a list of personIds in the contact group. Then do a batchget to get all the personIds.

*Get all contacts and filter them yourself


text:
Q: PostgreSQL: How to pass and array to a function and using it in a query with the IN operator I have a problem, I want to pass an array to a postgres function and use that array so returns values in a SELECT IN clause.
But It shows me this error:
An error occurred executing the SQL command :
SELECT
      *
  FROM
      get_invtransferences_porders_fporders (300001300 , array [ 300093753 , 300094126 , 300093349 , 300093838 , 300094128 ] ...

ERROR: operator does not exist : integer = integer [ ]
  Hint : No operator matches the name and type of arguments. You may need to add explicit type conversions .
  Where : PL / pgSQL get_invtransferences_porders_fporders (numeric , integer []) function on line 8 FOR loop around rows of a SELECT

This is my function:
CREATE OR REPLACE FUNCTION public.get_invtransferences_porders_fporders(p_product_id numeric, P_INVTRANSFERENCES_IDS integer[])
  RETURNS SETOF record
  LANGUAGE plpgsql
AS
$body$
DECLARE
    PORDER_PRODUCT RECORD;
    COMPONENT RECORD;
    COMPONENT2 RECORD;
    COMPONENT3 RECORD;
BEGIN
    FOR PORDER_PRODUCT IN (
                      SELECT
                        'porder'                                                    AS "operation_type"
                        ,porders.id                                                 AS "porder_id"
                        ,porders.user_id                                            AS "porder_user_id"
                        ,(SELECT name FROM users WHERE users.id = porders.user_id)  AS "porder_user_name"
                        ,porders.delivery_datetime                                  AS "porder_delivery_datetime"
                        ,porders_products.requested                                 AS "product_requested"
                        ,porders_products.produced                                  AS "product_produced"
                        ,products.code                                              AS "product_code"
                        ,products.NAME                                              AS "product_name"
                        ,(
                          SELECT products.name
                          FROM products
                          WHERE id = product_components.component_product_id
                          )                                                         AS "component_product_name"
                        ,product_components.quantity                                AS "component_quantity"
                        ,(
                          SELECT products.um_id
                          FROM products
                          WHERE id = product_components.component_product_id
                          )                                                         AS "component_um_id"
                        ,(product_components.quantity / products.production_base) * porders_products.requested  AS "total"
                      FROM porders
                        ,porders_products
                        ,products
                        ,product_components
                      WHERE porders.id = porders_products.porder_id
                        AND porders_products.product_id = products.id
                        AND porders_products.product_id = product_components.product_id
                        AND porders.id IN (
                          SELECT rawm_audit_porders.porder_id
                          FROM rawm_audit_invtransferences
                            ,rawm_audits
                            ,rawm_audit_porders
                          WHERE rawm_audit_invtransferences.rawm_audits_id = rawm_audits.id
                            AND rawm_audit_porders.rawm_audits_id = rawm_audits.id
                            AND rawm_audit_invtransferences.invtransference_id IN
                            (
                              SELECT
                                invtransferences.id
                              FROM invtransferences
                                ,invtransferences_products
                                ,products
                              WHERE invtransferences.id = invtransferences_products.invtransference_id
                                AND products.id = invtransferences_products.product_id
                                AND invtransferences.id IN (P_INVTRANSFERENCES_IDS)
                            )
                          )
                        AND product_components.component_product_id = p_product_id
                 ) LOOP
        IF(PORDER_PRODUCT.porder_id IS NOT NULL)THEN
            RETURN NEXT PORDER_PRODUCT;
        END IF;
    END LOOP;
    RETURN;
END;
$body$
 VOLATILE
 COST 100
 ROWS 1000

I think the error it here `invtransferences.id IN (P_INVTRANSFERENCES_IDS)
This is the select that calls the function:
SELECT
      *
  FROM
      get_invtransferences_porders_fporders(300001300 , array[300093753, 300094126, 300093349, 300093838, 300094128] )
  AS
  (
       "operation_type" varchar,
       "porder_id" numeric,
       "porder_user_id" numeric,
       "porder_user_name" varchar,
       "porder_delivery_datetime" date,
       "product_requested" numeric,
       "product_produced" numeric,
       "product_code" varchar,
       "product_name" varchar,
       "component_product_name" varchar,
       "component_quantity" numeric,
       "component_um_id" varchar,
       "total" numeric
   )
  ORDER BY
      "porder_id";

EDIT: I remove the VARIADIC words that were in the function and in the select that calls the function
Can you hep me Please.

A: You don't need to declare your function as VARIADIC to pass array to it.
Try this
CREATE OR REPLACE FUNCTION xxx(
    p_product_id integer,
    P_INVTRANSFERENCES_IDS integer[])
  RETURNS SETOF record
  LANGUAGE sql
AS
$body$
    select p_product_id = ANY(P_INVTRANSFERENCES_IDS)
$body$;

Note there is no VARIADIC before P_INVTRANSFERENCES_IDS.
You also need to use ANY instead of IN to check membership in array.
SqlFiddle


text:
Q: How can we directly include vue-custom-element in HTML file as a Script? How can we directly include vue-custom-element in HTML file as a Script?
On the documentation they have mentioned we can directly include vue-custom-element globaly but I cannot find vue-custom-element.js file anywhere.
So How can we implement it directly in HTML file like  this
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="https://path/to/vue-custom-element.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/document-register-element/1.4.1/document-register-element.js"></script>

A: You're looking at the project's GitHub page, which contains vue-custom-element.js. The implication is that you host it yourself on your server.
Other third-party CDN sites like jsdelivr will host the file as https://cdn.jsdelivr.net/npm/vue-custom-element@3.3.0/dist/vue-custom-element.min.js (etc), and you could use those at your own risk. There may be other providers, but StackOverflow is not a good place to manage an exhaustive list of third-party resources.
You're already using jsdelivr for the vue package, but as with all third party hosting there's no guarantee that the site and file will continue to exist and will not replace your dependency with a nefarious alternative. (The HTML + SRI option provides a hash commitment that would help ensure you know what you're including, though.)


text:
Q: Bit Aligning for Space and Performance Boosts In the book Game Coding Complete, 3rd Edition, the author mentions a technique to both reduce data structure size and increase access performance. In essence it relies on the fact that you gain performance when member variables are memory aligned. This is an obvious potential optimization that compilers would take advantage of, but by making sure each variable is aligned they end up bloating the size of the data structure.
Or that was his claim at least.
The real performance increase, he states, is by using your brain and ensuring that your structure is properly designed to take take advantage of speed increases while preventing the compiler bloat. He provides the following code snippet:
#pragma pack( push, 1 )

struct SlowStruct
{
    char c;
    __int64 a;
    int b;
    char d;
};

struct FastStruct
{
    __int64 a;
    int b;
    char c;
    char d;
    char unused[ 2 ]; // fill to 8-byte boundary for array use
};

#pragma pack( pop )

Using the above struct objects in an unspecified test he reports a performance increase of 15.6% (222ms compared to 192ms) and a smaller size for the FastStruct. This all makes sense on paper to me, but it fails to hold up under my testing:

Same time results and size (counting for the char unused[ 2 ])!
Now if the #pragma pack( push, 1 ) is isolated only to FastStruct (or removed completely) we do see a difference:

So, finally, here lies the question: Do modern compilers (VS2010 specifically) already optimize for the bit alignment, hence the lack of performance increase (but increase the structure size as a side-affect, like Mike Mcshaffry stated)? Or is my test not intensive enough/inconclusive to return any significant results?
For the tests I did a variety of tasks from math operations, column-major multi-dimensional array traversing/checking, matrix operations, etc. on the unaligned __int64 member. None of which produced different results for either structure.
In the end, even if their was no performance increase, this is still a useful tidbit to keep in mind for keeping memory usage to a minimum. But I would love it if there was a performance boost (no matter how minor) that I am just not seeing.

A: Such hand-optimizations are generally long dead. Alignment is only a serious consideration if you're packing for space, or if you have an enforced-alignment type like SSE types. The compiler's default alignment and packing rules are intentionally designed to maximize performance, obviously, and whilst hand-tuning them can be beneficial, it's not generally worth it.
Probably, in your test program, the compiler never stored any structure on the stack and just kept the members in registers, which do not have alignment, which means that it's fairly irrelevant what the structure size or alignment is.
Here's the thing: There can be aliasing and other nasties with sub-word accessing, and it's no slower to access a whole word than to access a sub-word. So in general, it's no more efficient, in time, to pack more tightly than word size if you're only accessing, say, one member.

A: Visual Studio is a great compiler when it comes to optimization. However, bear in mind that the current "Optimization War" in game development is not on the PC arena. While such optimizations may quite well be dead on the PC, on the console platforms it's a completely different pair of shoes.
That said, you might want to repost this question on the specialized gamedev stackexchange site, you might get some answers directly from "the field".
Finally, your results are exactly the same up to the microsecond which is dead impossible on a modern multithreaded system -- I'm pretty sure you either use a very low resolution timer, or your timing code is broken.

A: Modern compilers align members on different byte boundaries depending on the size of the member. See the bottom of this.
Normally you really shouldn't care about structure padding but if you have an object that is going to have 1000000 instances or something the rule of the thumb is simply to order your members from biggest to smallest. I wouldn't recommend messing with the padding with #pragma directives.

A: It is highly dependent on the hardware.
Let me demonstrate:
#pragma pack( push, 1 )

struct SlowStruct
{
    char c;
    __int64 a;
    int b;
    char d;
};

struct FastStruct
{
    __int64 a;
    int b;
    char c;
    char d;
    char unused[ 2 ]; // fill to 8-byte boundary for array use
};

#pragma pack( pop )

int main (void){

    int x = 1000;
    int iterations = 10000000;

    SlowStruct *slow = new SlowStruct[x];
    FastStruct *fast = new FastStruct[x];

    //  Warm the cache.
    memset(slow,0,x * sizeof(SlowStruct));
    clock_t time0 = clock();
    for (int c = 0; c < iterations; c++){
        for (int i = 0; i < x; i++){
            slow[i].a += c;
        }
    }
    clock_t time1 = clock();
    cout << "slow = " << (double)(time1 - time0) / CLOCKS_PER_SEC << endl;

    //  Warm the cache.
    memset(fast,0,x * sizeof(FastStruct));
    time1 = clock();
    for (int c = 0; c < iterations; c++){
        for (int i = 0; i < x; i++){
            fast[i].a += c;
        }
    }
    clock_t time2 = clock();
    cout << "fast = " << (double)(time2 - time1) / CLOCKS_PER_SEC << endl;

    //  Print to avoid Dead Code Elimination
    __int64 sum = 0;
    for (int c = 0; c < x; c++){
        sum += slow[c].a;
        sum += fast[c].a;
    }
    cout << "sum = " << sum << endl;

    return 0;
}

Core i7 920 @ 3.5 GHz
slow = 4.578
fast = 4.434
sum = 99999990000000000

Okay, not much difference. But it's still consistent over multiple runs.So the alignment makes a small difference on Nehalem Core i7.

Intel Xeon X5482 Harpertown @ 3.2 GHz (Core 2 - generation Xeon)
slow = 22.803
fast = 3.669
sum = 99999990000000000

Now take a look...
6.2x faster!!!

Conclusion:
You see the results. You decide whether or not it's worth your time to do these optimizations.

EDIT :
Same benchmarks but without the #pragma pack:
Core i7 920 @ 3.5 GHz
slow = 4.49
fast = 4.442
sum = 99999990000000000

Intel Xeon X5482 Harpertown @ 3.2 GHz
slow = 3.684
fast = 3.717
sum = 99999990000000000

*

*The Core i7 numbers didn't change. Apparently it can handle
misalignment without trouble for this benchmark.

*The Core 2 Xeon now shows the same times for both versions. This confirms that misalignment is a problem on the Core 2 architecture.

Taken from my comment:
If you leave out the #pragma pack, the compiler will keep everything aligned so you don't see this issue. So this is actually an example of what could happen if you misuse #pragma pack.

A: The compiler is going to either optimize for size or speed and unless you explicitly tell it you wont know what you get.  But if you follow the advice of that book you will win-win on most compilers.  Put the biggest, aligned, things first in your struct then half size stuff, then single byte stuff if any, add some dummy variables to align.  Using bytes for things that dont have to be can be a performance hit anyway, as a compromise use ints for everything (have to know the pros and cons of doing that)
The x86 has made for a lot of bad programmers and compilers because it allows unaligned accesses.  Making it hard for many folks to move to other platforms (that are taking over).  Although unaligned accesses work on an x86 you take a serious performance hit.  Which is why it is important to know how compilers work both in general as well as the particular one you are using.
having caches, and as with the modern computer platforms relying on caches to get any kind of performance, you want to both be aligned and packed.  The simple rule being taught gives you both...in general.  It is very good advice.  Adding compiler specific pragmas is not nearly as good, makes the code non-portable, and doesnt take much searching through SO or googling to find out how often the compiler ignores the pragma or doesnt do what you really wanted.

A: On some platforms the compiler doesn't have an option: objects of types bigger than char often have strict requirements to be at a suitably aligned address. Typically the alignment requirements are identical to the size of the object up to the size of the biggest word supported by the CPU natively. That is short typically requires to be at an even address, long typically requires to be at an address divisible by 4, double at an address divisible by 8, and e.g. SIMD vectors at an address divisible by 16.
Since C and C++ require ordering of members in the order they are declared, the size of structures will differ quite a bit on the corresponding platforms. Since bigger structures effectively cause more cache misses, page misses, etc., there will be a substantial performance degradation when creating bigger structures.
Since I saw a claim that it doesn't matter: it matters on most (if not all) systems I'm using. There is a simple examples of showing different sizes. How much this affects the performance obviously depends on how the structures are to be used.
#include <iostream>

struct A
{
    char a;
    double b;
    char c;
    double d;
};

struct B
{
    double b;
    double d;
    char a;
    char c;
};

int main()
{
    std::cout << "sizeof(A) = " << sizeof(A) << "\n";
    std::cout << "sizeof(B) = " << sizeof(B) << "\n";
}

./alignment.tsk
sizeof(A) = 32
sizeof(B) = 24

A: The C standard specifies that fields within a struct must be allocated at increasing addresses.  A struct which has eight variables of type 'int8' and seven variables of type 'int64', stored in that order, will take 64 bytes (pretty much regardless of a machine's alignment requirements).  If the fields were ordered 'int8', 'int64', 'int8', ... 'int64', 'int8', the struct would take 120 bytes on a platform where 'int64' fields are aligned on 8-byte boundaries.  Reordering the fields yourself will allow them to be packed more tightly.  Compilers, however, will not reorder fields within a struct absent explicit permission to do so, since doing so could change program semantics.


text:
Q: Do the set of solutions of $y'' + y = \cos(t)$ form a vector space? I think the answer is NO, because it's not closed under scalar addition. For example, take two solutions $y_1, y_2$. Then
$$y_1''(t) + y_1(t) = \cos(t) $$
$$y_2''(t) + y_2(t) = \cos(t) $$
But,
$$(y''_1(t)+y_2''(t))+(y_1(t)+y_2(t))=2\cos(t).$$
So it's not closed under addition. Am I correct?

A: That is correct. The solutions of a homogeneous linear differential equation form a vector space, but not the solutions of an inhomogeneous linear differential equation.


text:
Q: "Any other keywords? for GGLContext.sharedInstance().configureWithError()" Cannot convert value of type 'NSError?.Type' to expected argument type 'NSError?'
I created a variable for NSError, but it used to be "var error = NSError?" but it doesn't work i tried to make it "var error = NSError?.self" it doesn't return any error. But when i called it in the "GGLContext.sharedInInstance().configurationWithError(&error)" it gives me an error of "Cannot convert value of type 'NSError?.Type' to expected argument type 'NSError?'" what should i do.
i tried "var error = NSError?.self", "var error = Error.Self"
and called it to the configurationWithError(&error) yet gives me the same error
import UIKit
import Google
import GoogleSignIn

class LoginViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

//        var error = Error?.self
//        GGLContext.sharedInstance().configureWithError(error)
        var error = NSError?.self
        GGLContext.sharedInstance().configureWithError(&error)
        let signInButton = GIDSignInButton(frame: CGRect(x: 0, y: 0, width: 100, height: 50))
        signInButton.center = view.center
        view.addSubview(signInButton)
    }

}

//THIS IS THE FULL CODE IN MY VIEWCONTROLLER

Cannot convert value of type 'NSError?.Type' to expected argument type 'NSError?'This is the Error.


text:
Q: Merging on columns with dask I have a simple script currently written with pandas that I want to convert to dask dataframes.
In this script, I am executing a merge on two dataframes on user-specified columns and I am trying to convert it into dask.
def merge_dfs(df1, df2, columns):
    merged = pd.merge(df1, df2, on=columns, how='inner')
...

How can I change this line to match to dask dataframes?

A: The dask merge follows pandas syntax, so it's just substituting call to pandas with a call to dask.dataframe:
import dask.dataframe as dd

def merge_dfs(df1, df2, columns):
    merged = dd.merge(df1, df2, on=columns, how='inner')
# ...

The resulting dataframe, merged, will be a dask.dataframe and hence may need computation downstream. This will be done automatically if you are persisting the data to a file, e.g. with .to_csv or with .to_parquet.
If you will need the dataframe for some computation and if the data fits into memory, then calling .compute will create a pandas dataframe:
pandas_df = merged.compute()


text:
Q: Peticion POST a Laravel desde MEAN Trabajando con MEAN tengo una petición en un script que hace una consulta POST a un servidor externo, que está desarrollado en Laravel.
MEAN
var request = require('ajax-request');

request.post({
    url: 'http://127.0.0.1:8000/API',
    data: {'keywords' : 'hola'},
    headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}
});

Y cuando ejecuto el servidor NODE, me sale el siguiente error:
request.post({
    ^
ReferenceError: $ is not defined
at Object.<anonymous> (C:\Users\user\Desktop\project\server\API.js:2:9)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\user\Desktop\project\server\index.js:82:14)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)

A: El problema está en que estás intentando utilizar la librería externa jQuery cuando no la tienes, por eso el error hace referencia al $.
Para solucionarlo sin necesidad de importar esta librería, basta con utilizar las funciones nativas:
document.querySelector("meta[name='_csrf_header']").getAttribute("content")
Así que quedaría:
let request = require('ajax-request'),
    csrfToken = document.querySelector("meta[name='_csrf_header']").getAttribute("content");

request.post({
    url: 'http://127.0.0.1:8000/API',
    data: {'keywords' : 'hola'},
    headers: { 'X-CSRF-TOKEN': csrfToken}
});


text:
Q: 'Decryption Failed: No Data' with GPG 3.0.0 and Attachmate Reflection FTP Client Team,
I'm sharing some knowledge.
I was trying to download some GPG encrypted .txt files from an FTP (using Attachmate Reflection FTP) and then decrypt them. I kept receiving the error 'Decryption Failed: No Data'
When I clicked on the hyperlink for 'Diagnostics' I saw the following 'indeterminate length for invalid packet type...'
The problem was not GPG, but something with my FTP Client.
I solved my problem by going to Tools in the FTP Client and changed 'Transfer Method' from 'SMART' to 'Binary'

A: As seen above, the solution was going to Tools in the FTP Client and changing 'Transfer Method' from 'SMART' to 'Binary'


text:
Q: SQL Query optimisation for PS I am currently creating my webshop for my local parts store using prestashop 1.7.8.6
I developed scripts on myself and have successfully made the website work correctly.
But, with 2 millions rows of products including each 30 columns and multiple joins, i can't have a decent loading time on getProducts query.
Even with indexes and cache...
I use a simple query on prestashop product table and join id products from car filter table to match ps_product table.
I would like to know if it would be better to create tables for each vehicle using an id, and fill it with ps_product data, to use this table only instead of using multiple joins.
I'am using innoDB as engine.
Thanks

A: Prestashop does not have great performance with such a huge amount of data/products, as you have seen using native methods, so the best option is to strengthen your MySQL server.
Consider using one or more dedicated machines for SQL with replication),
by saving your data in external tables or store it to some distributed NoSQL system built to deal with large amount of data (like Elasticsearch or similar) so you can scale it easily and you can write your own code/module to retrieve what you need.


text:
Q: Jogando parâmetro na url Tenho um Projeto em Codeigniter que será em duas linguagens, porém eu preciso permitir esta alteração de linguagem somente na URL do projeto;
Ou seja, ao acessar o dominio.com.br/pt ele deverá manter como base url /pt em todas as páginas e consecutivamente mesma coisa com /en;
Alguém já precisou realizar esta inclusão? Segue abaixo o código do meu .htaccess, config e constants:
Htaccess:
<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteCond %{HTTP_HOST} ^www\.(.*)
    #RewriteRule (.*) http://%1/$1  [R=301,L]

    RewriteBase /cliente/em_desenvolvimento/back/mauricio/

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</ifModule>

Config:
$config['base_url'] = 'http://192.168.110.4/cliente/em_desenvolvimento/back/mauricio/';

Constants:
define('PATH_FRONT_END', $_SERVER['DOCUMENT_ROOT'] . '/cliente/em_desenvolvimento/back/mauricio/');
         define('PATH_FRONT_END_UPLOAD', $_SERVER['DOCUMENT_ROOT'] . 'cliente/em_desenvolvimento/back/mauricio/web_files/uploads/');

Acredito que possa ser realizado algo no routes, porém não faço ideia de como isso possa ser feito.

A: Foi criada uma constante para jogar o idioma na url:
                define('base_path', 'cliente/em_desenvolvimento/back/mauricio/');
                $uri_path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
                $uri_path = str_replace(base_path, '', $uri_path);
                $uri_segments = explode('/', $uri_path);

                switch ($uri_segments[1]) {
                    case 'pt':
                        define('idioma_site', 'pt');
                    break;
                    case 'es':
                        define('idioma_site', 'es');
                    break;
                    case 'en':
                        define('idioma_site', 'en');
                    break;
                    case 'cms':
                    break;
                    default:
                        header('location: http://192.168.110.4/cliente/em_desenvolvimento/back/mauricio/pt');
                        //header('location: http://192.168.110.4/cliente/em_desenvolvimento/back/bernardo/pt');
                        exit();
                    break;
                }


text:
Q: Iframe in sencha Touch I need to use a facebook like button iframe in my Android App...if I use this code I see it on my PC Desktop but I don't see anything in Android.
Do you know why and if exist a method to display the like button in Android?
I'm Using Sencha Architect and Touch 2.3
Thank you

A: It is as you say you.
This is my code:
htmlStrBase1 = '';
component.add({
        xtype: 'container',
        id: 'fb-root',
        width: 50,
        height: 20,
        flex:1,
    listeners: {
        initialize : function (container) {
            (function(d, s, id) {
                var js, fjs = d.getElementsByTagName(s)[0];
                if (d.getElementById(id)) return;
                js = d.createElement(s); js.id = id;
                js.src = "//connect.facebook.net/en_US/all.js";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));
            container.setHtml(htmlStrBase);
        }
    }
});


text:
Q: New magento website + old database I've set up my new magento website and I am in need to get all the products to this website. I do not need any other data! The problem is I only have the database of previous shop and no product csv file etc.
Can anyone suggest which parts I should move to a seperate .sql from that database dump to successfully inject previous shop's products to my new database?

A: You can try to install a clean magento instance over your old database, then export the products to csv an import them in the new shop.
I tried once moving only certain tables from one website to an other and that backfired instantly because of different attribute ids.


text:
Q: Delete Files from .tar Archive while Extracting I am wondering whether I can incrementally delete the contents of an archive (at a minimum .tar, though ideally also .tar.xz or similar) as I am extracting them all. The ultimate goal is to remove the necessity to have twice the space required for the files available while downloading and extracting.
I have looked around a bit, and it seems tar has a --remove-files option, which is compatible with archiving, but this only seems to work when creating an archive. The --delete option seems to work when extracting as well, but it only seems to work with .tar. Would it in this case be possible to replace the .tar.xz with an unarchived .tar in-place and then proceed to obtain the list of contents somehow and iteratively extract them with --delete? Or is there a better way of doing this?


text:
Q: How to skip debugging all of std namespace in Visual C++ 2013? I want to skip debugging all of std:: namespace C++ by default, without  code window changing to std:: code , authored by Microsoft as xstring . This question is similar to :
How to skip common classes in VS 2008 when stepping in? and
Auto-skip STL functions during step-by-step debugging in MSVC++2010 .
The only difference is that their solution are for visual studio 2008 and 2010. I tried it myself , and it works on visual studio 2010, but I want to do it on visual studio 2013. The same solution doesn't work on visual studio 2013. I tried changing all values in registry equal to :
_RTC_CheckEsp

to
std\:\:.*=NoStepInto

, some of these were values were for visual studio 12.0 ( which is visual studio 2013) , but after restarting visual studio 2013, nothing changed.  On the contrary this works on Visual Studio 2010. "Just My Code" option is  turned on.

A: As Hans Passant said, Edit the .natstepfilter files to add exclusions.
create a new file  for example nostd.natstepfilter and write in it as in Has the VS2012 NativeDE\StepOver registry entry that prevents step-into for specific functions changed format?
 <?xml version="1.0" encoding="utf-8"?>
 <StepFilter xmlns="http://schemas.microsoft.com/vstudio/debugger/natstepfilter/2010">
   <Function><Name>std::.*</Name><Action>NoStepInto</Action></Function>
</StepFilter>

For a 64-bit windows, move the file to :
 C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers

while for a 32-bit windows to:
 C:\Program Files\Microsoft Visual Studio 12.0\Common7\Packages\Debugger\Visualizers

or whatever you customized you installation to. Please note that natstepfilter does not work in mixed mode (mixing native and managed code). Ensure that your project debugging settings is set to Native only


text:
Q: How do I use a callable object as a method definition? I know it's possible to define a function and use it as a method:
def method(*args, **kwargs):
    print "%r %r" % (args, kwargs)

class Test(object):
    method1 = method

t = Test()
t.method1()  # (<__main__.Test object at 0x10705a4d0>,) {}

I'd like to do the same thing with callable objects, like this:
class Method(object):
    __call__ = method

class Test(object):
    method1 = Method()

However, when I do this, the self argument of Method.__call__ is the method itself (which is normal), but the self argument of the Test instance is lost.
t = Test()
t.method1()  # (<__main__.Method object at 0x10703f110>,) {}

Is it possible to have the self argument passed as the second argument to Method.__call__?

A: By wrapping that function method in a class you are effectively preventing the mechanism that binds an object to a function and thus creates a method. The way this works is that regular python functions are descriptors.
To summarize the docs: When you write the following code:
some_instance.some_function()

The some_functions __get__ method is called with some_instance as the first parameter. The __get__ method then returns a bound method object, that remembers the instance. Later, when the bound method object's __call__ method is called, it passes the saved instance as a first parameter.
We can reimplement that behaviour like this:
def method(*args, **kwargs):
    print("%r %r" % (args, kwargs))

class BoundMethod(object):
    # the bound method remembers the instance and the function
    def __init__(self, instance, function):
        self.instance = instance
        self.function = function

    # when the bound method is called, it passes the instance
    def __call__(self, *args, **kwargs):
        return self.function(self.instance, *args, **kwargs)

class Method(object):
    # the __get__ method assembles a bound method consisting of the
    # instance it was called from and the function
    def __get__(self, instance, cls):
        return BoundMethod(instance, method)

class Test(object):
    method1 = Method()

t = Test()
t.method1()  # (<__main__.Test object at 0x7f94d8c3aad0>,) {}

In your case Method is not a descriptor. So, when internally the __call__ property (which is a function) is requested it is bound to an object of the containing class (Method).
I am not sure if this is useful, as this example is just a simplified version of what happens under the hood anyway.
Note: in this example:
class C:
    def function(self): pass

print(C.function)
print(C().function)

The first print shows us, that an unbound method literally is called <unbound method C.function> while a bound method is called <bound method C.function of ...>.
In python3 however the first print shows us that unbound methods are just the unchanged functions we defined in the class.

A: Yes: make the method a descriptor—which, as already noted by Wombatz, is the mechanism used by normal method binding.
class Method(object):
  def __get__(self,obj,cls):
    def method(*args, **kwargs):
      print type(obj)   # to illustrate what object we get
      print type(self)  # we have the Method too
      print "%r %r" % (args, kwargs)
    return method

Notes:

*

*It would also be possible to forward to the __get__ on a function and produce a legitimate bound method object, but this way you have self and obj available.

*obj is None if the method is looked up on the class itself (Test.method1, rather than Test().method1); you can decide separately what to do (with cls) in that case.


text:
Q: Wait for all elements to exist I am using a plugin that generates dynamic content. I need to modify the content so I am using this function to wait until the elements exist:
var counter = 50;
var checkExist = setInterval(function () {
    console.log(counter);
    counter--
    if ($('.title').length || counter === 0) {

        // Insert font awesome arrow
        $('.title').append('');

        clearInterval(checkExist);
    }
}, 200);

This works perfectly fine for one element but I need to use it on multiple elements but it only runs once.
var counter = 50;
var checkExist = setInterval(function () {

    counter--
    if ($('.title').length || counter === 0) {

        // Insert font awesome arrow
        $('.title').append('');

        clearInterval(checkExist);
    }

    if ($('.cartcount').length || counter === 0) {

        // Set text to 0
        $('.cartcount').text('0');

        clearInterval(checkExist);
    }

}, 200);

How can I clean this up so I can wait for any number of elements to exist before executing my code?

A: As Lapskaus suggested, I was able to achieve what I needed with the following code.
// Wait for Menu elements to be created
var waitForEl = function (selector, callback) {
    if (!jQuery(selector).size()) {
        setTimeout(function () {
            window.requestAnimationFrame(function () { waitForEl(selector, callback) });
        }, 100);
    } else {
        callback();
    }
};

waitForEl('.title', function () {
    // Insert font awesome arrow
    $('.title').append('');
});

waitForEl('.cartcount', function () {
    // Set text to 0
    $('.cartcount').text('0');
});


text:
Q: Is this a bug in the boost library I'm compiling a project with autotools and am using g++ in version gcc version 5.3.1 and boost version 1_63. After aclocal, autoconf, autoheader, automake --add-missing, I ran configure with some options, which succedded and build make a Makefile. Running make fails and gives me the error (excerpt):
In file included from /usr/local/include/boost/ratio/ratio.hpp:46:0,
             from /usr/local/include/boost/chrono/duration.hpp:41,
             from /usr/local/include/boost/chrono/time_point.hpp:33,
             from /usr/local/include/boost/thread/lock_types.hpp:22,
             from /usr/local/include/boost/thread/pthread/mutex.hpp:16,
             from /usr/local/include/boost/thread/mutex.hpp:16,
             from src/cosupport-initializer/cpp/BasicInitializer.cpp:39:
/usr/local/include/boost/integer_traits.hpp:83:46: error: 'CHAR_MIN' was not declared in this scope
public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
                                          ^
/usr/local/include/boost/integer_traits.hpp:83:56: error: 'CHAR_MAX' was not declared in this scope
public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
                                                    ^
/usr/local/include/boost/integer_traits.hpp:83:64: error: template argument 2 is invalid
public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
                                                            ^
/usr/local/include/boost/integer_traits.hpp:83:64: error: template argument 3 is invalid
/usr/local/include/boost/integer_traits.hpp:89:53: error: 'SCHAR_MIN' was not declared in this scope
public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
                                                 ^
/usr/local/include/boost/integer_traits.hpp:89:64: error: 'SCHAR_MAX' was not declared in this scope
 public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
                                                            ^
/usr/local/include/boost/integer_traits.hpp:89:73: error: template argument 2 is invalid
public detail::integer_traits_base<signed char, SCHAR_MIN, SCHAR_MAX>
                                                                     ^
/usr/local/include/boost/integer_traits.hpp:89:73: error: template argument 3 is invalid
/usr/local/include/boost/integer_traits.hpp:95:58: error: 'UCHAR_MAX' was not declared in this scope
public detail::integer_traits_base<unsigned char, 0, UCHAR_MAX>
                                                      ^
/usr/local/include/boost/integer_traits.hpp:95:67: error: template argument 3 is invalid
public detail::integer_traits_base<unsigned char, 0, UCHAR_MAX>
                                                               ^
/usr/local/include/boost/integer_traits.hpp:131:47: error: 'SHRT_MIN' was not declared in this scope
public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
                                           ^
/usr/local/include/boost/integer_traits.hpp:131:57: error: 'SHRT_MAX' was not declared in this scope
public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
                                                     ^
/usr/local/include/boost/integer_traits.hpp:131:65: error: template argument 2 is invalid
public detail::integer_traits_base<short, SHRT_MIN, SHRT_MAX>
                                                             ^
/usr/local/include/boost/integer_traits.hpp:131:65: error: template argument 3 is invalid
/usr/local/include/boost/integer_traits.hpp:137:59: error: 'USHRT_MAX' was not declared in this scope
public detail::integer_traits_base<unsigned short, 0, USHRT_MAX>
                                                       ^
/usr/local/include/boost/integer_traits.hpp:137:68: error: template argument 3 is invalid
public detail::integer_traits_base<unsigned short, 0, USHRT_MAX>
                                                                ^
/usr/local/include/boost/integer_traits.hpp:143:45: error: 'INT_MIN' was not declared in this scope
public detail::integer_traits_base<int, INT_MIN, INT_MAX>
                                         ^
/usr/local/include/boost/integer_traits.hpp:143:54: error: 'INT_MAX' was not declared in this scope
public detail::integer_traits_base<int, INT_MIN, INT_MAX>
                                                  ^
/usr/local/include/boost/integer_traits.hpp:143:61: error: template argument 2 is invalid
public detail::integer_traits_base<int, INT_MIN, INT_MAX>
                                                         ^
/usr/local/include/boost/integer_traits.hpp:143:61: error: template argument 3 is invalid
/usr/local/include/boost/integer_traits.hpp:149:57: error: 'UINT_MAX' was not declared in this scope
public detail::integer_traits_base<unsigned int, 0, UINT_MAX>
                                                     ^
/usr/local/include/boost/integer_traits.hpp:149:65: error: template argument 3 is invalid
public detail::integer_traits_base<unsigned int, 0, UINT_MAX>
                                                             ^
/usr/local/include/boost/integer_traits.hpp:155:46: error: 'LONG_MIN' was not declared in this scope
public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
                                          ^
/usr/local/include/boost/integer_traits.hpp:155:56: error: 'LONG_MAX' was not declared in this scope
public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
                                                    ^
/usr/local/include/boost/integer_traits.hpp:155:64: error: template argument 2 is invalid
public detail::integer_traits_base<long, LONG_MIN, LONG_MAX>
                                                            ^
/usr/local/include/boost/integer_traits.hpp:155:64: error: template argument 3 is invalid
/usr/local/include/boost/integer_traits.hpp:161:58: error: 'ULONG_MAX' was not declared in this scope
public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>
                                                      ^
/usr/local/include/boost/integer_traits.hpp:161:67: error: template argument 3 is invalid
public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>

This means e.g. that in /usr/local/include/boost/integer_traits.hpp on line 83, the constructor initialization fails:
template<>
class integer_traits<char>
  : public std::numeric_limits<char>,
    public detail::integer_traits_base<char, CHAR_MIN, CHAR_MAX>
{ };

This means in the file /usr/local/include/boost/integer_traits.hpp and headers included in it, there's no definition of CHAR_MIN. So this is a bug in boost? Or what am I missing here?
UPDATE
The relevant code excerpts. Before the move:
#include <CoSupport/compatibility-glue/nullptr.h>
#include <CoSupport/Initializer/BasicInitializer.hpp>
#include <boost/thread/mutex.hpp>
#include <cassert>

namespace CoSupport {
...
}

After the move:
#include <boost/thread/mutex.hpp>
#include <CoSupport/compatibility-glue/nullptr.h>
#include <CoSupport/Initializer/BasicInitializer.hpp>
#include <cassert>

namespace CoSupport {
...
}

A:
This means in the file /usr/local/include/boost/integer_traits.hpp and headers included in it, there's no definition of CHAR_MIN

Which is as it should be - CHAR_MIN is defined in <climits>.

So this is a bug in boost? Or what am I missing here?

With 99% certainty, this is not a bug in boost. You probably have some include files of your own, in your project's include directories, masking climits or limits.h, or possibly another file which interger_traits.hpp includes and itself includes climits or limits.h.