text:
Q: Outlook VSTO AddIn for Meetings We have created a VSTO addin for Outlook Meetings.
As part of this we trap on the SendEvent of the message on the FormRegionShowing event:
_apptEvents.Send += new Microsoft.Office.Interop.Outlook.ItemEvents_SendEventHandler(_apptEvents_Send);

The method _apptEvents_Send then tests on a couple of properties and exits where appropriate.
private void _apptEvents_Send(ref bool Cancel)
{
    if (!_Qualified)
    {
        MessageBox.Show("Meeting has not been qualified", "Not Qualified Meeting", MessageBoxButtons.OK, MessageBoxIcon.Information);
        chkQualified.Focus();
        Cancel = true;
    }
}

The problem that we're having is that some users' messages get sent twice. Once when the meeting is sent and a second time when the user re-opens outlook.
I've looked for memory leaks, thinking that something might not be getting disposed of properly, and have added explicit object disposal on all finally calls to try and make sure resources are managed, but still getting the functionality incosistently across the organization. i.e. I never encountered the problem during development, nor other developers during testing. All users are up to date on framework (3.5 SP1) and Hotfixes for Outlook.
Does anyone have any ideas on what might be causing this?
Any ideas anyone might have would be greatly appreciated.

A: i'm no pro, but I've had trouble in the past when doing outlook automation due to people's send mail settings.
For example, my mail only sends when i force a send/receive cycle. Most people have outlook to send immediately though and I remember some headaches when someone first asked for the really simple automation scripts.
see if this is something that all the developers have in common and the user's may have set up differently.

A: Why do you use Microsoft.Office.Interop.Outlook.ApplicationEvents_10.Send Event instead of adding the given handler over and over again.
On startup method of your vsto addon, just add :
((MSOutlook.ApplicationEvents_10_Event)_OutlookApp).ItemSend += new Microsoft.Office.Interop.Outlook.ApplicationEvents_10_ItemSendEventHandler(Utils_ItemSend);

void Utils_ItemSend(object Item, ref bool Cancel)
{
    //Do your operation here.
}

A: You are doing minor mistaken. Change your code as following
 private void _apptEvents_Send(ref bool Cancel)
 {
    if (!_Qualified)
    {
    MessageBox.Show("Meeting has not been qualified", "Not Qualified Meeting",
    MessageBoxButtons.OK, MessageBoxIcon.Information);
    chkQualified.Focus();
    Cancel = true;
    return; // need to add this one line
  }
}


text:
Q: Making my first project in java So after like 2 hours of Java guides I started making my first project, a simple rock paper scissors game, but then I found a problem. I want to add 1 point to the winner of the game each time you pick rock paper or scissors and you win and its the only thing I need to do before its completed (I am new to Java).
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main extends JFrame {

    private static final long serialVersionUID = 1L;

    private static String Default = "Rock,Paper,Scissors";
    private static JLabel update;
    private static JLabel userScore;
    private static JLabel pcScore;
    private static Container panel;
    private static int userCounter;

    public static int getUserCounter() {
        return userCounter;
    }

    public static void setUserCounter(int userCounter) {
        Main.userCounter = userCounter + userCounter;
    }

    public static int getPcCounter() {
        return pcCounter;
    }

    public static void setPcCounter(int pcCounter) {
        Main.pcCounter = pcCounter + pcCounter;
    }

    private static int pcCounter;
    private static final int bwidth = 90;
    private static final int bheight = 25;
    private static Random random;
    private static final String ROCK = "Rock";
    private static final String PAPER = "Paper";
    private static final String SCISSORS = "Scissors";
    private static JButton rock;
    private static JButton paper;
    private static JButton scissors;

    public Main() {
        super("Simple Game :D");
        panel = new Container();
        getContentPane().add(panel);

        userScore = new JLabel();
        userScore.setText("Your Score " + getUserCounter());
        userScore.setBounds(300, 50, 100, 40);

        pcScore = new JLabel();
        pcScore.setText("Pc Score " + getPcCounter());
        pcScore.setBounds(430, 50, 100, 40);

        update = new JLabel(Default);
        update.setBounds(325, 0, 400, 40);
        update.enableInputMethods(false);
        update.setBackground(Color.BLUE.brighter());

        panel.add(update);
        panel.add(Rock());
        panel.add(Paper());
        panel.add(Scissors());

        panel.add(userScore);
        panel.add(pcScore);

    }

    public Component Rock() {
        rock = new JButton("Rock");
        rock.setBounds(350, 100, bwidth, bheight);
        rock.setBackground(Color.gray.brighter());
        rock.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Game(ROCK);
            }
        });
        return rock;
    }

    public Component Paper() {
        paper = new JButton("Paper");
        paper.setBounds(350, 130, bwidth, bheight);
        paper.setBackground(Color.WHITE);
        paper.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Game(PAPER);
            }
        });
        return paper;
    }

    public Component Scissors() {
        scissors = new JButton("scissors");
        scissors.setBounds(350, 160, bwidth, bheight);
        scissors.setBackground(new Color(174, 166, 166));
        scissors.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                Game(SCISSORS);
            }
        });
        return scissors;
    }

    public String Pc() {
        String pc = "";
        random = new Random();
        int choice = 1 + random.nextInt(3);
        if (choice == 1) {
            pc = ROCK;
        } else if (choice == 2) {
            pc = PAPER;
        } else if (choice == 3) {
            pc = SCISSORS;
        }
        return pc;
    }

    public void Game(String user) {
        String pc = Pc();
        int winner = 0;
        if (user == ROCK && pc == ROCK) {
            update.setText(user + " vs " + pc + " Its a Draw!!");
        } else if (user == ROCK && pc == PAPER) {
            setPcCounter(1);
            update.setText(user + " vs " + pc + " Pc Wins!! ");

        } else if (user == ROCK && pc == SCISSORS) {
            setUserCounter(1);
            update.setText(user + " vs " + pc + " You Win!!");

            // PAPER
        } else if (user == PAPER && pc == PAPER) {
            update.setText(user + " vs " + pc + " Its a Draw!!");
        } else if (user == PAPER && pc == ROCK) {
            update.setText(user + " vs " + pc + " You Win!!");
            userCounter += 1;
        } else if (user == PAPER && pc == SCISSORS) {
            update.setText(user + " vs " + pc + " Pc Wins!!");
            pcCounter += 1;
            // SCISSORS
        } else if (user == SCISSORS && pc == SCISSORS) {
            update.setText(user + " vs " + pc + " Its a Draw!!");
        } else if (user == SCISSORS && pc == ROCK) {
            update.setText(user + " vs " + pc + " Pc Wins!!");
            pcCounter += 1;
        } else if (user == SCISSORS && pc == PAPER) {
            update.setText(user + " vs " + pc + " You Win!!");
            userCounter += 1;
        } else if (user == null || pc == null) {
            System.exit(0);
        }

    }
}

A: You have an error in
public static void setUserCounter(int userCounter) {
    Main.userCounter = userCounter + userCounter;
}

Should be
Main.userCounter += userCounter;

or
Main.userCounter = Main.userCounter + userCounter;

Same thing for:
public static void setPcCounter(int pcCounter) {
    Main.pcCounter = pcCounter + pcCounter;
}

Also in some places at the bottom, you use directly the userCounter variable without using setUserCounter();
} else if (user == SCISSORS && pc == PAPER) {
update.setText(user + " vs " + pc + " You Win!!");
userCounter += 1;

Keep your style consistent and use setUserCounter();
Note that in objects, when there is myVar Object field and myVar argument, the Object field can be accessed by typing "this.myVar" to differentiate it from the argument which is "myVar"

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why am I getting a conversion function error? I have to read in an external file called text.txt. The file could contain a lot of data (and def > 83 chars) and I want to ignore the spaces. Then I need to get the total amount of chars in the file (not incl. spaces). I have to use strlen. I am getting a conversion type error which is confusing because I thought strlen returns an int. The error is on strlen(inputString) and more specifically on (inputString).
int main() {
fstream inFile;
string inputString;

inFile.open("text.txt", ios::in);

if (inFile) {
    getline(inFile, inputString, ' ');
    while (inFile)
    {
        int tempStringLength = strlen(inputString);
        int total = 0;
        total += tempStringLength;
    }
}
else
    cerr << "Unable to open file text.txt";
    exit(1);

    return 0;

}
I expect the total to be the total # of chars in the file.

A: The strlen function returns a size_t result which is usually equivalent to unsigned int on your platform.
Also, I haven't tried your code but it reads like an infinite loop. You might want to rearrange it like the following:
int main() {

fstream inFile;
string inputString;

inFile.open("text.txt", ios::in);

unsigned int total = 0;
if (inFile) {
    while (inFile)
    {
        getline(inFile, inputString, ' ');

        unsigned int tempStringLength =inputString.length();
        total += tempStringLength;

        //Or maybe combine the two previous statements into:
        //total += inputString.length();
    }
}
else
    cerr << "Unable to open file text.txt";
    exit(1);

    return 0;
}

P.S.: Also, strlen expects a char[] as input. I've changed that to be string.length() instead.


text:
Q: Node.js is installed but npm -v not working in ubuntu I have installed node.js on my machine, while doing node -v, the system is returning the version as 10.18.1 which is expected. But while doing npm -v , I am getting command not found.
I knew that node and npm install together then why node -v is working and not npm?
Note: I do not want to change node version. I have seen, that if I do install npm, the system changing the node version also


text:
Q: batch as 15 minutes in YAML for Build pipeline I am creating a Build pipeline in Azure Devops (earlier VSTS), and want build to get triggered  in BATCH every 15 minutes. If no merge received in repo then no build should be created.
Below is what I am referring to
trigger:
    batch: boolean # batch changes if true, start a new build for every push if false
branches:
    include: [ string ] # branch names which will trigger a build
    exclude: [ string ] # branch names which will not
paths:
    include: [ string ] # file paths which must match to trigger a build
    exclude: [ string ] # file paths which will not trigger a build code here

This code snippet I took from https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema
trigger:
    batch: true
branches:
    include:
    - master

pool:
  vmImage: 'Ubuntu-16.04'

variables:
  buildConfiguration: 'Release'

steps:
- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

*

*Only if I receive a  merge in current repo NOW then all rest merges in current repo in another next 15 min would be part of same build. How to add 15 min detail in my YAML document?

*After current build is Complete and until next merge is received in repo, 15 minutes time should not START? How do I code this in my YAML document?


text:
Q: Let $S$ be containing $n$ distinct points of $\mathbb{R}^{2}$, then prove $\mathbb{R}^{2}-S \simeq \vee_{i=1}^{n}S^{1}$ In order to solve the fundamental group of $\mathbb{R}^{2}$ minus $n$ distinct points i stumbled across the following problem :
I'd have liked to create the following homopoty equivalence between $S^{1}$ and just $\mathbb{R}^{2}$ minus a point $w$ and then iterate the process :
$$\mathbb{R}^{2}-w \overset{r}{\longmapsto} S^{1} \overset{i}{\longmapsto} \mathbb{R}^{2}-w$$
Such that $r(v) =\frac{v-w}{\|v-w\|_{2}}$ and $i(v) =\frac{v-w}{\|v-w\|_{2}} +w$  for any $v \in \mathbb{R}^{2}-w$.
And then define $H : (\mathbb{R}^{2}-w) \times [0,1] \longmapsto (\mathbb{R}^{2}-w)$ such that $H(v,t) = (1-t)(\frac{v-w}{\|v-w\|_{2}} + w)+tv$.
The problem however is that the map is not well defined since there are values of $t$ for which $(1-t)(\frac{v-w}{\|v-w\|_{2}} + w)+tv = w$.
What am I missing here ? Another approach I tried is : given the $n$ points define $n$ disjoint balls around them and try something as suggested here but I was unable to show that $\mathbb{R}^{2}$ minus these points retracts onto the boundary of these balls.
The problem has been asked here as well without direct proof, I think the more accurate proof and similar to my idea is this. However, instead of simply understand the solution given I'd like to understand the problem in mine in order to comprehend what is wrong, which is why opened the question.

A: You did a little mistake in the definition of $H(v,t)$.
Consider the stadard retraction from $\mathbb R^2 \ \backslash \{(0,0)\}$ to $S^1$ given by:
$$
F:\mathbb R^2 \ \backslash \{(0,0)\}\times [0,1] \rightarrow S^1\subset \mathbb R^2 \ \backslash \{(0,0)\}, \quad F(v,t) = \frac{v}{||v||}(1-t) + tv
$$
The map you are looking for is
$$H:\mathbb R^2 \ \backslash \{w\}\times [0,1] \rightarrow \mathbb R^2 \ \backslash \{w\}, \quad H(v,t) = \tau_w \circ F_t \circ \tau_{-w}(v)$$
where $\tau_w$ is the traslation by the vector $w$: $\tau_w(v) = v+w$. The idea is to translate the problem in the origin, resolve it and come back.
If you expand the formula you obtain:
$$
H(v,t) = \frac{v-w}{||v-w||}(1-t) + (v-w)t + w
$$


text:
Q: How should flet link to RTS web video streams? What can I do to interface with RTS network video streams or local file video streams? If possible, could you provide examples or development documentation?
For instance, how to concatenate video streams using OpenCV or process output video streams using YOLO?
Thank you, best wishes to you and have a great day! :)
I have read the reference documentation and can't find a suitable implementation for my method, if you can give me a reference. Thanks


text:
Q: Enable wifi adapter on Linux Mint 14 Cinnamon I just installed Linux Mint 14 Cinnamon on my laptop, but I can't find where to connct with wifi, I Googled about it and I found that I've to enable my wifi adapter in Software Sources, so I did enable it and then I restared my laptop, but this didn't solve my problem. When I open Software Sources again I find that my wifi adapter is not enabled.
When I log in to my session, I get a notification which says :

Network  Disconnected - you are now offline

My wifi adapter is a: BCM4312 802.11b/g LP-PHY
This is what I get when I run the command iwconfig :
lo        no wireless extensions.

eth0      no wireless extensions.

When I tried to install this package firmware-b43-installer_015-14_all.deb, I got this message :

Selecting previously unselected package firmware-b43-installer.
  (Reading database ... 139679 files and directories currently
  installed.)  Unpacking firmware-b43-installer (from
  .../firmware-b43-installer_015-14_all.deb) ...  dpkg: dependency
  problems prevent configuration of firmware-b43-installer:
  firmware-b43-installer depends on b43-fwcutter (>= 1:015-14); however:
  Package b43-fwcutter is not installed.  dpkg: error processing
  firmware-b43-installer (--install):  dependency problems - leaving
  unconfigured Errors were encountered while processing:
  firmware-b43-installer

After that I installed b43-fwcutter, and then I tried to install the package firmware-b43-installer_015-14_all.deb but I got this error :

An unsupported BCM4312 Low-Power (LP-PHY) device was found. Use b43
  LP-PHY firmware (firmware-b43-lpphy-installer package) instead.

So I removed firmware-b43-installer_015-14_all.deb using Synaptic Package Manager, And then I installed the package firmware-b43-lpphy-installer, but I got this message :

(Reading database ... 139686 files and directories currently installed.)
  Unpacking firmware-b43-lpphy-installer (from .../firmware-b43-lpphy-installer_4.174.64.19-4_all.deb) ...
  Setting up firmware-b43-lpphy-installer (4.174.64.19-4) ...
  --2013-04-13 18:52:14--  http://downloads.openwrt.org/sources/broadcom-wl-4.178.10.4.tar.bz2
  Resolving downloads.openwrt.org (downloads.openwrt.org)... failed:
  Name or service not known.
   wget: unable to resolve host address `downloads.openwrt.org'
  dpkg: error processing firmware-b43-lpphy-installer (--install):  subprocess installed post-installation script returned error exit status 4
  Errors were encountered while processing:  firmware-b43-lpphy-installer

A: According to this page, you should install the broadcom drivrs. If you can connect your laptop using an ethernet cable, open a terminal and run
sudo apt-get install firmware-b43-installer

If you don't have access to a wired connection, get online using whatever method you used to post here and download the installer from here. You can then install it using
sudo dpkg -i firmware-b43-installer_015-14_all.deb

After that, restart and your wireless should work.

A: For my similar model card, I needed the bcmwl- pkgs, the broadcom-sta pkgs, and the b43 one for it to work.


text:
Q: using ng-model in ng-repeat I've created angular directive with template:

       <input type="radio" ng-model="myvalue" value="{{$index}}">

The ng-model "myvalue" is part of the directive local scope:
.directive('mydirective', function()
{
    return {
        templateUrl: "path",
        scope: {},
        link : function(scope, el, attr)
        {
            scope.myvalue = 0;
            scope.$watch('myvalue', function()
            {
                console.log('myvalue changed');
            });
        }
    };
}

I'm clicking on the the radio buttons elements, but "myvalue" value never change.
Any idea?
Sample code: http://jsfiddle.net/r5jGL/

A: I found the solution.
Since ng-repeat create new scope, I've changed the ng-model value to $parent.myval in order to access the directive scope.

A: In the HTML:
<input type="radio" ng-model="$parent.myvalue" value="{{$index}}">

This allows you to access ng-model as ng-repeat has created its own scope.
The directive does not need to be changed.


text:
Q: How to port my react code into a mobile app React Noobie here. I'm having a problem in converting my React Application into an app, either chrome, ios, or android. My code works perfectly on the web browser (I happen to use Material UI which cause a hell lots of trouble). So I am looking for any fast, easy way to turn it into an application that can run.
If there's a way to turn a web application into an app locally.
Thank You So MUCH in advance!!!

A: React native is different from React.js. for example in react you have "div" in react native you have "View" and it's a native view.
you should rewrite your app with react native. and you can use the same code for web as well with the help of react native web.
but you have other options as well you can convert your app to PWA or a hybrid app

A: Well... Do you really need react-native? My suggestion is to pack your application into cordova and use it there. Some info about that


text:
Q: Opening and editing a very large mySQL database I have a database that's 1,300,000 KB large that was backed up and saved locally a month or so ago.
Well, the version hosted on the old server was getting hacked. Somehow, additional data (posts, users) were being added to it taking it over the maximum file-size threshold. As a result, the database corrupted and was erased.
I still have my local copy and I'm rebuilding the database on a new server. The problem is that the new server has a similar date file-size threshold and the database is too large because it has all this extra spam data in it.
Therefore, I need to edit it locally, deleting the unnecessary data, then uploaded.
I've tried opening the file in: Sublime, NotePad, WordPad, mySQL Workbench, Vim...to no avail.
I was finally able to open it in Microsoft Visual Studio using the mySQL Workbench plugin...
However, the program won't let me 1) edit the file 2) or copy and paste any of the data elsewhere...It results in a "system out of memory" notification....
Does anyone have experience working with large mySQL database files? What applications/programs to you suggest I use to open and edit this file locally?

A: Install MySQL locally, load the dump, prune what you don't want and dump it again. 1.3 GB limit on the database, you might want to look at a new hosting solution...


text:
Q: Active Directory authentication with Codeigniter Library I am using the ldap library for Codeigniter written by Greg Wojtak from auth_ldap_library.
I have setup the config as per the instructions. However when i try to authenticate using my username and password i am getting an error (ldap_bind() unable to bind).
Below is the config
$config['ldap_uri'] = array('ldaps://dc1.mycompany.com/', 'ldaps://dc2.mycompany.com/');
$config['use_tls'] = false;  // Using SSL above, don't use TLS with it
$config['search_base'] = 'DC=mycompany,DC=com';
$config['user_search_base'] = 'CN=Users,DC=mycompany,DC=com';
$config['group_search_base'] = 'CN=Users,DC=mycompany,DC=com';
$config['user_object_class'] = 'user';
$config['group_object_class'] = 'group';
$config['user_search_filter'] = '';
$config['group_search_filter'] = '';
$config['login_attribute'] = 'sAMAccountName';
$config['schema_type'] = 'ad'; // Could also use rfc2307bis
$config['proxy_user'] = '';  // Or CN=ProxyUser,CN=Users,DC=mycompany,DC=com
$config['proxy_pass'] = '';
$config['roles'] = array(1 => 'User',
                    3 => 'Power User',
                    5 => 'Administrator');
$config['auditlog'] = 'application/logs/audit.log';

This is the line where iam getting the error "error looking up DN for username"
line 217 is the foreach line
   foreach($this->user_search_base as $usb) {
   $search = ldap_search($this->ldapconn, $usb, $filter,
            array('dn', $this->login_attribute, 'cn'));
        $entries = ldap_get_entries($this->ldapconn, $search);
        if(isset($entries[0]['dn'])) {
            $binddn = $entries[0]['dn'];
            break;
        }
    }

Error message is as below.

Has anyone encountered a similar issue?


text:
Q: CoreLocation crashes on device but not on simulator Keep getting EXC_BAD_ACCESS. Ran NSZombieEnabled and came up with nothing.
In simulator console:
 2010-09-11 23:39:56.876 [19072:207] 1.309789, lat, 103.772196, lon

In device console:
EXC_BAD_ACCESS

The line of code:
 NSLog(@"%f, lat, %f, lon",latitudeString,longitudeString);

What CLManager is doing:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
 NSLog(@"Entering mlocationmanager did updatetolocation");
    latitudeString = [NSString stringWithFormat:@"%f", newLocation.coordinate.latitude];

    longitudeString = [NSString stringWithFormat:@"%f", newLocation.coordinate.longitude];

  NSLog(@"lat %@ long %@", latitudeString, longitudeString);
 NSLog(@"%@",newLocation.description);
 if (latitudeString.length >0 && longitudeString.length > 0){
  NSLog(@"Yes both are more than 0");
  locationIsReady = YES;

 }
 [self.tableView reloadData];
}

What is happening here? Both variables are in my header file and CLLocationManagerDelegate is conformed to. Been working on this for a few hours, but no luck. Hope you guys can help.
NSString *latitudeString;
 NSString *longitudeString;

A: You really do not need to convert newLocation.coordinate.longitude to an NSString to print it. Simply use %f in the format string to print them.
Also, when you write:
if (latitudeString.length >0 && longitudeString.length > 0)

You are comparing the length of the strings, which will always be greater than zero. BEcause if the longitude or latitude is zero, the converted string will be @"0.0" which has a length of 3. I suspect what you really want here is:
if (newLocation.coordinate.latitude != 0.0
    && newLocation.coordinate.longitude != 0.0)

A: The line of code should indeed be your culprit:
NSLog(@"%f, lat, %f, lon",latitudeString,longitudeString);

The correct NSLog format argument for Objective-C objects is %@. %f is for floating-point numbers.

A: Finally fixed it after a long while.
Took me some time to realize that NSXMLParser was actually overriding some of my variables (I have no idea why). So in the end, I called CLLocationManager after my XML had parsed. Problem solved.


text:
Q: Interestitial Ads blocks app function in offline My app has two ads :

*

*Banner

*Interstitial.

When I open my app the interestitial ad comes first(when data is on). When (data is off) the app doesn't functions properly like button onclick, etc. Only when the ad finished shows up my app works , or else it will not work in offline.
I want to run my app in offline and even if the ad not shows up my app should work.
Hope You'll help me and the question will be helpful for others
My Project
MainActivity.Java
public class MainActivity extends AppCompatActivity {

    private static final String TAG = "MainActivity";
    private InterstitialAd interstitial;
    private AdView mAdView;
    Button xxxx;

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);

    //GOOGLE ADMOB FIREBASE ADS //

    //Interstitial//

    AdRequest adRequest2 = new AdRequest.Builder().build();
    interstitial = new InterstitialAd(MainActivity.this);
    interstitial.setAdUnitId("ca-app-pub-8736194125011489/4511020459");
    interstitial.loadAd(adRequest2);
    interstitial.setAdListener(new AdListener() {
        @Override
        public void onAdLoaded() {
            displayInterstitial();
        }
    });
}

private void displayInterstitial() {
    if (interstitial.isLoaded()) {
        interstitial.show();
    }

    //Banner Ad//

    mAdView = (AdView) findViewById(R.id.adView);
    AdRequest adRequest1 = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest1);

    //button//

    xxxx = (Button)findViewById(R.id.xxxx);
    xxxx.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent xxxx = new Intent(MainActivity.this, xxxx.class);
            startActivity(xxxx);
        }
    });

Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jobyreuben.yyyyyyyyy">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity android:name=".SplashScreen" >

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

     </activity>

    <activity android:name=".MainActivity"/>

    <activity
        android:name=".xxxx"
        android:configChanges="orientation"
        android:screenOrientation="portrait" />

    </application>
    </manifest>

A: Try putting
 xxxx = (Button)findViewById(R.id.xxxx);
before AdRequest adRequest2 = new AdRequest.Builder().build();

A: According to your code, you're adding listener to button in   displayInterstitial method that is only called when interstitialAd loaded by onAdLoaded() callback method so you got ads on screen first then button works when you close interstitialAd.
And at the counter side when Internet is off, interstitialAd not loaded so onAdLoaded() -> displayInterstitial() not called and no listener added to your button.

*

*AndroidManifest.xml
Inside  application tag add AdActivity, if want to use Interstitial Ads
<meta-data android:name="com.google.android.gms.version"
           android:value="@integer/google_play_services_version" />

<activity android:name="com.google.android.gms.ads.AdActivity"
          android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
          android:theme="@android:style/Theme.Translucent" />

*MainActivity
private InterstitialAd interstitial;
private AdView mAdView;
Button xxxx;

  @Override
  protected void onCreate (Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);

      xxxx = (Button)findViewById(R.id.xxxx);
      xxxx.setOnClickListener(new View.OnClickListener() {
            @Override
           public void onClick(View v) {
             Intent xxxx = new Intent(MainActivity.this, xxxx.class);
             startActivity(xxxx);
           }
      });

      mAdView = (AdView) findViewById(R.id.adView);
      AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
      adRequestBuilder.addTestDevice(AdRequest.DEVICE_ID_EMULATOR);  // for testing only
      mAdView.loadAd(adRequestBuilder.build());

      interstitial = new InterstitialAd(this);
      interstitial.setAdUnitId("ca-app-pub-8736194125011489/4511020459");
      interstitial.setAdListener(new AdListener() {
             @Override
             public void onAdLoaded() {}

             @Override
             public void onAdClosed() {
                  loadIntersitialAd();
             }
      });

      loadIntersitialAd();
  }

  private void loadIntersitialAd(){

      AdRequest interstitialRequest = new AdRequest.Builder().build();
      interstitial.loadAd(interstitialRequest);
  }

  public void displayInterstitial() {
     if (interstitial.isLoaded()) interstitial.show();
  }

  public boolean isInterstitialLoaded(){
    return interstitial.isLoaded();
  }

  @Override
  protected void onResume() {
    super.onResume();
    mAdView.resume();
  }

  @Override
  protected void onPause() {
    super.onPause();
    mAdView.pause();
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    mAdView.destroy();
 }
}

Whenever you want to show Ad call displayInterstitial().
EDIT
Call displayInterstitial() from onAdLoaded() if you want to show Interstitial ad just after ad is loaded but this is not ideal way, loading Ad take some time so you'll get some delay between your Activity come in foreground and Interstitial ad display.
interstitial.setAdListener(new AdListener() {
         @Override
         public void onAdLoaded() {
              displayInterstitial();
         }

         @Override
         public void onAdClosed() {
              loadIntersitialAd();
         }
  });

EDIT 2
Don't load loadIntersitialAd() from onAdClosed() when you're calling displayInterstitial() from onAdLoaded() callback method because it creates recursive loop.
interstitial.setAdListener(new AdListener() {
         @Override
         public void onAdLoaded() {
              displayInterstitial();
         }

         @Override
         public void onAdClosed() {

         }
  });


text:
Q: Unable to connect to Public RDS in VPC via Lambda There are couple of questions around this, but none seem to solve my specific problem.
So i have a publicly accessible RDS instance in a VPC with two Security Groups : one the default SG for VPC & other to allow incoming connections from our developer machines. I am able to successfully connect to this RDS via my developer machines(personal laptops/PCs) as a result of the 2nd Security group.
Now, when i try to connect to this RDS via a Lambda running in same VPC, it fails with this error : "java.net.UnknownHostException: ****.rds.amazonaws.com: Name or service not known "
My lambda is getting launched in the same VPC as RDS and i have chosen all the RDS VPC subnets for the lambda. It also is tied to the default VPC security group.
Below is my understanding(obviously not right as connection is not working), what am i missing here?
The Default VPC SG(security group) associated to the lambda has outgoing rules set as 0.0.0.0/0 , hence it should allow lambda to access the whole world; so at least the RDS in VPC should be accessible.
The same default VPC SG should allow the RDS to accept incoming connections from any ip in the SG subnets(inbound rule mentions SG/default) ; hence lambda should be able to access it.

A: The error message is indicating that it cannot resolve the DNS Name of the RDS database (Name or service not known).
I suspect that this is due to the fact that the RDS instance has been configured as publicly accessible, which gives it a public DNS Name and IP address.
An AWS Lambda function connected to a VPC will send all network traffic via the VPC. It does not have access to the Internet unless there is a NAT in the VPC and the Lambda function is connected to a Private Subnet. Thus, the connection attempts from the Lambda function are possibly attempting to resolve a Public DNS Name, but is failing to do so.
This could likely be resolved by changing the RDS instance to be Publicly Available = No. This not only makes it safer, but it means that the DNS Name will resolve to a Private IP address, which should work correctly with a Lambda function connected to the VPC.
Alternatively, you could configure the Lambda function to not be connected to the VPC. This gives it Internet access, so it will connect to the RDS database just like any other computer on the Internet.

A: So the problem was that in my developer machine, I was using the db instance endpoint , but in lambda i was using the cluster endpoint. They look similar, hence i was not able to catch it earlier. On fixing the lambda to use the instance endpoint, both lambda & developer machines can successfully connect to the RDS.
However, I am now curious why the cluster url is not accessible, but i will create another question for that.


text:
Q: Yii2 Page not found when calling country/index I was practicing to work with Yii2 based on the tutorial in this link : http://www.yiiframework.com/doc-2.0/guide-start-databases.html
I am using Advanced Application
These are the files that i have created:
frontend/models/Country.php

frontend/controllers/CountryController.php

frontend/views/country/index.php

now when i try to access it using index.php?r=country/index i get 404 not found error.
But if i move the actionIndex of CountryController to SiteCountroller and rename it to actionCountry and also move my view file inside site folder (and of course change the name of index.php to country.php) then i can successfully see the list of countries using the address index.php?r=site/country
Any ideas about the 404 not found error?

A: Examples in tutorial are for basic application and contains app\ in namespaces declaration. And you are using advanced application so for frontend it should begin with frontend\ (see for example SiteController in advanced application).
I think this is the reason since you said that file content is exactly the same,  you didn't change default configuration and checked folders, files and classes for correct names.


text:
Q: Right Align String NumberFormat in Java I need to right align an input string of digits with a mask using plus symbols.
For example:
    String input = "893";
    String mask = "&&&&&&";

should return
    String output = "+++893";

I'm very confused on how to implement this with NumberFormat and or DecimalFormat as I haven't used them before. Any help would be appreciated.

A: If you need to use DeciamlFormat you could use:
int input = 893;
DecimalFormat decFormat = new DecimalFormat("000000"); //as many palces as you need
String output = decFormat.format(input);

And then replace all leading zeros with + sign.
String.format("%06d", input); //also gives you leading zeros

You still have to check if the output is too long, if you always want 6 places.

A: You could try this: If the length of the mask is greater than the length of the input, take the difference and add that many plus signs to the front of the input.


text:
Q: Google Appengine - Object with id "com.google.appengine.api.datastore.Key:Product("Potatoe")" is managed by a different Object Manager Hi i am hitting the common error "managed by a different object manager"
I have looked around online and not found a solution that fits my problem. I am calling the following code from a JSP page
PersistenceManager pm = PMF.get().getPersistenceManager();
String query = "SELECT FROM " +Location.class.getName();
List<Location> locTs = (List<Location>) pm.newQuery(query).execute();
for (Location location : locTs) {
   location.genRes(pm);
}
pm.close();
return "done";

location.genRes
 public void genRes(PersistenceManager pm) {
 Key product = this.getLtype(pm).getProductKey();
 String query = "SELECT FROM " + LocationInventry.class.getName() + " WHERE location == '"+key.getId()+"' && product == '"+product.getId()+"'";
 List<LocationInventry> lvd = (List<LocationInventry>) pm.newQuery(query).execute();
 if (lvd.size() == 0 ) {
  LocationInventry locationInventry = new LocationInventry(product, this);
  pm.makePersistent(locationInventry);
 }
 else {
  lvd.get(0).gen();
 }
}

The error is being thrown on pm.makePersistent(locationInventry);
As far as I can tell I am using only one persistent management and I am closing it after use. Thanks for any help.
Object with id "com.google.appengine.api.datastore.Key:Product("Potatoe")" is managed by a different Object Manager
org.datanucleus.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:375)
org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:674)
org.datanucleus.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:694)
net.sparktank.quilage.datastore.Location.genRes(Location.java:220)
net.sparktank.quilage.server.MainRunner.genResources(MainRunner.java:239)
org.apache.jsp.server.generateResources_jsp._jspService(generateResources_jsp.java:45)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:806)

A: I had this same problem some time ago and I have a vague memory that my jdoconfig.xml file was missing or not configured correctly.
Check out http://code.google.com/appengine/docs/java/datastore/usingjdo.html for more details.


text:
Q: An array inside Vue component has multiple reactiveSetter and reactiveGetter methods when logging in console I developed a vue chat component using Typescript. I have a messages array that is filled with send function and using it as a Web Component then using vue-custom-element.
The problem is that when I'm logging the messages array there is a bunch of reactiveSetter and reactiveGetter mothods there. Did I do something wrong?

This is the vue component:
<template>

        <fa-icon icon="user" />
        <app-baloon :direction="message.owns ? 'right' : 'left'">

          {{ message.user }}:
          {{ message.text }}
        </app-baloon>

    <textarea
      type="text"
      v-model="newMessage"
      id="new-message"
      @keydown.enter.exact.prevent="send"
      placeholder="Send the message..."
    ></textarea>

</template>

A:
When you pass a plain JavaScript object to a Vue instance as its data
option, Vue will walk through all of its properties and convert them
to getter/setters using Object.defineProperty. This is an ES5-only and
un-shimmable feature, which is why Vue doesn't support IE8 and below.

More: https://v2.vuejs.org/v2/guide/reactivity.html#How-Changes-Are-Tracked
This means that no - there's no error, it's the main method Vue keeps data reactive. So it's a feature (or THE feature, if you like) :)

One caveat is that browser consoles format getter/setters differently
when converted data objects are logged, so you may want to install
vue-devtools for a more inspection-friendly interface.

Vue devtools: https://github.com/vuejs/vue-devtools


text:
Q: Code Igniter SubApplication So, codeigniter has application and system. I want to add another folder called "platform" and it would have the same directory structure as application (controllers, views and everything).
How I want it to work is like this:
- When you load a model, view, library, controller etc it should first check in application (if it's not there, it should check in platform and if it's not there it should show an error)
- I want to make some basic models and controllers in the "platform" and all the controllers and models from "application" to inherit them
- I want to extend basic core and library classes in the "platform" and if needed they would be extended in the "application"
I don't know if code igniter can already do that or if it needs something to do it.
Basically it's something like the plugins from cakephp (if somebody knows how they are/work).
Question:
How do I do the above?

A: There is the "third_party" folder where you can add a "Sub Application" as you call it or a Application "Package".

"An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder..."

Source:
http://codeigniter.com/user_guide/libraries/loader.html (Its almost down at the bottom of the document.)
This is done inside of the application folder.
There might be a way to achieve what you want and put your folder outside of the application by doing this:
$this->load->add_package_path(PATH_OUTSIDE_APPLICATIONS.'/my_package/');

instead of :
$this->load->add_package_path(APPPATH.'third_party/my_package/');

I haven't tested if it would work yet. But you can try it!

A: You'll have to do some rejigging of files, but you could create two folders with separate applications files, and then point two separate index files to each folder with the $application_folder variable.
I've never actually tried this, but it should work. Make sure you also update the $system_folder var.
More here:
http://codeigniter.com/user_guide/general/managing_apps.html


text:
Q: Downloading a list of files, incrementing filename with each iteration I'm using this question to help me download a list of files into a directory. However, if I want to actually download them, I need to specify a filename to save as too. Here's what I have so far:
$ xargs -n 1  curl > newname.html -0 < ../list.txt

It's going through the list fine, but it appears that it's always overwriting newname.html with each iteration. How do I number the downloads so that I have 'newname1', 'newname2', and so on? I don't really understand terminal commands all that well so I don't even know where to begin with deciperhing this. I've basically just combined typical cURL download command and that thread I linked above about going down the list to get where I am.


text:
Q: different result from varpart and RsquareAdj I'm getting different results from varpart and RsquareAdj
> (allel_freq.varpar<-varpart(allel_freq.h,env.PCoA,PCNM.red))
Partition of variation in RDA

Call: varpart(Y = allel_freq.h, X = env.PCoA, PCNM.red)

Explanatory tables:
X1:  env.PCoA
X2:  PCNM.red

No. of explanatory tables: 2
Total variation (SS): 0.0017369
        Variance: 0.00017369
No. of observations: 11

 Partition table:
 Df R.squared Adj.R.squared Testable
[a+b] = X1            2   0.23618       0.04522     TRUE
[b+c] = X2            2   0.54147       0.42683     TRUE
[a+b+c] = X1+X2       4   0.65547       0.42578     TRUE
Individual fractions
[a] = X1|X2           2                -0.00106     TRUE
[b]                   0                 0.04628    FALSE
[c] = X2|X1           2                 0.38056     TRUE
[d] = Residuals                         0.57422    FALSE

in "varpart",Unique effect of env.PCoA is -0.00106,but when I use "RsquareAdj", I got different adjusted R-square(-0.2266707). strange.
> rda.envspe<-rda(allel_freq.h,env.PCoA,cbind(PCNM.red))
> RsquareAdj(rda.envspe)
$r.squared
[1] 0.1139976

$adj.r.squared
[1] -0.2266707


text:
Q: Python - Class object as function argument: Object only - Class not in argument I am trying to write a function taking a string as an argument and using this argument as a class object.
Note that my explanantion might be strangely formulated sice I could not find an answer online. The MWE below should clarify what I mean, the problematic line is indicated.
Edit: in the MWE, "print" is an example. I need to be able to call the object to update it, print it or, in the case of a list, append to it. I need access to the object itself, not the value of the object.
MWE
# Create a class
class myClass():
    def __init__(self):
        self.one = "Test"
        self.two = "Plop"

# Define function
def myFunction (parameter):
    print(myObject.parameter)##### This line is currently not possible.

# Use class
myObject = myClass()

# Use function
myFunction("one")

I am not trying to append a new object to the class, only to call an existing object.
Is this even possible?

A: Looks like you need the built-in function called getattr
my_object = myClass()

def my_function(parameter):
    print(getattr(my_object, parameter, None))

also this is not the best practice to call objects from outer scope like that. i'd suggest to use dict magic methods:
class MyClass:
    def __init__(self):
        self.one = "Test"
        self.two = "Plop"

    def __getitem__(self, parameter):
        return getattr(self, parameter, None)

    def __setitem__(self, parameter, value):
        return setattr(self, parameter, value)

my_obj = MyClass()
parameter = "x"
print(my_obj[parameter])
my_obj[parameter] = "test"
print(my_obj.x)

A: You need to use getarttr():
# Create a class
class myClass():
    def __init__(self):
        self.one = "Test"
        self.two = "Plop"

# Use class
myObject = myClass()

# Define function
def myFunction(parameter):
    print(getattr(myObject, parameter))##### This line is currently possible.

# Use function
myFunction("one")


text:
Q: Calculating Thevenin Resistance I am having difficulty calculating the Thevenin resistance of this circuit

I know I need to replace the batteries with links but then I am confused about how to approach R1,2 & 3 in terms of being in series or parallel. Would I consider R2 and R1 in parallel and therefore 1*2/1+2 = 0.667 then add R3 as they are is series then treat R4 as parallel?
I'm looking for the Thevenin equivalent as seen across 'A' amd 'B'
Losing the will with this slightly...
Thanks

A: Assume R1 to be parallel to R2. This effective to be in series with R3 and this effective resistance in parallel with R4.
This gives the effective Resistance across the terminals A and B, which is 625ohm.

A: Step 1 - Yes.  Because V1 = V2 (and common grounded), you can consider R1 and R2 to be in parallel, and in series with R3.
Redraw the schematic with this change and reconsider how R3 and R4 interact.


text:
Q: Find area and perimeter using fundamental forms This is a question my professor posed, and I'm not understanding how fundamental forms are related to lengths or how to approach this problem.
Suppose a surface has fundamental form $I = du^2 + (u^2+a^2) dv^2$ (for a constant $a$). Consider a triangle bounded by $u = av, u = -av,$ and $v = 1.$

*

*a) Find its perimeter.

*b) Find its area.
(recall the infinitesimal length $ds$;   infinitesimal area $dA =$ |xu x xv | $du$ $dv$ )
Can someone point me in a helpful direction?

A: Your surface may be viewed as a region $S \subset \mathbb{R}^2$ with coordinates $u,v$ and first fundamental form $I = du^2 + (u^2 + a^2)dv^2$. Using this first fundamental form, we can determine the lengths of curves and the areas of regions in the following way.
If $\gamma: [a,b] \rightarrow S$ is a curve with parameter $s$ and components $u(s),v(s)$, then
$$ \text{Length}(\gamma) = \int_a^b \sqrt{I\left(\tfrac{d\gamma}{ds},\tfrac{d\gamma}{ds}\right)} ds  \,=\, \int_a^b \sqrt{(\tfrac{du}{ds})^2 + (u(s)^2+a^2)(\tfrac{dv}{ds})^2} \,\,ds.$$
If $A \subset S$ is a region parametrised by $u,v$, then
$$ \text{Area}(A) = \int\int_A \sqrt{\text{det}(I)}\, dudv \, = \, \int\int_A \sqrt{u^2 + a^2}\, dudv. $$
So to complete the question, simply parametrise the edges of the triangle and use the first formula to get the perimeter (it's best to parametrise each side seperately and add the lengths at the end), and parametrise the triangle itself and use the second formula to get the area.


text:
Q: Aggregate multiple vars on different groupings in one Proc SQL query I need to aggregate about ten different vars on different groupings using Proc SQL;
Is there a way to achieve SUM () OVER ( [ partition_by_clause ] order_by_clause) in one sql query with different partition by clauses.
I've made an example here
data have;
infile cards;
input a b c d e f;
cards;
1 2 3 4 5
2 2 4 5 6
1 4 3 4 7
3 4 4 5 8
;
run;
proc sql;
create table want as
select *,
sum a over partiton by (b,c) as a1,
sum b over partiton by (c,d) as b1
sum c over partiton by (d,e) as c1
sum d over partiton by (a,c) as d1
from have
;
quit;

I don't want to wirte multiple sql queries and grouping on different vars and calculating one var in each step.
Hope that makes sense.

A: Proc SQL does not implement windowing functions and thus partition syntax therein as found in other SQL implementations.  You can only do partition by with passthrough SQL to a connection that allows such syntax.
You could perform such a computation in DATA step using hashes.
data have;
infile cards;
input a b c d e ;
cards;
1 2 3 4 5
2 2 4 5 6
1 4 3 4 7
3 4 4 5 8
;
run;

data want;
  if 0 then set have;

  length a1 b1 c1 d1 8;

  declare hash a1s();
  a1s.defineKey('b', 'c');
  a1s.defineData('a1');
  a1s.defineDone();

  declare hash b1s();
  b1s.defineKey('c', 'd');
  b1s.defineData('b1');
  b1s.defineDone();

  declare hash c1s();
  c1s.defineKey('d', 'e');
  c1s.defineData('c1');
  c1s.defineDone();

  declare hash d1s();
  d1s.defineKey('a', 'c');
  d1s.defineData('d1');
  d1s.defineDone();

  do while (not end);
    set have end=end;
    if a1s.find() = 0 then a1+a; else a1=a;  a1s.replace();
    if b1s.find() = 0 then b1+b; else b1=b;  b1s.replace();
    if c1s.find() = 0 then c1+c; else c1=c;  c1s.replace();
    if d1s.find() = 0 then d1+d; else d1=d;  d1s.replace();
  end;

  do while (not last);
    set have end=last;
    a1s.find();
    b1s.find();
    c1s.find();
    d1s.find();
    output;
  end;

  format _numeric_ 4.;

  stop;
run;


text:
Q: List of dictionaries to dictionary I want to do some dict comprehension for better data oranization
Original Dict:
mach = [{'name': 'Software 1', 'code': 'F105', 'version': '12.70.2', 'size': '115.25 Mb'},
        {'name': 'Software 2', 'code': 'F118', 'version': '12.71.22', 'size': '105.25 Mb'},
        {'name': 'Software 3', 'code': 'F115', 'version': '12.71.22', 'size': '105.25 Mb'},
        ....
        {'name': 'Software x', 'code': 'F120', 'version': '12.71.22', 'size': '105.25 Mb'}]

Needed Output Dict:
    new_mach = {'Software 1': 'F105',
                'Software 2': 'F118',
                'Software 3': 'F115',
                ...
                'Software x': 'F120'}

A: It's quite easy:
new_match = {}

for elem in match:
    new_match[elem["name"]] = elem["code"]

A: You could use a dict comprehension:
>>> mach = [
...     {
...         'name': 'Software 1',
...         'code': 'F105',
...         'version': '12.70.2',
...         'size': '115.25 Mb'
...     },
...     {
...         'name': 'Software 2',
...         'code': 'F118',
...         'version': '12.71.22',
...         'size': '105.25 Mb'
...     },
...     {
...         'name': 'Software 3',
...         'code': 'F115',
...         'version': '12.71.22',
...         'size': '105.25 Mb'
...     },
...     {
...         'name': 'Software x',
...         'code': 'F120',
...         'version': '12.71.22',
...         'size': '105.25 Mb'
...     }
... ]
>>>
>>> new_mach = {d['name']: d['code'] for d in mach}
>>> new_mach
{'Software 1': 'F105', 'Software 2': 'F118', 'Software 3': 'F115', 'Software x': 'F120'}


text:
Q: Error executing MSBUILD ReSharper CLI InspectCode task from TFS When executing the ReSharper InspectCode .MSBUILD task file:
 <?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Import Project="C:\Download\JetBrains.ReSharper.CommandLineTools.2018.1.2\InspectCode.MsBuild.Targets" />

    <Target Name="Build">
        <InspectCode ContinueOnError="False" SolutionFile="C:\source\xx\Dev\xx.Re.xx.sln" />
    </Target>
</Project>

With the following command:
msbuild c:\temp\test.msbuild

I receive the following error:

Error resolving component request for
  Microsoft.Build.Framework.IBuildEngine in
  ComponentAccessCardinality::Single mode in context "for  in Container: JetEnvironment". Sequence contains more than
  one element

Complete error:
https://pastebin.com/mCKsFtfH
The inspect code command finishes as expected, displaying a list of resharper errors/warnings, HOWEVER the fact that data has been written to the stderr output, means that the build fails.
So:

*

*Does anyone know how to fix this problem?

*Alternatively, can I pipe stderr to null somehow in order to ignore the errors?


text:
Q: Could not get a command to work with bash -c I am trying to execute a command to find out which process is listening on a particular port and i cannot get it to work if the command is passed as an argument to bash using bash -c
netstat -tnlp 2>/dev/null | grep ':10301'
tcp        0      0 0.0.0.0:10301           0.0.0.0:*               LISTEN      4755/nc

I can get it working if i do the below and it shows nc is listening on that port
netstat -tnlp 2>/dev/null | grep ':10301'  | grep LISTEN | awk '{print $7}' | cut -d'/' -f1 | xargs -i -n1 cat /proc/{}/cmdline
nc-kl10301

but if do it using bash -c
bash -c "netstat -tnlp 2>/dev/null | grep ':10301'  | grep LISTEN | awk '{print $7}' | cut -d'/' -f1 | xargs -i -n1 cat /proc/{}/cmdline"
cat: /proc/tcp        0      0 0.0.0.0:10301           0.0.0.0:*               LISTEN      4755/cmdline: No such file or directory

A: You need to escape $ in double quotes,
bash -c "netstat -tnlp 2>/dev/null | grep ':10301'  | grep LISTEN | awk '{print \$7}' | cut -d'/' -f1 | xargs -i -n1 cat /proc/{}/cmdline"

In your case, $7 is interpreted as a parameter. So awk will run {print} which prints the whole line instead of the intended field.


text:
Q: nHibernate query exception: no row with given identifier exists After modifying the datamodel a little bit, certain queries started giving me this exception. However, even after reading various forum-threads and blogs, I don't understand why this happens in my case. So I hope that someone here can help. First, an example query:
var criteria = Session.CreateCriteria(typeof(SomeEntity));
        criteria.Add(Expression.IdEq(id));
        criteria.SetFetchMode("_PrivateProperty", FetchMode.Eager);
        criteria.CreateAlias("PublicProperty", "alias");
        criteria.Add(Expression.Eq("alias.Id", aliasId));

If I modify the query by either removing (1) SetFetchMode or (2) CreateAlias for the public property, everything works fine.
The private property is usually loaded lazily, but in this case I want to load it together with its parent entity to combat select N+1.
So, why doesn't it work as displayed above, and does it work when I remove certain parts of the query?
UPDATE
Generated SQL:
SELECT * FROM SomeEntity this_
inner join PublicProperty alias4_ on this_.SomeEntityId=alias4_.SomeEntityId
inner join ReferencedProperty rp2_ on alias4_.RPId=rp2_.RPId
left outer join PrivateProperty v1_ on this_.SomeEntityId=v1_.SomeEntityId
WHERE this_.SomeEntityId= @p0 and rp2_.RPId= @p1

When run in SQL Server Management Studio, it works as expected. I get two results. In between modifying the datamodel and the query, the data in the database hasn't changed.
UPDATE2
Modification in model.
Original mapping:
References(d => d.PublicProperty, "PublicPropertyId").Cascade.SaveUpdate();

New mapping:
HasManyToMany(d => d.PublicPropertys)
            .Access.CamelCaseField(Prefix.Underscore)
            .Table("SomeEntityPublicProperty")
            .ParentKeyColumn("SomeEntityId")
            .ChildKeyColumn("PublicPropertyId")
            .Cascade.SaveUpdate()
            .Inverse();

UPDATE3
HasMany<PrivatePropertyEntity>(Reveal.Member<SomeEntity>("_PrivateProperty"))
            .Table("SomeEntity_PrivateProperty")
            .KeyColumn("SomeEntityId")
            .Cascade.AllDeleteOrphan()
            .LazyLoad().Inverse();

A: Your problem likely stems from the fact that if you use createalias (without specifying an outer join type) the entities don't get loaded eagerly in spite of what your configuration is.
The reason for this related to your error:  Assuming you didn't specify any criteria on the RHS of the association, and you have null references in your data, using an INNER JOIN would incorrectly filter out records on the LHS.
As such, it doesn't matter to NHibernate that your query returns two results using the INNER JOINS it goes ahead and lazy loads the associations anyway.  Somewhere you have a reference to a non-existent referenced property in your many-to-many join table, and it is failing when it tries to lazy load it to check whether the RHS matches you criteria.
Changing the alias to perform a left outer join should prevent the error (it will actually load the associated entities eagerly and not re-check the references), but you'll still have that referential integrity problem somewhere:
criteria.CreateAlias("PublicProperty", "alias", JoinType.LeftOuterJoin);


text:
Q: how to keep the y-axis labels in between the lines in HighChart plug in i am using this plugin to create the chart .
i have this :
and this is what i want:

how can i do this? Any references??
and here is my code for this chart
$(function ()
{
    $('#container').highcharts({
        chart: {
            type: 'column',
            margin: [ 100]
        },
        title: {
            text: 'World\'s largest cities per 2008'
        },
        xAxis: {
            categories: personNameList,
            labels: {
                rotation: -45,
                align: 'right',
                style: {
                    fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif'
                }
            }
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Population (millions)'
            }
        },
        legend: {
            enabled: false
        },
        tooltip: {
            formatter: function() {
                return ''+ this.x +'
'+
                    'Population in 2008: '+ Highcharts.numberFormat(this.y, 1) +
                    ' millions';
            }
        },
        series: [{
            name: 'Population',
            data: dataList,
            dataLabels: {
                enabled: true,
                rotation: -90,
                color: '#FFFFFF',
                align: 'right',
                x: 4,
                y: 10,
                style: {
                    fontSize: '13px',
                    fontFamily: 'Verdana, sans-serif'
                }
            }
        }]
    });
});

A: Here is one way to accomplish this:
In your labels object within the highcharts object, set the y position, and get rid of the '0' like this:
labels: {
    formatter: function() {
        if (this.value != 0) {
            return this.value;
        } else {
            return '';
        }
    },
    y: 40
}

Using this property, you can change the position [up or down] that each label is positioned. The only down-side to this is that the 0 on the y axis should be removed.
Here is a fiddle


text:
Q: User Settings JSON Environment Variables I am using the Sync Settings extension to synchronize my user settings to a Gist and have multiple systems that synchronize from it.  The problem that I have is that my systems do not have the same configuration, particularly my user profile is a different path.
I want to use an environment variable in the path to my Python interpreter that is installed in my user space.
Is there a way to do this also that would be cross-platform?
I want something like this:
"python.pythonPath": "${env:HOME}\\AppData\\Local\\Programs\\Python\\Python37-32\\python.exe"
Is that possible?  I have seen that there are environment variables, but I haven't been able to find a list of what they are.

A: I just relied on the Path environment variable to handle it like in this post: How to setup Visual Studio code to find Python 3 interpreter in Windows 10
"python.pythonPath": "python.exe"

Also, I use Shell Launcher, so I added an entry for Python, in addition to Windows PowerShell and PowerShell Core:
"shellLauncher.shells.windows": [
        {
            "shell": "c:\\Program Files\\PowerShell\\6\\pwsh.exe",
            "label": "PowerShell Core"
        },
        {
            "shell": "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
            "label": "Windows PowerShell"
        },
        {
            "shell": "python.exe",
            "label": "Python 3.7"
        }
    ]


text:
Q: problema con rankeo en sql server Tengo la siguiente consulta
SELECT em.id_empleado, p.des_familia, RANK() OVER(PARTITION BY p.des_familia ORDER BY sum(venta) DESC) AS RankByVentas,
    sum(venta) as venta, sum(unidades) as unidades
    FROM dim.empleado as em, fact.venta as vt, dim.producto as p
    WHERE em.id_empleado = vt.id_empleado AND p.id_producto = vt.id_producto AND vt.id_calendario between 20180101 AND 20181231  GROUP BY em.id_empleado, p.des_familia

Resultado obtenido:
   1     ABRIGOS HOMBRE 1   364812691.0152800000    4167.0000000000
 816     ABRIGOS HOMBRE 2   24366756.0000000000 398.0000000000
 485     ABRIGOS HOMBRE 3   10819031.0000000000 183.0000000000
 373     ABRIGOS HOMBRE 4   4903509.0000000000  54.0000000000
 288     ABRIGOS HOMBRE 5   4663207.0000000000  59.0000000000
3296     ABRIGOS HOMBRE 6   4476416.0000000000  49.0000000000
3185     ABRIGOS HOMBRE 7   4010515.0000000000  48.0000000000
 389     ABRIGOS HOMBRE 8   3747505.0000000000  47.0000000000
3147     BAG    112 117312.0000000000   4.0000000000
  41     BAG    113 116916.0000000000   4.0000000000
3246     BAG    114 113610.0000000000   4.0000000000
 726     BAG    115 113193.0000000000   3.0000000000
1515     BAG    116 112819.0000000000   4.0000000000
3302     BAG    117 108824.0000000000   5.0000000000
2115     BAG    118 104932.0000000000   3.0000000000
1477     BAG    119 104665.0000000000   5.0000000000
 586     BAG    120 104623.0000000000   5.0000000000
 368     BAG    121 103353.0000000000   3.0000000000
1207     BELT   28  1658921.0000000000  83.0000000000
 278     BELT   29  1643719.0000000000  87.0000000000
2886     BELT   30  1629965.0000000000  84.0000000000
 280     BELT   31  1624797.0000000000  84.0000000000
1186     BELT   32  1619111.0000000000  81.0000000000
 143     BELT   33  1599453.0000000000  79.0000000000
1763     BELT   34  1594120.0000000000  83.0000000000
1501     BELT   35  1590595.0000000000  85.0000000000
2674     BELT   36  1585859.0000000000  81.0000000000
3128     BELT   37  1572325.0000000000  82.0000000000

Necesito rankear los 5 primeros empleados de acuerdo a la sumatoria de ventas de cada familia de productos pero al hacer la consulta así me muestra ranking desde 1 hasta X en ciertas familias y en otras desde 144 hasta Y, no entiendo qué sucede ni cómo obtener solo los ids de empleados de los 5 primeros lugares para cada familia.
Lo que quiero obtener:
   1     ABRIGOS HOMBRE 1   364812691.01528000  4167.0000000000
 816     ABRIGOS HOMBRE 2   24366756.0000000000 398.0000000000
 485     ABRIGOS HOMBRE 3   10819031.0000000000 183.0000000000
 373     ABRIGOS HOMBRE 4   4903509.0000000000  54.0000000000
2886     ABRIGOS HOMBRE 5   4663207.0000000000  59.0000000000
3147             BAG    1   117312.0000000000   4.0000000000
  41             BAG    2   116916.0000000000   4.0000000000
3246             BAG    3   113610.0000000000   4.0000000000
 726             BAG    4   113193.0000000000   3.0000000000
1515             BAG    5   112819.0000000000   4.0000000000
1207             BELT   1   1658921.0000000000  83.0000000000
 278             BELT   2   1643719.0000000000  87.0000000000
2886             BELT   3   1629965.0000000000  84.0000000000
 280             BELT   4   1624797.0000000000  84.0000000000
1186             BELT   5   1619111.0000000000  81.0000000000

Agradezco la ayuda

A: Primero que todo, por favor no uses JOINs implícitos porque están deprecados hace más de 20 años; trata de usar JOINs explícitos.
Para lo que quieres, lo más fácil sería usar tu consulta actual como una tabla derivada o una CTE, y luego filtar:
Por ejemplo usando una CTE:
WITH CTE AS
(
    SELECT  em.id_empleado,
            p.des_familia,
            RANK() OVER(PARTITION BY p.des_familia ORDER BY sum(venta) DESC) as RankByVentas,
            SUM(venta) as venta,
            SUM(unidades) as unidades
    FROM dim.empleado as em
    INNER JOIN fact.venta as vt
        ON em.id_empleado = vt.id_empleado
    INNER JOIN dim.producto as p
        ON p.id_producto = vt.id_producto
    WHERE vt.id_calendario BETWEEN 20180101 AND 20181231
    GROUP BY em.id_empleado,
             p.des_familia
)
SELECT *
FROM CTE
WHERE RankByVentas <= 5
;

Y usando una tabla derivada:
SELECT *
FROM (
    SELECT  em.id_empleado,
            p.des_familia,
            RANK() OVER(PARTITION BY p.des_familia ORDER BY sum(venta) DESC) as RankByVentas,
            SUM(venta) as venta,
            SUM(unidades) as unidades
    FROM dim.empleado as em
    INNER JOIN fact.venta as vt
        ON em.id_empleado = vt.id_empleado
    INNER JOIN dim.producto as p
        ON p.id_producto = vt.id_producto
    WHERE vt.id_calendario BETWEEN 20180101 AND 20181231
    GROUP BY em.id_empleado,
             p.des_familia
    ) X
WHERE RankByVentas <= 5
;


text:
Q: PStricks code inside caption. LaTeX. What's wrong? I'm trying to put \psaxes command inside a caption. I have tried \verb, \lstinline and alltt package and nothing works. Whats wrong?
\documentclass[
               12pt,
               a4paper,
               openright,
               %twoside,
               oneside,               % Use twoside no lugar de oneside para impressão
               dvipsnames,
               chapter=TITLE,         % títulos de capítulos convertidos em letras maiúsculas
               section=TITLE,         % títulos de seções convertidos em letras maiúsculas
               english,
               brazil]{abntex2}

\usepackage[
                alf,
                abnt-emphasize=bf,
                bibjustif,
                recuo=0cm,
                abnt-etal-cite=4,
                abnt-etal-text=it]{abntex2cite}             % Para gerar a Bibliografia
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}

%\usepackage[showframe, pass]{geometry}                     % Habilitar para ver as margens
\usepackage{standalone}
\usepackage{verbatim}
\usepackage{alltt}                                          % Para comentários
\usepackage{comment}

\newcommand{\IBGEtabfontsize}{\ABNTEXfontereduzida}
\AtBeginDocument{%
  % comandos auxiliares para manipular os captions dentro do comando \IBGEtab.
  \newcommand{\configurecaptions}{\captionstyle[\raggedright]{}}
  \newcommand{\configureseparator}{\captiondelim{: }}
  % Define o comando \IBGEtab{}{}{} com caption e legenda da largura do conteúdo tabular, tabular*, etc
  % Parece funcionar com qualquer pacote
  \newsavebox{\myptabbox}
  \newlength{\myptabboxwidth}

  \newcommand{\IBGEtab}[3]{%
    \savebox{\myptabbox}{{\IBGEtabfontsize #2}}%
    \settowidth{\myptabboxwidth}{\usebox{\myptabbox}}%
    \centering%
    \parbox{\myptabboxwidth}{%
    \configurecaptions
    #1%
    \par%
    {\IBGEtabfontsize%
    #2%
    }%
    \par%
    #3}%
  }
  \let\ibgetab\IBGEtab
}

\newcommand{\mequa}[3]{\IBGEtab{#1}{#2}{#3}}

\newcommand{\Caption}[1]{ %
    \begin{Spacing}{1.5} %
        \caption{#1} %
        \end{Spacing} %
}

\newcommand{\Fonte}[2][\fontename]{ %
%   \vspace{-3pt}
    \vspace{10pt}
        \fonte[#1]{#2}
    \vspace{-5pt}
}

\begin{document}
   \begin{quadro}[h!]
      \centering
      \Caption{\label{qua:psaxes} Test\verb|\psaxes|.}
        \mequa{}{
         \begin{tabular}{lll}
         \toprule
                  Nome & Tipo & Padrão\\
                  \midrule\midrule
                     axesstyle  & axes|frame|none  & axes \\
                  \bottomrule
         \end{tabular}
      }{
         \Fonte{Test.}
     }
  \end{quadro}
\end{document}

And i get:


text:
Q: Using CLI in Java to manage Services I would like to run the net start and net stop command from java and fetch the results in java to administrate my services from there.
But I have no idea how to do that. Any Examples or Tutorials?

A: I think you can check below links. It may help you in executing the cmd commands from Java code.

*

*http://www.codejava.net/java-se/file-io/execute-operating-system-commands-using-runtime-exec-methods

*http://www.mkyong.com/java/how-to-execute-shell-command-from-java/

*Run cmd commands through java


text:
Q: Curl automated form filling If i have page like
xxxxxxx.org/2014/custom/code/code.php
and thers a text field and a sumit button
and the form tag for it is as follows
<form action="code.php" method="POST">
    <p class="formtext">
        Enter The Answer Here : <input type=text name="solution" />
        <input name="submit" type=submit class="btn btn-large    btn-success" value="Submit" />
    </p>
</form>
</div>
</html>

so what i want is the i need to pass the value of the text box to code.php using curl
from my local host but it isnt working :/
Edit :
the content of the curl php file is :
  <?php
$name = "ASDF";

//$post = array(
//    'name' => urlencode($name),
//);
$post="solution=$name";
$ch =curl_init();
curl_setopt($ch, CURLOPT_URL , 'http://www.XXXXXXXX.org/2014/custom/code/code.php');
curl_setopt($ch,CURLOPT_POST ,TRUE ) ;
curl_setopt($ch,CURLOPT_POSTFIELDS,$post);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,TRUE);
echo $r = curl_exec($ch);
curl_close($ch);
?>

thers a login at
http://www.XXXXXXXX.org/2014/custom/code/code.php
but i have logged in manually and then i opened up the curl.php file in my browser it takes me to the login page again and after i log in again ,
the curl passes the value to www.localhost/code.php
and not to http://www.XXXXXXXX.org/2014/custom/code/code.php

A: Actuall curl post parameter will be:
$post="solution=$name&submit=Submit";

You are missing submit=Submit.


text:
Q: Extract in a string a pattern starting with and ending with something I need to extract in a string a pattern starting with and ending with something
here is the url :
http://monsite.com/articles/%d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_sto3955603/description.html
In C#, how do I extract from this url the pattern %d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_ ?
The start character of the pattern is % and the ending character is _

A: You can use String.SubString and String.IndexOf methods like;
string s = "http://monsite.com/articles/%d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_sto3955603/description.html";
Console.WriteLine(s.Substring(s.IndexOf('%'), s.IndexOf('_' ) - s.IndexOf('%') + 1));

Output will be;
%d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_

Here a Demonstration.
If you want to check first your string has % or _ charachters or not, you can use String.Contains method like;
if(s.Contains("%") && s.Contains("_") && (s.IndexOf('_') > s.IndexOf('%')))
{
  // Your string has % and _ characters and also _ comes after first %.
}

A: Consider the following snippet...

string input = "http://monsite.com/articles/%d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_sto3955603/description.html";
var output = Regex.Match(input, @"%[\w\d%]*_");
Console.WriteLine(output.Value);

The output is...

%d8%a7%d8%af%d9%85%d9%8a%d9%84%d8%b3%d9%88%d9_


text:
Q: How can I update a React component depending on redux action outcome I have a React component that contains an input. The component dispatches a redux action that calls an API. I want to display a "SUCCESS" message per component but I can't work out how to get the message, other than through the reducer? But if I was to do it through the reducer it would just be a general message that would update all the form components?
//COMPONENT
export default class Stock extends React.Component {

constructor(props) {
    super(props);

    this.state = {
        value: "",
        id: this.props.hit['Name of Item'],
    }
  }

handleChange(e){
    e.preventDefault();
    this.setState({value: e.target.value});
}

handleClick(e){
    e.preventDefault();
    this.props.dispatch(updatePosStock(this.state.value, this.state.id));
}

render() {

    return (

{this.props.hit['Name of Item']}: {this.props.hit.Quantity}

Stock ID: {this.props.hit.objectID}

                <input className="input" value={this.state.value} type="text" onChange={this.handleChange.bind(this)} />
                save

                //MESSAGE TO DISPLAY HERE DEPENDING ON handleClick

        )
    }
}

//ACTION
export function updatePosStock(product, stock){
return function(dispatch) {
    axios.post('/api/v1/product/', {
        product,
        stock
    })
    .then((response) => {
        //console.log(response.data);
        return response.data;
        //dispatch({type: 'FETCH_PRODUCT_FULFILLED', payload: response.data})
    })
    .catch((error) => {
        console.log(error);
    })
}
}

A: If I understand, this component is rendered multiple times on the page and when you trigger action on one, message gets distributed to all the components (because it is not distinguishable between components.
So, I'd set message to be something like:
[{
  message: 'Success',
  item: itemId
},
...]

and when sending a data to api I'd send for which item it is being sent and would just push this message to message array, then in place where you want to display message you put
{this.displayMessage(messagesVar, index) || ''}

So when display message is not falsy it displays message.
messageVar is what your reducer updates.
Display message function is smt like
(messages, id) => {
     currentComponentMsgs = messages.filter((item) => item.id === id);
     return currentComponentMsgs.length > 0
            ? currentComponentMsgs.mat((item) => item.message).reduce((a,b) => a + ', ' + b}
            : '');
  }

I did not have time to check if it all works, but if you propagate id of each elemnt properly, using this pattern you can even have multiple messages recorder in messagesVar, so it serves as kind of a mailbox for components. You can use it on all of your components.

A: There are two ways you can achieve this
1. save your response message (e.g. 'success') in the form of an array
In this case you can define a state such as feedback: [], for example. Then you will set the message this way
...
//dispatch({type: 'FETCH_PRODUCT_FULFILLED', payload: [ product : response.data]})
..

Then in your component you do the following
...
<input className="input" value={this.state.value} type="text" onChange={this.handleChange.bind(this)} />
save

//MESSAGE TO DISPLAY HERE DEPENDING ON handleClick

{this.props.feedback[this.state.value] || ''}

Depending on how you import your states in to your components.
2. Create another property in your redux state or inside this.state={}
 for example inputKey. Then set inputKey value through handleClick(e, inputKeyValue)
You could pass inputKey as a third parameter to the function dispatched and continue with display as should above in you component.
I strongly recommend that you handle all your states with redux and avoid using this.state and this.setState() as much as you can.
I hope it helps.

A: Use callback for your action:
handleClick(e){
    e.preventDefault();
    this.props.dispatch(updatePosStock(this.state.value, this.state.id,
    (code, message)=>{if (code==='OK')this.setState({displayMessage:true, message:"Successfully saved"})}));
}

///ACTION
export function updatePosStock(product, stock, callback){
return function(dispatch) {
    axios.post('/api/v1/product/', {
        product,
        stock
    })
    .then((response) => {
        callback('OK')
        return response.data;
        //dispatch({type: 'FETCH_PRODUCT_FULFILLED', payload: response.data})
    }) .catch((error) => { callback(error.code, error.message)
        console.log(error);
    })
}
}


text:
Q: Can Keylogger apps able to see the messages sent via SendMessage()? I am creating a c# app to send a message in a notepad using the SendMessage() function. I have successfuly passed the strings to notepad. The strings are very important and i was wondering if a keylogger program can see this message?
If yes, do you have any other ideas on how i can send the strings securely?
Below is a sample code i used.
    [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
    public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string   lpszClass, string lpszWindow);

    [DllImport("User32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, string lParam);

    Process[] notepads = Process.GetProcessesByName("notepad");
    if (notepads.Length == 0) return;
    if (notepads[0] != null)
    {
        IntPtr child = FindWindowEx(notepads[0].MainWindowHandle, new IntPtr(0), "Edit", null);
        SendMessage(child, 0x000C, 0, TextBox1.Text);
    }

A: What you're doing is not secure; there are multiple ways a SendMessage call can be spied on by anyone who wants to do so.
SetWindowsHookEx with WH_CALLWNDPROC or WH_CALLWNDPROCRET will let an attacker monitor all messages being sent to a given thread, or they can monitor all messages across the system and just filter out the ones headed to your SendMessage target.
Alternately, an attacker can inject themselves into your recipient process, using WriteProcessMemory to write a DLL name into the recipient process, then CreateRemoteThread and LoadLibrary to load the DLL into the target process. After that, monitoring the process's messages should be fairly trivial.
To avoid using a DLL, an attacker could also use WriteProcessMemory to write code directly into the target process's memory space, then CreateRemoteThread to call it.
All three of these monitoring methods are documented in this CodeProject article. It's admittedly a little old, but the methods should still be relevant, particularly the SetWindowsHookEx one.
An attacker could also hook various Windows APIs directly; it's difficult and somewhat risky, but depending on the sensitivity of your data an attacker might find it a worthwhile approach.
Trying to protect your data will be very difficult, honestly. You can look at how KeePass keeps passwords secure; it's got a setting (at least in the 1.x branch; KeePass 2.x is an entirely different app) to "allow pasting only once and protect against clipboard spies", which might be of some benefit to you. Taking another cue from KeePass, you can also look into Windows' Data Protection API.
As a side note, you may want to replace
SendMessage(child, 0x000C, 0, TextBox1.Text);

with
SendMessage(child, WM_SETTEXT, 0, TextBox1.Text);

for readability. Not many people will recognize 0x000C by itself, although it's possible to guess what the message is based on context.


text:
Q: Php Division remainders & Arrays I have an array
     $blocks
It has 4 items with constant values
   A, B, C, D
$blocks["a"] = 20;
$blocks["b"] = 1000;
$blocks["c"] = 10000;
$blocks["d"] = 50000;

Another function returns a value, lets say 358020
(It's usually high but can drop to a few tens
How would I write a function that will take this value and return an array of how many of each item exists.
Example output something like:
 $output["a"] = 1;
 $output["b"] = 3;
 $output["c"] = 0;
 $output["d"] = 7;

Starting with the largest block, how many of that block fits into the value, then the remainder is passed to the next largest, and so on...

A: calculateNumberCredits(25000);

function calculateNumberCredits($experience) {

    # The credits we have
    $credits = array(
        'a' => '10000',
        'b' => '2000',
        'c' => '1000',
    );

    # Keep track of the amount needed per credit
    $timesCreditNeeded = array();

    # Start calculating the amount per credit we need
    foreach($credits as $creditID => $creditAmount) {

        # 1) Calculate the number of times the amount fits within the amount of experience
        $times = floor($experience / $creditAmount);

        # 2) Calculate the remainder of the above division en cache is for the next     calculation
        $experience = $experience % $creditAmount;

        # 3) Cache the number of times the credit fits within the experience
        $timesCreditNeeded[$creditID] = $times;

    }

    echo '<pre>';
    print_r($timesCreditNeeded);

    return $timesCreditNeeded;

}

// Will return Array ( [a] => 2 [b] => 2 [c] => 1 )

I loop through the credits you have in your system. In this example the credits are order from high to low. When this is not the case you should order them te get the desired result.
1) For each credit i try to find the max number of times the credit fits within the experience of the particular user. Because floatnumber make no sense we floor() the result of the division.
2) After i found the number of times the credit fits, I calculate the remainder for the next iteration (next credit). You can find the remainder by calculating the modulus.
3) Last but not least I cache the number of times the credit fits.
Hope this helps!


text:
Q: HTTP GET request in Javascript with Cookie? I need to do an HTTP GET request in JS, with a pre-definied cookie.
What would be the best way to to that?
Found that, with many ways to do an request, but found no one that supports cookies...
HTTP GET request in JavaScript?

A:     if(!isset($_COOKIE["cookiename"])) {
        setcookie("cookiename","cookievalue");
    } else {
        // This is propably the 2nd call of that site (with cookie)
        // Here your code comes
    }

A: You can't set cookies for a specific request, but you can edit cookies on the clientside if you set them as such.
This cookies script abstracts this aways a bit, because you only have access to the full string, containing all of the cookies in one via document.cookie, natively.
Depending on you want to do, you might be better off setting GET parameters instead.


text:
Q: Pyqt5 Stop Function with Stop Button We control our process with variables like "self.runHunt". If we get the "True" value, we start the time and print our text. When we press stop, we tell it to take the value "false" and stop the process. I think there is no problem here.
But;
Time starts when our function is "while true". At that time, even if we press the stop button, time continues and our value still remains as "True" and cannot update itself. However, after the time expires, the value becomes "false".
My question is how can I get the "false" variable without waiting for the time to complete?
from PyQt5 import QtCore, QtGui, QtWidgets
from operator import index
from PyQt5 import QtCore, QtGui, QtWidgets, QtTest
import random
import threading
import sys

myKeyboard = Controller()

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(850, 350)
        Dialog.setMinimumSize(QtCore.QSize(850, 350))
        Dialog.setMaximumSize(QtCore.QSize(850, 350))
        self.stopPushButton = QtWidgets.QPushButton(Dialog)
        self.stopPushButton.setGeometry(QtCore.QRect(580, 90, 241, 51))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setBold(True)
        font.setWeight(75)
        self.stopPushButton.setFont(font)
        self.stopPushButton.setIconSize(QtCore.QSize(32, 32))
        self.stopPushButton.setObjectName("stopPushButton")
        self.startPushButton = QtWidgets.QPushButton(Dialog)
        self.startPushButton.setGeometry(QtCore.QRect(580, 20, 241, 51))
        font = QtGui.QFont()
        font.setPointSize(11)
        font.setBold(True)
        font.setWeight(75)
        self.startPushButton.setFont(font)
        self.startPushButton.setIconSize(QtCore.QSize(32, 32))
        self.startPushButton.setObjectName("startPushButton")
        self.loopGroup = QtWidgets.QGroupBox(Dialog)
        self.loopGroup.setEnabled(True)
        self.loopGroup.setGeometry(QtCore.QRect(10, 10, 541, 221))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(75)
        self.loopGroup.setFont(font)
        self.loopGroup.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.loopGroup.setAcceptDrops(False)
        self.loopGroup.setAutoFillBackground(False)
        self.loopGroup.setFlat(False)
        self.loopGroup.setCheckable(False)
        self.loopGroup.setObjectName("loopGroup")
        self.huntCheckBox = QtWidgets.QCheckBox(self.loopGroup)
        self.huntCheckBox.setGeometry(QtCore.QRect(240, 35, 35, 20))
        self.huntCheckBox.setText("")
        self.huntCheckBox.setObjectName("huntCheckBox")
        self.huntLabel = QtWidgets.QLabel(self.loopGroup)
        self.huntLabel.setGeometry(QtCore.QRect(20, 35, 61, 21))
        font = QtGui.QFont()
        font.setFamily("Microsoft JhengHei UI")
        font.setPointSize(11)
        font.setBold(True)
        font.setWeight(75)
        self.huntLabel.setFont(font)
        self.huntLabel.setObjectName("huntLabel")
        self.HuntinfoBrowser = QtWidgets.QTextBrowser(self.loopGroup)
        self.HuntinfoBrowser.setGeometry(QtCore.QRect(280, 25, 251, 31))
        self.HuntinfoBrowser.setObjectName("HuntinfoBrowser")
        self.huntCmbBox = QtWidgets.QComboBox(self.loopGroup)
        self.huntCmbBox.setGeometry(QtCore.QRect(100, 25, 121, 31))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.huntCmbBox.setFont(font)
        self.huntCmbBox.setMouseTracking(False)
        self.huntCmbBox.setEditable(False)
        self.huntCmbBox.setMaxCount(100)
        self.huntCmbBox.setInsertPolicy(QtWidgets.QComboBox.InsertAtBottom)
        self.huntCmbBox.setObjectName("huntCmbBox")
        self.huntCmbBox.addItem("")
        self.HuntinfoLabel = QtWidgets.QLabel(self.loopGroup)
        self.HuntinfoLabel.setGeometry(QtCore.QRect(290, 30, 231, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.HuntinfoLabel.setFont(font)
        self.HuntinfoLabel.setText("")
        self.HuntinfoLabel.setObjectName("HuntinfoLabel")

        self.retranslateUi(Dialog)
        self.huntCmbBox.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

        hnt1 = "     10 - 15 sec.   "
        hnt2 = "     16 - 20 sec.   "

        #HUNT
        self.huntCmbBox.addItem(hnt1,[10.1, 15.1])
        self.huntCmbBox.addItem(hnt2,[16.1, 20.1])

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.stopPushButton.setText(_translate("Dialog", "STOP ALL"))
        self.startPushButton.setText(_translate("Dialog", "START"))
        self.huntLabel.setText(_translate("Dialog", "Hunt"))
        self.huntCmbBox.setCurrentText(_translate("Dialog", "    Select Time"))
        self.huntCmbBox.setItemText(0, _translate("Dialog", "    Select Time"))

        self.runHunt = False
        self.stop = False

        self.startPushButton.clicked.connect(self.start)
        self.stopPushButton.clicked.connect(self.stopFunc)
        self.stopPushButton.setEnabled(False)

    def stopFunc(self):
        self.runHunt= False
        self.stopPushButton.setEnabled(False)
        self.startPushButton.setEnabled(True)

    def huntFunction(self):

        index1 = self.huntCmbBox.currentIndex()
        self.seciliCmBox = self.huntCmbBox.currentData()
        self.HuntinfoLabel.clear()

        if index1 == 0 and self.runHunt:
            self.HuntinfoLabel.clear()
            self.HuntinfoLabel.setText(self.HuntinfoLabel.text() + " Error. Stop and select time!")
        else:
            self.HuntinfoLabel.clear()
            self.HuntinfoLabel.setText(self.HuntinfoLabel.text() + " On The Way!")

            while True:

                if self.runHunt:

                    randomTimer = float(random.uniform(self.seciliCmBox[0],self.seciliCmBox[1]))
                    QtTest.QTest.qWait(randomTimer * 1000)
                    self.HuntinfoLabel.setText("in time runhunt is: "+ str(self.runHunt))

                if self.runHunt:

                    #bla bla code
                    self.HuntinfoLabel.clear()
                    self.HuntinfoLabel.setText("in text runhunt is: "+ str(self.runHunt))

    def start(self):

        self.startPushButton.setEnabled(False)
        self.stopPushButton.setEnabled(True)

        t1 = threading.Thread(target=self.huntFunction)

        if self.huntCheckBox.isChecked():
            self.runHunt = True
            t1.start()
        else:
            self.HuntinfoLabel.clear()
            self.HuntinfoLabel.setText(self.HuntinfoLabel.text() + " You need check hunt box.")

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    Dialog = QtWidgets.QDialog()
    ui = Ui_Dialog()
    ui.setupUi(Dialog)
    Dialog.show()
    sys.exit(app.exec_())


text:
Q: Can Synaptic install application from a .tar.gz file downloaded from outside the repositories? I would like to know if Synaptic package manager can install an application from a .tar.gz file downloaded from a different source than is in the repositories in /etc/apt/sources.list.
I mean those files need to run ./configure , make, sudo make install to install. Does Synaptic perform these operations?

A: If you are looking to control your source-code-installation through Synaptic Manager or Ubuntu Software Center (to ease the process of uninstall), you can try
./configure
make
sudo checkinstall

which creates a .deb package. This is can be installed using Ubuntu Software Center.

A: Those file where we need to run ./configure , make, sudo make install are archives with source code of the application in it.
Synaptic is a graphical management software for installing debian packages with all it's dependencies. Those debian packages are precomplied and to put it simply they are just archives containing the binaries and configuration files.
Most modern Linux distributions have a similar systems because compiling every single program by yourself can be partly very painful.
To answer your question: No there is no option to give Synaptic a source package to install it from source, you have to do this by hand.
But, in most cases you will find an other repository or a PPA or even a .deb package for this piece of software.


text:
Q: Evaluate cells of strings in a cell array I have a cell array containing strings and cells, similar to this:
theCellArray = {{'aa1' {'bb'; 'cc'}}; {'aa2' {'dd'; 'ee'}}};

Now I would like to be able to concatenate the names and get something similar to this :
aa1.bb
aa1.cc
aa2.dd
aa2.ee

The number of element might change (so for aa1, there might be bb, cc, dd, ee, etc).
I tried various things, but I'm always unable to make Matlab evaluate the second step of string (the one containing bb, cc...). Any ideas?
EDIT:
There might be more than 2 levels, so theCellArray could be :
theCellArray = {{'aa1' {'bb' {'b1' {'b11' 'b12'} 'b2'}; 'cc'}}; {'aa2' {'dd'; 'ee'}}};

theCellArray is like a tree, so the number of level is unknown.

A: Here's a sweet one:
out = cellfun(@(y) cellfun(@(x) [ y{1} '.' x],y{2},'UniformOutput',false),theCellArray,'UniformOutput',false)
out{:}
ans =

    'aa1.bb'
    'aa1.cc'

ans =

    'aa2.dd'
    'aa2.ee'

Super One liner! (but not very efficient)  And only works with original pose of question with 2 levels of cell strings.

A: Here is a recursive solution:
function t = recCat(s)
if ~iscell(s)
    t = s;
elseif size(s,1) > 1,
    t = [recCat(s(1,:)); recCat(s(2:end,:))];
elseif size(s,2) > 1,
    t0 = cellfun(@(x) strcat('.', x), ...
        cellfun(@recCat, s(2:end),  'UniformOutput', false),  ...
        'UniformOutput', false);
    t = strcat(s{1}, t0{:});
elseif ischar(s{1})
    t = s;
else
    t = recCat(s{1});
end
end

Here is the result for first example:
>> theCellArray = {{'aa1' {'bb'; 'cc'}}; {'aa2' {'dd'; 'ee'}}};
>> recCat(theCellArray)
ans =
    'aa1.bb'
    'aa1.cc'
    'aa2.dd'
    'aa2.ee'

The second, as it stands now fails because of dimension issues in concatenation. I put 'bb' {'b1' {'b11' 'b12'} 'b2'} into another cell so that it has the same number of columns as 'cc' then you get
>> theCellArray = {{'aa1' {{'bb' {'b1' {'b11' 'b12'} 'b2'}}; 'cc'}}; {'aa2' {'dd'; 'ee'}}};
>> recCat(theCellArray)
ans =
    'aa1.bb.b1.b11.b12.b2'
    'aa1.cc'
    'aa2.dd'
    'aa2.ee'

However, you probably meant b11 and b12 to be on the same column not row so in that case:
>> theCellArray = {{'aa1' {{'bb' {'b1' {'b11';'b12'} 'b2'}}; 'cc'}}; {'aa2' {'dd'; 'ee'}}};
>> recCat(theCellArray)
ans =
    'aa1.bb.b1.b11.b2'
    'aa1.bb.b1.b12.b2'
    'aa1.cc'
    'aa2.dd'
    'aa2.ee'


text:
Q: Hex to / from datetime stamp I've an application running on Windows, I don't have the source code, the GUI presents the date as 22/06/2018 08:44, this date/time is written/read from a file. This file contains a Hex representation of the date, some examples below (the latter two have been edited by myself - hence the weird year).
2C 05 0A D4 01 (22/06/2018 08:44)
2C 06 0A D4 01 (22/06/2018 08:51)
2C 08 11 D4 01 (01/07/2018 06:53)
B4 AE 08 D4 01 (06/12/5671 13:13)
B4 AE 11 12 10 (31/07/5270 10:53)

I'm trying to understand the conversion from Hex to the GUI date/time, so that I could modify the Hex in the file direct and see the GUI date/time accordingly
Thanks

A: Edit: The hex numbers are standard Windows 64-bit values representing the number of 100-nanosecond intervals since January 1, 1601, with the three least significant bytes omitted and written as little endian (least significant byte first). For example, your first hex string, 2C 05 0A D4 01, means hex 01D4 0A05 2C00 0000 units at 100 nanos since January 1, 1601 UTC (this is precisely 22/06/2018 08:44:02.9898752 UTC, but your GUI omits seconds and fraction of second).
You can read more here: File Times on MSDN.
For the conversion from date and time to hex you may for example use http://www.silisoftware.com/tools/date.php?inputdate=2018-06-22T08%3A44%3A00%2B00%3A00&inputformat=text, enter your date as 2018-06-22T08:44:00+00:00 and get the hex out as 01D40A05:2A37C800. Round up so it ends in three zero bytes: 01D40A05:2B000000. Reorder the remaining bytes: 2B 05 0A D4 01.
Original answer
It's not a date-time encoding scheme that I have met before. And from the data you have provided I am not able to deduct the full scheme. I believe I have found a bit of the scheme. I cannot get further.
Assuming some linear correspondence I first note by comparing the first two samples that a difference of 1 unit of the second group of hex digits (the second byte if you will) makes for a difference of 7 minutes. Or approximately: we don't know if the times have seconds and maybe even fractions of seconds that are not displayed.
I used this information when comparing to the third sample. The third byte has increased by 7 from the first to the third sample (hex 11 - hex 0A = 7). Taking the increase on the second byte into account it would seem that one unit of the third byte approximates 1832 minutes, which is suspiciously close to 256 * 7 minutes = 1792 minutes. So it would seem that the 2nd and 3rd bytes have a "little endian" relationship, where the 3rd byte is more significant than the 2nd. Using this information we can obtain a little more accuracy: The difference in the times is 12849 minutes, and the difference on the 2nd and 3rd byte is hex 1108 - 0A05 = decimal 1795, so each unit is 7.1582 minutes (it agrees with the 7 minutes from before, only it's more precise). Using this value I interpolated the second date-time from the hex value 2C 06 0A D4 01 and got 2018-06-22T08:51:09. It agrees. Hypothesis confirmed!
The information found so far suffices for encoding values between 09/06/2018 14:43 (2C 00 00 D4 01) and 01/05/2019 09:17 (2C FF FF D4 01) with a precision of 7 minutes. I'd be surprised if that were enough for you.
Comparing to the value in the 4th sample it would seem that one unit on the first byte corresponds to 14 128 940 minutes (26.86 years). It doesn't divide nicely by the 7.1582 minutes from before, as we might have hoped, so I'm not sure how we might use this observation.
Comparing the last two samples it seems that the 4th and 5th byte cannot have the same little endian relationship since the 5th byte increases while the date decreases. It's still possible, though, if we assume that at least one of the years is before the common era ("BC") since era is not printed. Another possibility might be that the fifth byte is ignored. This leads to a unit of the fourth byte corresponding to 1 088 006 minutes. Again it bears no nice relationship to the 7.15 minutes from bytes 2 and 3, and it's suspicously close to the unit of the first byte, so probably incorrect.
To learn more: First try to see if you get a meaningful date-time from editing (hex) 00 00 00 00 00 into your file. If you do, next try one F at a time:
F0 00 00 00 00
0F 00 00 00 00
…
00 00 00 00 0F

If this doesn't make a pattern that is clear enough, try one bit at a time, using hex digits 1, 2, 4 and 8 instead of F.