text:
Q: How to find value of respective key using Dictionary Dictionary
         string[,]  Words = new string [,]
      /*****Word and Meaning****/

     {{"Absolute","Complete"},
     {"Custom","Tradition"},
     {"Design","Plan"},
     {"New", "Latest"},
     {"Sound", "Noise"},
     {"Vile", "Base"}};

/****Inputing The User***/
     string key = "";
     Boolean search=true;
     Console.Write("Input Word: ");
     key= Console.ReadLine();
     Console.WriteLine();

     for(int ctr=0; ctr < Words.GetLength(0); ctr++)

/****Search if the Value of Key that has been Put the User is true***/
         if(key == Words[ctr,0])
            search=true;
             break;
         else
             search=false
     if(search==true)

/***How to Get the Value of Words in Second Row****/
         Console.WriteLine(Words: " + key+ "Meaning: " +???;
        else
            Console.WriteLine("Not Found" + key);

Please help me..  To create this code of How to get the meaning of the Words: Absolute, Custom, Design, New, Sound, Vile.

A: If you have all unqiue keys at first place of every record, then this is right time to use Dictionary.
Here is the implementation
  Dictionary<string, string> dict = new Dictionary<string, string>();
  dict.Add("Absolute", "Complete");
  dict.Add("Custom", "Tradition");
  dict.Add("Design", "Plan");
  dict.Add("New", "Latest");
  dict.Add("Sound", "Noise");
  dict.Add("Vile", "Base");

Now you can read Key of dictionary from user
 Console.Write("Input Word: ");
 string key= Console.ReadLine();

Now check user input i.e. key is available in dictionary or not, like
if(dict.ContainsKey(key)) //ContainsKey return true if string i.e. key available in dictionary.
    Console.WriteLine("Word is :" + key + "Meaning is" + dict[key]);
else
    Console.WriteLine("Not Found" + key);


text:
Q: How to make LED flash once every 5 seconds using using 555 timer? I know this is not new but i really can't find a circuit that makes an led flash once every 5 secs. I hope somebody can help me out.
Thanks a lot.

A: An LM3909 is an 8 pin IC designed for exactly that, flashing LEDs. It operates on 1v to 5v and is very conservative on power usage. The datasheets are easy to find online.

A: Search for '555 LED flasher circuit' and go to Images.  Tons of schematics.  Plus, the 555 datasheet has many application circuits included.
https://images.search.yahoo.com/search/images;_ylt=AwrBT9aU78JZVM0AuihXNyoA;_ylu=X3oDMTE0NzBpZW00BGNvbG8DYmYxBHBvcwMxBHZ0aWQDVUkyQzNfMQRzZWMDcGl2cw--?p=555+led+flasher+circuit&fr2=piv-web

redpajama_set_name: RedPajamaStackExchange


text:
Q: Changing div element depending on current page I'm a php guy trying to work with C# for the first time. I have a master page with the following navigation code I'd like to dynamically change depending on the webpage:
main.master:
...

link A

link B

link C

...

As of now, the class="active" is hard coded, but I'd like to put some conditions such as:

whatever link it's supposed to be

I can do this in PHP, but I'm just not sure how to do it the C#'s ASP.net way.
I have the following structure:

    - main.master --
    -- pageA.aspx
    -- pageB.aspx
    -- pagec.aspx

such that the current page is loaded via:
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>

and looks like:

    x x x x x x x x x x x x x
    x main.master x x x x x x
    x Nav A x Nav B x Nav C x
    x x x
    x x x   p p p p p p p p p
    x x x   p Crnt page x p p
    x x x   p p p p p p p p p

I'd like to have the class ".active" applied to the main.master dynamically depending on whatever page variable is set by the current page.
tldr: I guess, what I'm also looking for is a simple way of doing the following: <?php //some code here ?>
edit:
protected void Page_Load(object sender, EventArgs e)
    {
//check for conditions of home
...
        this.isActiveHome.Text = @"
Home
";
    }

A: The <?php ?> equivalent is <%= %>
If you're doing a lot of logic, it's best practice to do that logic in the code behind (.aspx.cs) and render the controls there.
A better option is the BulletedList:
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.bulletedlist.aspx
Build the BulletedList control by adding the Items in the Page_Load method.
You can get the page name using:
string pageName = Path.GetFileNameWithoutExtension(Page.AppRelativeVirtualPath);


text:
Q: How to choose the elements from the jQuery object I'm sorry for stupid title.
Problem: I need to select only .special element from $elements variable.

Jquery:
var $elements = $('.element'),
    $special  = $element.find('.special'); // Not working.

UPD:
Please, don't write something like "$('.element.special')". It's wrong for my case.

A: You need to use .filter()
var $elements = $('.element'),
    $special  = $element.filter('.special');

Since the element you are targeting is a member of the $element set, you need to use .filter(), .find() is used to find descendant members of the elements in the calling set

A:
bbb

aaa

aaa

var $special = $('.element.special');
$special.html("test");

A: you can use
var $special = $('.element.special');


text:
Q: Xamarin Forms Push Notification received but not showing/appearing I had push notifications up and working previously but now for some reason although the push notification is received, (I know it is received as it shows in Debug that a FireBaseMessage was received), it is no longer shown or a notification does not appear.
Here it can be seen that the message is received:
The following is the code in my MyFireBaseMessagingService.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;
using System.Diagnostics;
using Firebase.Messaging;

namespace Chatfer.Droid
{
    [Service]
    [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
    class MyFirebaseMessagingService : FirebaseMessagingService
    {
        const string TAG = "MyFirebaseMsgService";
        public override void OnMessageReceived(RemoteMessage message)
        {
            System.Diagnostics.Debug.WriteLine(TAG, "From: " + message.From);
            if (message.GetNotification() != null)
            {
                //These is how most messages will be received
                System.Diagnostics.Debug.WriteLine(TAG, "Notification Message Body: " + message.GetNotification().Body);
                SendNotification(message.GetNotification().Body);
            }
            else
            {
                //Only used for debugging payloads sent from the Azure portal
                SendNotification(message.Data.Values.First());

            }

        }

        void SendNotification(string messageBody)
        {
            var intent = new Intent(this, typeof(MainActivity));
            intent.AddFlags(ActivityFlags.ClearTop);
            var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);

            var notificationBuilder = new Notification.Builder(this)
                        .SetContentTitle("Chatfer Message")
                        .SetSmallIcon(Resource.Drawable.ic_launcher)
                        .SetContentText(messageBody)
                        .SetAutoCancel(false)
                        .SetContentIntent(pendingIntent);

            var notificationManager = NotificationManager.FromContext(this);

            notificationManager.Notify(0, notificationBuilder.Build());
        }
    }
}

What's going on? Why did the notifications suddenly stop appearing? Any insight or suggestions would be appreciated!
EDIT: After changing the MyFirebaseMessagingService.cs to the following, the notifications started showing again!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Util;
using System.Diagnostics;
using Firebase.Messaging;

namespace Chatfer.Droid
{
    [Service]
    [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
    class MyFirebaseMessagingService : FirebaseMessagingService
    {
        const string TAG = "MyFirebaseMsgService";
        public override void OnMessageReceived(RemoteMessage message)
        {
            System.Diagnostics.Debug.WriteLine(TAG, "From: " + message.From);
            if (message.GetNotification() != null)
            {
                //These is how most messages will be received
                System.Diagnostics.Debug.WriteLine(TAG, "Notification Message Body: " + message.GetNotification().Body);
                SendNotification(message.GetNotification().Body);
            }
            else
            {
                //Only used for debugging payloads sent from the Azure portal
                SendNotification(message.Data.Values.First());

            }

        }

        void SendNotification(string messageBody)
        {
            var intent = new Intent(this, typeof(MainActivity));
            intent.AddFlags(ActivityFlags.ClearTop);
            var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);

            var notificationBuilder = new Notification.Builder(this)
                        .SetContentTitle("Chatfer Message")
                        .SetSmallIcon(Resource.Drawable.ic_launcher)
                        .SetContentText(messageBody)
                        .SetAutoCancel(true)
                        .SetContentIntent(pendingIntent)
                        .SetChannelId("YourUniqueChannelID");

            //var notificationManager = NotificationManager.FromContext(this);

            if (Build.VERSION.SdkInt < BuildVersionCodes.O)
            {
                // Notification channels are new in API 26 (and not a part of the
                // support library). There is no need to create a notification
                // channel on older versions of Android.
                return;
            }

            var channel = new NotificationChannel("YourUniqueChannelID", "FCM Notifications", NotificationImportance.Default)
            {
                Description = "Firebase Cloud Messages appear in this channel"
            };

            var notificationManager = (NotificationManager)GetSystemService(NotificationService);
            notificationManager.CreateNotificationChannel(channel);

            notificationManager.Notify(0, notificationBuilder.Build());
        }
    }
}

A: The reason I think you don't get it is that you do not have a notification channel if you have Android V 8+ devices which I'm sure you will see to it you are registering for a notification channel in your MainActivity OnCreate method
void CreateNotificationChannel()
    {
        if (Build.VERSION.SdkInt < BuildVersionCodes.O)
        {
            // Notification channels are new in API 26 (and not a part of the
            // support library). There is no need to create a notification
            // channel on older versions of Android.
            return;
        }

        var channel = new NotificationChannel(CHANNEL_ID, "FCM Notifications", NotificationImportance.Default)
                      {
                          Description = "Firebase Cloud Messages appear in this channel"
                      };

        var notificationManager = (NotificationManager) GetSystemService(NotificationService);
        notificationManager.CreateNotificationChannel(channel);
    }


text:
Q: Set Eclipse as the default editor for opening a file Is it possible to set Eclipse as the default program for open certain types of files? I'd like to set it as the default program for editing .java and .js files.

A: The normal way of setting a default program to open a certain type of files would work:
Right click a certain .java / .js file (any file of the type you want Eclipse to open by default) -> Open With -> Choose default program -> Choose Eclipse (you may need to browse and find the Eclipse executable file (the launcher)).
Do this for .java and .js files and you're good to go.

A: Install this plugin on eclipse :
https://marketplace.eclipse.org/content/default-text-editor


text:
Q: What's the difference of running ab locally and remotely? I was benchmarking my site with apache ab and I noticed that the response time had big differences when running ab on the server and running ab on a client box remotely.
So what's the biggest difference between running ab on the server and running ab remotely. Is the time consumed on net transportation?

A: Latency and network capacity.
We wrote a good article about concurrency/load testing with Siege (which is very similar to AB) specifically mentioning local versus remote testing.
You can read the full version here:
http://www.sonassi.com/knowledge-base/magento-kb/why-siege-isnt-an-accurate-test-tool-for-magento-performance/

Testing remote servers is almost pointless as it is a concurrency test (ie. how many requests can be satisfied repeatedly), the immediate bottleneck is the network connection between the two machines. Latency and TCP/IP overheads are what make testing a remote site completely pointless, the slightest network congestion amongst a peer between the two servers will immediately show reduced performance. So, what really starts to come into play is how fast the TCP 3-way handshake can be completed – the server being tested could be serving a dynamic page or static 0 byte file – and you could see exactly the same rates of performance, as connectivity is the bottleneck.
We can show this using a simple ping. Our data-centres are located in Manchester, United Kingdom, so we'll try pinging a server in the UK, then a server in the USA and show the differentiation. Both servers are connected to the internet via 100Mbit connections.
Ping from UK to UK
[~]$ ping www.bytemark.co.uk -c4
PING www.bytemark.co.uk (212.110.161.177) 56(84) bytes of data.
64 bytes from extapp-front.bytemark.co.uk (212.110.161.177): icmp_seq=1 ttl=57
--- www.bytemark.co.uk ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3005ms
rtt min/avg/max/mdev = 2.515/2.641/2.869/0.142 mstime=2.86 ms

Ping from UK to USA
[~]$ ping www.mediatemple.net -c 4
PING www.mediatemple.net (64.207.129.182) 56(84) bytes of data.
64 bytes from mediatemple.net (64.207.129.182): icmp_seq=1 ttl=49 time=158 ms
--- www.mediatemple.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 154.155/155.282/158.321/1.802 ms

You can immediately see the difference in performance. For that single TCP/IP connection to the USA from the UK, it took 156ms, 62 times more than to a server in the UK. Which means that before you even try anything, the maximum throughput you can achieve on Siege in a second is going to be around 6 transactions per second, due to latency alone.
Lets put this to the test then …
[~]$ siege http://www.wiredtree.com/images/arrow.gif -c 1 -t 10S -b
** SIEGE 2.66
** Preparing 1 concurrent users for battle.
The server is now under siege...
Lifting the server siege...done.
Transactions:                      50 hits
Availability:                 100.00 %
Elapsed time:                   9.89 secs
Data transferred:               0.00 MB
Response time:                  0.20 secs
Transaction rate:               5.06 trans/sec
Throughput:                     0.00 MB/sec
Concurrency:                    1.00
Successful transactions:          50
Failed transactions:               0
Longest transaction:            0.20
Shortest transaction:           0.19

Just under the predicted figure of 6 TPS. But unfortunately, this is always going to be the case. The latency will always prove to ruin any concurrency test even if the remote server is capable of much more. Lets repeat the exact same test from a server in the USA to see how latency really affected the test. First up a quick ping,
[~]$ ping www.mediatemple.net -c 4
PING www.mediatemple.net (64.207.129.182) 56(84) bytes of data.
64 bytes from mediatemple.net (64.207.129.182): icmp_seq=1 ttl=52 time=62.8 ms
--- www.mediatemple.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3067ms
rtt min/avg/max/mdev = 62.872/62.922/62.946/0.029 ms

[~]$ siege http://mediatemple.net/_images/searchicon.png -c 1 -t 10S -b
** SIEGE 2.72
** Preparing 1 concurrent users for battle.
The server is now under siege...
Lifting the server siege...      done.

Transactions:                     73 hits
Availability:                 100.00 %
Elapsed time:                   9.62 secs
Data transferred:               0.22 MB
Response time:                  0.13 secs
Transaction rate:               7.59 trans/sec
Throughput:                     0.02 MB/sec
Concurrency:                    0.99
Successful transactions:          73
Failed transactions:               0
Longest transaction:            0.14
Shortest transaction:           0.12

So there you have it, we've managed to double our transactions per second, without any server-side changes simply by using a server closer to the test site – showing how sensitive Siege is network latency.
Siege is going to be limited by the bandwidth available on your test server and the remote server. So once you start hitting higher levels of throughput, the amount of content being downloaded starts to go up. In our examples above, 0.02MB was downloaded in 10 seconds – which is a tiny 0.16 Mbps (megabits per second). But when you start to increase the number of concurrent users, things can change radically and it is very easy to saturate the network connection – long before the server itself has reached its capacity.
So if the server you were testing from only had 20Mbit of usable bandwidth, you would probably see a maximum of about 500 req/s on the 4Kb resource mentioned earlier.

Content extracted from http://www.sonassi.com/knowledge-base/magento-kb/why-siege-isnt-an-accurate-test-tool-for-magento-performance/

A: Yes, the different network situation is the cause.  An HTTP request tends to require 2 round-trips (for a very small request and response):
Client -> Server, SYN
Server -> Client, SYN/ACK
Client -> Server, ACK and HTTP request
Server -> Client, HTTP response

So, ping your server, and double that; that's the time that's being added to each request, on average.
You can enable HTTP keep-alive with -k and drop one of those round-trips out of the equation, but it will still be slower than local requests due to latency.

A: As you suggested the difference is due to the internet transfer from a remote client to the web server.
So it's always a good practice when doing benchmark to try and simulate your user experience. So what I do i try to run different benchmarks based on my visitors geo location to find out how they experience the site. For example if most of my visitor are from USA I run an EC2 instance from there and run the benchmark.
Based on that you can decide to deploy some kind of CDN if is needed.


text:
Q: How i can create ajax success if else condition without json? I created a form. I added many validations as requirement like required all fields. Check duplicate fields. Now I want if form submitted successfully without error reset my form if it has any error like duplicate email then show error Duplicate data found and don't reset form. I completed my code but tucked in a place I m returning false then it's not showing an error which I mentioned din called PHP file. So, how can I do it without using JSON?
$("#create_stock_out").click(function(){

    var form= new FormData();
    var subject = $("#subject").val();
    var slip_no = $("#slip_no").val();
    var warehouse = $("#warehouse").val();
    var vendor = $("#vendor").val();
    var issued_by = $("#issued_by").val();
    var received_by = $("#received_by").val();
    var project = $("#project").val();

    form.append('subject',subject);
    form.append('slip_no',slip_no);
    form.append('warehouse',warehouse);
    form.append('vendor',vendor);
    form.append('issued_by',issued_by);
    form.append('received_by',received_by);
    form.append('project', project);
    form.append('method', "stock_out");

    $.ajax({
        url: 'Function/Function.php',
        type: 'post',
        data: form,
        contentType: false,
        cache: false,
        processData:false,
        success:function(data){

            //alert(data);
            $('#stock_out_result').html(""+data+"");
            window.setTimeout(function() {
                $(".alert").fadeTo(500, 0).slideUp(500, function(){
                    $(this).remove();
                });
            }, 5000);

        }
    });
});


text:
Q: Populate a Div with the content from a select list I am trying to populate a Div with the selection from a select list. I can get it to work but the result is the value and I want the selected words.
Whatever the selection is the words appear in the Div:

Requests

Issues

Incidents

This is what I am working with;
My select list
<select name="ReportCat" id="ReportCat" class="imaindatesel" >
<option value="0">Select...</option>
<option value="1">Requests</option>
<option value="2">Issues</option>
<option value="3">Incidents</option>
</select>

My Div

My jQuery:
$(function(){
    $('#ReportCat').change(function(){

        $('#Requests').html($('#ReportCat').val());
    });
});

Can anyone please help, many thanks in advance

A: You may use : $("#ReportCat :selected").text() to get the text of selected option.

$(function(){
    $('#ReportCat').change(function(){

      $('#Requests').html($("#ReportCat :selected").text());
    });
});

<select name="ReportCat" id="ReportCat" class="imaindatesel" >
<option value="0">Select...</option>
<option value="1">Requests</option>
<option value="2">Issues</option>
<option value="3">Incidents</option>
</select>

A: To add the text, use $('#ReportCat').text() instead of $('#ReportCat').val().
$(function(){
    $('#ReportCat').change(function(){
        $('#Requests').html($('#ReportCat:selected').text());
    });
});

Also, you have repeated ID's for your div's. An ID is unique so I would suggest changing that to a class.


text:
Q: how to change the column name I am using 2 tables, dockmanagementtable and dockinfotable.
And I am using the following command for calculating the elapsed time:
((((dockmanagementtable.setvalueh * 60*60) +
   (dockmanagementtable.setvaluem * 60)) -
  dockinfotable.elapsedsecs)/60)

I am getting the correct output correctly. But I cannot modify the column name, which displays as ((((dockmanagementtable.setvalueh * 60*60) +(dockmanagementtable.setvaluem * 60)) - dockinfotable.elapsedsecs)/60).
I need to change that column name while doing the same operation.
My command is as follows:
select ((((dockmanagementtable.setvalueh * 60*60) +
          (dockmanagementtable.setvaluem * 60)) -
         dockinfotable.elapsedsecs)/60)
from dockinfotable inner join dockmanagementtable;

A: Use an alias to the column output in sql selection.
select ((((dockmanagementtable.setvalueh * 60*60) +
(dockmanagementtable.setvaluem * 60)) - dockinfotable.elapsedsecs)/60) as
mycolumn from dockinfotable inner join dockmanagementtable;

Or
select ((((dockmanagementtable.setvalueh * 60*60) +
(dockmanagementtable.setvaluem * 60)) - dockinfotable.elapsedsecs)/60)
mycolumn from dockinfotable inner join dockmanagementtable;


text:
Q: Eclipse Android and gitignore What files/folders can I safely ignore for inclusion with git?
I copied a good project, removed its gen and bin folders and tried to run the app. The Android Launch window says, "Your project contains error(s), please fix them before running your application. There is a red X on the icon to the left of the project in the Package Explorer. While the gen folder does not exist in Windows Explorer, it does in Package Explorer.

A: It's safe to ignore bin and gen, without problems.
When I have problems with a project setup, I do this:
First - have you looked at the 'Problems' tab in the view underneath the editor view - it generally gives more detailed information about project errors. If there's nothing conclusive there, I do the things below:

*

*Generally, when I'm having issues with Eclipse giving me phantom errors in the project, cleaning the project will fix it. It's in the menu, under Project>Clean.

*If that doesn't work, I'll usually try right clicking the project, going to Android Tools> Fix project properties.

*My last resort it to restart eclipse and delete the gen folder.

A: What I usually add to .gitignore is:
bin
gen

bin and gen are constantly changed while coding, so there's no need to include them into the Git repository. Also, sometimes I add .classpath and .project which are Eclipse specific files, because maybe I want to create a new Android project based on these same sources, but in another OS or IDE.
With regards to the error, I would clean the project and/or try to run the Fix Project Properties utility (right-click on the Project -> Android Tools -> Fix Project Properties).

A: There are file types to ignore
# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/

From Gitignore on github

A: the best way is use this site to generate: http://www.gitignore.io/

A: Best solution today is probably to generate the exact .gitignore file you need. Just go to http://www.gitignore.io
The project is also on Github: https://github.com/joeblau/gitignore.io

A: The simple answer to this question is *.* , basically it's completely safe to ignore anything you don't want to add to version control. That being said it really depends on what you're looking to accomplish by using Git. If you want to be able to checkout/import your project elsewhere from the same repository then you'll want to ignore at most /bin/. and /gen/., I wouldn't ignore the folders themselves (i.e. /bin, /gen) just for the sake of maintaining the proper directory structure for your project.
That answers the initial question, but is unrelated to the problem you are having. As far as solving the problem you are experiencing is concerned you would have to post more info, specifically what's listed in the Problems tab.  If you can't see the Problems tab anywhere then click on the Window menu, then show view, then choose problems if it's there or click on other and look under General to find it.


text:
Q: What are the ways or technologies to sign an executable application file in mac os x environment? I want to use self signed certificate to do signing of mac os executable like .app file or .ipa file for development purpose. I am not intending to publish the signed app in ios or mac app store. I want to develop this as a tool. So what are the options available?
I do not want to use "Xcode's automatic code signing" as it is out of my development scope.

A: First you will need to generate your own certificate.

*

*open -a "Keychain Access"

*(MENU) Certificate Assistant > Create a Certificate

*Enter the Name (for example my-codesign-cert)

*Identity Type > Self Signed Root

*Certificate Type > Code Signing

*Check "Let me override defaults" & click Continue.

*Enter a unique Serial Number.

*Enter a big Validity Period (days), like 3560 & click Continue.

*Fill in your personal information & click Continue.

*Accept defaults for the rest of the dialog boxes.

Codesign your items

codesign -s my-codesign-cert /path/to/my/binary_executable

Self-generated code sign certificates should be used for internal development only.
Do not  release thusly signed items into the wild.


text:
Q: Running selenium script in IE throws error "Only local connections are allowed." I've tried many things but still facing the same error. Can someone please help to suggest a solution?

Issue: When running selenium script in IE, I'm getting the following error.
  Setting: I'm using IE 11 and selenium 2.53.0

Started InternetExplorerDriver server (64-bit)
2.53.1.0
Listening on port 10402
Only local connections are allowed

Things I have tried so far:

*

*Changed IE Security setting such that all different zones are set to have Security Level = High

*Unchecked 'Enable Protected Mode' for all zones

*I tried both 32 bits and 64 bits of IEDriverServer.exe

*I tried to add the following codes after setting system property for the driver

DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability("ignoreZoomSetting", true);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(InternetExplorerDriver.NATIVE_EVENTS, false);
capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
capabilities.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);

Update
I updated selenium driver to 3.0.1 and changed IEDriver to 32 bits and getting following error
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 5420
Only local connections are allowed
Sep 26, 2017 12:03:15 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Sep 26, 2017 12:03:23 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Sep 26, 2017 12:03:30 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
java.lang.RuntimeException
    at org.testng.internal.TestResult.toString(TestResult.java:245)
    at org.testng.internal.TestResult.toString(TestResult.java:226)

Resolution
For anyone who might be interested, I have resolved my issue based on the two posts below.
Basically
1) Need to modify registry setting
2) Extend browser capability to ignore zone setting and protected mode setting
IELaunchURL issue with Selenium IE Driver
In IE: org.openqa.selenium.WebDriverException: This usually means that a call to the COM method IWebBrowser2::Navigate2() failed


text:
Q: Reading only SPECIFIC range of lines in a text file C++ Hi I have a text file which contains some numerical data. Of that text file ONLY the lines
14 to 100 have to be read into my C++ program. Each of these lines contain three numbers corresponding to x,y,z coordinates of a point. Thus, coordinates are given for 87 points in all.
I want to put these numbers into the arrays xp[87] yp[87] and zp[87].
How do I perform this?
Uptil now I have been used to the following
ifstream readin(argv[1])//Name of the text file

for (int i=0; i<=86; ++i)
{
readin>>xp[i]>>yp[i]>>zp[i];
}

But this technique works only for those files which contain 87 lines and the data to be read starts from the first line itself.
In the present case I want to ignore ALL lines before line 14 and ALL lines after line 100

A: Read line by line, for most flexibility in your format:
#include <fstream>
#include <sstream>
#include <string>

std::ifstream infile("thefile.txt");
std::string line;

unsigned int count = 0;

while (std::getline(infile, line))
{
  ++count;
  if (count > 100) { break; }    // done
  if (count < 14)  { continue; } // too early

  std::istringstream iss(line);
  if (!(iss >> x[count - 14] >> y[count - 14] >> z[count - 14]))
  {
    // error
  }
}

// all done

A:
In the present case I want to ignore ALL lines before line 14

Since you have to actually read the file to know where a line ends and a new one begins, you will have to then read 13 lines. Use getline() and a dummy string to hold the results from it.

and ALL lines after line 100

Just close the stream and be done with it.

A: After several years, Range-v3 allows one to write this:
#include <fstream>
#include <iostream>
#include <range/v3/view/drop.hpp>
#include <range/v3/view/getlines.hpp>
#include <range/v3/view/take.hpp>

using namespace ranges;
using namespace ranges::views;

int main() {

    std::ifstream ifs{"inputFile"};

    auto lines = getlines(ifs) | take(100) | drop(15/* which is 14 - 1 */);

    for (auto i : lines) {
        std::cout << i << std::endl;
    }
}

Requires C++17.


text:
Q: LVM group disk usage My Server LVM group is report full disk usage.
[root@CH3CSSD01-0539 ~]#  pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sdy2
  VG Name               centos
  PV Size               464.24 GiB / not usable 2.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              118845
  Free PE               0
  Allocated PE          118845
  PV UUID               uV9hb7-eD2V-q6rB-KqP7-OJu2-J50e-LrETpH

  --- Physical Segments ---
  Physical extent 0 to 1023:
    Logical volume      /dev/centos/swap
    Logical extents     0 to 1023
  Physical extent 1024 to 106044:
    Logical volume      /dev/centos/home
    Logical extents     0 to 105020
  Physical extent 106045 to 118844:
    Logical volume      /dev/centos/root
    Logical extents     0 to 12799

But actually disk is having lot of free space as seen by df.
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   50G  3.9G   47G   8% /
devtmpfs                  63G     0   63G   0% /dev
tmpfs                     63G     0   63G   0% /dev/shm
tmpfs                     63G   34M   63G   1% /run
tmpfs                     63G     0   63G   0% /sys/fs/cgroup
/dev/sdy1                494M  128M  367M  26% /boot
/dev/mapper/centos-home  411G  3.3G  407G   1% /home

I have rebooted host many times, still same. Can please help as what to do? I suspect its PE that are causing issue, how can i free up space on the volume group ?
Here is output of lvdisplay
[root@CH3CSSD01-0539 ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/centos/swap
  LV Name                swap
  VG Name                centos
  LV UUID                5eHvlE-btOG-5bSw-Pvpa-YQgJ-DT5t-oo0OCb
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-04 23:48:10 -0700
  LV Status              available
  # open                 2
  LV Size                4.00 GiB
  Current LE             1024
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

  --- Logical volume ---
  LV Path                /dev/centos/home
  LV Name                home
  VG Name                centos
  LV UUID                NzUCNY-2Jd4-HAaM-juFu-Qy1n-sZ2Y-Nbxuh2
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-04 23:48:11 -0700
  LV Status              available
  # open                 1
  LV Size                410.24 GiB
  Current LE             105021
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/centos/root
  LV Name                root
  VG Name                centos
  LV UUID                1SjCaN-iwTR-MOdM-zzqc-QktM-sJSw-6JlVCE
  LV Write Access        read/write
  LV Creation host, time localhost, 2014-09-04 23:48:18 -0700
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

Regards
AUn

A: It is normal your Volume Group shows as full: you defined three Logical Volumes, which added sizes (50+410+4) match that of your Volume Group.
The rest seems in order.

A: What you're seeing is perfectly normal.
Your Volume Group is full of Logical Volumes. Unless you need to create more volume groups, you don't need to do anything to free up Physical Extents.
Your Logical Volumes have file systems which then have free space which is what df is seeing.

A:
Can please help as what to do? I suspect its PE that are causing issue, how can i free up space on the volume group ?

Until fairly recent versions all logical volumes are 'thickly' provisioned.  Even with recent versions I believe thick volumes is the default.  When I say thick, I mean that if you create a volume that is 410.24 GiB, it will take up exactly that much storage on the physical volumes, even if that logical volume is completely empty.
Your /dev/mapper/centos-root, and /dev/centos/home seems to be extremely over-provisioned based on your current usage.  The simple answer is to shrink those filesystems, and logical volumes.  Hopefully the filesystems you have on this volumes are able to be shrunk, not all filesystems are.
Unfortunately, shrinking pretty much all filesystems is an operation that must be performed offline.  Also safely resizing things is a bit tricky.  Whatever you do, first start with making and verifying you have a good backup.
After verifying your backups, boot to livecd/liveusb that supports LVM.  Resize the  filesystem, then resize the logical volume.  There are many online guides about how to shrink a filesystem+logical volume so I will not repeat that here.
For the future, I strongly suggest that when you create logical volumes, you use use the smallest size you actually need.  Increasing the size of volumes and filesystems is trivial and for most filesystems can be done online.  So make your lv/filesystem small, and just add more space as needed.


text:
Q: List view column header index returns -1 I have a list view which i declared the column headers like below.
    private System.Windows.Forms.ColumnHeader Debtorname;
    private System.Windows.Forms.ColumnHeader Message;
    private System.Windows.Forms.ColumnHeader Hpno;
    private System.Windows.Forms.ColumnHeader Status;
    private System.Windows.Forms.ColumnHeader Timestamp;
    private System.Windows.Forms.ColumnHeader sentBY;
    private System.Windows.Forms.ColumnHeader submitTime;
    private System.Windows.Forms.ColumnHeader debtorid;
    private System.Windows.Forms.ColumnHeader Account;

    private System.Windows.Forms.ColumnHeader Client;
    private System.Windows.Forms.ColumnHeader Batchno;

I populate the listviewitems like below.
 ListViewItem lvi = new ListViewItem(new string[lstSMSReport.Columns.Count]);
 lvi.SubItems[Debtorname.Index].Text = myReader["debtorName"].ToString();
 lvi.SubItems[Status.Index].Text = myReader["status"].ToString();

 lvi.SubItems[Timestamp.Index].Text = myReader["timestamp"].ToString();

When i run the above, i get the result i am expecting , however this two columnheaders below threw and exception.
  lvi.SubItems[Client.Index].Text = myReader["clientname"].ToString();
  lvi.SubItems[Batchno.Index].Text = myReader["batchno"].ToString();

When i put the two in try and catch. Then i realized a -1 is return as the index for the two columns. I spent a couple of hours trying to figure out why but still couldn't.
Please any suggestion would be appreciated.


text:
Q: Javascript: how to ensure that fetch() has finished before using the data? I'm struggling with fetch(), which I'm using to retrieve JSON.  I think the problem is that the code completes and tries to 'act' on the array before fetch() has actually downloaded and processed it.  I wrote a simpler version initially, which resulted in the same problem; most of the code here is from Google Developers.
As shown below (setTimeout only included to demonstrate the problem) I get different results when accessing the same array twice, a second apart:
dataResultArray = requestJSONResult(searchString);

console.log(dataResultArray);           // logs '[]'
console.log(dataResultArray.length);    // logs '0'

setTimeout(function(){
  console.log(dataResultArray);         // logs the actual JSON array contents
  console.log(dataResultArray.length);  // logs the real array length
}, 1000);

function requestJSONResult(searchString) {
  var tempArray = []

  fetch(`/search/?term=${searchString}`)
    .then(status)
    .then(json)
    .then(function(data) {
      tempArray.push(...data)
    }).catch(function(error) {
    console.log('Request failed', error);
    });

  return tempArray;
}

function status(response) {
  if (response.status >= 200 && response.status < 300) {
    return Promise.resolve(response)
  } else {
    return Promise.reject(new Error(response.statusText))
  }
}

function json(response) {
  return response.json()
}

A: It appears you are trying to make your asynchronous code synchronous which is not a good idea.
Just return the promise from fetch to retrieve the data like so:
function requestJSONResult(searchString) {
  return fetch(`/search/?term=${searchString}`)
    .then(status)
    .then(json);
}

function status(response) {
  if (response.status >= 200 && response.status < 300) {
    return Promise.resolve(response)
  } else {
    return Promise.reject(new Error(response.statusText))
  }
}

function json(response) {
  return response.json()
}

requestJSONResult(searchString)
  .then(function(data) {
    console.log(data);
    console.log(data.length);
  })
  .catch(function(error) {
    console.log('Request failed', error);
  });

Now your requestJSONResult returns a promise that could either resolve or reject so any caller can wait for those events.

A: Keep in mind that I haven't tested this.  You need to use promises throughout.  Trying to force asynchronous code synchronous is not reliable, as you've discovered.
function status(response) {
  if (response.status >= 200 && response.status < 300) {
    return Promise.resolve(response)
  } else {
    return Promise.reject(new Error(response.statusText))
  }
}

Notice line 2 of requestJSONResult: return fetch(....).  We return the promise from the function.
function requestJSONResult(searchString) {
    return fetch(`/search/?term=${searchString}`)
        .then(status)
        .then(function(response) {
            return response.json();
        })
        .catch(function(error) {
            console.log('Request failed', error);
        });
}

requestJSONResult(searchString)
    .then(function(result) {
        console.log(result);
    });


text:
Q: Bash: run command on file change and on standard input I have a nice file watcher using fswatch:
cmd="go install ./..."
$cmd
fswatch -0 ./ | while read -d "" event; do
  echo "File Changed: $event"
  $cmd
done

Now I also want to listen for input at the command-line, so if I type in anything, $cmd will be run
I don't want to stop and start fswatch a lot (like in a loop) because it might miss a change.
What is the best way to do this?

A: The easiest way is to put your while-loop in the background and start a second while-loop for the commandline:
cmd="go install ./..."
$cmd
fswatch -0 ./ | while read -d "" event; do
    echo "File Changed: $event"
    $cmd
done &
while read -r line ; do
    echo "Commandline: $line"
    $cmd
done

There is also a way to use a fifo:
mkfifo nicename
cmd="go install ./..."
$cmd
tail -f nicename | while read -d "" event; do
    echo "File Changed: $event"
    $cmd
done &

fswatch -0 ./ >> nicename &
cat >> nicename

The fifo allows you to use even more that two input-processes to use your loop.


text:
Q: A film or TV series about classic monsters getting together This would have been a children's film or TV prog, and I probably saw it in the mid 1980s.
It was filmed with puppets (stop motion or marionation, I don't remember), and was about a gathering of classic movie monsters (Dracula, Frankenstein's monster) at the lab or home of some respected member of their group. I think he was an old man who was dying or retiring, and the gathering was about naming a successor.
I remember a couple of moments fairly clearly:

*

*Dracula - possibly aboard a ship? - looking at the old man's castle in the distance, then saying in a very stereotypical 'vampire' accent, "Now you vill see ze original batman!", then turning into a bat and flying to the castle.

*The old man's assistant/daughter scheming behind his back and telling at least one of the other monsters that they were not going to be chosen as successor.

*The assistant/daughter, probably at the end, tearfully confessing to her love interest that she can't love him because she's a robot, saying something along the lines of "My heart is just a pump that circulates coolant".
That's about as far as I can go. Does it ring any bells for anyone?

A: Pretty sure this is Mad Monster Party?.

Mad Monster Party (on-screen title Mad Monster Party?) is a 1967 American stop motion animated musical comedy film produced by Rankin/Bass Productions for Embassy Pictures. The film stars Boris Karloff, Allen Swift, Gale Garnett, and Phyllis Diller. Although less well-known than Rankin/Bass' holiday specials, it has become a cult film
Baron Boris von Frankenstein (voiced by Boris Karloff) achieves his ultimate ambition, the secret of total destruction. Having perfected and tested the formula, he sends out messenger bats to summon all monsters to the Isle of Evil in the Caribbean Sea. The Baron intends to inform them of his discovery and also to reveal his imminent retirement as head of the "Worldwide Organization of Monsters". Besides Frankenstein's Monster (referred to as "Fang") and the Monster's more intelligent mate (voiced by Phyllis Diller) who live in the island castle with Boris, the invites also include Count Dracula, the Mummy, Quasimodo (referred to as "The Hunchback of Notre Dame"), the Werewolf, The Invisible Man, Dr. Jekyll and Mr. Hyde, and the Creature from the Black Lagoon (referred to as the "Creature").
The Baron's beautiful assistant Francesca (voiced by Gale Garnett) enters the lab to confirm that all invitations have been delivered and inquires about one of the addressees named Felix Flanken (voiced by Allen Swift). Frankenstein explains that Flanken is his nephew and successor in the monster business. This displeases Francesca who covets the role for herself. Francesca even asks why there was not an invitation for "It". Boris replies that "It" was not invited since "It" can be a crushing bore, explaining that "It" even crushed the island's wild boars in his bare hands the last time "It" was invited.

The trailer:

From the script:

Dracula: Now, friends, you'll discover who was the original batman.

....

Monster's Mate: Who could be closer to Dr. Frankenstein than me and Fang?
Fang: Why, he created us!
Monster's Mate: Francesca! I'll see to it that she's not his successor.

....

Francesca: But where other women have a heart, I have a spring that will unwind. Where other women have lungs, I've got a pump that runs on batteries which will run out.


text:
Q: Python Using wildcard inside of strings I am trying to scrap data from boxofficemoviemojo.com and I have everything setup correctly. However I am receiving a logical error that I cannot figure out. Essentially I want to take the top 100 movies and write the data to a csv file.
I am currently using html from this site for testing (Other years are the same): http://boxofficemojo.com/yearly/chart/?yr=2014&p=.htm
There's a lot of code however this is the main part that I am struggling with. The code block looks like this:
def grab_yearly_data(self,page,year):
    # page is the url that was downloaded, year in this case is 2014.

    rank_pattern=r'([0-9,]*?)'
    mov_title_pattern=r'(.htm">[A-Z])*?	'
    #mov_title_pattern=r'.htm">*?	' # Testing

    self.rank= [g for g in re.findall(rank_pattern,page)]
    self.mov_title=[g for g in re.findall(mov_title_pattern,page)]

self.rank works perfectly. However self.mov_title does not store the data correctly. I am suppose to receive a list with 102 elements with the movie titles. However I receive 102 empty strings: ''. The rest of the program will be pretty simple once I figure out what I am doing wrong, I just can't find the answer to my question online. I've tried to change the mov_title_pattern plenty of times and I either receive nothing or 102 empty strings. Please help I really want to move forward with my project.

A: Just don't attempt to parse HTML with regex - it would save you time, most importantly - hair, and would make your life easier.
Here is a solution using BeautifulSoup HTML parser:
from bs4 import BeautifulSoup
import requests

url = 'http://boxofficemojo.com/yearly/chart/?yr=2014&p=.htm'
response = requests.get(url)

soup = BeautifulSoup(response.content)

for row in soup.select('div#body td[colspan="3"] > table[border="0"] tr')[1:-3]:
    cells = row.find_all('td')
    if len(cells) < 2:
        continue

    rank = cells[0].text
    title = cells[1].text
    print rank, title

Prints:
1 Guardians of the Galaxy
2 The Hunger Games: Mockingjay - Part 1
3 Captain America: The Winter Soldier
4 The LEGO Movie
...
98 Transcendence
99 The Theory of Everything
100 As Above/So Below

The expression inside the select() call is a CSS Selector - a convenient and powerful way of locating elements. But, since the elements on this particular page are not conveniently mapped with ids or marked with classes, we have to rely on attributes like colspan or border. [1:-3] slice is here to eliminate the header and total rows.

For this page, to get to the table you can rely on the chart element and get it's next table sibling:
for row in soup.find('div', id='chart_container').find_next_sibling('table').find_all('tr')[1:-3]:
    ...

A: mov_title_pattern=r'.htm">([A-Za-z0-9 ]*)	'

Try this.This should work for your case.See demo.
https://www.regex101.com/r/fG5pZ8/6

A: Your regex does not make much sense.  It matches .htm">[A-Z] as few times as possible, which is usually zero, yielding an empty string.
Moreover, with a very general regular expression like that, there is no guarantee that it only matches on the result rows.  The generated page contains a lot of other places where you could expect to find .htm"> followed by something.
More generally, I would advocate an approach where you craft a regular expression which precisely identifies each generated result row, and extracts from that all the values you want.  In other words, try something like
re.findall('stuff (rank) stuff (title) stuff stuff stuff')

(where I have left it as an exercise to devise a precise regular expression with proper HTML fragments where I have the stuff placeholders)
and extract both the "rank" group and the "title" group out of each matched row.
Granted, scraping is always brittle business.  If you make your regex really tight, chances are it will stop working if the site changes some details in its layout.  If you make it too relaxed, it will sometimes return the wrong things.


text:
Q: Check if a command was used at least once? I use LuaLaTeX, so Lua-based answers are welcome. I would like to know, for an arbitrary command sequence, can I make some function/command \wasused{csname} to tell me if a cs was used in my document? To clarify, by used, it may or may not be defined. I'm more interested if the cs was called at some point. I suppose one way would be to hook a counter in \def, or make some special version of it to do so.

A: You can define a counter, and then use \pretocmd from etoolbox package to increase it every time a command is used.
Here is we count how many times \emph was used in the document so far:
\documentclass{article}
\usepackage{etoolbox}
\newcounter{emusage}
\setcounter{emusage}{0}
\pretocmd{\emph}{\stepcounter{emusage}}{}{} % increase emusage every time \emph is used

\begin{document}

one two \arabic{emusage} \emph{three} \arabic{emusage}
\end{document}

The document will typeset "one two 0 three 1"


text:
Q: HTTP 500 error That's odd... the website can't display this page I am trying to setup a web API but can't seem to get the API to work in IIS.
When I debug the default ASP .netCore API weatherforcast example from Visual Studio 2019 everything works locally as expected. But as soon as I publish the project and more it to the default webpage folder in IIS, I can't seem to be able to open the web interface any more and postman doesn't communicate with it any more as well, it is a windows 10 environment.
The Error that I get is : HTTP 500 error
That's odd... the website can't display this page
Any help would be much appreciated.


text:
Q: How to avoid "tex capacity exceeded" with several tikzset definitions Problem
I'm defining several .pic keys using tikzset to be consumed later on other libraries. However, when I'm using pdflatex, for example, I get a capacity exceeded error.
I just tested that using lualatex seems to be fine for the moment. However, I didn't want to restrict to just one program to compile the documents.
I was thinking if there is a way to define the keys dynamically, or not to process them all when reading the document, but loading them on demand. Or since the .pic definitions will be in the same document it will be impossible to avoid the error.
Any thoughts and suggestions are welcomed.
MWE
To get an idea of what I'm talking about, check the code below.
What I'm doing is to create several keys with svg on the .pic.
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{svg.path}

\tikzset{
  cog/.pic = {
    \fill[scale=0.004em] svg {M863.24,382.771l-88.759-14.807c-6.451-26.374-15.857-51.585-28.107-75.099l56.821-70.452c12.085-14.889,11.536-36.312-1.205-50.682l-35.301-39.729c-12.796-14.355-34.016-17.391-50.202-7.165l-75.906,47.716c-33.386-23.326-71.204-40.551-112-50.546l-14.85-89.235c-3.116-18.895-19.467-32.759-38.661-32.759h-53.198c-19.155,0-35.561,13.864-38.608,32.759l-14.931,89.263c-33.729,8.258-65.353,21.588-94.213,39.144l-72.188-51.518c-15.558-11.115-36.927-9.377-50.504,4.171l-37.583,37.61c-13.548,13.577-15.286,34.946-4.142,50.504l51.638,72.326c-17.391,28.642-30.584,60.086-38.841,93.515l-89.743,14.985C13.891,385.888,0,402.24,0,421.435v53.156c0,19.193,13.891,35.547,32.757,38.663l89.743,14.985c6.781,27.508,16.625,53.784,29.709,78.147L95.647,676.44c-12.044,14.875-11.538,36.312,1.203,50.669l35.274,39.73c12.797,14.382,34.028,17.363,50.216,7.163l77-48.37c32.581,22.285,69.44,38.664,108.993,48.37l14.931,89.25c3.048,18.896,19.453,32.76,38.608,32.76h53.198c19.194,0,35.545-13.863,38.661-32.759l14.875-89.25c33.308-8.147,64.531-21.245,93.134-38.5l75.196,53.705c15.53,11.155,36.915,9.405,50.478-4.186l37.598-37.597c13.532-13.536,15.365-34.893,4.127-50.479l-53.536-75.059c17.441-28.738,30.704-60.238,38.909-93.816l88.758-14.82c18.921-3.116,32.756-19.469,32.756-38.663v-53.156C895.998,402.24,882.163,385.888,863.24,382.771zM449.42,616.013c-92.764,0-168-75.25-168-168c0-92.764,75.236-168,168-168c92.748,0,167.998,75.236,167.998,168C617.418,540.763,542.168,616.013,449.42,616.013z};
  },
  monitor/.pic = {
    \fill[scale=0.01em] svg {M145.407,248.988l-2.775,26.209c-0.224,2.115,0.46,4.225,1.883,5.806c1.422,1.581,3.449,2.483,5.576,2.483h79.301c2.126,0,4.153-0.903,5.576-2.483c1.422-1.581,2.106-3.691,1.883-5.806l-2.775-26.209h98.777c15.374,0,27.881-12.507,27.881-27.881V27.881C360.733,12.507,348.225,0,332.852,0H40.63C25.256,0,12.749,12.507,12.749,27.881v193.226c0,15.374,12.507,27.881,27.881,27.881H145.407z M221.055,268.487h-62.629l2.064-19.499h58.5L221.055,268.487z M40.63,15h292.222c7.103,0,12.881,5.778,12.881,12.881V197.99H27.749V27.881C27.749,20.778,33.527,15,40.63,15z M27.749,221.107v-8.117h317.983v8.117c0,7.103-5.778,12.881-12.881,12.881H40.63C33.527,233.988,27.749,228.21,27.749,221.107z};
  },
  notepad/.pic = {
   \fill svg {M29.334,3H25V1c0-0.553-0.447-1-1-1s-1,0.447-1,1v2h-6V1c0-0.553-0.448-1-1-1s-1,0.447-1,1v2H9V1c0-0.553-0.448-1-1-1S7,0.447,7,1v2H2.667C1.194,3,0,4.193,0,5.666v23.667C0,30.806,1.194,32,2.667,32h26.667C30.807,32,32,30.806,32,29.333V5.666C32,4.193,30.807,3,29.334,3z M30,29.333C30,29.701,29.701,30,29.334,30H2.667C2.299,30,2,29.701,2,29.333V5.666C2,5.299,2.299,5,2.667,5H7v2c0,0.553,0.448,1,1,1s1-0.447,1-1V5h6v2c0,0.553,0.448,1,1,1s1-0.447,1-1V5h6v2c0,0.553,0.447,1,1,1s1-0.447,1-1V5h4.334C29.701,5,30,5.299,30,5.666V29.333z};
  },
}

\begin{document}

\begin{tikzpicture}
  \pic at (0,0) {cog};

  \pic at (2,0) {monitor};

  \pic at (4,0) {notepad};
\end{tikzpicture}

\end{document}

Current problems

*

*The library can be added if I use lualatex instead of pdflatex, regardless of the number of \pic in use. My assumption is that the memory runs out when it is trying to load all the definitions into memory.
Hence, I was wondering to get a dynamic way of loading or defining the pics.

*There is no malformation of the keys, since it compiles with lualatex.

A: After been thinking about the problem, I thought that if the problem is the huge file, I can divide it into several files.
My approach is to not define any key, and when the pic is going to be used, then I will load the particular file.
My solution is
\tikzset{
  /tikz/pics/.unknown/.code={%
    \let\currentname\pgfkeyscurrentname%
    \input{\currentname.tex}%
    \pgfkeysalso{\currentname/.try}%
  }
}

Simply, check if the pic is unknown and load the file. I was doing some conditional loading with \IfFileExists, but when it didn't I got strange errors where tikz was trying to parse the failure. And decided against it.
There seems to be a problem with the definition of the keys, since when you use the pic several times it loads the file again. It seems like the definition of the key is not persisting (not sure why).
(Any better or more clever solutions are still welcomed
Full Example
\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{svg.path}

\usepackage{filecontents}

\begin{filecontents}{cog.tex}
\tikzset{
  cog/.pic = {
    \fill[scale=0.004em] svg {M863.24,382.771l-88.759-14.807c-6.451-26.374-15.857-51.585-28.107-75.099l56.821-70.452c12.085-14.889,11.536-36.312-1.205-50.682l-35.301-39.729c-12.796-14.355-34.016-17.391-50.202-7.165l-75.906,47.716c-33.386-23.326-71.204-40.551-112-50.546l-14.85-89.235c-3.116-18.895-19.467-32.759-38.661-32.759h-53.198c-19.155,0-35.561,13.864-38.608,32.759l-14.931,89.263c-33.729,8.258-65.353,21.588-94.213,39.144l-72.188-51.518c-15.558-11.115-36.927-9.377-50.504,4.171l-37.583,37.61c-13.548,13.577-15.286,34.946-4.142,50.504l51.638,72.326c-17.391,28.642-30.584,60.086-38.841,93.515l-89.743,14.985C13.891,385.888,0,402.24,0,421.435v53.156c0,19.193,13.891,35.547,32.757,38.663l89.743,14.985c6.781,27.508,16.625,53.784,29.709,78.147L95.647,676.44c-12.044,14.875-11.538,36.312,1.203,50.669l35.274,39.73c12.797,14.382,34.028,17.363,50.216,7.163l77-48.37c32.581,22.285,69.44,38.664,108.993,48.37l14.931,89.25c3.048,18.896,19.453,32.76,38.608,32.76h53.198c19.194,0,35.545-13.863,38.661-32.759l14.875-89.25c33.308-8.147,64.531-21.245,93.134-38.5l75.196,53.705c15.53,11.155,36.915,9.405,50.478-4.186l37.598-37.597c13.532-13.536,15.365-34.893,4.127-50.479l-53.536-75.059c17.441-28.738,30.704-60.238,38.909-93.816l88.758-14.82c18.921-3.116,32.756-19.469,32.756-38.663v-53.156C895.998,402.24,882.163,385.888,863.24,382.771zM449.42,616.013c-92.764,0-168-75.25-168-168c0-92.764,75.236-168,168-168c92.748,0,167.998,75.236,167.998,168C617.418,540.763,542.168,616.013,449.42,616.013z};
  }
}
\end{filecontents}
\begin{filecontents}{monitor.tex}
\tikzset{
  monitor/.pic = {
    \fill[scale=0.01em] svg {M145.407,248.988l-2.775,26.209c-0.224,2.115,0.46,4.225,1.883,5.806c1.422,1.581,3.449,2.483,5.576,2.483h79.301c2.126,0,4.153-0.903,5.576-2.483c1.422-1.581,2.106-3.691,1.883-5.806l-2.775-26.209h98.777c15.374,0,27.881-12.507,27.881-27.881V27.881C360.733,12.507,348.225,0,332.852,0H40.63C25.256,0,12.749,12.507,12.749,27.881v193.226c0,15.374,12.507,27.881,27.881,27.881H145.407z M221.055,268.487h-62.629l2.064-19.499h58.5L221.055,268.487z M40.63,15h292.222c7.103,0,12.881,5.778,12.881,12.881V197.99H27.749V27.881C27.749,20.778,33.527,15,40.63,15z M27.749,221.107v-8.117h317.983v8.117c0,7.103-5.778,12.881-12.881,12.881H40.63C33.527,233.988,27.749,228.21,27.749,221.107z};
  }
}
\end{filecontents}
\begin{filecontents}{notepad.tex}
\tikzset{
  notepad/.pic = {
    \fill svg {M29.334,3H25V1c0-0.553-0.447-1-1-1s-1,0.447-1,1v2h-6V1c0-0.553-0.448-1-1-1s-1,0.447-1,1v2H9V1c0-0.553-0.448-1-1-1S7,0.447,7,1v2H2.667C1.194,3,0,4.193,0,5.666v23.667C0,30.806,1.194,32,2.667,32h26.667C30.807,32,32,30.806,32,29.333V5.666C32,4.193,30.807,3,29.334,3z M30,29.333C30,29.701,29.701,30,29.334,30H2.667C2.299,30,2,29.701,2,29.333V5.666C2,5.299,2.299,5,2.667,5H7v2c0,0.553,0.448,1,1,1s1-0.447,1-1V5h6v2c0,0.553,0.448,1,1,1s1-0.447,1-1V5h6v2c0,0.553,0.447,1,1,1s1-0.447,1-1V5h4.334C29.701,5,30,5.299,30,5.666V29.333z};
  }
}
\end{filecontents}

\tikzset{
  /tikz/pics/.unknown/.code={%
    \let\currentname\pgfkeyscurrentname%
    \input{\currentname.tex}%
    \pgfkeysalso{\currentname/.try}%
  }
}

\begin{document}

\begin{tikzpicture}
  \pic at (0,0) {cog};

  \pic at (2,0) {monitor};

  \pic at (4,0) {notepad};
\end{tikzpicture}

\end{document}


text:
Q: Attaching file to mail with outlook I've got a file (a btmap called secretimage) that I want to attach to a mail when the user hits a button. I'ld like to use Outlook for this.
So this is what I've done:
using Outlook = Microsoft.Office.Interop.Outlook;
private void cmdSend_Click(object sender, EventArgs e)
    {
            Outlook.Application app = new Outlook.Application();
            Outlook.MailItem mail = new Outlook.MailItem();
            Outlook.Attachment attach = mail.Attachments.Add(secretImage, Outlook.OlAttachmentType.olByValue, 0, "Secret message");
    }

Though this gives me the following error:
Retrieving the COM class factory for component with CLSID
{00061033-0000-0000-C000-000000000046} failed due to the following error: 80040154 Klasse nicht registriert (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
The last part is German, I don't know why, actually I've set the language to English. "Klasse nicht registriert" translates "Class not registered".
I tried to do what is recommended here:
Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154
Though that didn't work.
Can anyone help me here? I'm really stuck.

A: Try this swap out your mail item for this code, taken from this link.  80040154 Class not registered ERROR in Outlook 2010 Add In
Microsoft.Office.Interop.Outlook.MailItem mail= app.CreateItem((OlItemType.olMailItem));

One of the problems you are going to run into with this method is that Outlook has security measures in place where you have to allow for an application to send on your behalf. It will prompt and there is no way to default that answer without using some software written specifically to suppress that message and answer it for you. This is not ideal for sending emails. I would suggest either using Exchange Web services or allow for a machine to be SMTP and use the System.Net.Mail Namespace. How ever you can use this code I provided to do this and I have tested and it works.


text:
Q: How to change images in jlable automatically I am trying to display different  images in 3 different  jlables. There  is a folder with images in them. I have display the images in the jlable and the image has to change after 60 seconds. No matter  what I  try I  cannot  do it. Can somebody help me.

A: The simple answer is, use a Swing Timer, it allows you to schedule a callback in the future, which is delivered within the context of the Event Dispatching Thread, making it safe to update the UI from, for example...
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Test {

    public static void main(String[] args) {
        new Test();
    }

    public Test() {
        EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                    ex.printStackTrace();
                }

                JFrame frame = new JFrame("Testing");
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.add(new TestPane());
                frame.pack();
                frame.setLocationRelativeTo(null);
                frame.setVisible(true);
            }
        });
    }

    public class TestPane extends JPanel {

        private JLabel label;
        private File[] images;
        private int imageIndex;

        public TestPane() {
            setLayout(new BorderLayout());
            label = new JLabel();
            label.setHorizontalAlignment(JLabel.CENTER);
            label.setVerticalAlignment(JLabel.CENTER);
            add(label);
            images = new File("...").listFiles();
            imageIndex = -1;
            nextImage();
            Timer timer = new Timer(1000, new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    nextImage();
                }
            });
            timer.start();
        }

        protected void nextImage() {
            if (images.length > 0) {
                imageIndex++;
                if (imageIndex >= images.length) {
                    imageIndex = 0;
                }
                try {
                    BufferedImage image = ImageIO.read(images[imageIndex]);
                    label.setIcon(new ImageIcon(image));
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            }
        }

        @Override
        public Dimension getPreferredSize() {
            return new Dimension(400, 400);
        }

    }

}

Have a look at How to use Swing Timers for more details.
If your images are large or are coming from a slow service (like over the internet), you might consider using a SwingWorker instead, this allows you to perform long running or blocking operations in the background (off the EDT), but which are easier to synchronise updates back to the EDT with.  Have a look at Refresh Image in JLabel with Timer for more details


text:
Q: Elements move on hover because border is added, padding, as suggested elsewhere doesn't seem to work When I hover over an area on my testing website, I made it so a border is added. But because that happens, other elements move. I've looked up other posts, and they recommended adding padding, but that doesn't seem to work because it goes over other stuff.
This is where I add the border:
#logo:hover {
  border: 2px solid cyan;
}

This is what it was added to:
#logo {
    width: 200px;
    height: 200px;
    position: relative;
    top: 80px;
    line-height: 12em;
    border-radius: 200px;
    margin: 0 10px 0 10px;
    overflow: hidden;
}

Does anyone know how to help me? Also about the way I asked my question.

#logo {
    background-color: black;
    width: 200px;
    height: 200px;
    position: relative;
    top: 80px;
    line-height: 12em;
    border-radius: 200px;
    margin: 0 10px 0 10px;
    overflow: hidden;
}

#logo:hover {
  border: 2px solid cyan;
}

Greetings,
TheWombatGuru

A: You also can use box shadow:
 #logo{
    box-shadow: inset 0 0 0 1px cyan;
 }

 #logo:hover {
    box-shadow: inset 0 0 0 2px cyan;
 }

A: You may add:
* {  box-sizing: border-box;}

to your css sheet or maybe just to your #logo id.
you may find more info about this (for me at least amazing propertie ) here
(and just in case... the code marked applied the property to every html element in your web, which is exactly what I have been doing in my last many projects with absolutely no regret)

A: You should try adding this to your #logo :
border: 2px solid transparent;

which would make :
#logo {
width: 200px;
height: 200px;
position: relative;
top: 80px;
line-height: 12em;
border-radius: 200px;
margin: 0 10px 0 10px;
overflow: hidden;
border : 2px solid transparent;
}

Or using box-sizing: border-box
Hopes it helps !
Cheers !

A: You should add box-sizing: border-box to the pertinent element in your CSS. This will put the padding inside the width of the container.
Here is a codepen to demonstrate: http://codepen.io/himmel/pen/LVPPvg

A: Alternatively to box-sizing: border-box; you could also use the calc function to subtract a value.
#logo:hover {
    width: calc(200px - 4px);
    height: calc(200px - 4px);
    border: 2px solid cyan;
}

This method might be helpful when you are dealing with percentages, anyway it's a cool trick i situations like this.

A: box-sizing: border-box doesn't really make the 'circle' render correctly with the border in this case - although it is an amazing property. If it were me, I'd change your css to the following:
#logo:hover {
border-left: 3px solid cyan;
border-right: 3px solid cyan;
padding: 0;
margin: 0 6px 0 6px;
}

and adjust your #logo class margins to
{margin: 0 9px 0 9px;}

a little 'hackier', but I prefer the behaviour

A: Try adding border:1px solid transparent; to non hover element.

A: Try using position: absolute; because elements with position absolute have no effect on other elements. Make sure that the parent element has a position relative. For example
`
#parent-element {
position:relative;
}
#logo {
position:absolute;
}`


text:
Q: SharePoint user/Windows authentication w/asp.net How to read SP user using asp.net?
Is there any detailed example of how to read the current sharepoint user in asp.net that I could follow? and what information I can get about the current sharepoint user? does it include full name, department and email address?
I found this link on MSDN. However, I'm looking for something written in details of how to do this process since I'm new at using sharepoint.
I've also looked at previous stackoverflow questions but it wasn't sufficient.

A: Have a look at the SPContext object.
When you e.g. build a custom web part (for example, a Visual Web Part), you can retrieve the current user with SPContext.Current.Web.CurrentUser. It will give you an SPUser object, with details about the current person.
The SPUser object will return basic properties, like user name, display name, e-mail address, and so forth. If you want to retrieve all user profile properties (e.g. the user's interests he can enter in his profile), it will be a bit more complicated. You'll have to query the user profile service. Please have a look here for more information how to do this using the server side object model.


text:
Q: Angular close browser I would like to store what user does in my angular application.
So i already do this function when user logout or when user is inactive.
But now i would like to do the same action when user close directly the browser or directly the tab.
Currently it's working when user closes directly the tab.
But when user closes directly the browser nothing is happening.
here is my code when i close tab
    @HostListener('window:unload', ['$event']) {
     unloadHandler(event) {
     this.audit = this.setAudit(this.audit);
     this.auditService.add(this.audit).subscribe();
   }

Is someone have an idea when i close the browser (all tabs)?

A: You could use the window:beforeunload instead of the unload one:
@HostListener('window:beforeunload', ['$event']) {
     unloadHandler(event) {
     this.audit = this.setAudit(this.audit);
     this.auditService.add(this.audit).subscribe();
   }


text:
Q: socket.emit and socket.on is not connected I was adding a chat page in my existing express app using socket.io.
My server code :
var io = socket(server);
io.on('connection', (socket) => {
    console.log('made socket connection', socket.id);
    // Handle chat event
    socket.on('chat', function(data){
        console.log("second");
        io.sockets.emit('chat', data);
    });

});

and my client code :
var socket = io.connect("http://localhost:3000/chat")

//Query elements
var message = document.getElementById('message'),
    btn     = document.getElementById('send'),
    output  = document.getElementById('output');

btn.addEventListener("click", function(){
    socket.emit('chat', {
        message: message.value,
    });
    console.log("First")
    message.value = "";
})
socket.on('chat', function(data){
    console.log("final function")
    output.innerHTML += `<p>${data.message}</p>`;
});

socket.emit is fired on click in client side but socket.on in server doesn,t run.
Note : console.log('made socket connection', socket.id); run normally

A: there is an issue in your client side . you are trying to connecting with namsespaces "chat" , remove chat
var socket = io.connect("http://localhost:3000")


text:
Q: Code crashes when splitting the tokens using strtok by passing the string to function My code crashes when I try to split the tokens using strtok by passing the string to function. Here is my code:
    #define MAX_STRING_SIZE 256

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static void getTokens(char *s1 ,char *ct1  ,char ***pppcToks ,int *nTkns)
{
    char *s2 = NULL;
    char *cp = NULL;

    cp = strtok(s1, ct1);
    (*nTkns)++;

    *pppcToks = (char **) malloc(1 * sizeof(char *));
    (*pppcToks)[0] = (char *)malloc(MAX_STRING_SIZE * sizeof(char));
    (*pppcToks)[0] = cp;

    while (NULL != (cp = strtok(NULL, ct1)))
    {

        *pppcToks = (char **)realloc((void *)(*pppcToks), (*nTkns) * sizeof(char *));
        (*pppcToks)[(*nTkns)] = (char *)malloc(MAX_STRING_SIZE * sizeof(char));
        (*pppcToks)[(*nTkns)] = cp;
        printf("%s\n", (*pppcToks)[(*nTkns)]);
        (*nTkns)++;
    }
    printf("%d", *nTkns);

}

int main(int argc, char *argv[])
{
    char ac[MAX_STRING_SIZE] = "Strtok#should#be tested to an extent";
    int nTkns = 0,inx;

    char **ppcList = NULL;

    getTokens(ac, "#", &ppcList, &nTkns);

    for (inx =0; inx < nTkns; inx++)
    {
    printf("%s", ppcList[inx]); //Fails in second loop
    }
    for(;;);

}

The first token gets printed. Crash occurs while printing further. Also note that I am using C++ compiler to compile C code, as I don't have one for C as such.

A: Please find the working code:
#define MAX_STRING_SIZE 256

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

static void getTokens(char *s1 ,char *ct1  ,char ***pppcToks ,int *nTkns)
{
    char *cp = NULL;

     /* get the first token */
    cp = strtok(s1, ct1);
    (*nTkns)++;

    (*pppcToks) = (char **) malloc(1 * sizeof(char *));
    (*pppcToks)[0] = (char *)malloc((strlen(cp) + 1) * sizeof(char));
    strcpy((*pppcToks)[0], cp);

    /* walk through other tokens */
    while (NULL != (cp = strtok(NULL, ct1)))
    {
        (*nTkns)++;
        (*pppcToks) = (char **)realloc((void *)(*pppcToks), (*nTkns) * sizeof(char *));
        (*pppcToks)[*nTkns-1] = (char *)malloc((strlen(cp) + 1) * sizeof(char));
        strcpy((*pppcToks)[*nTkns-1], cp);
    }
}

int main(int argc, char *argv[])
{
    char ac[MAX_STRING_SIZE] = "Strtok#should#be tested to an extent";
    int nTkns = 0,i;

    char **ppcList = NULL;

    getTokens(ac, "#", &ppcList, &nTkns);

    for (i =0; i < nTkns; i++)
    {
    printf("%s\n", ppcList[i]);
    }
    for(;;);

}

Thanks all for your valuable suggestion!!


text:
Q: How to add some values in a dataframe in Scala Spark? Here is the dataframe I have for now, suppose there are totally 4 days{1,2,3,4}:
+-------------+----------+------+
| key         | Time     | Value|
+-------------+----------+------+
|  1          |        1 | 1    |
|  1          |        2 | 2    |
|  1          |        4 | 3    |
|  2          |        2 | 4    |
|  2          |        3 | 5    |
+-------------+----------+------+

And what I want is
+-------------+----------+------+
| key         | Time     | Value|
+-------------+----------+------+
|  1          |        1 | 1    |
|  1          |        2 | 2    |
|  1          |        3 | null |
|  1          |        4 | 3    |
|  2          |        1 | null |
|  2          |        2 | 4    |
|  2          |        3 | 5    |
|  2          |        4 | null |
+-------------+----------+------+

If there is some ways that can help me get this?

A: Say df1 is our main table:
+---+----+-----+
|key|Time|Value|
+---+----+-----+
|1  |1   |1    |
|1  |2   |2    |
|1  |4   |3    |
|2  |2   |4    |
|2  |3   |5    |
+---+----+-----+

We can use the following transformations:
val data = df1
  // we first group by and aggregate the values to a sequence between 1 and 4 (your number)
  .groupBy("key")
  .agg(sequence(lit(1), lit(4)).as("Time"))
  // we explode the sequence, thus creating all 'Time' per 'key'
  .withColumn("Time", explode(col("Time")))
  // finally, we join with our main table on 'key' and 'Time'
  .join(df1, Seq("key", "Time"), "left")

To get this output:
+---+----+-----+
|key|Time|Value|
+---+----+-----+
|1  |1   |1    |
|1  |2   |2    |
|1  |3   |null |
|1  |4   |3    |
|2  |1   |null |
|2  |2   |4    |
|2  |3   |5    |
|2  |4   |null |
+---+----+-----+

Which should be what you are looking for, good luck!


text:
Q: Wrong display of array cell I have problem with display the cell's content.
int *probki= new int[liczbaProbek];
for (int i=0; i<liczbaProbek; i++) probki[i]=rand()%2;
koder *mojKoder=new koder();
int *probki2=new int[liczbaProbek];
for (int i=0; i<liczbaProbek; i++)
{
    int X=mojKoder->koduj(probki[i]);
    cout<<X<< " MOJ X"<<endl;
    probki2[i]=X;
    cout<<probki[i]<<" -> "<<cout<<probki2[i]<<endl;
}

The X is integer (like tab). When the function is done then X has normal number but when I display the cell content theres a random numbers (probably address).
http://puu.sh/bNOH9/a99c4b9aca.png
Does anyone have an idea what is going on?

A: You are pushing cout to cout. This gives you the address of cout (I think). Change your output line to this:
cout << probki[i] << " -> " << probki2[i] << endl;


text:
Q: Tomcat(6) escapes text from beans before including it to resultig html When I get from MyBean some text, for example,
Hello world
 and include it into jsp via  jsp:getProperty in resulting html page it will be <p>Hello world</p>
I could guess that tomcat's team did this due to security reasons but it's not behaviour that I want to get.
Q:how to get needed behaviour?
UPD:
@Jörn Horstmann
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="xs" class="bean.XS" scope="application"></jsp:useBean>

  <title>Test</title>

  <c:out value="${xs.yoba}" escapeXml="true"/>

  <c:out value="${xs.yoba}" escapeXml="false"/>

  <c:out value="<p>HELLO WORLD</p>" escapeXml="true"/>

  <c:out value="<p>HELLO WORLD</p>" escapeXml="false"/>

Getter fun:
public String getYoba(){
    return "<p>HELLO WORLD</p>"  ;
}

Resulting html:

  <title>Test</title>

  &lt;p&gt;Год выпуска: 20 июля 2010&lt;/p&gt;

  <p>Год выпуска: 20 июля 2010</p>

  &lt;p&gt;HELLO WORLD&lt;/p&gt;

  <p>HELLO WORLD</p>

I want:

  <title>Test</title>

HELLO WORLD

A: You can use the jstl c:out tag with escapeXml set to false to solve this:
<c:out value="${myBean.property}" escapeXml="false"/>

Edit:
When your getter already returns escaped HTML you would have to first unescape it, for example using Apache Commons Lang StringEscapeUtils:
public String getYoba(){
    return StringEscapeUtils.unescapeHtml("<p>HELLO WORLD</p>");
}


text:
Q: Make `envsubst` fail if a variable is not defined I have a file with a large number of variables in it.
$ cat message.txt
Hello, ${LOCATION}! You too, ${PERSON} ;)

If PERSON is not defined, envsubst replaces it with nothing:
$ LOCATION=World envsubst < message.txt
Hello, World! You too,  ;)

How can I make envsubst fail with a non-zero exit code (or something reliable) if any of the many environment variables in the file isn't defined?

A: You can easily to the equivalent in perl where you can exit with an error if the env var is not defined:
perl -pe 's{\$(?|\{(\w+)\}|(\w+))}{$ENV{$1} // die "$& not defined\n"}ge'

A: This is not ideal, in that it doesn't alter the behaviour of envsubst as requested, but it is able to identify unset variables.  The user must ensure that the delimiter EOF does not appear in the text.  If it does, then choose a different delimiter.
#!/usr/bin/env bash

msg="$( printf 'cat << EOF\n%s\nEOF\n' "$(cat)" )"

bash -u <<< "$msg"

Output:
$ ./test.sh < message.txt || echo fail
bash: line 1: LOCATION: unbound variable
fail
$ LOCATION=World ./test.sh < message.txt || echo fail
bash: line 1: PERSON: unbound variable
fail
$ LOCATION=World PERSON=Ralph ./test.sh < message.txt || echo fail
Hello, World! You too, Ralph ;)

Here is a lengthier version which will list all the unset variables in one go, instead of disclosing them one at a time:
#!/usr/bin/env bash

check_vars() {

# pass a list of variable names on stdin, one to a line

rc=0

while read v
do
        if [[ ! "${!v}" ]]
        then
                printf '%s\n' "$v"
                rc=1
        fi
done

return $rc

}

envsubst -v "$(cat)" | check_vars

This version will output a list of unset (or null) variables, one to a line, and exit with 0 if and only if the list is empty.
Output:
$ ./test2.sh < message.txt || echo fail
LOCATION
PERSON
fail
$ PERSON=Ralph ./test2.sh < message.txt || echo fail
LOCATION
fail
$ LOCATION=World ./test2.sh < message.txt || echo fail
PERSON
fail
$ LOCATION=World PERSON=Ralph ./test2.sh < message.txt || echo fail
$


text:
Q: how to package html outside epub reading flow I have an epub3 book containing lengthy data tables. I use a thumbnail image of these tables with a link to the actual html file (the html files are included in the manifest).
When I click the link to display the html table itself; the ereader displays the table, but when I click the back button the reader goes the end of the book and seems to have lost its place in the navigation.
How can I fix this so the back button works as expected?
I'm using Readium and Calibre.

A: The issue isn't your ePub file: it's the fact that the Readium interface doesn't render books like a typical web page... So the back button on your browser won't behave correctly.
The best solution I have found is to create your own back button using an inline link:
Go Back
This will take you back to the targeted element in the specified chapter!


text:
Q: Trying to Load Data from Excel into SQL Server. 32-bit Excel and 64-bit SQL Server Throws Error I've tried a few different ways to load data from Excel into SQL Server, as shown here:
Use [TestDatabase]

SELECT *
INTO dbo.tbl_SST_Personnel
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
       'Excel 12.0 Xml;HDR=YES;Database=C:\Users\rshuell001\Desktop\DATA - INPUT FILES\STT_Personnel.xlsx',
       'SELECT * FROM [tbl_SST_Personnel]')
GO

insert into OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\Users\rshuell001\Desktop\DATA - INPUT FILES\STT_Personnel.xlsx;', 'SELECT * FROM [tbl_SST_Personnel]')

select * from tbl_SST_Personnel

Insert into tbl_SST_Personnel
    Select *
    FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Users\rshuell001\Desktop\DATA - INPUT FILES\STT_Personnel.xlsx;HDR=YES', 'SELECT * FROM [tbl_SST_Personnel]')

I keep getting this error message for the first 2 scripts.

Msg 7438, Level 16, State 1, Line 13
  The 32-bit OLE DB provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server.

The 3rd script throws this error:

Msg 7302, Level 16, State 1, Line 14
  Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

Any idea how I can get this working?
Thanks to all.

A: There is no way you can invoke a 32-provider from 64-bit SQL Server or vice versa.

So, you have any of these options:

*

*64-bit Office

*32-bit SQL Server 2008

*32-bit SQL Server 2012

But, personally, I'm really not a fan to import the excel file data into SQL server table by using T-SQL.
In the real world, the SSIS is far more flexible to handle the Excel file import than T-SQL. If you are using the SSIS to import the data from Excel to SQL server, then it is no problem that if you have a 32- bit Office and 64-bit SQL server.
You can run the SSIS in a 32-bit debugging mode of setup an SQL agent job to run the SSIS job in 32-bit mode.


text:
Q: How can I set up an iOS compatible network pdf printer? I would like to have the ability to generate pdfs from the applications on iPad and iPhone that are print capable.
What I am asking for here is an object that would appear as a printer in OS X, but is actually set up as a virtual printer, a bit of software that anything that can print sees exactly as a printer, that can be shared over a local network and will list in any apps on any iOS devices that are currently running print-capable apps.
Simply put: how do I set up a local network pdf printer for iPad?
I need this to work with iOS5 and Mac OS X 10.6 Snow Leopard.

A: 1 - Install PDFwriter (free). It will allow you to add a new printer in Settings > Printer & Scanners > + button. When you print using this new printer, it will generate a PDF file under /Users/Shared/[username]/
2 - Install handyPrint (donationware). It will allow you to share the virtual PDF printer with the mobile devices.
You might need to disable or create a custom rule on the Mac's firewall so that the devices will find the printer. Change this under Settings > Security & Privacy > Firewall.
PS: I have only used on Mavericks and iOS 6, but I'm 97,21% sure it will work on Snow Leopard and iOS 5.
PPS: There might be similar programs to acomplish this, you don't really need these ones. If you want to see alternatives, search for "virtual printer mac".


text:
Q: How can I control lights with HTTP requests? I've just started with Node Red and am attempting to integrate it with an older Smart Home system I made for controlling lights. The old system is just an arduino with an Ethernet shield that accepts http requests to control a bunch of relays, with separate http requests for on and off control of each light.
Is there a way to add a virtual light in node red that when turned "on" sends one http request, and when shut "off" sends a different request? I already have Alexa set up and working and I can toggle the "device" on and off, but I don't know how to link the alexa "device" to a virtual light of some sort.

A: Just use a http-request node, you can control what url it accesses by setting the msg.url property on the input message.
You can set this property with either a function node or a change node based on the input from the alexa node.


text:
Q: Is there a particular way to access the members of ChildViewController into ViewController, used else ways other than in function prepare(for: segue)? Encountered logical problem while making a basic iOS application which demands 'ContainerView'.
Added a label into the ChildView and named the label timerGaugeLabel.
@IBOutlet weak var timerGaugeLabel: UILabel!

(Unable to access the member into the ViewController class)
Used the function prepare(for : segue) and created the instance for segue locally inside the function.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "ChildViewControllerSegue" {
            let childViewController = segue.destination as! ChildViewController
                    }
    }

(The data member timerGaugeLabel is accessible within the function but, not globally inside the ViewController.swift file)


text:
Q: При дублировании таблицы не срабатывает javascript pta-ua.com
Необходимо сделать 2 рейтинга на сайте. Один среди парных игроков, другой среди одиночных. Сейчас рейтинг работает автоматически, при смене значения количества очков игрок автоматически поднимается выше.
Когда я копирую этот же html код с теми же данными и дублирую , скрипт перестает работать. Сортирует только тот, который выше в коде.
Вот js код

$(document).ready(function()
 {
  $("#myTable").tablesorter( {sortList: [[2,1], [0,0]]} );
  $("#myTable").tablesorter( {debug:false} );
 $('table').tablesorter({ headers: { 0: { sorter: false}, 1: {sorter: false} } });
}
);
 $(function() {
    // add new widget called indexFirstColumn
    $.tablesorter.addWidget({
        // give the widget a id
        id: "indexFirstColumn",
        // format is called when the on init and when a sorting has finished
        format: function(table) {
            // loop all tr elements and set the value for the first column
            for(var i=0; i < table.tBodies[0].rows.length; i++) {
                $("tbody tr:eq(" + i + ") td:first",table).html(i+1);
            }
        }
    });

    $("table").tablesorter({
        widgets: ['zebra','indexFirstColumn']
    });
    var button = document.getElementById('showAll');
    table = document.getElementById('myTable');

button.addEventListener('click', function() {
  // Проверяем на наличие класса и  вызываем соответсвуюущую функцию
  table.classList.contains('opened') ? hideRows()  : showRows();
});

function showRows() {
  table.classList.add('opened');
  button.innerHTML = 'Скрыть';
}
function hideRows() {
  table.classList.remove('opened');
  button.innerHTML = 'Показать весь рейтинг';
}
});
HTML код

              №
              Фамилия Имя
              Очки

              1
              Фамилия Имя
              524

              2
              Фамилия Имя
              119

              3
              Фамилия Имя
              263


text:
Q: Prevent auto import of PowerShell modules in Azure Automation Runbook I have an Azure Automation PowerShell runbook that calls particular child runbooks based on input parameters. The child runbooks perform actions with different PowerShell modules. I believe Azure Automation is automatically loading/importing the required modules at the moment the child runbook is called. I would like to prevent this behaviour, and import modules manually using import-module.
In an Azure Automation account, is it possible to control if/when required modules are imported?

Edit:
Microsoft documentation outlining conditions where modules are imported.

A: This behavior, in Powershell, is controlled by one of the preference variables. More specifically, the $PSModuleAutoloadingPreference variable.
This variable control the automatic importing of module in the session.
By default, it is set to All, which automatically import modules on first-use.
Set this to None to disable the automatic importing of modules. You will need to explicitely use Import-Module for any command to be loaded.
Here's a snippet of the official documentation regarding preferences variiables and that variable specifically.

About Preference Variables

PowerShell includes a set of variables that enable you to customize
its behavior. These preference variables work like the options in
GUI-based systems.
The preference variables affect the PowerShell operating environment
and all commands run in the environment. In many cases, the cmdlets
have parameters that you can use to override the preference behavior
for a specific command.

...

$PSModuleAutoloadingPreference
Enables and disables automatic importing of modules in the session.
All is the default. To import a module, get or use any command in the
module. For example, use Get-Command. The
$PSModuleAutoloadingPreference variable does not exist by default. The
default behavior when the variable is not defined is the same as
$PSModuleAutoloadingPreference = 'All'.
Regardless of the variable's value, you can use Import-Module to
import a module.
The $PSModuleAutoloadingPreference variable takes one of the
PSModuleAutoLoadingPreference enumeration values: None,
ModuleQualified, or All.
Valid values are:

*

*All: Modules are imported automatically on first-use.

*ModuleQualified: Modules are imported automatically only when a user uses the module-qualified name of a command in the module. For
example, if the user types MyModule\MyCommand, PowerShell imports the
MyModule module.

*None: Automatic importing of modules is disabled in the session. To import a module, use the Import-Module cmdlet.

Source: about_Preference_Variables


text:
Q: Finding the equation of displacement How to find equation of displacement when you know the equation of velocity. And the finding the constant when you know that at t=0 displacement is 2?

A: If you have the velocity in terms of time
$$
v(t) = \frac{dx}{dt}
$$
you can integrate
$$
x(t) - x(0) = \int\limits_0^t v(\tau) d\tau
$$


text:
Q: Change cursor in Windows Store Apps I'm making a Windows Store app in C# and I have a normal TextBlock with a link inside it. And all I want to do it to make the cursor change into a hand when it goes over the text block, but unlike in WPF applications, there is no Cursor propriety. I know is a CoreCursor class in Windows.UI.Core. Am I suppose to use it somehow?

A: Window.Current.CoreWindow.PointerCursor =
    new Windows.UI.Core.CoreCursor(Windows.UI.Core.CoreCursorType.Hand, 1);

A: WinRT XAML Toolkit has an attached property that works just about the same as the Cursor property in WPF in that you set a cursor for an element and so when your mouse cursor hovers on top of that element - the cursor changes to what the property specifies and when it leaves control bounds - it restores the previous cursor. There are actually two properties - one called FrameworkElementExtensions.SystemCursor that takes any standard cursor from the CoreCursorType enum, which you just use like in this sample page - set
<Border
    xmlns:Extensions="using:WinRTXamlToolkit.Controls.Extensions"
    Extensions:FrameworkElementExtensions.SystemCursor="Cross"/>

The other one - FrameworkElementExtensions.Cursor allows you to set any custom cursor, but I believe you'd need to set it in code behind like FrameworkElementExtensions.SetCursor(myElement, myCursor); or bind to a cursor property set elsewhere.
You can also use custom cursors. You need to define a cursor in a native resource library as described in this article and then you should be able to set them either globally by setting the Window.Current.CoreWindow.PointerCursor property or with an attached property like my FrameworkElementExtensions.Cursor.


text:
Q: Give text width priority over max-width divs while keeping wrapping behavior With the following code:

        Hello Multiple words

The text will wrap to max space space for the left and right divs:

How do I tell the text to take maximum available width so it won't wrap in this case like so:

The goal is not to use whitespace:nowrap, so the text will actually wrap if the parent div doesn't have space. In this case the left and right divs should be treated as 'spare space' that should be taken by the text as needed.


text:
Q: Using SwiftUI to annotate an overlay with existing content shown beneath Path view I have a SwiftUI app where some content is presented to the user, and then the user will annotate over it with a Path view.
The issue I have is that when I use a clear background for the drawing view, or no background at all, the content beneath it will appear as desired, but the gesture changes for the drawing action do not register.
If however, I assign a non-clear color for the background, then the gesture changes register and the drawing appears.
FWIW, I was able to achieve the desired effect using a UIKit based interface, and would just like to recreate it with SwiftUI now.
The simplified code below is a complete example that demonstrates my predicament. This is just an approximation of the code in use, so it's not exactly production quality.
By changing backgroundColor to clear or by commenting out the .background(self.backgroundColor) line, the BackgroundView will now appear, but onChanged does not get called, so no ink will appear.
If I run as is, then the ink will appear, but I cannot see the BackgroundView.
import SwiftUI

struct ContentView: View {
    var body: some View {
        GeometryReader { geometry in
            ZStack {
                DrawingView(backgroundColor: .white,
                            geometry: geometry)
                    .zIndex(1)

                BackgroundView()
            }
        }
    }
}

struct DrawingView: View {
    let backgroundColor: Color
    let geometry: GeometryProxy

    @State private var points = [CGPoint]()

    var body: some View {
        Path { path in
            guard !points.isEmpty else  { return }

            for index in 0..<points.count - 1 {
                path.move(to: points[index])
                path.addLine(to: points[index + 1])
            }
        }
        .stroke(Color.red, lineWidth: 3.0)
        .background(self.backgroundColor)
        .gesture(DragGesture(minimumDistance: 0.1)
        .onChanged({ changeValue in
            print("onChanged called")
            self.points.append(changeValue.location)
        }))
    }
}

// Just a simple View to fill the background
struct BackgroundView: View {
    var body: some View {
        Color.black
            .edgesIgnoringSafeArea(.all)
    }
}

A: Instead of background use .contentShape as
.stroke(Color.red, lineWidth: 3.0)
.contentShape(Rectangle())                    // << here !!
.gesture(DragGesture(minimumDistance: 0.1)
.onChanged({ changeValue in