text:
Q: Change style on attributes, remove bullet list I finally find this code to show the attributes on a single product page, but I would like to change the style of the attributes list, i would like to replace the bullets with icons.
How can i do it?
thanks in advance
function isa_woocommerce_all_pa(){

    global $product;
    $attributes = $product->get_attributes();

    if ( ! $attributes ) {
        return;
    }

    $out = '
';

    foreach ( $attributes as $attribute ) {

        // skip variations
        if ( $attribute->get_variation() ) {
        continue;
        }
        $name = $attribute->get_name();
        if ( $attribute->is_taxonomy() ) {

            $terms = wp_get_post_terms( $product->get_id(), $name, 'all' );
            // get the taxonomy
            $tax = $terms[0]->taxonomy;
            // get the tax object
            $tax_object = get_taxonomy($tax);
            // get tax label
            if ( isset ( $tax_object->labels->singular_name ) ) {
                $tax_label = $tax_object->labels->singular_name;
            } elseif ( isset( $tax_object->label ) ) {
                $tax_label = $tax_object->label;
                // Trim label prefix since WC 3.0
                if ( 0 === strpos( $tax_label, 'Product ' ) ) {
                   $tax_label = substr( $tax_label, 8 );
                }
            }

            $out .= '
';
            $out .= '' . esc_html( $tax_label ) . ':  ';
            $out .= '';
            $tax_terms = array();
            foreach ( $terms as $term ) {
                $single_term = esc_html( $term->name );
                // Insert extra code here if you want to show terms as links.
                array_push( $tax_terms, $single_term );
            }
            $out .= implode(', ', $tax_terms);
            $out .= '
';

        } else {
            $value_string = implode( ', ', $attribute->get_options() );
            $out .= '
';
            $out .= '' . $name . ':  ';
            $out .= '' . esc_html( $value_string ) . '
';
        }
    }

    $out .= '
';

    echo $out;
}
add_action('woocommerce_single_product_summary', 'isa_woocommerce_all_pa', 25);

A: Target the list items using the :before pseudo class and add your icons that way.
ul li:before {
  content: '';
  background-image: url('icon.png');
}


text:
Q: When i use this php the results show all the table not the specific condition that table1.id = table2.id
*

*table 1

|---------------------|------------------|
|   User_id Primary   |      Email       |
|---------------------|------------------|
|         1           |      a@a.com     |
|---------------------|------------------|
|         2           |      b@b.com     |
|---------------------|------------------|

*

*table 2

|---------------------|------------------|
|   Post_id Primary   |  User_id Foreign |
|---------------------|------------------|
|         1           |       1          |
|---------------------|------------------|

Here's the code
$conn1 = @mysqli_connect('127.0.0.1','root','','signup');

$sql1 = "SELECT post_pic ,post_text FROM table2 INNER JOIN table1
    ON (table2.User_id = table1.User_id) " ;

$result = mysqli_query($conn1, $sql1);

if(mysqli_num_rows($result)>0){
     while ($row = mysqli_fetch_array($result)){

so when im logged in user id=2 user id=1 posts are shown

A: You need to specify the user id in your query, why you are getting images for user 1 is that your code at the moment runs as expected.
If you want to get data only for user1, you need to add a where clause specifying the user ID.
Like so:
//For Arguments Sake
$user_id = $_SESSION['loggedin_user_id'];

$sql1 = "SELECT post_pic ,post_text
         FROM table2
         INNER JOIN table1
         ON (table2.id = table1.id)
         WHERE table2.User_id = '$user_id'";

EDIT: Actually I just noticed that @04FS already mentioned it in a comment.

redpajama_set_name: RedPajamaStackExchange


text:
Q: JavaScript creating HTML5/XML element node To create an element to be used in a HTML5 document with JavaScript we can use the createElement() and createElementNS() methods from DOMDocument objects:
var node = document.createElement(element);
var node = document.createElementNS(nameSpace, element);

These commands create a node and than we can put it at some point of the document tree using appendChild(). My first question is: do the document.createElement() and document.createElementNS() functions store the node object they return at some place in the document object?
Second, is it possible to create an element node object (possibly using a name space) independent of specific document objects and later on to append it in the document tree of some documentobject given? That is, are there functions similar to createElement() and createElementNS() which are not members of a specific object (like the document object, as is the case above)?
Third, is it possible to create an element node object using a given document object document1 and them to append it on the document tree of another document object document2?

A:
My first question is: do the document.createElement() and document.createElementNS() functions store the node object they return at some place in the document object?

No, the implementation may do something like that internally, but nothing like that is exposed externally.

is it possible to create an element node object (possibly using a name space) independent of specific document objects and later on to append it in the document tree of some documentobject given?

The answer to this question is also no: each element, in general, each node is bound to the document object used to create it, which is referenced by the ownerDocument property.

Third, is it possible to create an element node object using a given document object document1 and them to append it on the document tree of another document object document2?

Yes, the second document has to adopt the node, via the adoptNode method. With DOM4 this method will mostly become unnecessary, since it's primarily used before insert a foreign node in a document, and DOM4 specifies that the adoption in such case is implicit.


text:
Q: SQL*Loader ORA-01821 So, apparently in Oracle 12.2 the following works
SDATE TIMESTAMP "YYYYMMDDHH24MISS",
But in 12.1, not so much.
SQL*Loader-951: Error calling once/load initialization
ORA-01821: date format not recognized

I have exactly the same ldr file on two different databases, one works and one not.
I don't really want to change the extract program to shorten the timestamp, but when I try an inline
"to_timestamp(substr(:SDATE,1,12), 'YYYYMMDDHH24MISS')" I get the same error.
Can someone shed any light? My brain is spinning around this a bit too fast.
Basically: I have a solution to the immediate problem, run it on the other server.
However, someone is going to want to know why, and "'cause it doesn't work otherwise" doesn't cut it for non-tech folks. :)
If anyone else has seen this and/or knows the document number, that would help.


text:
Q: How can i upload file and other parameter using NSURLConnection I am using NSURLConnection to send same data (NSString) to the server and i would like to add with them an image or a file so what's the value of the content type?
Encoding
- (NSData *)encodingData:(NSMutableDictionary *)dictionary
{
    NSMutableArray *arrayPosts = [[NSMutableArray alloc] init];
    [dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
         NSString *encodedKey = [key stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
         NSString *encodedValue = [obj stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        [arrayPosts addObject:[NSString stringWithFormat:@"%@=%@",encodedKey,encodedValue]];
    }];
    NSString *encodedArrayPosts = [arrayPosts componentsJoinedByString:@"&"];
    return [encodedArrayPosts dataUsingEncoding:NSUTF8StringEncoding];
}

Send Data
- (void)startAsyncRequest
{
   // Enable the network activity indicator in the status bar
   [self enableActivityIndicatorInStatusBar];

   // Setting of the request
   NSMutableURLRequest *urlRequest = [[NSMutableURLRequest alloc] initWithURL:self.url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
   [urlRequest setHTTPMethod:self.method];
   [urlRequest setHTTPBody:[self encodingData:self.dictionaryPosts]];

   // Send the request
   NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];

   if (connection) {
      // Connection succeded
     self.receiveData = [NSMutableData data];
   } else {
      // Connection Failed
      self.error = @"Connection Failed";
      // Inform the user that the connection failed
      [self.delegate requestFailed:self];
   }
}

A: You need to pass the data into as stream type in your server
public InsertImage(Stream stream)

Something like that then parse the stream type.
This is how to build your request using some boundaries
- (NSURLRequest *)buildRequest:(NSData *)paramData fileName:(NSString *)name {
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
    NSString *charset = (NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding));
    [request setURL:self.url];
    [request setHTTPMethod:self.method];

    NSString *boundary = @"0xKhTmLbOuNdArY";
    NSString *endBoundary = [NSString stringWithFormat:@"\r\n--%@\r\n", boundary];

    NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; charset=%@; boundary=%@", charset, boundary];
    [request addValue:contentType forHTTPHeaderField: @"Content-Type"];

    NSMutableData *tempPostData = [NSMutableData data];
    [tempPostData appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

    // Sample Key Value for data
    [tempPostData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"%@\"\r\n\r\n", @"Key_Param"] dataUsingEncoding:NSUTF8StringEncoding]];
    [tempPostData appendData:@"Value_Param"] dataUsingEncoding:NSUTF8StringEncoding]];
    [tempPostData appendData:[endBoundary dataUsingEncoding:NSUTF8StringEncoding]];

    // Sample file to send as data
    [tempPostData appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"userfile\"; filename=\"%@\"\r\n", name] dataUsingEncoding:NSUTF8StringEncoding]];
    [tempPostData appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
    [tempPostData appendData:paramData];
    [tempPostData appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
    [request setHTTPBody:tempPostData];
    return request;
}

You should get the stream type data on your server side and parse it, you can get the value base on the Key you pass e.g. Key_Param, and the name(fileName)of the file you send.


text:
Q: Vagrant, error when running vagrant up --provider=docker I'm trying to test the new docker support in vagrant 1.6. I'm on windows and I've setup my vagrant file but when I run "vagrant up --provider=docker" I get the following:
Bringing machine 'default' up with 'docker' provider...
==> default: Docker host is required. One will be created if necessary...
default: Vagrant will now create or start a local VM to act as the Docker
default: host. You'll see the output of the `vagrant up` for this VM below.
default:
default: Box 'mitchellh/boot2docker' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
default: Loading metadata for box 'mitchellh/boot2docker'
default: URL: https://vagrantcloud.com/mitchellh/boot2docker
default: Adding box 'mitchellh/boot2docker' (v0.8.0) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/mitchellh/boot2docker/version/1/provider/virtualbox.box
default: Progress: 100% (Rate: 2999k/s, Estimated time remaining: --:--:--)
The executable 'bsdtar' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.

A: a fast solution is to attach the path of the mingw binary location to the system's Path variable, e.g.:
C:\HashiCorp\Vagrant\embedded\mingw\bin
Remember to separate path entries with a ;.

A: *

*Uninstall Vagrant completely, remove C:\HashiCorp.

*Reinstall Vagrant.

This will fix everything.

A: *

*Go to Programs and Features

*Find Vagrant and Repair

No need to reinstall :)

A: Download & Install package follow instruction here http://gnuwin32.sourceforge.net/packages/libarchive.htm
then update your Path environment variable to include the installed path of bsd executable, usually C:\Program Files (x86)\GnuWin32\bin


text:
Q: Error: "Aesthetics must either be length one or the same length" in R I try run the following function in R:
GainChart <- function(score, good.label, n.breaks = 50, ...){

  df <- data.frame(percentiles = seq(0, 1, length = n.breaks),
                   gain = Gain(score, good.label, seq(0, 1, length = n.breaks)))

  p <-  ggplot(df, aes(percentiles, gain))  + geom_line(size = 1.2, colour = "darkred")
  p <- p + geom_line(aes(x = c(0,1), y = c(0,1)), colour = "gray", size = 0.7)
  p <- p + scale_x_continuous("Sample Percentiles", labels = percent_format(), limits = c(0, 1))
  p <- p + scale_y_continuous("Cumulative Percents of Bads", labels = percent_format(), limits = c(0, 1))
  p
}

And I received the following error message: "Error: Aesthetics must be either length 1 or the same as the data (50): x, y"
The command for call the function is:
GainChart(data_sampni$score,data_sampni$TOPUP_60d)

A: Your second geom_line() doesn't make sense. It seems that you are trying to draw a line between [0,0] and [1,1]. In that case, use geom_abline():
+ geom_abline(aes(intercept = 0, slope = 1))

A: The help for geom_line says that if data=NULL (the default) then the data is inherited from the parent graph.  That is where your mismatch is coming from.
Iy you change the second line to something like:
p <- p + geom_line(aes(x,y), data=data.frame(x=c(0,1), y=c(0,1)))

Then it should work.


text:
Q: Although I change the text of label it still returns initial value, how can I solve? Although I assign the text to the label (lblDoc), for
<%FillRpt(rpt, lblDoc.Text , UserId);%>

lblDoc.Text is Label.
<asp:Label ID="lblDoc" runat="server" Text="Label" Visible="false"></asp:Label>

I changed the Text value but still it return "Label". How can I change it?
the case is below:
 $.ajax({
                type: "POST",
                url: "FileManager.aspx/foo",
                data: "{}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                    $("#<%=lblDoc.ClientID%>").text(selectedPath);
                    <%FillRpt(rpt, lblDoc.Text , UserId);%>
                },
          });

A: Yes you are updating the client representation of a Label control on the client browser, but this  value won't be read on the server code for two reasons:

*

*When you do an HTML post on a page, only the form input fields are sent to the server, the Label control renders as a <span id="<ClientID>"> therefore the content of the span won't be sent as data to the server

*Even if the span content tag were sent to the server, its value would be overridden with the Label value stored in the ViewState
Your code won't work the way you are trying for the above reasons, and (as far as I know) the ViewState field cannot be decrypted using JavaScript
As an alternative:

*

*Keep changing the text of the span tag representing the Label

*Add a hidden field, and when you change the Label text in JavaScript, replicate the same value in this hidden field, finally, in your server code use this value to change the Label.Text property

A: Why do you need the <% tags?  You should just be able to do :
$("#lblDoc").text(selectedPath);

A: I solve the problem via using Web Method which return JSON data.

And after that
  $.ajax({
                type: "POST",
                url:
                data:
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function(msg) {
                   //.........
                    });
                },
                error: function(msg) {

                },
            });

in the success part, I do what I want. For example I append some data to any tag such as
$("#stackOverflow").append(....)


text:
Q: Android Studio: ActionBar.TabListener does not work with AppCompatActivity? I am trying to upgrade some code from FragmentActivity to AppCompatActivity and ActionBar to android.support.v7.app.ActionBar due to deprecation. I've spent a few hours trying to fix this, but I am sure someone with more experience might be able to solve this very quickly.
So my class looks like this now:
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
//...many other imports here
public class MyClass extends AppCompatActivity implements ActionBar.TabListener{

@Override
public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
}
//other code here...
}

My problem is that I am getting an error because Android Studio does not recognize the onTabSelected method signature in the superclass. Changing the tab paramenter to simply "Tab tab" instead of "ActionBar.Tab tab" doesn't help either.
Does anybody have any ideas?

A: Like i said, it is deprecated.
See: http://developer.android.com/intl/en/reference/android/support/v7/app/ActionBar.TabListener.html

This interface is deprecated. Action bar navigation modes are
  deprecated and not supported by inline toolbar action bars. Consider
  using other common navigation patterns instead.

And about your problem:

Action bar tabs can be replaced by:

*

*TabLayout from the Android Design Support Library, with or without a
  ViewPager; or

*a ViewPager and your favorite other tab solution for it, whether that
  be PagerTabStrip or any number of third-party tab implementations; or

*FragmentTabHost

Check this link: ActionBarActivity and ActionBar.TabListener is deprecated inside Android Tab Fragment ( Eclipse ApI 22 )


text:
Q: Apple Push Notification Service with PHP Script I'm trying so send push notifications ton my iPhone (APNS). I read this post and try to implement it. So all my certificates are good (normaly).
Now I have this php script :
$device = '4f30e047 c8c05db9 3fa87e7d ca5325f7 738cb2c0 0b4a02d4 d4329a42 a7128173'; // My iphone deviceToken
$payload['aps'] = array('alert' => 'This is the alert text', 'badge' => 1, 'sound' => 'default');
$payload['server'] = array('serverId' => $serverId, 'name' => $name);
$output = json_encode($payload);

$apnsCert = 'apple_push_notification_production.pem';

$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $apnsCert);

$apns = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $error, $errorString, 2, STREAM_CLIENT_CONNECT, $streamContext);

$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '', $device)) . chr(0) . chr(strlen($payload)) . $payload;
fwrite($apns, $apnsMessage);

//socket_close($apns); seems to be wrong here ...
fclose($apns);
When I run this script nothing happen. no error just an empty page but my iPhone doesn't receive the push notification ...
Have you got an idea?
Thanks a lot !

A: no space in device token, strip them

A: For development certificate you need url
 'ssl://gateway.sandbox.push.apple.com:2195'
but for production
 'ssl://gateway.push.apple.com:2195'

A: Strip the spaces from token and even then it's not work then
$apnsHost = 'gateway.sandbox.push.apple.com';

Remove "sandbox" from this url and it will run.

A: If you have more than one device and you loop through them I found that you have to create a new stream_context_create for each fwrite to prevent apple from closing the connection for a bad token.
FYI

A: To send notifications success fully you have to do 1 more thing.
Replace $output = json_encode($payload);
to $payload = json_encode($payload);

A: You are missing to provice certificate private key. Add this row:
stream_context_set_option($streamContext, 'ssl', 'passphrase', $certificatePrivateKey);


text:
Q: Use Retina resolution in Microsoft Remote Desktop I've been trying to set up my new MacBook Pro [with Retina display 2015 edition]. I use a lot of university software via Remote Desktop connection, it worked very well on my Acer laptop and it's vital that this staff works as good as on Windows machines.
The problem is that when I open the connection on MacBoook the display is not great - I can see pixels, just like my grandmas' TV from the 1970s. I tried with different resolution settings, still the same.

A: Click the Pencil [edit] Icon at the top of the main RDC window & set a higher remote screen resolution.
'Native' might be as good as it will let you have.
Scale content might not be good on a Retina screen - but it might appear quite small without it checked.

I have a feeling, which I'm unable to test, that it may be related to the maximum resolution of the remote machine's graphics, not the local - as you can always set the local machine to scale the remote's resolution to fit the local screen - e.g. for dual monitor remote, single monitor local.

A: I'm using "Microsoft Remote Desktop BETA" 10.2.3 https://rink.hockeyapp.net/apps/5e0c144289a51fca2d3bfa39ce7f2b06/ which has an option for retina display:

*

*right click the remote desktop connection > edit

*display > check "optimize for retina displays"

*Disconnect/reconnect to the machine. In my case I had to also reboot the remote machine but that may have been specific to my setup.

The windows 10 machine I remote into looks much better once I toggle this on.
Chris

A: Microsoft Remote Desktop doesn't support Retina throughput and scales the content by changing the resolution that is advertised. You can change this by setting the resolution of your display to a non-HiDPI resolution, such as literal 2880x1800, however everything will appear tiny unless you are able to directly set the HiDPI setting on the server which you are connecting to.

A: Here's something you might want to look at, as I have this issue connecting from my Win7 PC at work to some other PCs at work: Pixellated type.
It may be that cleartype is turned off for the RD session:
Right click on the desktop in the RD session and select Screen resolution. Then click on the "Make Text and other items larger or smaller" link and then the "Adjust ClearType text" link. There you can see if cleartype is off, if so check the "turn on cleartype" checkbox and go through the brief wizard (I usually just click next on each screen as the defaults are usually fine).
When you are done the type (at least) is much better.


text:
Q: Does Jasmine's toThrow matcher require the argument to be wrapped in an anonymous function? The documentation at https://github.com/pivotal/jasmine/wiki/Matchers includes the following:
expect(function(){fn();}).toThrow(e);

As discussed in this question, the following does not work, because we want to pass a function object to expect rather than the result of calling fn():
expect(fn()).toThrow(e);

Does the following work?
expect(fn).toThrow(e);

If I've defined an object thing with a method doIt, does the following work?
expect(thing.doIt).toThrow(e);

(If so, is there a way to pass arguments to the doIt method?)
Empirically the answer seems to be yes, but I don't trust my understanding of JavaScript scoping quite enough to be sure.

A: Let's take a look at the Jasmine source code:
try {
  this.actual();
} catch (e) {
  exception = e;
}
if (exception) {
  result = (expected === jasmine.undefined || this.env.equals_(exception.message || exception, expected.message || expected));
}

This is the core part of the toThrow  method. So all the method does is to execute the method you want to expect and check if a exception was thrown.
So in your examples, fn or thing.doIt will be called in the Jasmine will check if an error was thrown and if the type of this error is the one you passed into toThrow .

A: We can do away with the anonymous function wrapper by using Function.bind, which was introduced in ECMAScript 5.  This works in the latest versions of browsers, and you can patch older browsers by defining the function yourself. An example definition is given at the Mozilla Developer Network.
Here's an example of how bind can be used with Jasmine.
describe('using bind with jasmine', function() {

    var f = function(x) {
        if(x === 2) {
            throw new Error();
        }
    }

    it('lets us avoid using an anonymous function', function() {
        expect(f.bind(null, 2)).toThrow();
    });

});

The first argument provided to bind is used as the this variable when f is called. Any additional arguments are passed to f when it is invoked. Here 2 is being passed as its first and only argument.

A: Sadly, it seems that if I need to test a function that takes parameters, then I will need to wrap it with a function.
I would rather have preferred,
expect(myTestFunction, arg1, arg2).toThrow();

But I am ok with explicitly doing
expect(function(){myTestFunction(arg1, arg2);}).toThrow("some error");

FYI, note that we can also use a regex match on error:
expect(function (){myTestFunction(arg1, arg2);}).toThrowError(/err/);

A: If it is used like this:
expect(myTestFunction(arg)).toThrowAnyError(); // incorrect
Then the function myTestFunction(arg) is executed before expect(...) and throw an exception before Jasmine has any chance of doing anything and it crashes the test resulting in an automatic failure.
If the function myTestFunction(arg) is not throwing anything (i.e. the code is not working as expected), then Jasmine would only get the result of the function and check that for errors - which is incorrect.
To alleviate this, the code that is expected to throw an error is supposed to be wrapped in a function. This is passed to Jasmine which will execute it and check for the expected exception.
expect(() => myTestFunction(arg)).toThrowAnyError(); // correct


text:
Q: How to use WMI to query IP address from specific NIC? I have a computer with two NICs. I'm trying to query the IP address of each NIC separately to use in BGInfo.
This article describes how to query the IP address of only active network interfaces. It uses the following WMI query
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled=True

However, I want to query each IP address separately by referencing the name of the NIC. I've tried the following query but it fails due to being invalid.
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE Name=""

How do I use WMI to query the IP address of a specific NIC? There are few resources available.

A: How to use WMI to query IP address from specific NIC?
You need to select one property to make this specific and the correct, like:
Description MAC Address IPAddress:
Get this from the command line and remove any unnecessary ones (in this example):
wmic nicconfig get macaddress,description|findstr /vb "Microsoft Bluetooth WAN Miniport"

*

*In the output of the command, select the mac address already distinguishing which is Ethernet and which is Wi-Fi if applicable, if not, use the 'interfaces' that apply to your case:

Description                               MACAddress
Realtek PCIe GBE Family Controller        E1-4B-AF-9F-FE-D2
Intel(R) Dual Band Wireless-AC 3165       2C-04-0E-50-F0-E5

*

*Add this each mac address accorded with this query in BGInfo:

 IP ehernet:
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration where MACAddress='E1-4B-AF-9F-FE-D2'

IP wireless:
SELECT IPAddress FROM Win32_NetworkAdapterConfiguration where MACAddress='2C-04-0E-50-F0-E5'

*

*Results:

Obs.: These are the devices removed for this example (the unnecessary ones):
wmic nicconfig get macaddress,description|findstr /vb "Microsoft Bluetooth WAN Miniport"

Microsoft Kernel Debug Network Adapter
Realtek PCIe GBE Family Controller
Intel(R) Dual Band Wireless-AC 3165
Microsoft Wi-Fi Direct Virtual Adapter
Bluetooth Device (Personal Area Network)
WAN Miniport (SSTP)
Microsoft Wi-Fi Direct Virtual Adapter
Apple Mobile Device Ethernet

Note: For purposes of illustration, I used the same mac address in both requests, which explains the same ip in both, also the mac address came from one fake mac address generate

A: You can query like this to get the IP address of specific network adapter:
wmic path win32_networkadapterconfiguration where "IPEnabled=True" get caption,ipaddress | find /i "ADAPTER NAME"

For all adapters (with IP enabled):
wmic path win32_networkadapterconfiguration where "IPEnabled=True" get caption,ipaddress


text:
Q: PowerShell e-mail - sending .csv in body with HTML I have a powershell script that runs a mysql query, and exports the output to a .csv file.
It then imports it, sends it to a $body variable and e-mails it.
Here is the code
### Script to write body of e-mail to $body variable ###

$body = @"
CHECK 4A - MONTH DATABASE REPORT

Row count should be between 3-4k, but less on a Monday.

"@  + (Import-CSV  C:\Users\*****\Documents\Reports\result4A.csv | Out-String)

I want to use a bit of HTML in the e-mail too, just to make it a bit easier to read, so I used the -BodyAsHtml parameter:
### Send e-mail ###

send-mailmessage -from " Daily Check <server@company.com>" -to "Admin <e-mail@company.com>" -BodyAsHtml -subject "Daily Server Checks Report" -body "$body" -priority High -dno onSuccess, onFailure -smtpServer **.*.*.**

The problem is that this means the .csv file isn't displayed correctly in the e-mail, as the e-mail body is changed to HTML. Is there any way around this? I would like to keep the export to .csv solution if possible.

A: $csvHTML = Import-Csv C:\Users\*****\Documents\Reports\result4A.csv  | ConvertTo-Html

$body = @"
    ....
"@ + ($csvHTML[5..($csvHTML.length-2)] | Out-String)

This will convert the CSV file to HTML. Then you can simply select

 tags that contain the CSV (skip first 5 and last 2 lines) and add it to the body of your email.


text:
Q: React-native run a function for a specified length of time I am writing a react native app that scans for bluetooth low energy devices.
I have a function, scan, which searches for devices, and a function stopScan, which stops the search. When the user presses the 'scan' button, I want this function to run for five seconds, and then stop and present the results. Effectively I want something like this:
foo = () => {
    this.scan()
    //WAIT FIVE SECONDS
    this.stopScan()
}

I've looked at setTimeout etc, but I don't see how they solve the problem. I'm also anxious to do this correctly, as I know that blocking the event loop can be problematic.
Edit:
  findDevices = () => {
      this.setState({ scannerStatus: "scanning" });
      this.scanAndConnect();
      setTimeout(this.manager.stopDeviceScan, 5000);
      this.setState({ scannerStatus: "scanned" });
  };

  scanAndConnect() {
    this.manager.startDeviceScan(null, null, (error, device) => {
      this.info("Scanning...");

      if (error) {
        console.log(error);
        this.manager.stopDeviceScan();
        this.error(error.message);
        return;
      }

      if (device.name === "foo") {
        this.info("Connecting to device");
        device
          .connect()
          .then(device => {
            this.info("Discovering services and characteristics");
            return device.discoverAllServicesAndCharacteristics();
          })
          .then(device => {
            this.info("Setting notifications");
            return this.setupNotifications(device);
          })
          .then(
            () => {
              this.info("Listening...");
            },
            error => {
              this.error(error.message);
            }
          );
      }
    });
  }

A: If you need to call the scan function in repetition for 5seconds you can do like this:
 foo = () => {
      const scanInterval = setInterval(this.scan, 250) // It will call the scan function every 250ms

      setTimeout(() => {
        clearInterval(scanInterval)
        this.stopScan()
      }, 5000) // Stop the interval after 5s

    }

If you just need to call the stopScan() function after 5s, you can use a simple timeout:
foo = () => {
  this.scan()
  setTimeout(this.stopScan, 5000)
}

Which one you need to use depends on the actual implementation of scan() and stopScan()
EDIT: I have seen your code. The main issue is that setTimeout is NOT a blocking function. It will NOT block the execution until the time has passed (ie 5second), but it will only execute the function you pass as first parameter after the delay. So your code:
setTimeout(this.manager.stopDeviceScan, 5000);
this.setState({ scannerStatus: "scanned" });

will immediately set the scannerStatus to scanned, without waiting 5s. You need to set the call inside the timeout callback:
setTimeout(() => {
   this.manager.stopDeviceScan();
   this.setState({ scannerStatus: "scanned" });
}, 5000);


text:
Q: SCNScene / SCNSphere's visible area I have a SCNScene that contains a SCNSphere encapsulating the SCNCamera (camera is inside @ center of the SCNSphere, displaying its inner wall on screen).
Is there a method to query or a way to infer / calc the VISIBLE area of this sphere? I dont want the area of the screen in points, or the area of the scene itself, but what the camera is able to render from this sphere in a given device's screen (ipad and iphone do show a different amount of a 360 frame)
Help appreciated.

A: CameraNode.positions just set on the front
    cameraRollNode.position = SCNVector3(x: 0, y: 0, z: X)

Set sphere material:
    sphere_.firstMaterial!.cullMode = SCNCullMode.Front;

PIC had two sphere.
HOLP it useful.


text:
Q: WPF container with fix size children I want a container that have 3 columns and in each column, the cell can wrap it's content like the picture below

So far, I've done this:
    <ListBox Name="listQuestion">
        <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
                <UniformGrid Columns="3"/>
            </ItemsPanelTemplate>
        </ListBox.ItemsPanel>
    </ListBox>

But the result is every cell have the same size as the biggest cell.

A: If you want to have a grid with three separate lists as their columns you should be able to use a combination of a Grid and a listbox
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition />
        <ColumnDefinition />
        <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <ListBox Grid.Column="0"/>
    <ListBox Grid.Column="1"/>
    <ListBox Grid.Column="2"/>
</Grid>

A grid will give you the most flexibility in your layout and allows you to have elements span multiple columns or rows. If you don't need all that flexibility you could use a stackpanel instead
<StackPanel Orientation="Horizonal">
    <ListBox/>
    <ListBox/>
    <ListBox/>
</StackPanel>


text:
Q: how to filter tableView cell on button click, if cell textField having string as of button name in swift I want to filter the tableView cell on button click, show the cell if the cell's one element has the same string as that of button code. A Button is a collection view cell and all the buttons have some code. When I click on 1st button cell, the table needs to filter the cell having value as that of button code.
//Button UICollectionView

    func collectionView(_ collectionView: UICollectionView, cellForItemAt
     indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier:
       "buttonCell", for: indexPath as IndexPath) as! SPCollectionViewCell

        // static cell
        if (indexPath.row == 0) {
            cell.zoneLbl?.text = "All"
            code = "00"
        }else{
            var item2 = self.zoneList[indexPath.row - 1]
            code = item2["ListID"] as? String
            cell.zoneLbl?.text = item2["ListName"] as? String
         }
       return cell
       }

//TableView

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

        let cell = tableView.dequeueReusableCell(withIdentifier: "serviceProvider", for: indexPath ) as! serviceProviderTableViewCell

        let item = self.listData[indexPath.row]
        ZoneCategoryID =  item["ZoneCategoryID"]  as? String

        cell.serviceProviderName?.text = (item["CompanyName"] as? String)?.uppercased()
        cell.addressLbl?.text = item["Address"] as? String
        cell.emailLbl?.text = item["Email"] as? String
        cell.mobileNoLbl?.text = item["Phone"]  as? String
        zonee =  item["ListName"]  as? String
        TypeId = item["TypeID"]  as? String
        ServiceWellnessID =  item["ServiceWellnessID"]  as? String

       return cell
}

Here "code" value is same as "ZoneCategoryID".
Thanks in advance.


text:
Q: How to take out some part of a string which contains a mathematical expression and give the result I'm working on a command for a discord bot:
Someone types /calc (some-math-expression), eg. /calc 4+5.
I'd like to evaluate 4+5 and display the answer.
For this, I believe I have to take the '4+5' out of the string, calculate it, and return the answer.
How do I do it?
I tried doing this, it may be stupid, I'm new to this. (I'm using else if because I have other inputs for the bot)
else if (message.content === '/calc' + exp) {
    return Number(exp);
}

Apparently, this doesn't assign the '(some-math-expression)' to the exp var which I've defined before.
The bot shows no output.
Is there a method that splits the string into /calc and something else I could assign to a variable automatically?
Thanks!

A: While this answer would work, this could be used in a malicious way: the code will run everything in the string, so if somebody writes the right thing they could insert code into the bot, making it vulnerable to attacks. They could, for example, turn it off with /calc client.destroy() or read its token with /calc client.token: it's good practice not to make the eval command publicly accessible.
Instead of that, I would use a more secure method, with the mathjs package.

You can parse the expression as said in other answers, then use math.eval() to make it resolve the expression. You can find the docs here.
Here's a quick example:
var mathjs = require("mathjs");

let cmdString, mathExpression;

// This will just return the expression
function getExp(command = '') {
    return command.split('/calc')[1].trim();
}

cmdString = "/calc4+5"; // If this is the command...
mathExpression = getExp(cmdString); // ...this will be '4+5'
// Make the result with mathjs.eval()
let result = mathjs.eval(mathExpression); // 9

This is an easy way that works even with more complex operations, like sqrt() and cos(). It will also work with imaginary numbers and all sorts of stuff that no one would ever ask to a Discord bot.
You can try the package with RunKit: link.

A: I an not sure how you are getting the message.content and exp. But, as per my understanding you can do something as follows:
let cmdString = "/calc4+5";
let mathExpression = cmdString.split("/calc")[1];
let result = eval(mathExpression);

result is what your resultant values of the expression.
Thanks...

A: The easiest way for you to parse your input would be to use String.split. That is...
const words = message.content.split(' ');
const command = words[0];
const variables = words.splice(1).join(' ');

here command will become '/calc' and variables will become '4+5'
This works because in any input that you need your discord bot to handle, the first word will always be the command.

A:

let message = '/calc 4+5'

let equation = message.replace(/\/calc/, '').trim();
let answer = eval(equation)
console.log(equation+' =', answer )

You can achieve your function using the following Regular expression.

let message = '/calc 4+5'

if (equation = message.match(/^\/calc(.+)/)) {
 let answer =  eval(equation[1].trim());
 console.log(equation[1]+' =',answer)
}


text:
Q: Background color of 'Highlight Text' in WPF Datagrid cell This is not the simple "IsSelected" background color of a datagrid row.  What I am referring to is when I am in a datagrid, that has editable data, I click in a given cell and have any text (for example an address), if I select part of the text, the HIGHLIGHT coloring is what I want to change...  I assume it would be part of the DataGridCell styling, but not sure where.

A: You are looking for the TextBoxBase.SelectionBrush Property.  From the linked page on MSDN:

Gets or sets the brush that highlights selected text.

<TextBox SelectionBrush="Red" SelectionOpacity="0.5"
    Foreground="Blue" CaretBrush="Blue">
    This is some text.
</TextBox>

UPDATE >>>
You can apply this property in a Style that is applied to the DataGridTextColumn.EditingElementStyle property, like this:
<DataGrid ItemsSource="{Binding Items}" AutoGenerateColumns="False">
    <DataGrid.Columns>
        <DataGridTextColumn Binding="{Binding Name}">
            <DataGridTextColumn.EditingElementStyle>
                <Style TargetType="{x:Type TextBox}">
                    <Setter Property="SelectionBrush" Value="Red" />
                </Style>
            </DataGridTextColumn.EditingElementStyle>
        </DataGridTextColumn>
    </DataGrid.Columns>
</DataGrid>


text:
Q: How to get all projects in a SBT task? I'm writing a SBT task, which will get all projects of the whole project, then I can run some tasks against them.
The pseudo code is like:
val projects = someTaskToGetProjects.value
val updateReports = projects.map(p => (update in p).value)

But I can't find any task or setting to get the project list, how to do it?

A: I think buildDependencies might suit your needs, otherwise loadedBuild has everything.
val projects = buildDependencies.value.classpath.keys
val updateReports = projects.map(p => (update in p).value)


text:
Q: Python list comprehension with multiple conditions I have a list of strings
str_list = ['a', 'b', 'c']

and want to add a suffix
suffix = '_ok'

when the string value is 'a'.
This works:
new_str_list = []
for i in str_list:
    if i == 'a':
        new_str_list.append(i + suffix)
    else:
        new_str_list.append(i)

new_str_list
# ['a_ok', 'b', 'c']

How can I simplify this with a list comprehension?
Something like
new_str_list = [i + suffix for i in str_list if i=='a' ....

A: [i + suffix if i == 'a' else i for i in str_list]

Putting if after the for as you tried is for skiping values.
In your case you don't skip values but process them differently.

A: Create the item according to it's value -
[i + suffix if i=='a' else i for i in str_list ]

A: A concise option making use of fact that False == 0:
[i + suffix * (i=='a') for i in str_list]


text:
Q: C system() function I'm trying to  create a file in linux and give it executable rights using system() function in a C program. Here is the code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char *argv[], char *envp[]){
char s[100];
strcpy(s, "touch ");
strcpy(s, argv[1]);
strcpy(s, "; chmod a+x ");
strcpy(s, argv[1]);
system(s);
return 0;
}

But when I call compiled file with argument "abs" for example (consider I want "abs" as the name of the file to be created) it gives such output:
sh: 1: abs: not found

How can it be fixed? It's important that I have to use C programming and system() function.

A: It seems that answer is not understandable for future readers, let me try to explain what is the difference between strcpy and strcat

*

*strcpy() copies one string into another.

*strcat() function concatenates string by appending source string to destination string.

In the original code, every time a "strcpy" function was called, a previous value in the buffer was overwritten.
char s[100];
strcpy(s, "touch "); // s = touch
strcpy(s, argv[1]); // s = abc (argv[1] value)
strcpy(s, "; chmod a+x "); // s = ; chmod a+x
strcpy(s, argv[1]); // s = abc (argv[1] value)
system(s); // execute s = abc

And finally, since "s" is "abc" system() function tries to execute it, which is producing the following error:
sh: 1: abs: not found

In the modified version, instead of overwriting the previous value, the new value is appended to the buffer.
char s[100];
strcpy(s, "touch "); // s = touch
strcat(s, argv[1]); // s = touch abc
strcat(s, "; chmod a+x "); // s = touch abc; chmod a+x
strcat(s, argv[1]); // s = touch abc; chmod a+x abc
system(s); // execute s = touch abc; chmod a+x abc

A: strcpy copies a string to another, use strncat (3) to concatenate strings.
Your code should be like that:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define ARRAY_SIZE(X) sizeof(X)/sizeof(X[0])

int main(int argc, char *argv[], char *envp[]){
    char s[100];
    strncat(s, "touch ", ARRAY_SIZE(s) - 1 - strlen(s));
    strncat(s, argv[1], ARRAY_SIZE(s) - 1 - strlen(s));
    strncat(s, "; chmod a+x ", ARRAY_SIZE(s) - 1 - strlen(s));
    strncat(s, argv[1], ARRAY_SIZE(s) - 1 - strlen(s));
    system(s);
    return 0;
}

A: The code should be changed to the following:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(int argc, char *argv[], char *envp[]){
char s[100];
strcpy(s, "touch "); //s = "touch "
strcat(s, argv[1]); //s = "touch " + argv[1]
strcat(s, "; chmod a+x "); //s = "touch " + argv[1] + "; chmod a+x "
strcat(s, argv[1]); //s =  "touch " + argv[1] + "; chmod a+x " + argv[1]
system(s); //system("touch " + argv[1] + "; chmod a+x " + argv[1])
return 0;
}

Thanks a lot to commentators!


text:
Q: Python most common value in list of dict I have many dict in list.
[{'key3': '2', 'key2': '12', 'key1': '1'},
{'key3': '4', 'key2': '12', 'key1': '1'},
{'key3': '3', 'key2': '1', 'key1': '1'},
{'key3': '5', 'key2': '4', 'key1': '1'}]

How can I get the most recent value of the key2? This this example should print 12?

A: Try this:
my_map = {}
for entry in my_list:
    try:
        my_map[entry['key2']] += 1
    except KeyError:
        my_map[entry['key2']] = 1
print(max(my_map, key=my_map.get))

You'll create a dictionary (my_map) to hold the counts. On every element of the list, store the key2 value in the map and increment the count. We need the try/except methods so that if the key does not exist, we can set it to 1. Otherwise we increment it.
At the end of the for loop my_map will look like this: {'1': 1, '4': 1, '12': 2}
The final line gets the max value in the list, the key2 with the highest count. We provide key=lambda a: my_map[a] to tell the max function to use the values of the dictionary for the max, instead of using just the keys.


text:
Q: Is there a easy way to check which classes and methods are used in a C# file? I want compile C# code at runtime with the CSharpCodeProvider classes and load them as plugins. But I don't want to allow "any" code in them for security reasons, for example it should not be possible to write/read files (just as a example).
What i would like to do is to check the c# file before i compile them and limit the plugin to only uses classes/methods from my api (and maybe some other basic methods like the math class).
So my question: is there a easy way to "scan" a c# file to know which classes/methods are used?


text:
Q: wp_delete_user with username wp_delete_user() function requires user ID and [optional] reassign ID if the content is to be reassigned to another user.
All users' user names are also unique as WP doesn't allow duplicate user names. If I know username, is there no way with just one PHP/mysqli query I can delete the user instead of run one query to find ID of that user first and then tell wordpress to delete that user ?

A: There is no way to do this with only one query. But to be honest - deleting user takes more than one query itself...
You shouldn't use custom SQL for that, because there are many things you could break this way... Always use WP functions, if they exists (what if some plugin logs every deleted user, or what if some other action is needed, etc.)
You can use get_user_by to achieve that. Here's the example:
$user = get_user_by( 'login', 'john' );
if ( $user ) { // get_user_by can return false, if no such user exists
    wp_delete_user( $user->ID );
}

The fields you can get user by are: ID | slug | email | login.

A: It is a good practice to use WordPress function wp_delete_user() as it will delete user meta as well by running multiple queries on WordPress Database.
Check WordPress codex for more info: https://developer.wordpress.org/reference/functions/wp_delete_user/
Also it's easy to get user id and then delete user by adding something like
    $user = get_userdatabylogin('loginname');
    if($user){
        //delete user if exists
        wp_delete_user($user->ID);
    }

Or Else, You have to run multiple queries of generate a very complex query to properly remove user from WordPress database


text:
Q: Mapping akka stream source[A,B] to source[A,NotUsed] I've just started using akka streams so this may be a trivial question, however I haven't found an answer to it.
I have an input stream with type [String, Something] and I need to get rid of the auxiliary data and get a Source[String,NotUsed].
How can I do this?
Thanks.
Some example code:
def f():Source[String, NotUsed] = {
    val s=Source[String, Subscriber[String]] = Source.asSubscriber[String]
    ... // connect the source to a graph

    val o=??? //map s to Source[String,NotUsed]
    o
}

A: Try
val o: Source[String, NotUsed] = s.mapMaterializedValue(_ => NotUsed)

or
implicit val materializer: ActorMaterializer = ActorMaterializer()
val o: Source[String, NotUsed] = s.preMaterialize()._2


text:
Q: How do i create and populate a linked list using classes in c++? I am trying to create a program which uses classes to create a linked list data structure.  Is it necessary to create one linked list class which contains the list in it's entirety: nodes with info and the list? or do i create a  class for the list and a class for the nodes in the list?
Thanks,

A: Don't create your own list - use std::list


text:
Q: onEdit in Script vs onEdit trigger / Column Width Script Not Working For Editors I'm a beginner and created a script to expand columns on 4 different tabs (A Sheet, B Sheet, C Sheet, D Sheet).
For myself, the script author, the script works fine on all tabs.
For invited editors, the script seems to work fine on the first tab (A Sheet) but does not work on the other tabs (B Sheet, C Sheet, D Sheet).
I tried adding a onEdit trigger which seems to fix this problem but now I'm receiving "Service using too much computer time for one day" errors.
On 8/27 I received a notice that the "Service using too much computer time for one day" error occurred 3 times. When I check My Executions logs I only see about 17 seconds of trigger time.
My questions are:
1) If I have onEdit(e) in my script code do I need an onEdit trigger?
2) Do I need to add onEdit(e) in my script code in more places such as above the B, C and D script sections?
3) Why does the script work for me, the author, but not the users with editing permissions.
4) Why do I receive "Service using too much computer time for one day" error notifications when my total execution duration time is well below the limit of 90min/day.
5) Can someone point me to good formating rules for script?
Thanks!
    function onEdit(e) {
  var app = SpreadsheetApp;
  var ss = app.getActiveSpreadsheet();
  var Sh1 = ss.getSheetByName("A Sheet");

  var clmnwdth = Sh1.getRange("G16:G27").getValues();
  var maxi = Math.max.apply(Math, clmnwdth);

  var clmn6 = Sh1.getRange("AB13:AE15");
  var clmn56 = Sh1.getRange("X13:AE15");
  var clmn456 = Sh1.getRange("T13:AE15");
  var clmn3456 = Sh1.getRange("P13:AE15");
  var clmn23456 = Sh1.getRange("L13:AE15");

  var clmn2 = Sh1.getRange("L13:O15");
  var clmn23 = Sh1.getRange("L13:S15");
  var clmn234 = Sh1.getRange("L13:W15");
  var clmn2345 = Sh1.getRange("L13:AA15");

 Logger.log(maxi);

  if (maxi == 0) {
     Sh1.setColumnWidths( 12, 20, 5),clmn23456.setFontColor("white");
 } else if (maxi == 1) {
     Sh1.setColumnWidths( 12, 20, 5),clmn23456.setFontColor("white");
 } else if (maxi == 2) {
     Sh1.setColumnWidths( 16, 16, 5),Sh1.setColumnWidths( 12, 4, 100),clmn3456.setFontColor("white"),clmn2.setFontColor("black");
 } else if (maxi == 3) {
     Sh1.setColumnWidths( 20, 12, 5),Sh1.setColumnWidths( 12, 8, 100),clmn456.setFontColor("white"),clmn23.setFontColor("black");
 } else if (maxi == 4) {
     Sh1.setColumnWidths( 24, 8, 5),Sh1.setColumnWidths( 12, 12, 100),clmn56.setFontColor("white"),clmn234.setFontColor("black");
 } else if (maxi == 5) {
     Sh1.setColumnWidths( 28, 4, 5),Sh1.setColumnWidths( 12, 16, 100),clmn6.setFontColor("white"),clmn2345.setFontColor("black");
 } else {
     Sh1.setColumnWidths( 12, 20, 100),clmn23456.setFontColor("black");
  }

  var BSh1 = ss.getSheetByName("B Sheet");

  var Bclmnwdth = BSh1.getRange("G16:G27").getValues();
  var Bmaxi = Math.max.apply(Math, Bclmnwdth);

  var Bclmn6 = BSh1.getRange("AB13:AE15");
  var Bclmn56 = BSh1.getRange("X13:AE15");
  var Bclmn456 = BSh1.getRange("T13:AE15");
  var Bclmn3456 = BSh1.getRange("P13:AE15");
  var Bclmn23456 = BSh1.getRange("L13:AE15");

  var Bclmn2 = BSh1.getRange("L13:O15");
  var Bclmn23 = BSh1.getRange("L13:S15");
  var Bclmn234 = BSh1.getRange("L13:W15");
  var Bclmn2345 = BSh1.getRange("L13:AA15");

 Logger.log(Bmaxi);

  if (Bmaxi == 0) {
     BSh1.setColumnWidths( 12, 20, 5),Bclmn23456.setFontColor("white");
 } else if (Bmaxi == 1) {
     BSh1.setColumnWidths( 12, 20, 5),Bclmn23456.setFontColor("white");
 } else if (Bmaxi == 2) {
     BSh1.setColumnWidths( 16, 16, 5),BSh1.setColumnWidths( 12, 4, 100),Bclmn3456.setFontColor("white"),Bclmn2.setFontColor("black");
 } else if (Bmaxi == 3) {
     BSh1.setColumnWidths( 20, 12, 5),BSh1.setColumnWidths( 12, 8, 100),Bclmn456.setFontColor("white"),Bclmn23.setFontColor("black");
 } else if (Bmaxi == 4) {
     BSh1.setColumnWidths( 24, 8, 5),BSh1.setColumnWidths( 12, 12, 100),Bclmn56.setFontColor("white"),Bclmn234.setFontColor("black");
 } else if (Bmaxi == 5) {
     BSh1.setColumnWidths( 28, 4, 5),BSh1.setColumnWidths( 12, 16, 100),Bclmn6.setFontColor("white"),Bclmn2345.setFontColor("black");
 } else {
     BSh1.setColumnWidths( 12, 20, 100),Bclmn23456.setFontColor("black");
  }
  var CSh1 = ss.getSheetByName("C Sheet");

  var Cclmnwdth = CSh1.getRange("G16:G27").getValues();
  var Cmaxi = Math.max.apply(Math, Cclmnwdth);

  var Cclmn6 = CSh1.getRange("AB13:AE15");
  var Cclmn56 = CSh1.getRange("X13:AE15");
  var Cclmn456 = CSh1.getRange("T13:AE15");
  var Cclmn3456 = CSh1.getRange("P13:AE15");
  var Cclmn23456 = CSh1.getRange("L13:AE15");

  var Cclmn2 = CSh1.getRange("L13:O15");
  var Cclmn23 = CSh1.getRange("L13:S15");
  var Cclmn234 = CSh1.getRange("L13:W15");
  var Cclmn2345 = CSh1.getRange("L13:AA15");

 Logger.log(Cmaxi);

  if (Cmaxi == 0) {
     CSh1.setColumnWidths( 12, 20, 5),Cclmn23456.setFontColor("white");
 } else if (Cmaxi == 1) {
     CSh1.setColumnWidths( 12, 20, 5),Cclmn23456.setFontColor("white");
 } else if (Cmaxi == 2) {
     CSh1.setColumnWidths( 16, 16, 5),CSh1.setColumnWidths( 12, 4, 100),Cclmn3456.setFontColor("white"),Cclmn2.setFontColor("black");
 } else if (Cmaxi == 3) {
     CSh1.setColumnWidths( 20, 12, 5),CSh1.setColumnWidths( 12, 8, 100),Cclmn456.setFontColor("white"),Cclmn23.setFontColor("black");
 } else if (Cmaxi == 4) {
     CSh1.setColumnWidths( 24, 8, 5),CSh1.setColumnWidths( 12, 12, 100),Cclmn56.setFontColor("white"),Cclmn234.setFontColor("black");
 } else if (Cmaxi == 5) {
     CSh1.setColumnWidths( 28, 4, 5),CSh1.setColumnWidths( 12, 16, 100),Cclmn6.setFontColor("white"),Cclmn2345.setFontColor("black");
 } else {
     CSh1.setColumnWidths( 12, 20, 100),Cclmn23456.setFontColor("black");
  }
  var DSh1 = ss.getSheetByName("D Sheet");

  var Dclmnwdth = DSh1.getRange("G16:G27").getValues();
  var Dmaxi = Math.max.apply(Math, Dclmnwdth);

  var Dclmn6 = DSh1.getRange("AB13:AE15");
  var Dclmn56 = DSh1.getRange("X13:AE15");
  var Dclmn456 = DSh1.getRange("T13:AE15");
  var Dclmn3456 = DSh1.getRange("P13:AE15");
  var Dclmn23456 = DSh1.getRange("L13:AE15");

  var Dclmn2 = DSh1.getRange("L13:O15");
  var Dclmn23 = DSh1.getRange("L13:S15");
  var Dclmn234 = DSh1.getRange("L13:W15");
  var Dclmn2345 = DSh1.getRange("L13:AA15");

 Logger.log(Dmaxi);

  if (Dmaxi == 0) {
     DSh1.setColumnWidths( 12, 20, 5),Dclmn23456.setFontColor("white");
 } else if (Dmaxi == 1) {
     DSh1.setColumnWidths( 12, 20, 5),Dclmn23456.setFontColor("white");
 } else if (Dmaxi == 2) {
     DSh1.setColumnWidths( 16, 16, 5),DSh1.setColumnWidths( 12, 4, 100),Dclmn3456.setFontColor("white"),Dclmn2.setFontColor("black");
 } else if (Dmaxi == 3) {
     DSh1.setColumnWidths( 20, 12, 5),DSh1.setColumnWidths( 12, 8, 100),Dclmn456.setFontColor("white"),Dclmn23.setFontColor("black");
 } else if (Dmaxi == 4) {
     DSh1.setColumnWidths( 24, 8, 5),DSh1.setColumnWidths( 12, 12, 100),Dclmn56.setFontColor("white"),Dclmn234.setFontColor("black");
 } else if (Dmaxi == 5) {
     DSh1.setColumnWidths( 28, 4, 5),DSh1.setColumnWidths( 12, 16, 100),Dclmn6.setFontColor("white"),Dclmn2345.setFontColor("black");
 } else {
     DSh1.setColumnWidths( 12, 20, 100),Dclmn23456.setFontColor("black");
  }
}


text:
Q: Using Pandas, adding a timedelta to a new row in master dataframe? Goal: For a cell in a specific column that has a date within the next 9 months, add a new column to Master with either "Yes", for the date is coming up, or "No", for the date is not coming up.
I'm new to Pandas, so any help would be great. I have one dataframe I'm calling "Master", as the dataframe I am adding everything to to then export to an Excel spreadsheet. With the code below, I created a new dataframe for the date and am trying to say "If the cell is in date, put "Yes" in a new column".
I suspect my issue is that I'm trying to treat Pandas like arrays, but what it's actually doing is creating entirely new indexing when I make a new dataframe and doesn't hold onto how it used to be mapped to master. Is my understanding correct? And if so, how can I accomplish my goal in a more elegant way?
def mess_with_time(Master):
    now = datetime.datetime.now()
    nine_months_in_the_future = str(datetime.datetime.today() + relativedelta(months=+8))
    just_future_month=int(nine_months_in_the_future[5:7])
    just_future_year=int(nine_months_in_the_future[0:4])

    dates = Master[(Master['Contract End Date'] > '{}-{}-1'.format(now.year,now.month)) & (Master['Contract End Date'] <= '{}-{}-20'.format(just_future_year, just_future_month))]
Master['Contract End date coming up?'] = np.where(dates, 'Yes', 'No') #this breaks with
the error 'Length of values does not match length of index'

def Create_Master(file):
    df = pd.ExcelFile('{}.xlsx'.format(file))

    Master = df.parse('Main').fillna(0)

A: I try rewrite your solution to pandas:
First is possible use DateOffset and then create boolean mask by between:
now = pd.datetime.now()
months9 = now + pd.offsets.DateOffset(months=8)
print (months9)
2018-03-06 15:07:52.850238

rng = pd.date_range('2017-04-03', periods=10, freq='3M')
Master = pd.DataFrame({'Contract End Date': rng, 'a': range(10)})

dates_mask = Master['Contract End Date'].between(now, months9)
Master['Contract End date coming up?'] = np.where(dates_mask, 'Yes', 'No')
print (Master)
  Contract End Date  a Contract End date coming up?
0        2017-04-30  0                           No
1        2017-07-31  1                          Yes
2        2017-10-31  2                          Yes
3        2018-01-31  3                          Yes
4        2018-04-30  4                           No
5        2018-07-31  5                           No
6        2018-10-31  6                           No
7        2019-01-31  7                           No
8        2019-04-30  8                           No
9        2019-07-31  9                           No

It seems you need change boolean indexing Master[boolean_condition] to boolean condition only:
dates = Master[(Master['Contract End Date'] > '{}-{}-1'.format(now.year,now.month)) & (Master['Contract End Date'] <= '{}-{}-20'.format(just_future_year, just_future_month))]

to:
dates_mask = (Master['Contract End Date'] > '{}-{}-1'.format(now.year,now.month)) & (Master['Contract End Date'] <= '{}-{}-20'.format(just_future_year, just_future_month))

Master['Contract End date coming up?'] = np.where(dates_mask, 'Yes', 'No')


text:
Q: No output from GTX 1050 I have a PC with Ryzen 5 2400G and GTX 1050. Since it has an integrated GPU I enabled it for use with normal applications, while using the GTX 1050 for games. In Windows, I can get output from both of the GPUs. But in Ubuntu, I am only getting a signal from the integrated GPU. Due to this, I won't be able to change display settings in the NVIDIA Xserver settings. All the drivers are installed properly and my Ubuntu 20.04 is also up to date.
Edit: This is the output of lspci -k | grep -EA3 'VGA|3D|Display':
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050] (rev a1)
    Subsystem: NVIDIA Corporation GP107 [GeForce GTX 1050]
    Kernel driver in use: nvidia
    Kernel modules: nvidiafb, nouveau, nvidia_drm, nvidia
--
09:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] (rev c6)
    Subsystem: ASUSTeK Computer Inc. Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series]
    Kernel driver in use: amdgpu
    Kernel modules: amdgpu


text:
Q: визуальный редактор в SQLite android Здравствуйте, можно ли редактировать или же добавить данные в БД (SQLite в Android) в визуальном виде, как на MySql (PhpMyAdmin), например у тебя есть 4 полей в БД, и для заполнения есть 4 полей в программе, вводишь туда данные и нажимаешь на add или же ok и тут в базу добавляется данные введенные тобою?
A: Для работы с базой в Windows:

*

*SQLite Studio

*SQLite Database Browser
Для работы с базой в Android:

*

*SQLite Manager

*SQLite Viewer
Для работы с базой в Linux:

*

*SQLite Studio

*SQLite Database Browser
P.S: Лично я использую SQLite Studio. Все есть, удобно. Нареканий нет


text:
Q: calculate percentage of two values in the same row in ssrs 2008 I need your help. I have a matrix report in ssrs 2008. The report contain one field value column and one value column. I need to calculate a percentage for two values.
For example :
row 1 : Discount 10
Row 2 : Sales 100
Result : 10/100.

A: Output screenshot attached (Image URL : http://i.stack.imgur.com/WroU4.png)
    IF EXISTS (SELECT * FROM tempdb..sysobjects WHERE id=OBJECT_ID('tempdb..#Student')) DROP TABLE #Student

    CREATE TABLE #Student
    (
        id INT,
        NAME VARCHAR(100),
        TotalMark INT
    )
    ![enter image description here][1]
    INSERT INTO #Student VALUES ( 1,'Sanjay',635)
    INSERT INTO #Student VALUES ( 2,'Vinay',810)
    INSERT INTO #Student VALUES ( 3,'Ajay',799)
    INSERT INTO #Student VALUES ( 4,'Jay',560)

    SELECT * FROM #Student

Column Value : =str(Fields!TotalMark.Value *100 /1000)+"%"


text:
Q: Entering community wiki in grace period removes reputation The FAQ entry on CW reads:

The original author keeps the reputation gained (or lost) before their
  post entered community mode.

However, I just discovered that converting a post to CW within the 5 minute grace period removes any reputation already gained from upvotes. This is, at the very least, undocumented behavior.
IMO, converting to CW within the grace period should count as separate entry in the post's revision history, in much the same way as edits by other users do. Additionally, regarding reputation:

*

*Either the FAQ should be updated to reflect that CW during the grace period is an exception to the above mentioned rule, or

*The behavior should be altered, so that reputation from upvotes prior to CW are retained regardless of whether the change occurs during or after the grace period

I believe the second option is much more intuitive and would cause less confusion in the future.

A: Everything done during the grace period of the first edit is handled as it was done in the first edit; if you make a question a CW during the grace period of the first edit, it is like the question was a CW since the beginning.
The FAQ question has been written before the grace period feature was added. Maybe a note could be added, just to make sure somebody else doesn't get confused by that. To me, what you are describing is the expected behavior.


text:
Q: Changing font type within strings.xml Ok, so I'm familiar with how to change font types etc. for android development.  But, I can't find a way to do it with this example.
The code for string.xml...
<string-array name="help_labels">
    <item> item 1</item>
    <item> item 2</item>
    <item> item 3</item>
    <item> item 4</item>
</string-array>
<string-array name="help_txt">
    <item> item 1 description: blah blah blah blah</item>
    <item> item 2 description: blah blah blah blah</item>
    <item> blah blah blah blah</item>
    <item> blah blah blah blah</item>
</string-array>

the xml layout...
<TextView
    android:text="TextView"
    android:id="@+id/helpDetailText"
    android:cacheColorHint="#00000000"
    android:background="@layout/rectangle_border"
    android:textColor="@color/black1"
    android:padding="10dp"
    android:textSize="17.0sp"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
</TextView>

Java code..
public static final String HELP_TEXT = "helpText";
item = getIntent().getExtras().getSerializable(HELP_TEXT);
    TextView helpDetailText = (TextView) findViewById(R.id.helpDetailText);
    if (item != null) {
        if (isHtmlHelpText) {
            helpDetailText.setText(Html.fromHtml(item.toString()).toString());
        } else {
            helpDetailText.setText(item.toString());
        }
    }

What I'm trying to do..
So basically the labels lead to a detail page for each item.  I can't seem to find a way to change the font type within the description..  I would like to organize the paragraphs with bold headings before each paragraph.  This seems simple (and it probably is), but I can't figure it out.  I tried html tags (<b> label </b>) but that didn't work either.


text:
Q: XML add new child to each element child of array node I have xml that looks like this:
<ArrayOfConfig>
    <Config>
        <!--stuff-->
    </Config>
    <Config>
        <!--stuff-->
    </Config>
</ArrayOfConfig>

And I need to populate each Config node with a new child, such that it will look like:
<ArrayOfConfig>
    <Config>
        <!--stuff-->
        <NewChild>foo</NewChild>
    </Config>
    <Config>
        <!--stuff-->
        <NewChild>foo</NewChild>
    </Config>
</ArrayOfConfig>

I have run the following Powershell an an attempt to do so:
$doc = New-Object System.Xml.XmlDocument
$doc.Load('C:\temp\Configs.xml')
$child = $doc.CreateElement("NewChild")
$child.InnerText = "foo"
$doc.ArrayOfConfig.Config.AppendChild($child)
$doc.Save('C:\temp\Configs.xml')

Running this kind of works, it only adds the child node to the second Config.  Example:
<ArrayOfConfig>
    <Config>
        <!--stuff-->
    </Config>
    <Config>
        <!--stuff-->
        <NewChild>foo</NewChild>
    </Config>
</ArrayOfConfig>

The amount of Config child nodes of ArrayOfConfig varies, so I can't do any static assignment.  How do I iterate over the children of ArrayOfConfig and make sure each of them correctly gets the new child node?

A: $doc = New-Object System.Xml.XmlDocument
$doc.Load('C:\temp\Configs.xml')
foreach($config in $doc.SelectNodes('//Config'))
{
    $child = $doc.CreateElement("NewChild")
    $child.InnerText = "foo"
    $config.AppendChild($child)
}
$doc.Save('C:\temp\Configs.xml')


text:
Q: how to push project from local machine on windows 10 to github repo I did a git init in folder on my laptop
/c/Users/user1/user2/Lab assignments/mtech project/tex files/Thesis_8_March
now I did a git init in this directory I see a .git folder created and a file name config
[core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
[remote "origin"]
        url = git@github.com:kiotie32/kiotie32.git
        fetch = +refs/heads/*:refs/remotes/origin/*
~

how do I tell git that I want to push all the folders and files on that particular folder
to  repo to which I want to push ,Here is a link to
https://github.com/users/kiotie32/projects/2
what command should I issue and set things upto.

I have created a project not repository from Github in the browser.
if you see in above screenshot what I get is a project page it does not give me any link to something like repo.git to which I can issue git remote command like
git remote add origin git@github.com:username/reponame.git

I have previously uploaded projects hence this is not a new thing for me. In this case you see the screenshot and then let me know what needs to be done?


text:
Q: Prove this simple graph is not planar. Graph
I need to show this graph is not planar. I've attempted to find $K_5$ and $K_{3,3}$ as a subgraphs but haven't been successful yet. It's possible but unlikely this graph is planar but I haven't been able to draw it as a plane graph.

A: Draw this graph without vertex 10 or 15. Then think of constricting the path 4-20-5-30 down to a single vertex.
Remember, you don't need to have $K_{5}$ or $K_{3,3}$ as subgraphs, only a subgraph that is a subdivision of $K_{5}$ or $K_{3,3}$.


text:
Q: Why for loop order effect running time in matrix multiplication? I'am writing a C program to calculate the product of two matrix.
The problem That I noticed that the order of for loops does matter. For example:
for N=500
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < N; ++j) {
      for (int k = 0 ; k < N; ++k) {
       C[i*N+j]+=A[i*N+k] * B[k*N+j];
       }
     }
   }

execution time (Seconds) : 1.1531820000
   for (int j = 0; j < N; ++j) {
     for (int k = 0 ; k < N; ++k) {
       for (int i = 0; i < N; ++i) {
       C[i*N+j]+=A[i*N+k] * B[k*N+j];
       }
     }
   }

execution time (Seconds) : 2.6801300000
Matrix declaration:
      A=(double*)malloc(sizeof(double)*N*N);
      B=(double*)malloc(sizeof(double)*N*N);
      C=(double*)malloc(sizeof(double)*N*N);

I run the test for 5 time than calculate the average. Anyone have an idea why is this happening?

A: With the second loop, you keep making many big jumps all the time when you increment i in the inner loop, and to a lesser extent k. The cache is probably not very happy with that.
The first loop is better, indeed it's even better if you invert the orders of j and k.
This is essentially a problem of data locality. Accesses to main memory are very slow on modern architectures, so your CPU will keep caches of recently accessed memory and try to prefetch memory that is likely to be accessed next. Those caches are very efficient at speeding up accesses that are grouped in the same small area, or accesses that follow a predictable pattern.
Here we turned a pattern where the CPU would make big jumps through memory and then come back into a nice mostly sequential pattern, hence the speedup.


text:
Q: Logarithm with variable base I am trying to define a function that maps polynomials in the form of $x^{3^n}$ to the value of $n$ in the polynomial, where $n\in{Z}$.* Is
is valid to define this function as $log_{x^3}(u)$, where $u \in [{x^{3^n}} : n\in{Z}]$?
On the one hand I'm uncomfortable because I'm putting a variable in the base of a logarithm, but on the other hand, I don't think it matters because that variable doesn't depend on the input or output of the logarithm, so we can think of it like a constant base. Does it make sense to define the function this way?
*If anyone could show me how to write a blackboard Z in latex, that would be great.

A: It's perfectly acceptable to have variable bases for logarithms. Keep in mind that $\log_ba=\frac{\log a}{\log b}$. Therefore, $\log_{x^3}u=\frac{\log u}{\log x^3}$, so you don't even have to think of it as being a variable base.

A: The base $x$ logarithm $log_x$ takes a function $f(x)$ in $x$ and produces a numeric result in such a way that $log_x x^n = n$ for all values of $n$, including non-integer values. So, one possible answer is:
$$log_x f(x) = \lim_{h,k→0} {1 \over k}\left({{f(h(1+k)) \over f(h)} - 1}\right).$$
To handle $log_{x^3}$, we can generalize to $log_{g(x)}(f(x))$, where $g(x)$ is one-to-one, by defining:
$$log_{g(x)}(f(x)) = log_x(f(g^{-1}(x))),$$
so that:
$$log_{x^3}(f(x)) = log_x(f(\sqrt[3]{x})).$$
It can be further generalized to $nOf(f,a) = log_x(f(x-a))$, which either (a) yields a positive value that counts the multiplicity of the root $x = a$, if $f(a) = 0$ (including fractional multiplicities, like for $\sqrt{x-a}$), (b) yields a negative value that indicates the negative of the degree of singularity of $f(x)$ at $x = a$, if $f(x) → ∞$ as $x → a$ or (c) yields 0, if neither condition applies. Then $nOf(f,0) = log_x f(x)$ and $nOf(f,0) = n$ when $f(x) = x^n$.
It might also be possible to prove that this answer is unique, subject to generic, natural conditions; e.g. $log_x(f(x)g(x)) = log_x(f(x)) + log_x(g(x))$, $log_x 1 = 0$, $log_x x = 1$, and maybe other similar conditions.
One example - which prompted my query into the matter - is $nOf(j_n) = n$ for the Bessel functions $j_n(x)$, including those of half-integer order $n$. The idea of defining these functionals came in a dream, early this morning, out of the blue. I've never seen anything like this before, so I have no reference to any of this other than to myself.


text:
Q: Getting everything between two characters I'd like to search for two consecutive * characters and save everything between them including the first line with *.
Example:
 input:
A*1
A
B
B*4
C
Y*5
D

output 1:
A*1
A
B

output 2:
B*4
C

output 3:
Y*5
D

A: You can use:
awk '/\*/ { n++; } { print >> "output" n }' inputfile

This writes three files, output1, output2 and output3 with the contents in your question. Any text before a line containing a * would go into output.

A: awk 'BEGIN { RS="your delimiter"} {print $0}'

RS is the Records Separator, defining it at the beginning will let you split the input however you want.
Use NR to print the current record number
awk 'BEGIN { RS="\""} {print "output " NR ":\n" $0}'

A: This might work for you:
csplit -zf 'output' file '/\*/' '{*}'

This splits the file on *'s (/\*/) and names the result files outputnn where nn starts at 00. Files with empty lines are not output and the process is repeated to the end of file ( {*}).


text:
Q: NSIS Invalid Command userInfo::GetAccountType Total NSIS nube here. I had a script that was working, and now it isn't. It's based on an example provided on the nsis site:
    # This installs two files, app.exe and logo.ico, creates a start menu shortcut, builds an uninstaller, and
# adds uninstall information to the registry for Add/Remove Programs

# To get started, put this script into a folder with the two files (app.exe, logo.ico, and license.rtf -
# You'll have to create these yourself) and run makensis on it

# If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
!define COMPANYNAME "F_YEAH"
!define DESCRIPTION "I'm stoked!"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
!define UPDATEURL "http://..." # "Product Updates" link
!define ABOUTURL "http://..." # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 7233

RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)

InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"

# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)

# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "C:\Users\dkim\Documents\dog.ico"
outFile "GetSomeGA.exe"

!include LogicLib.nsh

# Just three pages - license agreement, install location, and installation
page license
page directory
Page instfiles

!macro VerifyUserIsAdmin
UserInfo::GetName
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
        messageBox mb_iconstop "Administrator rights required!"
        setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
        quit
${EndIf}
!macroend

function .onInit
    setShellVarContext all
    !insertmacro VerifyUserIsAdmin
functionEnd

section "install"
    # Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
    setOutPath $INSTDIR
    # Files added here should be removed by the uninstaller (see section "uninstall")
    File /r "C:\Users\dkim\Documents\Projects\MOR\Projects\GAintegration\GA_ConversionOnDemand_0.1"
    File "C:\Users\dkim\Documents\dog.ico"
    # Add any other files for the install directory (license files, app data, etc) here

    # Uninstaller - See function un.onInit and section "uninstall" for configuration
    writeUninstaller "$INSTDIR\uninstall.exe"

    # Start Menu
    createDirectory "$SMPROGRAMS\${COMPANYNAME}"
    createShortCut "$DESKTOP\pleaseClickMe.lnk" "$INSTDIR\GA_ConversionOnDemand\GA_ConversionOnDemand_run.bat" "" "$INSTDIR\dog.ico" 0

    # Registry information for add/remove programs
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayName" "${COMPANYNAME} -

${APPNAME} - ${DESCRIPTION}"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "UninstallString" "$\"$INSTDIR

\uninstall.exe$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "QuietUninstallString" "$

\"$INSTDIR\uninstall.exe$\" /S"
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayIcon" "$\"$INSTDIR

\logo.ico$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "HelpLink" "$\"${HELPURL}$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLUpdateInfo" "$\"${UPDATEURL}$

\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "DisplayVersion" "$

\"${VERSIONMAJOR}.${VERSIONMINOR}.${VERSIONBUILD}$\""
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMajor" ${VERSIONMAJOR}
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "VersionMinor" ${VERSIONMINOR}
    # There is no option for modifying or repairing the install
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoModify" 1
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "NoRepair" 1
    # Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
    WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
sectionEnd

# Uninstaller

function un.onInit
    SetShellVarContext all

    #Verify the uninstaller - last chance to back out
    MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
        Abort
    next:
#   !insertmacro VerifyUserIsAdmin
functionEnd

section "uninstall"

    # Remove Start Menu launcher

    RMDir /r "$PROGRAMFILES\${COMPANYNAME}"
    delete "$DESKTOP\click_or_die.lnk"

    # Always delete uninstaller as the last action
    delete $INSTDIR\uninstall.exe

    # Remove uninstaller information from the registry
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
sectionEnd

The error message I get is:
!insertmacro: VerifyUserIsAdmin
Invalid command: UserInfo::GetName
Error in macro VerifyUserIsAdmin on macroline 1
Error in script "C:\Users\dkim\Documents\test3.nsi" on line 55 -- aborting creation process

It won't let me use any command involving UserInfo. Any ideas on what might be going on?

A: The compiler cannot find the UserInfo plugin or the plugin is corrupted.
The file should be in %ProgramFiles%\NSIS\Plugins in NSIS v2 and in %ProgramFiles%\NSIS\Plugins\x86-ansi or %ProgramFiles%\NSIS\Plugins\x86-unicode in NSIS v3 (depending on your target type).
This plugin is part of the default NSIS install so I would recommend that you just reinstall NSIS on top of your existing install...


text:
Q: Substring in Neo4j I want to match all nodes in my graph with a property that has a value (loaded from a csv file) as a substring.
i.e If csvline[0] is a sub string of a property of the node n. Then I want to match it.
What I actually want to do is match the names with the complete names:
 n.property : George Michael
 csvline[0] : George

Then n is matched.

A: You can do this (in versions 2.3+) using the Cypher CONTAINS predicate.
MATCH (n:Person) WHERE n.name CONTAINS "George"
RETURN n;


text:
Q: Bonding in a soldering station I have a soldering station which came with a 3.5mm jack socket and a power prong as in the following photo:

The manual only mentions the following about the usage for the 3.5mm jack in their manual as:

What is the need for this? I never saw this in previous stations. Does anybody have experience with such wiring? Which one is safe in my case? Do I really have to earth this?
I couldn't find any information in the manual.

A:
What is the need for this?

To expand on the comment from PlasmaHH, that soldering station (and several other Weller products) give you options about the earthing of the soldering iron tip.
There is a specific socket on the soldering station, where that jack plug (and any connections to it - see below) is inserted.

I never saw this in previous stations.

I have seen several soldering stations that provide a separate terminal for connecting the iron tip to a local ground. This use of a jack plug just offers more options (explained below).
Some soldering stations from another brand only use the mains earth connection to ground the tip (no other options). They monitor that mains earth connection and shut down the soldering station of that mains earth connection is broken.
There are probably other approaches by different manufacturers too.

Do I really have to earth this?

You usually don't want the tip of a soldering iron to be "floating".
By default, using that Weller 81i soldering station, the soldering iron tip is connected to the earth pin in your mains cable:

That point in the manual is saying, without the jack plug inserted, the soldering iron tip is "hard grounded" i.e. it is directly connected to the soldering station's mains earth connection.
Therefore the question you need to ask yourself is: Is the earth pin in your mains power socket, connected to a low impedance local earth? If so, then the soldering station will behave like typical mains-powered irons, with the tip connected to the mains earth, when that 3.5mm plug is not inserted (i.e. the "as delivered" state).

Which one is safe in my case?

You have not explained "your case" and what exactly you need. However there are only a few choices. Here is a slightly different version than the one you kindly provided, of the relevant extract from the manual:

Going down the list in that image and using the same reference letters:

*

*(a) Hard-grounded
This is the "as delivered" state, with the jack plug not inserted.
The soldering iron tip is directly connected to the earth pin of the mains input socket of the soldering station. If you want the tip to be earthed, then you are responsible for ensuring that the mains earth connection to the soldering station is good enough and suitable for that purpose. Some examples of things which could go wrong, would be if you have a disconnected mains earth connection, or where your mains earth and neutral are swapped.

*(b) Equipotential bonding
This is when you connect a wire to the centre contact of the jack plug.
Now the soldering iron tip is connected only to whatever is at the other end of that wire, and not to mains earth. This connection via the wire could be a local earth, to perform equipotential bonding between multiple parts of an ESD setup, where the mains earth connection is not suitable for any reason.

*(c) Floating
This is when the jack plug is inserted, but with absolutely no connections to it.
Again, the soldering iron tip is connected to the centre pin of the jack plug (like in option (b) above) but in this case, there is absolutely nothing connected there, so the tip is floating. This would usually be banned by an ESD policy. At the moment I can only think of one, unusual, use for doing this.

*(d) Soft-grounded
This is when the jack plug is inserted, with a resistor (e.g. 1MΩ shown in the picture) between its centre and outer pins.
This is a variation of option (a) - the soldering iron tip is connected to the earth pin of the mains input socket of the soldering station via that resistor. Again this relies on the mains earth connection to the soldering station being "good enough".
Using "soft-grounding" (and choosing the value of that resistor) is a compromise between keeping the soldering iron tip firmly at the same voltage (i.e. ground) as other parts on your ESD bench (needs low resistance to ground), and reducing possible damage to a charged device, by it discharging via the soldering iron tip (needs higher resistance to ground).

I couldn't find any information in the manual.

This is probably because the option you select depends on your company's local ESD policy, which the soldering station manufacturer doesn't decide. The default option (soldering iron tip "hard connected" to mains earth input) is a common standard - but not the only one. That is why having choices can be useful. If you have questions, check the ESD policy of your organisation regarding soldering iron tip earthing.
In an "amateur" situation where your ESD procedures may be incomplete, leading to some devices remaining charged before soldering, then I suggest the "soft-grounding" option with a 1MΩ resistor (with a confirmed "good" earth connection to the soldering station) should be considered.


text:
Q: Haskell Stack install package dependency from github Is it possible to install a version of a package from github using Haskell stack?
e.g. in a .cabal or a stack.yaml file, how can I point a dependency at a git repo/branch/revision?

A: For stack <1.11:
The documentation for the stack.yaml packages section gives examples of referring to more complex package locations.

packages:
- location: .
- location: dir1/dir2
- location: https://example.com/foo/bar/baz-0.0.2.tar.gz
- location: http://github.com/yesodweb/wai/archive/2f8a8e1b771829f4a8a77c0111352ce45a14c30f.zip
- location:
    git: git@github.com:commercialhaskell/stack.git
    commit: 6a86ee32e5b869a877151f74064572225e1a0398
- location:
    hg: https://example.com/hg/repo
    commit: da39a3ee5e6b4b0d3255bfef95601890afd80709

Then add extra-dep: true to the package entry just to tell stack not to treat the code it pulls in as something you're developing on (e.g., don't load it in GHCi).

A: New syntax for Stack >1.7.1
As @Flip commented, the docs at docs.haskellstack.org
clarify the new syntax for your stack.yaml is: (note the full commit hash needs to be used)
extra-deps:
- github: apolishch/prime_table
  commit: a510622a824af999a809191e8c959b8ea5fa8bdb
- github: apolishch/reactive-banana
  commit: 74bac0f86ed172f95bb6f6a31041992fc161cf79
  subdirs: reactive-banana

To be clear: dependencies in your stack.yaml make sure that the packages (which are not in Stackage) are available would some .cabal file in your project want them, just in case.
You still have to specify the name of the package in build-depends in your .cabal file to say you actually depend on the package.
Note it doesn't matter what branch the commit is on, and repos can be forks. When a package is in a subdirectory, you can specify it, otherwise it will default to top-level.
Syntax for Stack >1.6.0
extra-deps:
- github: git@github.com:apolishch/prime_table.git
  commit: a510622a824af999a809191e8c959b8ea5fa8bdb

[Edit] I have found that sometimes the syntax from 1.7.1 fails with error message
C:\Users\username\AppData\Local\Programs\stack\x86_64-windows\ghc-8.4.3\lib/../mingw/bin\ar.exe: .stack-work\dist\7d103d30\build\objs-10648\libHSpackagename-0.1.0.0-DlGXqyeqb9MDn2z8KhgjVb.a: No such file or directory

and I solved that by using the 1.6.0 syntax, even though I was using Stack 1.7.1.
When using Travis, that will fail because Travis can't clone via SSH without your SSH keys of course. But you can still use the https link as
extra-deps:
- github: https://github.com/apolishch/prime_table.git
  commit: a510622a824af999a809191e8c959b8ea5fa8bdb

A: In my case i wanted to depend on a fork of pandoc, specifying a precise commit. It worked by adding the following to stack.yml:

extra-deps:
- archive: https://github.com/italia/pandoc/archive/1327c564cccf5dfa387a2956443990d9854c85cd.zip

This would work with any branch-like URL on Git. I found my url by browsing the files at the commit and copying the URL from the "Download ZIP" button.
Note that my branch has a specific version, higher than any version Stack could fetch from the resolver. I pinpoint the version in the Cabal dependencies. If the version on that branch would overlap with one available in the resolver's index, i'm not sure about which one would be picked

A: Looks like this has changed. Now one has to do:
packages:
- '.'

extra-deps:
  - git: https://github.com/haskell/network.git
    commit: 63fb8601003cad1ade959ffcf7be9689fe866421


text:
Q: Java - Adding/appending time start time(00:00:00.000) & end time (23.59.59.999) to date I'm getting start date as "2016-06-01" and end date as "2016-07-01" (in string format) for searching records in MongoDB. Need pointer/guidance to append start time (00:00:00.000) to start date and maximum time(23.59.59.999) to end date as below in Java using java.util.Date or any others which supported by MongoDB.
Example :
Start Date+with time : 2016-06-01T00:00:00.000
End Date+with time : 2016-07-01T23:59:59.999

A: public class DateSample {
public static void main(String[] args) throws ParseException {

    String startDate = "2016-06-01";
    String endDate = "2016-07-01";

    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Date strDate = formatter.parse(startDate+" 00:00:00.000");
    Date enDate = formatter.parse(endDate+" 23:59:59.999");
    System.out.println(formatter.format(strDate));
    System.out.println(formatter.format(enDate));

}

}
You will get
2016-06-01 00:00:00
2016-07-01 23:59:59

A: You could use the DateTimeFormatter.ISO_LOCAL_DATE_TIME for this. Here is an example that might shed some light on what you are trying to do:
DateTimeFormatter dtf = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
String startTime = "T00:00:00.000";
String endTime = "T23:59:59.999";
//here I used the LocalDateTime parser to parse the data+startTime/endTime
LocalDateTime startLocalDateTime = LocalDateTime.parse("2016-07-01"+startTime);
LocalDateTime endLocalDateTime = LocalDateTime.parse("2016-07-01"+endTime );
//with the LocalDateTime, you can then to whatever you want
//as an example, I am parsing it using ISO_LOCAL_DATE_TIME :
String strinStartTime= dtf.format(LocalDateTime.parse("2016-07-22"+startTime));

I hope this helps;

A: If you are running under jdk 1.8, use LocalDateTime
LocalDateTime is an embedded api of jdk 1.8. You can found explaination here docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html. You can use minus* or plus*, and parse methods

A: tl;dr
ZoneId zoneId = ZoneId.of( "Europe/Paris" ) ;
LocalDate startDate = LocalDate.of( "2016-06-01" ) ;
ZonedDateTime zdt start = startDate.atStartOfDay( zoneId ) ;
ZonedDateTime zdt stop = startDate.plusMonths(1).atStartOfDay( zoneId ) ;
// Perform database search where ( ( x >= start ) AND ( x < stop ) ) . Notice '>=' versus '<' with no 'equals' on the latter.

If you need strings…
String outputStart = start.toInstant().toString() ;  // 2016-05-31T22:00:00Z  Paris in the summer is two hours ahead of UTC.
String outputStop = stop.toInstant().toString() ;  // 2016-06-30T22:00:00Z

Details
The Answer by ishmaelMakitla is good in that it points to using the java.time classes built into Java 8 and later. But it focuses on strings rather than objects. Also it does not discuss the crucial issue of time zone.
The java.time classes include:

*

*LocalDate for a date-only value with no time-of-day and no time zone.

*LocalTime for a time-of-day value without a date and without a time zone.
LocalDate startDate = LocalDate.parse( "2016-06-01" );  // Parsing ISO 8601 standard date format.
LocalTime startTime = LocalTime.MIN;  // '00:00'.
Both of those classes can be used in factory methods to instantiate LocalDateTime and other classes.
LocalDateTime ldt = LocalDateTime.of( startDate , startTime );

In code above we used LocalTime.MIN to get 00:00. To directly answer your Question, you can also use LocalTime.MAX in the same way to get 23:59:59.999999999. But I do not recommend doing so. Read below about "Half-Open".
Time zone
Time zone is crucial in determining a date and a time. For any given moment the date and the hour-of-day both vary by time zone. A few minutes after midnight in Paris is a new day while still "yesterday" in Montréal.
The Local… types are not actual moments on the timeline. They represent a vague idea about possible moments. As noted above, the first moment of June 1st in Paris is simultaneously May 31st at 6 PM in Montréal. So before performing your database search you need to assign a time zone to your LocalDateTime. Applying a ZoneId produces a ZonedDateTime object.
Perhaps your date-time was intended to be Paris.
ZoneId zoneId = ZoneId.of( "Europe/Paris" );
ZonedDateTime zdt = ldt.atZone( zoneId );

Or perhaps you intended UTC. This all depends on your business rules, the context in which your app operates. For UTC, we use OffsetDateTime as UTC is not a full time zone but rather a mere offset-from-UTC. A time zone is an offset plus a set of rules for handling anomalies such as Daylight Saving Time (DST).
OffsetDateTime odt = ldt.atOffset( ZoneOffset.UTC );

To get a string as asked for in the Question, extract LocalDate and call toString(). But I do not recommend this as it ignores time zone (read on down below).
String output = odt.toLocalDateTime.toString();  // Not likely to be what you really need.

Best practice in databases is to store the date-time in UTC. I don't know about MongoDB. Be sure to read the doc on how your database driver in Java may be affecting/translating the values you specify.
Start of Day
Be aware that a day does not always start at 00:00:00. In some time zones DST or other anomalies means the day may start at some other time such as 01:00.
The java.time classes will make adjustments as needed in some situations. Be sure to read the class doc so you see if the behavior matches your expectations & needs.
You can ask java.time to find the starting time.
ZonedDateTime zdt = LocalDate.of( "2016-06-01" ).atStartOfDay( zoneId );

Half-Open
Your attempt to determine the end of the day is a problem. That last second is infinitely divisible. Traditional Unix-oriented libraries resolve to whole seconds, the old date-time classes in Java resolve to milliseconds, some databases like Postgres may resolve to microseconds, and java.time and other databases such as H2 resolve to nanoseconds. Do not get in the middle of that.
Generally in date-time programming of a span of time, the best practice is "Half-Open". The beginning of the span is inclusive while the ending is exclusive.
So searching for a month of data in Paris zone means searching for records where the date-time is equal to or later than the start and less than (but not including) the stop.
ZoneId zoneId = ZoneId.of( "Europe/Paris" );
LocalDate startDate = LocalDate.of( "2016-06-01" );
ZonedDateTime zdt start = startDate.atStartOfDay( zoneId );
ZonedDateTime zdt stop = startDate.plusMonths(1).atStartOfDay( zoneId );
// Perform database search where ( ( x >= start ) AND ( x < stop ) ) . Notice '>=' versus '<' with no 'equals' on the latter.

Similarly, the month of records for UTC rather than Paris.
ZoneOffset zoneOffset = ZoneOffset.UTC;
LocalDate startDate = LocalDate.of( "2016-06-01" );
OffsetDateTime start = OffsetDateTime.of( startDate , zoneOffset );
OffsetDateTime stop = OffsetDateTime.plusMonths(1).of( startDate , zoneOffset );
// Perform database search where ( ( x >= start ) AND ( x < stop ) ) . Notice '>=' versus '<' with no 'equals' on the latter.

Using the Half-Open approach consistently throughout your app where handling spans of time will make your code more sensible and easier to understand. You can also train your users to think this way. We all use Half-Open intuitively in situations situations like "Lunch break is from 12:00 to 13:00". We all know this means be back from lunch before the clock strikes 13:00:00.0.


text:
Q: Store cache according to the URL I am creating a Java web application using the Vaadin framework, nevertheless the question concerns any type of web application. The application consists of several modules and I have implemented it in that way, that any module appears according to the URL. In particular a parameter in the URL determines which module must appear. The problem is the influence of the cache on the functionality of the application, since every it runs with an URL having been used previously, it brings the application stored in cache and therefore the last module appeared, not the module indicated by the URL.
I want to know if an attainable approach would be to store the application separate in the cache according to the URL. For instance if there are 10 modules, hence 10 URLs, a cache.manifest file should be used for each one:
cache.manifest_module1
cache.manifest_module2
...
cache.manifest_module10

Could that be implemented and how? How could then I lead each time the application, which runs under a specific URL, to be stored in the correct (specific) cache.manifest file?
Update: I have read also this question, which points out that it is possible to link each url to a cache-manifest file, but it does not explain how. Any suggestion?